ReferenceCLI commands
BetaYou are reading docs for the beta channel (
2.4.1-beta.1) — updated automatically on every beta release.Switch to stable →CLI commands
ak sessions redact
Dry-run credential redaction for Claude Code session JSONL files
Scans registered Claude Code session JSONL files and redacts known credentials. Detection is best-effort and intentionally pattern-based. Default mode is dry-run. Apply requires both --apply and --yes.
Who it's for: Users preparing local session evidence for sharing or review.
When to use it: Run before attaching Claude Code transcripts to issues, PRs, or support reports.
What changes on disk: Dry-run is read-only. Apply snapshots each affected session root, then rewrites changed JSONL files via temp-file + rename.
Usage
ak sessions redact [flags]Examples
ak sessions redact --json
ak sessions redact --project myapp --session 550e8400 --json
ak sessions redact --project myapp --apply --yes --jsonFlags
| Flag | Description |
|---|---|
--apply | Rewrite changed session files after taking a session-root backup |
-h, --help | help for redact |
--json | Emit machine-readable JSON (implies --no-interactive) |
--no-interactive | Disable interactive prompts (CI-safe) |
--project stringArray | Project name to scan; repeatable |
-q, --quiet | Suppress non-error output on stderr |
--redact-emails | Also redact email addresses |
--session stringArray | Session ID to scan; repeatable |
-V, --verbose | Extra diagnostic output on stderr (loses to --quiet) |
-y, --yes | Assume yes for all prompts |
Output modes
| Mode | Behavior |
|---|---|
pretty | default on TTY (colors, ASCII markers) |
plain | auto when stdout piped or --no-interactive |
json | --json (single-object envelope, NDJSON-safe) |
Exit codes
| Code | Meaning |
|---|---|
0 | success |
1 | runtime error |
2 | invalid flags |
3 | user-cancel (SIGINT, prompt-cancel) |
1 | scan or rewrite failed |
2 | invalid flags or --apply without --yes |
Related commands
ak sessions— Inspect and maintain local coding-agent sessions