Skip to content

CLI Reference

Find commands, options, and examples for startup, authentication, sessions, cleanup, and worktree management.

For installation and first-time setup, start with the Quickstart.

chord [global flags] [command] [command flags] [args]

Without a command, chord runs the local TUI in the current directory.

Command Purpose
chord Run the local TUI
chord auth [provider] Sign in with a preset: codex OAuth provider
chord config add [<provider>/<model>] Browse the verified catalog, or add a known model reference, and append it to a pool
chord config advise Review and apply catalog-based model configuration recommendations
chord config refresh-catalog Pull the latest tagged catalog snapshot from the upstream data repository
chord takeover <action> Start or query a transfer, or retry saving, with bounded JSON output
chord headless Run without TUI; stdio JSON control plane
chord acp Serve the Agent Client Protocol over stdio for ACP clients
chord doctor config Validate global/project config files and model pool references
chord doctor models Diagnose configured provider/model calls
chord doctor skills Diagnose skill discovery, loading, and visibility
chord doctor agents Diagnose agent definitions and external backend commands
chord cleanup status Inspect state/cache/log sizes managed by the path locator
chord cleanup <kind> Clean sessions / dumps / cache / logs / project (dry-run by default)
chord worktree list List chord-managed worktrees of the current repository
chord worktree remove <name> Remove a chord-managed worktree
chord worktree finish <name> Merge the target branch into the real worktree, squash the result back as one commit, then remove the worktree
chord resume <session-id> Resume a session by ID, auto-locating its worktree
chord import <source> [file] Import an external session into Chord’s session store and convert recognizable external tools to current Chord tool cards
chord sessions list List recent sessions and ownership without writing session files
chord sessions project <id> Project a persisted session into per-turn JSONL facts (read-only)
chord completion <shell> Generate shell completion scripts for bash, fish, powershell, or zsh
chord help [command] Show command help

These flags are accepted by every command and are merged with environment variables and config.yaml (CLI flag wins, then env var, then config file).

Flag Description Env var Default
--api-base Override the provider base URL for this invocation; when set, it takes precedence over each provider’s api_url CHORD_API_BASE empty
--config-home Config home directory containing config.yaml, auth.yaml, agents/, skills/, commands/ CHORD_CONFIG_HOME $XDG_CONFIG_HOME/chord if set, else ~/.config/chord
--state-dir Durable runtime state (sessions, exports, logs, project registry, worktree metadata) CHORD_STATE_DIR $XDG_STATE_HOME/chord if set, else ~/.local/state/chord
--cache-dir Rebuildable cache (runtime caches, transient artifacts) CHORD_CACHE_DIR $XDG_CACHE_HOME/chord if set, else ~/.cache/chord
--sessions-dir Override the sessions root only CHORD_SESSIONS_DIR <state-dir>/sessions
--logs-dir Override the logs directory only CHORD_LOGS_DIR <state-dir>/logs
-h, --help Show help for the current command — false
-v, --version Print build and runtime version information, then exit — false

For the full directory layout, see Paths. For all environment variables, see Environment variables.

-v/--version is available on the root command. Subcommands expose -h/--help and the same path / API override flags shown above.

Runs the local TUI in the current directory. That directory becomes the session working directory: relative file paths, omitted shell workdirs, and omitted grep / glob search roots resolve from it. When --worktree or chord resume switches into a chord-managed worktree, that worktree path becomes the session working directory instead; file tools do not need to understand git worktrees separately. The session working directory is injected before the first user message (and again after context compaction) so the model sees the same path base that tools use. User-facing tool cards may display paths relative to it for readability, while raw tool-call arguments and session exports preserve the model’s original paths for auditing.

On the first run, if global config.yaml is missing and Chord can get a controlling TTY, it starts a one-time setup wizard before opening the TUI; see Quickstart for what it asks, what it writes, and how it behaves without a controlling TTY. help, version, and non-root subcommands do not trigger the wizard.

Flag Description
-c, --continue Resume the most recent non-empty session for this project that is not already open elsewhere
-r, --resume <id> Resume a specific session ID of the repository the current directory belongs to. A session that recorded a chord-managed worktree reopens in that worktree.
--takeover <id> Take over a gateway-managed session in the same workspace and restore it paused
--takeover-timeout <duration> Observation budget; omitted waits indefinitely, 0 returns after admission
--fork-history[=N] Fork the session named by --resume at a compaction boundary and resume the fork instead: omit N for the latest applied boundary or pass a history-N number (e.g. =2). Only valid with --resume, and the session must belong to the current repository. Forking works while the source session is open elsewhere (see Resuming sessions).
--yolo Start with YOLO mode enabled: releases the main agent’s in-scope confirmations and call-level permission limits; role capability boundaries still hold
-w, --worktree [name] Create or enter a chord-managed git worktree by name (auto-named when no name is given); sessions are shared by every checkout of the repository. Combine with --continue / --resume to continue the repository’s latest session with the worktree as the working directory.
--reset-branch Only with --worktree: reset a leftover branch that no worktree has checked out to the current HEAD instead of refusing to reuse the name.

--continue and --resume are mutually exclusive; --fork-history applies only with --resume and cannot be combined with --continue or --worktree.

--continue picks the most recently active non-empty session that this process can open. Chord orders sessions by the newer of two modification times, main.jsonl and an existing usage-summary.json; it does not scan full transcripts or build a separate project-level index. Filesystem timestamps can become misleading after copying or restoring session files, and activity that updates neither file may not affect the order.

A session that another running Chord process already owns is skipped, and the next candidate is used; the skip is announced with a one-time notice (a toast in the TUI, a skipped_locked_sessions field in the headless ready envelope, and the log), so the switch is never silent. If every session is owned elsewhere, Chord starts a new one. --resume <id> names one specific session instead, so it reports an error rather than substituting another when that session is already open.

Two entry points run the same resume pipeline; they differ only in how the session is located:

  • chord --resume <id> (alias -r) resumes a session of the repository the current directory belongs to. It composes with --continue / --worktree and is the form scripts and headless use.
  • chord resume <id> resolves the same sessions as an explicit command: it prints the checkout it switched to and then starts the TUI there.

Each of them switches into the chord-managed worktree the session recorded, and so does --continue: it picks a session first and enters the checkout that session recorded. A worktree session therefore resumes from the main checkout, or from any other checkout of the same repository. When that worktree no longer exists, Chord reports it and records the fallback: chord resume <id> resumes in the repository’s main checkout, while --resume and --continue continue in the checkout Chord was started from, recording it when it is a worktree.

Rule of thumb: the entry points find the same sessions, so pick by invocation style — a flag on the default command, or the chord resume <id> command.

# Plain start
chord
# Resume the most recent session
chord --continue
# Resume a specific session
chord --resume 20260428064910975
# Create / enter a chord-managed worktree
chord --worktree feat-auth
# Resume the latest session inside a worktree
chord --worktree feat-auth --continue

Sign in after the base configuration is in place. This command is for preset: codex OAuth providers and stores credentials under ~/.config/chord/auth.yaml. Chord also keeps machine-managed shared OAuth runtime state in ~/.config/chord/auth.state.json so quota/reset caching does not constantly rewrite auth.yaml. Without a provider name, Chord auto-selects the only configured codex provider, or prompts you to choose when multiple are configured. The first-run wizard can complete this same Codex OAuth sign-in flow during setup; chord auth codex remains the direct command when you want to sign in again later.

During normal model requests, OAuth responses such as HTTP 401/403 token_invalidated, revoked tokens, expired refresh tokens, or deactivated accounts are treated as permanent credential failures. Chord marks the matching OAuth runtime-state entry as expired, deactivated, or invalidated (using account/user metadata first, then refresh-token hash fallback), removes that credential from the selectable key pool, and refreshes the TUI Keys count. Retry entries in the error panel include the OAuth email/account and a masked key=... label that shows a short prefix and suffix of the credential for human-friendly identification. Use chord auth to sign the account in again, or chord auth state clean to remove unusable entries.

Flag Description
--device-code Use device-code flow (paste a one-time code into the provider’s web page) instead of the local browser callback. Useful for SSH / headless / WSL where opening a browser locally is not possible.
# Auto-select a configured codex provider
chord auth
# Explicitly choose a provider name
chord auth codex
# Headless / SSH environments
chord auth codex --device-code

Refresh every refresh-token backed OAuth credential for a preset: codex provider. The command prints one line per credential as refreshed, failed, or skipped; skipped credentials include API keys and OAuth entries without a refresh token. Any failed refresh makes the command return an error after processing the remaining credentials.

Successful refreshes update auth.yaml and synchronize the matching runtime entry in ~/.config/chord/auth.state.json while preserving quota/reset hints.

chord auth refresh codex

List expired, deactivated, or invalidated OAuth runtime-state entries from ~/.config/chord/auth.state.json. This command does not report orphan state entries whose matching OAuth credential was removed from auth.yaml; use chord auth state clean to remove both invalid and orphan state.

chord auth state list

Remove invalid OAuth runtime-state entries from ~/.config/chord/auth.state.json, orphan state entries whose OAuth credential no longer exists in auth.yaml, and matching expired / deactivated / invalidated OAuth credentials from ~/.config/chord/auth.yaml.

Typical use cases:

  • clear shared cached state and matching credentials for expired / deactivated / invalidated accounts;
  • keep auth.state.json and auth.yaml in sync after rotating or retiring accounts;
  • remove unusable OAuth credentials after Chord marks them expired, deactivated, or invalidated.
chord auth state clean

chord takeover preflight | start | status | retry-save

Section titled “chord takeover preflight | start | status | retry-save”

Use --session <id> and --transfer-id <id> to identify the session and transfer, -d/--session-dir <workspace> to select its project directory, and --json for one JSON status of at most 64 KiB. preflight and start also require --target-kind tui|gateway and --target-instance <id>. start accepts an optional --timeout <duration> observation budget. Read further blockers with status --blocker-offset <offset>, using the previous page’s next_offset.

preflight checks the target configuration and source endpoint without starting a transfer or freezing the source. Its successful JSON reply includes the canonical workspace, source runtime and session epoch, and target identity. A linked worktree uses its main repository’s canonical workspace identity; pass the worktree directory with -d to retain its execution directory.

--takeover cannot be combined with --resume, --continue, --fork-history, or --worktree. A waiting timeout leaves the source transfer running; retry save failures under the original transfer ID. Transfers support TUI and gateway-managed headless processes running as the same OS user in the same workspace on macOS and Linux. See Usage for behavior and recovery actions.

Run Chord without a TUI. Input is JSON commands on stdin, output is JSON envelopes on stdout. See Headless for the full protocol.

Flag Description
-d, --session-dir <dir> Project directory the headless session targets (default: current dir)
-c, --continue Continue the latest session in the target directory
-r, --resume <id> Resume a specific session ID in the target directory
-w, --worktree [name] Create or enter a chord-managed worktree before starting
--gateway-managed Expose takeover for a gateway that owns the session lifecycle
--gateway-instance <id> Managed binding identity, required with gateway management
--gateway-transfer-id <id> Validate an incoming transfer with --resume and restore paused
chord headless
chord headless -d /path/to/repo --continue
chord headless -d /path/to/repo --worktree feat-auth

Serve the Agent Client Protocol over stdio, so an ACP client such as Zed can drive Chord as its agent. stdout carries JSON-RPC only; Chord’s logs and any stray stdio output go to the logs directory, one log per process (chord-acp-mux-<pid>.log for the frontend, chord-acp-<session-id>.log for each session).

The client sends the working directory with session/new, and model, permissions, MCP servers, and session storage all come from Chord’s own configuration. One process serves every session the client opens, one child process per session.

Flag Description
--max-sessions Maximum number of ACP sessions served at once (default 8)
# Launched by the ACP client; running it by hand expects JSON-RPC on stdin
chord acp

See ACP Agent Mode for client setup, what the client sees, and current limits.

Review explicit model settings that differ from a verified config_profile in the active model catalog. These are deterministic configuration recommendations, not automatic model selection or a claim that one setting is best for every task. Catalog-filled defaults do not produce recommendations; only an explicit user value that differs from the profile does.

Without arguments, the command lists the model, YAML path, current value, recommended value, and catalog source. Use --json for automation. Select one recommendation with <provider>/<model> <field>:

# List active profile recommendations
chord config advise
# Inspect machine-readable recommendations
chord config advise --json
# Remove a safe direct override and follow the catalog at load time
chord config advise openai/gpt-6.2-sol reasoning.summary \
--accept follow-catalog
# Pin the recommended scalar in config.yaml
chord config advise openai/gpt-6.2-sol reasoning.summary --accept pin
# Keep the current value for this exact catalog/value combination
chord config advise openai/gpt-6.2-sol reasoning.summary --keep-current
# Apply every active recommendation
chord config advise --accept pin
# Keep every current value
chord config advise --keep-current

follow-catalog applies only to directly declared leaves; it is offered when removing the selected leaf cannot change another explicit leaf in the same block. When a value is inherited through YAML aliases or merge keys, --accept pin writes an explicit override by trying three locations in order: the declaring scalar (only when that is safe for other bindings), an override under the model’s own mapping (every binding of that model inherits it), and an expansion of the selected provider’s models entry (only that binding changes). Each candidate is resolved and validated: it must resolve the selected recommendation without introducing a new recommendation or changing an unrelated one. When no safe write location exists, the command reports the manual edit to make instead. Without a model and field, the same flags apply to every active recommendation: --accept pin resolves all of them, --accept follow-catalog does so only when every recommendation is a removable direct leaf, and --keep-current acknowledges them all. A batch applies and verifies each edit in turn; the first recommendation that cannot be resolved stops the command and is reported, while the edits already applied stay in place, so re-running resumes with the rest. When several bindings inherit the same declaration (same layer, file, and line), the listing shows a single entry that names the affected bindings. Editing that declaration changes every binding, and --keep-current on any one binding acknowledges all of them; --json still reports one entry per binding. The command locks the target config, reloads the recommendation, validates a candidate configuration, and replaces the file only after successful resolution. A write re-encodes the whole document, so blank lines between entries are not preserved (comments and key order are preserved). Keep-current suppression is fingerprinted by provider, model, field, catalog ID/version, current value, and recommended value; changing any of those facts re-arms the recommendation.

Save explicit model settings in config.yaml and append the model to a pool, using the model catalog as the source of verified facts. The command writes catalog: false so the saved model does not depend on runtime catalog filling. It is offline by default, and the candidate config is resolved in full before anything is written — the file is only replaced when that resolution reports no errors.

Run the command without arguments to browse the catalog interactively: pick a managed provider (or one of your configured providers on that preset), then one of the wire models the preset is verified to serve, and the guided setup continues from there. Outside an interactive terminal, pass <provider>/<model> explicitly.

How the model resolves:

  • Wire name bound to the provider’s preset (for example gpt-6.2-sol under preset: openai): the resolved model settings are saved, including context, modalities, reasoning variants and field send rules, along with the pool reference.
  • Custom endpoint: pass --catalog <id> to copy a catalog recipe under your own wire name. Limits, modalities and compaction hints transfer; the same protocol also copies model behavior, compat, reasoning variants and field send rules. Your URL, credentials and compression settings stay explicit. Request-body compression follows the provider preset unless you set it: preset: codex sends zstd, other presets send uncompressed bodies, and provider compress: gzip / compress: zstd / compress: off overrides that choice.
  • No match: the closest verified models are listed with their catalog IDs. In an interactive terminal, press a number to select immediately without Enter, press m to enter a verified catalog ID, or press Esc/0 to cancel; the request model name stays unchanged. Non-interactive mode also shows refreshed candidates with their provider scope and sources, then returns an error; it never adopts one automatically.

In an interactive terminal, the command guides you through catalog selection and any missing provider URL or API-key environment variable. You can then choose an existing pool or create a new one, and configure the reasoning variant and request-body compression. It previews resolved limits and the settings to save, and writes only after confirmation. Numbered menus and y/n confirmations respond immediately; Enter accepts a displayed default. Press Esc, q or 0 in menus, enter q / cancel in text prompts, or decline saving to cancel. URLs, environment variable names and new pool names still require Enter. End of input also cancels, leaving configuration and credential files unchanged. Existing provider URLs and credentials are reused; accepting the compression default preserves the current setting, while changing it affects every model on that provider.

If another command changes the selected provider’s endpoint or protocol while you review it, saving stops and you must run the command again to review the current endpoint. Configuration and credentials are saved separately. If credential saving fails after the configuration is saved, the error identifies the saved file and the environment-variable reference to add to auth.yaml.

Use --no-interactive to skip prompts and confirmation in scripts. Redirecting stdin or stdout also disables prompts; pass <provider>/<model> explicitly in that case, or the command fails.

Existing pool entries keep their order — new references are appended. Untouched YAML anchors and aliases are preserved. Editing a shared value creates independent settings without changing other references; << merges are supported too.

Existing explicit model values, including cost and blocks cleared with null, are preserved. Repeating add or refreshing the catalog does not overwrite saved values; edit config.yaml to change them. Fill in unknown settings and endpoint prices yourself.

Reasoning levels are saved in variants, without setting a base reasoning.effort, thinking.effort or thinking.level. The command uses the endpoint’s verified variant list when available; otherwise it converts documented model levels only for a matching protocol. Existing explicit choices are preserved. Select a level with --variant high or a model reference ending in @high; without a selection, the endpoint default applies.

Flag Description
--url <u> API URL when the provider does not exist yet (path must end in a known protocol suffix)
--catalog <id> Catalog model ID to borrow facts from (custom endpoints)
--pool <name> Model pool to append the reference to (default default)
--api-key-env <v> Write $VAR as the provider credential in auth.yaml when it has none
--variant <name> Use a defined reasoning variant in the pool reference (@variant)
--compress <mode> Provider request compression: off, gzip or zstd; omission preserves the current setting. An unset compress follows the preset default (zstd for preset: codex)
--no-interactive Disable guided choices and save confirmation for scripts
--keep-current Acknowledge freshness advisories for this model without changing anything
--refresh-catalog First pull the latest tagged catalog snapshot from the upstream repository (network); a failure continues with the catalog already in effect
# Browse verified providers and models, then finish the guided setup
chord config add
# Save explicit settings and a pool reference for an official model
chord config add openai/gpt-6.2-sol
# Guided gateway setup: select a catalog entry and fill connection details
chord config add mygw/gpt-6.2-sol
# Scripted gateway setup with explicit arguments
# Serve a catalog model through your own gateway under its wire name
chord config add mygw/claude-gw --url https://gateway.example.com/v1/messages \
--catalog anthropic/claude-opus-5-5 --no-interactive
# Add credentials for a new provider in the same step
chord config add mygw2/m1 --url https://gateway.example.com/v1/chat/completions \
--catalog openai/gpt-6.2-sol --api-key-env MYGW_API_KEY
# Silence a freshness advisory after deciding to keep the current borrow
chord config add mygw2/gpt-6.2-sol-gw --keep-current

Pull the newest version tag of the upstream model catalog repository (chord-models) into a local cache. A refreshed snapshot supersedes the built-in catalog as a whole — by catalog version, never merged entry by entry — and takes effect on the next start of every chord command. Refresh is an explicit network operation: it never runs in the background, and any failure leaves the previous cache and the built-in catalog untouched. Pass --repo <url> to pull from a different mirror. chord doctor config prints which snapshot is in effect.

The refreshed data supplies future config add operations and models using runtime catalog filling. Models saved with catalog: false retain their explicit settings.

Check the global and project config.yaml files for unrecognized keys, wrongly typed values, malformed YAML, and invalid setting values (such as an unknown retry_backoff or a negative diagnostics threshold). The command reports every problem it finds in one pass instead of stopping at the first one.

It also loads the effective config the runtime would start with (project merged over global) and reports model pool references that do not resolve — a reference naming an unknown provider or model, or a @variant the model does not define. Parse problems stay attributed to their file; such effective-config problems are reported as problem: lines (the errors field in --json). The report also names the catalog snapshot in effect (catalog in --json): its version, upstream repository and tag, whether it came from the embedded snapshot or the refresh cache, and why a present cache was not installed. The report also lists advisories: settings that load exactly as written but may not behave as intended, including catalog references that a newer verified model likely supersedes and explicit model settings that differ from a verified profile. Each includes an action for accepting the recommendation or keeping the current choice. Advisories never change the exit status.

Chord’s config loader logs these problems and starts anyway, treating the offending value as not configured. This command surfaces them explicitly so you can validate a config file without reading the log.

Flag Description
--json Emit a machine-readable JSON report
--model <provider/model> Base model to explain; requires --field
--field <field> One supported field; requires --model

The global config is always checked; the project config (.chord/config.yaml) under the current working directory is checked when present. Any problem makes the command exit with status 2, which is convenient for scripts and CI.

The report also lists warnings for settings that load as written but are unlikely to do what you expect, such as a Chat Completions gateway model with thinking enabled but no compat.chat_completions.native_thinking selector. Warnings are printed as warning: lines (the warnings field in --json) and do not change the exit status.

# Validate global + project config
chord doctor config
# Machine-readable report for scripts
chord doctor config --json

Explain why a model setting has its current value

Section titled “Explain why a model setting has its current value”

Use a model and field together to inspect the configuration currently on disk:

chord doctor config --model sample/model-1 --field reasoning.effort
chord doctor config --model sample/model-1 --field limit.input --json

Supported fields are exactly reasoning.effort, thinking.type, limit.context, limit.input, and limit.output. Both flags must be explicit and nonempty. Use a base provider/model reference; @variant queries, wildcards and multiple fields are not supported.

The result shows the resolved value, global/project declarations, actual catalog contributions or context derivation, related diagnostics, and where to edit. It distinguishes an explicit empty string or zero from an absent value, and a cleared capability block from an untracked source. Shared YAML aliases and merges suggest an explicit override under the target model instead of editing the shared anchor. A null ancestor masks lower-layer declarations; the edit suggestion points to that ancestor so it can be replaced with a mapping. Some null declarations leave the source partially tracked; the reported value still comes from the resolved configuration.

This is a read-only disk view. It does not include CLI, role or session overrides, the running model-pool selection, or the final API request. It does not contact a provider or refresh the catalog. A nonpositive limit.input means there is no independent input cap: runtime capacity depends on the context window and planned output. limit.output is the static model limit, not the request’s max_tokens.

The full configuration is still checked. A resolved query can accompany an overall failure (exit 2); partial source evidence or an unset/cleared value alone does not fail the command. With --json, the existing report gains a query object containing status, view: "disk", the resolved file paths, project_exists, and either result or a structured error. Argument, unknown-model and load errors also produce JSON reports once flag parsing succeeds.

Run lightweight diagnostics for configured model calls using the same provider transport path as normal LLM requests. It loads config.yaml / auth.yaml, resolves each selected target to a canonical provider/model[@variant] ref, applies model and variant tuning, and reports success, latency, text chunks, token usage when available, and Responses transport (http or websocket). The command uses the same merged global + project config view as normal runtime startup.

By default, Chord tests one representative model per configured provider. The representative is stable: the first model referenced by any model_pools entry for that provider, or the provider’s first model by name when no pool references it. Each diagnostic target makes one request attempt by default; use --retry only when you explicitly want to retry transient failures. When a provider has multiple credentials, diagnostics intentionally use only the first credential so later keys cannot hide that credential’s failure.

Flag Description
--provider <name> Test only the named provider’s representative model, or provide the provider for a bare --model value
--model <ref> Test one model. Use provider/model[@variant], or model[@variant] only together with --provider
--pool <name> Test every model ref in the named model_pools entry independently, preserving pool order
--all-models Test all configured models for --provider (must be combined with --provider)
--all-pools Test every configured model pool
--timeout <duration> Per-model request timeout (default 30s)
--retry <count> Maximum request attempts per target (default 1; client/auth errors such as 400/401/403 are not retried)
--fail-fast Stop after the first failed request or configuration error
--json Emit a machine-readable JSON report

--model, --pool, and --all-pools are mutually exclusive. Pool checks do not use fallback: each pool entry is requested independently so an unavailable fallback target is not hidden by a later successful model.

# Smoke-test all configured providers with representative models
chord doctor models
# Test one provider's representative model
chord doctor models --provider openai
# Test an exact model or variant
chord doctor models --model openai/gpt-5.5
chord doctor models --model openai/gpt-5.5@high
chord doctor models --provider openai --model gpt-5.5@high
# Audit a model pool or all pools
chord doctor models --pool thinking
chord doctor models --all-pools --json
# Test every configured model for one provider
chord doctor models --provider openai --all-models --fail-fast

Explain why a configured skill never reaches the model, and what the model would receive if it did. It reuses the runtime discovery order and parser, but keeps invalid and shadowed files as their own rows instead of skipping them silently. It also audits the directories the runtime glob traverses, so an unreadable directory or a broken symlink shows up as a scan issue instead of looking empty. Each row reports four independent dimensions: integrity (whether the runtime keeps the file), load (whether the body reads back), visibility (whether the selected role’s ruleset hides the skill), and resources (health of declared resources frontmatter entries), plus a shadowed flag when a higher-priority directory owns the name. Loading and reading a skill says nothing about whether the model will pick it.

The report also states the configuration it ran under: the content root, the checkout root, the working directory, the selected role and where that role’s configuration comes from, and the skill directories in runtime priority order. --agent selects the role whose permission baseline the report uses; it defaults to builder. An unknown role fails with exit code 2 instead of producing a report that answers a different question.

The baseline is the selected role’s own permission rules. It does not include session permission overlays, YOLO, or — for a worker — the parent agent’s rules, so a worker row describes the role’s own baseline and not the worker’s effective runtime permission. A role that runs on an external backend does not use Chord’s local skill catalog at all: its rows report not_applicable instead of a visibility verdict.

Each row also reports what the model would receive:

  • invocation: the allow / ask / deny action the baseline yields for a call that loads this skill by name. Visibility is not the same thing as being free of confirmation.
  • startup: whether the Available Skills block keeps the description (listed), a shortened one (listed_truncated), only the name (name_only), or nothing (not_listed), plus the reason.
  • model_invocation: whether the model may load the skill on its own (allowed) or only an explicit /skill may (manual_only).
  • paths: none, conditional (waiting for a matching path), or invalid with the pattern error. An invalid pattern does not cancel name-based loading.
  • description: the raw size and the size actually written in the startup listing, in bytes and Unicode code points. Rendered sizes include JSON quotes and escapes. Entries without a description have zero rendered size; an unavailable or inapplicable baseline yields null. truncated reports whether the listing wrote a shortened description, or null when it could not be evaluated.
  • sizes: the SKILL.md source file (frontmatter included), the parsed body (frontmatter removed, CRLF normalized), and the rendered result with empty arguments. The rendered result contains the expanded body and the envelope; envelope_bytes includes the resource warning, any added newline and the closing tag. warning_bytes is a subset of that overhead. The rendered size is measured before truncation; over_inline_budget marks a result larger than the 50 KiB inline budget of a model tool result.
  • sidecar: the sidecar file that supplied the effective metadata, when there is one.

The startup block total, the largest skills, and up to five evidence-backed items to check are reported as well. startup.description_budget_bytes is the 8 KiB budget for described entries, the header and the omission notice. Additional skill names are outside that budget, so startup.total_bytes can exceed it. Those thresholds only order the list: a large or truncated skill never changes the exit code.

Exit codes follow the doctor family: 1 when any skill fails integrity or load, 2 when the check itself cannot run. Scan problems — an unreadable directory, a broken symlink, a scan path that is not a directory — exit 2 and are listed in the report (scan_issues) instead of aborting it. An unknown --agent role also exits 2. Denied skills, shadowed duplicates, resource problems, and an empty skill set do not change the exit code.

Flag Description
--json Emit a machine-readable JSON report
--strict Also fail when the ruleset is unavailable or a check did not run
--agent <name> Role whose permission baseline the report uses (default: builder)
# Diagnose skill discovery, loading, and visibility
chord doctor skills
# Machine-readable report, or fail on unchecked rows
chord doctor skills --json
chord doctor skills --strict
# Diagnose the baseline of another configured role
chord doctor skills --agent reviewer

Check that agent definitions load and that external backend commands resolve. Agent definitions with a backend block run on an external coding-agent CLI, so a missing command fails every delegation for that role; the report names each definition’s mode and backend, and shows where the resolved command was found. Launch argument and environment validation already run when definitions load, so those errors surface here as load failures.

Exit codes follow the doctor family: 1 when an external backend command is missing from PATH, 2 when the definitions fail to load or the check itself cannot run. Definitions without a backend do not change the exit code.

Flag Description
--json Emit a machine-readable JSON report
# List agent definitions and verify external backend commands
chord doctor agents
# Machine-readable report
chord doctor agents --json

Inspect or clean state, cache, and log directories managed by the path locator.

Print sizes for state, cache, and logs directories, plus session and project counts. Read-only.

chord cleanup status

Sample output:

state_dir: /Users/me/.local/state/chord (29.6 GB)
cache_dir: /Users/me/.cache/chord (847 B)
logs_dir: /Users/me/.local/state/chord/logs (263.5 MB)
sessions: 42 across 7 projects

chord cleanup sessions | dumps | cache | logs | project

Section titled “chord cleanup sessions | dumps | cache | logs | project”

Clean a specific kind of managed data. Defaults to a dry run: pass --yes to actually delete.

Flag Description
--older-than <duration> Only consider entries older than this duration (Go duration syntax, e.g. 720h for 30 days)
--yes Actually delete; without this flag the command only previews what would be removed
Kind What it cleans
sessions Session directories under <state-dir>/sessions/<project-key>/ older than the cutoff, plus leftover deletion tombstones. Session age follows the same last-activity signal as the session picker and --continue. Project directories are never removed.
dumps Over-age completed .json LLM dump files under each session’s dumps/llm/; temporary files and empty directories are kept, and sessions open in another process are skipped
cache Rebuildable cache under <cache-dir>/runtime/
logs Rotated logs under <state-dir>/logs/
project Orphan project entries (project directories that no longer exist on disk)
# Preview what would be removed
chord cleanup sessions --older-than 720h
# Actually remove sessions older than 30 days
chord cleanup sessions --older-than 720h --yes
# Clear all rebuildable cache (will reload on next run)
chord cleanup cache --yes

Sample output:

would remove /Users/me/.local/state/chord/sessions/project-a/202605120001 (263.5 MB)
would remove 1 sessions, total 263.5 MB
dry-run: pass --yes to delete

The last line summarizes what would be removed. With --yes, the same lines use removed instead of would remove, with no dry-run trailer.

removed /Users/me/.local/state/chord/sessions/project-a/202605120001 (263.5 MB)
removed 1 sessions, total 263.5 MB

Manage chord-owned git worktrees. Use chord worktree <name> (or chord --worktree <name>) to create or enter a worktree and start a session there; use this command’s subcommands for management operations such as list, remove, and finish.

These commands need git on PATH. When it is unavailable, chord worktree <name>, --worktree, list, remove, and finish refuse with a message naming the missing git binary instead of a repository error.

Worktrees live under <state-dir>/worktrees/<repo-id>/<slug>, outside the repository, unless worktree.root says otherwise: a relative value resolves against the main repository root, so root: .chord/worktrees places checkouts at <repo>/.chord/worktrees/<slug>. When that directory lies inside the repository, Chord keeps a .gitignore containing * in it so the checkouts never show up as untracked files in the main checkout. That file only keeps git status clean; deleting it does not weaken any protection. Other tools are not aware of that skip: an in-repo checkout is a second copy of the tree, so index- or scan-based tools may pick it up too (see Worktrees).

Sessions are shared by every checkout of a repository. The history lives in the repository’s own store, so a session started in a worktree is listed and resumed from the main checkout and vice versa; the runtime cache stays per checkout, and exports follow their sessions. A session records the checkout it was working in, and resuming it switches back there (see Resuming sessions). Removing a worktree never deletes that history.

A worktree contains tracked files only. Gitignored content — a local AGENTS.md, .chord/config.yaml, agents, skills, plans — is not copied; a session running in a worktree reads it from the main checkout, so project instructions, skills, sub-agents, and memory behave as they do in the main checkout. When the checkout carries its own AGENTS.md or project skills, those copies take precedence. List the gitignored files a fresh worktree should receive in a repository-root .worktreeinclude file (gitignore syntax; .env* when the file is missing or lists no pattern). Those files are copied on creation, and a tracked file is never overwritten. The copy happens once: later edits are not synced, and because .env* is copied by default, a local credential can end up in every checkout.

Permission rules, hooks, agent configuration, and worktree creation settings are resolved from the main checkout when a session starts; resuming a session recorded in another checkout does not re-resolve them. See Worktrees for what that means for rules that target one checkout.

List chord-managed worktrees of the current repository.

Delete the worktree directory, its runtime cache, and its ownership metadata. The branch and the repository’s session history are preserved. Removal refuses while a Chord session, sub-agent, or background job still holds the checkout; Chord cannot see other tools, so don’t remove one that is in use.

Flag Description
--force Remove even when the worktree has uncommitted changes; force-delete the branch
--delete-branch Also delete the worktree’s branch. Without --force, the branch is only deleted if it has been merged.

Merge the target branch into the real worktree branch first, then squash the finished worktree state back onto that target branch as a single commit, fast-forward that target branch to include the squashed result, and finally remove the worktree and delete its branch.

Flag Description
--onto <branch> Target branch to merge into the worktree and squash back onto (default: the main worktree’s current branch)
--check Preview whether the target branch can merge cleanly into the worktree in a temporary worktree; a real finish may leave the real worktree in a merge state while you resolve conflicts
-m, --message <message> Override the generated squash commit message for the final finish commit

If merging the target branch into the worktree would hit conflicts, finish exits with conflict details, keeps the target branch unchanged, and leaves the real worktree in that merge for you to resolve and re-run.

If a rebase or merge is already in progress in the worktree, finish exits early instead of starting another merge on top of it.

Use --check when you want a conflict preflight without mutating the real worktree, branch, or target branch. A real finish is intentionally not side-effect free: if the merge from the target branch conflicts, Chord keeps the real worktree in that merge state so you can resolve it and rerun finish.

A real finish also moves the target branch: it fast-forwards that branch inside the main checkout, so when the main checkout has it checked out, its working tree is updated, and when the main checkout is on another branch, finish switches to the target branch and back. Do not run another session or tool in the main checkout while finish runs.

Pass -m/--message when you want to override the generated squash message with a final commit message you wrote yourself.

A real finish that needs to create the squashed commit also requires git commit identity (user.name / user.email, or GIT_AUTHOR_* / GIT_COMMITTER_*). --check does not require commit identity because it stops after the merge preflight.

chord worktree list
chord worktree remove feat-old --delete-branch
chord worktree finish feat-auth --onto main
chord worktree finish feat-auth --onto main -m "feat(auth): finalize auth flow"

Resume a session by ID. Unlike chord --resume, this command can locate the session even when the original worktree differs from the current directory; it auto-detects which chord-managed worktree the session belongs to and switches into it. For when to use each entry point, see Resuming sessions.

chord resume 20260428064910975

Forking a session at a compaction boundary

Section titled “Forking a session at a compaction boundary”

With --fork-history, the command no longer resumes the original session. Instead it forks the session at one of its compaction boundaries (copying the history as it was at that moment into a brand-new session) and resumes that fork. The original session is never modified and does not need to be closed: forking reads only the session’s archive files and writes a new session directory, so it works even while the source session is open in another Chord process.

chord resume 20260428064910975 --fork-history # fork at the latest applied boundary
chord resume 20260428064910975 --fork-history=2 # fork at the 2nd applied boundary
  • A compaction boundary is a [Context Summary] checkpoint applied mid-session; each one kept the pre-compaction transcript as main.pre-compress-N.jsonl, with a history-N.status.json record marking it applied once the rewrite finished. Forking to an applied boundary N reproduces that generation’s session state: the fork’s main.jsonl is created record for record from main.pre-compress-N.jsonl, transcript records copied unchanged, including its leading checkpoint summary card, which was part of the real state you saw then (forking the 2nd boundary keeps the 1st summary card at the top). The earlier history-1..N-1.md compaction archives are copied alongside so the checkpoint’s history map still resolves: the model can read the archives on demand to look up anything archived before that boundary. The boundary’s own archive history-N.md is not copied: the forked pre-compress-N transcript still carries those messages inline, so copying it would only duplicate content. Earlier content is browsed through those archives rather than stitched back into the transcript.
  • Message text (user input, assistant replies, tool calls and results, diffs) is preserved verbatim: session ids, paths, and commands inside the content are historical facts and are never rewritten. Image/PDF attachments are copied into the new session and their references updated.
  • The fork is a fresh session: usage/token statistics and runtime state start from zero. session-meta.json records forked_from and keeps the source session’s worktree provenance and manually enabled MCP servers.
  • The new session id is printed and the fork is resumed automatically, entering the TUI like any other session. The session must have at least one applied compaction; requesting a boundary outside the available range fails with the list of valid history-N values.

What is not copied: the fork carries the main-session transcript plus the compaction archives, and nothing else. Sub-agent transcripts, delegated task records, mailbox state, background jobs, artifacts, and other runtime state under the source session’s subagents/ / artifacts/ / snapshot.json are owned by the live source session and deliberately not copied: that state cannot be faithfully reconstructed at an earlier point in time, and usage statistics are tied to the source session as well. Consequences: browsing history is unaffected, but if you keep working in the fork, tasks delegated before the fork remain visible as message cards only, and they cannot be queried or resumed there, so any later work that depends on those agents cannot continue. New sub-agent and task activity started inside the fork works normally.

Import an external agent session into a resumable Chord session. Currently supported sources: opencode, codex, claude.

For Claude Code imports, Chord reconstructs the best-effort main non-sidechain conversation instead of blindly importing the newest raw leaf. Compact boundaries are used for reconstruction, not rendered as visible transcript messages. Sidechain/sub-agent entries are excluded from the main imported session by default; when detected, CLI output reports the skipped count and import-report.json records Claude-specific diagnostics, including sidechain agent IDs when present.

For OpenCode imports, a compaction the source session applied is mapped, not replayed: the paired summary becomes a Chord context-summary checkpoint standing immediately before the oldest message the compaction kept, those recent messages stay as history after it, and the earlier messages the source had already folded away are replaced by that checkpoint — the shape the source model itself saw. Only the newest usable compaction shapes the import, because each compaction consolidates the ones before it. When the export does not record which messages the compaction kept, the full history is kept instead and the import reports that fallback; the checkpoint then stands where the compaction marker was. A compaction that completed with no summary text is skipped the same way, unless the replaced head still holds the original request to anchor it — the checkpoint then carries that request alone and the import reports the missing summary. CLI output and import-report.json record how many checkpoints were mapped, how many messages they replaced, and how many markers were skipped.

For Codex imports, --id matches the thread id encoded in the rollout file name and selects the newest filename timestamp; same-second ties break by rollout id. This follows Codex’s filename fallback. Chord does not read Codex’s session database, so the selected file can differ from the one codex resume opens. A rollout page that references a history_base also imports its base pages, in order before the selected page and truncated where the source stopped inheriting them. A chain that cannot be followed completely, including a missing or compressed (.jsonl.zst) base page, fails the import; compressed rollouts are not supported. import-report.json records the stitched page count and the records that came from the base pages.

Recognizable imported tool calls are always converted to the closest current Chord tool card when their arguments can be normalized, including file mutations as edit, apply_patch, write, or delete. A record without a usable mapping is kept as the tool call under the source tool’s name and arguments, paired with its result, rather than being rewritten: it really ran in the source session, so the trajectory keeps the action it was. Only a record too malformed to name or pair a call (a missing name or call id, or arguments that cannot be encoded) falls back to readable text instead of raw JSON. Converted imported tools do not restore Chord FileTracker snapshots; re-run read when you need fresh file context or stale-change warnings before editing imported files.

You can import the same source conversation multiple times, for example to continue it with different models. Each import creates a separate Chord session by default. Use --sid <id> --force to replace an existing session.

Flag Description
--project <path> Project to write into (default: current directory)
--sid <id> Specify the Chord session id (default: auto-generated)
--id <session-id> Import by source session id instead of file path (supported for codex and claude)
--root <path> Root directory for --id lookup (codex default ~/.codex/sessions, claude default ~/.claude/projects)
--reasoning <mode> Reasoning import policy: off, visible, or strict (default strict)
--dry-run Parse and report only; do not write a session
--json Machine-readable JSON summary
--force Allow overwriting an existing --sid
# OpenCode export
opencode export <sessionID> > export.json
chord import opencode export.json
chord resume <sid>
# Codex by file
chord import codex ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl
# Codex by session id
chord import codex --id <session-id>
# Claude Code by file
chord import claude ~/.claude/projects/**/<sessionId>.jsonl
# Claude Code by session id
chord import claude --id <session-id>

See the Importing external sessions section for the full notes on tool/reasoning policy, conversion warnings, and provider-safe wire normalization.

Run chord sessions list --json --limit 10 -d /path/to/project to list recent sessions without starting an agent. Chord resolves the configured session directory and repository sharing, including linked worktrees; --state-dir and --sessions-dir apply normally. The JSON report contains schema_version: 1, the canonical workspace, and sessions entries with id, last_active (RFC 3339), and locked. Entries are ordered by recent activity, with descending IDs breaking ties. The default limit is 10 (range 1–1000). Empty results use an empty array; errors exit unsuccessfully. Message content and credentials are not included.

Project a persisted session into per-turn facts as JSONL, one line per turn: turn boundaries, tool outcomes with result digests, tool-attributed file changes, and compaction boundaries. It is read-only: the session directory is never written, so it works while the session is open in another process. Use it when reviewing a session, preparing evidence for a completion report, or feeding structured facts to another tool instead of grepping the raw transcript.

Turn causes are downgraded on purpose: a turn started by your message reports user_message; anything else reports inferred (a synthetic starter such as a compaction checkpoint or a background result) or unknown (no leading user message at all). The projection never guesses between a user continue and a background wake: they are observationally identical in the persisted history.

Each turn carries turn_index, trigger, bounded user_text / assistant_final_text (over-long text is cut with truncated: true and a ref back to the source message), tool_calls (name, status, recovery state, duration, bounded args, result digest, and a ref shaped as session_id + message_index + tool_call_id), file_changes (path, op, added/removed lines, exact | partial | unknown attribution), plus compaction_boundary and the message index range it came from. Compaction summaries are boundary markers, not facts: the turn they open carries no user text. A tool result interrupted by a restore keeps its persisted status but is flagged result_unknown — check that flag before reading it as success or failure. Refs may expire after the session is deleted or compacted; digests let you detect that. An empty file_changes list means “no recorded change”, never “no change”: shell effects without file metadata stay unattributed.

Flag Description
--out <path> Write the JSONL projection to this file instead of stdout, with owner-only read/write permissions. A path inside the session directory — or a hard link to a file in it — is rejected, so a projection can never overwrite the session it reads
--session-dir <path> Project this session directory directly; <session-id> can be omitted
--max-bytes <n> Raise or lower the JSONL size cap (bytes). A projection above the cap fails instead of being silently cut. 0 keeps the default (256 KiB)
chord sessions project 20260428064910975 > projection.jsonl
chord sessions project 20260428064910975 --out projection.jsonl
chord sessions project --session-dir /path/to/session --out projection.jsonl

Generate a shell completion script for bash, fish, powershell, or zsh. Use the generated script according to your shell’s normal completion loading rules.

chord completion zsh
chord completion bash
chord completion fish
chord completion powershell

Show command help. This is equivalent to passing --help to the command.

chord help
chord help doctor models
chord doctor models --help

When you run from source, use the package path (not main.go):

go run ./cmd/chord/
go run ./cmd/chord/ headless
go run ./cmd/chord/ --worktree feat-auth

go run cmd/chord/main.go will not pick up the rest of the main package and is not supported.