CLI
In early access, Postrun's commands are pnpm scripts run from the root of a checkout. Each one forwards its flags to a script in the core package. This page lists every command, its flags, and the environment variables it reads.
| Command | What it does |
|---|---|
pnpm capture | Record Claude Code and Cline sessions as they happen. |
pnpm capture:cc:setup | Configure Claude Code for recording, and nothing else. |
pnpm ingest | Build sessions from capture files and write them to the store. |
pnpm sessions | List stored sessions. |
pnpm delete | Delete one session for good. |
pnpm serve | Build the review app and serve it with the store. |
pnpm export | Write one session as a redacted HTML report. |
pnpm adapter:cc, pnpm adapter:cline | Print a session's steps as JSON, without storing them. |
pnpm dev:core, pnpm dev:ui | Run the server and the review app for development. |
Every command runs inside the core/ folder of the checkout, so a relative path you pass (to --db, -o, or a capture folder) is resolved from core/, not from where you typed the command. Use absolute paths or ~ paths.
pnpm capture
pnpm capture
pnpm capture --once
Without flags, it runs until you press ctrl-c:
- Checks
~/.claude/settings.jsonand applies Postrun's Claude Code configuration if it is missing or out of date (seepnpm capture:cc:setup). If it is already present, it logsclaude-code config: already present in <path>. - Starts the OTLP receiver on
127.0.0.1:4318. - Sorts Claude Code's hook log into one folder per session and writes each session to the store on every
StopandSessionEnd, after a 4 second pause. On start it catches up on every session it missed, and removes a session's raw files 24 hours after the session goes quiet (the store keeps everything). - Watches
~/.cline/data/sessions, writes new or changed Cline sessions on start, and rewrites a session at least 2 seconds after its files change.
Both are paced so a busy session costs about 1% of one CPU core at most: a very long session is refreshed less often rather than costing more.
| Flag | Effect |
|---|---|
--once | Skip the configuration step and the receiver. Catch up on every Claude Code and Cline session not yet stored, then exit. |
| Variable | Default |
|---|---|
POSTRUN_CAPTURE_DIR | ~/.postrun/captures |
POSTRUN_CLINE_DIR | ~/.cline/data/sessions |
POSTRUN_OTLP_PORT | 4318 |
POSTRUN_DB | ~/.postrun/postrun.db |
POSTRUN_CLAUDE_SETTINGS | ~/.claude/settings.json |
POSTRUN_KEEP_CAPTURES | unset. Set to 1 to keep each session's raw files instead of removing them 24 hours after it goes quiet. |
Every log line starts with the time, for example [22:14:03] otlp receiver on http://127.0.0.1:4318 (127.0.0.1 only) -> ....
pnpm capture:cc:setup
pnpm capture:cc:setup
Merges Postrun's env vars and six hooks into ~/.claude/settings.json and prints a one-line summary of what changed. Backs the file up once to settings.json.postrun-backup, keeps every other setting, and never duplicates its own entries, so it is safe to run again. Reads POSTRUN_CAPTURE_DIR, POSTRUN_OTLP_PORT and POSTRUN_CLAUDE_SETTINGS. See Claude Code for exactly what it writes.
pnpm ingest
pnpm ingest --agent claude-code [<captures-dir>] [--session <id>] [--db <path>]
pnpm ingest --agent cline <session-id | session-dir | messages.json> [--db <path>]
Builds sessions from an agent's files and writes them to the store. Every write is an upsert, so re-ingesting is safe.
| Flag | Effect |
|---|---|
--agent <kind> | claude-code (the default) or cline. Any other value is an error. |
--session <id> | Claude Code only: ingest this one session. Without it, every session in the folder is ingested (each sessions/<id>/ folder, or every session in a folder of shared log files). |
--db <path> | Write to this store instead of POSTRUN_DB or ~/.postrun/postrun.db. |
The positional argument:
- For
claude-code, a captures folder. Defaults to~/.postrun/captures. - For
cline, required: a session id (looked up in~/.cline/data/sessions), a session folder, or a<id>.messages.jsonfile.
Output, one line per session and a total:
ingested claude-code session 3ac04cde-...: 112 steps, 9 turns, 1 segments, 1 actors -> /home/you/.postrun/postrun.db
store totals: sessions=4 segments=4 actors=4 turns=31 steps=402
The first word is updated when the session was already in the store.
pnpm sessions
pnpm sessions [--agent <kind>] [--db <path>]
Lists stored sessions, newest first. For each: start time, agent, id and workspace; then step counts by type, turns, failed, reference-only and flag counts, and cost; then the first line of the first prompt.
| Flag | Effect |
|---|---|
--agent <kind> | Only sessions from this agent kind. |
--db <path> | Read this store. |
Prints no sessions in <path> when the store is empty.
pnpm delete
pnpm delete <session-id>
pnpm delete <session-id> --yes
Without --yes, prints what would be deleted (agent, title, step count, and the raw capture folder if there is one) and changes nothing. With --yes, deletes the session from the store with secure delete on, removes its raw capture files, and keeps its id so the recorder never records it again. Get the id from pnpm sessions.
It does not touch the agent's own copy under ~/.claude/projects or ~/.cline/data/sessions, and says so. If the id is unknown it exits with an error, or says the session was already deleted.
| Flag | Effect |
|---|---|
--yes | Delete, instead of only showing what would go. |
--db <path> | Use this store. |
The review app's Delete button does the same. See Deleting a session.
pnpm serve
pnpm serve [--port <n>] [--db <path>] [--ui <dir>]
Builds the review app, then serves it and the API on 127.0.0.1. Runs until ctrl-c. The host is always 127.0.0.1 and cannot be changed.
| Flag | Effect |
|---|---|
--port <n>, -p <n> | Port, 1 to 65535. The flag wins over the PORT variable, which wins over the default, 1234. |
--db <path> | Store to serve. The flag wins over POSTRUN_DB, which wins over ~/.postrun/postrun.db. |
--ui <dir> | Folder holding the built review app. Default apps/ui/out in the checkout. |
--help, -h | Print usage. |
| Variable | Effect |
|---|---|
PORT | Port, when --port is not given. |
POSTRUN_DB | Store path, when --db is not given. |
POSTRUN_INGEST_TOKEN_FILE | Path of the ingest token file. Default ~/.postrun/ingest-token. Created on first start. |
pnpm export
pnpm export <session-id> [-o <file>] [--force] [--db <path>]
Writes one redacted, self-contained HTML report and lists every value it masked. Redaction cannot be switched off.
| Flag | Effect |
|---|---|
-o <file>, --out <file> | Output path. Default postrun-<agent>-<date>-<short id>.html, resolved from core/. |
--force, -f | Overwrite an existing file. |
--db <path> | Read this store. |
--help, -h | Print usage. |
The file is written with mode 0600. See Exporting and redaction.
pnpm adapter:cc and pnpm adapter:cline
pnpm adapter:cc <captures-dir> [session-id] > steps.json
pnpm adapter:cline <session-id | session-dir | messages.json> > steps.json
Run an adapter on its own: the session's steps go to stdout as a JSON array, and a one-line summary goes to stderr. Nothing is written to the store. Useful for checking how an agent's files are read.
Point adapter:cc at one session's folder, ~/.postrun/captures/sessions/<id>. Given a folder of shared log files that holds several sessions, it needs the session id; the error lists the ids it found.
pnpm dev:core and pnpm dev:ui
pnpm dev:core # the server on 127.0.0.1:1234, serving the last built UI (no build step)
pnpm dev:ui # Next dev server on 127.0.0.1:3000, with /api proxied to 127.0.0.1:1234
dev:core takes the same flags as pnpm serve. dev:ui reads UI_PORT for its own port and POSTRUN_CORE_URL for the server it proxies to.
Workspace commands
pnpm typecheck # every package
pnpm test # every package
pnpm build # every package
Exit codes
| Code | Meaning |
|---|---|
0 | Success. |
1 | The command failed: for example, the port is in use, the session was not found, the output file exists, or setup could not write settings.json. |
2 | Bad usage: an unknown flag, a missing value, an invalid port, or an unknown --agent. |
Errors go to stderr, prefixed with the command, such as postrun serve:, postrun store:, postrun capture: or postrun export:.