CLI Reference
The oacp CLI provides commands for workspace setup, inbox messaging, monitor-friendly inbox watching, agent profiles, message signing and trust, receiver-autonomy audit records, and environment health checks. Memory operations live in the separate agent-memory CLI.
Version: This reference reflects oacp-cli 0.5.4, the latest published release.
oacp --helpis authoritative for the installed version, andoacp help <command> [<subcommand>]prints leaf help. See the Changelog for what’s new in each version, and Renamed and removed commands if a command from an earlier release no longer runs.
| Command | Description |
|---|---|
oacp init |
Create a new project workspace; preview with --dry-run |
oacp agent |
Add project agents and manage global profiles |
oacp inbox |
List pending inbox messages |
oacp watch |
Emit inbox delta events for Monitor-friendly polling |
oacp session-init |
Verify Codex startup inputs and emit SessionStart context |
oacp setup |
Generate runtime-specific config files in a repo |
oacp send |
Send a protocol-compliant inbox message |
oacp trust |
Manage local keys, project trust (catalog + pins), and envelope script pins |
oacp autonomy |
Record human outcomes, checkpoints, and terminal audit states |
oacp envelope |
Compile, show, or clear the runtime envelope for a task |
oacp doctor |
Check environment and workspace health |
oacp validate |
Validate an inbox/outbox YAML message |
oacp verify |
Verify a message’s auth trailer against receiver-local pins |
oacp init
Section titled “oacp init”Create a new project workspace under $OACP_HOME/projects/.
oacp init <project-name> [--agents <list>] [--repo <path>] [--link <src:dst>] [--dry-run] [--json]Description
Section titled “Description”Scaffolds a complete OACP workspace: agent directories, a receiver config.yaml per agent (from the conservative always_pause template), the four per-project memory files, and workspace.json. It also records each agent’s project membership in its global profile. --agents is a comma-separated list of agents to create; it defaults to claude,codex,cursor, and "" creates none. Gemini remains supported: pass --agents claude,codex,gemini, or add it later with oacp agent add.
Create-only (since v0.5.3). An existing project root — including an empty directory or a dangling symlink — is refused with exit code 3 before anything is written. --fail-if-exists makes that policy explicit; it is also the default, and there is no overwrite flag. Attach an existing workspace through its workspace.json, and repair one with oacp agent add. --dry-run prints the plan without any filesystem writes, and --json emits the plan or the apply result as JSON. Exit codes: 0 planned or created, 3 existing target, 2 argument error, 1 another validation or filesystem failure. The plan schema and migration notes are in the workspace initialization guide.
| Flag | Description |
|---|---|
--agents |
Comma-separated agents to create (default: claude,codex,cursor; "" for none) |
--repo |
Repo root used for artifact symlinks and recorded in workspace.json |
--link |
Create an artifacts/DST -> REPO/SRC symlink, as SRC:DST (repeatable; requires --repo) |
--fail-if-exists |
Refuse an existing project root (also the default) |
--dry-run |
Plan without any filesystem writes |
--json |
Emit the plan or apply result as JSON |
--oacp-dir |
Override $OACP_HOME directory |
Created Structure
Section titled “Created Structure”$OACP_HOME/projects/<project-name>/├── agents/│ ├── claude/│ │ ├── audit/│ │ │ └── autonomy_decisions/│ │ ├── config.yaml│ │ ├── dead_letter/│ │ ├── inbox/│ │ │ └── archive/│ │ └── outbox/│ ├── codex/│ │ └── ...│ └── cursor/│ └── ...├── artifacts/├── checkpoints/├── logs/├── memory/│ ├── archive/│ ├── decision_log.md│ ├── known_debt.md│ ├── open_threads.md│ └── project_facts.md├── merges/├── packets/│ ├── deploy/│ ├── findings/│ ├── review/│ └── test/├── state/└── workspace.jsonEnvironment
Section titled “Environment”| Variable | Description | Default |
|---|---|---|
OACP_HOME |
Root directory for all OACP projects | ~/oacp |
If OACP_HOME is not set, workspace commands default to ~/oacp.
Example
Section titled “Example”export OACP_HOME=~/oacpoacp init billing-service --dry-run # print the plan, write nothingoacp init billing-serviceoacp agent
Section titled “oacp agent”Add agents to a project and manage global agent profiles. Subcommands: add, init, sync, show, list.
--oacp-dir <path> can appear before or after the subcommand; the last occurrence wins.
oacp agent add
Section titled “oacp agent add”oacp agent add <project> <agent-name> [--runtime <runtime>]Adds an agent to an existing project workspace without re-initializing it: the agent’s inbox/ (with archive/), outbox/, dead_letter/, audit/autonomy_decisions/, and a receiver config.yaml. With --runtime (claude, codex, cursor, or gemini), it also generates status.yaml and agent_card.yaml with runtime defaults, taking the model and description from the agent’s global profile when one exists. Agent names allow alphanumerics, dots, hyphens, and underscores, up to 64 characters. Before v0.5.3 this command was oacp add-agent.
oacp agent init
Section titled “oacp agent init”oacp agent init <name> --runtime <runtime>Scaffolds a global agent profile at $OACP_HOME/agents/<name>/profile.yaml. Valid runtimes: claude, codex, cursor, gemini, human.
oacp agent sync
Section titled “oacp agent sync”oacp agent syncBackfills the global agent registry from existing project workspaces. oacp agent add and oacp init populate the registry as they go; sync covers workspaces created before they did.
oacp agent show
Section titled “oacp agent show”oacp agent show <name> [--project <project>]Prints the merged agent profile as YAML. Without --project, it shows the global profile only. With --project, it merges the global profile with the project-level agent_card.yaml — project fields override global fields (shallow dict merge, list replacement).
oacp agent list
Section titled “oacp agent list”oacp agent list [--project <project>]Lists known agents with their runtime, project memberships, and scope tags (global, project, or both).
Example
Section titled “Example”$ oacp agent add billing-service alice --runtime claudeAgent 'alice' added to project 'billing-service': ~/oacp/projects/billing-service/agents/alice + agents/alice/inbox/.gitkeep + agents/alice/inbox/archive/.gitkeep + agents/alice/outbox/.gitkeep + agents/alice/dead_letter/.gitkeep + agents/alice/audit/autonomy_decisions/.gitkeep + agents/alice/config.yaml + agents/alice/status.yaml + agents/alice/agent_card.yaml + ~/oacp/agents/alice/profile.yaml (registry created)
$ oacp agent list --project billing-service alice runtime=claude memberships=billing-service (global, project) codex runtime=codex memberships=billing-service (global, project)
oacp agent add --runtimecreates bothstatus.yamlandagent_card.yamlfor the new agent.oacp doctor --fixcreates or refreshesstatus.yamlonly.
oacp inbox
Section titled “oacp inbox”List pending inbox messages for one or all agents in a project.
oacp inbox <project> --agent <name>oacp inbox <project> --alloacp inbox <project> --agent <name> --jsonDescription
Section titled “Description”Scans an agent’s inbox directory for YAML message files and prints a summary table with sender, type, priority, subject, and age. Use --all to see every agent’s inbox in the project, and --json for machine-readable output.
The lister reads each message through the shared receive boundary (since v0.4.2) — one verified, bounded snapshot per file. Under signing.verify_mode: enforce, an unverified message surfaces as a held row built from filesystem metadata only (no message field is parsed or displayed); under warn, rows carry the verification status. See Message Signing.
| Flag | Description |
|---|---|
--agent |
List one agent’s inbox (mutually exclusive with --all) |
--all |
List every agent’s inbox in the project |
--json |
Emit JSON output instead of a table |
--oacp-dir |
Override $OACP_HOME directory |
Example
Section titled “Example”$ oacp inbox my-project --agent claudeINBOX: claude (my-project) — 2 messages
| # | From | Type | Priority | Subject | Age ||---|-------|-----------------|----------|--------------------------|-----|| 1 | iris | task_request | P1 | Update docs for v0.5.3 | 3h || 2 | codex | review_feedback | P2 | Re: Review PR #42 | 0m |$ oacp inbox my-project --all --json{ "project": "my-project", "mode": "all", "agents": [ { "agent": "claude", "message_count": 2, "messages": [...] }, { "agent": "codex", "message_count": 0, "messages": [] } ]}oacp watch
Section titled “oacp watch”Emit inbox delta events for one agent — designed for Claude Monitor or shell loops that re-run the command.
oacp watch --agent <name> --project <project> [--project <project> ...]oacp watch --agent <name> --all-projectsoacp watch --agent <name> --project <project> --jsonDescription
Section titled “Description”oacp watch scans an agent’s inbox(es), persists state between runs, and prints one structured line per new event since the last run. Each invocation is short-lived: emit, persist, exit. Run it under a process supervisor or a shell loop to keep watching.
By default, the first run for a target uses --since=now, so existing inbox messages are not replayed as NEW_MESSAGE events. MESSAGE_ARCHIVED events are suppressed unless --show-archived is passed.
For concurrent watchers of the same inbox — for example, several Claude sessions each running their own oacp watch — pass a stable per-subscriber --state-id (since v0.3.3). Each --state-id gets an independent cursor file, so every watcher receives every new-message event instead of sharing one cursor and swallowing each other’s events.
The emitter reads each message through the shared receive boundary (since v0.4.2). Under signing.verify_mode: enforce, an unverified message emits a held event built from the filename only — its subject reads (held: unverified under enforce) and no message field is surfaced; under warn, events carry the verification status. See Message Signing.
| Flag | Description |
|---|---|
--agent |
Required. Agent inbox name to watch |
--project |
Project to scan (repeatable for multi-project watch) |
--all-projects |
Auto-discover all projects that contain this agent’s inbox |
--state-id |
Per-subscriber cursor file (state/watch/<agent>.<id>.json). Lets concurrent watchers of the same inbox each receive every event. Omit for the legacy shared cursor |
--since |
First-run baseline cutoff: now (default), epoch, relative (30s, 5m, 2h, 7d), or ISO 8601 (2026-04-26T00:00:00Z). Only applies on the first run for a target |
--show-archived |
Emit MESSAGE_ARCHIVED events when messages disappear from the inbox. Off by default — when the watching agent is the inbox owner, these are self-loops |
--json |
Emit JSON Lines instead of plain lines |
--oacp-dir |
Override $OACP_HOME directory |
--project and --all-projects are mutually exclusive — pass one or the other.
Output
Section titled “Output”Plain mode (default) emits one line per event: the event name, then project, agent, file, type, and priority fields, then the subject.
NEW_MESSAGE project=my-project agent=claude file=20261020162036_codex_review_feedback_3951.yaml type=review_feedback priority=P2 Re: Review PR #42MESSAGE_ARCHIVED project=my-project agent=claude file=20261020143000_iris_task_request_a8f3.yaml type=task_request priority=P1 Update docs for v0.5.3Field values outside a safe character set are JSON-quoted, so untrusted text stays on one bounded, terminal-safe line. JSON mode (--json) emits one object per line with the same fields plus from and, for signed messages, auth.
Example
Section titled “Example”# Continuous watch under a shell loop — replay existing messages the first timewhile true; do oacp watch --agent claude --all-projects --since=epoch || true sleep 120done
# Notification-friendly default — no replay, no archive noiseoacp watch --agent claude --all-projects
# Observer agent watching another agent's archivesoacp watch --agent claude --project audit --show-archivedoacp session-init
Section titled “oacp session-init”Verify Codex startup inputs, update the agent’s status.yaml, and emit SessionStart context.
oacp session-init --project <project> [--model <model>] [--json | --hook] [--dry-run]Description
Section titled “Description”Builds a bounded, truthful ordered-read manifest for a Codex session: which startup files exist and which the session must still read, in order. Startup file states report verified, meaning the command confirmed readability and updated status.yaml. With --hook (since v0.4.3), it reads Codex SessionStart JSON from stdin — taking the active model and working directory from the payload — and emits hook JSON; oacp setup codex wires exactly this into .codex/hooks.json. The memory pull is no longer part of it: --pull-memory is a retired no-op, because the memory tool’s own SessionStart hook pulls (agent-memory setup codex).
| Flag | Description |
|---|---|
--project |
Project name under $OACP_HOME/projects/ |
--model |
Model identifier written to status.yaml |
--status |
Runtime availability: available (default), busy, or offline |
--current-task |
Optional current-task string written to status.yaml |
--json |
JSON output |
--hook |
Read Codex SessionStart JSON from stdin and emit hook JSON |
--pull-memory |
Retired no-op; the memory pull is the memory tool’s own SessionStart hook |
--dry-run |
Compute the report without writing status.yaml |
--hub-dir |
OACP home root (default: $OACP_HOME or ~/oacp) |
oacp setup
Section titled “oacp setup”Generate runtime-specific configuration files in a repository.
oacp setup <runtime> [--project <project>] [--repo-dir <dir>]<runtime> is one of claude, codex, cursor, gemini. --project is auto-detected from .oacp if not given. --repo-dir is auto-detected from .git if not given.
Description
Section titled “Description”Creates the files that connect a repo to an OACP workspace. Existing files are kept, never overwritten, and the command prints each file as created (+), skipped (~), or retired (-).
- Claude Code —
.claude/agents/<project>.md, an agent file named after the project that Claude Code loads (since v0.5.3), and.claude/skills/. In.claude/settings.jsonit registers theoacp-envelope-hookPreToolUse shim that enforces runtime envelopes. - Codex —
AGENTS.mdwith OACP instructions, and one startup-only handler safely merged into.codex/hooks.jsonthat runsoacp session-initon CodexSessionStart(since v0.4.3). Review and trust the definition with/hooks. - Cursor — the project-side agent directory and a repo-local
.cursor/rules/oacp.todo.mdcplaceholder (since v0.3.2). Cursor-owned rules remain deferred; Cursor sessions setOACP_RUNTIME=cursoror pass--fromwhen sending. - Gemini —
.agent/rules/oacp.mdwith OACP instructions.
Memory hooks are not OACP’s. Since v0.5.0 oacp setup installs no memory hooks, and rerunning it retires the .claude/hooks/oacp-memory-pull.sh and oacp-memory-push.sh registrations an earlier release generated — exact matches only, custom hooks untouched. Install the memory startup hook with agent-memory setup claude (or codex) from agent-memory.
| Flag | Description |
|---|---|
--project |
Project name (auto-detected from .oacp if not given) |
--repo-dir |
Repo root directory (auto-detected from .git if not given) |
--oacp-dir |
Override $OACP_HOME directory |
Example
Section titled “Example”$ oacp setup claude --project billing-serviceRuntime 'claude' setup in /path/to/repo: + .claude/agents/billing-service.md + .claude/skills/ + .claude/settings.json Memory startup hook: run `agent-memory setup claude` (pip install agent-memory-cli).oacp send
Section titled “oacp send”Send a protocol-compliant inbox message to another agent.
oacp send <project> --to <recipient> --type <type> \ --subject <subject> (--body <body> | --body-file <path>) [--from <sender>]Description
Section titled “Description”Composes a YAML message, writes it to the recipient’s inbox/, and saves a copy in the sender’s outbox/. The message gets a unique ID in the format msg-<YYYYMMDDHHmmss>-<sender>-<rand> and a UTC timestamp automatically. The project is positional; there is no --project flag.
Messages are signed when the sender’s signing.sign_messages config knob is on, or with --sign per message — signing needs a key from oacp trust keygen and the crypto extra.
| Flag | Required | Description |
|---|---|---|
--from |
No | Sender agent name. Optional when the sender can be inferred (see below) |
--to |
Yes | Recipient agent name; comma-separated for broadcast (claude,gemini) |
--type |
Yes | Message type (see Message Types) |
--subject |
Yes | Short subject line |
--body |
Yes* | Message body, inline. Required unless --body-file is used |
--body-file |
No | Read the body from a file (- for stdin) |
--priority |
No | P0, P1, P2, or P3 (default: P2) |
--in-reply-to |
No | Parent message ID; sets parent_message_id and inherits the parent’s conversation_id (searches the sender’s inbox and outbox) |
--parent-message-id |
No | Parent message ID for threading, without inheriting the conversation |
--conversation-id |
No | Conversation thread ID |
--related-pr |
No | Related pull request number (numeric) |
--related-packet |
No | Related packet ID |
--context-keys / --context-keys-file |
No | Context keys, inline or from a file |
--expires |
No | Expiry duration (30m, 1h, 2d); sets expires_at |
--channel |
No | Free-text channel tag (review, deploy, brainstorm, incident are suggestions) |
--autonomy-hint |
No | Advisory receiver autonomy hint (auto_proceed); never escalates the receiver’s verdict |
--sign |
No | Sign this message (detached-JWS auth trailer). Default follows signing.sign_messages |
--suffix |
No | Filename disambiguator suffix |
--dry-run |
No | Print the YAML message without writing files |
--json |
No | Output the result as JSON |
--quiet |
No | Suppress success output |
--oacp-dir |
No | Override $OACP_HOME directory |
Sender Inference
Section titled “Sender Inference”When --from is omitted, OACP resolves the sender using this precedence chain:
--fromflag (explicit)OACP_AGENTenvironment variableAGENT_NAMEenvironment variable- Agent card runtime match — if exactly one agent in the project has an
agent_card.yamlwhoseruntimefield matches the detected runtime (OACP_RUNTIMEor runtime-specific environment markers), that agent is used
If none of these resolve to a sender, the command exits with an error.
Message Types
Section titled “Message Types”The --type flag accepts any of the 12 defined message types: task_request, question, notification, follow_up, handoff, handoff_complete, review_request, review_feedback, review_addressed, review_lgtm, brainstorm_request, brainstorm_followup.
See Message Types for details on each type. Handoff bodies are validated by their owning workflow, not by oacp send (since v0.5.3).
Example
Section titled “Example”# Explicit sender$ oacp send my-project \ --from claude \ --to codex \ --type review_request \ --priority P1 \ --subject "Review auth middleware PR" \ --body "PR #42 adds JWT validation to the API gateway."OK: msg-20261020162036-claude-8c1b inbox: ~/oacp/projects/my-project/agents/codex/inbox/20261020162036_claude_review_request_3882.yaml outbox: ~/oacp/projects/my-project/agents/claude/outbox/20261020162036_claude_review_request_3882.yaml
# Reply in the same thread (inside a configured agent runtime, so --from is inferred)$ oacp send my-project \ --to claude \ --type review_feedback \ --in-reply-to msg-20261020162036-claude-8c1b \ --subject "Re: Review auth middleware PR" --body-file findings.mdoacp trust
Section titled “oacp trust”Manage local signing keys and the project trust root: the zero-authority catalog plus each receiver’s pins (since v0.4.0). Subcommands: keygen, keys, import, list, revoke, sign-policy, pin-script.
Key and trust commands require the optional crypto extra. --oacp-dir <path> can appear before or after the subcommand; the last occurrence wins. The trust-root model behind these commands: Message Signing.
oacp trust keygen [--agent <name>]oacp trust keys [--agent <name>]oacp trust import <stub.pub.json> --project <name> --agent <receiver>oacp trust list --project <name> [--agent <receiver>]oacp trust revoke <kid> --project <name> (--agent <receiver> | --all-receivers)oacp trust sign-policy --project <name> --agent <receiver> [--kid <kid>]oacp trust pin-script <script> (--project <name> | --all-projects) --agent <receiver> [--env <NAME>]... [--kid <kid>]oacp trust keygen
Section titled “oacp trust keygen”Creates a dedicated Ed25519 signing key under $OACP_HOME/keys/ (directory 0700, key files 0600 — the directory never syncs) plus a public <kid>.pub.json stub for the import flow. The kid is the key’s RFC 7638 JWK thumbprint. --agent names the agent the key belongs to (inferred if omitted). Key management and rotation: Message Signing. Before v0.5.3 this command was oacp key gen.
oacp trust keys
Section titled “oacp trust keys”Lists local signing keys, optionally filtered with --agent. Neither keygen nor keys needs a project. Before v0.5.3 this command was oacp key list.
oacp trust import
Section titled “oacp trust import”Records a <kid>.pub.json stub in the project’s zero-authority distribution catalog (projects/<name>/trust/catalog.yaml — identity recorded, nothing granted) and pins it active in the receiver’s own allowed_signers.yaml, the only file consulted at verify time. Import is integrity-checked: the kid must be the RFC 7638 thumbprint of its JWK, private key components are refused, same-kid conflicts are refused, and a revoked pin is never silently reactivated. The whole catalog-then-pins transaction is serialized on a project trust lock. --catalog-only records the identity and grants no authority.
oacp trust list
Section titled “oacp trust list”Lists the project’s catalog entries and receiver pins; --agent narrows the output to one receiver’s pins.
oacp trust revoke
Section titled “oacp trust revoke”Handles compromise response without hand-editing trust files: it validates the canonical kid spelling, flips the pin to status: revoked while keeping key material in place, and is safely re-runnable (re-revoking reports unchanged). --all-receivers is all-or-nothing: every target is validated before any pin is written.
oacp trust sign-policy
Section titled “oacp trust sign-policy”Signs the receiver’s config.yaml and trust/allowed_signers.yaml with the receiver’s own local key (since v0.4.2), under the distinct oacp-policy+yaml JOSE profile with {project, receiver, kind} context binding, and enrolls each target in the machine-local policy-enrollment registry — after which an unsigned policy file is invalid, never unsigned. Trust mutations on an enrolled trust root atomically re-sign it or refuse the write. --kid signs with one specific key. Since v0.5.4 a run holds the policy file’s sibling lock from read to replace and verifies the signed candidate before replacing the file, so overlapping runs serialize and a failed run leaves the previous bytes on disk. See Message Signing → Policy-file signing.
oacp trust pin-script
Section titled “oacp trust pin-script”Pins a script the runtime adapter may run under an envelope (since v0.5.4). It records the script under the receiver’s envelope.trusted_scripts in config.yaml — the path as spelled (absolute or ~/-rooted), the sha256 of the file’s bytes, and the --env names a caller may prefix — appending an entry or refreshing the one that names the same file, leaves every other key unchanged, and re-signs the config as sign-policy would. A signed or enrolled config is never written while the receiver’s key is unavailable. The pin is the human’s review of those bytes: run it again after every edit to a pinned file, or the adapter asks on each run until the pin is refreshed. --all-projects pins the script in every project where the receiver has a config.yaml. oacp doctor --project reports malformed, missing, and stale pins.
| Flag | Description |
|---|---|
--agent |
keygen: the key’s agent (inferred if omitted) · keys: filter by agent · import/revoke: the receiver whose pins change · list: only this receiver’s pins · sign-policy: the receiver whose policy files are signed · pin-script: the receiver whose config carries the pin |
--project |
Project workspace name (required for import, list, revoke, sign-policy; pin-script takes it or --all-projects) |
--all-projects |
pin-script only — pin in every project where the receiver has a config.yaml |
--env |
pin-script only — an assignment name a caller may prefix (repeatable; replaces the pin’s list) |
--catalog-only |
import only — record the identity in the catalog, grant no authority |
--all-receivers |
revoke only — revoke the kid for every receiver in the project that pins it |
--kid |
sign-policy and pin-script — sign with this specific key only |
--json |
Machine-readable output |
--oacp-dir |
Override $OACP_HOME directory |
Example
Section titled “Example”# on the signer's machine$ oacp trust keygen --agent iris$ oacp trust keys
# on the receiver's side$ oacp trust import ~/oacp/keys/…/<kid>.pub.json --project my-project --agent claude$ oacp trust list --project my-project
# pin a script the receiver's envelope may run$ oacp trust pin-script ~/tools/finish.sh --project my-project --agent claudeoacp autonomy
Section titled “oacp autonomy”Write receiver-autonomy audit records after admission: human outcomes, mid-task checkpoints, and terminal states. Subcommands: outcome, finalize. Before v0.5.3 these were oacp autonomy-outcome and oacp autonomy-finalize; stored audit receipts keep the result.finalizer.name: oacp autonomy-finalize discriminator, which names the writer format, not the command spelling.
oacp autonomy outcome
Section titled “oacp autonomy outcome”oacp autonomy outcome <audit.yaml> --decision <approved|modified|declined> [--actor <handle>]Records a human approval, modification, or decline on a paused autonomy audit (since v0.3.5). It writes the structured result.human_outcome block: the decision, actor, timestamp, decision latency computed from the audit’s created_at_utc, and the copied pause reason codes. The write is lock-guarded and atomic, and refuses to overwrite a recorded outcome unless --replace is explicit. Grant handling is separate from task approval — a task approval never silently creates a standing continuation grant. See Receiver Autonomy → Human approval and decline outcomes.
It is pause-phase aware: on a checkpoint pause whose record already carries an outcome, the decision is a checkpoint clear and lands in result.threshold_checkpoint.reauthorization, leaving the admission outcome intact. The actor convention is pinned: one canonical, whitespace-free handle per human, fleet-wide (the anonymous default human warns).
| Flag | Required | Description |
|---|---|---|
--decision |
Yes | approved, modified, or declined |
--grant-decision |
No | not_requested, approved, modified, or denied |
--grant-scope-file |
No | Explicit grant scope (required for --grant-decision modified) |
--modification-file |
No | YAML mapping recording the human’s admission delta (--decision modified) |
--decided-at |
No | Override the decision timestamp (ISO 8601 UTC) |
--actor |
No | Stable per-person handle of the deciding human (default: human, which warns) |
--replace |
No | Replace a previously recorded outcome |
--dry-run |
No | Compute and print the outcome without writing the audit file |
--json |
No | Machine-readable output |
oacp autonomy finalize
Section titled “oacp autonomy finalize”oacp autonomy finalize <audit.yaml> --final-state <done|error|cancelled|superseded> [--started-at <UTC>] [--actual-files-touched <n>]oacp autonomy finalize <audit.yaml> --checkpoint --actuals <actuals.yaml>oacp autonomy finalize <audit.yaml> --validate [--sweep]One lock-aware code path owns every receiver-side write to an audit record after admission: mid-task threshold checkpoints (--checkpoint) and terminal updates (--final-state), with the pinned enums and cross-field invariants enforced at write time. --validate reports integrity findings for a record (or, with --sweep, its whole directory) and writes nothing — the same checks oacp doctor runs. Exit codes: 0 written or validated, 2 usage or validation error, 4 checkpoint breached — the record is now checkpoint-paused, and the re-authorization flow applies before success can be written. A --replace whose corrected actuals would breach a record that is already closed is refused without writing.
Terminal writes stamp the serving model and effort into result.runtime (since v0.5.3), from --model / --effort or the OACP_RUNTIME_MODEL / OACP_RUNTIME_EFFORT environment variables. See Receiver Autonomy → Threshold-exceeded checkpoint.
| Flag | Description |
|---|---|
--final-state |
Terminal state: done, error, cancelled, or superseded |
--checkpoint |
Record a mid-task checkpoint evaluation instead of a terminal state |
--validate |
Report integrity findings and write nothing; --sweep covers the record’s whole directory |
--actuals |
Checkpoint actuals mapping (YAML) |
--started-at |
Receiver work start (YYYY-MM-DDTHH:MM:SSZ); derives actual_minutes when --actual-minutes is omitted |
--actual-minutes / --actual-files-touched |
Measured work actuals |
--realized |
A side effect actually performed (repeatable), e.g. commits_changes, creates_or_updates_pr, merges_pr; since v0.5.4 a grant-only effect (sends_oacp_reply, submits_github_review, writes_findings_packet) that the record’s admission does not cover is refused with nothing written |
--reply-message-id |
Message ID of the completion reply |
--artifact |
An artifact the task produced (repeatable) |
--completed-at |
Completion time |
--model / --effort |
Model and effort serving the receiver at completion (default: OACP_RUNTIME_MODEL / OACP_RUNTIME_EFFORT) |
--cancelled-by / --cancelled-at / --reason |
Cancellation receipt: human or sender, when, and an optional explanation |
--deliverable-landed |
Partial delivery recorded on a cancellation |
--predicted-risk-materialized |
true or false |
--superseded-by / --superseded-by-message |
The superseding evaluation, or a verified replacement review-request file attesting sender supersession |
--config |
Receiver config for re-authorization arbitration (default: the record’s policy_path) |
--replace / --dry-run / --json |
Overwrite a terminal write, preview it, or emit JSON |
Example
Section titled “Example”$ oacp autonomy outcome agents/claude/audit/autonomy_decisions/20261020T161413Z_msg-....yaml \ --decision approved --actor alice$ oacp autonomy finalize agents/claude/audit/autonomy_decisions/20261020T161413Z_msg-....yaml \ --final-state done --started-at 2026-10-20T16:15:45Z --actual-files-touched 3oacp envelope
Section titled “oacp envelope”Compile, show, or clear the runtime envelope for an admitted task (since v0.3.5).
oacp envelope compile <message.yaml> --receiver <agent> [--audit <admission-record>]oacp envelope show --project <project>oacp envelope clear --project <project> --receiver <agent>Description
Section titled “Description”Turns an admitted message’s declared task_profile plus the receiver’s autonomy config into a runtime envelope at agents/<receiver>/state/active_envelope.json, enforced at the tool-call layer by a static runtime shim (for Claude Code, the oacp-envelope-hook PreToolUse hook registered once by oacp setup claude). Compile at task pickup; clear at completion. Compilation is fail-closed — a missing, unparsable, or invalid profile pauses the task with envelope_compile_error instead of executing unenforced. After a threshold-checkpoint re-authorization, recompile with --extend, which preserves the active envelope’s runtime counters; --force is the different-message restart and resets them. See Receiver Autonomy → Envelope compilation.
Enforcement is earned, not assumed (since v0.5.1): the compiler stamps enforcement: hooks only when the receiver’s adapter resolves, and otherwise records none with a named reason; --audit writes the same state into the admission record. --audit also handles the one deliberate non-compile: an admitted public_visibility: true task with a recorded human admission approval is stamped envelope_enforcement: none (reason public_visibility_admission_approved) instead of compiling. Under signing.verify_mode: enforce the compiler refuses a message that is not signed-verified (since v0.4.2).
oacp envelope clear runs from inside the enforced session (since v0.4.0): the hook validates the clear against the task’s newest audit record (matched by content, never by filename) and sanctions it only when the record carries a terminal result.final_state with a completion stamp. Protocol-mandated bookkeeping (audit records, the receiver’s own inbox and outbox, the runtime scratchpad) does not consume the declared expected_files_touched budget. Enforcement is session-scoped (since v0.4.1): the compiled envelope records the harness session that compiled it and no-ops for tool calls from any other session.
| Flag | Required | Description |
|---|---|---|
--receiver |
No | Receiver agent the envelope constrains (default: claude) |
--project |
Yes (show/clear) | show and clear cannot infer the project; compile infers it only from a message path inside $OACP_HOME/projects/<project>/, otherwise it is required there too |
--config |
No | compile only — receiver config path (default: agents/<receiver>/config.yaml) |
--audit |
No | compile only — the admission audit record for this message; receives the result.envelope_enforcement stamp |
--extend |
No | compile only — recompile over an existing envelope, preserving its counters (re-authorization flow) |
--force |
No | compile only — overwrite an existing envelope for a different message, resetting counters |
--json |
No | compile only — machine-readable output |
--oacp-dir |
No | Override $OACP_HOME directory |
Example
Section titled “Example”$ oacp envelope compile agents/claude/inbox/20261020_iris_task_request.yaml --receiver claude \ --audit agents/claude/audit/autonomy_decisions/20261020T161413Z_msg-....yaml# ... execute the task under hook enforcement ...$ oacp envelope clear --project my-project --receiver claudeoacp doctor
Section titled “oacp doctor”Check environment and workspace health.
# Environment checkoacp doctor
# Project-specific checkoacp doctor --project <name>
# Auto-fix safe issuesoacp doctor --project <name> --fixDescription
Section titled “Description”Runs a series of diagnostic checks and reports a severity for each, grouped by category. Without --project, only the Environment category runs; with --project, the workspace categories run too. Exit code 0 means no errors (warnings don’t block); 1 means one or more blocking errors. Each line starts with [+] pass, [!] warning, [x] error, or [-] skipped, and a category header shows the worst severity among its checks. Memory-home checks belong to the memory tool: doctor reports the installed agent-memory version and hands off to agent-memory doctor (since v0.5.0). Full check list: the doctor guide.
| Flag | Description |
|---|---|
--project |
Check a specific project workspace |
--fix |
Auto-fix safe issues: missing inbox directories and missing or stale status files |
--audit-dir |
Diagnose the basename of a custom evaluator audit directory; adds a warning when it does not end in autonomy_decisions, without changing workspace scans (since v0.5.3) |
--json |
Output a machine-readable JSON report |
-o, --output |
Save the report to a file (in addition to stdout) |
--oacp-dir |
Override $OACP_HOME directory |
Checks Performed
Section titled “Checks Performed”| Category | What it verifies |
|---|---|
| Environment | git, python3 (3.9.2+), and gh on PATH; optional ruff, shellcheck, pyyaml, and agent-memory |
| Workspace | workspace.json exists and is valid JSON; agents/ exists, with the agent count |
| Inbox Health | Pending messages per agent inbox; inboxes with messages older than 24 hours flagged stale; missing inbox directories |
| Schemas | YAML under packets/ parses; each status.yaml has its required fields, valid enum values, and timestamps |
| Autonomy | Each receiver config.yaml validates; the audit/autonomy_decisions/ directory exists; audit policy_path references resolve; records born done but never finalized are advised on; envelope.trusted_scripts pins are checked (since v0.5.4) — a malformed entry errors, a missing or stale pinned file warns |
| Trust Root (since v0.4.0) | Receiver pins and the catalog load and pass integrity checks; pinned-but-not-cataloged identities warn; cataloged-but-unpinned identities surface as catalog-not-pinned, escalating to warn when the identity is live |
| Signing readiness (since v0.4.1) | Every catalog identity carries an active pin before any receiver flips signing.verify_mode to enforce, with gaps broken down per receiver |
| Policy-file authorization (since v0.4.2) | Per-receiver signature status of config.yaml and trust/allowed_signers.yaml — signed, unsigned, or invalid |
| Agent Status | status.yaml present for each registered agent and updated within the last hour |
Example Output
Section titled “Example Output”$ oacp doctor[-] Environment [+] git — git version 2.47.0 [+] python3 — Python 3.12.4 [+] gh — gh version 2.62.0 (2024-11-14) [+] ruff — ruff 0.8.1 [-] shellcheck — not installed (optional) Install: brew install shellcheck [+] agent-memory — agent-memory 0.1.3 (run agent-memory doctor) [+] pyyaml — available
$ oacp doctor --project billing-service...[!] Inbox Health [+] claude/inbox — empty [!] codex/inbox — 3 message(s), oldest 48h stale Process or archive stale inbox messages...oacp validate
Section titled “oacp validate”Validate an inbox or outbox YAML message against the protocol schema.
oacp validate <path-to-message.yaml> [--quiet]Description
Section titled “Description”Parses a YAML message file and checks it against the OACP message schema. Reports missing required fields, invalid values, and format violations. Exits with code 0 on success and 1 on validation failure; --quiet suppresses the success line. Envelope checks only: handoff body schemas belong to their owning workflow, and the kernel no longer emits body-schema advisories (since v0.5.3).
What It Checks
Section titled “What It Checks”| Validation | Description |
|---|---|
| Required fields | id, from, to, type, priority, created_at_utc, subject, body are present |
| Type validity | type is one of the 12 defined message types |
| Timestamp format | created_at_utc is valid ISO 8601 UTC (e.g., 2026-03-13T14:30:00Z) |
| Priority values | priority is P0, P1, P2, or P3 |
| Field limits | id, parent_message_id, and subject up to 200 characters; body up to 20,000 |
| Threading | conversation_id, when present, matches conv-<YYYYMMDD>-<agent>-<seq> |
Example
Section titled “Example”$ oacp validate ~/oacp/projects/my-project/agents/codex/inbox/20261020162036_claude_review_request_3882.yamlOK: ~/oacp/projects/my-project/agents/codex/inbox/20261020162036_claude_review_request_3882.yamloacp verify
Section titled “oacp verify”Verify a message’s auth trailer against receiver-local pins (since v0.4.0).
oacp verify <message.yaml> --project <name> --receiver <agent>oacp verify --batch --project <name> --receiver <agent> < paths.txtDescription
Section titled “Description”Implements verify-before-parse: strict last-line trailer extraction from the raw bytes, bounded structural checks, EdDSA verification over the exact raw prefix against receiver-local pins only (no network at verify time), then an identity cross-check on the verified prefix. Each message is reported as unsigned, signed-unknown-kid, signed-verified, or signed-INVALID. This command reports and never rejects; rejection happens at intake, where the autonomy gate runs the same verification under signing.verify_mode: enforce (since v0.4.2) and only a signed-verified message proceeds — every other outcome quarantines an evidence copy into dead_letter/ and exits 3 with an intake_rejected decision.
--quarantine sets a byte-tampered message aside with a no-clobber evidence copy in dead_letter/, without touching the original. --attach-audit records the canonical result.message_auth block into an autonomy audit record — the one supported path for audit stamping. Since v0.5.4 the stamp binds to the record’s accepted snapshot: when the record carries a message_sha256, the verified file must hash to it, or the attach is refused (exit 2) and the record is left as it was. --batch (since v0.5.3) reads one message path per stdin line and streams one JSON verdict per line, in input order, against a single pin-policy snapshot; it exits 0 when the whole stream was processed, so inspect each verdict’s status, and it cannot combine with a positional file, --quarantine, or --attach-audit. See the batch verification guide. Full protocol semantics: Message Signing.
| Flag | Description |
|---|---|
--project |
Project name (with --receiver) |
--receiver |
Receiver agent whose pins are consulted |
--pins |
Explicit path to an allowed_signers.yaml (instead of project/receiver resolution) |
--batch |
Read paths from stdin and stream one JSON verdict per line |
--quarantine |
Write an evidence copy to dead_letter/ when the result is INVALID |
--attach-audit |
Record the message_auth block into the given autonomy audit YAML |
--json |
Machine-readable output |
--oacp-dir |
Override $OACP_HOME directory |
Example
Section titled “Example”$ oacp verify agents/claude/inbox/20261020_iris_task_request.yaml \ --project my-project --receiver claude[oacp-auth] signed-verified signer=urn:oacp:agent:…:iris kid=8eVCNRv7uT62…Renamed and removed commands
Section titled “Renamed and removed commands”OACP 0.5.3 regrouped related operations under agent, trust, and autonomy, and removed the memory, event-writing, and retention shims from the kernel. The old spellings now exit 2 with an unknown-command error; there are no aliases.
| Before 0.5.3 | Now |
|---|---|
oacp add-agent <project> <agent> |
oacp agent add <project> <agent> |
oacp key gen |
oacp trust keygen |
oacp key list |
oacp trust keys |
oacp autonomy-outcome <audit> |
oacp autonomy outcome <audit> |
oacp autonomy-finalize <audit> |
oacp autonomy finalize <audit> |
oacp memory init |
agent-memory enable |
oacp memory <verb> (clone, pull, push, disable, archive, restore) |
agent-memory <verb> |
oacp org-memory init |
agent-memory org init |
oacp write-event |
agent-memory event write (agent-memory 0.1.1 or later) |
oacp retention |
No replacement; retention is operator-owned (see Inbox / Outbox) |
The memory replacements take --home <path> where the old commands took --oacp-dir <path>; the other arguments carry over. Install them with pip install agent-memory-cli — see Shared Memory and agent-memory. The packet initializer, the packet and handoff templates, and the findings quality-gate script also left the kernel in 0.5.3; workflows own their artifact formats and validators. Upgrade notes: the command migration guide and the memory command migration guide.

