Reintegration policy and recovery guide

Domain pages

This guide expands the normative contract in cacophony-spec §17 for operators, profile authors, and managed agents. Agents land work through first-party lifecycle commands so the daemon can preserve branch safety, recorded summaries, and bead state.

Delivery model

Canonical lifecycle surface

The mode comes from the first source that sets it: the --mode flag on one reintegration or spawn, the profile's reintegration mode, then the project's integration.default_intent. The backend likewise comes from --backend, then the profile's reintegration.backend, then the project's integration.backend. Direct with the local_merge backend squashes into the target branch from an isolated checkout; direct with the pull_request backend opens a PR and merges it without review, through GitHub native auto-merge where the project enables it. pr_auto_merge opens a PR that merges when allowed, pr_review stops at review, pr_submit publishes one ready PR and stops, artifact_only records the branch and commits without landing, and none never reintegrates.
Choosing a modeThe mode and the backend are resolved separately, each from the first source that sets it; together they decide how work lands.
SituationCommandContract
Final worker closeoutAGENT_ID="agent-id"; caco agent complete --id "$AGENT_ID"Success path for one-shot workers; reintegrates and terminates the worker.
Persistent/dev mid-flight landingAGENT_ID="agent-id"; caco agent reintegrate --id "$AGENT_ID"Lands committed work while keeping the agent alive.
Materialized friend checkoutAGENT_ID="agent-id"; FRIEND="project"; caco agent reintegrate --id "$AGENT_ID" --friend "$FRIEND"Targets friend-checkouts/<project>/, uses that friend's integration policy/remotes, records the target-project difference, and leaves the primary checkout/runtime alive; complete --friend is explicit terminal closeout.
Recorded profiles--mode direct,recordedRequires a structured summary artifact before merge.
PR-backed profilespr_review / pr_auto_merge / pr_submitUses configured project remotes and integration policy.

Agent checkouts come from checkout_type: the default clone is a single-branch clone of the daemon's canonical checkout that borrows its objects, while full clones the project's configured remote with its own object store and needs no canonical checkout. caco git clone --project <name> --into <dir> makes the same config-shaped clone by hand, applying the project's remote, SSH key, identity, git.config and extra remotes; see Agents.

Manual git reset, git cherry-pick, raw pushes to main, or hand-edited daemon checkout history are exceptional diagnostics, not normal reintegration workflow.

Recovery, forensics, and emergency levers

Completion blockers (publication and admission failures that block the owning agent loudly), emergency HTTPS land, and audited self-owned GitHub recovery are in Reintegration recovery.

Canonical checkout and live-config guardrail

Managed workers must not edit ~/.cacophony/config.yaml, $CACOPHONY_DIR/config.yaml, or $CACOPHONY_DIR/daemon/checkouts/<project> to repair live project config, profile composition, or canonical checkout drift. Those paths are live daemon/operator inputs: project config and source changes belong in a managed agent checkout and must land through the lifecycle surface above. If a canonical checkout is stale, dirty, locally ahead, has a broken HEAD or an index lock, or blocks reintegration, preserve the command output and dirty-path evidence, then coordinate with caco-ctrl / the operator-owned recovery path. Workers must not run git reset, git clean, reclone, remove locks, rewrite refs, or hand-write home config as a shortcut.

The fleet config checkout, daemon/checkouts/cacophony-config, is not managed like a product canonical checkout. The daemon's config refresher fetches it about once a minute, validates each fetched commit before checking it out, and keeps the last good commit when a candidate is invalid; local edits there are discarded. Config changes land only as merged cacophony-config pull requests.

For read-only triage, caco ops check --project <name> --json reports local and cluster canonical-checkout freshness, dirty paths, lock state, broken Git state, and owner/action guidance; operator_choice_required or blocked findings are stop signs for ordinary workers — evidence to route, not permission to clean the checkout.

Legacy section directory