# Playbook lifecycle for agent-hub (#257, #481)

## Required checks at initialization

For the complete new-project sequence, see [the quickstart guide](quickstart.md#a-new-project-with-sdlc-advise-or-enforce).

`ahub init --sdlc advise|enforce` proposes the repository's required check names.
Discovery is one bounded operation: at most three capped GitHub reads (the default
branch, the latest completed default-branch run with limit 1, then that run's jobs
with a 100-job cap), with a 5-second bound per read and a 20-second overall deadline.
A local `origin/HEAD` avoids the default-branch read. A missing tool, failed read,
timeout or truncated job inventory falls back to `.github/workflows/*.yml`.
Fallback accepts complete literal block-style job names (the job id when `name`
is absent). Matrices, expressions, aliases and reusable workflows require an
explicit `--required-checks <a,b,...>` override; the fallback does not guess expanded
names. Workflow reads refuse links and bound files and bytes. Names follow the
existing SDLC limit of 32 distinct checks, each at most 120 characters.

The guided prompt shows the found names after choosing advise/enforce and lets
the person confirm or edit them. `--yes` accepts discovery; `--required-checks`
skips discovery. Existing configured names, including the matching `[repos]` table, are retained
unless explicitly replaced. Enforce with no known names refuses before any initialization write.

Only `STAIxBWLB/agent-hub` retains the native three-check fallback including
`seeded guards`. Other repositories without configured checks report
`required checks unknown: set required_checks in .agenthub/sdlc.toml`, including
cached review admission; their CI watcher cannot report success from an empty set.
Repository-specific `[repos]` checks are included in review admission and CI watches.

`ahub settings get sdlc.mode` and `ahub settings get sdlc.required_checks` show the
running and file values (`--json` exposes `value` and `fileValue`). A file that
cannot load is unknown. These reads grant no settings write capability; edit the
file through `ahub settings edit sdlc.toml` and restart to apply it.

## Authority and evidence

The issue remains the specification, Tasks remains the sole task mutation boundary, and GitHub remains authoritative for PR heads, required checks, merge commits and releases. The hub stores artifact identities and bounded structured readbacks, never issue/PR bodies. Off is the default. Advise exposes blockers without changing task transitions. Enforce blocks the build-entry and review/approval transitions listed below; it never releases, edits GitHub or gives a peer additional capabilities. The one GitHub write is the guarded merge of an approved task (#786, below), off by default.

A reviewed head is a full lowercase 40-character SHA observed through a successful readback, not an implementer-supplied statement. A check is evidence only for that same head. Unknown/missing required checks, unavailable GitHub, pending reviews or unresolved threads remain blockers in enforce and visible unknowns in advise. A newer head invalidates the derived review and approval readiness. Historical task approval is retained as history, not presented as approval of the new commit. Revalidate after asynchronous readbacks immediately before any board write.

## Default lifecycle

The built-in lifecycle follows the [AI-Native SDLC Playbook](https://claude.com/resources/articles/the-ai-native-sdlc-playbook). Stage ids describe the hub's artifacts and handoffs; the playbook labels group them into Plan, Design, Build, Test, Deploy and Maintain.

| Stage id | Playbook stage | Acting role | Artifact or exit gate | Current enforcement | Class (#784) |
| --- | --- | --- | --- | --- | --- |
| intent | Plan | person/planner | intent or backlog identity | person spec acceptance required at build entry in enforce | person-only (acceptance) |
| spec | Design | person/planner | issue identity and scope | spec acceptance/body drift checked at build entry | person-only (acceptance) |
| plan | Build | planner/owner | plan, branch, existing predecessor gates | current planner review required at build admission; literal-path conformance gates approval in enforce | agent-executable |
| build | Build | owner | PR identity/current head and local check on that head | entering review, when enabled | agent-executable |
| test | Test | verifier/reviewer | required checks and local gate on the reviewed head | approval, when enabled; bug test integrity and the configuration-PR eval gate below | agent-executable |
| review | Deploy | assigned reviewer | current head-bound verdict, no pending change request/open thread; AC checklist under Compliance; each new or changed error, refusal or failure message names its cause and next step (Bugs pass, #1095) | approval, when enabled; open Important findings block in enforce | agent-executable |
| merge | Deploy | person | current-head readiness, ordered touching PRs | shown; the guarded merge below runs only when `auto_merge` is `on` (default off) | agent-executable where the project's AGENTS.md delegates it to the approving reviewer (this repository does, #784); the hub still shows the person as actor |
| release | Deploy | person | merged commit, version/tag, docs freshness/live receipt checklist | person authorization and optional tag hook below | agent-evidence / person-verdict (consent) |
| maintain | Maintain | person/planner | follow-up intent and operational evidence | shown; metrics and control bands from S7 (`ahub sdlc metrics`) | agent-executable |

Stored `implement` and `verify` stage ids read as `build` and `test`. A write that names the old id stores the id the configuration lists, so new enabled-lifecycle receipts use the canonical ids. The default remains off, preserving existing off-mode output, receipt and schema shapes. Status, explain, console and dashboard name the playbook stage beside enabled lifecycle ids.

## Playbook alignment

| Slice | Playbook play | Delivery in this slice |
| --- | --- | --- |
| S0 | Plan, Design, Build, Test, Deploy, Maintain stage model | Nine built-in bases, canonical ids, stored receipt aliases and playbook labels |
| S1 | Accepted intent/spec and spec drift | Person-only `ahub sdlc accept`, bound to the issue's body edit time; build entry needs it in enforce (see Spec acceptance below) |
| S2 | Accepted plan and diff conformance | Bounded proof/risks, metadata-only plan conformance and person-bound departure acceptance |
| S3 | Bugs, Security and Compliance review passes | Head-bound findings, configured nit cap, Important approval gate and recurring-finding amendment proposals |
| S4 | Red-first tests and test integrity | Bug-label metadata, source-labelled red-first proof and changed pre-existing test blockers |
| S5 | Continuous evals for agent configuration | Gate mechanism only: `config_paths` mark a configuration PR and the configured `eval_check` is then required, with its pass rate and suite version recorded. No suite is chosen, created or defaulted: suite choice pending the person (#251/#266) |
| S6 | Production approval gate | Person-only commit/version/docs receipt and opt-in Git tag pre-push guard; report stays read-only |
| S7 | Metrics, deterministic control bands and follow-up intent | `ahub sdlc metrics`, optional `[bands]` with log, diagnose and propose tiers, one card per breach episode; merge-time review and CI figures recorded from the merged PR; release metrics (interval, lead time, hotfix rate) and a `hotfix_rate` band; an opt-in scheduled security-scan baseline (`[security_scan]`, `security_open_alerts` band). Only the per-release gates-run record remains unbuilt (design spec amendment) |
| S8 | Compliance acceptance-criteria checklist | Head-bound checklist retained; legacy workflow and phase receipts refused since 0.13.0; task import removed |
| S9 | Planner grooming and plan review | Read-only digest, current plan-review receipt at build admission, all-mode WIP and accepted-untouched return |
| S10 | Planner cost governance | Typed review/CI scope, premature-review admission, identical-tree CI reuse and read-only cost report |

S0/S8 establish vocabulary and checklist compatibility only. Later slices must retain the same authority contract: the issue is the spec, Tasks owns mutations, GitHub owns PR/check/tag facts, and the hub stores bounded identities, timestamps, hashes and counts instead of remote bodies. No slice writes GitHub or grants capabilities. Advise shows readiness without blocking; enforce applies only the named implemented gates. A full live advise cycle through S1, merge, release and S6 authorization remains pending and cannot be certified by S0/S8 source tests.

The repository uses feature branches and PRs. Release PRs require merge commits because documentation stamps name release-branch ancestors. Do not describe squash as a universal release practice. Worktree/branch cleanup follows confirmed merge; installation and native readback are separate live receipts. A successful source gate cannot certify those receipts.

## Moving from GSD

This is a migration from the GSD planning tool and its `.planning/` artifacts.
The retired `gsd-lite` setting below is a different compatibility path. The hub
uses the issue as the spec and the board as the current work record.

| GSD artifact | Hub destination |
| --- | --- |
| Milestone | Release line and release train |
| Phase and plan | Board task with a file/symbol plan and dependencies |
| Requirements and acceptance | Spec issue acceptance criteria and a head-bound `criteria` receipt |
| `.planning/STATE.md` | Task board and `ahub sdlc status` |
| CONTEXT decisions, `D-xx` and `GATE-xx` | The spec issue's Decisions section, retaining the IDs; `hub_remember` for a public operational decision |

Archive `.planning/`; do not delete it. First find scripts and tests that read
its plans, receipts, decisions or gates, then preserve those paths or update
readers in a reviewed change before relocating anything. Keep the original
artifacts and their references in version control. Archiving marks them historical;
it does not make their evidence disposable. Move current scope and acceptance
criteria into spec issues and board tasks without inventing completed gates.

Review the project's AGENTS.md and README in the same migration: replace GSD
execution instructions and milestone-based version rules with the project's
current task, review and release rules. Preserve historical decision references.
The init notice only points here; it never imports or edits `.planning/`.

Set the release policy in committed `.agenthub/config.json` before requesting
release authorization. For a project with `package.json` and no
`docs/verified.json`, the relevant fragment is:

```json
{
  "release": {
    "version": "package.json",
    "docs": "none"
  }
}
```

`release.version` may instead be `release-notes` with `release.notesPath`
(default `docs/releases/v{version}.md`), or `none` for an exact-commit version
binding. Use `release.docs: "checker"` when retaining `docs/verified.json`.
`none` is refused while that manifest exists; local config does not override
committed release policy. This exemption skips documentation checking only,
without supplying release consent, a tag or publication.

Initialization and person-only setup steps below run from a separate person-owned terminal.
An agent or delegated live test cannot impersonate that person. Command forms
are the ones printed by `ahub help`; placeholders name values to choose.

1. Enable `advise` first with `ahub init --sdlc advise`, then review its shared
   changes. To edit existing lifecycle settings, use the help form
   `ahub settings edit <config.local.json|sdlc.toml> (set <path> <json> | remove <path>)... [--reason <text>] [--preview] [--yes] | backups [--json]`.
   For example, `ahub settings edit sdlc.toml set mode '"advise"'`.
   For an already initialized project with a running hub, the person may instead
   directly instruct its uniquely configured conductor, in that conductor's own
   session, to run `ahub sdlc configure --mode advise --required-checks 'unit,lint'`.
   This optional subsequent step stages only off/advise and check names for the
   next start; it cannot initialize the project or enable enforce. The
   [instruction and audit rules](#instructed-conductor-configuration-1432) apply.
2. Record the long-term goal with
   `ahub goal new <title> [--milestone <text>]... [--depends <id>]... [--shared]`.
3. Create its release line with `ahub release new <name> <goal> <order>`.
   The goal argument describes what this release aims to deliver. Creating a
   release line records planning intent only; it does not ship anything.
4. Have the planner file the spec issues and board tasks, retaining the old
   decision IDs and acceptance evidence. Inspect `ahub sdlc status`; the person
   accepts each spec with `ahub sdlc accept <task> --issue <n>`.
5. After required CI checks and the new task flow have been checked, the person
   may select `ahub init --sdlc enforce --required-checks <a,b,...>`.
   Release authorization remains a separate decision with
   `ahub sdlc authorize-release <version>` after committing the release policy
   and preparing the release candidate.

## Configuration and persistence contract

.agenthub/sdlc.toml contains mode off|advise|enforce and a bounded ordered stage list, using the built-in stages above by default. The loader validates built-in mappings and bounded custom stage/gate/actor definitions; custom guidance does not grant authority. Unknown stages/gates, duplicate stages, cycles, unbounded lists and unknown keys are refused with a field-level reason. A project file may define guidance/gates, but it does not expand capabilities or permissions.

Task lifecycle fields store stage, issue/PR identity, observed head, reviewed head, local-gate head/result and bounded check/readback metadata. Legacy rows read with no lifecycle metadata. Every change goes through Tasks and records its actor; adapters/tools/CLI never write Board directly. Readback timestamps identify observations, not a freshness promise. Persist no task text in lifecycle receipts; public output uses the existing PII stub and publicTitle/publicView.

A reviewer records the head it actually reviewed. If GitHub no longer reports that head, a stale verdict refuses before effects. Changes requested does not require green CI. Approval requires a current review and all configured required checks successful on that head, except the proven draft macOS deferral described below; neutral/skipped does not substitute unless explicitly allowed by the project's gate contract. For that draft only, missing GitHub approval and outstanding review requests are deferred to merge, because the connector does not review a draft. Unknown review-request evidence, a pending change request, unresolved threads and all other blockers still refuse approval. A local check records an exact SHA and its result; it is a claimed local receipt, labelled separately from externally fetched CI.

## Readbacks and presentation

Use structured gh JSON/GraphQL read-only calls (the guarded merge below is the one exception) with validated repository and numeric artifact identities. No shell interpolation, PR/issue body fetching, token logging or unbounded comment storage. Failure yields unknown. Required checks come from repository rules or explicitly configured names; an empty/unknown set is not silently green. Review-thread status is counted, not copied. Cancellation and task-owner generation fencing prevent a late read from approving reassigned work.

GitHub may return more than one row for a named check after a rerun or cancellation. When every row has a workflow identity and start time, and those identify one uniquely newest run of the same workflow, the hub evaluates that run and drops older rows. If workflow identity or ordering is ambiguous, it retains the rows; duplicate evidence remains a blocker rather than a guessed pass. In the CI watcher, cancelled attempts and a draft PR's deferred `check (macos-latest)` read as pending so the watcher can wait for a replacement run. Review admission can accept this repository's draft head only when Ubuntu and seeded guards pass, the remaining required checks pass, and the failed macOS aggregate's exact-head job proves its draft-deferral step was the sole failure. Incomplete or stale proof remains a blocker. This is review readiness, not a successful full gate: the macOS aggregate still needs to pass for merge.

For the repository workflow, see the `Draft first` and `Merging after approval` rules in `AGENTS.md`. The connector reviews after the approved draft is marked ready; its unresolved threads and pending change requests still block merge. A later push invalidates the earlier head's approval. The reviewer marks the approved head ready and merges only after the full exact-head gate and review blockers settle.

ahub sdlc status and explain expose mode, stage, gate, observed/reviewed/local-check heads, next actor and next action. Console/dashboard derive the same result. Merge ordering compares exact PR path sets, reports intersections and never guesses an automatic landing order where dependencies are unknown. Release readiness lists merged work since the tag, stale/nonancestor documentation stamps and open native/live receipts; each unknown remains visible.

## Composition and measurement

The acceptance-criteria checklist belongs to the Compliance pass over the same board. It creates no second STATE/PLAN/HANDOFF authority and cannot auto-advance. #259 profiles supply project defaults without changing gate authority. #247 records store ids, timings and outcomes, not plan text. #251/#266 provide the separate evaluation work; no effectiveness comparison or native lifecycle experiment is claimed here.

## Delivery and verification state

Head-bound review/approval gates, bounded custom definitions, read-only merge/release reports, S0/S8 vocabulary/checklist migration, S1 spec acceptance and S9 planner admission and S10 cost governance are implemented in source. S11 release-train governance ships in 0.12.37. S5 and S7 are implemented in source (S5 as a gate mechanism with no suite behind it, S7 with merge-time readback, release metrics and an opt-in security baseline). Only the native advise-through-merge/release cycle and the per-release gates-run record remain pending. S6 authorization and its optional tag hook are implemented in source. S4 test integrity is implemented in source. S2 plan conformance and S3 findings are implemented in source. Installation and native acceptance require separate receipts; a person authorization is consent, not native verification.

## Initial commands

For `STAIxBWLB/agent-hub`, a per-project `.agenthub/sdlc.toml` may set `mode = "advise"` and `required_checks = ["check (ubuntu-latest)", "check (macos-latest)", "seeded guards"]`; other repositories use their own check names from [initialization](#required-checks-at-initialization). The optional `eval_check` and `config_paths` are described under the eval gate below. Omit the file for off. A missing/empty check set is unknown, never a green approval gate. The built-in stage order follows the table above; changing the file applies at the next hub start.

A person records ids and a claimed local receipt with `ahub sdlc record 12 '{"repo":"owner/repo","issue":109,"pr":325,"localHead":"<full SHA>","localResult":"passed","stage":"build"}'`. Owners/reviewers have the bounded `hub_sdlc_record` tool; it accepts no remote bodies or external-check results. Only the assigned reviewer or person records a reviewed head. `ahub review 12 approved --head <full SHA>` rechecks current evidence before approval. Changes requested does not require green CI.

`ahub sdlc status` lists bounded local projections without polling every remote PR. `ahub sdlc explain 12` or `status 12` performs a fresh structured readback, open to any agent as a public view (private tasks stay stubs), with no remote body retention. Shared console/dashboard projections explicitly show unknown external evidence; they do not certify freshness from cached data. Default task rows and contracts remain unchanged when off.

# Spec acceptance (#481 S1)

- The person accepts a task's spec issue with `ahub sdlc accept <task> --issue <n> [--repo owner/repository]` (the repository defaults to the task's receipt). Agent shells and live tests are refused. The hub reads the issue's `lastEditedAt` and `updatedAt` through a fixed GraphQL query and stores them with the issue identity and the time of acceptance; it never reads or stores the body. `hub_sdlc_record` cannot write an acceptance, and relinking the receipt to another repository or issue drops it.
- Build entry is the `implement` or `bulk_edit` task's acceptance (`hub_task_accept`), or a recorded stage change into a build stage by anyone but the person. Enforce names missing issue/acceptance prerequisites in the [entry-gate order below](#named-ci-and-build-entry-diagnostics-1328-t2), then re-reads the body edit time: `spec changed after acceptance` means a body edit (comments only move `updatedAt`), and `spec edit time unknown` means the readback could not establish it. Advise reports lifecycle gaps as notices without blocking them; off performs no lifecycle read.
- At build entry, a replacement may carry existing person consent from an older cancelled task only when its entire local `supersededBy` is `task #N`, `#N` or `N` for this destination, both tasks name the same canonical repository and issue, and a fresh host GitHub read proves the same `lastEditedAt`. Explicit `null` means no body edit; missing or unavailable edit metadata is unknown. Caller timestamps and comments-only `updatedAt` changes cannot grant or revoke this carry. A different issue/repository or edited body requires the person to accept again.
- Carry reads metadata for at most 32 matching older cancelled sources (a 33rd row makes the result unknown), with each raw JSON field capped at 64 KiB and the total projection at 256 KiB. Unknown, malformed or truncated metadata, cold repository scope, private source/destination/context or changed actor/policy, source cancellation revision/consent metadata or destination flow/identity during readback leaves consent absent. Source history is not read, and unrelated historical note changes are not compared. Whole local references exclude prose, qualified projects and URLs; older-only sources exclude cycles. No source body, detail, plan or history is scanned.
- Spec validation itself is read-only. After the existing outer admission succeeds, the host atomically preserves the original person's `acceptedAt` and records a `spec acceptance carried` HUB history entry with the source task and cancellation revision alongside that outer event. A refused plan/stage/completion admission or a failed atomic consent/outer-event transaction retains the original task and history. Only the acceptance identity/edit fields move; the destination keeps its own plan review, artifact/head and lifecycle evidence. A repeated gate does not append another carry entry. Manual acceptance stays person-only and receipts cannot supply consent.
- `ahub sdlc status <task>` and `explain` show `spec: {issue, state}` (`missing`, `current`, `changed` or `unknown`) when the lifecycle is enabled and the receipt names an issue. The spec state is not a merge-readiness blocker: its gate is build entry.

# Acceptance-criteria checklist

- A task's reviewer or the person records a head-bound `criteria` receipt through `hub_sdlc_record` or `ahub sdlc record` (an off or older daemon's tool schema still offers `phase`). Its ids name the issue's acceptance criteria. The board owns the receipt and its actor/history; no writable STATE/PLAN/HANDOFF file is introduced.
- A checklist names a bounded slug `id`, a full `head` and 1..32 criterion records. Each criterion has a bounded `id`, boolean `required`, `result` verified|failed|unverified and up to eight hashed refs. Accepted refs are `sha256:<64-hex>`, or `artifact|check|source:<ASCII-reference>@<64-hex>`. Whole receipt JSON is at most 32 KiB. The hub never fetches those refs or treats a model claim as a deterministic check. Verified outcomes are reviewer claims, separately labelled from fresh GitHub checks.
- Required failed/unverified criteria and missing/stale checklist heads keep readiness false. Advise/off preserve existing transition behavior. Enforce adds criteria blockers only at approval. Entering review remains possible with unverified criteria so the reviewer can inspect and record them. Criteria claims do not replace exact-head local/CI checks.
- Once recorded, a checklist adds its blockers in any enabled lifecycle; off ignores it, as #257 did. The `criteria` entry/exit gate uses the same checklist without a workflow selector, and a missing checklist is a blocker the reviewer clears by recording one. Task dependencies remain with `Tasks.after`, created through `ahub task propose --after`. Checklist task import is removed.
- A task's acceptance criteria are this checklist: there is no second criteria model (#507b). The review request lists the recorded criteria (`- <id>: <result>`, `(optional)` for a non-required one) ahead of its checklist, so the reviewer sees the ids the task is judged by; a PII task lists none. A `hub_review` unmet item that starts with a recorded id (`AC2: the overwrite case has no test`, or the bare id) names that criterion: the hub records the ids it matched on the verdict as `unmetCriteria` (history and the public view), read from the board's checklist at the verdict and never from the caller. An id the checklist does not hold, the wrong case, a longer word that merely starts with an id and an id in the middle of a sentence are plain text, and the note text is unchanged. These ids are what later review packing and learning refer to.
- `ahub sdlc status <id>`, `explain` and console/dashboard projections show the same criteria view. `ahub sdlc export <id>` keeps the #257 schema-1 bytes in plain off (`workflow: "none"`, `phase: null`); an enabled or retired-setting lifecycle emits schema 2, with sanitized state, criteria/hashes and `stateHash`/`sourceHash`: the exact projection hash and normalized effective lifecycle-configuration hash. These are derived hashes, not code/build attestations or import authority. Private exports contain a stub and no checklist refs.

Example reviewer receipt:

```json
{
  "criteria": {
    "id": "delivery-one",
    "head": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "criteria": [{ "id": "AC0", "required": true, "result": "unverified", "refs": [] }]
  }
}
```

The repeated SHA is syntax only. Replace it with the reviewed head; a verified criterion also requires hashed evidence refs.

## Retired workflow compatibility (#252, #481 S8)

The old `gsd-lite` workflow is retired. Omit `workflow` from `.agenthub/sdlc.toml` and use the criteria checklist above. Until hub 0.13.0, `workflow = "none"` loads silently and `workflow = "gsd-lite"` loads with a migration warning in `hub.log` and makes a criteria checklist required on every task. The `phase` gate and receipt name are compatibility aliases for `criteria` during that same window; use `criteria` for new configuration and writes. From 0.13.0, `workflow`, the `phase` gate and the `phase` receipt name are refused with a field-level reason.

Stored phase receipts remain readable: their criteria are shown, while legacy task lists are ignored with a visible note. Reading historical receipts never imports or edits task edges. [The retired analysis](gsd-collaboration-analysis.md) preserves the original rationale and unrun measurement plan; it is not current workflow guidance.

# Custom lifecycle definition contract (#257)

- The sdlc.toml loader reads a single regular single-link file up to 64 KiB, checks its identity/size across a bounded read and refuses symlinks or changing files.
- Optional `definitions` in sdlc.toml maps a stage id to bounded data: `base`, `actor`, `entry_gates`, `exit_gates` and `after`. `stages` is the explicit ordered list, at most 32 distinct lower-case ASCII ids of at most 48 characters. Built-in names retain their original base; custom ids map to one of the nine semantic bases above. Unknown keys, gates, actors, duplicate gates and references refuse before startup.
- The list must contain a review-base and merge-base stage because existing Tasks done/review transitions need those destinations. Other stages can be renamed, inserted or omitted. `after` has at most eight distinct earlier ids; self, forward, missing and cyclic dependencies refuse. Configuration defines no new task states, runnable commands or capability.
- Actors are owner, reviewer, person or planner (defaulting to the base's existing actor guidance). A configured actor never grants lifecycle write authority to a new caller. Existing task owner/reviewer/person eligibility remains the outer boundary. In enforce, an explicit custom stage change additionally requires its configured actor; a person may record every stage. A planner must already be an eligible task holder with the existing planner flow role. Off/advise preserve their nonblocking claim behavior.
- Gate names are issue, pr, local, review, checks and criteria. The legacy phase gate is accepted only during the deprecation window. They read only the existing artifact identities, exact-head GitHub readback, claimed local receipt or current board-owned acceptance-criteria checklist. Entry/exit readiness is shown separately from approval readiness. Custom gates cannot remove the existing review/approval floor, turn a missing required-check set green or treat a criteria claim as external verification.
- Receipts keep their configured stage id. Tasks validates stage names against the active definition before storing. A definition removed after a restart makes the old stage visibly unknown until an eligible person/holder records a valid one; it is never silently remapped. Existing state-derived completion/approval selects the first configured review/merge base destination, not a hard-coded name; no arbitrary stage auto-advance is added.
- CLI, console and dashboard use the same definition/base/actor and entry/exit blocker projection. Every managed native/local task schema advertises the same active stage ids. Separate MCP processes read authenticated daemon status, not a mutable sdlc.toml; a live older daemon without the optional field retains the seven-stage schema. An unavailable/malformed read withholds hub_sdlc_record until a successful tools-list read rather than inventing stages. Enabled defaults use the nine playbook bases; off-mode config, receipts, schemas and projections retain their prior shapes. Native model ingestion and an actual advise/release cycle remain unverified.

Example:

```toml
mode = "advise"
required_checks = ["check (ubuntu-latest)", "check (macos-latest)", "seeded guards"]
stages = ["question", "draft", "fact-check", "approve", "publish"]

[definitions.question]
base = "plan"
actor = "planner"
entry_gates = ["issue"]

[definitions.draft]
base = "build"
actor = "owner"
after = ["question"]
exit_gates = ["local"]

[definitions.fact-check]
base = "test"
actor = "reviewer"
after = ["draft"]
exit_gates = ["checks"]

[definitions.approve]
base = "review"
actor = "reviewer"
after = ["fact-check"]
exit_gates = ["review"]

[definitions.publish]
base = "merge"
actor = "person"
after = ["approve"]
```

These ids are guidance/receipt destinations. Publish neither merges nor releases. The read-only source-readiness report is implemented below. Native acceptance and research measurements remain unverified or pending; person authorization is recorded separately below.


# Structured documentation readiness evidence (#257)

The package-owned scripts/check-docs.mjs accepts --json with the same normal/--require-fresh verdict as its human output. Metadata includes the observed head, validated package version and sorted document identities with fresh/stale/nonancestor/unknown state, stamp, covered commit count and dirty flag when known. Invalid/error payload text is excluded from machine output; an error count and fresh=false retain uncertainty. Git readbacks disable repository-configured helpers and bound subprocess time/output. No stamp, version, tag or release is written. This evidence is a release-readiness input, not proof of prose review or native acceptance.

The release reader additionally requests --committed: manifest, README and package metadata come from the captured HEAD, and dirty documentation/evidence files block freshness. A working-tree restamp cannot certify a commit that still contains stale stamps. The ordinary checker continues to support working-tree review before those stamps are committed.

The manifest must list `README.md`, every agent note and every page directly under `docs/` and `docs/addons/` except the dated records `docs/smoke.md` and `docs/gsd-collaboration-analysis.md`; a missing entry is an error. CI's `decision` job reports stale stamps as warnings on every PR, even when the gate is reused; only the release PR restamps (#1268).

# Guarded merge (#786)

`.agenthub/sdlc.toml` takes `auto_merge = "off" | "dry-run" | "on"` (default `off`) and optional `[repos."owner/name"]` tables with `required_checks` and `auto_merge`. A table's mode overrides the top-level one for that repository; its `required_checks` come first, then the top-level list, so a repository without branch protection is gated by what this file names (an empty set refuses: `required checks unknown`). Unknown keys are refused with a field path. The file is read once at start.

Two triggers, neither blocking: an approving `hub_review` at the PR's current head (the check runs after the verdict is saved and reports through a notice; a failing or throwing check never changes the verdict), and `ahub sdlc merge <task> [--dry-run]` (the person or the one configured conductor; a daemon control op that always replies; the decision prints for a person, and `--json` prints it as a document). Right before acting the hub re-reads the PR (`readSdlcPr`) and the queue (`readMergeQueue`) and refuses, naming every failing gate: task not approved, head changed since the approved head, a required check failing, pending or missing, a pending change request, pending or unknown review requests, an unresolved or unknown thread, an open Important finding, a draft, a PR not first among its touching PRs or a dependency that is not approved, a release PR (`release PR: person consent required`), a private task, or unreadable evidence. Unknown is never a pass. The decision judges every gate on three readings (the PR, the queue's own read, then the PR once more, last) and refuses what any of them fails, so a check, review request, thread or draft that changes between reads at the same head is caught; `--match-head-commit` pins only the head. The board-side inputs are read again, synchronously, in the same stretch as the `gh pr merge` call (nothing is awaited between the read and the call) and compared with what the decision judged: the task's state, repo, PR and reviewed head, its privacy, every dependency's state and the dependency edges, open Important findings on the head, the release stage, the merge mode and required checks in force, and the asker's authority and the hub's availability. Any difference refuses and runs nothing. The complete local queue inputs (all task links, dependency edges, receipts, plans, findings, privacy and SDLC configuration) must also match their pre-read fingerprint in a synchronous check after the fresh gates and argv validation, immediately before dispatch. The caller must still be the person, the hub approval trigger or the currently configured conductor at that final check. Any changed projection refuses, conservatively including an unrelated task projection change; a new invocation reads the queue again.

`on` runs exactly `gh pr merge <pr> --repo <repo> --squash --match-head-commit <head>` (a closed argv shape checked right before the call) and reads the PR back: only GitHub reporting `MERGED` is a merge, whatever the exit code. Never `--admin`, never a ref update used to perform the merge, and no `--auto` while the repository does not allow auto-merge (a person's repository setting). `dry-run` reports the same decision and the argv it would run and runs nothing; `off` reads nothing. Logs and notices name the task number and gates only. The verdict mirror is described in the next section.

## Adopting a PR merged outside the hub (#1328 T3)

If a PR was merged before its task could finish the normal review flow, the
person or the current configured conductor runs:

```sh
ahub sdlc adopt-merge <task> --pr <n>
```

The task must already establish its repository. `--pr` can bind a missing PR
link; a conflicting recorded PR or repository refuses. The hub reads that
repository and PR and requires it merged at the task's last recorded full head,
with every configured required check green at that head and no open Important
finding. Unresolved or unknown review threads, pending or unknown review
requests, and an explicit change request refuse too. A GitHub approval is not
required when review coverage is complete and clean. The hub observes one
bounded GraphQL snapshot with checks bound to its head commit. Missing, pending,
failed or unknown checks refuse with their names and
a next step. A missing artifact, missing full head, changed task or policy,
stale actor/session or a held hub also refuses without changing the task.

Eligible task states are exactly `in_progress`, `in_review` and
`changes_requested`, with all Important findings dispositioned. `proposed` and
`backlog` tasks must be assigned and accepted first. `approved` and `cancelled`
are already closed. Each refusal names the state and the next step. The Board
transition is host-only and requires the current flow revision; the generic
state transition table is unchanged.

A successful adoption records `merged outside the hub` as the actual person's
or conductor's action, moves the task to `approved`, and releases dependents as
an ordinary approval does. It does not invent a reviewer verdict or reviewed
head, run `gh pr merge`, post a review, or remove a branch or worktree. A task
already approved or cancelled is not adopted again.
Observed `sdlc.head` follows the proven PR head; older local/reviewed metadata
remain unchanged and noncurrent. Normal settlement observers receive the
approval (origin follow-back, supervision, research recording and release/profile
timing), without adding a review verdict or automatic-done count. Release timing
never counts an adoption that occurred after the release.

Private tasks and private
turns refuse for every actor before GitHub reads; use the person's local review
workflow for private work. `--live-test` cannot delegate this approval as the
person.

## Merge result and cleanup (#786 T2)

Post-run reads make at most three attempts within a shared six-second budget. Only a GitHub MERGED observation with its merge commit permits cleanup; the CLI exit is recorded separately, including a nonzero exit when GitHub confirms the merge. Non-merged, missing or unreadable evidence records the bounded result and leaves branches alone. Off and dry-run create no merge record or cleanup effects.

Tasks stores host-only `sdlc.merge` evidence bound to the repository, PR and head. Lifecycle tools cannot submit this field, and artifact changes invalidate it. A change during an awaited operation leaves the previous attempt in history without overwriting the replacement artifact. Durable cleanup and owner-notice claims precede those effects. Merged or uncertain attempts are not automatically repeated after restart; a positively observed not-merged result can be retried by an explicit command. A crash before the first post-run record remains an untracked attempt requiring inspection.

Remote cleanup reads the merged PR head, repository default, legacy protection and active rulesets. It skips missing, fork, default, protected, moved or unsupported refs. Its only ref write is a single GraphQL compare-and-swap deletion: `beforeOid` is the merged PR head and `afterOid` is zero. A moved head refuses deletion; unknown outcomes stay explicit. The hub sends the owner a public-view notice to remove only its task worktree and local branch when safe. The hub runs no local branch or worktree deletion. Finding the worktrees that are left over is the worktree shelf (`docs/operations.md`, "The worktree shelf (#1057)"): the hub derives which ones are finished and shows them, and removal is the person's own `ahub worktrees tidy --confirm` in a terminal, never a daemon or panel action.

## Verdict mirror (#786)

Each `hub_review` verdict is mirrored as ONE `COMMENT` review on the head it was given for, so a person reading the PR sees the hub's verdict. One GitHub account authors and merges every PR and GitHub refuses `APPROVE` and `REQUEST_CHANGES` on your own PR, so a comment is the only review the hub can leave; it is a record, never a gate, and nothing reads it back as approval. The call is exactly `gh api repos/<repo>/pulls/<pr>/reviews -f event=COMMENT -f commit_id=<head> -f body=<text>`, a closed shape checked right before it runs; the hub makes no other review write. The first line of the body is `agent-hub verdict: approved|changes_requested (task #N, reviewer <peer>)`.

It follows the same `auto_merge` setting as the guarded merge, per repository: `off` posts and reads nothing, `dry-run` reports the call it would make in a notice, `on` posts. It runs after the verdict is saved, is never awaited by the verdict and never fails it (a failure is a notice naming the task number). A verdict at a head the PR is no longer at posts nothing, a closed PR gets nothing (the head and state are read once more after the review list, last, so a push or a close during that read is caught; GitHub offers no compare-and-set on a review, so a push landing between that read and the post is not, and the comment still names its commit), and unknown evidence (an unreadable PR or review list, or a full page of 100 reviews) posts nothing. At most one mirror exists per (task, head, verdict): the hub reads the PR's reviews for its own headline at that head before posting, so a retried verdict or a restart does not post twice. For an approval the comment is posted before the guarded merge starts reading.

The body after the headline is the note's public view: a private task, a note the review screen withheld, a note given in a private turn and a note matching a private pattern are mirrored as the headline alone. The note is bounded, control characters are stripped, and a line that looks like a verdict headline or an agent-hub message header is neutralised so a note cannot forge a second mirror.

# Read-only merge queue contract (#257)

Queue reads fetch PR numbers and bounded head/check/review/thread/file-count metadata, never remote titles or bodies. Up to16 open PRs and8 external dependency reads share a20second budget. Every linked local receipt must satisfy the existing approval floor on that current head; draft/unknown status, missing file coverage and unlinked/private work remain blocked. Same-target path intersections return counts without names. Task after edges provide the only dependency order; open predecessor PRs block current readiness, unresolved touching order asks the person, cycles/truncation remain incomplete. A board approval never substitutes for a merged-commit receipt. No queue operation changes dependencies, owns work, merges or writes GitHub.

A truncated open-PR list blocks every row because omitted PRs may change the touching order. Version advancement uses SemVer precedence, including prereleases; build metadata alone is not an advance.

Missing/incomplete file evidence, an unknown target branch or a private PR also prevents conflict coverage for other rows. Their readiness stays blocked without reading the private PR.

Queue completeness requires both full file coverage and verified target branches, even when all file pages have been returned.

Touching PRs without explicit task dependency order, and their dependent PRs, appear in unordered rather than the ordered result until the person resolves them. Independent disjoint work can still be ordered. Truncated or unknown touching coverage supplies no order; a late board revision also discards the entire previously derived order.

After intervening remote PR reads, a final bounded identity-list read must match the initial open set; changes or unavailable readback invalidate readiness and order. Empty/private-only snapshots perform no intervening remote evidence reads. Repository identity matching is case-insensitive for both holders and dependencies.

Those snapshots include every PR head, which must remain unchanged and match its observed evidence. Documentation dirtiness uses staged-tree metadata, untracked names and raw blob hashing rather than git status, so clean/process filters are never invoked. Gitlinks, large files or unsupported filesystem evidence remain unverified; transformed bytes are not declared equivalent by executing a configured helper.

Snapshot target branch names and target commit identities must also stay unchanged and match the evidence used to compute file conflicts. A retarget or advancing base invalidates the report even with an unchanged PR head.

# Read-only release report contract (#257)

Report reads bind the observed local head, committed package version, published release tag and matching local/remote commit identity. Only a verified tag ancestor defines the bounded first-parent commit list. The package-owned JSON doc checker must report freshness at that same head; open/unknown native issue metadata remains a blocker. Source readiness never certifies native acceptance or permits publication, and a changed head invalidates the report. No body, issue title, task text, version bump, restamp, tag or release mutation is included.

Merged PR identities are resolved from those post-tag commits in batches of at most 100, with at most 10 associated PRs per commit and the same shared read deadline. Repository lifetime PR counts cannot truncate the report. Missing, mismatched or paginated associations remain unknown; direct commits may have no associated PR.

The predecessor is the newest non-draft entry from GitHub's descending release list, which includes prereleases. The stable-only "latest release" endpoint is not used; an RC can anchor the next RC's tag and commit coverage.


# Delivery readback commands and surfaces (#257)

`ahub sdlc queue <owner/repository>` and `ahub sdlc release <owner/repository> [live-issue...]` are read-only readbacks, open to any agent as a public view. They also run through the existing console command path. The dashboard's Delivery evidence section uses labelled inputs and read-only buttons, textContent output and existing project/instance/generation fences; switching projects discards old reports and input. The report never changes task state or grants a permission. Private document names are removed at the Tasks public projection. Ledger issue state remains metadata, never native-success proof or release permission.

The all-project manager forwards both delivery reads through the same scoped console connection with a 30-second cap, beyond their shared 20-second read budget. Stale/unknown project or instance identities and unknown operations remain refused.

After dashboard authentication, those two delivery operations get a 35-second HTTP idle limit so Bun's ordinary 10-second limit cannot cut the report early. Other actions keep the ordinary limit.

The connection idle setting is not a guaranteed 10-second deadline for an active handler. The actual HTTP fixture records that an ordinary action also completes after 11.5 seconds; that legacy behavior is retained. The owner approved correcting only the newly added test's mistaken ordinary-action failure expectation. Manager control request caps are separate from HTTP connection idle behavior. Delivery HTTP results omit the internal control-request rid.

- Runtime doc checker ships explicitly in the npm tarball and package verification asserts its presence. Merge queue criteria readiness derives each holder's current board checklist view; absent or blocked required checklists remain unknown/blocked.

# Planner plan review (#481 S9)

A configured planner reads `hub_planner_groom` (or the person runs `ahub backlog groom`) before choosing build work. The digest reports missing text-only dependencies, repository-scoped duplicate issues and path/symbol overlaps, over-WIP owners, recorded supersession, issue edit/closed-state evidence and capability, queue or offline blockers. It proposes no board mutation. Missing repository or issue evidence stays unknown; the planner still evaluates issue rulings and the person's priorities. Private task text and references are withheld.

The planner records `hub_plan_review` with the task id, current `planningRevision` and a reason. The person's CLI is `ahub sdlc plan-review <task> <revision> <reason...>`. Tasks records the actor, planning revision, observation time and host-read issue identity/edit time. The fixed GraphQL query requests metadata only, never an issue body or comments; comment-only activity does not invalidate the body-edit receipt. Caller-supplied timestamps are refused. A changed revision requires another review except for the complete contiguous release-only history described under S11; issue identity/edit and cost-scope checks still apply. An issue edit requires another review; unavailable metadata never counts as a current review. The native CLI cannot delegate this person-attributed write through `--live-test`.

For implementation/bulk-edit tasks and an explicit build-base stage, enforce refuses an offer or acceptance without a current receipt. Advise reports the gap and off performs no lifecycle gate. Spec acceptance and planner review are independent readbacks bound to one task snapshot before acceptance. The ordinary synchronous acceptance path cannot bypass the enforce readback. A self-claim can remain assigned and proposed while its prerequisites are missing, with no offer or accepted event. A saved planner review can release previously held proposed work; delivery failure leaves that saved receipt intact.

Two board rules apply in every lifecycle mode:

- Acceptance and self-claim, including a `done` that implicitly accepts proposed work, respect the owner's effective planner WIP limit. The target task is excluded when checking capacity, and updating an already accepted plan or resubmitting changes_requested work does not consume another slot, provided its current owner accepted it after the latest ownership change. Another unaccepted offer cannot block that redo. In enforce, a changes_requested resubmission still revalidates spec acceptance and the plan review; an issue body edit requires the person to accept the revised spec and the planner to review it again before re-acceptance or done. A refusal names the owner, limit and open task ids before a board write. The existing planner capacity accounting includes owned open work and active planner-pull reservations.
- A planner or the person can return accepted but untouched work with `hub_backlog_return_untouched`, or `ahub backlog return <task> <revision> <reason...>`. A done/check/review/integration entry or recorded branch, commit, PR or local/review head refuses the return. History and planning fields remain; former role requests are withdrawn through the existing delivery path. A successful return permits replanning and pulling again without erasing historical acceptance. General unassignment and cancellation of accepted work remain person-only. Planner changes to pinned or frozen work remain refused.

Enabled lifecycles send an attached planner one grooming pointer for a changed board revision; a queued pointer is not duplicated. Proposal, approval and planning writes flow through the existing revision and task-sweep notice path. External issue changes are read during grooming, offering and accepting, rather than by a separate watcher.

The digest is bounded to 500 task rows (open work plus structured cancelled supersession evidence) and 256 findings, with at most eight issue metadata reads sharing four seconds. Spec acceptance and planner-review staleness are compared independently. Truncation and unavailable evidence are explicit. Qualified foreign repositories are compared within their own key. Without a proven repository key an absolute outside-project path remains unknown; the dedicated repository-overlap resolver is tracked in #476.

S9 ceilings: a private build task with an issue reference cannot satisfy enforce admission: privacy forbids the external issue metadata read, and no person override for a metadata-free plan receipt exists. Grooming pointers are coalesced only while queued, per board revision; there is no minimum time interval after delivery, so a busy board may produce one delivered pointer per revision.

# SDLC metrics and control bands (#481 S7)

`ahub sdlc metrics [--since <YYYY-MM-DD|ISO time>]` (the planner tool `hub_sdlc_metrics`; planner or person only, read-only) derives these from board history: time from spec acceptance to plan review, from acceptance to the first verdict and (when a merge time is supplied) to merge; the first-pass approval rate and rework rounds; the first-pass check rate; same-head CI reruns; stale-head re-reviews; and open stalls by kind. Each is a count, mean, median, p90 and max over the tasks that have it. `unknown` is the word and a count (`unknown: N`) for a task that does not have it: a metric the board cannot derive is never zero. A private task is counted as withheld and read for nothing else. The report is a pure function of the board history, so a fixture history gives the same report every time.

What each metric reads, and what it does not:

- `first_pass_check` uses the first completion check; if none exists, it uses the latest isolated run before the first done at that done's recorded head. Without matching evidence it is unknown.
- `accepted_to_plan_ms` measures task acceptance to plan review only when no spec-acceptance event was recorded. A carried spec acceptance counts as a spec-acceptance anchor.
- `stale_head_re_reviews` counts review rounds whose verdict was bound to a different head than the review was requested for (the `done`'s recorded head against the verdict's findings head), so it needs both heads on the round. New done entries record the requested commit independently of cost plans; older done entries use the cost head or the head of the bound spec report. A task with no such round is `unknown`, not 0. (A `done` after an `approved` is not a signal: the board cannot produce one.)
- `acceptance_to_merge_ms`, `same_head_ci_reruns`, `ci_runs_at_merge`, `github_reviews_at_merge` and `review_rounds_at_merge` come from the merge-time readback. The guarded merge (`ahub sdlc merge`, or the auto-merge after an approving verdict) reads the merged PR once, after the merge is observed, and records on the task's merge record `cost: { mergedAt, ciRuns, ciReruns, reviews }`: CI runs linked to any head of the PR (an attempt after the first of one run id is a rerun) and distinct GitHub reviews. When GitHub omits a run's link to the PR, the runs are the PR branch's complete pull-request run inventory between the PR's creation and its merge, read only for a same-repository head on a branch no other overlapping PR uses (#1584); incomplete pagination or ambiguous branch ownership keeps the figure unknown. The read is bounded (8 s, the same fixed queries as `ahub sdlc costs`), host-written and never a tool input, and it never decides the merge result. A CI figure is known only when the run list was complete, and a failed or partial read leaves the field `null`; a task whose merge was not read, merged before this record existed or merged by hand where the host did not observe it, is `unknown` for all of them, never 0. A PR merged outside the hub while its repository's merge mode is `off` is observed by the host for an approved task (`mergeReadback`, #1555: a pass every 5 minutes that reads at most three tasks and reads a task again no sooner than 10 minutes later, for 24 hours after the approval; only a merge at the reviewed head is recorded) and supplies the same figures when its cost read completes. `review_rounds_at_merge` counts the task's review handoffs (`done`) up to the merge. `merged` in the report says how many counted tasks have a read merge and how many do not. `ahub sdlc costs` still carries the per-PR cost table with its own scope.
- `stalls` counts open stalls on public tasks by kind and the dones recorded without writes.

`.agenthub/sdlc.toml` may set `[bands.<metric>]` for `acceptance_to_plan_ms`, `acceptance_to_first_review_ms`, `first_pass_approval`, `rework_rounds`, `first_pass_check`, `stale_head_re_reviews`, `hotfix_rate` or `security_open_alerts`. Every field is optional and bounded: `window` (4 to 200, default 20), `min_samples` (3 to 200, default 8, at most `window`), `log_sigma` 2, `diagnose_sigma` 3, `propose_sigma` 4 (ordered, 0.5 to 20), `drift_run` (3 to 50, default 6) and `min_delta` (the smallest step worth any tier: an hour for the times, one round, half a rate). An unknown metric or field is refused with its path. The newest value is compared with the mean and population standard deviation of the `window` values before it, on the bad side only (a longer time, more rework, a lower rate). The deviation is floored per metric (half an hour, or half a round or a rate) so a flat baseline does not turn one step into thousands of deviations. Fewer than `min_samples` before it fires nothing, and so does a step under `min_delta`, drift included. A run of `drift_run` newest values all more than one deviation on the bad side is at least `diagnose` even when none reaches a sigma tier, provided the newest step clears `min_delta`. Tiers:

- `log`: one hub notice per breach episode, remembered in the board database so a restart does not repeat it.
- `diagnose`: one read-only `triage` backlog task for the planner to inspect the histories behind the metric. It asks for no edit of files, branches or the board.
- `propose`: one `plan` backlog card that names the metric and its evidence (the newest value, the task that produced it, where the episode began, the baseline and the deviations).

`rework_rounds` and `stale_head_re_reviews` are final only when a task is approved: a task still in flight is `unknown` for both and the series places them at the approval, so a provisional value cannot move and start a second episode inside one shift. The stale-head count compares the head a `done` requested with the head the verdict is bound to; the verdict head prefers the lifecycle receipt's `head` or `localHead` over the commit, so a task whose receipt head and commit disagree can read one spurious stale round. Release metrics (interval, lead time, hotfix rate) and the `hotfix_rate` band are built (see Release metrics below); only the per-release gates-run record is not, because it needs gate-execution evidence the S6 authorization path would supply. A breach is an episode: the run of non-ok values of one metric, keyed `<metric>:#<task, release or scan that started it>:<tier>` in the card (`Band breach key:`). The key comes from history alone, so a sustained shift keeps one key however many tasks finish inside it, and a restart finds the same one. A metric with an open band card (a backlog or open task, not approved or cancelled) writes nothing more, so a value that grows from `diagnose` to `propose` inside one episode adds no second card. When the planner closes the card and the metric returns to ok, a later breach is a new episode and a new card. The daemon evaluates every five minutes, only when the board or the band configuration changed since the last evaluation that ran, and not while it is stopping or recovering or has a storage error; a held pass, mode off or no bands consumes nothing, so the breach is written when the hold clears. A failed evaluation is one `hub.log` line. Detection never calls a model, the cards hold fixed words, numbers and task, release or scan ids and no task text, and the hub opens no GitHub issue: external registration stays a person's decision.

Bands act only when the lifecycle `mode` is `advise` or `enforce`: in `off` the writer is idle, though `ahub sdlc metrics` still reports each configured band's tier.

Two bands are not made of tasks. `hotfix_rate` has one point per shipped release (1 for a hotfix train, 0 otherwise); a shipped release with no recorded train history is left out, never a 0, and a release whose scope holds private work is left out too. `security_open_alerts` has one point per recorded security scan. Their breach cards name the subject (`release #N`, `security scan #N`) instead of a task, with the same key format, one card per episode and the same open-card rule.

## Release metrics (#481 AC12)

`ahub sdlc release` (the readiness report) and `ahub sdlc train report <release-id>` show release interval (the time between consecutive shipments), lead time from a task's final approval to the release that shipped it, and the hotfix rate (hotfix trains over shipped trains with recorded history). They are computed from the shipped releases' recorded train history and the board's task history by `releaseMetrics`, with unknown kept `null` and named (`1 release without complete history: #2`): a release shipped before train history was recorded, or a task with no approval before the ship, is unknown, never 0. Releases whose scope holds private work are left out. A band on `hotfix_rate` proposes a planning card (see Control bands). The per-release gates-run record is not built: it needs gate-execution evidence the S6 authorization path would supply, and a cut record is not that evidence.

## Security-scan baseline (#481 S7)

The hub runs no scanner and invents no control. `[security_scan]` in `.agenthub/sdlc.toml` makes it read the open-alert counts GitHub already holds for the repository and record them as a baseline:

```toml
[security_scan]
sources = ["dependabot", "secret_scanning"]   # nonempty, from dependabot, secret_scanning, code_scanning; there is no default
every_h = 24                                  # 1 to 720, default 24
# repo = "owner/name"                         # default: the project repository
```

Nothing is scheduled unless this table exists, and a lifecycle `mode` of `off` schedules nothing. The daemon checks hourly whether a scan is due and, when it is, reads each named source with a fixed `gh api repos/<repo>/<source>/alerts?state=open&per_page=100 --jq length` (paged to at most 1000 alerts, 20 s in all) and keeps only the counts: one `security_scans` row of counts per scan, never an alert's text, package, path or location. A source GitHub will not read (not enabled, not permitted, over the cap, a failed call) makes the row's total unknown, and an unknown total is not a point in the series: a repository with nothing readable records nothing useful and never reads as zero alerts. The scan is held like every host writer (stopping, recovery, storage error) and judged again after its read, so a configuration or hold that changed meanwhile writes nothing. A repository identity that matches a privacy pattern is never scanned.

The `security_open_alerts` band judges the total over the preceding scans like every other band, and a breach is one `log` notice, one read-only `triage` task or one `plan` card keyed `security_open_alerts:#<scan>:<tier>`, naming the scan and the counts and no alert. Without a `[bands.security_open_alerts]` table the scans are recorded and shown, and nothing is judged.

# Planner review and CI cost governance (#481 S10)

At plan review, batch small related fixes into one area branch and PR; keep release preparation separate from feature work. A plan can name `review: {scope: "none" | "delta" | "full", reviewers: N}` and `ci: "focused" | "full" | "reuse"`. None requires zero reviewers; delta/full require one to eight. These are expected costs, not permission to bypass the task's reviewer, CI or privacy gates. Use one reviewer for a small change; split a large review by area with one receipt owner. After a fix, review the delta against the previous findings. S2 will compare planned scope with completed coverage.

The planner can provide scope with `hub_plan_review`; the person can run `ahub sdlc plan-review <task> <revision> <reason...> --review full --reviewers 1 --ci full`. Tasks records the explicit scope on the plan and its revision-bound receipt. A file-list update retains omitted cost fields; an explicit scope change cannot replace a reviewed scope during enforce acceptance. Old plans and receipts remain unspecified and are never filled by guessing. Advise reports missing scope. In enforce, every newly recorded receipt needs both scopes; an existing scope-less receipt remains valid until a non-release planning revision changes, with the same complete-history exception under S11. Enforce acceptance cannot add owner-supplied cost keys to that legacy receipt; the planner must record an explicit scope first.

A review request is premature if its task head does not match the PR head, configured required checks are not green, or a pending bot thread is unanswered. A resolved thread is settled; an unresolved one needs a user reply after its last bot comment. The hub reads identity, timestamps, authorship type and resolution only, never comment bodies. Without explicit required checks the native floor is both OS checks plus `seeded guards` for `STAIxBWLB/agent-hub` only; another repository reports `required checks unknown: set required_checks in .agenthub/sdlc.toml` (#1344). Advise reports the gap; enforce refuses before the requesting done/cohort writes. If only quiet task-history events arrive during an advise readback, the evidence is discarded and review continues with unknown readiness, without another external read. A reviewer change is allowed because the reviewer is re-derived before the write; it is not an authority or readiness receipt. Mode, owner, privacy, receipt, authority and other history drift still refuse; enforce remains unchanged. A private turn may finish its own PII task in advise with a generic unknown-readiness notice and no remote metadata read; the private-turn refusal for ordinary work remains. Delayed checks revalidate before completing; a refused completion sends a private-aware notice to call `hub_task_done` again only while the task is still in progress with the owner that started the check. Otherwise only the console notice is recorded. Background roster/quota role changes remain fact, but enforce holds a new review envelope without an admission readback; refresh it through a manual reviewer assignment after CI and replies are ready. The brief and verdict coverage belong to #520, separate from this admission.

**Evidence in the review request (#824).** A fresh reviewer cannot run tests or read `gh`, so the request carries the hub's own reading of the admission it already made, for every reviewer: `Hub-verified at <head>: required checks <names> passed at this exact head; no bot review thread is waiting for a reply` (plus `via identical-tree run <n>` when the hub reused one), or in advise mode `Hub-verified at <head>: not ready: <blockers>`. No admission (lifecycle off) and a PII task get no block, and no new `gh` call is made for it: it renders what `reviewRequestAdmission` read. `ReviewReadiness.checks` names the required checks that were judged. When the admission is ready and the hub ran no check of its own, the checklist's check line says CI passed at this exact head and that test execution or CI evidence is not an unmet item (name a specific missing test or behaviour instead); otherwise the old wording stays. The text comes only from the hub's reads and recorded `check passed` events, never from the builder's summary or a `hub_sdlc_record` claim, and a review-only reviewer still gets no builder summary (#223 R2).

CI controllers are serialized per pull request (`check-pr-<number>`) and for main pushes and ordinary dispatches (`check-main`), for the entire workflow (#609); macOS timing dispatches use their own macos-timing group. Within a PR a newer head replaces the older run: `queue: single` replaces a pending one and `cancel-in-progress` (pull requests only, #1490) cancels an in-progress one, and a cancelled run is never a full-gate proof because reuse needs all three required jobs to have succeeded. A draft PR does not start the macOS shards and its required `check (macos-latest)` fails with "macOS deferred" (never a skip, which a proof could borrow); `gh pr ready` starts a run that includes them. Main never cancels and keeps `queue: max`, which preserves up to 100 waiting controllers ([GitHub concurrency documentation](https://docs.github.com/en/actions/how-tos/write-workflows/choose-when-workflows-run/control-workflow-concurrency)). Different PRs run side by side: a repository-wide lock serialized every PR (17-18 min alone, 40-54 min with 4-5 PRs in flight on 2026-10-20). Two groups admitting the same tree at the same instant can run it twice; that duplicate costs one run and never a false green. Required job names and read-only token permissions are unchanged. Before PR or push gates, `scripts/ci-reuse.mjs` reuses successful full proof for the identical Git tree, including its workflow. On reuse the shard jobs are skipped, and the aggregate jobs `check (ubuntu-latest)`, `check (macos-latest)` and `seeded guards` report their exact required names. They run only a `Reuse verified identical-tree full gate` marker step naming the original proof; full setup and gates are skipped. Skipped jobs and successful reuse-reporting jobs never count as fresh full proof. A running identical-tree gate refuses duplicate admission; unknown active coverage refuses safely. Only a 404, a timeout on the individual read limit, or malformed successful proof is dropped: a failed successful-run list drops that proof phase, while a failed commit or jobs read drops only that candidate and continues the bounded search. Other failures (5xx, 403, 429, response size bounds, authentication and unclassified errors) remain unknown. Exhausting the overall deadline or request budget stays unknown even when a request reports a timeout. Without verified proof, a complete empty active scan requires a fresh gate. An unreadable, truncated or unidentifiable active inventory, or exhaustion of the shared request budget or deadline, stays unknown and refuses admission. The release reader (`--require`) still refuses without verified identical-tree full proof. Metadata reads are bounded to 100 recent successes/active runs and 240 calls within 60 seconds. Pending serialized controllers are not admitted gates. Run focused tests and `scripts/check.sh --changed` locally; CI carries the full-suite gate; a known flake warrants only one rerun of its failed job with recorded evidence.

`hub_sdlc_costs` and the person's `ahub sdlc costs [owner/repo]` report linked merged PRs without changing the board. A review round is a board done-to-verdict handoff, not each reviewer in a multi-reviewer round. An observed handoff still counts when its declared scope was none. The report counts distinct check-workflow run ids, extra attempts (`run_attempt - 1`), full re-reviews, delta rounds and summed review intervals, with GitHub review counts alongside them. Unspecified scope and unavailable evidence stay unknown/incomplete. Only current public links are projected; a private counterpart withholds the whole PR. Up to 16 linked PR reads share 20 seconds; each PR covers at most 100 commits, reviews and recent check-workflow runs, and the pure aggregator bounds 500 tasks, 200 PRs and 10,000 history entries. Truncation is explicit. S10 exposes pure band-breach proposal data; S7 owns rolling baselines, band configuration, automatic scheduling and board-card creation.

The S10 policy ceilings are settled in the spec: hub task #284 implements the lost-proof admission rule, #285 owns thread-author classification, and #286 implements quiet-only advise drift and delayed refusal notices to the same check owner while the task remains in progress. The per-PR queue is already in place (#609).

# Planner release trains (S11)

Release scope stays on each task's existing `release` planning field. `hub_release_new` creates a future planning row; `hub_release_configure` activates it, sets its planned cut date, or records an enumerated hotfix cause. Only one train may be active or frozen. Future planning rows remain available so unfinished work has a next-train destination.

`hub_release_assign` changes only a task's release, including approved or in-flight work. It retains execution state, owner, reservations and dependencies. It requires the current planning revision and a reason. Public reasons are screened; private or pinned work requires the person. A private reason stays on the board with a withheld history marker and never goes to the model screen, including when approved work is rolled out of a train. Public readiness/cut still refuses a scope containing private work; frozen or settled scope cannot move through this operation. Release-only planning revisions retain the S9 plan review only when the complete intervening planning history changes exactly the release field; other planning changes still invalidate it. The existing general backlog planning rules remain unchanged.

Use `ahub sdlc train report <release-id>` to see planned task identities, approval readiness, due trigger and recorded release metrics. `ahub sdlc release-assign <task> <revision> <release-id|none> <reason...>` is the person's CLI for assignment. A planner uses the corresponding hub tools under its own identity. `ahub sdlc train configure <release-id> <revision> '{"state":"active","cut":1792500000000}'` activates a future train and optionally sets the UTC epoch-millisecond cut date.

A train becomes due when its tasks are approved or its cut date arrives. A date never clears an unfinished task: move it to the next planning row with a reason before cutting. `hub_release_cut`, or the person's `ahub sdlc train cut <release-id> <revision>`, freezes a nonempty, fully approved scope. Scope and authority are checked again after cost/admission reads and in the final database transaction. Cancellation does not count as approval.

The cut obtains a short repository lease through the installed host `dot admit` controller, checks the shared gate lock, and retains the lease until scope freeze. The controller is resolved outside the project, its command is fixed, and missing/expired/unknown admission defers. The daemon checks fresh account quota headroom for attached peers with a real source (a registered `budget.reader`, or an enabled soft-token limit), including shared instance accounts; unknown/stale readings from those sources defer. Registered accounts without a configured source report `no quota source` rather than deferring on absent readings; an unknown external account still requires evidence. Budget-record and manual pauses still defer for every attached peer. This metadata lease does not authorize a build. Each later heavy preparation step needs its own admission. The cut neither publishes nor tags, and it never substitutes for S6's person authorization or native verification.

A hotfix records one cause and why it cannot wait: `loss`, `security_privacy`, `upgrade_start_blocked`, or `core_flow_no_workaround`. These mean data/message loss, a security/privacy defect, blocked upgrade/start, or a broken core flow without a workaround. Hotfixes keep every scope, quota, resource, review and CI gate. Their branch starts at main and contains the fix and regression only; unrelated work belongs in a future train.

Release history records the frozen task ids and actual cut/shipment times. CI resource counts read only the planned scope's PRs at cut (at most 16 distinct PRs in one repository, run attempts included); failed reads or a larger/mixed-repository scope leave the count unknown; board review verdict counts are recorded separately. Missing PR links, incomplete reads and legacy history remain unknown. Metrics derive shipment intervals, approval-to-shipment lead time, hotfix fraction among shipped releases, and recorded resource counts. They do not infer success from an absent record. Release-preparation PR costs and future S7 band automation are separate evidence, not guessed counts. The per-release "gates run" record is deferred to S6/S7; frozen scope and resource counts do not prove that gates ran.

Legacy release rows omit train metadata. The old off-mode planning APIs keep their shape; explicit train operations always enforce their stated board/resource rules. Enabled lifecycle freeze, and any configured train freeze, must use the admitted cut path. Ship/drop remain person-only. The existing person-selected upgrade/recovery operation and its readiness/completion checks remain separate from a cut; a source gate is not an upgrade receipt.

Person ruling 2026-10-19 supersedes the earlier S11 upgrade-admission ruling: upgrades remain outside S11 host-admission, quota and additional all-idle gates. Recovery uses its pre-S11 `recoveryReady()` checks: no busy peers, pending approvals resolved and completion checks settled, with the existing operation-identity and lifecycle fences. A quota/manual pause, missing or shadowed `dot`, or an outer same-repository admission lease adds no S11 upgrade refusal. The person-selected operation remains the confirmation; no extra receipt or agent upgrade authority is added. Release-cut host and quota admission remains unchanged.

Configured cut dates must be positive safe UTC millisecond timestamps; the train tool does not accept null to clear a date. A configured active/frozen train also requires a recovery target advertising `release_trains`, so an older daemon cannot silently drop the safeguards after restart. Target proof is checked before preparation and again before commit; queued future planning rows and legacy rows retain their existing compatibility.

Release-cut refusals name the applicable exits: stop or resume a paused peer, adjust `ahub budget set`, or drop the train with `ahub release drop`. Install the resource controller or fix PATH when `dot` is unavailable or shadowed; retry the cut outside an outer admission lease when nested admission is refused.

Train history retains at most 256 events. Configuration no-ops retain the revision and history; meaningful configuration reserves the final two slots for cut and shipment. Capacity refusals occur before effects; an already exhausted legacy train requires a person-selected replacement.

## Structured review findings (#481 S3)

`hub_review` accepts optional `findings`, or the person can pass JSON with `ahub review <id> <verdict> --findings '<json>'`. Each item has a stable `id`, `pass` (`bugs`, `security`, `compliance`), `severity` (`important`, `nit`) and `disposition` (`open`, `fixed`, `false_positive`, `accepted`), with optional `path` and `rationale`. Only the person can use `accepted`, with a non-empty rationale. Reports have at most 64 findings and 64 KiB; ids, paths and rationale have bounded lengths. `max_nits = 5` in `.agenthub/sdlc.toml` sets the report's nit cap (0..64), including in off mode.

Verdict history retains each report and its reviewed head. Within a task, the semantic id remains the finding identity when its pass is reclassified; a disposition for that id settles the same finding across passes. Open Important findings carry forward across heads until a reviewer explicitly sets fixed or false_positive, or the person sets accepted with a rationale. Omitting an id never settles it; nits stay on their original head. Review requests list carried public ids, pass, severity and optional path; private finding details stay withheld. Head selection uses the first valid full SHA from the PR head, reviewed head, local head, then commit metadata; unresolved non-empty reports refuse in enforce. A supplied head must match the resolved task head when one exists, and that resolution is rechecked after asynchronous screening. Status and the merge queue show counts for the current head. In enforce, approval refuses while any Important finding remains open; advise exposes the count without blocking. Existing verdicts without structured findings stay compatible.

With the lifecycle on (`advise` or `enforce`; #1403 A1, B4), an item may also carry these fields, and `off` refuses them as unknown fields and advertises none of them:

- `state` (`confirmed` or `needs_validation`) and `boundary` (`principal`, `control`, `resource`, `result`: the lower-trust actor, the control that was meant to hold, the resource affected and the result observed, each at most 512 bytes and sanitized like `rationale`). An open `important` finding with `pass: "security"` must carry both, and the refusal names the four boundary fields; nits, other passes and settled findings need neither, and the fields are refused on them.
- `blocker` (the missing fact), required with `needs_validation` and refused with `confirmed`. A `needs_validation` finding is a source-grounded hypothesis: it does not block approval in any mode and is counted apart (`needsValidation` in the findings tally), and on approval the hub files one read-only `triage` backlog card that names the blocker.
- `origin` (`introduced` or `pre_existing`; omitted means `introduced`, so existing reports behave exactly as before). A `pre_existing` important finding does not block approval and does not carry to a later head (it is counted as `preExisting`); on approval the hub files one `plan` backlog card for it. A later `open` report of an id that still blocks cannot lower it with `pre_existing` or `needs_validation`: only an explicit disposition settles it.

Each follow-up card carries a `Finding follow-up key:` marker (task, pass, id, kind) so an approval repeated by another verdict never files a second one. A card names the task, the finding id and pass and, for a hypothesis, its blocker; never the boundary text or the path, which stay in the task's review history under the privacy boundary below. The hub opens no GitHub issue for a security finding. PII and private-turn tasks, withheld reports and findings whose text the privacy gate refuses get no card.

Finding text passes through the task privacy boundary. PII tasks remain stubs; withheld reports expose only counts on ordinary tasks. When the same public, non-withheld semantic pass/id pair appears on a second distinct task, Tasks proposes one durable, marker-deduplicated backlog plan (excluding false positives) to amend AGENTS.md or an area note. A positional id (a single letter or a label word such as `nit` followed by digits, optionally after a pass prefix: `N1`, `F5`, `nit-1`, `bugs:3`) is local to one review and never counts toward that card; only a semantic id recurs. Only hub-proposed plan cards supply dedupe markers. The proposal grants no editing or acceptance authority.

## Plan conformance (#481 S2)

Plans accept optional `proof` (test paths or check names) and `risks`, each at most 32 strings of 512 characters. They share the task-text privacy screen; enabled SDLC schemas advertise them while ordinary off-mode schemas stay unchanged. File coverage compares repository-relative identities for literal file or directory prefixes in `plan.paths`, with no glob expansion. Repository-root entries (including normalized `.` or `./`) never cover the inventory and leave conformance unknown. Absolute entries map only through verified same-repository aliases; an unverified mapping remains unknown. Symbols, proof and risks do not cover files. A planned path left untouched is advice; a changed path outside the plan is a departure. Missing plans, unsafe or unmappable paths, truncated inventories, renamed/copied files without both path identities, and failed metadata reads remain unknown.


With the lifecycle enabled, a plan also accepts `base` (the full lowercase 40-character commit it was written against), `out_of_scope` (excluded literal paths), `stop_if` (conditions to stop and report), and ordered `steps` with a required `description` and optional `verify` text containing the command and expected result. Each list holds at most 32 items; each exclusion, condition, description and verification text is at most 512 characters. These fields share the task privacy screen and stored plan revision. Verification text is never executed by the hub. A changed file under `out_of_scope` is a departure even when a broader `paths` prefix includes it; review/status and merge queue use the same exclusions.

`hub_task_accept` and `hub_task_done` report `drift: none`, `drift: changed (<paths>)` or `drift: unknown` when the plan has a base. At accept, this compares only `plan.paths` from the exact base to the local remote-tracking default-branch tip, resolved through `refs/remotes/origin/HEAD`; no task head is required. At done, the endpoint is the unique merge-base of the recorded task head (`refs.commit`, otherwise its recorded lifecycle head) and that default tip, so task-owned commits are excluded. The base must be an ancestor of the selected upstream endpoint; reversed or unrelated lineage stays unknown. The bounded local Git source validates commit objects, rechecks the default tip and lists changed names without fetch, network, lazy object fetch or patch reads. Missing default refs, missing done heads, shallow/missing/ambiguous history, foreign scope, incomplete or unsafe inventory, and failed reads stay unknown. The checkout HEAD and a guessed `main` branch are never substituted. The tip is the local tracking ref, not a claim of freshness from a remote server. Private tasks/turns disclose no drift. Drift is advice in both advise and enforce and never blocks acceptance, completion or approval. Drift includes changes under an excluded path when it lies inside `plan.paths`: the exclusion makes the change a conformance departure rather than hiding it from base drift. Drift is separate from PR conformance and its existing approval gate. Off-mode tools advertise none of these new fields, ignore them on input, and add no drift read or readback.

Review/status use the same bounded PR file metadata reader as the merge queue; no patch or body is fetched. In enforce, approval requires known coverage of every changed path or a current person acceptance of the departure. Request changes, amend the plan through `hub_task_accept`, and call done again before approval. Off adds no conformance gate; advise reports departures without blocking.

The person may instead run `ahub sdlc accept-departure <task> <head> <reason...>`. Acceptance requires a currently known departure, never unknown or already covered conformance. The hub reads and captures the complete current repo/PR/head inventory, verified task repository scope and the plan fingerprint/revision; changing the plan, repository refs/scope, link, head or inventory invalidates that acceptance. Departure consent also expires on hub restart: amend the plan or accept again in the new host lifetime. This fail-closed ceiling prevents a rejected, unpersisted readback from reviving old consent; a durable host observation journal is the upgrade path. The reason is bounded to 2048 characters, sanitized and privacy-screened. There is no peer tool or live-test delegation for this person-only operation. Private PR inventories are unavailable to this remote readback; amend the private plan instead. Public private-task projections show only whether a departure acceptance exists.

The report names "plan revisions after the first observed push". Host-authored content revisions live in task history, independently of backlog `planningRevision`. The first verified remote head records the current revision/fingerprint; earlier pushes are explicitly unknown. Pending observations persist only with successful owner/reviewer transitions; status and queue reads do not append board history. Off mode captures no S2 observation or content revision. Plan edits made while off therefore do not count in revisions after the first observed push when reporting resumes. Revoking an existing person acceptance on a plan change still persists its invalidation, including while reporting is off. If startup loses a pending observation, the earlier interval remains unknown. This observation boundary is a ceiling until a webhook or Actions push receipt provides a true push-event source.

## Test integrity (#481 S4)

When mode is enabled, the linked issue's complete label metadata decides applicability: `bug` (case-insensitive) requires S4, known non-bug labels exempt it, and unavailable labels are unknown. No issue title/body or patch is read. Enforce blocks entering review and approval for unknown applicability, missing/invalid proof, incomplete file metadata, or modified/deleted pre-existing test files. Advise exposes the same report without blocking; off adds no S4 receipt or readback.

Record `redFirst` with two legs through `hub_sdlc_record` or `ahub sdlc record`. Both use the same bounded `check` name; `red` has `result: "failed"`, `green` has `result: "passed"`, each with `source: "local" | "container" | "ci"` and a full lowercase commit SHA. The red commit must occur in this PR, have one parent, and add only recognized test paths. Its preceding single-parent ancestry inside the complete PR commit set must touch only test paths, so implementation commits cannot precede red. Merge/ambiguous ancestry is refused. The green SHA must equal the current PR head. Local/container results remain labelled claims, CI legs require the named failed/passed CheckRun observed on their exact commits; agent-posted StatusContext entries cannot establish CI evidence. `checkEvidence` labels each leg `claimed` or `observed`; `redFirst: verified` describes validated structure and supplied results, not independent observation of local/container execution. CI cancellation, timeout or skipped results do not prove red-first failure. Relinking the repo, issue or PR drops the proof unless it is explicitly supplied again. In enforce, only the person may change an established repo/issue; an owner/reviewer may fill missing identity or relink the PR. This identity boundary also holds before the first read and after restart, so an owner cannot evade S4 by swapping a bug issue for a non-bug issue. Advise/off keep existing relink authority.

Example receipt (replace both SHAs):

```json
{"redFirst":{"red":{"source":"local","head":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","check":"bun test test/regression.test.ts","result":"failed"},"green":{"source":"local","head":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","check":"bun test test/regression.test.ts","result":"passed"}}}
```

Status/explain and merge-queue rows expose `testIntegrity` with applicability, red-first state, file-inventory state, source labels and modified/deleted test paths. Added tests are allowed. Test paths are under `test/`, `tests/` or `__tests__/`, or have a supported `.test`/`.spec` suffix; conventional `*_test.go`, `test_*.py`, `*_test.py`, `*_spec.rb` and `*Test.java` names also count. Renames/copies, unsafe paths, missing change types and truncated inventories stay unknown. Private tasks and metadata rejected by the current host privacy policy expose a neutral unknown report; receipt metadata is screened again on public output.

Reads share the existing 20 s lifecycle/queue allowance and fixed argument/output caps. Labels and check contexts are bounded to 100 each, PR commits to 100, and the red commit to fewer than 100 changed files; larger proof is unknown rather than silently accepted. The queue revalidates every linked issue's applicability with its final PR snapshot (up to 32 distinct issues). Metadata cannot detect a later commit gutting assertions in a test added by the PR; content-aware review remains required. These metadata/claim receipts do not prove a native/container run by themselves; no live advise-through-release receipt is claimed.

## Eval gate for agent configuration (#481 S5)

Suite choice pending the person. This slice wires the gate only. It chooses, creates and defaults to no eval suite: `eval_check` has no default, and until the person names one a configuration PR shows `eval check not configured` in its status and advice (never a silent pass) and nothing is required of it, in any mode (#251 and #266 own the suite and its smoke subset).

`.agenthub/sdlc.toml` takes two optional keys, read at hub start:

- `eval_check = "<check name>"`: the one check a configuration PR must have passed on its current head. One nonempty name of at most 120 characters.
- `config_paths = ["AGENTS.md", "docs/agent-notes/**", ...]`: the patterns that mark a PR as a configuration change. At most 32 unique repository-relative patterns of literal names, `*` and `?` inside one segment, and a whole-segment `**` (`dir/**` matches everything under `dir`, never `dir` itself). Absent means the defaults: `AGENTS.md`, `docs/agent-notes/**`, `templates/**` (role texts and profiles), `.agenthub/roles/**`, `.agenthub/routing.toml`, `routing.toml` and `src/hub/hub-tools.ts` (the hub tool definitions). A list replaces the defaults, and an empty list turns the gate off. Bad values refuse at load with a field path.

A PR is a configuration change when any of its changed files matches. The decision uses the PR's complete file inventory (metadata, never patches): an incomplete or truncated inventory is `eval gate: PR file coverage incomplete or unknown`, never a clean code-only PR. A code-only PR is unaffected: no extra required check, no eval read, no `evalGate` in its status or queue row, and off output stays byte for byte.

For a configuration PR with an `eval_check`:

- The check joins the required checks on every reading: `ahub sdlc status`, the review and approval gates, the merge queue and the guarded merge decision (`required check evals: ...`).
- The hub reads that check run once at the exact head (fixed argv, at most 32 KiB of output and 10 s, one completed run of that exact name at that head, else unknown) and keeps only two values from its title and summary, `eval_pass_rate=<0 to 1>` and `eval_suite=<version>`. No other text is stored or shown.
- `evalGate` in status and queue rows shows the check, its state, how many changed files matched, the pass rate and the suite version. A verdict that approves a passing check appends `Eval gate: <check> passed at <head>, pass rate <rate>, suite <version>` to the approval note, which is the recorded pass rate and suite version.
- With an `eval_check`, a passing check that reports no pass rate or suite version and unknown file coverage are gaps. Advise shows each in `evalGate.gaps` and in the review advice notice and never blocks on it. Enforce adds each to the blockers, so the review, approval and merge gates refuse.
- Without an `eval_check`, the gate is a note (`evalGate.notes`, `state: not_configured`) in every mode and never a blocker: an existing enforce setup gains no refusal until the person names a suite. File coverage is not judged then.

The guarded merge reads the eval check run before its final PR read and judges that last reading with no remote await in between, so a change request, thread, draft or check that moves during the eval read refuses. A passed eval check on the last reading with no result read (the PR entered configuration scope after the read) counts as unreported.

A private (PII) task reads no eval metadata and records none.

## Security pass for sensitive paths (hub task 895, #1403 A2)

`.agenthub/sdlc.toml` may name the paths whose change needs a recorded security pass:

```toml
[security]
paths = ["src/local/**", ".github/workflows/**", "scripts/release-*"]
companions = ["agents", "local-ipc"]
```

- `paths` uses the `config_paths` pattern language (literal names, `*` and `?` inside a segment, a whole-segment `**`; a trailing slash or a bare prefix is refused at load with the language spelled out). `companions` is optional, a unique list from `agents`, `supply-chain`, `local-ipc` and `data-isolation`; it names which parts of `docs/agent-notes/security-review.md` the reviewer reads. No `[security]` table, or `mode = "off"`, changes nothing and `hub_review` does not advertise `security_pass`.
- The decision uses the PR's complete file inventory, the one plan conformance reads (metadata, never patches). `securityPass` reads `required` (a changed path matches and no pass names the PR's current head), `recorded`, `not_required` (the complete inventory matches nothing) or `unknown`. An incomplete or unreadable inventory is `unknown`, never `not_required`. The readback carries a count of matching paths and the companions, never the path names.
- A reviewer records the pass on the verdict: `hub_review` `security_pass: {covered: [...], not_covered: [...]}` or `ahub review <id> approved --security-pass '{"covered":["local runner"],"not_covered":[]}'`. It names at least one unit (up to 32, 120 bytes each, no unit in both lists), so a partial pass says what it did not read, and it binds to the head the verdict reviewed: a later head needs a new pass. A pass on a PR that needs none is stored and harmless.
- `advise` records an approval without a pass and adds the requirement to the advice. `enforce` refuses the approval (before any board effect) and blocks the merge queue row and the merge gate, for `required` and for `unknown`. The review request tells the reviewer a pass is required, or that applicability is unknown, and points to the checklist. PII tasks carry no pass.
- `ahub sdlc status` and the merge queue show a `security pass` line; the queue shows the strictest state when a PR has several holders.

## Security audit with a coverage ledger (hub task 896, #1403 A4, A5)

A recurring, read-only read of the security-sensitive surfaces, on request. It needs the lifecycle on (`advise` or `enforce`) and the `[security]` table above.

- `ahub sdlc audit start [--profile quick|standard] [--since <ref>]` (the person, or the one configured conductor) files one `review`-class task and seeds the ledger in `hub.db`: one unit per `[security] paths` surface and companion, `planned`. `standard` reads each surface against each configured companion; `quick` reads each surface once against the general checklist. `--since <ref>` keeps only the surfaces with a changed path since that ref. One audit is open at a time. A refusal (wrong caller, lifecycle off, no table, an unreadable head or change list) writes nothing.
- Only the hub writes the ledger. The assigned auditor (the task's owner, while it is in progress) reports through `hub_audit_report`, advertised only with the lifecycle on: `units` (`covered`, `deferred` with a reason of at most 200 bytes, or `out_of_scope`, never `planned`) and `findings` in the `hub_review` shape with `pass: security` and the boundary contract of the findings section. A report is one transaction, and a unit or finding that fails validation changes nothing.
- A `confirmed` important security finding is a `candidate` until a different reviewer-role peer (or the person) sends `verify: [{finding, verdict: verified|rejected}]`. The finder cannot verify its own finding, and a decided finding is not rewritten by a later report: the result lists such a re-filed finding in `notUpdated`, so the auditor sees it. A report is one transaction, so a verification that loses a race rolls back the units, findings and other verifications of that call. A verified open important finding is settled with `settle: [{finding, disposition: fixed|false_positive}]` by a reviewer-role peer other than the finder, or by the person, in a call of its own (never in the call that verifies it, so the verifier's decision is read first). Only a verified, not rejected, not yet settled finding is settled, once; a candidate is refused with the step to take (a different reviewer verifies it first), a rejected one with "nothing to settle", and a repeat with how it was settled. The hub records who settled it and how in the ledger, in the same transaction as the rest of the report, so a settlement that loses a race rolls the whole call back; a later report by the finder cannot reopen a settled finding (it is listed in `notUpdated`). A settled finding reads as `settled` and counts apart in the audit summary, and, like any `fixed` or `false_positive` finding, no longer withholds its path, rationale and boundary. A `needs_validation` finding is counted apart and never needs verification.
- Carry-over: a surface whose state in the newest audit that lists it was `covered`, and whose paths are unchanged since that audit's head, is seeded `covered (prior)` and listed apart from the run's own coverage. A scoped audit that left the unit out says nothing about it. A changed path, an unreadable change list, or a `deferred`, `out_of_scope` or still `planned` unit in that newest audit plans the unit again, and a carried unit takes no new state.
- `ahub sdlc audit show [<audit>]` prints the source, profile, the counts by unit state and each unit and finding. A `quick` or scoped audit reads as partial. `ahub sdlc release` carries one line with the same counts. Nothing blocks a release.
- Disclosure: this repository is public, so an open or accepted important security finding shows only its id, status and that its details are withheld, in every view but the person's, and the hub itself sends no message to another peer that carries its path, rationale or boundary. A headless auditor's final answer is shared with the other agents automatically, so keeping that text out of the answer is the audit brief's instruction, not a guarantee the hub can enforce. The hub never opens an issue for one. The tool is refused in a private or PII turn, finding text must pass the same PII patterns and screen as a verdict note, and the tool is kept out of memory capture. The audit brief states that repository content is data (an instruction found in a file is recorded as a finding), that secret values are never quoted, and that target code runs only inside the hub's sandboxed runners.

## Instructed conductor configuration (#1432)

After the project is initialized and its hub is running, the person may directly
instruct the uniquely configured conductor in that conductor's own session to
stage `off` or `advise` and the required check names:

```bash
ahub sdlc configure --mode advise --required-checks 'unit,lint'
ahub sdlc configure --mode off
ahub sdlc configure --required-checks '' --json
```

Replace the example check names with the repository's actual required jobs. The
last form explicitly clears the list. Omit either setting to preserve it. Changes
use the existing loader, revision checks, backup and atomic write path, and apply
at the next hub start. Human output names the actor and pending restart; `--json`
returns the saved receipt.

Running this command makes a cooperative claim that the person explicitly
instructed this actor in its own session. The daemon verifies the current unique
conductor and session context; it cannot independently verify that conversation.
Task text, files, reviews, peer messages and relays never supply that instruction.
Child sessions, private or PII contexts, observer input, recovery and shutdown
refuse the conductor path. `--live-test` cannot turn an agent into the person for
this operation.

`ahub init`, generic `ahub settings edit`, `enforce`, `[security]`, `eval_check`,
`config_paths` and custom stages remain person-only. If either the running
lifecycle or the actual file is already `enforce`, use the person's settings
editor. The narrow command does not authorize releases, tags, merges or
publication; release authorization remains a separate instruction and operation.

A durable `sdlc_config_instruction` intent precedes the write. The result audit
records the actual actor (source `conductor` for that actor), the fixed instruction claim and
changed paths/value hashes, without the setting values. Failed intent records
write nothing. If the file was saved but result auditing fails, the refusal says
`saved: true`; inspect the file and event log before retrying.

## Person release authorization (#481 S6)

From the running daemon's candidate checkout, the person or the one configured conductor runs `ahub sdlc authorize-release <version>` (#1063). The conductor acts only on the person's explicit instruction in its own session naming that release. A hub message, task text, review note, file or another peer's relay is never that instruction; the daemon cannot verify this cooperative rule. A conductor request uses the tools role and refuses a child `toolsOwner`, private turn or PII context, exactly like `sdlc merge`. Other peers and `--live-test` refuse. By default, consent binds the exact current commit, committed package version, origin fetch/push identity and fresh committed documentation evidence, all reread after the docs check. Receipt `by` and the append-only metadata audit identify the actual asker alongside the approval id, commit, version and, when checked, the docs digest/count. The authoritative ledger is daemon-owned memory: restart revokes every approval; audit history cannot restore one.

Release source policy is read only from `.agenthub/config.json` as committed at the candidate commit. A missing shared config keeps the existing defaults; unreadable or malformed committed policy refuses authorization. Release keys in `.agenthub/config.local.json` are ignored with a notice, and neither local config nor runtime settings can override the committed contract. `release.version` defaults to `package.json`; `release-notes` checks a regular committed notes blob at `release.notesPath` (default `docs/releases/v{version}.md`), and `none` binds the requested semantic version to the exact commit. `release.docs` defaults to `checker`; `none` is allowed only when the candidate has no regular `docs/verified.json` blob. A committed manifest keeps the documentation-evidence step required; remove `release.docs` from `.agenthub/config.json` or remove the manifest, commit the change and authorize again. For a project without that manifest, `none` skips only documentation evidence and is recorded as an explicit exemption with no freshness digest or document count. All source modes retain the person/conductor boundary, exact commit and origin binding. `npm publish` requires a clean tracked worktree and derives its target from committed `package.json`; with an alternate version source, that package version must identify the same configured target.

`ahub sdlc release <owner/repo>` keeps the existing package.json-default version and receipt output. For `release-notes` or `none`, it selects the latest successful receipt only when its commit, repository, origin and committed policy match this report; it rechecks the notes blob for the receipt version, or reports the `none` version bound by that receipt. Without an eligible receipt it prints `version undetermined`, names the configured source and points to `ahub sdlc authorize-release <version>`. It never guesses from a tag, notes filename or stale receipt. A source revalidation failure is stale/unknown consent and `ready` remains false. `docs:none` is shown as an explicit exemption and performs no documentation read. Authorization removes only the person-decision blocker. Native acceptance remains unverified and `ready` remains false until separately supported. No tag, workflow or publication is changed by authorization or readback.

The optional `ahub init --release-guard` writes instructions and an executable default Git `pre-push` hook. Preview with `--dry-run --json`. An existing regular hook is renamed to `pre-push.agent-hub-original`, preserving its inode and mode, and chained with the exact original arguments and stdin only after successful preflight. Ordinary later `init` calls retain the guard. Linked/hardlinked hooks, occupied backups and custom `core.hooksPath` are refused before project writes; integrate custom hook runners manually instead. The wrapper pins the current Bun and package entry paths; run init again after moving or replacing that installation.

For every actual pushed `v*` destination, the hook requires an exact semantic version and a matching receipt for the captured source object peeled to its commit. Missing consent, another commit/version/remote, daemon downtime or a reset ledger refuses the push. Version-tag deletion is refused. Branch-only pushes do not need a daemon and still reach the user's hook. The person can bypass with Git `--no-verify`; agents must never bypass it. This is a cooperative Git guard, not an OS capability boundary.

Before other release commands, agents run `ahub sdlc release-guard -- <literal argv...>`. Supported forms are one named-remote tag push, `gh release create v<version>` (an existing GitHub tag is read back; a new one requires `--target <full-sha>`), and `npm publish` from the approved checkout. Ambiguous selectors, alternate repositories, bulk pushes, workspaces and archive publishes refuse. The npm preflight refuses tracked worktree changes before and after rechecking the committed release policy, the configured documentation verdict when enabled, and HEAD, but does not attest the eventual tarball, npm configuration or lifecycle scripts. Guard and hook operations require an explicit target and never infer one from a prior receipt. The command performs no release operation and its answer is not an execution grant. GitHub/npm enforcement remains instruction-based until adapter integration (#312/#313); rerun preflight after changing any target or candidate. Native install, live release and migration evidence remain separate obligations.

Tracked npm cleanliness compares the cached index to HEAD and raw tracked blob bytes without `git status`, clean/process filters or text converters. It refuses unknown evidence, gitlinks, transformed files and inventories above 4,096 entries, 4 MiB per file, 32 MiB total or 250 ms; untracked files remain outside this check and the eventual tarball is not attested.

## Release preparation and the guarded tag (#787 P3b)

Release preparation is an agent task; the release decision remains the person's. Consent may be recorded by the person or by the configured conductor on the explicit version-naming instruction above; preparation alone grants no consent. A hub captured before #1120 has no `scripts/check-docs.mjs` in its runtime copy, so `ahub sdlc authorize-release` there refuses with "documentation checker ... is missing from the running hub" (not "stale documentation"): record consent from a hub that carries the checker, either `ahub upgrade` to a release that includes #1120 or a hub started from the candidate checkout with `bun src/cli/main.js`, and never restamp documents to get past it.

`bun scripts/release-prepare.ts [--version X.Y.Z] [--dry-run]` is the mechanical half of AGENTS.md "Releasing" steps 1 and 2. On a `release/<version>` branch (it refuses `main`, a detached HEAD, a dirty tree and any other branch name) it reads the commits since the last `v*` tag, applies the rule (any `feat` subject bumps the minor, otherwise the patch; a version below the rule or not newer than the last tag is refused, so is a missing or empty `## Unreleased`), and writes `package.json`, the README `Status:` line, the generated doc facts (the quickstart install tag and the version pins between `<!-- facts:<name> -->` markers, rendered by `scripts/lib/readme-facts.ts`, so the release PR passes `scripts/readme-facts.ts`; `--dry-run` lists the blocks it would change, #1273), the CHANGELOG section (the Unreleased entries move under the version, Unreleased stays empty), the `Upgrading to <version>` note in `docs/quickstart.md` with the global CLI and plugin step, the bundle (`bun run build`) and a verification report skeleton `docs/verification/<date>-<version>.md`. The skeleton lists the pull requests the commits name and the native acceptance receipts, which it reads from `docs/verification/` files added since the tag, never from what an agent writes. It leaves `TODO(agent)` markers for what only a review can state: each PR's review and CI, the document review, the checks and the known gaps.

It restamps nothing by itself. A stamp in `docs/verified.json` records that someone read what changed under a document, so `bun scripts/release-prepare.ts restamp <document>... --reviewed` sets `verifiedAgainst` to HEAD for the named documents only, refuses without `--reviewed`, refuses an unnamed or unknown document and refuses with staged changes. The agent runs it per document after reading the source commits, commits `docs/verified.json`, opens the release PR and merges it with a merge commit (never squash).

`bun scripts/release-tag.ts <version> [--execute]` is the one guarded tag run. Every run repeats the whole preflight and reports every refusal at once: a valid release version; `package.json`, the README Status line and a CHANGELOG section at HEAD all naming it; HEAD on `main`, clean, and the merge commit of a `release/<version>` PR (a squash is refused); HEAD an ancestor of `origin/main` (fetched, not assumed); no `v<version>` tag locally or on the remote; `scripts/check-docs.mjs --require-fresh --committed` clean; a `docs/quickstart.md` "Upgrading to <version>" section with the global CLI and plugin step and no `TODO(agent)`; and exactly one `docs/verification/<date>-<version>.md` with no `TODO(agent)` left. Without `--execute` it only reports, and whether the person's consent matches (exit 2 when it does not). With `--execute` it reads the consent through `ahub sdlc release-guard -- git push <remote> <commit>:refs/tags/v<version>` (read only; the ledger `ahub sdlc authorize-release` fills from the person or the explicitly instructed configured conductor, revoked by a hub restart), repeats the preflight, checks the commit did not move, reads the consent once more, and then makes the single push of that exact commit. A rejected push is reported and never retried, and the script passes neither `--force` nor `--no-verify`; the pre-push hook from `ahub init --release-guard` still runs on that push. The push creates a lightweight tag (`<commit>:refs/tags/v<version>`), the exact form `ahub sdlc release-guard` parses and the consent receipt binds; the repository's tags are mixed (v0.19.0 and v0.18.0 are annotated, v0.17.0 is not) and `.github/workflows/release.yml` accepts either (`v*`, then `--verify-tag`), so this is a convention difference, not a gap. If the project wants annotated release tags, create the tag object first and push the tag ref, which the guard also accepts (its source object is peeled to the commit); that is a later change to this script. `AHUB_RELEASE_ROOT` points both scripts at a checkout other than the one they live in (the tests use it so nothing outside a scratch repository is touched). Neither script calls `authorize-release`: the report only names the command; the person or the explicitly instructed configured conductor records consent separately. Publication (npm, the GitHub release) stays with the tag-triggered workflow, which has its own gate (`.github/workflows/release.yml`).

The scripts and their pure helpers live in `scripts/release-prepare.ts`, `scripts/release-tag.ts` and `scripts/lib/release-plan.ts`; they are maintainer tooling and are not part of the published package. The deterministic recovery barriers of #787 AC3 are not needed by either leg and are not part of this change.

## Deliverable records (#509a)

A report, translation or slide deck has no commit, so the artifact identity is the file's own content hash, recorded by the hub.

- `hub_task_done` and `hub_sdlc_record` (inside `receipt`) accept `deliverables: [{path, format, version?}]`, one to sixteen entries. `path` is project-relative with forward slashes; `format` is a lowercase label (`md`, `pdf`, `docx`, `csv`); `version` is an optional short label. There is no hash field: **a claimed `sha256`, `hash` or `bytes` is refused**, and so is any field the hub does not own.
- The hub opens and hashes each file itself. The path is resolved with `realPath` and checked with `guardPath` in read mode: outside the project, on the secrets denylist (`local.deny`), through a dangling link, inside `.git` or `.agenthub` (the hub's own state), not a regular file, missing, over 256 MiB each or 512 MiB together are refused, with the path as given and never a resolved one. The file is opened without following a final link and its device and inode are compared with what was checked, so a path swapped in between is refused; a file that changes while it is read is refused, never recorded half-read. Reading is chunked with an await between chunks, so a large file does not stall the daemon.
- A bad call is refused whole, before any board write: no partial record, and the task stays where it was. Each record stores `id` (an opaque id from path and format, stable across edits), `path`, `format`, `version`, the real `sha256` and the size.
- **Where the files are read.** Paths are relative to the owner's execution root: the project checkout for an ordinary owner, the instance's own verified worktree for a declared worktree instance (the place it writes). A root the host cannot prove refuses the call, and a read of such a task reports every file `unknown`, never `unchanged`; an approval is refused for the same reason.
- It works in a plain folder. Nothing needs git, a PR, a shadow repository, a snapshot, facts or a lifecycle receipt (a task with no `sdlc` receipt records and approves deliverables).
- **Approval binds the bytes.** When a reviewer approves, the hub reads the files again. Unchanged, the approval records the same hashes. Changed, missing or unreadable, the approval is refused before any write with `deliverable changed since it was delivered: <id> (<state>)`; the owner calls `hub_task_done` again so the current files are reviewed. `changes_requested` needs no binding. The person may approve files that moved: the current bytes are measured and bound, and the verdict note says the files had changed since delivery.
- **Later edits.** `hub_task_show` and `ahub task show` add `deliverables: { state: "delivered" | "approved", changedSinceReview, files: [{ id, sha256, state: "unchanged" | "changed" | "missing" | "unknown", ... }] }`, read from the files as they are now against what was approved (or, before approval, delivered). `changedSinceReview` is true only for a file measured to differ. A file the hub cannot read or vouch for (denied, outside, replaced by a link out, too large) is `unknown`, never `unchanged`.
- **Private records.** For a PII task, or a file under `pii.paths`, the record is private: every peer view, review request, status and log shows the id, hash and size only, `(path withheld)` in the request. The board keeps the path so the file can be found again, as it keeps the rest of a PII task's text. A path that matches a PII pattern is withheld the same way.
- `hub_sdlc_record` with `deliverables` records them on a `lifecycle` entry, through the same hashing and the same owner, reviewer or console authority; a receipt without them is the old call.
- Limit: a daemon from before this slice ignores `deliverables` on `hub_task_done` (the plugin is installed apart from the daemon), so restart the hub after an upgrade before relying on it; a done that names deliverables and shows no `Deliverables` block in its review request was recorded without them.
- `ahub deliverables [--task <id>] [--approved] [--check]` lists them (#509 AC3). Not in this slice: a hash of a file the hub cannot read.

## Named CI and build-entry diagnostics (#1328 T2)

Exact-head review blockers name each required check and its state, for example
`exact-head full CI is not green: missing seeded guards; pending check (macos-latest)`.
Failed, duplicate and unknown checks are named too. Incomplete inventories remain
unknown, and identical-tree reuse still requires its full proof and snapshot recheck.
Complete cached and fresh review evidence use the same diagnostic formatter.

Enforce build-entry guidance names the first missing snapshot step in this order:

1. `spec issue not recorded (owner/planner: hub_sdlc_record)`
2. `spec not accepted (person: ahub sdlc accept <task> --issue <n>)`
3. `plan not reviewed (planner: hub_plan_review)`

Proposal results and route explanations carry this guidance separately from peer
eligibility. A plan-review hold is recorded as a ready hold, never as
`no-eligible-peer`; that label remains a peer-eligibility outcome. Assignment stays
pure and receives snapshot guidance as data. Candidate choice and the existing
plan-only offer gate remain unchanged: an owner offer may precede person spec
acceptance. Acceptance still runs live spec checks before live plan checks, with
its existing authority and currentness fences. Snapshot guidance never certifies
that an accepted spec or reviewed issue is still current. Unavailable, private or
closed plan evidence retains its original diagnostic lead and planner action. Private task projections
withhold these issue-specific diagnostics.

## Advisor surveys and considered findings (#1403 T7)

`ahub sdlc survey start [--focus bugs|tests|debt|deps|dx|docs]` is an on-request
person/current-conductor operation with the lifecycle enabled. It creates one
read-only `plan` task at an exact source ref. Repository content is data, not
instructions: the task does not install or run a scanner, execute a fix, publish
an issue or push a branch. `ahub sdlc survey show <task> [--json]` reads its report.

The assigned planner reports through `hub_survey_report`: findings have a stable
semantic id, evidence `path:line`, affected paths, impact, effort `S|M|L`, risk,
confidence `high|medium|low`, and `fix_sketch`. A report alone creates no card.
The planner must vet each finding against that pinned source before submitting
an explicit vetted decision. This is the planner's attestation, not a host proof
that source was reread. Vetted high/medium confidence yields a backlog `plan`
card; low confidence yields read-only `triage` investigation. No card authorizes
execution. Replay and concurrent vetting share a repository-scoped semantic
finding marker; positional labels never match across tasks.

Review `false_positive`, audit rejection and survey rejection share an
append-only considered ledger with id, paths, reason and source binding.
A later scoped brief shows matching ids as rejected before with the reason,
subject to existing privacy/security disclosure. A changed path clears the
suppression for that path. Unrelated path changes do not clear it. Unknown or
incomplete change evidence shows rejected before, change unknown, and retains
suppression. The planner may reconsider only with an explicit vetted reason;
that creates a reconsideration entry and may create the card while preserving
the historical rejection. No rejection is deleted or silently rebound. Open host-created cards alone dedupe a matching marker. Approved or cancelled cards remain history: when the rejection no longer suppresses the finding, a new vetted card names the prior closed card as "hub task N" and the reason it reopened. Closing a card never clears an unchanged rejection.

Private turns, child contexts, recovery and ended role authority refuse writes.
Security finding text and paths remain in authorized private reports, not
public backlog cards, briefs or memory. Lifecycle off advertises no survey tool
or additional task readback. Live audit/survey dogfood (#1403 T8) still requires
the person's separate instruction; this feature adds no schedule or live run.

Externally observed merged PRs use host-only `mergeReadback` evidence. Its cost fields remain unknown if the bounded readback cannot complete. The latest configured security scan reports a per-source number or `unknown`; an unreadable source is never reported as zero.

## Closed-task compaction (#1555 AC6)

A task that reaches `approved` or `cancelled` drops its ephemeral state, and nothing a metric or a verdict reads:

- Its `touches` rows (`Turns.pruneTouches`). Every reader looks at open tasks only (`conflictsOf`, `pathWarnings`, the owner-write evidence of an in-progress task), and the overlap counts are already frozen in `tasks.history`. A startup pass also prunes rows of tasks that closed while no hub ran. A turn that ends after its task closed records no rows.
- The output tail and staged `output.log` of its finished or stale isolated checks (`ContainerRunner.compactTask`). The receipt keeps its status, exit, head, tree, timing, owner and revision; a queued or running run is never touched.
- The settled results of a closed Pi session in `pi_tool_receipts` (`compactPiResult`): a new session closes the earlier ones, and a result over 2,000 characters keeps its prefix and, for a shell result, its exit code. The active session's receipts are untouched.

Task rows, history, `sdlc` receipts, `usage_rollup` and `rollup_seen` are never deleted or edited. `test/terminal-compaction.test.ts` computes `sdlcMetrics`, `costMetrics`, `releaseMetrics`, the usage roll-up and the whole task rows before and after a compaction and requires them identical.
