AgentKit
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 --json

Flags

FlagDescription
--applyRewrite changed session files after taking a session-root backup
-h, --helphelp for redact
--jsonEmit machine-readable JSON (implies --no-interactive)
--no-interactiveDisable interactive prompts (CI-safe)
--project stringArrayProject name to scan; repeatable
-q, --quietSuppress non-error output on stderr
--redact-emailsAlso redact email addresses
--session stringArraySession ID to scan; repeatable
-V, --verboseExtra diagnostic output on stderr (loses to --quiet)
-y, --yesAssume yes for all prompts

Output modes

ModeBehavior
prettydefault on TTY (colors, ASCII markers)
plainauto when stdout piped or --no-interactive
json--json (single-object envelope, NDJSON-safe)

Exit codes

CodeMeaning
0success
1runtime error
2invalid flags
3user-cancel (SIGINT, prompt-cancel)
1scan or rewrite failed
2invalid flags or --apply without --yes
  • ak sessions — Inspect and maintain local coding-agent sessions

On this page