Contract as a Code (CAAC)

Write software contracts as explicit clauses and cases. Prove your coding agent kept them with revision-bound execution evidence, four-gate acceptance, and bounded admission.

BATCH-006

Current Pass

Continue after error

The batch reports a zero divisor, then returns 4 for the next pair, 9 ÷ 2.

Clauses
19
Current pass
1
Unverified
18

caac map rendered examples/batch-division.md with a recorded test run and an example acceptance manifest. The report captures revision 41592ee.

Inspect the recorded run and gate →

Core guarantees

One-byte stale detection

caac evidence

Change one byte of the captured contract, code, or test. The next evidence check marks the receipt stale and blocks use of the old pass. Replay tests with zero-trust environment isolation and use a negative control to catch tests that still pass after a declared change.

Four independent gates

caac gate check

The report checks syntax and binding, semantic review by someone other than the author, current execution evidence, and owner acceptance separately.

Bounded admission and runner

caac admit exec

The runner checks owner-approved paths and scope. It records admission under a journal lock before launching a trusted command. A child failure or signal records uncertain and blocks a retry until reconciliation.

Visual feature map and local MCP

caac map

Render one contract to offline HTML, Markdown, or JSON. caac mcp exposes four read-only tools to coding agents.

  • caac_lint
  • caac_evidence_check
  • caac_gate_check
  • caac_admit_check

Contract workflow

  1. Draft (XS–XL)
  2. Lint
  3. Evidence
  4. Gate
  5. Admit
  6. Map & MCP

Create a draft and view a map

Run these commands from the repository root. init creates a starter contract. map renders the batch example with unverified clauses.

Run and check a case

Shell
cargo run --locked -- lint examples/batch-division.md
output=$(mktemp -d)
cargo run --locked -- init "$output/payment-contract" --title "Payment retry"
cargo run --locked -- map --contract examples/batch-division.md \
  --format html --output "$output/batch-map.html"
printf '%s\n' "$output/batch-map.html"