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 tail

Stream appended session messages

Follows one Claude Code session JSONL file and prints messages appended after tail starts.

Who it's for: AI agents, CI monitors, and developers that need a live CLI equivalent of the desktop Sessions stream.

When to use it: Use while Claude Code is actively writing to a session file. Use Ctrl-C or cancel the process to stop.

What changes on disk: Read-only. Tails the selected ~/.claude session JSONL file.

Usage

ak sessions tail <project> <session-id> [flags]

Examples

ak sessions tail myapp session-abc
ak sessions tail myapp session-abc --json

Flags

FlagDescription
-h, --helphelp for tail
--jsonEmit machine-readable JSON (implies --no-interactive)
--no-interactiveDisable interactive prompts (CI-safe)
-q, --quietSuppress non-error output on stderr
-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)
  • ak sessions — Inspect and maintain local coding-agent sessions

On this page