Decapod Docs
DECAPOD DOCUMENTATION

HARNESS AI METACOGNITION.

Decapod is the local-first metacognitive governance kernel for AI coding agents: orient intent, reflect at decisions, isolate worktrees, and prove commits.

Decapod crab mascot

Choose your path

OPERATIONALIZED METACOGNITION

Why Metacognition?

Code generation is fast; keeping autonomous work aligned across sessions and harnesses is hard. Decapod externalizes agentic metacognition into explicit, repo-native decision calls—decapod infer orientation, decapod govern plan reflect, the embedded Constitution, agent-authored living specifications, trajectory custody, and exact-commit decapod validate gates—so Codex, Claude Code, Cursor, Antigravity, and custom harnesses check assumptions before mutating disk and verify evidence before shipping.

DEPLOYMENT OFFERINGS

Decapod Local & Decapod Cloud

Decapod Local

Free · Offline · No signup

Run the full governance kernel in your repository using local SQLite and Git state. No account, hosted service, or network sign-in required.

  • decapod init (backend = "local", default)
  • Embedded Constitution, governed plans, isolated worktrees, and proof gates
Start locally

Quick install

Install once with cargo-binstall (or build from source via cargo install decapod --locked) and initialize your repository:

cargo binstall decapod && decapod init

Then open Codex, Claude Code, Cursor, or Antigravity and describe your task. Generated entrypoints (AGENTS.md, CLAUDE.md, CODEX.md, GEMINI.md) direct your agent to invoke Decapod at decision, workspace, and validation boundaries. See Quickstart for prerequisites, agent boundary details, and your first governed result walkthrough.

Core documentation

Introduction

Decapod is a local-first metacognitive governance kernel for AI coding agents—binding intent, reflection, worktree custody, and exact-commit proof.

Models produce intelligence.
Agents perform work.
Repositories preserve state.
Decapod governs the transition from intent to proof.

Decapod operates as an agent-agnostic, daemonless metacognitive governance kernel. Coding agents invoke its CLI and structured RPC interface to orient decisions against human intent, run bounded reflection, coordinate task custody, isolate workspaces, and validate exact candidate commits. Each call exits; .decapod/ and Git preserve governance state and proof across agents and sessions.

Bring Your Own Coding Agents (BYOA)

One engineering project rarely uses a single harness forever. A single engineer may switch between Cursor and Claude Code on the same repository, while teammates run Codex, Antigravity, or custom CLI harnesses in parallel.

Decapod treats agent tools as interchangeable consumers of a common repository kernel:

  • No proprietary harness or central chat UI: Keep the coding agent and editor you already use.
  • No manual command choreography: Humans run decapod init once per repository; coding agents invoke Decapod through its CLI and structured RPC interface (decapod rpc).
  • Shared durable substrate: .decapod/ preserves intent, plans, task claims, trajectories, living specifications, and validation receipts in the repository so any later agent can inspect what happened and carry unresolved obligations forward.

See BYOA & Interoperability for the exact discovery and negotiation contract (interop.manifest, interop.negotiate, interop.project).

Human → Agent → Kernel → Repository

ParticipantResponsibility
HumanExpresses engineering intent, supplies judgment at decision gates, and approves meaningful outcomes.
Coding AgentInterprets the prompt and codebase, performs edits and tests, authors living specs, and invokes Decapod at decision, workspace, and validation boundaries.
Decapod KernelExposes deterministic CLI and structured RPC operations for custody, orientation, bounded reflection, policy checks, validation, and publication gates.
RepositoryPreserves .decapod/ governance artifacts, Git history, worktrees, and commit-bound evidence across sessions, models, and harnesses.

Like an operating system kernel, Decapod manages resources (task claims, lease generations, isolated Git worktrees, optional containers) and enforces invariants at transition boundaries without taking over user-space work.

The metacognitive decision-time loop

Natural language alone does not make execution reliable. Transcripts live in transient tool sessions and disappear when an engineer switches agents or hits a failure. Decapod moves that control loop into explicit, decision-time kernel calls:

  1. Before inference and implementation: The agent evaluates the prompt (decapod eval --stdin --format json), ingests contracts (decapod docs ingest), claims scoped custody (decapod todo claim), enters an isolated worktree (decapod workspace ensure), and retrieves constraints, plans, and optional bounded reflection challenges (decapod infer orientation --task-id <id>).
  2. During execution: The agent updates living specifications (.decapod/managed/specs/*), records trajectory observations and checks (decapod govern trajectory record), and queries repository policy or the embedded Constitution when needed.
  3. At verification and remediation: Validation (decapod validate) evaluates the exact candidate commit and accepted target. A failure returns actionable, typed diagnostics rather than silent completion; the agent repairs the root cause on the work branch, records a fresh checkpoint, and rechecks the exact revised commit.

This is decision-time invocation and iterative correction grounded in repository state—not model-level self-awareness or guaranteed automatic arbitration.

Concurrency and explicit limits

Shared governance helps concurrent engineers and agents coordinate overlapping scope through exclusive/shared claims, expiring leases (--lease-seconds), decapod todo fleet overlap inspection, explicit handoffs (decapod todo handoff), and isolated Git worktrees or containers (Workspace Isolation).

Just as important is what Decapod does not replace:

  • Shared governance does not promise conflict-free concurrent edits to identical files across separate branches.
  • It does not replace Git conflict resolution, peer code review, CI, human decision gates, or independent exact-commit validation.

See Multi-Agent Workflows for concrete parallel-engineer coordination and conflict boundaries.

Local and Cloud parity

Both storage modes remain repo-native:

  • Local (repo.backend = "local"): Keeps the task and event datastore locally in .decapod/data/decapod.db alongside Git-tracked .decapod/ governance files. Free, offline, and requires no account or network connectivity.
  • Cloud (repo.backend = "cloud"): Routes supported task operations (todo list/add/get/show/claim/release/done) through Dactyl to the hosted Decapod Cloud service so engineers and agents on different machines share live task claims and custody, subject to verified repository and organization access (see Cloud project routing). Organization owners and admins manage repository enrollment, seat assignments, teammate access policies, and organization administration in Organization Admin.

Cloud mode does not replace Git, execute agents in a separate remote runtime, or waive worktree isolation and local/CI validation requirements. See Cloud sign-in and task access for authorization and failure boundaries.

Where the Constitution fits

Decapod includes an embedded, agent-queryable Constitution covering engineering golden paths, architecture, research, and software-business context, open to community PRs. It supplies defaults and reference context inside the governed loop (decapod constitution get/search, decapod govern capsule query). It is not a per-project instruction blob—project rules live in .decapod/config.toml and .decapod/OVERRIDE.md—and reading a Constitution entry is never proof of correctness. See Constitution.

Quickstart

Initialize Decapod's metacognitive governance kernel in your repo once, then let Codex, Claude Code, Cursor, or Antigravity ship proof-gated commits.

Who runs what: A human operator installs decapod and runs decapod init once per repository. After initialization, your coding agent (Codex, Claude Code, Cursor, Antigravity, or a custom harness) invokes the remaining commands automatically via the generated repository entrypoints (AGENTS.md, CLAUDE.md, CODEX.md, GEMINI.md).


1. Install the binary (Human)

Choose either prebuilt binary installation or building from source:

# Fastest when cargo-binstall is installed (requires Rust/Cargo + cargo-binstall):
cargo binstall decapod

# Or compile directly from crates.io with locked dependencies:
cargo install decapod --locked

Local SQLite prerequisite: Default local mode (backend = "local") uses a host SQLite shared library via Dactyl. If decapod reports LOCAL_SQLITE_RUNTIME_REQUIRED, install your OS SQLite runtime or set DACTYL_SQLITE_LIBRARY; see Local Dactyl SQLite prerequisite. Cloud-backed repositories do not require local SQLite.


2. Initialize once per repository (Human)

Run decapod init from your repository root:

# Free local mode (SQLite in .decapod/data/decapod.db, offline, no signup):
decapod init

# Or Decapod Cloud (hosted team task coordination and repository-bound custody):
decapod init --backend cloud

Interactive terminal setup steps through Project → Preferences → Review to generate .decapod/config.toml, .decapod/governance.json, living spec templates under .decapod/managed/specs/, and agent entrypoints. Scripted setups use decapod init with or --proof (for config-only preparation without signing in or claiming readiness). Existing repo upgrades and legacy JSONL imports are documented in Configuration: Legacy Upgrades.

For Decapod Cloud teams:

  • Start a personal or team workspace at Cloud Signup and review Cloud project routing.
  • Manage repository enrollment, seats, access policies, and organization administration in Organization Admin.
  • Each teammate signs in per machine with decapod cloud login; credentials stay private, and missing authorization (action_required or repository_denied) fails closed without falling back to local SQLite (see Decapod Cloud Boundary).

3. Hand off to your coding agent

Once decapod init succeeds, open your coding agent in the repository and ask for the engineering outcome you want in ordinary language—for example:

Fix the failing retry-backoff test.

(Or, for a UI/UX task: Improve the terminal interface.)

You do not need to append "Read AGENTS.md, claim a task, write tests, update docs, commit, push, merge" or operate Decapod commands manually. Your repository entrypoints tell the agent how to identify concrete improvements, perform the implementation, add or update meaningful tests, keep affected documentation and living specs aligned, repair failures, and deliver through the repository's configured endpoint—stopping at PR review by default or advancing autonomously only where explicitly configured in Standing Project Delegation.

At decision and commit boundaries, your agent invokes the kernel:

StageAgent commandPurpose
Prompt & contract gateprintf '%s' '<prompt>' | decapod eval --stdin --format json & decapod docs ingestScreen untrusted input ("status": "allow") and load current binary contracts
Session & task claimdecapod session acquire & decapod todo claim --id <task-id>Attribute custody and lease exclusive work ownership
Worktree isolationdecapod workspace ensure --branch agent/<agent>/<task-id>-<topic>Keep main/master untouched (--container when container_workspaces = true)
Orientationdecapod infer orientation --task-id <task-id> & decapod rpc --op context.resolveLoad task constraints, living specs, and optional bounded reflection
Validation & proofdecapod govern artifacts checkpoint ... & decapod validateBind exact candidate HEAD to configured proof checks

See Single-Agent & Handoff Workflow and the CLI Reference for full flag contracts and mid-task agent handoffs.


4. First Governed Result Walkthrough

Here is what one currently supported, verifiable Decapod run produces in your repository—grounded in recorded runs on the Proof page, cross-host entrypoint observations in #880, and the end-to-end fixture in tests/workunit_verified_proof_1660.rs (target outcome-only defaults for full duty derivation, outcome-relevant test controls, and unattended push-through-merge are tracked in #1981, #1982, and #1983 as target/in-progress):

  1. Isolated branch & active custody: After claiming <task-id>, your agent works strictly inside .decapod/workspaces/<worktree> on branch agent/<agent-id>/<task-id>-<topic>, leaving the root checkout untouched.
  2. Authored intent & staged checkpoint: Before committing edits, the agent updates code, tests, affected guidance, and .decapod/managed/specs/ (INTENT.md, ARCHITECTURE.md, INTERFACES.md), records checks in .decapod/governance.json (decapod govern trajectory record), and runs:
git add <authored-paths>
decapod govern artifacts checkpoint --id <checkpoint-id> --summary "Implement fix and update specs"
git add .decapod/governance.json
git commit -m "Implement governed change"
  1. Validation binds to the exact HEAD commit: The agent runs:
decapod validate
  • If a configured build, test, spec, or policy gate fails, decapod validate exits nonzero with typed blockers and remediation steps so the agent can repair the failure and revalidate before claiming completion.
  • Stale-evidence invalidation: If the agent fixes code and creates a new commit, any earlier green receipt for the previous commit immediately becomes stale and cannot admit VERIFIED completion or PR creation. The agent must run decapod validate again on the revised HEAD.
  1. Visible proof in the final result: Once decapod validate passes for the exact current commit against the accepted target branch, the agent publishes or advances to the authorized endpoint (decapod workspace publish and decapod todo done --id <task-id> --validated) and reports the verifiable result:
    • Requested behavior and isolated branch/worktree (agent/<agent-id>/<task-id>-<topic>)
    • What changed across code, tests, affected documentation, and living specs
    • Which required checks actually ran and passed against exact candidate HEAD
    • Current accepted target branch, PR or merge state (PR opened vs merged), and any unresolved work or authority boundary
decapod workspace publish
decapod todo done --id <task-id> --validated

Boundary of what proof establishes: decapod validate proves that the configured repository gates, specs, custody checks, and tests actually executed and passed against the exact candidate HEAD commit (not fabricated record-proof claims). It does not guarantee semantic correctness beyond the configured checks and human review, nor physical confinement of unrestricted host tools. See Proof & Verification Gates.

Mental Model

Learn Decapod's metacognitive mental model: coding agents invoke an ephemeral Rust kernel for orientation, bounded reflection, isolation, and commit proof.

Humans express engineering intent and judgment through the coding agent they already use (Codex, Claude Code, Cursor, Antigravity, or another harness). The coding agent invokes Decapod through its CLI or Decapod-specific structured RPC interface (decapod rpc) whenever work crosses a custody, decision, boundary, or proof transition.

Each invocation ends without leaving a resident daemon. The repository—specifically .decapod/ and Git history—preserves governance state. One engineering task can span processes, models, sessions, and harnesses without losing its recorded constraints or unresolved obligations.

The Kernel Analogy

Human (goal & approval)
  │
  ▼
Coding Agent (user space: reads code, plans, edits, runs tests, calls Decapod)
  │  CLI (`decapod ...`) / Structured RPC (`decapod rpc --op ...`)
  ▼
Decapod Kernel (ephemeral control plane: custody, orientation, policy, validation)
  │
  ▼
Repository (`.decapod/` + Git: plans, specs, claims, worktrees, checkpoints, proof)
  • Resources: Decapod manages task claims and lease generations (todo), isolated Git worktrees and optional containers (workspace), and normalized governance records (.decapod/governance.json).
  • Interface: Agents call Decapod through CLI commands or its Decapod-specific structured RPC interface (decapod rpc --op <op> --params <json> or --stdin) to acquire state, test proposed scopes, and validate candidates.
  • Isolation: Each claimed task works on its own worktree branch, keeping the root checkout (master/main) clean and preventing uncommitted file collisions between parallel agents.
  • Continuity: When a second agent resumes the work—or a human inspects a PR—plans, living specifications, trajectory checks, and validation receipts live in repository state rather than a vanished chat transcript.

The metacognitive decision-time loop

Agents do not call Decapod for every keystroke, nor does Decapod inspect model weights or provide magical self-awareness. Instead, agents invoke Decapod at decision and state-transition boundaries to ground inference before acting and verify results before claiming completion:

  1. Prompt Gate & Contract Ingestion: Before reading repository files or mutating state, the agent evaluates the prompt (decapod eval --stdin --format json), ingests current command contracts (decapod docs ingest), and acquires a session (decapod session acquire).
  2. Custody & Isolation Pressure: "I need exclusive ownership and a clean branch before touching files." The agent claims or adds a task (decapod todo claim --id <id> --lease-seconds 3600), checks fleet overlaps (decapod todo fleet), and enters an isolated worktree (decapod workspace ensure --branch ...).
  3. Orientation & Reflection Pressure: "Before implementing, what constraints, specs, and risks govern this change?" The agent calls decapod infer orientation --task-id <id> (and optionally --reflection '<json>' or decapod rpc --op mentor.obligations at consequential decisions) to surface plan constraints, forbidden paths, living specs, and escalation admissibility across a bounded three-round reflection loop. Reference knowledge from the embedded Constitution (decapod constitution get / decapod govern capsule query) informs decisions inside this step.
  4. Execution & Trajectory Custody: As the agent works, it updates .decapod/managed/specs/*, records inspected/modified files and checks (decapod govern trajectory record), reviews changed contracts (decapod govern plan review-spec), and binds staged material with decapod govern artifacts checkpoint before committing.
  5. Validation & Remediation Pressure: "Does the exact candidate commit pass all required gates against the accepted target?" The agent runs decapod validate. If validation fails, the kernel returns typed error codes and recovery guidance rather than marking work done. The agent repairs the root cause on the work branch, checkpoints and commits the revision, and re-runs decapod validate on the exact new commit.
  6. Publication Pressure: Only when required gates and proof pass for the exact candidate does the work move to decapod workspace publish and decapod todo done --id <id> --validated.
prompt gate → claim & isolate → orient & reflect → implement & record trajectory
      → checkpoint & commit → validate exact commit
      → [if failed: repair → checkpoint & commit → revalidate exact commit]
      → publish & mark done

Epistemic Custody

A central invariant in Decapod is Epistemic Custody: preserving the falsifiable chain between the human's original intent, the context and constraints retrieved before inference, the assumptions and unresolved obligations carried during execution, and the exact-commit proof required for completion (see Artifact Reference and Governance Artifact Inventory).

What Decapod does not guarantee

Clear boundaries keep governance trustworthy:

  • No always-on daemon or shell interception: Decapod cannot force an arbitrary harness to call it, nor can it intercept direct git or filesystem edits made outside Decapod's CLI/RPC boundaries.
  • No automatic merge arbitration: Parallel worktrees isolate uncommitted work, but if two agents edit the same lines in separate branches, standard Git merge conflict resolution, code review, and re-validation still apply.
  • No self-certifying testimony or stale proof reuse: Reading the Constitution, writing a living spec, or declaring a check "passed" in trajectory input is never validation proof. Editing code or rebasing invalidates prior proof; decapod validate must pass on the exact revised commit.
  • No unverified Cloud authority: In backend = "cloud" mode, DECAPOD_AGENT_ID is a cooperative coordination label, not cryptographic authorization; the hosted service independently authorizes repository access on every request.

Configuration

Decapod is configured via .decapod/config.toml (see the Config Specification Reference). This file is human-editable and should be committed to your repository.

The [init] Section

Controls how decapod init behaves.

  • specs: (bool) Whether to generate spec scaffolding under .decapod/managed/specs/.
  • diagram_style: ("ascii" or "mermaid") The style for generated architecture diagrams.
  • entrypoints: (list) Which agent entrypoints to create (e.g., ["AGENTS.md", "CLAUDE.md"]).

The [repo] Section

Defines project-specific policy and metadata.

  • product_name: The name of your project.
  • product_summary: A short description of what the project does.
  • architecture_direction: A high-level note on the architectural style (e.g., "modular monolith").
  • product_type: (e.g., "library", "service", "application").
  • done_criteria: Global "done" criteria that all tasks must satisfy.
  • primary_languages: A list of languages used in the repo.
  • container_workspaces: (bool) Whether to enforce container isolation for all work. Recommended for multi-agent workflows.

Project Overrides

For deep behavioral changes, use .decapod/OVERRIDE.md (see Config Overrides). Find the generated directive section and replace the instruction inside its four-backtick source block with Markdown or any documentation style you prefer. Decapod extracts the block contents as authority while the outer file renders them as code. Duplicate or Decapod-namespaced unknown directive headings outside a body block fail closed instead of applying partial authority.

Standing Project Delegation

Repository configuration determines where a coding agent stops after implementing a change—without requiring the human to repeat workflow commands in every prompt:

  • Human PR review (default): [governance].main_merge defaults to false (omitted when false). After you describe an outcome, your agent claims a task, works in an isolated worktree, runs checks, updates affected documentation and living specs, checkpoints and commits, runs decapod validate, and opens or updates a pull request with decapod workspace publish, then waits for human review and merge.
  • Autonomous delivery through merge (explicit repository opt-in): A human maintainer may set main_merge = true under [governance] in the accepted base repository's .decapod/config.toml (within the repository's branch-protection and CI rules). When accepted standing policy permits it, Decapod's merge-authorization gate (evaluate_main_merge_authorization) lets the agent advance through commit, push, PR checks, and merge without repeated approval prompts once exact-HEAD proof passes. A candidate workbranch cannot self-authorize main_merge = true (POLICY_SELF_AUTHORIZATION_REJECTED), and any base-branch movement or new commit invalidates prior readiness immediately.

Currently demonstrated vs. target defaults: Repository entrypoint activation (AGENTS.md, CLAUDE.md, CODEX.md, GEMINI.md), isolated task/worktree custody, exact-HEAD validation, stale-evidence invalidation, and recorded proof fixtures (/proof.html, tests/workunit_verified_proof_1660.rs, #880) are implemented today (cross-host unattended qualification remains in progress in #880). Target outcome-only defaults—automatically deriving ordinary UX/QA/engineering/docs duties without keyword triggers (#1981), enforcing outcome-relevant coverage and negative controls (#1982), and continuous autonomous continuation through the authorized endpoint (#1983)—are actively tracked work rather than universally enabled defaults.

Legacy Upgrades and Config Backups

When upgrading an existing Decapod repository after installing a newer decapod binary:

  • Idempotent store migration: decapod init, decapod validate, and other governed commands one-shot-import any residual legacy event JSONL into the canonical SQLite event store (.decapod/data/decapod.db) and move retired files under .decapod/data/.retired-jsonl/. Runtime writers never append to JSONL, and legacy SQLite stores recreated by an older binary are copied forward and removed.
  • Override preservation: Existing .decapod/OVERRIDE.md body bytes are preserved while sections are rendered into fenced documentation source areas with visible authoring instructions; unsafe or ambiguous authority fails closed.
  • Non-destructive config refresh: decapod init --refresh preserves existing authored settings as defaults, makes no state edits during --dry-run, and backs up changed configuration privately under .decapod/data/config-backups/. Agents run decapod init --proof during validation for non-interactive upgrade checks without authenticating Cloud credentials or asserting readiness.

Single-Agent & Handoff Workflow

Even when a single engineer drives the work, Decapod prevents context loss, silent scope drift, and unverified completion claims—and makes it effortless to switch coding agents mid-task (see Agent-First Architecture and BYOA & Interoperability).

The Decision-Time Loop

The human describes the goal to their preferred coding agent. The agent invokes Decapod at decision and state boundaries:

  1. Prompt Gate & Session Custody:
    printf '%s' '<incoming prompt>' | decapod eval --stdin --format json
    decapod docs ingest
    decapod session acquire
    
  2. Task Claim & Workspace Isolation:
    decapod todo claim --id <task-id> --lease-seconds 3600
    decapod workspace ensure --branch agent/<agent-id>/<task-id>-<topic>
    cd <reported-worktree-path>
    
  3. Orientation & Bounded Reflection: Before editing source files, the agent gathers constraints, plan state, and optional reflection checks:
    decapod infer orientation --task-id <task-id>
    decapod rpc --op context.resolve
    # Optional at risky or forbidden-path boundaries:
    decapod infer orientation --task-id <task-id> --reflection '<request-json>'
    
    When engineering tradeoffs or doctrine apply, the agent queries the embedded Constitution (decapod constitution get core/DECAPOD).
  4. Implementation, Trajectory & Checkpoint: Inside the worktree, the agent updates code and living specs (.decapod/managed/specs/*), records trajectory evidence, reviews changed contracts, and checkpoints staged material before committing:
    decapod govern trajectory record --run-id <run-id> --modified-file <path> --check "unit=passed"
    decapod govern plan review-spec --path .decapod/managed/specs/ARCHITECTURE.md --disposition updated --reason "..."
    git add <authored-paths>
    decapod govern artifacts checkpoint --id <checkpoint-id> --summary "What changed and was verified"
    git add .decapod/governance.json
    git commit -m "Describe the governed change"
    
  5. Exact-Commit Validation & Failure Recovery:
    decapod validate
    
  6. Publication & Completion: Only after required gates pass for the exact candidate commit:
    decapod workspace publish
    decapod todo done --id <task-id> --validated
    

Concrete journey: switching between two agents on one repo

An engineer starts a bugfix in Cursor or Codex, then switches to Claude Code or Antigravity to finish and validate it:

  1. Agent A records the plan, claims <task-id>, works in the isolated worktree, and either runs decapod todo handoff --id <task-id> --to <agent-b> --summary "Parser fix implemented; unit tests still failing" or decapod todo yield --id <task-id>. Unresolved obligations and checkpoints remain in .decapod/governance.json and .decapod/managed/specs/*.
  2. Agent B runs decapod session acquire, claims or resumes <task-id>, and inspects decapod todo get --id <task-id>, decapod govern artifacts status, and decapod infer orientation --task-id <task-id>.
  3. Agent B inherits the exact scope, prior edits, and remaining proof gaps without asking the human to re-explain the whole project—and still must pass decapod validate on its own final commit.

Concrete journey: recovering from failed verification

When decapod validate fails on a candidate commit:

  1. Do not claim completion or bypass gates: Validation exits nonzero and prints typed error codes and recovery guidance (see Proof & Validation and Error Handling).
  2. Fix the root cause on the same work branch: The agent inspects the failure, repairs the code, spec, or governance artifact inside the claimed worktree, refreshes specs if needed (decapod rpc --op specs.refresh), and records a new trajectory entry and checkpoint before committing the fix.
  3. Recheck the exact revised commit: Prior proof from before the edit is stale. The agent re-runs decapod validate against the new HEAD commit and accepted target, publishing only after the revised commit passes.

Multi-Agent Workflow

Coordinate parallel AI coding agents with shared metacognitive custody: scoped task leases, fleet overlap checks, isolated worktrees, and clean handoffs.

Decapod supports concurrent work across multiple engineers and multiple coding agents on the same repository—whether two teammates use Codex and Claude Code in parallel, or several agent workers tackle distinct slices of one codebase.

The Coordination Model: Lease, Isolate, Inspect

Decapod coordinates parallel work through explicit custody and isolated filesystems:

  1. Scoped Task Claims & Leases: Agents acquire exclusive or shared custody with decapod todo claim --id <id> --lease-seconds 3600 (default exclusive; --mode shared joins as secondary owner). Leases expire automatically if abandoned unless renewed via decapod todo renew --id <id>.
  2. Overlap Inspection (todo fleet): Before modifying overlapping files or paths, agents run decapod todo fleet to inspect active leases, expired claims, and path/scope overlaps across the repository (tests/unit/core/fleet_coord_tests.rs).
  3. Worktree & Container Isolation: Each claimed task runs in its own Git worktree via decapod workspace ensure --branch agent/<agent-id>/<task-id>-<topic>, optionally wrapped in Docker via --container when container_workspaces = true (see Workspace Isolation).
  4. Explicit Handoffs & Yields: When passing a task to another engineer's agent or a specialist reviewer, use decapod todo handoff --id <id> --to <receiver> --summary "..." (which advances the lease generation and re-issues the lease) or decapod todo yield --id <id> (which releases exclusive lease capacity without archiving the task).
decapod todo fleet --format json
decapod todo claim --id <task-id> --lease-seconds 3600
decapod workspace ensure --branch agent/<agent-id>/<task-id>-<topic>

Shared Context Without Shared Dirty Trees

While each agent edits files in an isolated worktree, durable project context stays shared:

  • Tasks, scope & governance: Task state lives in .decapod/data/decapod.db (backend = "local") or the authorized Decapod Cloud service (backend = "cloud"; see Cloud project routing and Organization Admin for repository enrollment, seat assignments, and teammate access policies), while plans, claims, trajectories, and living specs live in .decapod/governance.json and .decapod/managed/specs/*.
  • Aptitude & federated knowledge: Agents can record and retrieve project conventions and procedural observations via decapod data aptitude and decapod data federation.
  • Heartbeats & presence: Agents can record liveness via decapod todo heartbeat and renew active leases via decapod todo renew.

Concrete journey: two engineers using different agents in parallel

Suppose Engineer A (using Claude Code) works on authentication (src/auth/) and Engineer B (using Codex) works on CLI formatting (src/cli/):

  1. Both agents run decapod session acquire with distinct DECAPOD_AGENT_ID values, check decapod todo fleet, and claim separate tasks with disjoint scopes.
  2. Each agent calls decapod workspace ensure to obtain its own worktree and branch. Uncommitted edits, build caches, and test runs never collide on disk.
  3. If Engineer B's task later needs a file Engineer A already claimed, decapod todo fleet surfaces the path/scope overlap. Rather than silently overwriting work, the engineers coordinate via decapod todo handoff, sequential ordering, or separate commits.
  4. When Engineer A merges to master first, Engineer B's earlier validation becomes stale relative to the moved target. Engineer B reconciles master into their worktree, resolves any Git conflicts, checkpoints the merge, and runs decapod validate on the exact merged commit before PR readiness.

What shared governance does NOT guarantee (Negative Cases)

  • No conflict-free edits to identical files: If two parallel branches edit the same lines of the same file, Decapod does not magically auto-merge them. Standard Git conflict resolution, human code review, CI, and fresh validation still apply.
  • Conflicting claims: An active exclusive lease owned by Agent A blocks Agent B from claiming the same task until Agent A runs todo handoff, todo yield, todo release, or the lease expires.
  • Expired custody: Letting a --lease-seconds window lapse without decapod todo renew exposes the claim as expired in decapod todo fleet and prevents stale custody from blocking progress forever.
  • Stale proof across concurrent merges: A passing decapod validate run before an upstream master move or rebase does not authorize publication; revalidation against the exact current candidate and accepted target is mandatory.
  • Cloud access boundaries: In backend = "cloud" mode, parallel engineers on separate machines share live task custody only when the hosted service authorizes each principal for that repository (repository_denied or action_required halts without falling back to local SQLite).

External Trackers

Decapod does not replace project-management systems such as GitHub Issues, Linear, Jira, or Beads. Those systems may remain the organizational system of record. Decapod governs accepted work at the repository execution layer.

The Integration Pattern

  1. Organizational Layer (External): A human creates an issue in Linear (e.g., DEV-456).
  2. Execution Layer (Decapod): An agent adds a Decapod todo that references the external issue (see CLI Reference).
    decapod todo add "Fix regression in auth" --ref "DEV-456"
    
  3. Execution (Isolated): The agent claims the todo and enters its isolated workspace (see Workspace Isolation).
  4. Proof (Verification): The agent marks the task as done, satisfying the Decapod proof gates (see Proof & Validation).
  5. Sync (Closure): The passing Decapod state provides the "green light" to close the external Linear issue.

Why This Bridge Matters

External trackers organize work but do not enforce Decapod's repository invariants. Decapod contributes execution-layer custody, validation, and evidence. The external item is closed according to the team's own approval policy after the governed work reaches its required publication state.

Workspace Isolation

Workspace isolation is Decapod's primary defense against the "dirty tree" problem and multi-agent environment corruption (see Workspace Sandboxing).

Git Worktrees: The First Line of Defense

By default, decapod workspace ensure (see CLI Reference) creates a Git Worktree. Unlike a standard clone, a worktree allows you to have multiple branches checked out simultaneously in different directories while sharing a single .git database.

  • Speed: Creating a worktree is nearly instantaneous.
  • Integrity: Each workspace is a clean slate. There are no residual build artifacts from other branches.

Container Isolation: The Gold Standard

When working with multiple agents or complex dependency chains, filesystem isolation is often not enough. Decapod can wrap each worktree in a Docker container (see Multi-Agent Workflow).

Benefits of Containerization:

  • Dependency Sandboxing: One agent can run npm install for Node 18 while another uses Node 20 in a separate workspace.
  • Process Protection: A rogue agent process (e.g., an infinite loop or a memory leak) cannot crash the host machine or affect other agents.
  • Restricted Access: You can define network and volume policies to limit what an agent can see outside its workspace.

Managing the Workspace Pool

Use decapod workspace status to view the health and ownership of all active workspaces. Decapod handles the complex plumbing of mapping these directories to specific agents and tasks, so you don't have to.

Agent-First Architecture

Decapod's agent-first architecture gives coding agents CLI, structured RPC, and bounded MCP/A2A adapters for metacognitive orientation and commit proof.

The human supplies engineering intent and judgment through their chosen editor or harness; the coding agent invokes Decapod at decision, coordination, and verification boundaries while performing the work. Because the contract lives at the repository boundary rather than inside a vendor-specific runtime, Codex, Claude Code, Cursor, Antigravity, and custom CLI harnesses can operate on the same repository through the same kernel interface (see BYOA & Interoperability).

Closed-loop execution, proof-backed acceptance

Decapod's agent-facing API turns a rejected boundary or missing obligation into usable feedback for the next iteration. The agent preserves the accepted intent from the original request and subsequent instructions, updates its work, and designs the evidence needed to substantiate the result. This is closed-loop metacognitive agent governance.

Validation has a separate role. Required gates execute the agent-developed proof plan under Decapod's governance expectations, bind results to the candidate state, and determine whether the required evidence exists. A well-formed plan or an agent's confidence cannot substitute for executed proof.

Closed-loop model · Error and recovery contract · Proof

From one agent to the next

Decapod keeps the governing record outside the transient model context. An interrupted or replaced agent can inspect the recorded intent, task and workspace custody, prior checks, failed attempts, and remaining obligations. The agent must re-evaluate freshness and authority rather than blindly replaying old operations.

“Continue PR #1234” names the cold-context continuation experiment: a new agent reconstructs the work from recorded state, corrects a genuine failure, obtains fresh exact-candidate proof, and updates the same PR without a transcript handoff. The underlying custody and recovery primitives exist; independent end-to-end demonstration is still being established.

The Agentic Lifecycle

Decapod structures agent work into an explicit, resumable decision-time lifecycle:

  1. Prompt Gate & Ingestion: The agent checks untrusted input (decapod eval --stdin --format json), reads embedded command contracts (decapod docs ingest), and acquires a local or cloud-backed session (decapod session acquire).
  2. Task Claiming & Isolation: The agent claims a todo with an explicit lease (decapod todo claim --id <id> --lease-seconds 3600) and creates an isolated worktree (decapod workspace ensure --branch ...) so overlapping work stays visible and isolated (see Single-Agent Workflow and Multi-Agent Workflow).
  3. Decision-Time Orientation & Reflection: Inside the worktree, the agent calls decapod infer orientation --task-id <id> and decapod rpc --op context.resolve to load plan constraints, living specs, and task scope. At consequential boundaries, it may pass --reflection '<json>' or invoke decapod rpc --op mentor.obligations for bounded three-round challenge checks, and query the embedded Constitution for engineering reference context.
  4. Implementation & Trajectory Custody: The agent edits code and living specifications (.decapod/managed/specs/*) inside its isolated workspace, records trajectory observations (decapod govern trajectory record), reviews changed contracts (decapod govern plan review-spec), and checkpoints staged material (decapod govern artifacts checkpoint) before committing.
  5. Validation & Exact-Commit Recovery: The agent runs decapod validate on the committed candidate. Failures return typed blockers and recovery guidance rather than passing silently; the agent repairs the branch, commits a new checkpoint, and re-runs decapod validate on the exact revised commit (see Proof).
  6. Publication & Completion: Passing gates permit decapod workspace publish and decapod todo done --id <id> --validated (see Artifacts Reference).

Key Agent-First Concepts

1. Deterministic Context Capsules

Models degrade when flooded with stale or irrelevant prose. Decapod's Context Capsules (decapod govern capsule query, decapod rpc --op context.resolve) select bounded, provenance-tagged slices of doctrine and project state so different harnesses start from the same constraints.

2. Living Specifications

Living specifications (.decapod/managed/specs/*) are the acting agent's explicit interpretation of the repository. The agent authors and maintains their semantic prose; Decapod requires and validates them (decapod rpc --op specs.refresh or decapod validate --refresh-specs refreshes supported fingerprints and manifests without inventing authored claims; see Intent).

An incorrect specification surfaces a misunderstanding before publication. A stale specification means governed work remains incomplete.

3. Aptitude & Federated Knowledge

Agents can preserve learned repository conventions and procedural observations across sessions using decapod data aptitude and decapod data federation, while task custody and unresolved obligations persist in todo and .decapod/governance.json.

4. Structured RPC and Bounded Protocol Adapters (MCP & A2A)

Decapod exposes a CLI, a Decapod-specific structured RPC interface (decapod rpc --op <op>), a bounded daemonless stdio Model Context Protocol (MCP) adapter (decapod mcp serve|schema|config, read-only by default with separately guarded --allow-mutations), and a bounded A2A Agent Card, handoff validator, and opt-in loopback HTTP adapter (decapod a2a card|handoff|serve|send). These remain narrow transport adapter boundaries over the local governance kernel: adapter discovery never proves code delivery, never imports remote authority, and never replaces decapod validate (see Model Context Protocol (MCP) and BYOA & Interoperability).

Decision-Time Negative Cases

Agent-first governance fails closed rather than smoothing over broken preconditions:

  • Unregistered or malformed RPC: Unknown ops return unknown_op without initializing project state; malformed or duplicate-key JSON parameters are rejected before dispatch (tests/interop_conformance.rs).
  • Missing session or expired claim: Mutating commands refuse unauthenticated or expired custody rather than silently reassigning ownership (decapod todo renew or decapod todo handoff is required).
  • Reflection stagnation or blocked escalation: Repeating an unchanged forbidden-path proposal or asking a routine discoverable question returns reflect / blocked rather than manufacturing human approval (tests/infer_precision.rs).
  • Stale proof or Cloud denial: Editing files invalidates prior validation; in backend = "cloud" mode, repository_denied or action_required halts without falling back to local SQLite (tests/cloud_managed_session.rs).

Closed-Loop Metacognitive Governance

Closed-loop metacognitive governance turns AI coding agent intent, reflection, trajectory feedback, and exact-commit validation into durable repo state.

The agent supplies intelligence. Decapod governs convergence. Validation demands proof.

A coding agent must interpret an evolving request, act on a real repository, detect when its work no longer satisfies its commitments, and correct course. Decapod makes that process observable and governable through repository-native state and agent-facing feedback. The model has two coupled mechanisms with different authority.

1. Inside the loop: govern the trajectory

original prompt + accepted subsequent instructions
                       ↓
            agent interprets intent
                       ↓
         scopes tasks and proof obligations
                       ↓
             implements the work
                       ↓
   Decapod evaluates governed state and transitions
                       ↓
         feedback → revise → retry ↺

Decapod is called at consequential decision and state-transition boundaries. An invocation may approve the requested operation, reject it, or describe the missing precondition and supported remedy. The agent interprets the feedback and changes its work accordingly. It does not need a human to rephrase a routine error as a new prompt.

The recorded intent baseline evolves through accepted instructions. The agent records its interpretation of the original request and subsequent clarifications in governed state. A Git commit can establish when that interpretation was recorded; it cannot authenticate who originally spoke, or prove that the agent understood them. Until independently sourced request provenance is available, the distinction remains explicit. Task custody, scope and recorded decisions survive sessions and harnesses. See intent provenance and tracking issue #1761.

The loop is metacognitive because the agent repeatedly evaluates its own plan and implementation against explicit expectations and feedback. Decapod supplies the constraints and durable state that make those comparisons consequential. It does not expose or claim to control every private thought or token generated by a model.

2. At the validation boundary: execute proof obligations

As part of fulfilling the request, the agent also designs falsifiable checks that can demonstrate whether the outcome meets the accepted intent. Decapod requires the relevant claims, checks, and evidence to become explicit, under the Constitution and project policy.

The validation boundary runs the required gates against the identified artifact, under the applicable configured rules. It evaluates the evidence and determines whether completion or publication requirements are satisfied.

agent-authored implementation + proof obligations
                       ↓
        required validation gates execute
                       ↓
      current evidence for the exact artifact
                       ↓
         admissible / blocked / unresolved

The gates are distinct from the agent's conversational confidence. A proposed test is not an executed test. A completed task is not an accepted artifact. A prior successful check is not automatically proof for a changed commit. An agent may write a flawed requirement and a test that faithfully passes against the wrong behavior. Green checks prove only what their covered obligations and accepted validation policy actually establish; fidelity to unexpressed human intent remains not_proven. See independent falsifier work.

A rejected validation result can return to the agent as another feedback event; the agent must revise and resubmit its actual work. Iteration is the mechanism of convergence. Validation is the test of that convergence.

One instruction contract across the lifecycle

The kernel already distinguishes governance rule authority (Constitution, project override, task constraints, kernel invariant), phase (pre-execution, during execution, validation, publication), severity (advisory, warning, error, critical), and verdict (pass, fail, unverifiable, stale). Each rule carries evidence and, where available, an actionable remediation contract. These are orthogonal dimensions, not competing kinds of validation.

BoundaryWhat Decapod examinesConsequence
PreparationRecorded intent, unanswered questions, contradictions, accepted plan, applicable rulesUnresolved instructions cannot approve the plan; provenance is retained
ImplementationScope, custody, worktree, task/phase status, required evidence, recorded trajectoryInvalid Decapod transitions are refused with corrective feedback
ValidationApplicable constitutional and project rules, test/build/security checks where configured, artifact provenance, current proof, stale or missing evidenceAll required gates contribute to the actual verdict; passing tests alone are insufficient
PublicationExact candidate and accepted target, current governance document, required receipts, policy and remote admissionStale or incomplete proof cannot authorize governed publication

The same recorded instruction obligations are checked at each boundary. When the plan changes, earlier acceptance and affected proof may become stale. Native validation remains broader than test completion; a model assertion, a generated specification, or a green badge cannot replace the applicable source-bound evidence.

The intent record lives within the existing .decapod/governance.json alongside its plan, claims, trajectory and validation records. Its raw_intent is the recorded origin and refined_intent is the agent's interpretation. They are deliberately different. The same intent ID cannot silently rewrite the recorded origin; later human instructions require explicit identity and provenance. Git establishes the recorded history, while actual human identity needs an authenticated host where required.

Where enforcement actually lives

Decapod can refuse a Decapod-mediated operation or publication transition when a prerequisite is unsatisfied; actionable errors return control to the agent for repair. The kernel is daemonless and does not intercept an unrestricted process editing files or directly calling Git/GitHub. Such bypasses require explicit host hooks, OS permissions, or remote branch protection and must not be described as kernel-forced compliance.

An APPROVED plan is a declared execution-contract state, and the CLI alone does not authenticate a human approver. The required distinction is between agent/caller plan acceptance, genuine human decision evidence when policy demands it, executed validation, PR publication, and remote admission/merge. A PR's existence is not proof of admission, much less semantic correctness. See enforcement boundary hardening.

Cold-context continuation

Consider the user instruction “Continue PR #1234.” It is a product-level acceptance test for Decapod's durable state model, not a special syntax that the kernel currently guarantees.

An agent with no access to the earlier chat should be able to consult the repository and actual Git/forge state to reconstruct the recorded original and later instructions, task ownership, permitted scope, plan, workunit/trajectory, earlier failed checks and attempted corrections, outstanding proof obligations, and current PR head/base. It must verify what remains applicable now, select a permissible repair, and execute fresh validation before claiming the PR is ready. Merely retrieving a summary or repeating the previous agent's “done” claim would fail that test.

This design unites three existing concerns:

  1. Durability: Request, custody, trajectory, rules, and evidence survive outside the model context in established canonical storage.
  2. Corrective feedback: A rejected Decapod-mediated transition should identify the specific applicable obligation and supported next action so the agent can repair rather than repeat an equivalent failed attempt.
  3. Adjudication: Required validation and publication checks judge the exact candidate against the current governing conditions. An agent cannot turn previous good intentions into fresh proof.

The kernel supplies durable records and source-backed guidance at supported boundaries. It does not automatically intercept every inference call, direct shell command, or private model thought. A new agent cannot recover information that was never recorded. The end-to-end cold-agent PR continuation is being tested under #1367 and #1758; do not label that complete until an independently observed real-agent run succeeds.

Assurance and claim discipline

ClaimEvidence required
ProvenAccepted implementation, reproducible negative and positive checks, and evidence bound to the actual candidate
PartialWorking mechanism with a named unverified seam, missing external observation, or bounded coverage
TargetA desired autonomous workflow or integration awaiting falsifiable end-to-end evidence

A check may prove an operation executed without proving a human's unexpressed intention. A valid repository journal may preserve recorded context without establishing that a new agent used it correctly. An actual admitted PR is a stronger result than an agent's completion message.

Why the sequence matters

An agent can take several individually authorized steps and still produce an unsatisfactory result. A trustworthy outcome needs more than isolated permission checks: it needs a recorded trajectory from intent to implementation, clear proof expectations, and validation of the final candidate.

Decapod governs recorded work and state transitions, with defined policy and evidence boundaries. It does not claim to infer every internal reasoning step. Likewise, validation establishes what the configured proofs actually demonstrate; it cannot establish semantic correctness that the proof obligations fail to express. When the intent remains ambiguous or evidence is inadequate, the correct outcome is not proven, with an explicit blocker or a decision gate.

In practice

A user asks an agent to change an API, then clarifies a backward-compatibility requirement. The agent records both the request and the clarification, scopes the change, and proposes checks that demonstrate the new behavior and compatibility. Decapod rejects unsupported transitions or missing obligations and gives the agent actionable feedback. The agent amends its work and proof design, then submits the candidate to validation. Required gates execute the checks. The resulting evidence is associated with the exact repository state; a failing or missing gate leaves completion unresolved.

This is closed-loop metacognitive agent governance with proof-backed checks on recorded intent convergence. Verification of the exact artifact is concrete; confidence about the human's intended meaning must remain bounded by the available independent evidence.

Agent-first architecture · Proof · Error handling · Mental model

BYOA & Interoperability

Decapod is built for Bring Your Own Agent (BYOA) workflows. An engineering team does not have to standardize on a single AI IDE, proprietary chat UI, or central orchestration daemon. Codex, Claude Code, Cursor, Antigravity, and custom harnesses all interact with the same repository kernel through the same CLI and structured RPC contract.

How heterogeneous agents bind to one repository

  1. Repository entrypoints (AGENTS.md, CLAUDE.md, CODEX.md, GEMINI.md): Generated during decapod init and refreshed across upgrades so any supported harness opening the repository sees the same governance contract (decapod eval, decapod docs ingest, decapod session acquire, decapod todo claim, decapod workspace ensure, decapod validate).
  2. Process-level CLI & Decapod-specific structured RPC: Agents invoke decapod <command> or decapod rpc --op <op> --params <json> (or --stdin, or authenticated loopback --http-server). Every call is ephemeral and exits on completion; durable state stays in .decapod/ and Git.
  3. Compatibility by explicit contract, not blanket claims: Agents discover supported operations and extensions at runtime via decapod rpc --op interop.manifest and negotiate compatibility via decapod rpc --op interop.negotiate against profile decapod.interop (v1, supporting extensions receipts, interlocks, projections, and context-capsule).
decapod rpc --op interop.manifest --params '{}'
decapod rpc --op interop.negotiate --params '{"profile_version":"v1","required_extensions":["receipts","interlocks"]}'

The manifest (src/decapod/core/interop.rs) separates implementation status from verification state: static source coverage maps default to not_run, and interop.manifest explicitly declares that it describes capabilities rather than authorizing actions or proving live conformance.

Bounded protocol and harness adapters (MCP, A2A, Harness CLI)

In addition to the CLI and decapod rpc, the current binary ships three bounded, daemonless interoperability adapters that preserve repository-local authority:

  • Local stdio MCP adapter (decapod mcp serve|schema|config): Exposes 6 typed tools and 4 redacted decapod:// resources over local stdio JSON-RPC 2.0 (2025-03-26, 2024-11-05; auto, jsonl, or content-length framing). Transport defaults to read-only; --allow-mutations still enforces session authentication and .decapod/workspaces/* worktree custody. See Model Context Protocol (MCP) for exact tool/resource contracts and version-qualified host configuration guidance (including Grok Build).
  • Bounded A2A card, handoff validator, and opt-in loopback adapter (decapod a2a card|handoff|serve|send): Advertises only executable local governance skills, reports core A2A framing separately from Decapod governance extensions, and validates bounded handoff envelopes fail-closed against local repository ground truth (imported_authority_granted: false). The opt-in authenticated loopback HTTP adapter (decapod a2a serve / send) remains bounded (INV-DAEMONLESS) and non-authoritative; Decapod does not ship a persistent hosted A2A task server.
  • Conflict-safe harness packaging (decapod integration harness matrix|generate|install|status|update|remove|rollback): Emits an honest 6-host compatibility matrix (codex, claude-code, antigravity, opencode, grok-build, pi) and installs or rolls back host discovery configs without clobbering unrelated user settings.

Across all three surfaces, Decapod preserves three hard distinctions:

  1. Local protocol conformance is not live vendor-host activation: Passing local stdio/HTTP adapter tests does not by itself prove end-to-end activation inside a specific third-party host CLI or IDE.
  2. Cooperative host hooks are not security boundaries: Host hooks can be disabled, bypassed by direct shell/git execution, or fail open on errors; final enforcement remains in Decapod's kernel custody gates, OS/container isolation, and Git/forge branch protection.
  3. Adapter discovery never proves delivery: Listing or calling MCP tools or inspecting an A2A Agent Card never substitutes for exact-candidate decapod validate proof.

Identity and custody across harnesses

  • Local cooperative identity: DECAPOD_AGENT_ID and decapod session acquire (DECAPOD_SESSION_PASSWORD) attribute local task claims, workspace leases, and trajectory entries. decapod session handshake --scope <scope> records tamper-evident identity_assertions, where environment-supplied agent/provider names remain self-declared and unverified unless backed by a trust root.
  • Cloud-backed identity (repo.backend = "cloud"): Task custody routes through Dactyl to a hosted service that independently verifies the authenticated account and repository permission on every request; copying another agent's DECAPOD_AGENT_ID label never grants cloud repository access (see Cloud sign-in and task access).
  • Shared durable custody: Because plans, claims, trajectories, living specs, and validation receipts live in .decapod/governance.json, .decapod/managed/specs/*, and the todo store, switching harnesses never strands context inside a closed chat window.

Concrete journey: switching agents mid-task

Suppose one engineer starts a change in Codex, stops midway, and continues in Claude Code or Cursor on the same repository:

  1. First agent leaves durable state: Codex claimed <task-id> (decapod todo claim --id <task-id>), entered .decapod/workspaces/<worktree>, recorded scope/checks in .decapod/governance.json, and either yielded or handed off (decapod todo handoff --id <task-id> --to claude-code --summary "..." or decapod todo yield --id <task-id>).
  2. Second agent resumes without re-explaining everything: Claude Code runs decapod session acquire, inspects decapod todo get --id <task-id>, decapod govern artifacts status, and decapod infer orientation --task-id <task-id> (claiming or accepting the handoff if needed). It immediately sees the accepted intent, modified files, unresolved obligations, and any prior failed checks.
  3. Proof must still be earned on the final commit: Any new edits by the second agent require fresh trajectory updates, checkpoints, and decapod validate on the resulting commit.

Negative cases & enforcement evidence

Failure CaseKernel BehaviorSource / Test Evidence
Unregistered RPC opReturns unknown_op without creating .decapod/ or session files.tests/interop_conformance.rs::unregistered_rpc_is_rejected_before_project_startup
Malformed or duplicate JSON keysRefused before interop.negotiate or RPC dispatch; never silently drops a required extension.tests/interop_conformance.rs::malformed_rpc_parameters_cannot_drop_required_negotiation
Conflicting task claimExclusive claim by Agent A blocks Agent B unless handed off, yielded, or expired.tests/unit/core/fleet_coord_tests.rs, tests/todo_enforcement.rs
Expired custody leaseClaim lease expires after --lease-seconds unless renewed (decapod todo renew); expired leases are surfaced by decapod todo fleet.tests/unit/core/fleet_coord_tests.rs::lease_expiry_and_reclaim_rules
Stale proof after editsPrior validation receipt no longer satisfies current commit; decapod validate must pass on the new commit.tests/interop_conformance.rs::stale_evidence
Inaccessible repo or Cloud denialrepository_denied or action_required halts without SQLite fallback; validate requires a valid workspace and accepted target.tests/cloud_managed_session.rs

Intent

Preserve human intent before AI coding agents write code: Decapod tracks raw requests, living specs, ambiguity pressure, and reconciliation receipts.

In Decapod, Intent is the primary driver of the metacognitive development lifecycle—the human-originated "Why" that must be preserved, challenged when ambiguous, and formalized before implementation begins.

The Spec-First Mandate

Agents often dive into implementation before fully understanding the human operator's goal. Decapod prevents this by mandating a spec-first approach:

  1. Capture: Vague requests are converted into explicit tasks via decapod todo add (see CLI Reference).
  2. Formalize: Agents are required to update or verify the specs/INTENT.md document scaffolded in the repository (see Artifacts Reference).
  3. Validate: The required checks execute against the identified implementation and the recorded acceptance criteria. A mismatch they actually detect fails; an unexpressed semantic misunderstanding may remain not_proven (see Proof & Validation).

Intent Pressure

"Intent Pressure" occurs when an agent encounters ambiguity. Decapod's philosophy is that uncertainty must be preserved, not compressed. If an agent is 70% sure of a requirement, it must not guess the remaining 30%. Instead, it should record the ambiguity in the task's metadata or INTENT.md and request human clarification.

Versioned Specifications

Because Decapod is repo-native, your specifications are versioned alongside your code. This creates a permanent, auditable link between a feature's requirements and its implementation, which is invaluable for long-term maintenance and multi-agent handover.

Canonical instruction custody

Decapod already stores durable intent custody in .decapod/governance.json. Its intents map keeps the recorded original request (raw_intent) distinct from the agent's working interpretation (refined_intent). The same document carries the current plan, trajectory, claims, and validation receipts; there is no second human-intent store.

An original request must not be silently rewritten by an updated plan or a new model's interpretation. The same intent identity preserves its original recorded text. Materially new human instructions use separate identity and explicit provenance; existing Git history remains recoverable. The kernel can preserve recorded bytes and enforce stated requirements, but an agent-supplied assertion about who said something is not authenticated human consent.

The governed plan's instruction blockers have one meaning across preparation, implementation, validation and publication: missing intent, unknowns, unresolved human questions or contradictory instructions, and pending human spec-review decisions are not approval. Correct the plan, explicitly reaccept the revised execution contract, and revalidate affected evidence.

Continuous Intent Reconciliation

The governed plan records the request as captured or interpreted by the agent; agent-authored project specifications express its current understanding. This is not independent proof of the original human words or their meaning. Changes to source code cannot silently authorize a change to that recorded intent, and the kernel does not infer a missing human approval from an agent statement. The authoritative request/clarification lineage and contradictory-prompt arbitration are tracked in #1761. The coding harness generates code and proposed spec updates; Decapod reports observable mismatches and retains existing governance/proof gates.

Read the advisory report at any point:

decapod rpc --op intent.reconcile --params '{}'

This read-only reconciliation operation uses the existing repo fingerprint, spec manifest, authored Markdown, and governed plan. It reports outdated manifest snapshots, missing canonical specs, unresolved human questions, and stale bound spec reviews. Hash agreement establishes input freshness, not semantic correctness.

For stable cross-document traceability, the agent may place an exact standalone marker before a requirement in the authored portion of .decapod/managed/specs/INTENT.md:

<!-- decapod:requirement REQ-OFFLINE-EDIT -->
Offline editing remains available without connectivity.

Use that same marker in the authored sections of the relevant architecture, interface, semantics, security, operations, or validation document. Only INTENT.md defines an ID; another document merely references it. IDs must be REQ- followed by uppercase letters, digits, hyphens or underscores, at most 64 bytes total. Never put markers in generated blocks or code fences. Missing, duplicate, invalid, orphaned, and unvalidated references remain visible. A reference is an agent-authored traceability assertion, never evidence that code satisfies the requirement or that a test passed.

Immutable change impact

For a bounded, exact Git comparison, provide the full immutable base commit ID. The current HEAD commit is the other end of the comparison. This view excludes uncommitted working-tree changes; it never silently resolves a moving branch name.

decapod rpc --op intent.reconcile --params '{"base_commit":"<full-commit-oid>"}'

The additive change_impact section (report version 1.1.0 when requested) lists changed paths and status, including renames, authored material-spec changes versus generated-only projection updates, and REQ identifiers explicitly present in changed authored specs. It separately exposes changed implementation paths that have no verified code-to-requirement mapping. A marker appearing in a spec cannot establish that any changed code implements it.

The inspection requires a real commit object that is an ancestor of HEAD. Unsupported or oversized paths and incomplete observations are reported with complete: false, without inferring unaffected files. Invalid or symbolic base identifiers fail explicitly. review_needed and evidence_needed are advisory; neither field satisfies spec review, validation or publication proof. Empty RPC parameters retain the existing report shape and version.

This first reconciliation contract is advisory: it does not write specs or code, approve changes, execute tests, or certify semantic alignment. Agents resolve the findings in their isolated workspace and use the configured validation and publication process for acceptance. A reported not_proven is not a test failure and cannot be treated as proven.

Workspaces

Decapod workspaces are isolated execution environments that ensure agentic work is performed safely and reproducibly.

The Isolation Hierarchy

Decapod provides three levels of isolation:

  1. Branch Isolation: Every task is performed on a dedicated git branch, preventing accidental mutations to main.
  2. Filesystem Isolation: Decapod uses Git Worktrees to create unique directory structures for every task. This allows multiple agents to work on the same repository concurrently without filesystem collisions.
  3. Process Isolation: By enabling container_workspaces, Decapod wraps each worktree in a Docker container. This ensures that an agent's processes, environment variables, and local dependencies (like node_modules) are completely isolated from other agents.

Workspace Lifecycle

  • Acquisition: Triggered by decapod workspace ensure. Decapod calculates the necessary isolation level based on project config.
  • Entry: The agent cds into the workspace. All subsequent tool calls (compilers, linters, tests) must be executed within this boundary.
  • Promotion: Once work is verified, decapod workspace publish bundles the changes for merging back into the root repository.
  • Eviction: Completed or abandoned workspaces are automatically cleaned up to save disk space and maintain repository hygiene.

Why it Matters

Without workspace isolation, multi-agent systems are prone to "environment drift" and race conditions. Decapod's workspace model makes concurrent agent work as safe as concurrent human work on separate machines.

Proof

Decapod separates AI coding agent claims from proof-backed completion using exact-commit validation gates, epistemic custody, and deterministic checks.

A completion claim only reports what an agent believes. Proof-backed completion establishes that the required gates actually ran against identified repository state, produced verifiable evidence, and permitted the governed publication transition.

Proof design and verification are different acts

The agent is responsible for implementing the request and articulating how its implementation can be falsified. Original intent, accepted subsequent prompts, the Constitution, and applicable project policy determine the expectations. In its governed execution loop, the agent may revise its implementation and proposed checks as it receives actionable feedback.

The validation layer executes the required gates outside the agent's self-assessment. A result is admissible only when the configured requirements have been exercised against the identified repository state and their evidence is present and current. Validation may be invoked repeatedly; each verdict still belongs to the exact candidate and conditions it measured.

The agent can author a test and run it, but cannot turn a test description, a green-looking message, or its own conclusion into proof. Missing or weak proof obligations remain a governance concern even when individual authorized actions appear harmless.

See Closed-loop metacognitive governance.

Validation is a governed decision

decapod validate evaluates the required, applicable repository contract. That can include rule authority and scope, plan/intent readiness, Constitution and project overrides, source history, worktree custody, actual build/test/security execution, validation epoch integrity, and evidence freshness for the exact candidate. A green unit-test suite is one possible input to this broader determination.

Rules use independent dimensions: authority (constitutional, project, task, non-waivable kernel), lifecycle phase (pre-execution, during execution, validation, publication), severity (advisory through critical), and verdict (pass, fail, unverifiable, stale). Remediation describes the supported action and whether autonomous repair or human authorization is required. The kernel does not turn an unresolved question or an unknown proof into a successful result.

The approved plan is an execution-contract state. Recorded human questions, contradictions, unknown requirements, and unresolved human spec decisions remain blockers at preparation, execution, validation, and publication. Passing a test cannot waive those obligations.

Verification Gates

A "Gate" is a discrete check that must pass for a task to be considered valid. Common gates include:

  • Compliance Gates: Checked by decapod validate (see CLI Reference).
  • Quality Gates: Unit tests, linting, and type-checking.
  • Security Gates: Secret scanning and dependency audits.
  • Human Gates: Explicit approval for high-risk changes.

The Evidence Ledger

When an agent completes validated work, Decapod binds validation receipts and evidence references to governed repository state (see Artifacts Reference). Agent testimony alone does not satisfy that boundary.

This creates epistemic custody: a reviewable chain from accepted intent and assumptions to the checks that ran and the repository state they measured.

Failure and recovery

A failed gate means the proof requirement is unsatisfied; it does not mean the task is complete. If the result provides a supported recovery path, the agent should:

  1. inspect the validation result;
  2. identify the violated invariant;
  3. perform the sanctioned remediation;
  4. update the relevant artifact;
  5. re-run validation; and
  6. continue toward publication.

Decapod does not assume every failure is recoverable. Decision gates, contradictions, unsupported remediation, and unavailable proof remain blockers for human review.

Determinism

Decapod strives for deterministic proof. A proof is valid only if it can be re-run or re-verified by another agent or a human at a later date. This ensures that the repository's integrity is not dependent on a single agent's transient state.

Common Questions

Answers to common questions about operationalized AI metacognition, living specs, validation gates, enforcement boundaries, and Decapod Local vs Cloud.

What does metacognition mean in Decapod?

In Decapod, metacognition means operationalized, decision-time self-monitoring externalized into repository state—not model-weight introspection, consciousness, or anthropomorphic claims. Before mutating code, a coding agent queries Decapod (decapod infer orientation, decapod govern plan reflect, the embedded Constitution, and .decapod/managed/specs/*) to test whether its plan matches recorded intent, respects boundaries, and preserves unresolved uncertainty. During and after execution, trajectory custody and decapod validate confront the agent's claims with independent, exact-commit evidence so misunderstandings surface and get corrected before publication. See Closed-Loop Metacognitive Governance and Mental Model.

Why does Decapod not write my specifications?

The agent interprets the request and repository, so the agent authors the semantic claims. Decapod requires, validates, and may refresh supported projections of those claims.

Why are living specifications required?

They move the agent's interpretation out of transient model context and into a durable, reviewable repository artifact.

Why can specifications be wrong?

They record an agent interpretation, not an independent truth invented by Decapod. Validation makes a misunderstanding visible before publication so it can be corrected.

Can a green validation result prove the agent built what I meant?

Only to the extent that the configured checks express the relevant requirement. Decapod can demonstrate which checks actually ran against the exact source, under which accepted policy. If the agent misunderstood a request and authored tests for the wrong behavior, passing those tests does not establish fidelity to the human's intended meaning. The intent-reconciliation view explicitly reports semantic alignment as not_proven. Closed-loop governance explains the distinction.

Does an APPROVED plan prove a human approved it?

No. It is a governed state transition for the recorded plan, and its current CLI contract does not independently authenticate a human identity. A separate human decision or approval must be backed by the relevant trusted authority. Creating a PR does not prove admission or merge.

Can Decapod physically prevent every agent file write?

No. It rejects unsupported operations through its own interface and can block governed publication. An unrestricted agent may edit files or invoke Git outside that interface. Enforcing all host operations requires controls at the actual host, operating-system, and repository boundaries. The enforcement map identifies the distinction.

Why does validation block publication?

Publication is a governed state transition. It remains blocked while required invariants or evidence are unsatisfied.

Why are governance artifacts committed?

Plans, claims, trajectories, validation receipts, and related evidence must remain available to reviewers, CI, and later agents after the original process ends.

Why does durable state live in the repository?

The repository already provides shared custody and history. Keeping governed state with the work allows execution to continue across processes, models, harnesses, and Decapod invocations.

Why is Decapod daemonless?

Agents invoke it when governance is needed. No background process is required because the repository, not process memory, is the durable execution surface.

Why can one task span many invocations?

Each CLI or RPC call is ephemeral. The task continues through durable repository state until validation, publication, and proof requirements are satisfied.

Why should an agent continue after a recoverable validation failure?

Failure means a required condition is still unsatisfied. The agent should follow the supported remediation, update the affected artifact, revalidate, and continue toward publication.

How is Decapod different from an agent?

The agent interprets and performs the work. Decapod governs accepted work and validates the conditions around it.

How is it different from an orchestrator?

An orchestrator schedules or coordinates execution. Decapod defines and enforces repository-native governance boundaries; it does not replace the harness that runs the agent.

How is it different from a task tracker?

Trackers organize work. Decapod governs accepted work at the execution layer. GitHub Issues, Jira, Linear, or another tracker may remain the organizational system of record.

What does convergence mean?

The agent preserves accepted intent, stays within explicit boundaries, maintains durable state, responds to validation, remediates supported failures, and produces evidence before completion.

What does proof-backed completion establish?

It establishes that required checks ran against identified repository state, produced the required evidence, and permitted the governed completion or publication transition.

How do Decapod Local and Decapod Cloud differ?

Decapod Local (repo.backend = "local", default) is free, offline, and local-first, with no account required. Decapod Cloud (repo.backend = "cloud") provides hosted repository-bound task custody and team coordination for organizations and repositories enrolled through Cloud Signup and Organization Admin. See Cloud project routing and Decapod Cloud sign-in and task access for the exact runtime boundary.

How do teams manage Decapod Cloud subscriptions and repository access?

Organization owners and admins set up teams at Cloud Signup and manage subscriptions, repository enrollment, seat assignments, teammate access policies, and billing in Organization Admin. Each teammate signs in independently on their own machine (decapod cloud login); the Decapod CLI never stores pricing tables, access rosters, or billing authority in .decapod/config.toml, and the service independently authorizes every repository read and write.

Constitution

Decapod's embedded Constitution gives coding agents on-demand engineering doctrine, tradeoffs, and research context inside the metacognitive control loop.

Compiled directly into the Decapod binary, this agent-queryable knowledge corpus supplies curated engineering golden paths, architecture and design tradeoffs, implementation methodology, technical research, security and operations, and the product and business context required to build, ship, and operate software.

Subordinate role in the architecture

The Constitution is not the primary Decapod product headline, and it is not a per-project instruction blob:

  • Decapod is the governance kernel (custody, isolated workspaces, decision-time orientation and reflection, exact-commit validation, and proof).
  • The Constitution is one embedded reference layer inside that loop, providing shared baseline engineering defaults and research context across repositories.
  • Repository-specific rules live separately in .decapod/config.toml (project policy and proof profile), .decapod/OVERRIDE.md (scoped directive overrides), and .decapod/managed/specs/* (agent-authored living specifications).

Every project can draw from the same underlying engineering canon without copying tens of thousands of lines into a giant AGENTS.md prompt file.

A software-factory knowledge base

The Constitution is organized for targeted agent retrieval, not end-to-end human reading. Its discoverable nodes cover software architecture, interfaces, data, methodology, specifications, documentation, and cited technical research. Research entries capture questions, contributions, engineering implications, limitations, and related work so an agent can weigh tradeoffs instead of blindly copying patterns.

Its scope is intentional: software engineering and the business of bringing software to market. Technical choices, reliable delivery, product decisions, and go-to-market considerations belong when they materially inform engineering work; unrelated encyclopedic topics do not.

Agents query inside the governed loop

Coding agents query relevant Constitution fragments through Decapod's CLI or structured RPC interface during orientation and planning—without requiring humans to paste giant rulebooks or run slash-command sequences:

decapod constitution get core/DECAPOD
decapod constitution search --query "validation"
decapod govern capsule query --topic "interfaces" --scope "interfaces" --task-id <task-id>
decapod rpc --op constitution.get --params '{"section":"core/DECAPOD"}'

The agent must still invoke the supported interface; installing Decapod is not evidence that an arbitrary harness consulted the Constitution. See Agent-First Architecture and the CLI Reference.

How knowledge becomes authority

The Constitution has a global baseline, with local policy layered separately:

  1. Shared Constitution. The versioned embedded corpus supplies engineering doctrine, reference material, decision context, and directives with explicit authority and binding classifications.
  2. Repository overrides. A team's .decapod/OVERRIDE.md can refine registered directives for its repository. Exact directive IDs, precedence, and source provenance are part of the governed context. See Overrides.
  3. Task-specific constraints. Accepted objectives, plans, specifications, custody, and applicable work-unit policies further constrain the current operation.

Knowledge is not proof. Research findings, examples, and advisory recommendations inform decisions; they are not executable validation results. Required validation (decapod validate) must still run against the actual candidate commit and accepted target before completion or publication. No retrieved Constitution page substitutes for real checks.

Contribute to the common canon

The Constitution is community-contributable through reviewed GitHub pull requests to Decapod. See Contributing for the repository's review and proof expectations.

Useful contributions strengthen a software-engineering or software-business golden path, document a relevant research result and its limitations, clarify an architectural tradeoff, or improve how agents retrieve applicable knowledge. Include sources and explain which engineering decisions the material improves. Changes affecting binding behavior also require compatibility and validation evidence.

Corpus schema 3.1 and the existing compression build apply structural admission. Ordinary nodes remain advisory doctrine. Binding/router promotions must change the reviewed native admission registry and identify the owning control and PR review requirement. Declared guidance remains not_machine_enforced; native execution gates retain their own measured proof. Editing metadata or a review label cannot authenticate human approval or establish that a check passed.

See Constitution provenance for reproducible source history, author testimony, external research dates and security/effectiveness limits. The global JSON corpus, early Markdown embedding, scoped retrieval and later provenance/gates have separate histories.

Constitution provenance and evidence

Design provenance, implemented mechanisms and measured effectiveness are separate claims. This page records what can be checked and what remains testimony. It does not claim that an instruction-file study tested Decapod or that earlier design proves a better outcome.

Reproduce the repository chronology

From a full checkout, run the source-controlled Rust generator against an immutable accepted commit:

cargo run --locked --features build-tools --bin decapod-constitution-history -- \
  --ref 6ab6de3134286a790d78d370ca3fb43c0d92f834 \
  --public-evidence docs/research/constitution-public-source-evidence.json

assets/tools/constitution_history.rs inspects history reachable from that commit and explicitly captured public version-tag objects. It records source predicates, full commit/blob identities, author and committer dates, source URLs and the first containing published version. It separately dates embedded Markdown, generated entrypoint templates, overrides, section hashes, scoped selection, global JSON, compressed JSON embedding, capsules, override provenance, workspace refusal and proof-gate implementation. Missing evidence stays null. Its deterministic fixtures exclude an unaccepted orphan branch and distinguish a version tag from a published release.

The checked-in generated facts bind the public source capture. The capture records 594 public plain version tags and 592 nondraft, nonprerelease GitHub releases observed on 2026-11-17. It was collected read-only with git ls-remote --tags origin and gh api --paginate repos/DecapodLabs/decapod/releases. The generator verifies local tag-object equality and hashes the explicit input; it does not authenticate the capture's producer. Without this input, publication remains unobserved. Older public tag lineages are included explicitly rather than mistaking the earliest tag still ancestral to today's master for the first release.

The first matching commit in reverse topological source history is an observed repository fact. Git author/committer/tag timestamps can be changed; they are not independently recorded dates of first public availability. A containing tag is not evidence of an uploaded GitHub release or of a functioning released binary. Release publication uses the separate captured forge evidence. Literal source predicates identify inspected bytes; tests and actual-binary execution establish behavior.

Claim and evidence matrix

ClaimTime assertedArtifactCommit/releaseClassVerification and limitsProvenance
Intent-Driven Design statements began in August 2025Reported in the public research artifact; inspected 2026-11-17Author's account of LinkedIn postsNo independently verified original post supplied herePublic author testimony about earlier postsOriginal post URL, publication date and contemporaneous archive still needed; no inception date inferredResearch README
Constitution-driven scaffolding existed around September 2025Same accountReported earlier practiceNo contemporaneous artifact verified hereAuthor testimonyA separate milestone from the November report; neither date silently replaces the otherResearch README
Recurring context poisoning motivated a November 2025 design milestone2026-11-17 issue clarificationAuthor's reportNo private artifact inspected or publishedAuthor testimonyPrivate evidence remains private; permission and provenance are required before use#879
embedded markdown constitutionCommit metadata 2026-02-11T03:01:48-08:00; release 2026-02-11T12:51:11Zsrc/core/assets.rs; literal predicates and blob in generated facts0b4378d01fd5cb7033856938db6a0b24cbbb26b9; v0.0.1Public repository source + captured forge publicationEarliest observed matching source predicate; not design inception, execution or efficacySource
generated agent entrypoint templateCommit metadata 2026-02-11T03:01:48-08:00; release 2026-02-11T12:51:11Zsrc/core/assets.rs; literal predicates and blob in generated facts0b4378d01fd5cb7033856938db6a0b24cbbb26b9; v0.0.1Public repository source + captured forge publicationEarliest observed matching source predicate; not design inception, execution or efficacySource
repository override resolutionCommit metadata 2026-02-12T15:07:21-08:00; release 2026-02-12T23:20:02Zsrc/core/assets.rs; literal predicates and blob in generated factsc164749cc5a3007dcae7afafcb04df9b71f4e314; v0.1.4Public repository source + captured forge publicationEarliest observed matching source predicate; not design inception, execution or efficacySource
section fragment with source hashCommit metadata 2026-02-17T15:41:09-08:00; release 2026-02-17T23:47:47Zsrc/core/docs.rs; literal predicates and blob in generated factsb50afbb654bc5dcb854523a943a78cd075ae115b; v0.26.0Public repository source + captured forge publicationEarliest observed matching source predicate; not design inception, execution or efficacySource
task query scoped selectionCommit metadata 2026-02-23T04:28:38-08:00; release 2026-02-23T12:47:14Zsrc/core/docs.rs; literal predicates and blob in generated facts329f5c234e73e6cc270a60e53bccb0c60b1389d6; v0.38.0Public repository source + captured forge publicationEarliest observed matching source predicate; not design inception, execution or efficacySource
global json node corpusCommit metadata 2026-05-21T21:55:18-07:00; release 2026-05-22T04:59:06Zassets/constitution.json; literal predicates and blob in generated facts0e87b0ebf9c3252482f2a37e1bb5b4188b044e12; v0.49.0Public repository source + captured forge publicationEarliest observed matching source predicate; not design inception, execution or efficacySource
compressed json embeddingCommit metadata 2026-05-27T17:33:29-07:00; release 2026-05-28T00:36:19Zbuild/compress_constitution.rs; literal predicates and blob in generated facts94f17b3a4a762ba0c7ad3421360ba0ac5f1b12bb; v0.55.0Public repository source + captured forge publicationEarliest observed matching source predicate; not design inception, execution or efficacySource
state bound context capsuleCommit metadata 2026-02-23T06:51:52-08:00; release 2026-02-23T15:18:52Zsrc/core/context_capsule.rs; literal predicates and blob in generated factsb4ea35b07ebf4990ef47184d6c13a22483ab37df; v0.38.5Public repository source + captured forge publicationEarliest observed matching source predicate; not design inception, execution or efficacySource
override source provenanceCommit metadata 2026-08-01T19:37:05-07:00; release 2026-08-02T02:46:17Zsrc/decapod/core/assets.rs; literal predicates and blob in generated facts3590e46c46460b9e2fd42a8a1e447f017273e233; v0.93.0Public repository source + captured forge publicationEarliest observed matching source predicate; not design inception, execution or efficacySource
native workspace refusalCommit metadata 2026-02-17T12:45:08-08:00; release 2026-02-17T20:51:28Zsrc/core/workspace.rs; literal predicates and blob in generated facts9f071132dd996fe713159a27dca012b0b325cb26; v0.25.1Public repository source + captured forge publicationEarliest observed matching source predicate; not design inception, execution or efficacySource
native proof gateCommit metadata 2026-02-23T06:40:40-08:00; release 2026-02-23T14:57:40Zsrc/core/workunit.rs; literal predicates and blob in generated facts0537bf48b9eac9c71a4fe5558f9cf2f43c4b602d; v0.38.4Public repository source + captured forge publicationEarliest observed matching source predicate; not design inception, execution or efficacySource
The AGENTS.md study first appeared in February, with later revisionsPublication history verified 2026-11-17arXiv historyv1: 2026-02-12 14:15:22 UTC; v2: 2026-06-23; v3: 2026-09-29Independent publication recordStudies repository instruction files; does not evaluate DecapodarXiv:2602.11988
Accountable Agentic Execution's controlled studies remain prospectiveREADME inspected 2026-11-17Explicit pre-results status and synthetic-fixture warningREADME blob 168f0fa6e08e1cf65dd635fd77fabf33a918f99bPublic research statusMechanism implementation and synthetic records are not treatment-effect observationsResearch README

The generated facts supplement this matrix with separately identified later mechanisms. A claim of independent development can be made only to the extent its dated artifacts support it; this history alone does not establish November 2025 or general design priority. No private artifact is inferred from testimony.

Security and empirical limits

The global Constitution is a binary-embedded source corpus. Repository overrides specialize registered directives with explicit precedence; task context is a bounded projection. Advisory research and contributed software-business guidance do not acquire binding authority through repetition or retrieval rank. Source admission checks structural promotion; required PR review remains a separate authority boundary, and guidance is not automatically a machine-enforced gate.

Context poisoning includes rejected conversational premises resurfacing and lower-trust text pretending to be accepted policy. Repository-file redundancy is a different question studied by the AGENTS.md evaluation. Neither phenomenon alone proves a Decapod advantage or a particular transformer cache mechanism. Decapod cannot erase tokens already delivered to a third-party model, force an uncooperative host to invoke it, or intercept arbitrary unrestricted shell/forge actions. Source review and hashes cannot establish relevance, host consumption, semantic truth or successful execution on their own.

Implementation and empirical acceptance remain with #1772 (selection), #1774 (contribution admission), #657 (knowledge corrections), #880 (observed host delivery) and #1095 (independent outcomes and total cost). Historical provenance never substitutes for their tests or for controlled real-agent comparisons.

Overrides

Overrides are the primary mechanism for customizing Decapod's behavior for a specific project. They allow you to apply your team's unique engineering culture to the Decapod governance kernel (see Configuration).

The OVERRIDE.md Substrate

The .decapod/OVERRIDE.md file is a human-authored Markdown document where you can redefine specific constitution directives (see Decapod Constitution). Each generated directive subsection owns a four-backtick source block. Find the appropriate subsection and replace the visible instruction inside that block with Markdown or whatever documentation style best expresses the policy.

The outer fence prevents headings in the policy from rendering as structure in OVERRIDE.md. Decapod removes that wrapper and loads its contents as binding authority. Four backticks allow ordinary triple-backtick examples inside the body. A duplicate registered directive, an unclosed body fence, or an unknown ID in a Decapod namespace outside a body block is ambiguous and fails closed; Decapod never applies only part of an ambiguous override file.

Decapod derives the machine evidence. Resolved context reports the directive ID, .decapod/OVERRIDE.md source path, whole-file source hash, directive-body hash and byte count, and repository-project precedence. Users do not author those fields.

Example Override

If a registered testing directive defines a different coverage expectation than your repository has accepted, capture the reviewed variation explicitly:

### methodology/TESTING
````markdown
For this repository, we target a minimum of 80% line coverage. Critical paths in `src/decapod/core/` still require 100%.
````

When to use Overrides

  • Custom Style Guides: Mandate specific linting rules or naming conventions.
  • Tighter Security: Block agents from touching specific directories or files.
  • Workflow Adjustments: Add mandatory manual review steps for specific subsystems.
  • Platform Specifics: Define how Decapod should interact with your specific CI/CD pipeline.

Policy as Code

Because overrides are committed to the repository, they serve as "Policy as Code". They are versioned, auditable, and provide a clear, shared understanding of the rules for both humans and agents.

On upgrade, decapod init renders the current scaffold and moves each valid legacy body byte-for-byte inside its fenced source area. If an authored body already contains a four-backtick run, Decapod chooses a longer outer fence. Empty retired generated sections are ignored, while a non-empty retired or unknown Decapod directive fails visibly so policy is not discarded. decapod init and decapod validate reject ambiguous binding authority rather than applying only part of it.

Model Context Protocol (MCP)

Decapod provides a CLI, a Decapod-specific structured RPC interface (decapod rpc --op <op>, plus an optional authenticated loopback HTTP server via decapod rpc --http-server), and a bounded, daemonless local stdio MCP JSON-RPC 2.0 adapter (src/decapod/core/agent_interop/mcp.rs).

Shipped MCP adapter (decapod mcp)

  • decapod mcp serve [--one-shot] [--max-requests <N>] [--max-frame-bytes <N>] [--framing auto|jsonl|content-length] [--allow-mutations]: Serves a bounded local stdio MCP JSON-RPC 2.0 session and exits cleanly on EOF, --one-shot, --max-requests, or shutdown (INV-DAEMONLESS, zero lingering daemons).
  • decapod mcp schema [--format json|text]: Exports the deterministic tool and resource schema catalog (decapod-mcp-stdio).
  • decapod mcp config [--root <DIR>] [--executable <PATH>]: Emits a conflict-safe mcpServers.decapod JSON entry for host wiring.

Protocol, framing, and size bounds

  • Supported MCP protocolVersion values: 2025-03-26 and 2024-11-05. Any other requested revision is rejected fail-closed with JSON-RPC error -32602 listing the supported revisions.
  • Stdio framing: auto (default), jsonl, or content-length. Incoming request frames default to a 262144-byte (256 KiB) limit (DEFAULT_MAX_FRAME_BYTES) and responses default to a 131072-byte (128 KiB) cap (DEFAULT_MAX_RESPONSE_BYTES).
  • Lifecycle methods: initialize, notifications/initialized, notifications/cancelled, ping, shutdown, tools/list, tools/call, resources/list, and resources/read.

Bounded tools (6) and redacted resources (4)

SurfaceTypeAccess / Guard
decapod_interop_manifestToolRead-only; returns interoperability manifest (optional schema validation).
decapod_interop_negotiateToolRead-only; deterministic fail-closed capability negotiation.
decapod_rules_taxonomyToolRead-only; 8-domain coding-rule taxonomy and gap matrix.
decapod_overlap_classifyToolRead-only; 6-state semantic task-scope overlap classification.
decapod_envelope_verifyToolRead-only; evaluates external governance envelope v1 under local trust policy without importing authority.
decapod_governed_mutateToolDenied by default (read_only_session_denied). Opt-in --allow-mutations enforces an authenticated Decapod session (session_required), an isolated .decapod/workspaces/* worktree (worktree_isolation_required), registered RPC_OPS membership (unknown_op), and fail-closed cloud_backend_unavailable rejection on unsupported non-todo ops when [repo].backend = "cloud".
decapod://manifestResourceRedacted read-only application/json interoperability manifest.
decapod://constitution/core/DECAPODResourceRedacted read-only text/markdown excerpt of the core router contract.
decapod://rules/taxonomyResourceRedacted read-only application/json coding-rule taxonomy matrix.
decapod://harness/matrixResourceRedacted read-only application/json host compatibility matrix.

resources/read refuses path traversal (.., \), non-decapod:// URIs, hidden rubrics, secrets, .env, .db/SQLite stores, and token-bearing paths (resource_denied).

Important: The MCP adapter is a narrow transport adapter boundary over Decapod's local governance kernel. Discovering or calling MCP tools does not prove full code delivery, does not import remote authority, and does not waive decapod validate or repository custody gates.

Key interoperability distinctions

  • Local protocol conformance vs. real vendor-host activation: Passing local black-box stdio transcripts and schema tests (tests/agent_interop_conformance.rs, docs/conformance/observed-interop-receipts-v0.163.md) proves framing, redaction, and local gate parity only. Real vendor-host activation depends on each host's installed CLI/IDE runtime, protocol version negotiation, project trust prompt, and authentication state (tracked in #875 and #880).
  • Cooperative host hooks vs. independently enforced boundaries: Host lifecycle hooks (such as PreToolUse or harness plugins) are cooperative reminders that can be disabled, bypassed via direct shell/git commands, or fail open on hook errors. Independent enforcement lives in Decapod's kernel gates, isolated .decapod/workspaces/* worktrees, OS/container isolation, and Git/forge branch protection.
  • Bounded A2A adapter vs. hosted A2A task server: Decapod ships a bounded A2A Agent Card (decapod a2a card), fail-closed handoff validator (decapod a2a handoff), and opt-in authenticated loopback HTTP adapter (decapod a2a serve / decapod a2a send, bounded by --max-requests with imported_authority_granted: false). It does not run a persistent hosted A2A task server or import remote task authority.

Optional configuration example: Grok Build (grok 1.0.77)

Qualification & verification status: The commands below are a version-qualified configuration example verified offline against the grok 1.0.77 (50ca579fa996) CLI in a disposable repository with zero LLM API calls and zero secrets. A full live Grok Build agent-session host arm (under #875/#880) is not_run.

Setup, discovery, and opt-in project trust

Register Decapod in project scope (writes [mcp_servers.decapod] to .grok/config.toml without secrets or overwriting unrelated entries):

grok mcp add --scope project decapod -- decapod mcp serve
grok mcp list
grok mcp doctor decapod

Grok Build enforces opt-in project trust for repo-local MCP definitions in .grok/config.toml. Running grok mcp doctor decapod in an untrusted repository intentionally refuses to launch the project-scoped server (folder untrusted) until the operator explicitly trusts the folder (for example, grok --trust mcp doctor decapod).

Observed protocol revision boundary on grok 1.0.77: When invoked with grok --trust mcp doctor decapod --json against decapod mcp serve, grok 1.0.77 starts the stdio server and requests protocolVersion: "2025-11-25", which decapod mcp serve currently rejects fail-closed (-32602, supported: ["2025-03-26", "2024-11-05"]). Until protocol revision alignment ships or the host negotiates 2025-03-26, Decapod's conflict-safe harness package for Grok Build (decapod integration harness install --harness grok-build) wires .grok/decapod-rpc.json to decapod rpc --stdin instead.

Disable, enable, remove, and rollback

grok mcp disable decapod
grok mcp enable decapod
grok mcp remove --scope project decapod
  • grok mcp disable / enable toggles the server entry in ~/.grok/config.toml without deleting project files.
  • grok mcp remove --scope project decapod removes only [mcp_servers.decapod] from .grok/config.toml, preserving unrelated user configuration.
  • For clean rollback of .grok/config.toml, revert it via Git; for Decapod-managed .grok/decapod-rpc.json, run decapod integration harness rollback --harness grok-build (or decapod integration harness remove --harness grok-build). No secrets are stored in either file.

Hook enforcement warning for Grok Build

Grok Build's lifecycle hooks fail open on hook errors and run ahead of plan-mode gating. Because a failing or bypassed hook cannot stop an unapproved mutation, Grok Build hooks must be treated strictly as cooperative automation—never as the final security, custody, or publication barrier. Final authority always stays with Decapod's isolated worktree checks, decapod validate, and Git/forge branch protection.

Current local handshake

decapod session handshake --scope <scope> records local declarations, scope, proof declarations, document hashes, and a deterministic artifact hash. That hash provides tamper-evident integrity for the recorded handshake data; it does not authenticate a model provider, harness, binary, human principal, or organization.

The handshake's identity_assertions preserve identity claims separately from verification. An assertion carries its claim kind, subject type, value, evidence class, scope, lifecycle, authority/verifier slots, method, and result. Environment-provided agent and provider values are self-declared and unverified unless a configured trust root establishes stronger evidence.

The repository-local session credential establishes local custody and correlation for the current session. It is not external provider authentication. See BYOA & Interoperability for the live decapod.interop contract, and see the interoperability profile, capability negotiation, the native MCP adapter, the A2A adapter, the optional HTTP transport, and identity and provenance for the boundaries adapters must preserve.

Configuration Reference

Decapod project policy is defined in .decapod/config.toml. This file should be committed to source control and is the primary mechanism for humans to communicate global rules to agents.

The [init] Section

Governs the behavior of the decapod init command.

KeyTypeDefaultDescription
specsbooltrueIf true, scaffolds living documentation under .decapod/managed/specs/.
diagram_styleenum"ascii"Preferred style for generated architecture diagrams ("ascii" or "mermaid").
entrypointslist[...]The agent entrypoint files to maintain (e.g., AGENTS.md, CLAUDE.md).

The [repo] Section

Defines the operational policy and metadata for the repository.

KeyTypeDefaultDescription
product_namestringNoneThe canonical name of the software product.
product_summarystringNoneA high-level description of the product's purpose.
architecture_directionstringNoneThe intended architectural style (e.g., "monolithic", "event-driven").
product_typestringNoneCategorization (e.g., "cli", "library", "service").
done_criteriastringNoneThe global definition of "done" that all work must satisfy.
primary_languageslist[]The primary programming languages used in the repository.
detected_surfaceslist[]Entrypoints and interfaces detected in the repo (e.g., "cargo", "npm").
external_trackerboolfalseWhether Decapod should expect and validate external issue references.
container_workspacesbooltrueIf true, Decapod will strongly encourage/enforce Docker isolation for worktrees.
backendenum"local"Storage backend for the project todo path ("local" for Decapod Local, or "cloud" for Decapod Cloud). Decapod Cloud uses the binary-owned service endpoint and GitHub origin identity.

Cloud service details are intentionally not project configuration. Decapod owns the Decapod Cloud deployment defaults in the binary, derives repo_id from the GitHub origin, and keeps credentials machine-local. Explicit overrides use DECAPOD_CLOUD_API_URL (DECAPOD_PROPODUS_API_URL is a deprecated compatibility alias).

Schema Versioning

Decapod uses a schema_version key at the root to ensure forward and backward compatibility as the governance kernel evolves.

schema_version = "1.0.0"

[init]
specs = true
diagram_style = "mermaid"

[repo]
product_name = "decapod"
container_workspaces = true
done_criteria = "Validate passes and all unit tests are green."

Exceptional RBAC operations

The main repository's .decapod/config.toml owns exceptional permissions; candidate worktrees cannot grant them by editing their own config. Defaults deny all exceptional operations. Example:

[governance.rbac]
journal_repair_roles = ["maintainer"]
validation_bypass_roles = [] # set to ["maintainer"] only for reviewed exceptions

[governance.rbac.actor_roles]
operator = ["maintainer"]

Callers must assert an exact configured actor label using DECAPOD_AGENT_ID=operator. These are cooperative local role labels, not cryptographic authentication; the local developer trusts their own workspace, and a process that can edit the main configuration or assert another actor label remains inside the local trust boundary. Protect the config with human review and file-system access controls.

In Decapod Cloud mode, these local role labels never authorize remote operations. The cloud backend authenticates the session bearer and resolves repository roles using server-owned grants. Contributor, maintainer, owner, and expiring contractor delegation are backend policy, not self-selected agent names. Decapod Local operation is free, works offline, and does not require a cloud account.

decapod todo journal checkpoint --accept-historical-gap TASK_A --accept-historical-gap TASK_B --reason "reviewed historical range" requires todo.journal.repair permission. The entire batch, each bounded acceptance event and its subsequent transition checkpoints commit together. Non-selected historical gaps and unrelated divergences still block recovery.

Plain decapod validate always runs required validation. Only an explicitly granted validate.bypass permission allows decapod validate --bypass-validation --bypass-reason "reviewed exception". This writes an audit event and returns status=bypassed with proof_ready=false and publication_ready=false. It does not create a passing validation receipt, satisfy qa verify, bypass CI, or authorize publication. The publisher and proof verifier still require real evidence.

Laya post-proof readiness

[laya] mode = "disabled" is the default; Laya inference runs only after deterministic validation when the repo sets mode = "required" with the reviewed model_manifest_digest and local installation. A candidate cannot disable an accepted required policy. No Laya installation or inference is required for disabled mode. Per-run assessment receipt identifiers are excluded from verification replay hashes; receipt decisions, material, configuration and governance bindings remain significant.

CLI Reference

Decapod provides a unified CLI that supports both human-friendly text output and machine-readable JSON.

Command Aliases

Decapod provides short aliases for common subcommands:

  • v -> validate
  • i -> init
  • t -> todo
  • w -> workspace
  • g -> govern
  • s -> session
  • d -> docs

Core Operations

validate (alias: v)

Perform methodology compliance checks.

  • --store <repo|user>: The task store to validate.
  • --format <text|json>: Output formatting.
  • --verbose: Enable detailed per-gate timing.

init (alias: i)

Bootstrap or manage the Decapod lifecycle.

  • --backend local|cloud: Select the logical backend: local (Decapod Local, default, free and offline) or cloud (Decapod Cloud, account required). Cloud starts or resumes managed sign-in through Dactyl and reports pending/account-action/denied outcomes as non-success. Setup readiness requires current server authorization.
  • --restart-cloud-signin: Explicitly start a new flow after an interrupted one-time exchange or rejected credential; use with --backend cloud.
  • --proof: Prepare configuration without cloud sign-in or a readiness claim.
  • with: Apply explicit options (non-interactive).
  • clean: Remove all Decapod state from the directory.
  • --refresh: Re-open the interactive initialization questionnaire for an existing project, preserving current values as defaults and keeping the refresh non-destructive. In non-interactive environments it preserves the current configuration without prompting.

integration

Preview, reversibly remove, or restore Decapod's repository integration without deleting project state:

decapod integration preview [--dir <path>] [--format text|json]
decapod integration remove --authorize [--dir <path>] [--format text|json]
decapod integration restore [--dir <path>] [--manifest <path>] [--format text|json]
  • preview: Read-only inspection that performs zero filesystem, Git, SQLite, session, or network mutations and reports generated, edited, authored, unknown, and active resources separately.
  • remove: Requires explicit --authorize. Removes only positively owned, unchanged generated integration (entrypoints, hooks installed by Decapod, .gitignore rules, untouched scaffolds) while preserving edited/shared/unknown entries, authored instructions/overrides/specs, .decapod/data/, .decapod/governance.json, *.bak backups, global config, and credentials. Refuses uncertain ownership, symlink replacement, and active-custody conflicts. Records .decapod/integration-restore-manifest.json atomically before removal. Permanent state deletion (--purge-state) and protected governance removal (--remove-protected-governance) remain separate explicit authority boundaries.
  • restore: Losslessly restores removed generated files and .gitignore rules from .decapod/integration-restore-manifest.json while refusing to overwrite symlinks or conflicting newly authored files.

capabilities

Discover the features supported by the current Decapod binary.

mcp

Bounded local stdio MCP JSON-RPC 2.0 adapter and schema/config exporter (see Model Context Protocol (MCP)):

  • decapod mcp serve [--one-shot] [--max-requests <N>] [--max-frame-bytes <N>] [--framing auto|jsonl|content-length] [--allow-mutations]: Run the daemonless stdio MCP adapter (2025-03-26, 2024-11-05; read-only by default; --allow-mutations still enforces active session and .decapod/workspaces/* custody).
  • decapod mcp schema [--format json|text]: Export the deterministic 6-tool / 4-resource catalog.
  • decapod mcp config [--root <DIR>] [--executable <PATH>]: Generate a conflict-safe host MCP server configuration entry.

a2a

Bounded A2A Agent Card, fail-closed handoff validator, and opt-in authenticated loopback HTTP adapter (not a hosted A2A task server; see BYOA & Interoperability):

  • decapod a2a card [--format json|text]: Emit the Agent Card advertising only executable local governance skills.
  • decapod a2a handoff (--input <FILE> | --json <JSON>): Validate a bounded task/handoff envelope against local repository ground truth (imported_authority_granted: false).
  • decapod a2a serve / decapod a2a send: Opt-in authenticated loopback HTTP handoff exchange bounded by --max-requests (INV-DAEMONLESS).

cloud

Optional Decapod Cloud credential and project operations. These commands do not enable cloud storage or change the Decapod Local (local) SQLite default.

  • cloud login: the agent starts or resumes the repository's saved sign-in flow and checks current repository access. The human runs init once.
  • cloud login --restart: the agent explicitly starts a fresh sign-in after an expired, revoked, or uncertain exchange, preserving the interrupted task and its operation ID. An uncertain exchange is never replayed.
  • cloud status: inspect private phase, credential presence, and expiry without network I/O or printing a token. server_readiness remains not_checked. See Decapod Cloud sign-in and task access for live confirmation.

Local database maintenance

These commands apply only to the canonical local .decapod/data/decapod.db store and are explicit operator workflows:

decapod data db verify
decapod data db backup --destination <unused-database-path>
decapod data db recover --preserve-original-at <unused-sibling-archive-path>

verify is read-only and reports Dactyl v0.10.0 integrity metadata. backup uses Dactyl's online SQLite backup, so a WAL source is captured without copying live -wal/-shm files into the destination. recover performs the verified logical dump/reload only when explicitly requested; it preserves the original, atomically publishes the replacement, rolls back on failure when possible, and reports rollback failure distinctly. Recovery returns DELETE journal mode while retaining application data and relevant SQLite metadata.

Do not run recovery while writers or same-process Dactyl connections are open. The Decapod sidecar lock bounds contention between cooperating Decapod processes, but it cannot coordinate arbitrary external SQLite writers or unreliable filesystems/mounted storage. No command repairs a store automatically, including startup, validation, event append, or connection creation. JSON diagnostics distinguish healthy, unavailable, locked, corrupt, unsupported, recovery_failed, and recovery_rollback_failed; inspect failure_code for Dactyl's precise code.


Workspace Management (alias: w)

workspace ensure

Create or enter an isolated task worktree.

  • --branch <name>: Provide a custom branch name.
  • --container: Wrap the workspace in a Docker container.

workspace status

Display active workspaces, their owners, and their current state.

workspace publish

Prepare and bundle changes from an isolated workspace for promotion (PR/merge). The promotion push is fast-forward-only. Decapod never force-pushes a governed workspace branch. A non-fast-forward rejection is a blocker: reconcile the remote divergence, rerun validation, and retry publication rather than rewriting shared history.


Task Tracking (alias: t)

todo list

List tasks from the backlog.

  • --status <open|claimed|done|archived>: Filter by state.
  • --category <name>: Filter by task category.

todo claim

Lock a task for active implementation.

  • --id <task-id>: The specific ULID of the task.
  • --mode <exclusive|shared>: Set the locking mode.

todo done

Complete a work unit and generate proof artifacts.

  • --id <task-id>: The task to close.
  • --validated: Capture a cryptographic proof baseline of the changes.

Governance & Subsystems (alias: g)

govern policy

Classification and approval for high-risk actions.

govern health

Claims, proofs, and system-wide integrity status.

govern artifacts

Manage the single .decapod/governance.json document through logical sections: Populate in dependency order: stable PR identity, intent/scope plan, current claims and planned checks, work/evidence trajectory, validation, then staged-material checkpoints. Record meaningful boundaries throughout the work, not only at completion.

  • migrate: losslessly import legacy split files; reads never migrate implicitly.
  • begin-pr --id <change> --base-branch <branch>: start an explicit PR boundary after verifying discarded evidence is recoverable from Git.
  • claim --id <id> --statement <text> --falsifier <text> --status <status>: record a current-PR claim; status is open, supported, refuted, or blocked. Repeat --proof-ref <ref> for evidence; support requires proof.
  • resolve-obligation --id <id> --resolution <text> --proof-ref <ref>: explicitly retire a carried obligation with one or more proof references.
  • checkpoint --id <unique-id> --summary <text> [--proof-ref <ref>]: bind staged authored material and logical governance inputs. Stage the updated governance document afterward and commit both.
  • status: read current normalized state without creating runtime state.
  • verify-checkpoints --base-branch <ref> [--head-ref HEAD]: read-only verification of exact-material checkpoints across the full commit graph.
  • reconcile-merge: reconcile a Git-merged .decapod/governance.json journal from immutable commit ancestry (HEAD, MERGE_HEAD, merge-base --all) without turning failed or missing proof into a passing result.
  • inventory [--base-branch <branch>]: inspect logical sections, semantic currency, and PR participation. --repair initializes absent empty claims; --claims-note <text> records a current-PR checkpoint; --compact preserves legacy semantics while normalizing storage. Existing evidence is not overwritten.

Research claims are separate from Health Engine claims in .decapod/data/decapod.db.

govern capsule query

Perform a deterministic query over the embedded constitution.

  • --topic <name>: The subject of inquiry.
  • --scope <scope>: The context boundary (e.g., "interfaces").

setup laya

Explicitly install/verify the pinned external cache and register private native runtime pins. Supports --cache-directory, --runtime, --cpu-runtime, --offline and --check-updates. See the assessment contract.

Decapod Cloud sign-in and task access

Select repo.backend = "local" for Decapod Local (the default: free, offline local SQLite and Git governance with no account required) or repo.backend = "cloud" for Decapod Cloud (hosted team task coordination and repository-bound custody; see Cloud project routing). The boundary is agent → Decapod → Dactyl → Decapod Cloud service. Decapod owns the system interface, repository binding, and private session custody. Dactyl owns public discovery, the physical connector, sign-in and session transport, and subsequent data requests. The service decides who may access a repository; initial workspace setup happens in Cloud Signup, and subscriptions, repository enrollment, seat assignments, teammate access policies, and billing are managed in Organization Admin.

Project configuration needs only the logical choice:

[repo]
backend = "cloud"

No deployment URL, physical driver, copied token, price, membership roster, or role assignment belongs in this configuration. Local mode works without cloud credentials or cloud discovery.

Human setup and headless continuation

From a repository with a GitHub origin, run:

decapod init --backend cloud

The same flow is used after manually changing the backend to cloud. A normal cloud task command or decapod session acquire starts or resumes the same repository-bound session. An existing unexpired session is reused; a session near expiry is refreshed while holding its private lock.

If sign-in is needed, Decapod prints a validated, one-time browser handoff and returns a non-success onboarding_pending result with authorization_url. The agent shares that link and runs decapod cloud login every two seconds for up to five minutes. It resumes the task as soon as sign-in completes, without waiting for another user message. If still pending, it preserves the saved flow. The human runs init once per repository and completes browser actions; later CLI operations belong to the agent. Each invocation polls at most once.

The URL and a successful browser redirect are not initialization success. Decapod accepts the issued session, asks the service to complete the account handoff, and performs an authenticated, read-only repository task lookup. Only a successful authorized read produces the setup-ready message. It proves current read access; the service independently authorizes every later write, claim, completion, or privileged operation.

The current service reports an unresolved account entitlement as action_required. The client does not guess whether payment or seat assignment will resolve it, and it does not invent an account-action URL. An explicit access denial is repository_denied. Both remain non-success outcomes. When a session has already been issued, a retry can recheck account completion with that same session without consuming another sign-in code.

decapod cloud status inspects private local state without network requests or printing a token. Its phase is a custody state; server_readiness is not_checked, even when the saved phase is ready. Use initialization or a normal cloud command or agent-owned decapod cloud login to obtain a current server decision.

decapod init --backend cloud --proof prepares configuration only. It does not authenticate, create a synthetic credential, or claim server readiness.

Recovery and private custody

Pending sign-in state and credentials are stored outside Git, under the machine data directory. Each record is bound to the selected service origin, the GitHub repository, and the canonical main checkout. Linked worktrees of that checkout share custody; separate clones do not. A different origin or repository cannot reuse the record.

Directories and files must have private ownership and permissions (0700 and 0600 on Unix). The store rejects symlink and hard-link credential files, oversized or malformed records, binding mismatches, and storage located in a Git checkout. A stable, separate lock serializes updates and refresh. Atomic replacement synchronizes the file and parent directory before continuing.

Decapod saves an in-flight marker before a one-time bootstrap exchange, session exchange, or refresh. It saves each received code or rotated session before making the next request. A later process can resume safe status polls and account-completion checks. If a one-time response was lost, or the process stopped before saving it, the outcome is explicitly uncertain. Decapod does not replay that request or treat an old refresh token as reusable.

For an uncertain exchange, expired handoff, or rejected managed credential, the agent follows the reported recovery instruction:

decapod cloud login --restart

This explicitly clears the selected private flow and starts a new sign-in. It does not clear another repository's custody. A known rejected bearer is marked unusable; a late rejection of an old bearer cannot invalidate a newer rotation saved by another command.

Access tokens, refresh tokens, PKCE verifiers, polling secrets, and exchanged codes never enter project configuration, Git artifacts, diagnostic messages, or process arguments. The browser handoff is intentionally shown to the human; treat it as a short-lived sign-in link. Dactyl sends credentials only through the selected validated transport and refuses cross-origin redirects.

Cloud task boundary

Cloud todo list, add, get, show, claim, release, and done use the same TodoStore interface as local commands. The active cloud factory obtains the current managed session and passes its opaque bearer and versioned repository context to Dactyl's logical connector. It does not choose a hosting provider or physical database. It does not initialize or fall back to SQLite when discovery, authentication, authorization, or a data request fails.

Dactyl carries the service's native query and batch protocol. Decapod supplies reviewed task SQL and ordered atomic operations; the service must enforce repository scope, conditional transitions, event consistency, and transaction rollback. The startup read uses the existing authorized task-get statement, not a health endpoint or an unauthenticated SELECT 1 shortcut.

todo done --validated remains unsupported because the current cloud task contract does not provide remote proof capture and verified completion. This client change does not establish full remote governance parity.

For a data mutation with a lost response, use the operation identity described in Resuming cloud todo creation. Session recovery does not replay a task mutation. A retry identity is not an authorization grant.

Identity and service-owned authority

Decapod derives the requested owner/name from the GitHub origin. Forks remain distinct repositories. A project-configured identifier, email address, mutable SCM username, or agent label cannot grant access. The response must match the requested repository before it is accepted.

The hosted service resolves the managed principal, linked identity, grants, membership, entitlement, and effective privilege. It also decides whether an account action is still pending. The client neither implements a price table nor infers authority from payment or seat assignment.

DECAPOD_AGENT_ID identifies the operational caller for coordination. Copying another agent's label cannot transfer authenticated cloud custody. Exceptional maintainer or owner actions require their separate service authorization and audit trail. Publication and merge retain their independent governance gates.

Implementation and evidence boundaries

The active orchestration is core::cloud_client; core::cloud_session owns private custody. DactylBridge resolves the managed route through dactyl_db::CloudConnector. Historical explicit adapters and legacy client types remain compatibility APIs, not the ordinary cloud setup path. Ambient legacy endpoint (DECAPOD_CLOUD_API_URL / deprecated DECAPOD_PROPODUS_API_URL), physical-selector, and access-token variables do not select or authenticate the managed CLI flow.

tests/cloud_managed_session.rs exercises the actual CLI against disposable loopback HTTP fixtures: missing and reused sessions, headless continuation, serialized refresh, interrupted exchanges, account requirements and denial, binding isolation, redaction, and absence of SQLite fallback. Custody unit tests exercise private files, locks, phase shapes, and crash recovery. Existing task command, wire, idempotency, and explicit adapter tests retain their narrower contracts.

These fixtures establish client behavior only. They are not real PostgreSQL, RLS, hosted policy, or production readiness evidence. Those separate gates remain in #1377, #1378, and #1369. See Supabase consumer validation for protected service profiles and their explicit evidence requirements.

Connector-enabled builds pin the published dactyl-db 0.16.1 registry API, including the patched quinn-proto >= 0.11.19 floor tracked by Decapod #1638. The SDK requires Rust 1.85; Decapod retains its existing Rust 1.96.1 toolchain. HTTP/3 remains disabled. Its registry version, checksum and locked protocol floor are checked by the release dependency policy. Required dependency, compilation and fixture checks still have to pass on the exact candidate; a release alone does not establish client readiness. The dependency handoff remains tracked in #1380. No Git/path override or source-overlay diagnostic substitutes for those gates.

Local SQLite maintenance

Local operators retain explicit integrity, backup, and recovery commands:

decapod data db verify
decapod data db backup --destination /approved-backup/decapod.backup.db
decapod data db recover --preserve-original-at /same-directory/decapod.before-recovery.db

Dactyl owns physical integrity checks, online backup, and logical recovery. Decapod owns the canonical file, coordination lock, authorization, and approved destination. Recovery preserves the original and publishes a verified replacement only after quiescing cooperating writers. These commands require the local backend. Cloud sign-in never performs local database maintenance.

Choose a managed cloud project

A Git checkout and a managed cloud project have different identifiers. Signing in establishes the managed session; the service still decides which project the account may use. When the originating Git repository resolves unambiguously to a single Cloud project, Decapod automatically reconciles and routes it after decapod cloud login, so manual project selection is not required. Decapod stores any explicit override routing reference privately alongside its repository-scoped session, outside Git. Local mode continues to work independently.

When overriding or disambiguating across multiple projects after signing in with decapod init --backend cloud, an agent or a human can inspect available projects:

decapod cloud projects

Choose an exact project name, or a numbered entry from that saved directory:

decapod cloud project use "Team repository"
decapod cloud project use 1

Numbers refer to the exact directory previously shown for this managed account. A later directory reorder does not silently select a different project. Duplicate names require a numbered choice. The service rechecks the selected project; a selection cannot manufacture membership, assignment or data access.

For a new project, explicitly create it:

decapod cloud project create "New repository"

Creation uses the existing authenticated account API. It does not purchase access or elevate resource permissions. The command saves its request identity before sending the mutation. If a response is lost, rerun the same command and name to reconcile that request. A changed name conflicts while the outcome is unknown. A received creation result remains saved, so an immediate retry does not create another project. Do not restart with a different request to guess whether the earlier write committed.

A project may be selected while access is pending. Resolve that requirement in Organization Admin (repository enrollment, seat assignments, teammate access policies, and organization administration), or coordinate with your project administrator. Then retry initialization or the original command. The next operation checks current account/project eligibility and uses the native authenticated data route. A cached selection, browser return or valid bearer does not prove current access.

Project commands remain reachable before data eligibility. They display names and status; JSON output is available with --format json. Credentials, request custody and routing metadata stay in private machine storage. Repository configuration contains no bearer, refresh credential or authoritative project grant.

Reauthentication as a different managed account requires an explicit new selection. Revocation or denial stops the next authorization boundary and cannot silently select another project or SQLite. A transaction already executing retains its server-defined transaction boundary.

Existing explicitly supported canonical-repository native routes continue to work when no managed selection is recorded. Discovery and authentication still travel through Dactyl. Each command constructs its data connection after refresh, so the next request carries the current bearer.

Offline CLI fixtures establish routing and recovery behavior. Disposable PostgreSQL/PostgREST, released artifacts and protected hosted sign-in remain separate evidence; none is inferred from a local fixture or successful selection.

Cloud task retry receipts use a versioned private cache so older clients cannot rewrite away a selected-project binding. Upgrade an older client when it refuses the cache; keep the receipts for reconciliation. Legacy records migrate under the existing lock, and unsupported future versions or oversized upgrades preserve the original file. Deleting a receipt is not evidence that a timed-out write rolled back. Local storage remains independent of this cloud-only cache.

Resuming cloud todo creation

Cloud todo add assigns a distinct operation token before authentication. A fresh invocation means new work, even when its title and other inputs are identical to an earlier task. Never issue a fresh add to retry an uncertain operation.

When onboarding is pending or a response is lost, retain operation_id from the JSON diagnostic. After fixing the reported prerequisite, repeat the original arguments and add --operation-id TOKEN, for example:

decapod todo add "Implement a feature" --priority high --operation-id TOKEN --format json

TOKEN is the exact value returned by that operation, not a title, task ID, or credential. Repeat all original options. A restarted agent may resume the request; the original creation event keeps its original audit actor. The client refuses a token for changed arguments, repository, or service endpoint before contacting the service. To change an unsubmitted request, intentionally start a new operation; do not mutate the identity of the old one. Recovery text does not interpolate task text into a shell command.

After an interrupted process, decapod todo operations --format json lists the machine's retained receipt metadata. Match the original operation and replay its original arguments with its token. This inspection never opens the repository's local task database. It is metadata inspection, not authentication or a task store: task descriptions and other request contents are not retained there.

Outcomes

  • blocked_before_submit: this attempt did not dispatch the mutation. Its failure category distinguishes authentication, onboarding pending, authorization, offline, transport, conflict, cancellation, and validation
  • outcome_unknown: a dispatched mutation may have committed, or an interrupted attempt has not been reconciled. Never interpret it as rollback
  • succeeded: the client observed the mutation result or an exact immutable creation receipt through the authorized service boundary

attempt_status records whether this individual attempt dispatched. Once an operation is uncertain, a blocked retry cannot downgrade its overall status; only an exact authorized receipt can establish success.

The failure JSON schema is decapod.cloud.todo-operation.v1. It contains only operation identity, status, failure category, retryability, and a next action. Task data, bearer tokens, refresh tokens, endpoints, and arbitrary service error messages are excluded. Authentication/authorization failures remain distinct; a retry token never provides repository access. The service continues to own authenticated principal identity and authorization; Decapod neither parses unverified bearer claims nor treats a local successful receipt as access.

Duplicate protection and receipts

The existing Dactyl atomic batch inserts the task, its creation event, and reads the task. A resumed operation reuses its task ID and deterministic event ID. The creation event binds an immutable request fingerprint. Retries inspect that event through the same authenticated Dactyl query boundary; subsequent changes to a task's title, status, or assignee do not invalidate its creation receipt. An ID collision or a changed request cannot overwrite an existing task. A concurrent loser or lost acknowledgement can reconcile the winner's exact receipt. Authentication or authorization errors are never bypassed by a second reconciliation request.

Unknown outcomes stay unknown if the confirming read is unavailable. The client never substitutes local SQLite, generates a new identity for a retry, or infers rollback from an HTTP error. A successful local receipt still requires normal authentication and authorized remote reconciliation when explicitly retried.

Local metadata and retention

Non-secret receipt metadata lives under the machine configuration directory in decapod/todo-operations. It stores token, fingerprint, task ID, outcome, failure category, and update time. It contains no task payload or credentials, and has no repository-local fallback. Private creation permissions, bounded exclusive locking, and atomic replacement protect concurrent writers.

The journal is limited to 256 records and 1 MiB. Successful receipts older than seven days are removed when preparing new work; the oldest successful receipt may also be removed at capacity because the durable service event remains the authority. Unresolved records are never silently evicted. When all slots are unresolved, new operations fail before submission and ask for reconciliation. An existing operation can still be retried at capacity.

Proof boundary

Local SQLite adapter tests prove the client uses a task-plus-event atomic transaction, handles transaction failure without partial state, and reconciles an immutable creation event after task changes. Synthetic public Dactyl HTTP fixtures exercise response loss, interrupted reconciliation, and denied receipt reads. These are client/adapter proofs, not deployed service authorization or hosted transaction-isolation proofs. Hosted parity and service atomicity remain separate downstream acceptance work (#1377 and #1378).

Supabase consumer validation

Ordinary project users select only repo.backend = "local" | "cloud" (Decapod Local or Decapod Cloud). The managed cloud flow goes through Dactyl public discovery, sign-in, account completion, and native data transport. Setup does not require a deployment URL, physical driver selector, copied credential, or project-level provider configuration. See Decapod Cloud sign-in and task access for the human flow, headless continuation, private custody, and explicit recovery.

Package and implementation prerequisites

The client consumes the public connector/session API in the published dactyl-db 0.16.1 registry release. The release-policy test pins that exact version and its verified registry checksum and audits every locked quinn-proto entry against the patched 0.11.19 floor, including inactive entries. SDK Rust 1.85 is below Decapod's unchanged Rust 1.96.1 requirement; HTTP/3 is not enabled. Required dependency, compilation and product checks still have to pass on the exact candidate. No governed source-overlay recipe is configured for integration diagnostics before those checks pass; no such diagnostic result is claimed. The release handoff is tracked by #1380. Do not replace a missing registry artifact with a committed Git/path override or remove the release dependency checks.

The 0.16 adoption is tracked in #1667. It includes the SDK's enforced resource budgets introduced in 0.15. Oversized SQL, parameter/result cells, row sets or wire responses return bounded errors rather than granting unbounded execution. Decapod retains the SDK defaults and its existing managed connector/session interfaces; this dependency update does not activate new hosted authority or permit uncertain mutations to be replayed.

Standard builds enable supabase-cloud; a build without that capability fails closed when the managed cloud backend is selected. Local SQLite remains independent. The logical cloud factory delegates its physical route to Dactyl. Historical Neon and Supabase adapters remain explicit library and conformance surfaces. Their legacy environment configuration does not select the ordinary managed CLI route or supply its credentials.

The managed CLI fixture origin is available only with explicit DECAPOD_TEST_MODE=1 and DECAPOD_CLOUD_TEST_ORIGIN set to a literal-loopback HTTP origin. It is a disposable test seam, never project policy or a hosted operator configuration channel. Tests isolate HOME and both XDG directories; synthetic credentials are written through the private custody API.

Proof ownership

tests/cloud_managed_session.rs drives the actual binary through discovery, bootstrap, exchanges, refresh, account completion, and an authorized task read. It covers resumable headless invocation, exact binding, serialization, lost responses, explicit denial, unresolved entitlement, and secret redaction. Cloud command failures cannot initialize SQLite; unsupported repository datastore commands fail before local startup. File-only control surfaces and local-backend behavior remain separate.

The service owns schema, grants, membership, payment/seat readiness, and authorization. Dactyl carries validated transport; Decapod carries the target repository and opaque current bearer. A printed handoff, issued credential, health response, or payment alone does not establish repository access. Initialization checks service completion and an existing authenticated, read-only task statement. Every later data request is authorized again.

The legacy production-command profiles below are currently unavailable with the managed CLI. Explicitly selecting them fails with MANAGED_CLI_FIXTURE_UNAVAILABLE before fixture reads, CLI execution or network access; their endpoint/token environment variables cannot select the managed origin or establish private custody. The retained fixtures, commands and assertions describe the real-service acceptance contract that a separately reviewed managed fixture must restore, not a runnable or completed proof. The legacy explicit PropodusClient test in propodus_live still targets its declared endpoint and does not establish managed CLI behavior. Native RPC and managed-account hosted acceptance remain independent requirements; loopback fixtures and the expected preflight failure do not satisfy them.

Ownership and permissions

Git continues to hold governance plans, claims, trajectory, validation, specs, and proof artifacts. Supported shared operational tasks and matching events use the configured backend. There is no SQLite-file upload or synchronization.

The authenticated service resolves the principal, organization, group/team membership, repository identity and effective permission. Client-supplied scope is a request target, never a grant. Decapod exercises public allowed and denied outcomes instead of copying the service's authorization rules.

The conformance profile covers the reviewed todo task/event schema. It does not establish arbitrary Decapod catalog or schema portability. A compatible service implements the current reviewed task SQL and ordered three-operation batches: task mutation, matching event, final task read. It must commit both state and event or neither. It must gate event insertion on the preceding mutation affecting one row; a matching timestamp by itself is insufficient. Concurrent claims have one winner. Stale or missing transitions return a conflict/zero count and cannot append success events. A response lost after commit is ambiguous: observe task state before deciding whether to retry. This client contract does not add or claim mutation idempotency.

Separate evidence profiles

  • Default SQLite/Neon regression and cloud boundary tests need no hosted credentials. Local HTTP fixtures establish client composition and error handling only. They are not PostgreSQL, RLS, or hosted Supabase evidence.
  • cloud_supabase_boundary with supabase-cloud checks actual CLI dispatch, bearer/context placement, normalized rows, safe failure diagnostics, no local fallback, and no credential forwarding across redirects. Actual CLI add/claim/release/done requests must use one ordered task-write, event-write, task-read batch with the same explicit ID and timestamp. Zero or non-singleton task/event counts must fail even when the response contains a task row. Get/show check keyed reads and explicit missing results. These scripted HTTP responses prove client composition only, never service atomicity or policy.
  • supabase_service::local_postgres_service_contract is ignored by default. An external service harness must start actual PostgreSQL, apply a fresh schema, provision authenticated principals and grants, create a protected fixture, run the test, verify its receipt against the real event ledger, then deterministically destroy only its disposable database/roles.
  • supabase_service::protected_hosted_supabase_service_contract is separately ignored. Run it only in an operator-approved protected environment with DECAPOD_SUPABASE_HOSTED_PROOF=1, HTTPS and disposable/namespaced data. The external fixture owner must guarantee cleanup on failure as well as success. No hosted endpoint, credential, or completed hosted result ships with this branch.

Invoke the local service test with:

DECAPOD_SUPABASE_FIXTURE=/protected/temporary/fixture.json \
  cargo test --locked --features supabase-cloud --test supabase_service \
  local_postgres_service_contract -- --ignored --nocapture

The hosted command uses the other test name and hosted opt-in. Missing inputs cause an explicit failure when an ignored test is selected; an unselected ignored test is unavailable evidence, not a pass. A fixture declaration does not prove its backend: the harness's actual PostgreSQL observations and cleanup result must accompany the client receipt.

Protected fixture contract

The fixture file is created outside Git with restrictive permissions. Do not print it, attach it to CI artifacts, or include it in logs. Its schema is:

{
  "profile": "local-postgres",
  "endpoint": "http://127.0.0.1:PORT",
  "repository": "fixture-owner/disposable-repo",
  "allowed_tokens": ["FIRST_USER_SESSION", "SECOND_USER_SESSION"],
  "denials": [
    {
      "case": "cross_org",
      "token": "DENIED_USER_SESSION",
      "repository": "fixture-owner/disposable-repo",
      "expected_error": "repository_not_authorized"
    }
  ],
  "disposable": true,
  "receipt_path": "/protected/temporary/client-receipt.json"
}

Required denial cases are cross_org, wrong_group, wrong_team, unauthorized_user, insufficient_access, revoked_access, and expired_session. Each must be provisioned by the service's public permission contract. Insufficient-access fixtures may read but must deny add/claim/release/done; other cases must also deny list/get/show. expected_error is a safe public error category. The two allowed tokens must belong to independently authenticated users with access to the same fresh repository slice, not two copies of one bearer.

The client proof creates one task, checks shared list/get/show and missing rows, races two CLI claim processes, rejects a stale claim, releases/reclaims and completes. Missing-task transitions and non-owner release/completion must fail. Repeated transitions after completion must fail, and a subsequent read by the other principal must still match the completed row. Denials must reveal no task data and must leave task state and event counts unchanged. Its non-secret receipt declares expected version 5 and exactly these events: task.add, task.claim, task.release, task.claim, task.done. The service harness verifies the ledger and adds separate deliberate-failure rollback, equal-timestamp stale-CAS, type/count, fresh-schema and permission proof. Those are service-side assertions, not conclusions inferred from a successful client response.

PostgreSQL and Supavisor Connection Modes (#1378, #1369)

Decapod Cloud clients talk exclusively to Propodus HTTP Edge/PostgREST endpoints (CloudConnector / dactyl-db) over HTTPS or literal loopback and never embed direct PostgreSQL credentials or open psql/TCP database sockets from the CLI. Backend schema migrations, RLS policy enforcement, and PostgREST pool execution on Supabase/PostgreSQL 17 span three distinct connection topologies:

Connection ModeTypical Endpoint / PortSession & Prepared StatementsRLS / GUC Lifetime & Decapod Contract
Direct connectiondb.<project-ref>.supabase.co:5432Dedicated PG backend session; prepared statements and session-level SET persist across transactions.Used only by privileged schema owner/DDL migration runners (Propodus Migrate, ProvisionAuthBridge) and TestPostgresNativeManagedProjectConsumer admin fixtures, never by Decapod CLI clients.
Supavisor session pooleraws-0-<region>.pooler.supabase.com:5432Session-pinned backend; preserves session GUCs (set_config(..., false)) and prepared statements until client disconnect.Compatible with migrations and long-lived server tools when IPv4 egress is required; not required by Decapod CLI HTTP transport.
Supavisor transaction pooleraws-0-<region>.pooler.supabase.com:6543Backend returned to pool after each transaction (COMMIT/ROLLBACK); session-level SET, LISTEN, advisory locks across statements, and server-side prepared statements are invalid across pooled transactions.PostgREST / Edge runtime requires simple-query / disabled prepared statements (PGRST_DB_PREPARED_STATEMENTS=false) and transaction-local GUCs (SELECT set_config(..., true) cleared on COMMIT, verified against PostgreSQL 17.11) so tenant/user RLS claims cannot leak across pooled clients.

Hosted vs. Local Disposable Verification Boundary

  • local_postgres_service_contract and protected_hosted_supabase_service_contract in tests/supabase_service.rs remain #[ignore] and fail closed with MANAGED_CLI_FIXTURE_UNAVAILABLE via require_managed_cli_fixture() because legacy ambient-token fixtures cannot bind DPoP/device-gateway custody.
  • Any hosted Supabase check must remain read-only on free/customer projects ($0/mo, zero BYPASSRLS, zero billing or customer org mutation) unless an isolated disposable project fixture is explicitly provisioned and torn down by its external owner.
  • local_native_managed_project_contract and local_native_managed_project_revocation verify real DECAPOD_NATIVE_PROJECT_FIXTURE client/project selection, task/event CAS, and member revocation end-to-end against a disposable local PostgreSQL 17
    • PostgREST (PGRST_DB_PREPARED_STATEMENTS=false) service boundary.

Gatekeeper source context

Gatekeeper checks path policy, protected paths, diff size, credential patterns, and dangerous source patterns. Context may discharge one exact matched source span only when the supported parser establishes the relevant meaning. Other matches on the same line remain independent.

Explicit scan inputs

Repeat --paths for each file:

decapod govern gatekeeper check --paths src/decapod/lib.rs --paths src/decapod/core/dactyl_todo.rs

Comma-separated arguments are not expanded. Missing, non-text, or unreadable explicit files and explicit directories fail rather than reporting a successful empty scan. Without --paths, staged paths come from Git's NUL-delimited output. A Git failure is an error. Deleted paths and both sides of renames still participate in protected-path checks even when there are no remaining bytes to scan.

Literal Rust include_str! dependencies are followed, including calls nested within macro input. General include! expansion and include_bytes! interpretation are outside this recognizer. Included files retain credential and path-policy checks. Included text with an unknown suffix still receives conservative raw dangerous-pattern checks. Missing, dynamic, unreadable, out-of-repository, or excessively large dependency graphs cannot establish a successful scan. Moving source into an included file is not an exemption.

Supported evidence

  • Explicit bearer-scheme syntax remains distinct from ordinary credential prose. Short or word-like credentials in explicit syntax remain findings
  • Rust password formatting uses exact literal spans and proven runtime provenance. Supported immutable environment bindings and a narrowly checked random-byte generator can carry evidence through supported local tuple, option, branch, and match flow. A helper name alone proves nothing
  • Positional SQL parameters require a verified terminal database operation. Constructing an operation object alone is insufficient because its SQL can escape. Supported local wrappers are resolved through the actual Cargo module graph and must forward directly to the external connection contract
  • Native shell context distinguishes quoted parameter expansion from executable substitutions and unsafe constructs. Dockerfile context keeps instruction substitution separate from shell execution in RUN
  • Fully qualified standard primitive string comparisons consume their input as text. They do not make other literals, credentials, or shell operations on that source line safe
  • Explicit Rust shell or unresolved interpreter construction produces an independent review finding, including multiline, alias, and included-input forms. A filename's native grammar cannot discharge that execution boundary

These are bounded recognizers, not Rust macro expansion, a compiler, complete shell interpretation, or dependency-supply-chain verification. Ambiguous bindings, namespace shadows, unsupported attributes, mutation, unknown escaping values, unresolved module evidence, and unsupported syntax retain findings. SQL evidence assumes genuine external database and async-trait implementations; local path/package substitution and manifest patches cannot supply that evidence. Cargo configuration, environment overrides, downloaded code, and toolchains are not authenticated by this source recognizer. Native data-command recognition likewise assumes standard command implementations and runtime shell behavior; it does not authenticate PATH or executable contents. Source-defined overrides and known executable options remain part of the adversarial test boundary. Arbitrary custom-runner semantics and whole-program reinterpretation of included text are outside these bounded recognizers. Visible standard-library manifest substitution or an invalid manifest prevents Rust password-context exemptions; standalone source without a manifest retains the documented standard-library assumption.

Findings that intentionally remain

Literal credentials remain detectable in source, documentation, tests, and synthetic fixtures. Contextual exemptions do not rely on filenames, comments, placeholder words, credential length, or test labels. Broader legacy pattern recognizers retain their documented shape limits. The tests retain short quoted and explicit-assignment passwords, alongside the old literal setup instruction, as positive controls. Typed Rust let, const, and static password/passwd/pwd declarations are scanned across whitespace and newlines, including short literal values. The additive textual matcher supports ref/ref mut bindings and simple array/slice annotations with literal or named lengths. It stops at statement semicolons, braces, or an earlier equals sign; nested arrays and arbitrary length expressions are outside this bounded recognizer. It is not a complete Rust type parser. Detection does not require successful parsing. Runtime provenance can discharge only its exact initializer span, so a nearby literal remains a finding. These bounded recognizers do not supply universal secret detection.

Actual shell command substitutions remain executable-shell findings even when quoted. For example, a fixed script that queries process identity still contains a command invocation; recognizing its quoted variables does not certify every command in the script. Dynamic shell execution, unknown command provenance, and dangerous operations remain subject to review.

The session setup instruction now identifies the generated password rather than telling callers to use the separately displayed session token. This is an instruction correction; it does not add a placeholder exception.

Verification boundary

Paired tests cover each supported safe form and nearby adversarial changes: literal fallbacks, mutation and shadowing, operation-string escapes, altered wrapper implementations, custom macros and methods, shell function overrides, missing includes, and mixed safe/unsafe lines. Extracted native templates have byte-equivalence and rendered-output regressions against their original representations, and remain part of the Cargo package.

Scanner implementation tests do not waive publication policy or establish container custody. Run the official validator separately and preserve actual passed, failed, ignored, and unavailable evidence. A new scanner must not act as its own authority for publication approval.

Governance Artifact Inventory

.decapod/governance.json is the sole tracked governance authority. It holds a compact baseline, current-PR identity and claims, cumulative checkpoints, explicit unresolved obligations, and normalized logical sections:

SectionWriterPurpose
Plandecapod govern planRefined intent, scope, phases, decisions, and proof hooks
Claimsdecapod govern artifacts claimCurrent-PR falsifiable claims; support requires proof
Trajectorydecapod govern trajectoryIntent custody, scope, actions, assumptions, checks, and evidence
Validationdecapod validateReceipt bound to current repository inputs and trajectory

The same tracked document also has a canonical top-level intents map. It preserves recorded raw_intent separately from its agent-authored refined_intent, with custody events and trajectory identifiers. A change of recorded origin under an existing intent ID is rejected; an actual new instruction needs separate provenance and an auditable transition. These records are recoverable from Git, which verifies authored history without authenticating the human speaker. The state.resolve projection reads original and derived intent separately.

The plan/trajectory/validation surfaces all consume the same unresolved instruction conditions: ambiguity, unknowns, contradictions, and pending spec-review decisions. Plan acceptance cannot silently clear them. The gate taxonomy already distinguishes authority, phase, severity and verdict. See closed-loop governance.

Health Engine claims remain in .decapod/data/decapod.db, and runtime workunit manifests in .decapod/data/workunits/. Neither is a second tracked research ledger. See the governed execution model.

Explicit PR lifecycle and publication invariant

Use decapod govern artifacts migrate to import valid legacy split files losslessly. Read operations never write. Conflicting or malformed authority fails closed instead of being silently repaired. begin-pr --id <change> --base-branch <branch> starts the explicit boundary only when discarded state is recoverable from Git. Accepted completed claims stay in Git history; explicit unresolved obligations carry forward. Resolve an obligation with resolve-obligation --id <id> --resolution <text> --proof-ref <evidence>.

Before each authored commit, finish the relevant plan, trajectory, claim, spec, and validation work; stage authored files; record a unique checkpoint; then stage the governance document and commit:

git add <authored-paths>
decapod govern artifacts checkpoint --id <unique-id> --summary "What changed and was checked" --proof-ref <evidence>
git add .decapod/governance.json
git commit -m "Describe the governed change"

Checkpoints are cumulative within the current PR. Publication and CI verify exact immutable material at every authored commit, including merges, and reject erased or rewritten checkpoints. A valid file only at the PR tip is insufficient. Pre-adoption legacy history is not retroactively represented as verified proof. Historical observation sections remain readable and are preserved when a new trajectory starts. They do not supply current readiness or require credentials.

Rewritten branch pushes and stale CI events

A GitHub push event binds both the old and new commit IDs. If a later force-push replaces that history and the old commit is no longer present in a fresh checkout, the immutable event-context verifier must reject the run (Git cat-file verification failed). That historical run remains failed: rerunning it cannot establish the missing Git objects or replace its event identity with the branch's current tip.

A pull-request checkpoint job also binds the event's accepted base. If its target ref resolves to a different commit when the job runs, publication material verification fails with PUBLICATION_MATERIAL_BASE_CHANGED and reports both revisions. The earlier checkpoint history is still evidence for its original commit range. Current admission needs a fresh event and proof against the current accepted base.

For an existing pull request, preserve the current accepted branch history, make a substantive follow-up change in its claimed Decapod worktree, record a new checkpoint, and push a fast-forward commit. Inspect the resulting push run and the pull-request checks against the same new immutable SHA. Do not erase the old failure, substitute a mutable branch ref for the event's old SHA, or treat a green PR workflow as proof that the earlier push passed.

Population order and write boundaries

Use the existing commands in dependency order:

  1. Begin one stable PR identity with govern artifacts begin-pr.
  2. Populate intent, todo binding, and scope with govern plan init or update.
  3. Record actual current-PR claims with falsifiers and planned checks/proof hooks; do not create placeholder claims or claim support before evidence exists.
  4. Perform the work and record its inspected/modified paths, checks, evidence, and unresolved assumptions with govern trajectory init and record.
  5. Run decapod validate against the current completed batch.
  6. Stage material, record a unique checkpoint, stage governance.json, and commit.

Persist meaningful intent, scope, evidence, and commit boundaries throughout the work instead of reconstructing them only at the end. Combine related updates at one boundary, and skip repeated unchanged content. A new claim or changed scope returns to the affected earlier step; it does not restart the PR identity.

Release pin flywheel

Master entrypoint/Dockerfile/manifest pins record the Decapod version that generated that master tip. A cargo-only release-plz merge does not rewrite pins. There is no Release Artifact Sync workflow and no post-release heal PR.

Flywheel:

  1. Master is generated by Decapod vN (pins say vN).
  2. User/agent PRs with installed vN merge.
  3. A new release vN+1 is cut from master (Cargo/CHANGELOG only).
  4. Users install vN+1. Master pins remain vN until a user/agent PR runs validate with vN+1 and commits healed entrypoints, Dockerfile pin, and specs manifest (first PR for the new installed binary must refresh all of them).

Inventory and repair

decapod govern artifacts inventory --base-branch master
decapod govern artifacts inventory --repair

Repair initializes absent empty claims and preserves existing evidence. Inventory reports each logical section's schema and semantic currency; it does not invent claims or replace plan, trajectory, or validation work.

inventory --claims-note "..." records a current-PR checkpoint without inventing a research claim. inventory --compact performs lossless legacy normalization. When a Git merge (MERGE_HEAD present) leaves .decapod/governance.json with a merge conflict or Trajectory artifact hash mismatch, run decapod govern artifacts reconcile-merge before committing the merge; it reconciles from immutable commit ancestry (HEAD, MERGE_HEAD, merge-base --all), rejects conflicting unaccepted PR authority or check-status contradictions, and preserves failed or missing proof verbatim. Successful validation writes the logical validation section without a self-referential hash cycle. Do not use DECAPOD_VALIDATE_SKIP_GIT_GATES as an agent publication shortcut. Stage and checkpoint the final material before committing.

An external tracker such as GitHub Issues, Jira, Linear, or Beads may remain the organizational system of record. Decapod's todo and claim state governs the accepted work at the repository execution layer.

Current-contract review and remote publication proof

When a PR changes implementation surfaces, workspace publish requires explicit reviews of the current INTERFACES, ARCHITECTURE, and SECURITY contracts. This is agent-authored review evidence, not automated proof that prose is semantically correct. An accurate unchanged spec does not need a cosmetic rewrite:

decapod govern plan review-spec \
  --path .decapod/managed/specs/INTERFACES.md \
  --disposition unchanged-with-reason \
  --reason "Inspected the changed command: existing response and error contracts remain accurate"

Repeat for ARCHITECTURE and SECURITY with findings specific to each review. Use updated for a material authored correction, or requires-decision when human judgment is needed. The command computes the spec's material hash and the current code fingerprint; callers cannot supply their own hashes. Later code or authored spec changes invalidate the review. Fingerprint refresh alone is not a review.

Ordinary review-spec cannot silently approve an unchanged pending decision. After receiving an explicit human answer, record that answer deliberately:

decapod govern plan resolve-spec-review \
  --path .decapod/managed/specs/INTERFACES.md \
  --decision-ref "review thread and human answer reference" \
  --reason "The human accepted the documented contract and its stated tradeoff"

This uses the same declared-approval authority as govern plan approve; the reference preserves provenance and is not cryptographic human authentication. APPROVED means that the caller advanced the governed execution-contract state; it does not certify the agent correctly interpreted the human request, establish independent human identity, or substitute for any separately required approval. The original question remains in the review record. A decision about stale code or stale spec content is rejected. Never invent a decision reference or infer approval. Existing 1.0 plans remain readable; recording reviews writes plan 1.1.

Inference orientation exposes governed_plan.instruction_readiness for the current plan. Each recorded blocker names its source in the plan and the report gives the supported correction. Draft planning can retain open items. Approval, execution checkpoints, validation, and publication require them to be resolved. After a correction, approve the revised plan and rerun affected proof. Starting a new plan preserves a pending spec decision.

After review, refresh supported projections and run validation. The validation epoch binds the plan (including review evidence), claims, authored and generated spec content, entrypoints, and managed Dockerfile. It excludes the logical validation section itself so committing a receipt does not create a self-referential commit loop. Plan and trajectory must name the same current todo. Required logical sections must be valid, and the normalized document must match committed bytes and participate in the PR diff. Checkpoints bind every authored commit to its exact material.

Publication pushes the captured commit to the captured push URL, reads the exact remote head and base back, fetches those immutable objects, and checks their base-to-head diff. GitHub publication reuses an existing matching open PR or creates a draft, verifies repository/head/base/SHA and the complete paginated PR file list, and checks for head/base movement during readback. It does not infer success from git push or gh pr create exit status alone.

remote_verified and pr_verified are separate result fields. Non-GitHub branch publication can succeed with an explicit warning that PR proof is unavailable. Missing GitHub CLI/authentication, PR creation errors, wrong targets, truncated file lists, or remote races are hard failures. PUBLICATION_INCOMPLETE means the branch was already pushed but the PR must not be reported ready. Fix the stated condition and retry workspace publish; retries reuse matching PRs and never force-push or delete the published branch. Transport diagnostics are not echoed because they may contain credentials.

Fresh work branches

workspace ensure initializes the branch-local document from the embedded, versioned template after creating an isolated branch from the selected accepted base. Its draft plan and initial trajectory describe the current claimed task, including captured intent and scope. agent.init and validation share this initializer for manually created fresh worktree branches. They do not rewrite main/master or treat initialization as successful validation.

A stable change ID survives repeated calls, process restarts, branch renames, and rebases. New-branch evidence must agree with Git's accepted base and the inherited document must be recoverable in Git. Dirty, malformed, missing-task, and ambiguous accepted context is preserved with an actionable error. Old accepted claims, checkpoints, and receipts stay in Git history; policy and explicit unresolved obligations carry forward. Read-only status and inventory never initialize.

Container workspace paths

Container workspaces share .decapod/data and .decapod/managed/migrations with the host for coordination databases, leases, and datastore locks. The clone retains branch-local tracked governance, accepted project configuration and overrides, living specs, sessions, and awareness. Initialization happens before launch against the exact prepared base, and startup preserves that branch. An older whole-.decapod bind mount or symlink is rejected with GOVERNANCE_WORKSPACE_ALIAS; recreate the workspace with the supported layout before writing governance.

Host-root runtime lookups alias the branch's managed directory, with only managed/migrations overlaid from the shared host ledger. This preserves atomic ledger updates and prevents historical migrations from rerunning, while version counters and tracked specs remain branch-local. Existing host config and overrides are available read-only for shared-datastore policy decisions; branch files remain the input to source and document validation.

Error Handling

Decapod uses Rust's Result<T, DecapodError> contract internally. Commands return errors to the process boundary, where Decapod prints a human-readable message on stderr and exits unsuccessfully. The error variant is useful for the message and recovery guidance; it does not currently select a distinct process exit status.

Governance feedback and corrective execution

Decapod's errors carry two responsibilities. They report a failed operation or unsatisfied requirement to the caller, and, where supported, describe what the agent must address before attempting the next governed transition. An agent uses this feedback to revise implementation, evidence, or scope and then retries.

This is part of the closed-loop metacognitive execution model. A useful governed failure identifies the applicable constraint and, where supported, a corrective operation. The agent must apply the correction to its work and revalidate applicable proof obligations against the exact candidate. The correction may remain relevant after an agent swap because the source records persist. The convergence model distinguishes feedback from the independent validation boundary.

Not every CLI error is a stable machine-readable payload. The CLI prints descriptive errors on stderr; structured command surfaces should be used when integrations need fields rather than prose. A nonzero status never constitutes acceptance.

Process Exit Status

StatusMeaningDescription
0SuccessThe operation completed successfully.
1Decapod operation failureA domain, validation, configuration, session, I/O, or storage error was returned. decapod validate also uses status 1 when a gate fails.
2CLI syntax failureClap rejected an unknown command, argument, or option before Decapod ran the operation.
127Shell command not foundThis is normally emitted by the calling shell when decapod or another command is absent; Decapod does not use 127 for its Rust errors.

Do not infer a unique status from DecapodError::Config, NotFound, or SessionError: all of those domain errors currently use status 1. Scripts that need to distinguish failures should inspect the command output or use a structured command surface rather than depend on the error text as a stable API.

Idiomatic Rust Error Handling

Functions that can fail return Result and use ? to propagate errors. Use map_err when a lower-level error needs to be translated into Decapod's domain error type or given application context:

fn load_config(path: &Path) -> Result<Config, DecapodError> {
    let text = std::fs::read_to_string(path)?;
    toml::from_str(&text).map_err(|error| DecapodError::Config(error.to_string()))
}

fn run(path: &Path) -> Result<(), DecapodError> {
    let config = load_config(path)?;
    validate_config(&config)
        .map_err(|message| DecapodError::ValidationError(message))?;
    Ok(())
}

The ? operator preserves the original error when a From conversion exists (for example, std::io::Error becomes DecapodError::IoError). map_err is appropriate when the caller needs a different domain variant or additional context. Avoid unwrap and expect for user input, files, environment variables, or external commands; reserve them for proven invariants and test fixtures.

At the CLI boundary, src/main.rs matches the result from decapod::run(), prints the error with its Display implementation, and exits with status 1. That keeps error propagation explicit without exposing Rust's debug-style enum representation to command-line users.

Error Variants and Recovery

DecapodError currently contains these variants:

  • StorageError: inspect the Dactyl route, host-runtime availability, schema, and lock state.
  • IoError: check the referenced path, permissions, and external process.
  • DatabaseInitializationError: inspect repository initialization and schema setup.
  • PathError: correct the repository, workspace, or artifact path.
  • EnvVarError: check the required environment variable and its encoding.
  • ValidationError: follow the reported gate and remediation command.
  • NotFound: verify the requested task, workspace, document, or artifact ID/path.
  • NotImplemented: use a supported command or defer the operation.
  • Config: correct .decapod/config.toml or the relevant environment setting.
  • ContextPackError: inspect the context pack and its integrity metadata.
  • SessionError: run decapod session acquire, then retry the operation.

Local Dactyl SQLite prerequisite

LOCAL_SQLITE_RUNTIME_REQUIRED is a targeted agent remediation, not a repository corruption report. It means the project selected backend=local and Dactyl could not load a host SQLite shared library. Install the operating system SQLite runtime or set DACTYL_SQLITE_LIBRARY once in the current shell to an absolute library path. Decapod persists a discovered path in the user-level ~/.config/decapod/runtime.toml, so the setting is reused across projects on that machine; cloud-backed commands do not require this runtime.

The wrapped SQLite, I/O, and environment errors remain available through the standard std::error::Error::source chain, so callers can log the underlying cause without parsing the display string.

Local database maintenance diagnostics

data db verify, backup, and recover emit JSON before returning a failure. The diagnostic_status field is the stable operator classification:

  • healthy: Dactyl completed the requested operation and its verification.
  • unavailable: the SQLite runtime or storage is unavailable.
  • locked: bounded coordination or SQLite lock contention prevented progress.
  • corrupt: Dactyl found a malformed database or failed integrity verification; failure_code distinguishes details such as malformed_database and corrupt_database.
  • unsupported: the selected Dactyl capability or access mode is unsupported.
  • recovery_failed: recovery failed after it was explicitly requested.
  • recovery_rollback_failed: recovery and rollback both failed and require human review.

automatic_repair is always false. A failed diagnostic does not trigger REINDEX, dump/reload, replacement, or any other repair. Recovery is an operator-only command and requires writer quiescence; Dactyl owns WAL/SHM handling, atomic replacement, rollback, and DELETE journal-mode activation.

Artifacts

Decapod governs authored state and produces generated evidence and projections. Those classes are not interchangeable.

These artifacts are the inspectable surface of .decapod/ as the repo-native substrate for governed agent work. They preserve the state that should survive beyond a chat transcript: intent, architecture assumptions, selected context, validation output, and proof provenance.

Authored and managed state

The files under .decapod/managed/ include agent-authored project contracts and Decapod-managed state. They are not all generated.

specs/

Living documentation of the project's intent and design. The acting agent authors and maintains this prose; Decapod requires and validates it.

  • INTENT.md: What the project is trying to achieve.
  • ARCHITECTURE.md: High-level design and diagrams.
  • INTERFACES.md: Defined APIs and boundaries.

Generated evidence and projections

Decapod generates supported context capsules, attestations, manifests, receipts, and proof artifacts from governed inputs. A generated projection is a consumable view, not an independent authority that can replace its source.

Evidence and provenance records

  • provenance/: Manifests and checklists for promotion.
  • custody/: Detailed evidence logs and contradiction records.
  • diagnostics/: Optional logs for troubleshooting.

Context capsules

Deterministic, generated projections used by agents to orient themselves. Their provenance identifies the authority from which they were resolved.

AGENTS.md, CLAUDE.md, etc.

Root-level entrypoints for AI agents. These files point agents to the Decapod kernel and provide their starting instructions.

See Governance Artifact Inventory for state ownership and lifecycle details.

Contributing to Decapod

Decapod is a governed agent control plane. Contributions are accepted when they increase enforcement value with minimal surface area.

Non-Negotiable PR Rules

Every PR MUST include:

  • Intent: What invariant or behavior is being changed.
  • Invariants affected: An explicit list of impacted invariants.
  • Proof added: A test, gate, or command that enforces the change.

Local Dev & Tooling

Decapod uses Bazel (coordinated via Bazelisk) as its primary build and test system.

# Build the decapod binary
bazelisk build //:decapod

# Run all tests
bazelisk test //:core_tests

# Initialize and validate decapod locally
bazel run //:decapod -- init --proof
bazel run //:decapod -- validate

Nix Development Shell

If you are using Nix, you can enter a fully reproducible development shell containing all the required tooling by running:

nix develop

You can also build Decapod using Nix:

nix build

Before You Open a PR

Before submitting your PR, ensure that Decapod's governance gates and CI expectations are satisfied:

  • Work in an isolated worktree via decapod workspace ensure after claiming a todo. Do not work directly on master.
  • Run decapod validate and ensure it passes successfully.
  • Managed spec projections (.decapod/managed/specs/*) are written only inside that claimed worktree. workspace status does not refresh them on the protected root. Include the refreshed specs in the same PR as the code change (GitHub #1255).

GitHub Workflow Permissions

[!IMPORTANT] GitHub Workflow Permissions (workflow scope)

If you are contributing changes that trigger GitHub Actions workflows or edit files under .github/workflows/, your Personal Access Token (PAT) must have the workflow scope.

To verify if your token has the appropriate permission level, run the following API call:

curl -I -H "Authorization: Bearer YOUR_GITHUB_TOKEN" https://api.github.com/user

Inspect the X-OAuth-Scopes header in the response. It must contain the workflow scope (for example: X-OAuth-Scopes: repo, workflow).