Built-in Profile: code๐
The embedded code profile (crates/acdd-state/src/profile/embedded/code.yaml) is the full software engineering lifecycle built into the acdd binary. It inherits base (git.isolation: worktree, save: commit, limits) and defines architect, builder, and independent_reviewer roles alongside abstract build_check and verify_all command slots.
How ClaimResp assembles agent context๐
When a worker calls acdd_claim / acdd claim <node_cursor>, ACDD builds a 6-tier budgeted ClaimResp envelope (default soft ceiling 32 KiB) and renders it as structured Markdown:
| Tier | Field | Contents |
|---|---|---|
| 1 (Mandatory) | contract, guidance | Task/milestone spec excerpt, admitted scope, acceptance_criteria, and all resolved guidance blocks (fails with GuidanceBudgetExceeded if Tier 1 exceeds max_guidance_bytes). |
| 2 (Rework) | unresolved_findings | Latest rejection findings and failed_trace_log_tail (up to diagnostic_inline_bytes, 4,096 bytes) when returning after fail or rearchitect. |
| 3 (Architect Slice) | pre_task_slice | Per-task blueprint slice materialized during blueprint_synthesis (canonical_owners, mechanism_rules, max_net_loc, verification_seam, incoming_seams, outgoing_seams). |
| 4 (Dependencies) | dependency_receipts | Completed receipts from upstream dependency tasks (need:). |
| 5 (Coordination) | blackboard | Recent notes, blockers, and decisions posted on acdd_blackboard (up to 15 items ร 500 chars). |
| 6 (Domain Lenses) | context_lenses | Dynamic docs.* and code.* context lenses declared on the gate's context: list, in YAML declaration order. |
What the agent receives at each gate๐
blueprint_synthesis.synthesize(architect) โ receivesmilestone.synthesisguidance,docs.instructions,docs.adrs,docs.invariants, andblackboarddecisions; outputsproof: blueprintwith per-task slices.blueprint_synthesis.review(independent_reviewer,independent_from: [synthesize]) โ audits the blueprint acrossclaims,architecture,project_isolation,administration; lockssave.immutable: true.tasks.<id>.build(builder) โ receivespre_task_slice,unresolved_findings+failed_trace_log_tail(on rework),dependency_receipts,docs.*lenses, pluscode.symbols,code.tests, andcode.external_callers. Must passbuild_check,code.seam, andcode.lint.tasks.<id>.review(independent_reviewer,independent_from: [build]) โ audits all 6 contours (paths,claims,architecture,concurrency,project_isolation,administration) with fulldocs.*andcode.*lenses. Routes localized defects tobuild(fail) or systemic drift torearchitect(fail_drift).tasks.<id>.deliver(independent_reviewer,need: [build, review]) โ verifiescandidate_treeOID parity and creates the atomicAcdd-Claimcommit + durable receipt.tasks.<id>.rearchitect(architect,max_attempts: 3) โ triggered onarchitectural_drift(context_reset_required: true), receivesdocs.*andcode.symbolsto realign the design.run_tests&polishโrun_testsexecutesverify_all+code.lint([arch, syntax, docs]); failures route topolish(builder, scoped to docs/skills/profiles/configs).integration_review&handoffโ independent audit of the full integrated run branch (independent_from: [polish, tasks.build]), followed byhandoff(post: commit,archive: true,prune: true).
Real Markdown delivered to an agent (T1.build example)๐
# Gate Claim: `T1.build`
- Run: `PAY-014`
- Claim Revision: `2`
- Contract Revision: `1`
- Worker: `builder-1`
- Worktree: `/repo/.worktrees/PAY-014-T1`
- Candidate Tree: `4e9a1c72...`
- Inspect: `acdd show T1.build --run PAY-014`
## Contract
- **Gate**: `tasks.build`
- **Proof**: `command`
- **Command**: `build_check`
- **Task**: `T1`
- **Target**: Enforce atomic deduplication inside `WebhookProcessor::handle`
- **Scope**: `src/billing/webhook.rs`, `src/storage/ledger.rs`, `tests/billing_test.rs`
- **Checks**: `code.seam`, `code.lint`
## Guidance
- **TASK BUILD & SEAM PROOF**: Author compiling, passing seam tests directly in `build` within `max_net_loc` budgets.
## Pre-Task Architectural Slice
- **Layer**: `billing/domain`
- **Max Net LOC**: `85`
- **Verification Seam**: `tests/billing_test.rs::dedupes_replayed_webhook_atomically`
- **Canonical Owners**: `src/billing/webhook.rs`, `src/storage/ledger.rs`
## Dependency Receipts
- `blueprint_synthesis.review` @ `8b3f10d4...` (2026-11-22T18:10:00Z)
## Governing Invariants
- `INV-BILLING-IDEMPOTENT` (`docs/adr/0004-idempotent-ledger.md:14`) [ENFORCED]
## Scoped Symbols
- `WebhookProcessor::handle` : 38:104 : `pub async fn handle(&self, sig: &str, raw: &[u8]) -> Result<WebhookOutcome>`
## Scoped Tests
- `dedupes_replayed_webhook_atomically` (`tests/billing_test.rs:42`)
## External Callers
- `routes::stripe_webhook_handler` (`src/api/routes.rs`) -> `WebhookProcessor::handle`Full embedded YAML (code.yaml)๐
version: 2
inherit: base
tags:
- default
- docs
default_tools:
- code_map_overview
- code_map_search
- code_map_inspect
- code_map_impact
- code_map_analyze
- code_map_explain
- code_map_tests
- code_map_prove_removal
- code_map_query
- code_map_lint
- ast_grep_search
- get_doc
- search_docs
- acdd_read
- acdd_guide
- acdd_state
- acdd_claim
- acdd_verify
- acdd_submit
- acdd_blackboard
proofs:
blueprint:
description: "Architectural blueprint with grounded citations and per-task slices"
schema:
type: object
required:
- cited_invariants
- cited_symbols
- global_negative_boundaries
- blackboard_decision_id
- tasks
properties:
ac_mapping:
type: array
items:
type: string
c2_boundary_impact:
type: string
adr_required:
type: boolean
sad_updates:
type: array
items:
type: string
cited_invariants:
type: array
items:
type: string
cited_symbols:
type: array
items:
type: string
global_negative_boundaries:
type: array
items:
type: string
blackboard_decision_id:
type: string
tasks:
type: object
additionalProperties:
type: object
required:
- layer
- summary
- exported_interfaces
- negative_boundaries
- incoming_seams
- outgoing_seams
properties:
layer:
type: string
summary:
type: string
exported_interfaces:
type: array
items:
type: string
negative_boundaries:
type: array
items:
type: string
canonical_owners:
type: array
items:
type: string
mechanism_rules:
type: array
items:
type: string
max_net_loc:
type: integer
verification_seam:
type: string
incoming_seams:
type: array
items:
type: object
required:
- source_task
- contract_type
- contract_ref
- specification
properties:
source_task:
type: string
contract_type:
type: string
enum:
- seam_dependency
- shared_type
- shared_helper
contract_ref:
type: string
specification:
type: string
outgoing_seams:
type: array
items:
type: object
required:
- target_task
- contract_type
- contract_ref
- specification
properties:
target_task:
type: string
contract_type:
type: string
enum:
- seam_dependency
- shared_type
- shared_helper
contract_ref:
type: string
specification:
type: string
roles:
architect:
mode: subagent
reuse_on_reject: true
guidance: "Spawn an architect subagent in the run worktree with thin (run, cursor, worker, worktree) prompt; reuse the same worker on blueprint rejection."
builder:
mode: subagent
reuse_on_reject: true
guidance: "Spawn a builder subagent in the assigned worktree with thin prompt; reuse the same worker on review rejection and handle BUDGET_OVERRIDE escalations."
independent_reviewer:
mode: subagent
reuse_on_reject: false
guidance: "Spawn a fresh independent_reviewer (distinct worker_id from build/polish) with thin prompt to audit all contours independently."
guidance:
code.principles:
description: "ENGINEERING & SIMPLICITY PRINCIPLES"
criteria:
- "Reuse canonical owners (`INV-SINGLE-OWNER`), keep one SSOT with native closed enums/types instead of magic strings or shadow layers, and avoid unrequested fallback architecture."
- "Zero production N+1 I/O, DB, parse, or subprocess loops: batch/preload once at the boundary, skip branches discarded by caller filters, and trust validated internal types without re-checking."
- "Extract shared helpers for `>= 5`-line repeated pipelines, keep cohesive single-caller code together, and remove clones, `dead_tails`, `phantom_tested`, and `dangling_calls`."
- "Escalate new subsystems or `max_net_loc` overages via `acdd_blackboard` (`decisions`/`blockers`) or `submit --action escalate` โ never convert one-time incidents into permanent layers."
- "Keep logic/state tests in-memory with hoisted setup and table matrices; reserve tempdirs, VCS checkouts, and child processes strictly for isolation contracts."
code.tools:
description: "ACDD NAVIGATION & HYGIENE PROTOCOL"
criteria:
- "Use `code_map_*`, `ast_grep_search`, `acdd_read(selector: ...)`, `search_docs`, `get_doc` (`rg` only for literals/config); if MCP is unavailable, use `acdd` CLI (`skills/acdd/SKILL.md`)."
- "Run `code_map_lint` for arch/syntax/docs rules, `code_map_impact`/`tests`/`prove_removal` before deleting/changing public symbols, and `code_map_query(duplicates, dead_tails)` before submit."
- "Do NOT run inline Python (`python -c` / heredocs) or write ad-hoc `.py` verification scripts โ use native tests or `acdd` CLI."
milestone.synthesis:
description: "ARCHITECTURAL BLUEPRINT SYNTHESIS"
criteria:
- "Audit canonical owners first; populate `proof.tasks` with minimal `canonical_owners`, `mechanism_rules`, `max_net_loc`, `verification_seam`, and cross-task seams."
- "Post the decision via `acdd_blackboard` and cite its ID in `blackboard_decision_id`."
milestone.blueprint_review:
description: "INDEPENDENT BLUEPRINT REVIEW"
criteria:
- "Verify invariants, canonical-owner reuse, layer boundaries, realistic `max_net_loc`, proportional verification, and a valid `blackboard_decision_id` across `proof.tasks`."
task.code:
description: "TASK BUILD & SEAM PROOF"
criteria:
- "Follow `pre_task_slice` (`canonical_owners`, `mechanism_rules`, `max_net_loc`); fix defects across all sibling call sites at the canonical owner."
- "Author compiling, passing seam tests directly in `build` (`code.seam`, `exit_code == 0`) and verify hot-path budgets proportionally."
- "If `context_reset_required` is set, read the latest `rearchitect` decision from `acdd_blackboard` and rebuild cleanly from scratch."
task.review:
description: "INDEPENDENT TASK REVIEW"
criteria:
- "Verify every `AC` 1:1, concurrency/path safety, non-self-approved `BUDGET_OVERRIDE` vs measured net LOC, and `code_map_impact` / `code_map_query` (`duplicates`, `dead_tails`, `phantom_tested`, `dangling_calls`) across all contours."
- "Reject localized bugs as `kind: defect` (`fail: build`); reject structural violations requiring context reset as `kind: architectural_drift` (`fail_drift: rearchitect`)."
- "Reject N+1 loops, duplicate `>= 5`-line logic, orphan helpers, missing assertions, or slow disk/subprocess tests for pure logic (recommend >150 LOC splits only when responsibilities are tangled)."
task.rearchitect:
description: "ARCHITECTURAL RECOVERY AFTER DRIFT"
criteria:
- "Diagnose the structural drift against invariants/canonical owners and post the simplest seam correction to `acdd_blackboard` (`topic: decisions`) before routing to `build`."
milestone.polish:
description: "INTEGRATION POLISH & DOCS RECONCILIATION"
criteria:
- "Resolve integration/review findings strictly inside admitted polish paths without weakening verified contracts."
milestone.review:
description: "INTEGRATION REVIEW"
criteria:
- "Audit the integrated diff against `target_base` across all contours, verify trace freshness, runtime test budgets, zero leaked temp resources, and workspace-wide `duplicates`/`dead_tails`."
milestone.handoff:
description: "TERMINAL DELIVERY RECEIPT"
criteria:
- "Confirm all non-cancelled tasks are completed and predecessor proofs match the current tree."
contours:
architecture:
description: "Verify single-owner reuse, simplicity, layer boundaries, and absence of redundant or incident-driven abstractions."
criteria:
- "Confirm canonical owners and existing safeguards are reused instead of accumulating defensive wrappers, redundant validations, parallel pipelines, or shadow resolvers."
- "Verify strict layer boundaries, zero unnecessary code or narrow string heuristics where structural data exists, proportional complexity, and zero incident-driven permanent abstractions."
concurrency:
description: "Verify concurrent operations preserve revision fencing, claim ownership, and rollback integrity."
criteria:
- "Verify CAS preconditions, claim revisions, and lock ordering prevent partial or stale state publication."
project_isolation:
description: "Verify data, profiles, paths, and Git operations stay confined to the owning workspace."
criteria:
- "Confirm path confinement, symlink rejection, and workspace isolation."
commands:
build_check:
unbound: true
verify_all:
unbound: true
gates:
- id: blueprint_synthesis
gates:
- id: synthesize
role: architect
proof: blueprint
guidance:
- milestone.synthesis
- core.execution
- code.principles
- code.tools
- hitl.pro
context:
- docs.instructions
- docs.adrs
- docs.invariants
pass: review
- id: review
role: independent_reviewer
proof: review
contours:
- claims
- architecture
- project_isolation
- administration
independent_from:
- synthesize
guidance:
- milestone.blueprint_review
- core.review
- code.principles
- code.tools
- hitl.pro
context:
- docs.instructions
- docs.adrs
- docs.invariants
save:
immutable: true
fail: synthesize
- tasks:
gates:
- id: build
role: builder
save: snapshot
command: build_check
proof: command
checks:
- code.seam
- check: code.lint
with:
categories:
- arch
- syntax
- docs
guidance:
- task.code
- core.execution
- code.principles
- code.tools
- hitl.pro
context:
- docs.instructions
- docs.adrs
- docs.invariants
- code.symbols
- code.tests
- code.external_callers
pass: review
- id: review
role: independent_reviewer
proof: review
contours:
- paths
- claims
- architecture
- concurrency
- project_isolation
- administration
independent_from:
- build
need:
- build
guidance:
- task.review
- core.review
- code.principles
- code.tools
- hitl.pro
context:
- docs.instructions
- docs.adrs
- docs.invariants
- code.symbols
- code.tests
- code.external_callers
save:
immutable: true
pass: deliver
fail: build
fail_drift: rearchitect
- id: deliver
role: independent_reviewer
independent_from:
- build
need:
- build
- review
receipt: true
guidance:
- hitl.pro
save:
immutable: true
post: commit
fail: build
- id: rearchitect
role: architect
guidance:
- task.rearchitect
- core.execution
- code.principles
- code.tools
- hitl.pro
context:
- docs.instructions
- docs.adrs
- docs.invariants
- code.symbols
pass: build
max_attempts: 3
- id: run_tests
command: verify_all
proof: command
checks:
- check: code.lint
with:
categories:
- arch
- syntax
- docs
max_attempts: 3
pass: integration_review
fail: polish
- id: polish
role: builder
scope:
- ".acdd/profile.yaml"
- ".acdd/profiles/**"
- "docs/**"
- "skills/**"
- "AGENTS.md"
- "README.md"
- ".gitignore"
command: verify_all
proof: command
max_attempts: 3
guidance:
- milestone.polish
- core.execution
- code.principles
- code.tools
- hitl.pro
context:
- docs.instructions
- docs.adrs
- docs.invariants
pass: run_tests
- id: integration_review
role: independent_reviewer
proof: review
contours:
- paths
- claims
- architecture
- concurrency
- project_isolation
- administration
independent_from:
- polish
- "tasks.build"
need:
- run_tests
guidance:
- milestone.review
- core.review
- code.principles
- code.tools
- hitl.pro
context:
- docs.instructions
- docs.adrs
- docs.invariants
- code.symbols
- code.tests
- code.external_callers
save:
immutable: true
pass: handoff
fail: polish
- id: handoff
role: independent_reviewer
need:
- run_tests
- integration_review
receipt: true
guidance:
- milestone.handoff
- hitl.pro
save:
immutable: true
post: commit
archive: true
prune: true
fail: polish