Decapod is the local-first metacognitive governance kernel for AI coding agents: orient intent, reflect at decisions, isolate worktrees, and prove commits.
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.
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.
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.
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).
Expresses engineering intent, supplies judgment at decision gates, and approves meaningful outcomes.
Coding Agent
Interprets the prompt and codebase, performs edits and tests, authors living specs, and invokes Decapod at decision, workspace, and validation boundaries.
Decapod Kernel
Exposes deterministic CLI and structured RPC operations for custody, orientation, bounded reflection, policy checks, validation, and publication gates.
Repository
Preserves .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.
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:
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>).
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.
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.
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.
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.
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).
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.
# 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.
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).
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:
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):
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.
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:
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.
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.
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.
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.
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:
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).
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 ...).
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.
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.
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.
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.
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).
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.
Decapod is configured via .decapod/config.toml (see the Config Specification Reference). This file is human-editable and should be committed to your repository.
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.
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.
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.
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).
When engineering tradeoffs or doctrine apply, the agent queries the embedded Constitution (decapod constitution get core/DECAPOD).
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"
Exact-Commit Validation & Failure Recovery:
decapod validate
Publication & Completion: Only after required gates pass for the exact candidate commit:
decapod workspace publish
decapod todo done --id <task-id> --validated
An engineer starts a bugfix in Cursor or Codex, then switches to Claude Code or Antigravity to finish and validate it:
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/*.
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>.
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.
When decapod validate fails on a candidate commit:
Do not claim completion or bypass gates: Validation exits nonzero and prints typed error codes and recovery guidance (see Proof & Validation and Error Handling).
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.
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.
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.
Decapod coordinates parallel work through explicit custody and isolated filesystems:
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>.
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).
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).
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>
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.
Suppose Engineer A (using Claude Code) works on authentication (src/auth/) and Engineer B (using Codex) works on CLI formatting (src/cli/):
Both agents run decapod session acquire with distinct DECAPOD_AGENT_ID values, check decapod todo fleet, and claim separate tasks with disjoint scopes.
Each agent calls decapod workspace ensure to obtain its own worktree and branch. Uncommitted edits, build caches, and test runs never collide on disk.
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.
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.
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).
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.
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.
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.
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).
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.
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).
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.
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.
Decapod structures agent work into an explicit, resumable decision-time lifecycle:
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).
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).
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.
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.
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).
Publication & Completion: Passing gates permit decapod workspace publish and decapod todo done --id <id> --validated (see Artifacts Reference).
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.
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.
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.
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).
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 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.
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.
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.
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.
Boundary
What Decapod examines
Consequence
Preparation
Recorded intent, unanswered questions, contradictions, accepted plan, applicable rules
Unresolved instructions cannot approve the plan; provenance is retained
Implementation
Scope, custody, worktree, task/phase status, required evidence, recorded trajectory
Invalid Decapod transitions are refused with corrective feedback
Validation
Applicable constitutional and project rules, test/build/security checks where configured, artifact provenance, current proof, stale or missing evidence
All required gates contribute to the actual verdict; passing tests alone are insufficient
Publication
Exact candidate and accepted target, current governance document, required receipts, policy and remote admission
Stale 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.
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.
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:
Durability: Request, custody, trajectory, rules, and evidence survive outside the model context in established canonical storage.
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.
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.
Accepted implementation, reproducible negative and positive checks, and evidence bound to the actual candidate
Partial
Working mechanism with a named unverified seam, missing external observation, or bounded coverage
Target
A 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.
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.
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.
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.
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).
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.
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).
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.
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:
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.
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.
Adapter discovery never proves delivery: Listing or calling MCP tools or inspecting an A2A Agent Card never substitutes for exact-candidate decapod validate proof.
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.
Suppose one engineer starts a change in Codex, stops midway, and continues in Claude Code or Cursor on the same repository:
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>).
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.
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.
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.
Agents often dive into implementation before fully understanding the human operator's goal. Decapod prevents this by mandating a spec-first approach:
Capture: Vague requests are converted into explicit tasks via decapod todo add (see CLI Reference).
Formalize: Agents are required to update or verify the specs/INTENT.md document scaffolded in the repository (see Artifacts Reference).
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" 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.
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.
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.
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.
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.
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.
Branch Isolation: Every task is performed on a dedicated git branch, preventing accidental mutations to main.
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.
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.
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.
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.
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.
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.
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.
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:
inspect the validation result;
identify the violated invariant;
perform the sanctioned remediation;
update the relevant artifact;
re-run validation; and
continue toward publication.
Decapod does not assume every failure is recoverable. Decision gates, contradictions, unsupported remediation, and unavailable proof remain blockers for human review.
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.
Answers to common questions about operationalized AI metacognition, living specs, validation gates, enforcement boundaries, and Decapod Local vs Cloud.
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.
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.
They record an agent interpretation, not an independent truth invented by Decapod. Validation makes a misunderstanding visible before publication so it can be corrected.
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.
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.
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.
Plans, claims, trajectories, validation receipts, and related evidence must remain available to reviewers, CI, and later agents after the original process ends.
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.
Agents invoke it when governance is needed. No background process is required because the repository, not process memory, is the durable execution surface.
Each CLI or RPC call is ephemeral. The task continues through durable repository state until validation, publication, and proof requirements are satisfied.
Failure means a required condition is still unsatisfied. The agent should follow the supported remediation, update the affected artifact, revalidate, and continue toward publication.
An orchestrator schedules or coordinates execution. Decapod defines and enforces repository-native governance boundaries; it does not replace the harness that runs the agent.
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.
The agent preserves accepted intent, stays within explicit boundaries, maintains durable state, responds to validation, remediates supported failures, and produces evidence before completion.
It establishes that required checks ran against identified repository state, produced the required evidence, and permitted the governed completion or publication transition.
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.
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.
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.
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.
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.
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:
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.
The Constitution has a global baseline, with local policy layered separately:
Shared Constitution. The versioned embedded corpus supplies engineering doctrine, reference material, decision context, and directives with explicit authority and binding classifications.
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.
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.
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.
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.
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.
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.
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 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 .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.
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%.
````
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.
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).
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).
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.
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.
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.
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.
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.
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.
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.
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 global definition of "done" that all work must satisfy.
primary_languages
list
[]
The primary programming languages used in the repository.
detected_surfaces
list
[]
Entrypoints and interfaces detected in the repo (e.g., "cargo", "npm").
external_tracker
bool
false
Whether Decapod should expect and validate external issue references.
container_workspaces
bool
true
If true, Decapod will strongly encourage/enforce Docker isolation for worktrees.
backend
enum
"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).
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] 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.
--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.
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.
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).
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).
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.
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.
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.
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.
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.
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.
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.
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 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.
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.
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 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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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:
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.
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 Mode
Typical Endpoint / Port
Session & Prepared Statements
RLS / GUC Lifetime & Decapod Contract
Direct connection
db.<project-ref>.supabase.co:5432
Dedicated 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 pooler
aws-0-<region>.pooler.supabase.com:5432
Session-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 pooler
aws-0-<region>.pooler.supabase.com:6543
Backend 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.
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 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.
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.
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.
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.
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.
.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:
Section
Writer
Purpose
Plan
decapod govern plan
Refined intent, scope, phases, decisions, and proof hooks
Claims
decapod govern artifacts claim
Current-PR falsifiable claims; support requires proof
Trajectory
decapod govern trajectory
Intent custody, scope, actions, assumptions, checks, and evidence
Validation
decapod validate
Receipt 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.
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.
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.
Begin one stable PR identity with govern artifacts begin-pr.
Populate intent, todo binding, and scope with govern plan init or update.
Record actual current-PR claims with falsifiers and planned checks/proof hooks;
do not create placeholder claims or claim support before evidence exists.
Perform the work and record its inspected/modified paths, checks, evidence,
and unresolved assumptions with govern trajectory init and record.
Run decapod validate against the current completed batch.
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.
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:
Master is generated by Decapod vN (pins say vN).
User/agent PRs with installed vN merge.
A new release vN+1 is cut from master (Cargo/CHANGELOG only).
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).
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.
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.
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 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.
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.
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.
A domain, validation, configuration, session, I/O, or storage error was returned. decapod validate also uses status 1 when a gate fails.
2
CLI syntax failure
Clap rejected an unknown command, argument, or option before Decapod ran the operation.
127
Shell command not found
This 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.
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.
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.
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.
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.
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.
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
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).
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: