CLI commands
ak sessions redact
Dry-run credential redaction for Claude Code session JSONL files
ak sessions redact
Dry-run credential redaction for Claude Code session JSONL files
Synopsis
What it does: 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.
Examples: ak sessions redact --json ak sessions redact --project myapp --session 550e8400 --json ak sessions redact --project myapp --apply --yes --json
What changes on disk: Dry-run is read-only. Apply snapshots each affected session root, then rewrites changed JSONL files via temp-file + rename.
Output modes: pretty default on TTY (colors, ASCII markers) plain auto when stdout piped or --no-interactive json --json (single-object envelope, NDJSON-safe)
Exit codes: 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
ak sessions redact [flags]Options
--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 promptsSEE ALSO
- ak sessions - Inspect and maintain local coding-agent sessions