Skip to content

Latest commit

 

History

History
2187 lines (1278 loc) · 104 KB

cli-and-config.md

File metadata and controls

2187 lines (1278 loc) · 104 KB

CLI and config reference

This page lists every playbook command, flag and config key. It is generated from the clap definitions and the config key table, and a test fails when it is out of date. For what each key means and when to change it, read the config keys page. For one line per command and who may run it, run playbook commands.

Config keys

Set a key with playbook config set <key> <value> and read it with playbook config get <key>.

Key Default Allowed values
pr.review.enabled true true, false
pr.review.type auto quick, deep, auto
pr.review.fix false true, false
pr.merge.enabled false true, false
commit.signOff true true, false
commit.aiMessage true true, false
handoff.onClear false true, false
pr.draft true true, false
pr.rules default default, warn, off
pr.ticketPatterns ["[A-Z][A-Z0-9]+-[0-9]+"] see the config keys page
worktree.cleanup.enabled true true, false
mode ask ask, auto
effort.max auto auto, low, medium, high, xhigh, max
effort.auto off off, suggest, on
memory.source both both, playbook
models.haiku empty empty, or claude-<tier>-<major>[-<minor>] for that tier
models.sonnet empty empty, or claude-<tier>-<major>[-<minor>] for that tier
models.opus empty empty, or claude-<tier>-<major>[-<minor>] for that tier
routing.escalate auto ask, auto, deny
auto.budget.mainUsd 200 a number, see the config keys page for the range
auto.budget.agentUsd 50 a number, see the config keys page for the range
auto.budget.ceilingUsd 0 a number, see the config keys page for the range
gate.maxRounds 5 a number, see the config keys page for the range
fix.maxFiles 3 a number, see the config keys page for the range
fix.maxLines 500 a number, see the config keys page for the range
security.defaults false true, false
usage.theme default default, spectrum, dark, light, mono
usage.maskAccount false true, false
usage.weekStart monday monday, sunday, saturday
usage.timeZone local local, utc
usage.telemetry auto auto, off
usage.toolDetails true true, false
usage.priceRefresh auto auto, off
usage.budget.monthlyUsd 0 a number, see the config keys page for the range
usage.budget.weeklyUsd 0 a number, see the config keys page for the range
usage.ui.layout empty see the config keys page
usage.ui.state empty see the config keys page
sessions.autoClose off off, propose, auto
hygiene.enabled true true, false
docs.convert auto auto, off
docs.anydocPath empty see the config keys page
launcher.shortName false true, false
systemPrompt.enabled true true, false
attribution.enabled false true, false
hooks.proseLint.mode warn warn, block, off
hooks.policyGuard.enabled false true, false
upgrade.mode notify notify, auto, off
upgrade.plugin auto auto, ask, off
watch.enabled false true, false
watch.repos [] see the config keys page
watch.autonomy propose off, propose, auto
watch.pollSeconds 60 a number, see the config keys page for the range
watch.catchup.maxHours 72 a number, see the config keys page for the range
watch.allowedAuthors [] see the config keys page
watch.tokenEnv empty see the config keys page
watch.limits.dailyActions 50 a number, see the config keys page for the range
watch.limits.dailyUsd 5 a number, see the config keys page for the range
gc.enabled true true, false
effort.agents.<name>, effort.commands.<name>, effort.skills.<name> auto auto, low, medium, high, xhigh, max
watch.rule.<id> empty one rule as JSON text

Commands

playbook

Configure and support Claude Code from the command line.

playbook installs hooks and a session launcher, shows the Agent Budget Dashboard, and helps with PRs, reviews, worktrees and session handoffs.

Subcommands: adr, agents, atlassian, cc, ccd, ci, code, commands, commit, completions, config, deps, doc, doctor, effort, eval, gate, gc, glossary, handoff, hooks, learn, manifest, memory, migrate, mode, path, plan, plugin, pr, prose, review, route, sanitize, segment, sessions, settings, setup, skills, state, statusline, sync, tools, trust, uninstall, upgrade, usage, version, watch, worktree

playbook adr

Work with ADRs, such as the next free record number

Subcommands: next

playbook adr next

Print the next ADR number and today's date

Creates docs/adr in the repo if it is missing. Prints Next number: NNNN Date: YYYY-MM-DD.

playbook agents

Check that agent definition files follow the playbook rules

Subcommands: check

playbook agents check

Check every agent definition follows the agent rules

Exits 0 when all pass and 1 otherwise.

  • <AGENTS_DIR>: Directory of agent definitions. Defaults to plugins/playbook/agents in the repo, else agents at the repo root

playbook atlassian

Check the Atlassian tools the playbook:atlassian skill uses

Subcommands: check

playbook atlassian check

Check the acli version and whether twg is installed

Prints one line for acli (ok, too old with the brew upgrade atlassian/acli/acli hint, version unreadable or missing) and one for twg. Exits 0 when acli is usable and 1 otherwise, so the skill can fall back to the next route. Whether the Atlassian MCP tools are connected is left to the skill.

playbook cc

Start a Claude Code session, or manage sessions and worktrees

With no subcommand, starts a session with the playbook prompt and model chain. Any other arguments go to claude as they are. The subcommands do the housekeeping: list sessions, prune state, clear caches, and create worktrees. pb is an alias for playbook, so pb cc works too.

Example: playbook cc --model sonnet

  • <ARGS>: Arguments passed through to claude

Subcommands: cache, clean, fresh, launch, list, prune, raw, worktree

playbook cc cache

Work with the caches that would freeze old settings into a session

Subcommands: clear

playbook cc cache clear

Clear caches that would freeze old settings into a session

playbook cc clean

Clean up and resume a session

Clones the session named for this directory with its settings overrides stripped, then resumes the clone in claude, so settings, plugins and hooks reload from the current config. Starts a fresh session when none matches. The same as playbook cc --clean.

  • <ARGS>: Arguments passed through to claude

playbook cc fresh

Start a fresh session

Starts a new claude session without resuming an earlier one, with the current settings applied. The same as playbook cc --fresh.

  • <ARGS>: Arguments passed through to claude

playbook cc launch

Run the launcher (playbook cc and playbook ccd call it)

  • --skip-permissions: Pass --dangerously-skip-permissions to claude (the playbook ccd form)
  • <ARGS>: Subcommand and arguments, passed through to claude

playbook cc list

List sessions for the current project

playbook cc prune

Remove stale runtime state

playbook cc raw

Resume a session as it was

Resumes a session in claude as it was, with no fork and its settings overrides kept. Starts a fresh session when none matches. The same as playbook cc --raw.

  • <ARGS>: Session id to resume (default: the most recent), then arguments for claude

playbook cc worktree

Create a git worktree for a branch and print its path

Prints only the path, so a shell can run cd "$(playbook cc worktree my-branch)".

Example: playbook cc worktree my-branch

  • <BRANCH>: Branch to create the worktree for
  • <ENV_BASE>: Directory (relative to the repo root) holding the .env to copy in

playbook ccd

Start a session with permission prompts skipped

The same launcher as playbook cc, with --dangerously-skip-permissions added. It replaces the old ccd shortcut. pb ccd works too.

Example: playbook ccd fresh

  • <ARGS>: Subcommand and arguments, passed through to claude

playbook ci

Run the repo checks that need no model (manifest, agents, settings)

Prints one line per check. Exits 0 when all pass and 1 if any fails, so it is safe in CI. A skipped check passes unless --strict is set.

Example: playbook ci --strict

  • --json: Print one JSON object instead of text
  • --strict: Also exit 1 when a check is skipped (for example in the wrong directory)
  • --dir <DIR>: Run in this directory instead of the current one

playbook code

Index and search the repo's source code

The index is a cache kept under the playbook state directory for this worktree. Nothing is written inside the repo.

Subcommands: context, index, outline, read, refs, search, status, symbol

playbook code context

Gather the code a task needs

Describe the task in words. Finds matching declarations and text, widens text hits to the declaration around them, adds imports of the top files and tests that name a top declaration, merges overlaps and fills a size budget. Prints what did not fit.

Example: playbook code context "add retry support to payment processing"

  • <QUERY>: Task, in words
  • --max-tokens <MAX_TOKENS>: Budget in tokens for the whole text output, counted as four bytes each
  • --json: Print one JSON document

playbook code index

Build or refresh the code index for this repo

Hashes every file git lists, and reads only the ones that changed. Worktrees of one repo share one store, so content that is already stored is not parsed again. Each worktree runs once at a time.

Example: playbook code index --json

  • --json: Print one JSON document
  • --rebuild: Index everything again; a damaged store is replaced for every worktree

playbook code outline

List the declarations in one file

Parses the file as it is on disk, so it works without an index and never shows old text. Prints at most 500 declarations, indented by nesting.

Example: playbook code outline lib/payment/service.ts

  • <PATH>: File to outline
  • --json: Print one JSON document

playbook code read

Print numbered lines of one file

Reads the file as it is on disk. Prints at most 400 lines or 32 KiB. A range that ends past the file is cut at the end with a warning.

Example: playbook code read lib/payment/service.ts 10:40

  • <PATH>: File to read
  • <LINES>: First and last line, 1 based and inclusive, as START:END
  • --json: Print one JSON document

playbook code refs

List syntax references to a name

Finds identifiers in code that spell the name, including declarations and imports, and skips comments and strings. Every result is a candidate: nothing checks scope or types, so unrelated names that share a spelling also appear.

Example: playbook code refs processPayment

  • <TARGET>: Name to look for. A dotted or scoped name uses its last part
  • --limit <LIMIT>: Most results to show, from 1 to 200
  • --json: Print one JSON document

playbook code search

Search symbols, imports and text of this repo

Without the text flag, results are ranked in tiers: exact qualified name, exact name, name ignoring case, name prefix, import, text, then a plain substring scan. With it, only indexed text is searched. Words in the query are matched as plain text, so operators have no special meaning. Results are marked stale when a file changed after indexing.

Example: playbook code search retry --lang python

  • <QUERY>: Words to look for
  • --text: Search indexed text only
  • --path <PATH>: Only files under this path prefix, for example lib/payment/
  • --lang <LANG>: Only files of this language: rust, typescript, javascript, python or go (one of rust, typescript, javascript, python, go)
  • --limit <LIMIT>: Most results to show, from 1 to 200
  • --json: Print one JSON document

playbook code status

Report whether the index matches the files on disk

Hashes every file git lists, so it is slower than the quick check that search commands run first.

Example: playbook code status --json

  • --json: Print one JSON document

playbook code symbol

Find where a name is declared

Matches the exact qualified name first (a top level symbol's qualified name is its plain name), then the name, then the name ignoring case, then the name as a prefix.

Example: playbook code symbol PaymentService --kind class

  • <NAME>: Name to look up
  • --kind <KIND>: Only this kind, for example function, class or method
  • --lang <LANG>: Only files of this language: rust, typescript, javascript, python or go (one of rust, typescript, javascript, python, go)
  • --path <PATH>: Only files under this path prefix, for example lib/payment/
  • --limit <LIMIT>: Most results to show, from 1 to 200
  • --json: Print one JSON document

playbook commands

List every playbook command, what it does and who may run it

Built from this binary's own command tree, so it lists only the commands the binary has. One line per command, with its subcommands. A name ending in ! or a line marked (user-only) is for the user to run; (read-only) runs freely. Give a group to list its subcommands with their flags. Reads nothing and writes nothing.

Example: playbook commands pr

  • <GROUP>: Command or group to list, such as pr or worktree review
  • --json: Print a JSON array with one object per command: command, purpose, access, args, subcommands, intents

playbook commit

Run the git steps of /playbook:commit

Subcommands: prepare, run

playbook commit prepare

Stage, format, and print what a commit message is drafted from

Refuses the repo's default branch. Prints NO_STAGED_CHANGES when there is nothing to commit, else BRANCH=, the changed files and the diff.

Example: playbook commit prepare -A

  • -A: Stage everything first (git add -A)
  • -u: Stage tracked changes first (git add -u)
  • -a: Replace the last commit

playbook commit run

Commit, rebase when behind, and push

Reads the message from stdin, or from --message-file. With -A, -m or --json it drafts the message with a small model (Haiku), or from the staged file names when commit.aiMessage is false, the model fails or a staged file looks like a secret, unless -m gives one, and refuses the default branch. Adds a sign-off per commit.signOff and signs when user.signingkey is set. A rejected push is never forced. Exits 1 on any failure.

Example: playbook commit run --message-file /tmp/msg.txt

  • --message-file <MESSAGE_FILE>: File with the commit message (default: read stdin)
  • -A: Stage everything first (git add -A) and draft the message
  • -m, --message <MESSAGE>: Commit message (default: drafted from the staged files)
  • --json: Print one JSON report that always exits 0, the outcome in verdict
  • --args-stdin: Read the flags and the worktree phrase from stdin; stages per -A/-u
  • -a: Replace the last commit
  • --auto: Auto mode: never force a push
  • --no-signoff: Leave the sign-off trailer off
  • --no-type-check: Skip the check that the commit type fits the files. A docs-only change is not feat, and a lock-file bump is not fix
  • --no-prose-check: Skip the prose check. It flags a dash, a curly quote, a banned word or a contrast phrase in the message

playbook completions

Print a shell completion script for bash, zsh or fish

Example: playbook completions zsh

  • <SHELL>: Shell to print the script for (one of bash, zsh, fish)

playbook config

Read and change playbook settings in any tier

Settings come from tiers, highest first: repo, org, global, then the built-in default. get and list show which tier supplied a value.

Example: playbook config set pr.review.enabled true

Subcommands: export, get, import, list, set

playbook config export

Print every stored setting as one JSON document

Settings live in a database, not hand-editable files. Export gives you a readable copy, and config import loads one back.

Example: playbook config export > playbook-config.json

playbook config get

Show a setting's value and which tier it came from

Example: playbook config get pr.review.enabled

  • <KEY>: Dotted setting name, such as pr.review.enabled

playbook config import

Load settings from a JSON document made by config export

Every key and value is checked first, and nothing is stored if any is invalid. Use - to read standard input.

Example: playbook config import playbook-config.json

  • <FILE>: JSON file to read, or - for standard input

playbook config list

List every setting with its value and source tier

playbook config set

Change a setting

Writes to the repo tier unless you pass --org or --global. The per-user update.* keys go to the global tier, and --org is refused for them.

Example: playbook config set pr.review.enabled true

  • <KEY>: Dotted setting name, such as pr.review.enabled
  • <VALUE>: New value; it is read as the type the setting expects
  • --org: Write to the org tier instead of the repo tier
  • --global: Write to the global tier instead of the repo tier

playbook deps

Install the tools a Brewfile lists, keeping any already on PATH

Example: playbook deps ensure Brewfile

Subcommands: ensure

playbook deps ensure

Install missing Brewfile tools with Homebrew

Leaves each tool already on PATH alone, and reads the brew and tap lines of the Brewfile.

Example: playbook deps ensure --builtin

  • <BREWFILE>: Brewfile to read, Brewfile in the current directory by default
  • --builtin: Read the Brewfile built into this binary instead of a file

playbook doc

Read a PDF or Office file as text with the bundled converter

Conversion is local, bounded in size, time, memory and output, and never uses OCR or a hosted service. The text is printed as untrusted document content. A long document is printed in slices, and the full text is kept in a private cache for a day.

Example: playbook doc read report.docx

Subcommands: read, status

playbook doc read

Print a document as Markdown, framed as untrusted content

Supports pdf, docx, doc, odt, rtf, epub, pptx, ppt, odp, xlsx, ods and csv. A scanned PDF with no text layer reports that it needs OCR.

Example: playbook doc read report.pdf --section 2

  • <FILE>: Document to read
  • --json: Print one JSON object instead of the framed text
  • --offset <OFFSET>: Character offset to start the slice at (default 0)
  • --limit <LIMIT>: Most characters to print, capped at the display size
  • --section <SECTION>: Print one section by its number from the section index

playbook doc status

Say which document converter is in use, or that none was found

playbook doctor

Check the playbook setup, or read one fact the check uses

playbook doctor with no subcommand runs playbook doctor check, the full health check the /playbook:doctor command uses. It only reads. The other subcommands print one fact each, such as pending migrations, plugin version or hook wiring, and help when a layer reports a miss.

playbook doctor --fix repairs playbook's own files after an upgrade and prints the list of what still needs you, the same as playbook migrate. At a terminal it first asks whether to turn attribution OFF, the default, by adding the missing attribution keys; that yes is the only Claude Code setting it writes. A no stores attribution ON.

Example: playbook doctor

Example: playbook doctor migrations

  • --fix: Run the safe migrations for playbook's own files, then list what needs you

Subcommands: check, migrations, models

playbook doctor check

Check the seven playbook layers and print a status table

Reads your settings, shell files and PATH, and lists a PASS, INFO, WARN or FAIL row for each layer, then the review config, stale worktrees and pending migration notices. Always exits 0 when it could run the checks.

  • --json: Print the rows as JSON

playbook doctor migrations

List the manual migration findings that need you

Prints one line per finding, or nothing when none is pending.

playbook doctor models

Show the model tiers, any overrides and the fallback chain in use

Also says whether your own fallback replaces playbook's, and when the effort in force makes the chain start at Haiku.

  • --json: Print the report as JSON

playbook effort

Set playbook's own ceiling on effort, or inspect one component's

playbook effort list shows every command, skill and agent with its shipped effort and effective level. playbook effort resolve agents reviewer says which agent file to dispatch under the ceilings. Set a per-component ceiling with playbook config set --global effort.agents.reviewer medium. playbook effort suggest reads your usage and lists agents where a change looks safe or needed.

auto (the default) sets no ceiling, so Claude Code's own maxEffortLevel decides how high effort may go. Each skill, command and agent still keeps the effort it ships with. low, medium, high, xhigh or max set playbook's own ceiling. The key is effort.max. The effective ceiling is the lower of this and Claude Code's own maxEffortLevel, which playbook only reads and never changes. Sessions started with playbook cc or playbook ccd get the ceiling. With no level, shows both values and the one that wins.

The ceiling lowers the effort an orchestrator passes when it spawns an agent, the default effort the launcher adds and what the binary reports. It does not cap a command or skill that ships its own effort, a level you state for the session, or a spawn that skips the resolve step, because only Claude Code's maxEffortLevel setting can, and playbook never writes it.

Example: playbook effort xhigh

  • <LEVEL>: One of auto, low, medium, high, xhigh or max
  • --json: Print the status as JSON (with no level)

Subcommands: apply, choose, list, log, reset, resolve, suggest

playbook effort apply

Apply the proposed effort patch to playbook's config, after approval

Builds the same patch as suggest --patch, shows it, and asks y/N. --yes approves without asking, and is required when not at a terminal. Writes only playbook's own config: the global tier, a backup of the previous effort.* keys under ~/.config/playbook/effort/, a ledger and a change log. Never goes below an agent's quality floor, never touches the reviewer, the auditor or any agent marked costly to miss, and never exceeds a ceiling. Claude Code's settings are not touched.

Example: playbook effort apply --range 90d

  • --range <RANGE>: One of 30d, 60d, 90d, month or all
  • --yes: Approve without asking

playbook effort choose

Choose an effort for one dispatch from its diff

Does nothing while effort.auto is off (the default). With suggest it logs what it would pick and the dispatch keeps the default. With on it names the effort to pass to the Agent call on the base agent, picked strictly between the agent's quality floor and every ceiling, raised (to high at most) for risky or large diffs and lowered only for small clean ones. An agent marked costly to miss is never lowered. Any error gives the default. Every choice is appended to a local log (playbook effort log).

Example: playbook effort choose reviewer --base origin/main --json

  • <AGENT>: Agent name, such as reviewer
  • --base <BASE>: Read the diff shape from git diff --numstat <ref>
  • --lines <LINES>: Changed lines, when not using --base
  • --files <FILES>: Changed files, when not using --base
  • --bytes <BYTES>: Diff size in bytes
  • --path <PATHS>: Touched path, repeated for several, when not using --base
  • --lens <LENS>: Review lens, such as security
  • --json: Print JSON

playbook effort list

List every component with its shipped effort and effective level

  • --json: Print JSON

playbook effort log

Show the automatic effort choices that were logged

Each row has the time (UTC), component, default and chosen level, the inputs and the reason. The log is local and append only.

Example: playbook effort log --limit 20

  • --limit <LIMIT>: How many of the latest rows to show
  • --json: Print JSON

playbook effort reset

Undo what effort apply changed, in one command

Restores each key the patch changed to its earlier value, unless you edited it since. --all also sets every other effort.* key in the global tier back to its default. A backup is written first.

Example: playbook effort reset --all

  • --all: Also reset every effort.* key to its default

playbook effort resolve

Show one component's shipped effort, ceiling and effective level

For an agent it also names the file to dispatch and every file allowed under the ceiling.

--cap <level> adds a ceiling from the calling command, for example review holding its reviewer to medium. The lowest of the cap and the user's ceilings applies.

Example: playbook effort resolve agents reviewer --cap medium --json

  • <KIND>: One of agents, commands or skills
  • <NAME>: Component name, such as reviewer or review
  • --cap <CAP>: Extra ceiling from the caller: low, medium, high, xhigh or max
  • --json: Print JSON

playbook effort suggest

List agents where a change to effort looks safe or needed (read only)

Reads the local usage store and the quality floor table and prints, for each agent, its dispatches, reruns and overrides, the cost per effort level, and whether lowering is permitted or something needs a look. Lowering is only ever proposed down to the benchmark floor. Nothing is written: not the store, not memory, not any settings file. Cost is per model and effort bucket, shared with the main session.

Example: playbook effort suggest --range 90d --json

  • --range <RANGE>: One of 30d, 60d, 90d, month or all
  • --json: Print JSON
  • --patch: Print a proposed config patch instead (still read only)

playbook eval

Check how well the review triage classifier sorts real PRs

Each case is a PR with a known answer per review lens. Costs one gh pr diff fetch and one live claude call per case, so run it by hand or on a schedule.

Example: playbook eval triage

Subcommands: bench, triage

playbook eval bench

Benchmark agent roles across models and effort levels

Each case is a fixed prompt with an objective check (a planted bug found, a claim judged right, a test that passes), so no judge model is involved. It prints pass rate, cost and time per role, model and effort. It estimates the cost first and refuses to start above --max-cost-usd, and stops mid run when the spend reaches it. Needs a logged-in claude; it makes real API calls.

With --strategy, the implementer cases run with tools in a scratch git repo, comparing one dispatch per TDD step against one per Work Unit.

Example: playbook eval bench --role fact-checker --model haiku,sonnet --effort low,medium --runs 2

  • --cases <CASES>: Case file or directory; defaults to the cases shipped in the playbook repo
  • --role <ROLE>: Only these roles (comma separated)
  • --id <ID>: Only cases whose id starts with one of these (comma separated)
  • --model <MODEL>: Models to try (aliases such as haiku, sonnet, opus)
  • --effort <EFFORT>: Effort levels to try
  • --runs <RUNS>: Calls per case, model and effort
  • --max-cost-usd <MAX_COST_USD>: Spend cap in US dollars; the run is refused above it
  • --jobs <JOBS>: Calls in flight at once
  • --json: Print JSON instead of a table
  • --list: List the cases and exit
  • --strategy <STRATEGY>: Run the tdd_repo implementer cases with tools in a scratch git repo. Use one dispatch per TDD step (per-step) or one per Work Unit (per-wu)

playbook eval triage

Run the review triage classifier on each case

Compares each result with the known answer. Needs network access, a logged-in gh, and a working claude with a live API key. Exits 0 when no lens was wrongly skipped and no case errored, and 1 otherwise. Re-run it whenever the triage prompt changes.

Example: playbook eval triage

  • <FIXTURES>: Case file to run; defaults to the cases shipped in the playbook repo
  • --prompt <PROMPT>: Triage prompt to send; defaults to the one shipped in the playbook repo

playbook gate

Record and check plan verdicts used as gates

Verdicts are stored per worktree, keyed by plan.

Subcommands: check, record, snapshot

playbook gate check

Check that recorded phase verdicts still pass

Exits 0 only if every named phase is PASS or WARN and its source is unchanged. Exits 1 on any other verdict, a stale one, or no phases.

Example: playbook gate check my-plan plan adversarial test-review

  • <PLAN_SLUG>: Plan slug to check
  • <COMMAND>: Command running this check
  • <PHASES>: Phase names to check
  • --source <SOURCE>: File with the current source content, compared against what each verdict saw. Defaults to the shared draft, <plans>/<slug>.gate-source.md
  • --json: Print one JSON object instead of text (exit codes stay the same)

playbook gate record

Save a phase verdict for a plan

Reads a phase agent's output, finds its VERDICT: line, and stores it.

Example: playbook gate record my-plan plan adversarial out.md

  • <PLAN_SLUG>: Plan slug the phase belongs to
  • <COMMAND>: Command that produced this verdict
  • <PHASE>: Which phase this verdict is for
  • <INPUT>: File with the phase agent's output, or "-" to read stdin
  • --source <SOURCE>: File with the source content the verdict covers. Used to spot a stale verdict later. Defaults to the phase's snapshot, <plans>/<slug>.gate-source.<phase>.md
  • --stuck: Store a FAIL report as STUCK. Use it when the revise and re-run loop stopped because the blocking findings made no progress. Refused for any other verdict

playbook gate snapshot

Freeze the plan draft for each gate phase about to run

Copies <plans>/<slug>.gate-source.md, the draft as it stands, to <plans>/<slug>.gate-source.<phase>.md for every phase named, so each phase records its verdict against what it actually reviewed. Prints the snapshot paths. Fails, copying nothing, when the draft file is missing.

Example: playbook gate snapshot my-plan adversarial test-review

  • <PLAN_SLUG>: Plan slug
  • <PHASES>: Phase names to snapshot for

playbook gc

Show what playbook state takes space on disk, or clean it up

Lists each store of on-disk state with its size, item count, age and the action a cleanup would take. It changes nothing and takes no lock. With --yes it repairs interrupted moves, tombstones items past their limit and deletes tombstones past their grace period. With --restore it puts a tombstoned item back where it came from.

Example: playbook gc

  • --yes: Apply the cleanup
  • --restore <ID>: Restore a tombstoned item by id

playbook glossary

Append entries to the repo's GLOSSARY.md file

Subcommands: add

playbook glossary add

Append one entry line to GLOSSARY.md at the repo root

Example: playbook glossary add "WU: Work Unit"

  • <ENTRY>: Entry text to append

playbook handoff

Save and show notes that carry over to the next session

A handoff is a markdown note for one directory. The next session started there loads it when the SessionStart hook is installed and runs, and /playbook:handoff load loads it on demand.

Subcommands: check, facts, load, save, status, template

playbook handoff check

Check a handoff read from stdin for section shape and dashes

playbook handoff facts

Print the git facts for the "Where we are now" section

  • --dir <DIR>: Directory to read (default: the current one)

playbook handoff load

Print this directory's handoff without using it up

  • --all: Print every waiting handoff, not just the newest
  • --dir <DIR>: Directory to load (default: the current one)

playbook handoff save

Save the handoff note read from stdin for the next session

  • --dir <DIR>: Directory the handoff belongs to (default: the current one)
  • --session <SESSION>: Session id the handoff is for. Only the start that follows that session's /clear loads it, so parallel sessions never share one

playbook handoff status

Show recent session starts and this directory's handoff counts

playbook handoff template

Print the rules and template for writing a handoff

playbook hooks

List the hooks that playbook setup wires into Claude Code

Subcommands: list

playbook hooks list

Print every hook with its event, matcher and what it does

Lists the hooks setup adds to settings.json, grouped by purpose. Changes nothing.

playbook learn

Gather the repo facts that /playbook:learn reads

Subcommands: collect, preflight

playbook learn collect

Count the git history or the repo layout

Feeds the /playbook:learn collectors. git prints contributors, churn hotspots, commit types, remote branch prefixes, recent tags and commits per month. structure prints the top level, languages, entry points, build manifests with their scripts and targets, test and lint config, Dockerfiles, CI, infrastructure as code, migrations, model files and scripts/. Both print one JSON object, read only through git, with every count capped.

Example: playbook learn collect git structure

  • <ROLES>: Which to collect: git, structure, or both (one of git, structure)

playbook learn preflight

Name the repo and memory store, probe the tools, and tally JIRA keys

playbook manifest

Check that tracked files sit in allowed top-level paths

Subcommands: check

playbook manifest check

Check every tracked file is at an allowed top-level path

Exits 0 when all pass and 1 otherwise.

  • <REPO_ROOT>: Repo root to check (default: the repo you are in)

playbook memory

Manage the memory graph that sessions read from

Subcommands: claude, context, export, rebuild, stats

playbook memory claude

Work with Claude Code's auto memory

Subcommands: import

playbook memory claude import

Copy notes from Claude Code's auto memory into playbook memory

One way and opt in. It only reads Claude Code's memory for this project (~/.claude/projects/<project>/memory/*.md) and never changes, moves or deletes anything there. Each note becomes a playbook fact in this repo's project memory. A note already imported (tracked by content hash on the playbook side) and a fact that already exists are skipped, so running it again copies nothing.

Example: playbook memory claude import --dry-run

  • --dry-run: Show what would be copied and write nothing
  • --from <FROM>: Read this directory instead of the project's Claude Code memory

playbook memory context

Print the repo's slice of the memory graph as markdown

Shows the facts in scope, typed edges and the anchor index. When there is nothing to show it prints one Memory context: none (<reason>) line and exits 0. A missing default graph is rebuilt from the fact files first.

  • --repo <REPO>: Repo slug (owner/name); defaults to the origin remote's slug
  • --graph <GRAPH>: Graph JSON file; defaults to the graph in ~/.config/playbook/data/memory.db

playbook memory export

Print the memory graph as JSON

The graph lives in ~/.config/playbook/data/memory.db, rebuilt from the fact files. This prints the document older versions kept in memory.graph.json, for tools that read that shape. A missing database is rebuilt first.

Example: playbook memory export --json

  • --json: Print JSON (the only format)

playbook memory rebuild

Rebuild the memory graph from every fact on disk

Memory is rebuilt on its own when a fact is saved, so you only need this after editing fact files by hand. The graph is written to ~/.config/playbook/data/memory.db; the fact files in ~/.config/playbook/memory/ stay the source of truth, so the database is safe to delete. Prints the same summary as playbook memory stats.

  • --json: Print the summary as JSON

playbook memory stats

Summarize the memory graph without changing it

Prints the database path, size and last rebuild time, the fact count per scope (global, org, project), the node count, the edge count per relation, the anchor count, and the dangling edges (target missing) and anchors (path missing on disk). Anchors are checked only for the repo you run it in, when it has an origin remote. Read only: a missing database is reported, not built.

Example: playbook memory stats --json

  • --json: Print the summary as JSON

playbook migrate

Bring playbook's own files up to date with this binary

Runs the migrations that write only playbook's own files, then records this binary as the one that ran them. The ones that run once start only after an upgrade, and the checks that repair a file run every time. A migration waits for the release named in its since. Nothing runs after a downgrade. It never writes Claude Code settings. It ends with the list of what still needs you, one bullet per item with why it matters and the command that fixes it: playbook setup for a change to Claude Code settings or a shell file, and its own fix for a report. The session start then stops repeating a report it printed. A run also updates the playbook plugin through claude plugin update, then says to restart Claude Code. A missing claude command or a failed update prints the command to run and does not change the exit code. --no-plugin or playbook config set upgrade.plugin off turns this off. update, the install script and doctor --fix run the same step.

Exit codes: 0 when it finished or had nothing to do, 1 when the record could not be read or written, a migration failed, or another playbook process held the lock.

Example: playbook migrate --status

  • --status: List each migration with its release, scope and state, writing nothing
  • --dry-run: Show the migrations a run would start and what needs you, writing nothing
  • --json: Print JSON for tools
  • --no-plugin: Leave the playbook plugin in Claude Code as it is. By default a run updates it with claude plugin update, unless the config key upgrade.plugin is off

playbook mode

Choose whether playbook asks questions or decides on its own

ask is the default. auto lets commands pick the recommended option and keep going. The choice is stored per repo.

Example: playbook mode auto

Subcommands: ask, auto, status

playbook mode ask

Turn auto mode off for this repo, so playbook asks again

playbook mode auto

Turn auto mode on for this repo

playbook mode status

Show the current mode and where it came from

Example: playbook mode status --json --command implement --args "--auto"

  • --json: Print one JSON object instead of a line of text
  • --flag <FLAG>: Report as if a command ran with --auto or --ask, and warn when the hooks would disagree (one of ask, auto)
  • --command <COMMAND>: Add the effort ceiling for this command, such as implement, to the JSON
  • --args <ARGS>: Raw arguments of a command, as one string. Its --auto or --ask sets the mode

playbook path

Print the path of a playbook storage directory

Prints one of this repo's storage directories. For those kinds it first moves any legacy directories from the old repo-local location. data and plugin-root skip that move. plugin-root prints the installed playbook plugin directory instead. It looks at PLAYBOOK_PLUGIN_DIR, then the installPath Claude Code recorded, then CLAUDE_PLUGIN_ROOT, then the newest plugin cache directory. When none is usable it prints one line naming each place tried and exits 1. --create does not apply to it.

Example: playbook path plans

  • <KIND>: Which directory to print (one of plans, implement, worktrees, handoff, data, plugin-root)
  • --create: Create the directory when it does not exist

playbook plan

Save plan checkpoints, write Work Unit briefs, clear scratch files

Subcommands: brief, checkpoint, cleanup, graph, ledger, list, wave

playbook plan brief

Write the brief file for each Work Unit

/playbook:implement gives these files to its subagents. Each <OUT>/<wu-id>.brief.md holds a short header (plan, worktree, scoped verify), the Work Unit's own section of the plan verbatim, and a "Relevant memory" list of the facts anchored to its files or matching its title. With --facts-tokens above 0 it adds a Callers block of use sites from the code index, cut to that many tokens. Every id is checked first: a missing one writes nothing and exits 1. Prints the paths written, one per line.

Example: playbook plan brief docs/plan.md WU-1 WU-2 --out /tmp/briefs --verify 'cargo test {tests}'

  • <PLAN>: Plan or blueprint file
  • <WUS>: Work Unit ids, such as WU-1
  • --out <OUT>: Directory to write the briefs into
  • --worktree <WORKTREE>: One worktree path for every brief
  • --worktree-base <WORKTREE_BASE>: Directory holding one worktree per Work Unit, named by its lower case id
  • --verify <VERIFY>: Scoped verify command; {tests} and {files} become the Work Unit's paths
  • --repo <REPO>: Repo slug (owner/name) for the memory scope; defaults to the origin remote's
  • --graph <GRAPH>: Graph JSON file; defaults to the graph in ~/.config/playbook/data/memory.db
  • --facts-tokens <N>: Most tokens of code facts to add to each brief; 0 adds none

playbook plan checkpoint

Print a topic's checkpoint path, or save the checkpoint

Without --write it creates the plans directory and prints the path, then found or not-found. With --write it replaces the checkpoint with stdin under a directory lock. A failed save prints a one-line notice and still exits 0, so planning continues without resume safety.

Example: playbook plan checkpoint my-topic

  • <SLUG>: Kebab-case topic slug, or the ticket id in lower case
  • --write: Replace the checkpoint with stdin

playbook plan cleanup

Remove the scratch files a finished plan leaves in the plans directory

Removes exactly <slug>.checkpoint.md, <slug>.checkpoint.md.lock and <slug>.gate-source*.md from playbook path plans, never the final plan or its quality report. Prints the removed file names, one per line. Safe to repeat: nothing to remove exits 0. Exit 1 for a bad slug or flags, 2 when a symlink leaves the directory or a removal fails (nothing removed after a refusal). --stale lists leftovers of every slug that already has a final plan and deletes them only with --yes.

Example: playbook plan cleanup my-topic --dry-run

  • <SLUG>: Kebab-case topic slug
  • --dry-run: Only list what would be removed
  • --json: Print the result as JSON
  • --stale: Clear leftovers for every slug that already has a final plan; dry run unless --yes
  • --older-than <OLDER_THAN>: Only clear files at least this many days old. Needs --stale. By default a plan being re-planned today is left alone, because files under one day old are kept
  • --yes: With --stale, actually delete

playbook plan graph

Check a plan's Work Unit dependency graph

Subcommands: check

playbook plan graph check

Check a plan's Work Unit graph for cycles, order and unsafe groups

Reads the plan's Segments and Work Units tables and reports one line per finding: cycle (Work Units that never resolve), order (a Work Unit needing one from a later Segment), coverage (a Work Unit in no Segment, or a Segment listing a missing one), unknown (a Requires naming no Work Unit) and parallel (members of one Parallel group that depend on each other, share files, or both touch a lockfile or migration folder). Ends with PASS or FAIL and a topology= hint (stacked, independent or single). Exit 1 on a finding. With --json it always exits 0 and the envelope carries the findings.

Example: playbook plan graph check docs/plan.md

  • <PLAN>: Plan file
  • --json: Print the report as the shared JSON envelope

playbook plan ledger

Show or set the run state kept beside a plan

Subcommands: set, show

playbook plan ledger set

Set fields on a Work Unit or Segment, keeping the others

Fields: status, base, commit, branch, pr, land, review, ci_fix_attempts, ci_rerun_attempts, merge_attempts, parked_reason, parked_at. Concurrent calls are safe: each write holds the advisory lock plan checkpoint uses. Nothing is written when an id, field or pair is invalid.

Example: playbook plan ledger set docs/plan.md WU-3 status=DONE

  • <PLAN>: Plan file
  • <ID>: Item to update, for example WU-3 or S2
  • <PAIRS>: Fields as key=value

playbook plan ledger show

Print the run state kept beside a plan

Reads <plan stem>.ledger.json beside the plan and prints each id with its key=value fields, or NONE when nothing was set. With --json it prints the shared envelope with an entries object.

Example: playbook plan ledger show docs/plan.md

  • <PLAN>: Plan file
  • --json: Print the ledger as the shared JSON envelope

playbook plan list

List the plans and ADR blueprints /playbook:implement can run

Prints path<TAB>[status]<TAB>title per file, or NO_PLANS.

  • --json: Print JSON instead of text

playbook plan wave

Pick the Work Units to run next

Subcommands: next

playbook plan wave next

Print the Work Units that are safe to run together next

Takes the Work Units whose Requires are all in --done, in the first Segment that still has work, and keeps each one whose files stay clear of those already picked (no shared path, and not two lockfile or migration editors). Prints one id per line, or NONE when nothing can start. Always exits 0 for a readable plan.

Example: playbook plan wave next docs/plan.md --done WU-1,WU-2

  • <PLAN>: Plan file
  • --done <DONE>: Finished Work Unit ids, separated by commas
  • --json: Print the wave as the shared JSON envelope

playbook plugin

Manage the playbook plugin in Claude Code, apart from the binary

install adds the marketplace and the plugin, for a playbook that did not come from Homebrew. upgrade refreshes the marketplace and runs claude plugin update for each installed playbook plugin id. Neither downloads a binary. Run playbook upgrade to update the binary.

Example: playbook plugin install

Subcommands: install, upgrade

playbook plugin install

Install the playbook plugin and its marketplace into Claude Code

For a playbook that did not come from Homebrew, such as one from the install script, a container, a home server platform like Umbrel or a nix profile. Needs claude on PATH. Adds the amplifiedengineer/marketplace marketplace unless Claude Code lists it already, and leaves one listed under the old pragmatic-engineer name as it is. Turns on autoUpdate for the marketplace in ~/.claude/settings.json, and keeps an explicit false. Then installs playbook@amplifiedengineer. Claude Code updates a plugin with its marketplace, so that one flag also keeps the plugin up to date; there is no per-plugin key.

You asked for it, so upgrade.plugin set to off, PLAYBOOK_SKIP_PLUGIN_UPDATE and a CI environment do not stop it. Prints one line per step. A second run reports every step as done and changes nothing. Exits 1 when claude is not on PATH or a step fails.

Restart Claude Code or run /reload-plugins after an install.

Example: playbook plugin install

  • --json: Print one JSON object in the shared envelope, and exit 0 whatever the result

playbook plugin upgrade

Upgrade only the playbook plugin and its marketplace

Refreshes the marketplace, then runs claude plugin update for every installed playbook plugin id, playbook@amplifiedengineer and the old playbook@pragmatic-engineer. You asked for it, so upgrade.plugin set to off, PLAYBOOK_SKIP_PLUGIN_UPDATE and a CI environment do not stop it. Prints one line per plugin. Exits 1 when an upgrade fails, claude is not on PATH, or the marketplace refresh failed while the plugin lags; an up to date plugin, one the marketplace has not published yet and a missing plugin exit 0.

Restart Claude Code or run /reload-plugins after an upgrade.

Example: playbook plugin upgrade

  • --json: Print one JSON object in the shared envelope, and exit 0 whatever the result

playbook pr

Prepare and open PRs, and pick a review depth

These are the mechanical steps behind /playbook:pr-create.

Example: playbook pr prepare --base main

Subcommands: checks, comments, create, merge, prepare, reply, review, rules, stack, status

playbook pr checks

List a PR's checks, optionally waiting, and triage the failed jobs

Prints CHECKS=<verdict> (PASS, NONE, FAIL, CANCELLED, PENDING, TIMEOUT or UNREADABLE), a line per check, and per failed job its run id, failed step and whether it is transient (cancelled, or a failed Set up job step: rerun it instead of fixing code). --watch polls until the checks settle or --timeout, and reads again after a failed read (up to three reads in a row, once a first read has worked and before --timeout) before it reports UNREADABLE; with --fail-fast it stops at the first failure. Exit codes: 0 all passed or none exist, 5 the PR could not be read, 6 a check failed or was cancelled, 7 still pending. With --json it prints the envelope with checks[] and failed[] (name, run_id, step, transient) and exits 0.

Example: playbook pr checks 12 --watch --fail-fast

  • <PR>: PR number
  • --watch: Wait until the checks settle or the timeout passes
  • --fail-fast: With --watch, stop at the first failed check
  • --required: Only the checks the base branch requires
  • --timeout <TIMEOUT>: With --watch, give up after this many seconds
  • --interval <INTERVAL>: With --watch, seconds between reads
  • --json: Print the envelope with the checks and failed jobs, and exit 0

playbook pr comments

Resolve a PR and fetch its review threads and comments

Takes the command's arguments as one string (#12 --bots --dry-run -y). Prints the PR, head SHA, your login and the flags, and writes the threads and issue comments as JSON under /tmp.

  • <ARGS>: Command arguments as one string, such as #12 --bots

playbook pr create

Commit, push and open or update a PR from any worktree

Stages per flag, commits when something is staged (message from --message or --message-file), rebases onto the base, pushes, then opens or updates the PR through gh. Opens a draft unless the pr.draft setting is false. Refuses the default or a protected branch and a detached HEAD, never skips hooks or signing, and only force-pushes with a lease after its own rebase. Exit codes: 0 delivered, 3 refused, 4 rebase conflict, 5 a git or gh call failed, 6 PR closed or a required check failed, 7 wait timed out, 8 auto-merge did not queue, 9 nothing to do.

Example: playbook pr create --dir ../wt -A --message "fix(x): y" --title "fix(x): y" --ready

  • --dir <DIR>: Worktree to deliver from (default: the current directory)
  • -A: Stage everything first (git add -A)
  • -u: Stage tracked changes first (git add -u)
  • --staged: Commit only what is already staged (the default)
  • --message <MESSAGE>: Commit message
  • --message-file <MESSAGE_FILE>: File with the commit message
  • --title <TITLE>: PR title
  • --body <BODY>: PR body
  • --body-file <BODY_FILE>: File with the PR body
  • --base <BASE>: Base branch (default: the open PR's base, a parent PR branch, or the default branch)
  • --ready: Open or mark the PR ready for review
  • --draft: Open or return the PR as a draft
  • --auto-merge: Queue auto-merge and verify it queued
  • --wait: Wait until the PR merges, closes, or a required check fails
  • --timeout <TIMEOUT>: Seconds to wait with --wait
  • --dry-run: Print the plan and change nothing
  • --ticket <TICKET>: Ticket key for the branch (none turns the ticket rules off)
  • --issue <ISSUE>: GitHub issue number the PR handles
  • --json: Print JSON instead of text
  • --branch <BRANCH>: Refuse unless --dir is on this branch
  • --auto: Auto mode: never force a push; a branch that needs a force is parked

playbook pr merge

Merge a PR: wait for checks, arm auto-merge, wait for the merge

Prints MERGE=<verdict> reason=<why> and then the report. Verdicts: MERGED, ARMED, GATE, FAILED, CLOSED, TIMEOUT, NOT_QUEUED. Exit codes: 0 merged or armed, 3 a gate (draft, waiting on a base PR, head moved, review required, changes requested, needs a rebase), 5 gh failed, 6 the PR closed or a check failed, 7 still waiting (call again with --settle 0), 8 auto-merge did not queue. With --json it prints the envelope with verdict, reason and next (done, wait, rebase, fix-ci or ask) and exits 0. --no-wait and --admin skip the checks and the wait: they print merge_rc=<code> (or admin_rc=) and what gh said, and exit 0. Never deletes the branch.

A PR stacked on another PR is gated bottom up (each unmerged PR must pass the same gate, and a stop names it as blocked_by=#<n>), then the whole stack is queued with the merge-async call pinned to the checked head, and the call waits until every PR has merged. --no-wait returns ARMED after the queue call. --admin is a usage error on a stack.

Example: playbook pr merge 12

  • <PR>: PR number
  • --no-wait: Arm auto-merge now and return, without waiting for checks or the merge
  • --admin: Squash with admin rights instead of arming auto-merge
  • --match-head <MATCH_HEAD>: With --no-wait or --admin, refuse unless the PR head is this commit
  • --timeout <TIMEOUT>: Give up after this many seconds in total
  • --interval <INTERVAL>: Seconds between reads
  • --settle <SETTLE>: Seconds to wait for the first checks to appear (use 0 on a repeat call)
  • --dir <DIR>: Work in this directory instead of the current one
  • --json: Print the envelope with verdict, reason and next, and exit 0

playbook pr prepare

Run pre-flight checks and gather what a PR draft needs

Finds the branch and base, checks the repo is ready, writes the diff to a scratch file, and prints labeled lines for the PR drafter.

Example: playbook pr prepare --base main

  • --base <BASE>: Base branch for the PR (default: the repo's default branch)
  • --ticket <TICKET>: Ticket id to cite (default: one found in the branch name)
  • --dir <DIR>: Work in this directory instead of the current one
  • --json: Print one JSON report instead of labeled lines
  • --args-stdin: Read the command's flags and the worktree phrase from stdin

playbook pr reply

Post one reply on a PR, from a file

--thread ID replies in a review thread (ID is the databaseId of the thread's first comment, as pr comments writes it); --issue comments on the PR itself. The body is read from --body-file, so quotes, backticks and newlines need no shell escaping. It refuses an empty body, an em or en dash, and AI attribution. Prints Posted: <url> and the body.

Example: playbook pr reply --pr 12 --thread 345 --body-file /tmp/reply.md

  • --pr <PR>: PR number
  • --thread <THREAD>: Reply in the review thread whose first comment has this databaseId
  • --issue: Comment on the PR itself
  • --body-file <BODY_FILE>: File holding the reply text
  • --repo <REPO>: owner/name; defaults to the current repo

playbook pr review

Review a PR

Subcommands: post, submit, triage

playbook pr review post

Create a pending review on a PR from a findings file

The findings file is JSON: commit_id, then comments, each with path, line, side and body, plus start_line and start_side for a range. A review body is optional; leave it out to frame the review at submit time. Creates the review pending, checks GitHub reports it PENDING (code 5 otherwise) and prints id=, state= and url=. With --json it prints the envelope and exits 0.

Example: playbook pr review post 12 --findings /tmp/findings.json

  • <PR>: PR number
  • --findings <FINDINGS>: Findings file to post as the pending review
  • --json: Print the envelope with id, state and url, and exit 0

playbook pr review submit

Submit a pending review as a comment, an approval or a change request

Sends the verdict for review ID and checks it left PENDING (code 5 otherwise). An approve with no --body says LGTM. Prints id=, state= and url=. With --json it prints the envelope and exits 0.

Example: playbook pr review submit 12 99 --event request-changes

  • <PR>: PR number
  • <ID>: Review id, as pr review post printed it
  • --event <EVENT>: How to submit the review (one of comment, approve, request-changes)
  • --body <BODY>: Text for the review
  • --json: Print the envelope with id, state and url, and exit 0

playbook pr review triage

Choose a quick or deep self-review for a PR

An empty diff or one over 60000 bytes is deep. Then the diff rules run (size, risky paths, docs-only and similar, no model): at high confidence their answer is final and prints source=rules with a signal: line per reason. Otherwise a small model is asked three times, and anything but a unanimous quick becomes deep (source=model). --model skips the rules. A rules error prints a note: line and falls through to the model.

Example: playbook pr review triage --pr 12 --scope stack

  • --pr <PR>: PR number (default: the current branch against its base)
  • --base <BASE>: Base branch when no PR number is given (default: the repo's default branch)
  • --dir <DIR>: Work in this directory instead of the current one
  • --scope <SCOPE>: What the rules measure: this PR alone, or every open PR in its stack (one of this-pr, stack)
  • --model: Skip the diff rules and ask the model only

playbook pr rules

Cut the skill rules a PR title and body need

Reads the writing-style and engineering-standards skills from the plugin root (playbook path plugin-root prints it), writes four files under /tmp, checks each, and prints their paths. A failed check prints ERROR: ... and exits 1. With --commit it writes only the commit-message slice of writing-style. When the plugin lacks one of the files, the copies built into this binary are used and stderr says so.

  • --plugin-root <PLUGIN_ROOT>: Plugin root (default: playbook path plugin-root, else the built-in copies)
  • --commit: Write only the slice a commit message needs

playbook pr stack

Find the PRs stacked with a PR

Reads the GitHub stack API, then falls back to the branch chain. Takes the arguments as one string (#12 --json --max-prs 6 --max-lines 3000). Prints a summary, or JSON with --json. --context writes one shared review context under /tmp/pr-stack-<pr>. --digest prints what the open PRs above the PR change, per file. map --stack <file> --findings <file> gives each finding to the PR whose diff holds the line and lists the findings a PR above changes under fixed_above.

  • <ARGS>: Command arguments as one string, such as #12 --json

playbook pr status

Read what the finish flow needs to know about a PR, in one call

One call for the finish flow. With --json it prints the shared envelope (ok, code, meaning, error) around the report and exits 0 even on failure: read ok and code. A usage error still exits 2. Without --json it prints the same report as text and exits with the code.

Example: playbook pr status 12 --json

  • <PR>: PR number
  • --json: Print the JSON envelope and exit 0
  • --flag <FLAG>: Treat the run mode as this one, as mode status --flag does (one of ask, auto)
  • --dir <DIR>: Work in this directory instead of the current one

playbook prose

Check prose against the writing-style rules

Subcommands: check

playbook prose check

Lint files for banned phrases, structures and em or en dashes

Prints path:line: finding for each problem. Fenced code, inline code, URLs, file paths and quoted lines are skipped. Exits 0 unless --strict is given and a hard finding exists, or a file cannot be read. With GITHUB_ACTIONS=true it prints annotations.

Example: playbook prose check README.md

  • <FILES>: Files to check
  • --strict: Exit 1 when a hard finding exists

playbook review

Run the mechanical steps behind the review commands

Subcommands: checks, lenses, prepare, size, triage

playbook review checks

Run a project's own type check, lint and tests in a directory

Prints their output. A failing check is output, not an error. With --list it prints the commands, one per line, and runs none.

Example: playbook review checks /tmp/review-wt

  • <DIR>: Review worktree to run in
  • --list: Print the commands instead of running them

playbook review lenses

Pick the conditional review lenses a diff calls for

Subcommands: pick

playbook review lenses pick

Name the conditional review lenses a diff triggers

Applies the deep review's trigger table to BASE...HEAD (no network): architecture, big-o, complexity, integration, migration, docs, dedup and adr. Prints one lens: trigger line per lens, or NONE. With --json it prints the shared envelope with a lenses array of {lens, trigger}.

Example: playbook review lenses pick --base main --json

  • --base <BASE>: Branch the diff starts from. Defaults to the repo's default branch
  • --json: Print the picks as the shared JSON envelope

playbook review prepare

Resolve the PR, report-only or posting, and in-place or worktree

Takes the raw arguments of the review command as one string. Prints KEY=value lines: PR, REPO, PR_NUMBER, HEAD_SHA, AUTHOR, SELF_REVIEW, SELF_MODE, MODE, WT and REVIEW_JSON. On a problem it prints error: ... and exits 1.

Example: playbook review prepare deep "#4265 --self"

  • <KIND>: Which review: quick or deep (one of quick, deep)
  • <ARGS>: Review command arguments as one string, such as #12 --self
  • --auto: Accepted for compatibility; auto mode does not skip the post question

playbook review size

Measure a diff and say which review path it takes

Counts the changed lines of BASE...HEAD and prints lines=N files=M path=single|swarm. A diff of at most 150 changed lines takes the single path, one reviewer holding every lens; a larger one, or any run with --all-lenses, takes swarm.

Example: playbook review size --base main

  • --base <BASE>: Ref the diff starts from
  • --head <HEAD>: Ref the diff ends at
  • --all-lenses: Always take the swarm path
  • --dir <DIR>: Repo directory to measure in. Defaults to the current directory

playbook review triage

Work with the lens tier map that review triage returns

Subcommands: merge

playbook review triage merge

Complete a review-triage tier map so no lens is left unclassified

Reads the triage reply (a JSON object of {lens: {tier, reason}}) from --tiers FILE, or - for stdin, and prints the full map as JSON plus a Triage: lens=tier, ... line. A missing or unusable reply, a lens the reply left out, and a tier other than skip, cheap-check or full-lens all become full-lens.

Example: playbook review triage merge --lenses security,logic --tiers triage.json

  • --lenses <LENSES>: Every lens that was sent to triage, comma separated
  • --tiers <TIERS>: File holding the triage reply, or - for stdin; omit when triage returned nothing
  • --force <FORCED>: Fix a lens's tier whatever triage said, as lens=tier:reason (repeatable)

playbook route

Say which model, effort and agent a kind of task goes to

One routing table for every command that dispatches agents. Kinds: mechanical, classify, check, review, write, implement, design. Only implement reads --tier (low, medium or high). The answer includes whether the user must approve first (the top model, the high tier, or a task that failed twice). routing.escalate decides what happens then: ask tells you to ask the user, auto (default) proceeds (auto mode and auto.budget.mainUsd still cap the spend), deny returns the cheaper route. Your effort ceiling always wins.

Example: playbook route implement --tier medium --json

  • <KIND>: One of mechanical, classify, check, review, write, implement or design
  • --tier <TIER>: One of low, medium or high. Only implement reads it
  • --failures <FAILURES>: How many times this task already failed
  • --json: Print the decision as JSON

playbook sanitize

Remove AI attribution lines from message text

For callers that are not an agent hook, such as a git commit-msg hook or CI. Each subcommand rewrites FILE in place unless --check is given, and prints one line per removed line to stderr: its number and the shape of the attribution, never its text. Without --check the exit code is always 0, even when FILE cannot be read or written.

Subcommands: commit, pr

playbook sanitize commit

Clean a commit message file, such as git's .git/COMMIT_EDITMSG

Example: playbook sanitize commit .git/COMMIT_EDITMSG

  • <FILE>: File holding the message
  • --check: Report what would be removed, without writing. Exits 1 if anything would be removed, and 2 if FILE cannot be read

playbook sanitize pr

Clean a PR title or body saved to a file

Example: playbook sanitize pr /tmp/body.md

  • <FILE>: File holding the text
  • --check: Report what would be removed, without writing. Exits 1 if anything would be removed, and 2 if FILE cannot be read

playbook segment

Run the git recipes /playbook:implement uses for a Segment

Subcommands: branch, size, unit, verify

playbook segment branch

Put HEAD on the branch a Segment is built on

Names the branch <type>/<plan-slug>-s<N>-<title> and creates it from the right base: the default branch for independent Segments, the previous Segment's branch for stacked ones (fetched when it is not local), and always the fetched origin/<default> under --land. The single topology creates nothing and reports the current branch and tip. Prints branch=<name> base=<sha> base_ref=<ref>. Exits 1 when the branch already exists.

Example: playbook segment branch --type feat --plan-slug my-plan --n 2 --title "Parser core" --topology stacked --prev-branch feat/my-plan-s1-schema

  • --type <KIND>: Conventional commit type for the branch name, such as feat
  • --plan-slug <PLAN_SLUG>: Plan slug
  • --n <N>: Segment number
  • --title <TITLE>: Segment title, kebab-cased and truncated into the branch name
  • --default-branch <DEFAULT_BRANCH>: Default branch of the repo
  • --dir <DIR>: Repo directory to run in. Defaults to the current directory
  • --topology <TOPOLOGY>: How the plan's Segments are delivered (one of stacked, independent, single)
  • --prev-branch <PREV_BRANCH>: Previous Segment's branch, for a stacked Segment past the first
  • --land: Branch off the fetched origin default branch, at the land boundary

playbook segment size

Measure a Segment against its base

Prints lines=N files=M for BASE...HEAD.

Example: playbook segment size --base main

  • --base <BASE>: Base ref of the Segment
  • --dir <DIR>: Repo directory to run in. Defaults to the current directory

playbook segment unit

Run one Work Unit of a parallel wave in its own worktree

Subcommands: integrate, resume, start

playbook segment unit integrate

Squash a unit's checkpoints onto the Segment branch

Soft resets the worktree to --base, commits only --files with the signing and sign-off the commit run path uses, cherry-picks that commit onto --branch (the checkout in --dir must be on it) and removes the worktree. Prints integrated=<sha> branch=<branch>. On a cherry-pick conflict it restores the checkout, keeps the worktree, writes a .playbook-conflict-stop marker there and exits 1.

Example: playbook segment unit integrate WU-3 --base abc1234 --path ../wt/plan/wu-3 --branch feat/plan-s1-core -m "feat(core): add the parser" --files docs/a.md docs/b.md

  • <WU>: Id of the Work Unit
  • --base <BASE>: Commit the unit started from
  • --path <PATH>: Worktree of the unit
  • --branch <BRANCH>: Segment branch to cherry-pick onto
  • -m, --message <MESSAGE>: Commit message of the squashed commit
  • --files <FILES>: Files of the unit; nothing else is committed
  • --dir <DIR>: Checkout of the Segment branch. Defaults to the current directory
  • --json: Print the report as the shared JSON envelope

playbook segment unit resume

Say which TDD step comes next for a unit

Reads the wip(<wu>): red|green|refactor - <scenario> commits between --base and HEAD of --dir. Prints last=<step> scenario=<id> next=<step>, or last=none next=red with no checkpoint. After a refactor, next=red starts the following scenario.

Example: playbook segment unit resume WU-3 --base abc1234 --dir ../wt/plan/wu-3

  • <WU>: Id of the Work Unit
  • --base <BASE>: Commit the unit started from
  • --dir <DIR>: Worktree of the unit. Defaults to the current directory
  • --json: Print the report as the shared JSON envelope

playbook segment unit start

Add a Work Unit's worktree at its base commit

Runs git worktree add --detach at --base and prints worktree=<path> base=<sha>. A worktree already at the path is reported, not recreated.

Example: playbook segment unit start WU-3 --base abc1234 --path ../wt/plan/wu-3

  • <WU>: Id of the Work Unit
  • --base <BASE>: Commit the unit starts from: the Segment branch tip
  • --path <PATH>: Where to create the worktree
  • --dir <DIR>: Repo directory to run in. Defaults to the current directory
  • --json: Print the report as the shared JSON envelope

playbook segment verify

Say whether a branch's files match the fetched default branch

Fetches origin/<default branch> and compares the listed files with the branch. Prints match=true, or match=false differing=a,b and exits 1. After a squash merge the trees match even though the commits do not. With --json it prints the shared envelope with matches and a differing array.

Example: playbook segment verify --branch feat/my-plan-s1-schema --files a.txt b.txt

  • --branch <BRANCH>: Branch that should have landed
  • --files <FILES>: Files to compare; nothing else is read
  • --default-branch <DEFAULT_BRANCH>: Default branch of the repo
  • --dir <DIR>: Repo directory to run in. Defaults to the current directory
  • --json: Print the verdict as the shared JSON envelope

playbook sessions

List recent agent sessions and their state

Shows the repo, branch, worktree, linked PR, state, context size and cost of each session. Read only. A session is done when the PR of its branch is merged or closed, and stale after a few days without activity. Suggestions are printed, never acted on, and a worktree with uncommitted changes is flagged, never removed.

Example: playbook sessions --json

  • --json: Print the sessions as JSON

Subcommands: list, sweep

playbook sessions list

List recent sessions (the default)

  • --json: Print the sessions as JSON

playbook sessions sweep

Show what a sweep would close for each finished session

Judges each finished session's worktree with the same guards as playbook worktree remove: landed, clean, unlocked and not in use. A stale session is listed but not swept. Only the dry run exists: it removes nothing, stops no process and closes no tab or pane.

Example: playbook sessions sweep --dry-run

  • --dry-run: Report only and change nothing (required)

playbook settings

Create or check the shared settings template

Subcommands: check, gen

playbook settings check

Check the shared settings template is valid

Exits 0 when valid and 1 with a message when not.

Example: playbook settings check seed/shared-settings.json .

  • <TEMPLATE>: Shared settings template to check
  • <REPO_ROOT>: Repo root that every hook command must resolve inside

playbook settings gen

Create the shared settings template from a live settings.json

Takes the hooks and status line from the live file and keeps the permissions of the current seed. Prints the new seed.

Example: playbook settings gen ~/.claude/settings.json seed/shared-settings.json

  • <SRC>: Live settings.json to start from
  • <SEED>: Current seed, whose permissions block is kept

playbook setup

Install or repair your local Claude Code setup

Safe to run again: it only touches what is missing or out of date. In a terminal it asks about each optional part (hooks, status line, PATH, the system prompt, the pb short name) unless you answer with a flag. Each part has --x and --no-x. With --yes, unanswered parts use their defaults, and every asked part is on: hooks, the status line, PATH, the system prompt and pb. The system prompt stays off when systemPrompt.enabled is false or an earlier install had none, and pb stays off after a stored no. Telemetry is on by default too: the question defaults to yes and --yes is a yes, but --yes alone never replaces an off switch you set. Without a terminal and without --yes, only PATH is on: hooks, the status line, the system prompt, pb and telemetry stay off unless you pass their flag. --only telemetry (or a bare --telemetry) runs just that part; --only takes any parts and leaves everything else alone.

The security defaults (permissions rules) are never asked about and stay off unless you pass --security or set security.defaults to true. Without them, setup leaves any permissions you already have untouched.

Before it asks anything, setup prints a plan of each part and the files it edits. --dry-run shows what would change on your machine and changes nothing. --explain describes a part, or every part, and changes nothing.

Example: playbook setup --no-hooks --system-prompt

  • --plugin: Install or update the playbook plugin in Claude Code with the claude command. Given by name it runs even without a terminal, with upgrade.plugin off or in CI
  • --no-plugin: Leave the playbook plugin as it is
  • --hooks: Wire every playbook hook into settings.json (guards, session and worktree hooks)
  • --no-hooks: Add no playbook hook entries, including the guards in the shared settings
  • --statusline: Use the playbook status line (sets statusLine.command to playbook statusline)
  • --no-statusline: Do not set or change statusLine in settings.json
  • --security: Also apply the security defaults (permissions rules). Off unless asked or security.defaults is true
  • --no-security: Do not apply the security defaults, even when security.defaults is true
  • --path: Put the playbook binary on PATH for every shell start
  • --no-path: Do not edit shell files for PATH
  • --system-prompt: Install the playbook system prompt (an existing copy is refreshed either way)
  • --no-system-prompt: Do not install the system prompt. It stores systemPrompt.enabled false so pb cc starts with Claude Code's own
  • --telemetry: Answer yes to the telemetry question. Writes the OpenTelemetry variables for the local usage collector into settings.json. Given alone it means --only telemetry
  • --no-telemetry: Do not write telemetry variables into settings.json
  • --short-name: Add pb as a short name for playbook. Makes a pb -> playbook symlink in the install directory, only when pb is free
  • --no-short-name: Do not add the pb short name
  • --completions: Install tab completion for playbook and pb in the shell named by $SHELL
  • --no-completions: Do not install shell completion
  • --policy-guard: Turn the policy guard on (hooks.policyGuard.enabled). It denies skipped git hooks, a hand-run gh pr create, Claude Code memory writes and settings.json edits
  • --no-policy-guard: Do not turn the policy guard on; it is off by default and a stored choice is not changed
  • --attribution: Attribution ON: Claude Code adds its Co-Authored-By trailer, generated-by line and session link. Removes each attribution key in settings.json that holds exactly the off value playbook writes, and stores attribution.enabled true
  • --no-attribution: Attribution OFF. Claude Code adds no trailer, generated-by line or session link. Sets attribution in settings.json, replacing your own values. Setup applies this when you choose nothing and have not chosen ON before
  • --codex-hooks: Register the playbook Bash guards in the hooks.json of Codex (off unless asked)
  • --no-codex-hooks: Do not register guards in Codex
  • --only <PART>: Run only these parts and ask nothing. Parts, comma separated: plugin, hooks, statusline, security, path, system-prompt, telemetry, short-name, completions, policy-guard, attribution, codex-hooks. Everything else stays untouched. playbook setup --only telemetry turns telemetry on, and --only attribution applies attribution OFF unless you chose ON
  • -y, --yes: Never ask: use the default for every part you did not answer with a flag
  • --dry-run: Print what would change for each part and change nothing
  • --explain <PART>: Describe a part, or every part when none is named, and change nothing

playbook skills

Share the playbook skills with other agents

sync copies the plugin's skills and commands into the folder that Codex reads, ~/.agents/skills, as playbook-* folders. It never touches folders you made yourself or edited.

Example: playbook skills sync --dry-run

Subcommands: sync

playbook skills sync

Copy the playbook skills into another agent's skill directory

Without --agent, every agent found on this machine is synced. A second run with nothing new changes nothing.

Example: playbook skills sync --agent codex

  • --agent <AGENT>: Sync only this agent (one of codex)
  • --dry-run: Show what would change and write nothing
  • --json: Print the report lines as a JSON array

playbook state

Inspect playbook's own bookkeeping (migration record, sweep markers)

list prints the rows of the state table in config.db, sorted by key, optionally only those under a prefix. Read only: use playbook setup to repair and playbook config export to back up the config.

Example: playbook state list migrations/

Subcommands: list

playbook state list

Print the state rows, sorted by key

  • <PREFIX>: Only keys that start with this prefix
  • --json: Print the rows as one JSON object

playbook statusline

Print the Claude Code status line

Claude Code runs this to draw the line at the bottom of a session.

playbook sync

Share usage between your machines, or turn that off

Sync is off until you run playbook sync enable. It sends only the usage columns it lists to your own Turso database. Most names run the pbsync helper that ships next to playbook, and playbook sync config shares the settings that may sync. pbsync is a short name for the same commands.

Example: playbook sync status

Subcommands: config, disable, enable, pull, purge, push, run, status

playbook sync config

Share the settings that may sync, or apply what other machines sent

push sends your shared global values and pull writes a proposal that changes nothing. apply shows the proposal next to your values and applies it when you answer yes.

Example: playbook sync config apply

  • <ARGS>: Words for the helper when no subcommand matches

Subcommands: apply, pull, push

playbook sync config apply

Apply the settings that playbook sync config pull proposed

Shows each proposed value next to your current global value and asks before it stores anything. Only keys that may sync are accepted, and each value is checked like config set. A project value still wins over the global one. Nothing changes unless you answer yes or pass --yes.

Example: playbook sync config apply --yes

  • --yes: Apply without asking

playbook sync config pull

Write the settings other machines sent as a proposal

Changes no setting. Run playbook sync config apply to review it.

Example: playbook sync config pull

  • <ARGS>: Flags for the helper

playbook sync config push

Send the shared global setting values

Refreshes the key list and values files first.

Example: playbook sync config push

  • <ARGS>: Flags for the helper

playbook sync disable

Turn sync off and keep the local data

Example: playbook sync disable

  • <ARGS>: Flags for the helper

playbook sync enable

Turn sync on for the accounts you name

Shows what will be sent and asks before it turns sync on. Pass --url for your Turso database, --account for each account to sync, and --yes to skip the question.

Example: playbook sync enable --url https://db.example.turso.io --account me

  • <ARGS>: Flags for the helper, such as --url

playbook sync pull

Copy the usage rows other machines sent

Example: playbook sync pull

  • <ARGS>: Flags for the helper, such as --force

playbook sync purge

Remove this machine's rows from the shared database

Clears the local copies and turns sync off. --all removes every machine's rows and asks first.

Example: playbook sync purge --yes

  • <ARGS>: Flags for the helper, such as --all

playbook sync push

Send new usage rows to the shared database

Example: playbook sync push --force

  • <ARGS>: Flags for the helper, such as --force

playbook sync run

Push, then pull, then share the settings that may sync

The old pbsync sync.

Example: playbook sync run

  • <ARGS>: Flags for the helper, such as --force

playbook sync status

Show whether sync is on and its local state

Makes no network call.

Example: playbook sync status

  • <ARGS>: Flags for the helper

playbook tools

List the commands a session can use for each task

Subcommands: map

playbook tools map

Print the map from each task to the command that does it. The session start hook injects this text, so skills can ask for a task by name

  • --json: Print [{"intent", "command"}] as JSON
  • --check: Exit 1 when the map costs more than its token budget

playbook trust

Mark a directory as trusted in Claude Code

Writes to ~/.claude.json so Claude Code's first-launch trust prompt does not block playbook cc or playbook ccd. Always exits 0, even on failure, so a script can call it without checking.

Example: playbook trust /Users/me/project

  • <PATH>: Absolute path of the directory to trust

playbook uninstall

Remove what playbook installed from this machine

Takes out the hook entries and status line that playbook setup wrote into settings.json, the launcher block in your shell rc files, and the files playbook placed under ~/.config/playbook. It stops and removes a collector service that an older setup installed, under the current or the 0.37.0 launchd label. Everything else in settings.json and the rc files stays, each changed file is backed up first, and memory, sessions and history are never touched. The playbook binary stays unless you pass --remove-binary. It changes nothing without --yes; --dry-run lists what would go.

Example: playbook uninstall --dry-run

  • --yes: Go ahead and remove (without it, nothing is changed)
  • --dry-run: List what would be removed and change nothing
  • --remove-binary: Also remove the playbook binary, its backups and the PATH line the installer added

playbook upgrade

Upgrade playbook to a published release, and its plugin with it

Looks up the latest release and compares it with this binary. When it is newer, shows both versions and asks you to confirm in a terminal; --yes skips the question. With no terminal and no --yes, it prints the hint and changes nothing. After you confirm, it downloads the release, checks its SHA256 sum and, when gh is installed, its build attestation, then swaps the binary and keeps the old one as a backup. In auto mode it refuses unless you pass --yes.

Then it runs the plugin step of playbook plugin install and playbook plugin upgrade so the plugin matches the new binary: it adds the marketplace when it is missing, turns on autoUpdate for it, and installs or updates the plugin. Pass --no-plugin or set upgrade.plugin to off to skip that step. To change only the plugin, run playbook plugin upgrade.

A Homebrew install is never replaced: upgrade checks for a newer release, says Homebrew owns the binary, and tells you to run brew upgrade playbook. It exits 0.

--check and --list change nothing. --check exits 0 whether or not a newer release exists, and 1 on an error such as an unreachable release list or an unknown version. --json prints one object in the shared envelope and exits 0 whatever the result.

Example: playbook upgrade --check

  • --check: Only report whether an update is available
  • --list: List published releases
  • --pre: Consider pre-releases when picking the latest
  • --yes: Skip the confirmation question, and confirm the upgrade when auto mode is on
  • --json: Print one JSON object in the shared envelope, and exit 0 whatever the result
  • --no-plugin: Leave the playbook plugin in Claude Code as it is. By default upgrade installs or updates it, unless the config key upgrade.plugin is off

playbook usage

Show token and cost usage across your sessions

With no subcommand, opens the terminal view, which opens on this month compared with last month. When stdout is not a terminal, or with --summary, prints a text summary of estimated cost instead. --json prints the same numbers as JSON for scripts. Times and days use your local time zone, shown in the output; --utc switches to UTC, or set usage.timeZone or PLAYBOOK_TELEMETRY_TZ to local or utc. Ranges: today, week, last-week, month, last-month, 30d, 60d, 90d, all. Weeks start on Monday unless usage.weekStart says otherwise. For today, week and month, --json adds a comparison with the previous period over the same elapsed span, and --summary prints it. The cost per agent and skill, tool latency and health views come from Claude Code's OpenTelemetry export when it is available, see playbook usage collect.

Example: playbook usage --range today

  • --json: Print the totals, groupings and live view as JSON
  • --summary: Print the text summary and exit (every recorded session unless --range is given)
  • --range <RANGE>: Date range, counted in days of the chosen time zone. One of today, week, last-week, month, last-month, 30d, 60d, 90d or all. Default month for the terminal view, 30d for --json, all for --summary
  • --account <KEY_OR_NAME>: Show only one account, by key or name. Scopes --summary and --json, and the terminal view opens on it
  • --utc: Show times and group days in UTC. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ
  • --local: Show times and group days in your local time zone. This is the default. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ

Subcommands: account, collect, doctor, machine, prune, status, stop

playbook usage account

List the accounts in the usage store, name them and move events

Every usage event carries an account key: the email Claude Code was signed in to, or a token: fingerprint. These commands show the keys, give each one a display name and relabel events recorded under the wrong account.

Example: playbook usage account list

  • --db <FILE>: Usage database file to use instead of the default, such as a backup copy
  • --utc: Show times and group days in UTC. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ
  • --local: Show times and group days in your local time zone. This is the default. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ

Subcommands: assign, fingerprint, list, name, reconcile, sessions, undo

playbook usage account assign

Move events to another account, by time range or by session

Prints how many events and how much cost would move and changes no events until you add --confirm. Times are read on your local clock; add --utc for UTC. By time, give --from and --to (the end is not included) and each event moves by its own time. By session, give --before-session or --through-session with --from or --from-session as the start, and every event of each session that starts in that span moves. An applied move is numbered and account undo reverses it. Running the same move again moves nothing.

To change one session only, add --session: it limits the move to the events of that session. With --from or --to it moves that part of the session; without them it moves the whole session.

Example: playbook usage account assign --from 2026-11-01T00:00 --to 2026-11-02T12:00 --as personal

  • --from <FROM>: First instant to move, like 2026-11-01T00:00 (a bare date means midnight)
  • --to <TO>: First instant not to move, like 2026-11-02T12:00
  • --from-session <SESSION>: Start with the sessions from this one on (its id from account sessions)
  • --before-session <SESSION>: End before this session starts
  • --through-session <SESSION>: End with this session included
  • --session <SESSION>: Move only events of this session (its id from account sessions)
  • --as <KEY_OR_NAME>: Account key or name that receives the events
  • --was <KEY_OR_NAME>: Move only events now labeled with this account key or name
  • --confirm: Apply the move; without it nothing changes
  • --db <FILE>: Usage database file to use instead of the default, such as a backup copy
  • --utc: Show times and group days in UTC. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ
  • --local: Show times and group days in your local time zone. This is the default. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ

playbook usage account fingerprint

Print the account key for CLAUDE_CODE_OAUTH_TOKEN in this shell

A session started with that variable set is recorded under a key like token:ab12cd34, made from the token with a one way hash. This prints the key and never the token. Run it in a shell that has the variable set, then use the key with account name and account assign.

Example: playbook usage account fingerprint

  • --db <FILE>: Usage database file to use instead of the default, such as a backup copy
  • --utc: Show times and group days in UTC. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ
  • --local: Show times and group days in your local time zone. This is the default. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ

playbook usage account list

List the accounts with their events, cost and time span

  • --db <FILE>: Usage database file to use instead of the default, such as a backup copy
  • --utc: Show times and group days in UTC. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ
  • --local: Show times and group days in your local time zone. This is the default. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ

playbook usage account name

Give an account key a display name, or clear it with an empty name

Example: playbook usage account name you@example.com Company

  • <KEY>: Account key shown by account list
  • <NAME>: Display name to show; empty clears it
  • --db <FILE>: Usage database file to use instead of the default, such as a backup copy
  • --utc: Show times and group days in UTC. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ
  • --local: Show times and group days in your local time zone. This is the default. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ

playbook usage account reconcile

Compare cost on each side of session boundaries with a dashboard

Give the daily totals you read from the Claude web dashboard of the account that owns the later sessions, as YYYY-MM-DD=amount. For each session that starts in the window, taken as the boundary, it prints the local cost per listed day before it and from it on, and how far the later side is from the dashboard. The closest boundaries print first. Days are on your local clock; add --utc for UTC.

Example: playbook usage account reconcile --from 2026-10-30 --to 2026-11-04 --dashboard 2026-11-03=285.03

  • --from <FROM>: Start of the window, like 2026-10-30
  • --to <TO>: End of the window (not included)
  • --dashboard <DAY=AMOUNT>: Dashboard daily total, like 2026-11-03=285.03; repeat for more days
  • --top <TOP>: Print this many results, closest boundary first; 0 prints all
  • --db <FILE>: Usage database file to use instead of the default, such as a backup copy
  • --utc: Show times and group days in UTC. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ
  • --local: Show times and group days in your local time zone. This is the default. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ

playbook usage account sessions

List the sessions that start in a window

Shows each session id with its first and last event time, repo, event count, cost and account label, oldest first. Use an id as the boundary of account assign. Times are on your local clock; add --utc for UTC. The window is the last 7 days unless --from and --to say otherwise.

Example: playbook usage account sessions --from 2026-10-30 --to 2026-11-04

  • --from <FROM>: Start of the window, like 2026-10-30 or 2026-10-30T08:00
  • --to <TO>: End of the window (not included)
  • --db <FILE>: Usage database file to use instead of the default, such as a backup copy
  • --utc: Show times and group days in UTC. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ
  • --local: Show times and group days in your local time zone. This is the default. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ

playbook usage account undo

Reverse the newest applied move, or the one with this number

  • <ID>: Move number printed by account assign
  • --db <FILE>: Usage database file to use instead of the default, such as a backup copy
  • --utc: Show times and group days in UTC. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ
  • --local: Show times and group days in your local time zone. This is the default. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ

playbook usage collect

Run the local OpenTelemetry receiver in the foreground

Listens on 127.0.0.1 only (default port 47318, chosen once and then kept; a free port is chosen on the first run when that one is taken; an existing install keeps the port it recorded) and stores API request cost and token rows, tool call timings and API errors from Claude Code's JSON telemetry. Prompts, tool content, paths, emails and user ids are never stored. A second start reports the running collector (playbook usage status shows it too). It stops by itself after the idle time, counted from the last real telemetry request, so a status check does not keep it alive. Use --idle-seconds 0 to keep it running in a tmux window. Sessions that sent no telemetry are read from transcripts as before. While it runs, cc points its sessions at it unless usage.telemetry is off or you set telemetry yourself. When the settings that setup wrote point at it and none runs, playbook commands and hooks start one with --idle-seconds 0 (see docs/internals/04-usage-dashboard.md).

Example: playbook usage collect --idle-seconds 1800

  • --port <PORT>: Port to listen on. It is an error when the port is busy. Defaults to the recorded port, chosen once (47318, or a free one when that is taken) and kept. A port given here also replaces the recorded one; run playbook setup --only telemetry afterwards (older versions: playbook init --only telemetry)
  • --idle-seconds <IDLE_SECONDS>: Stop after this many seconds with no request; 0 means never
  • --utc: Show times and group days in UTC. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ
  • --local: Show times and group days in your local time zone. This is the default. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ

playbook usage doctor

Show where pbtop can read your usage limits on this machine

Lists which sources exist: the plan fields and cached usage numbers in the Claude Code config file (~/.claude.json), the statusline reading and the manual usage.budget.* keys. It prints field names, ages, the plan label, the window percentages and the manual budget amounts, and never an email, name, id, organization or token. Run it on a machine where the limits look wrong and share the output. Add --raw to also print the values of six plan fields (billing type, organization type, seat tier, the two rate limit tiers and the extra usage flag) and the numbers behind each choice: the cache fetch time as written, the type of each cache field, and the monthly amount used against the reported limit and your budget, in dollars. It also says what the statusline budget line will show. It only reads files and creates nothing.

Example: playbook usage doctor --raw

  • --raw: Also print the plan field values and the cached spend limit
  • --utc: Show times and group days in UTC. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ
  • --local: Show times and group days in your local time zone. This is the default. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ

playbook usage machine

Show this machine's id and name, or rename it

The id is a random UUID made once and kept in the data folder, so it survives a changed hostname or home folder. The name defaults to the hostname. Both stay on this machine.

Example: playbook usage machine --name laptop

  • --name <NAME>: Display name to keep for this machine; an empty name restores the hostname
  • --utc: Show times and group days in UTC. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ
  • --local: Show times and group days in your local time zone. This is the default. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ

playbook usage prune

Delete old telemetry rows

Removes telemetry rows older than 90 days and the oldest rows beyond 500000 per table. The receiver does the same when it starts and every few hours. Transcript data and every total are left alone, because totals come from transcripts.

Example: playbook usage prune --dry-run

  • --dry-run: Say what would be removed without deleting anything
  • --utc: Show times and group days in UTC. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ
  • --local: Show times and group days in your local time zone. This is the default. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ

playbook usage status

Show whether the telemetry receiver is running

Prints how telemetry is configured (on with the collector running, off because you disabled it in your Claude Code settings, or off because nothing sets it) with a one-line fix, then the pid, port, idle limit, how many telemetry rows are stored (API requests, tool calls, API errors, metric points), the retention limits, and the time of the newest event. Like most playbook commands it can start the collector first. It never prints the token. With --json it prints the same as JSON. Exit code 0 whether or not a receiver runs.

Example: playbook usage status --json

  • --json: Print the status as JSON
  • --utc: Show times and group days in UTC. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ
  • --local: Show times and group days in your local time zone. This is the default. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ

playbook usage stop

Stop the running telemetry collector

Asks the collector that holds the lock to stop through its authenticated shutdown route and waits up to 3 seconds for it to let go. One that does not answer is killed, but only after checking that the process is really the playbook collector. Prints stopped, or not running with exit code 0 when no collector runs. The next playbook command or session starts a new one. A collector from 0.38.0 or older holds no lock, so this does not see it.

Example: playbook usage stop

  • --utc: Show times and group days in UTC. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ
  • --local: Show times and group days in your local time zone. This is the default. Overrides usage.timeZone and PLAYBOOK_TELEMETRY_TZ

playbook version

Print the installed version, same as --version

playbook watch

Poll GitHub issues and comments and act on them by rules

Rules live in watch.rule.<id> and watch.repos lists the repos. At the default level a matching event becomes a proposal that nothing acts on until you approve it. The GitHub token is read from the environment variable named by watch.tokenEnv (GITHUB_TOKEN when unset).

With no verb it runs in the foreground until you stop it, polling every watch.pollSeconds and picking up after a laptop sleep from where it stopped. A second foreground run prints watch already running and exits 1.

Example: playbook watch once

Subcommands: approve, log, once, pause, reject, resume, retry, service, status

playbook watch approve

Carry out a proposal

Runs the action now. When another watch process is running it only marks the item and that process carries it out.

Example: playbook watch approve 3

  • <ID>: Proposal number printed by watch once

playbook watch log

Print the audit log, oldest first

Example: playbook watch log --rule triage --outcome done

  • --rule <RULE>: Only records of this rule
  • --outcome <OUTCOME>: Only records with this outcome, such as done or retry
  • --json: Print each record as a JSON line

playbook watch once

Poll every repo once and run the items you approved

A repo watched for the first time starts from now, so turning watch mode on never replays old issues. Prints watch already running and exits when another watch process holds the lock. With --dry-run it shows the rules and what a poll would propose, and changes nothing.

Example: playbook watch once --since 2026-11-01T00:00:00Z

  • --since <SINCE>: Replay events from this UTC time, for example 2026-11-01T00:00:00Z
  • --dry-run: Show the rules and what a poll would propose, and change nothing

playbook watch pause

Stop starting new actions

An action that is already running finishes. Proposals still queue.

Example: playbook watch pause

playbook watch reject

Drop a proposal without acting on it

Example: playbook watch reject 3

  • <ID>: Proposal number printed by watch once

playbook watch resume

Start new actions again after a pause

Example: playbook watch resume

playbook watch retry

Put a dead item back in the queue

Example: playbook watch retry 3

  • <ID>: Number of the dead item, shown by watch status

playbook watch service

Install or remove the timer that runs watch once

Subcommands: install, uninstall

playbook watch service install

Install a timer that runs watch once every 60 seconds

A launchd agent on macOS and a systemd user timer on Linux. No process stays running between polls. The timer finds the GitHub token through gh auth token, so run gh auth login first.

Example: playbook watch service install

playbook watch service uninstall

Remove the timer that service install made

The audit log stays unless you ask for it to go.

Example: playbook watch service uninstall --delete-log

  • --delete-log: Also delete the audit log

playbook watch status

Show whether watch runs, the queue, the limits and the dead list

Example: playbook watch status --json

  • --json: Print the status as JSON

playbook worktree

Clean up git worktrees whose branches have landed

Locked worktrees are kept unless the process that locked them is gone.

Example: playbook worktree sweep --dry-run

Subcommands: remove, review, sweep

playbook worktree remove

Remove one worktree if it has landed and is not in use

Example: playbook worktree remove ../.worktrees/my-repo/my-branch

  • <PATH>: Worktree path, as shown by git worktree list

playbook worktree review

Create or remove the locked review worktrees

/playbook:review --quick and /playbook:review --deep run in them.

Subcommands: setup, teardown

playbook worktree review setup

Add a locked worktree for a PR head and print its path

Fetches the PR head, adds a locked detached worktree for it, and prints its absolute path on stdout. Warnings go to stderr.

Example: playbook worktree review setup 12 0123456789abcdef0123456789abcdef01234567

  • <PR>: PR number
  • <HEAD_SHA>: Full head commit sha the review was resolved against

playbook worktree review teardown

Remove a review worktree, even a dirty one

Always exits 0, and skips any path outside the review worktrees.

Example: playbook worktree review teardown .git/review-worktrees/12-0123456

  • <PATH>: Worktree path printed by setup

playbook worktree sweep

Remove every landed worktree that is not in use

Scans all worktrees of this repo, whichever tool made them. Keeps locked ones unless the locking process is dead.

  • --dry-run: Show what would be removed without removing anything