AGENT SKILL

closing-review

Run closing review and generate an attestation. Use after Build completes or functional changes invalidate prior review evidence.

License 许可
MIT
所属仓库
kouko/loom-plugins
最近更新
2026-11-15
Stars
★ 0
Forks
0

01 前言 Front Matter

name
closing-review
version
1.5.0
description
Run closing review and generate an attestation. Use after Build completes or functional changes invalidate prior review evidence.

02 资源文件 7

03 SKILL.md 正文

Closing review

Reviewer findings and generated evidence are written in English. Every message to the user, including a relayed reviewer or acceptance-tester result, is written in the user's conversation language, even on a turn with no new user message, such as a background agent's completion or a resume after compaction.

closing-review decides whether the completed functional content is ready. It produces docs/loom/<change-id>/attestation.json; agents never edit that file by hand.

1. Establish the content

When a factual contradiction could change a review conclusion, identify the pending decision and use loom-code:engineering-research as needed; adequate evidence needs no new study. Return findings or uncertainty to review without editing artifacts, replacing independent verification or creating missing execution evidence; preserve scope and user decisions.

Resolve the branch base, read the confirmed intent and retained plan when present, and list the cumulative diff. If only publication metadata changed and a matching attestation already exists, call loom-code:ship in the same turn unless a stated stop condition applies. Do not rerun finalize-review: the evidence is still valid and Ship owns the remaining work. A progress report naming Ship does not complete this hand-off.

At entry, omit any step the user told you to skip in plain words; §2 and §3 say how skipped reviewers, adversarial and acceptance-test are handled. Words that ask to skip independent acceptance testing — "acceptance testing", or the step formerly called "blind run" — mean the acceptance-test step. At station entry, keep the full flow unless the user instructed a skip. Automatic narrow-change simplification belongs to finalization and attestation validation. The default is the full flow: skip a step only when the user tells you to in plain words, then tell the user in one line which step is skipped and continue. When you honour such a skip, append one line skipped-by-instruction: <step> <YYYY-MM-DD> to the plan's ## Risks section, or the intent's ## Constraints section when plan is absent or skipped, and commit it before dependent checks. Commit that line before reviewers read the final digest, because it changes the digest; a later commit is harmless only when the skip sends the change to Ship unattested (§5).

2. Compute review depth

Use the confirmed intent when spec or plan is skipped. Give reviewers and testers the retained artifact paths and omitted steps; apply Acceptance directly when spec is omitted, and use bounded task handoffs when plan is omitted. Any downstream reference to a spec, plan or its sections applies only when that artifact is retained; use the intent's Constraints for a record otherwise assigned to plan Risks. Missing skipped artifacts require no recovery; all retained verification still applies.

Before every host-native dispatch, the station must resolve the model-and-effort profile as the shared dispatch profile defines and apply its result. Repeat this resolution for every reviewer, second-vendor reviewer, and acceptance tester dispatch. <loom-code> (this plugin's root) is ${CLAUDE_PLUGIN_ROOT} on Claude Code; on any other host it is the directory two levels above this SKILL.md.

On Antigravity CLI or OpenCode, map tool and agent names with ../../references/antigravity-tools.md or ../../references/opencode-tools.md.

Before dispatching reviewers in Round 1, run "<loom-code>/scripts/loom-python" --repair sync-trunk from the change worktree. When it reports up to date, continue. When it reports content changed, dispatch no reviewer and return to Build §3 to re-run the complete package suite and the existing adversarial programs, then start Round 1 again. When it prints WARN review.sync, state the warning in the round report and continue. When it prints BLOCK review.sync, dispatch no reviewer and return the change to Build. Any other result, including exit 2, dispatches no reviewer and reports the printed message. Run it before acceptance testing (§3), so acceptance testing exercises the synced content.

Before dispatching reviewers in any round, confirm on the current functional content (a committed acceptance test report aside) that Build's hand-off reports the complete package suite passing or package-tests is skipped by the user's plain-words instruction, and that it reports every adversarial program passing or adversarial is skipped by the user's plain-words instruction, each skip waiving only its own check. When that hand-off reports a check failing, return the change to Build and dispatch no reviewer. Reviewers read only content whose Build mechanical checks passed.

<!-- gate: review.absence-recovery --> Absence is a distinct antecedent from a failing check. On a re-entry with every planned task already committed, that hand-off is not in context, and the item this station needs may itself be missing. Neither state is a check reporting a failure, and neither routes like one. When an item is absent, read loom-code/contract/manifest.yaml (stations[].produces and actions[].owner) for the station that produces the absent item; this file keeps no second copy of that mapping. This lookup covers only an item this rule names: the adversarial programs, the acceptance test report or the attestation. Take the owner, never charter.signoff, which names where an artifact is signed off rather than who produces it. When that owner is this station, produce the item here and route it nowhere; for an acceptance test report specifically, that means following §3. When it is another station, return the change there, naming the station sequence entered so far, and dispatch no reviewer. Recovery adds a path and waives nothing: every check above runs on the recovered content. Keep the stations this run has entered as a list in entry order, in the active task context and not in a committed ledger, and name that list in the handoff and in either stop below. A second entry to a station is the last one allowed; a third entry to any station is a recovery that has failed, and it stops and reports under the rule below rather than routing on. The run enters no station more than twice, a count that tracks only entries made to resolve an absent item under this rule and is never incremented by §4's ordinary round-and-digest progression.

Stop and ask when producing an absent item needs a decision point the user has not answered for this change, naming the station sequence entered so far. When the user has answered it, including a general delegation such as "you decide", proceed and record the choice as user-decided. This governs only whether the run asks again; a user-requested skip follows the plain-words rule in §1.

Stop when the attempt to produce an absent item fails. Report which item is absent, what was attempted, and where it failed. Also report the station sequence entered so far. Do not attempt that item a second time and do not hand the change on to another station.

<!-- /gate -->

When acceptance testing is needed, finish it and commit its report (§3) before dispatching the first reviewers. After Build commits completed functional content, run:

"<loom-code>/scripts/loom-python" --ready --script checked_readonly.py reviewer-count <change-id>

Use only accepted JSON with exit 0 and status: passed: its positive integer data.reviewer_floor, tied to the unchanged data.change_id, determines how many fresh-context reviewers with distinct agent identities to dispatch. The consumer validates these fields before emitting them and adds --json itself; do not parse success prose. Valid usage/internal errors, invalid observations or startup failures dispatch no reviewers and supply no default floor. Report the diagnostic and stop this prerequisite; no automatic retry or text fallback. This ready-mode call reuses the runtime prepared above; a readiness failure retains the launcher's repair guidance. See the shared CLI result guide. After accepting the core result, present applicable suggested_next only when it is a nonblank string, as advisory content; otherwise retain the original diagnostic. Advice does not set a reviewer floor, authorize dispatch or permit automatic execution, retry or text fallback. The checker derives the floor from the cumulative branch delta and fails closed to two when it cannot classify the whole change. finalize-review recomputes the same policy, and the PR's verification status reports a mismatch as stale; the orchestrator never declares or overrides it. When reviewers is skipped by the user's plain-words instruction, dispatch no reviewer and pass no verdicts.

  • Unless reviewers are skipped, resolve a selected second vendor from the standing fixed CLI, the per-change ask answer, or a committed user-decided — second-vendor selection-confirmed: <vendor> plan line, or a direct user request naming an outside coding agent for the active code branch. Record an accepted ask answer or direct request with that exact line in the plan's ## Risks; when plan is skipped, record - user-decided — second-vendor selection-confirmed: <vendor> in the confirmed intent's ## Constraints before reviewing. If a plan is created later, copy the selection into its Risks before review. The checker reads plan Risks first, then intent Constraints when the plan is absent or has no selection. Keep a direct request's verbatim quote and target in the JSON authorization_source at dispatch, with selected_executor set to the final user choice; a refused or superseded agent cannot fill the outside slot. The request is not an asked question in ## Questions asked. Thus reviewer-count, finalization and attestation validation can recompute it. With no selection, do not start external execution. Compare the selected model's provider family with the current host model's family when that family is known; if they match, the selection is not independent and must not run as the outside reviewer. With a valid selection, retain at least one incumbent reviewer and dispatch an additional outside reviewer. A floor of one rises to two; at a higher floor, the outside reviewer may occupy one slot, but cannot replace the incumbent. Finalization requires both vendor families in distinct passing verdicts.

Reviewer independence is a quality requirement, not a ledger field. Give each reviewer the branch base, changed paths, intent, spec when present, plan, and the applicable lens from references/lenses.md. Reviewers return the structured YAML required by agents/reviewer.md; the orchestrator converts the accepted fields to the temporary JSON consumed by finalization. For branch-end review, send both reviewed_sha (the diff base) and review_target_sha (the committed HEAD being judged). Preserve the target in the outside review's raw YAML and attributed verdict. Finalization requires it to equal HEAD; later attestation validation allows publication-only commits after that target while requiring the target to be an ancestor with the same functional content digest. Before dispatching the round's reviewers, run once at HEAD each adversarial program whose command is not pytest, shell or direct execution, writing its combined output to a temporary directory outside the repository. Hand the reviewers those output paths together with the commit they ran at, HEAD (the packet's review_target_sha); a returned confirmation's reviewed_sha names that commit, never the packet's diff base.

<!-- gate: review.external-dispatch --> For the selected outside reviewer, invoke the named loom-code:external-review skill. Give it the complete reviewer packet, including the same lens from references/lenses.md and the same agents/reviewer.md YAML contract used by incumbent reviewers. Supply an explicit executor, model, effort and model-provider family. A resolver result of overrides: null does not select an outside profile; choose and verify a complete pair or report EXECUTION_FAILED. Never use the external CLI's default model or effort and never substitute another pair after rejection.

Before any network-backed discovery, probe or review, give the user the cost, vendor-egress, review_root working directory, local-execution, filesystem_access_outside_root, and filesystem_write_not_guaranteed disclosures and retain authorization_source in the external skill's complete JSON consent record. A direct user request naming the outside coding agent and an unambiguous active branch authorizes one review without a second yes/no checkpoint; interpret the full request, including any refusal or correction, then quote it, bind selected_executor and executor to the final choice, show the disclosures, and record their flags as shown rather than separately acknowledged. Immediately before each owner call for outside discovery or execution, re-evaluate the latest user choice across all conversation turns available then. Refresh the final-choice record, or invalidate a stale approved record after cancellation, replacement, or ambiguity; a clear direct request needs no second confirmation. One execution call runs discovery, preflight, and review consecutively. Handle a new user turn received during that call before the next outside call; material already sent cannot be recalled. The working directory does not confine the CLI's file reads or guarantee it cannot write files. An earlier fixed setting without these disclosures is insufficient; resolve its confirmation at the existing intent decision point. If the provider or target is ambiguous, or material scope expands beyond the active task, obtain the missing choice before dispatch. A changed executor or review_root requires renewed authorization. Pass the consent record and exact root to the shared runner. A missing or stale record prevents execution. On Codex, run the installed runner outside the sandbox with narrowly scoped host approval when the selected CLI requires the existing host login; denial is an authorization blocker, never a login diagnosis.

Continue in the same active turn after disclosure for a clear direct request, through discovery, preflight, execution and the owning review's result validation. Reuse the existing authorization instead of waiting for another user answer. Keep the consent record distinct from host execution approval; it does not grant that approval. Carry the original user request, exact review target, destination vendor and minimized packet scope into any required narrowly scoped host execution request through the host's existing request mechanism. Respect the host's decision; consent JSON alone never establishes host approval. Report a required second user answer as failed uninterrupted-execution acceptance, even when the host requires that answer before execution. Do not end the turn at disclosure, ask whether to send the scoped material, or make a second answer a condition of starting. Report an actual host refusal as an incomplete review and preserve the refusal instead of attempting a bypass. Cancellation, ambiguity and material scope expansion still follow the choice rules above; this continuation rule grants no additional access or retry. The fresh-authorization retry rule below applies outside this initial execution.

The shared runner returns execution status, evidence and raw review output; it does not judge the review. A failed probe or review is a distinct outside failure and supplies no verdict. On completion, this station validates the raw YAML against agents/reviewer.md, attributes it to the selected model family, and accepts only a conforming verdict. One whole-output yaml or YAML fence and nonempty finding text without a Conventional Comments label are accepted without changing their content. Every finding still needs a nonblank path with a positive line number or nonblank quote; dimension scores must meet their findings' severity, and the overall verdict must agree with the scores and findings. For outside results, a dimension may use an exact canonical score followed by — and nonblank rationale. Copy the full dimension score string into the attributed verdict for comparison with the raw YAML; use only the canonical score token for finding severity and overall-verdict consistency. The overall verdict remains a bare canonical token. Blank or ambiguous scores are rejected. Duplicate YAML mapping keys at any depth are rejected. A transient executor failure or malformed outside output may be retried once for the same digest and reviewer identity, but every repeat outside execution is a newly authorized review with a fresh preflight. The earlier consent does not authorize a silent retry. For probe-rapid-refill-breaker or review-rapid-refill-breaker, report an incomplete review and inspect private diagnostics before requesting that new authorization. A second outside failure ends the episode as EXECUTION_FAILED. A rejected explicit model or effort never triggers a default-model retry. The accepted outside verdict carries the completed runner result to finalize-review; it checks the raw YAML against the attributed lens, verdict, dimension scores, findings and notes, then stores a receipt bound to the unmodified raw-output digest with executor, model, effort, family and reviewer identity in the attestation. A vendor label without this receipt is not a completed outside review. <!-- /gate -->

3. Run acceptance testing

Use acceptance testing when an Acceptance line cannot be settled mechanically. When every Acceptance is settled mechanically, omit the independent report even for executable, non-narrow changes; this differs from a user skip or automatic narrow simplification. Finalization and publication still require passing functional executions and reviews, record the actual tested commit, and check any report present. Report absence cannot prove that semantic decision: the station and reviewers must require independent evidence when needed. Acceptance testing means dispatching the loom-code:acceptance-tester agent fresh-context, never an agent that touched any part of the change. It writes the report to docs/loom/<change-id>/acceptance-test-report.md and detailed evidence to docs/loom/<change-id>/evidence/acceptance-test-evidence.md. Those files, other direct evidence files and attestation.json are publication metadata under the manifest; executable probe programs remain functional content. Commit the report and its evidence before finalize-review, which records the tested commit from the report's canonical Tried on ... at <sha> line and rechecks every applicable evidence rule. Publication rechecks those rules against the selected committed tree; valid evidence-only edits keep the functional digest, while missing or invalid coverage, commit identity, intent confirmation or named boundary files fails validation. Review verdicts persist authoritatively in the change directory's attestation.json under verdicts; the outside-repository review input is temporary input, not a second authoritative record. When acceptance-test is skipped by the user's plain-words instruction, run no acceptance testing. When acceptance-test is skipped and so no report exists, tell the user, in the conversation before Ship, every step skipped by instruction, read from the committed skipped-by-instruction: lines and described in plain words by what it would have done, not as its record id.

On every dispatch, tell the acceptance tester whether package-tests or finalize-review is skipped. Also hand it every finding of severity important or worse that the main agent dismissed. A finding of that severity dismissed after the tester's last dispatch, when Ship comes next, is listed in the pull request's Verification section instead. On a re-dispatch after a fix, also pass the earlier report and evidence file paths and the fix's commit range. The tester's steps 6-7 govern the suite row and what is re-tested.

Closing review dispatches no adversary and creates no adversarial program. Build commits the adversarial programs, and its hand-off names each program's path and command; §5 passes them to finalize-review. Do not record a claimed result; finalization executes them. When adversarial is skipped by the user's plain-words instruction, Build hands off no adversarial program and §5 omits the adversarial input.

<!-- gate: review.probe-graduation --> A probe program that caught a defect on its own change is carried into the suite that runs on every later change, through a plan task, before §5 runs finalize-review. That is the deadline, because §5 is what executes the programs and writes the attestation: a program still sitting in the change's store when the attestation is written was never graduated. Graduation is a plan task, so the route is back through Build — this station dispatches no implementer and moves no file itself. Re-enter §5 once Build reports the move.

A program of this change that caught none is named as such in the review report and deleted from the repository: a program that never went red is run twice and never again, so it defends nothing against a later regression. The adversarial protocol commits a program only when it is red, so this branch never fires on a program that step produced as intended. It is reached in two cases and no others: a program carried over from an earlier dispatch whose case a later fix removed, and a program whose observed result Build's hand-off does not give, which is read as caught nothing. Read which is which from Build's hand-off, which records each program's observed result. Probe programs committed for earlier changes stay where they are. <!-- /gate -->

4. Converge within one bounded episode

<!-- gate: review.bounded-episode --> A closing Review episode starts when fresh reviewers first evaluate completed functional content for the confirmed requirements. Only a substantive requirements change with renewed intent confirmation starts another episode. The main agent must record the changed requirements and affected obligations in retained spec, plan and evidence (or intent Constraints when those artifacts are omitted), distinguishing evidence retained as applicable from evidence replaced for the new requirements. Confirmation's byte pin proves the confirmed content, not semantic change. The episode admits at most three distinct functional-content digests; changing the task, app, branch, reviewer, vendor, model, or technical design does not reset that limit. Wording-only reconfirmation must preserve existing review rounds. The main agent must retain the retry count for the same failed task, even after a substantive requirements change and renewed confirmation. Before treating work as a new task, the main agent must record a concrete changed obligation and the task-continuity rationale in those existing artifacts, with checkable evidence for that distinction; a new task name alone changes neither count nor limit. A digest is distinct whenever a functional-content file changed since the content the reviewers last read; publication-only edits do not change it.

  • Round 1 — full review. Review the cumulative functional content.
  • Round 2 — fix verification. Batch fatal and important findings, return to Build, which repeats its end-of-Build mechanical checks, and resume the same reviewers over the functional fix delta.
  • Round 3 — terminal verification. Review the final digest once. NEEDS_REVISION ends the episode as NON_CONVERGENT; never dispatch Round 4.

Treat the episode as stuck when Round 2 still has blockers, the same blocker survives two consecutive rounds, the blocker count does not decrease after a functional fix, or the fix repeats the same mechanism shape; stop local patching then, and use the next available round only after the technical design re-look. The agent owns that re-plan when it preserves requirements, visible behavior, and guarantees.

Do not ask the user whether to continue a technical fix or which technical repair to choose. Authorization for a repeat outside execution is separate. Ask only when resolving the blocker would change requirements, visible behavior, or guarantees; that change requires a newly confirmed intent rather than another round in this episode.

A malformed response, unavailable executor, or other transient failure before a conforming verdict exists may retry once against the same functional-content digest. For an outside reviewer, that repeat execution requires a newly authorized review with a fresh preflight; never retry silently. After probe-rapid-refill-breaker or review-rapid-refill-breaker, inspect private diagnostics before requesting authorization. That retry is not a review round. A second failed attempt before a conforming verdict ends the episode as EXECUTION_FAILED. Treat a conforming NEEDS_REVISION as a successful review assignment that consumes the current review round. Feed back that completed assignment as successful conforming work under the shared dispatch profile, then return the artifact defects to Build for the next permitted fix round; it consumes no failed-reviewer retry. An execution-boundary result remains excluded and does not automatically become malformed-response; classify it from its actual failure evidence under the shared dispatch contract and stop when that contract permits no retry. Report every completed host-native execution before any permitted retry, retaining its actual count and effective profile.

Keep this episode in the active task context. Do not create a review-round ledger or committed state schema. Wording-only publication edits do not reopen closing-review. <!-- /gate -->

Before any fix begins, the main agent collects every fatal or important finding that the reviewers and independent acceptance testing returned on the content the reviewers just read, including the committed acceptance test report, into one list. Every fix starts from that whole list. Findings that share a defect class, named in words taken from the findings themselves, go to Build as one hand-off that names every one of their instances; findings of different classes go as separate hand-offs. Every hand-off from the list goes to Build in the same fix round, before the reviewers resume. A verdict label such as NEEDS_REVISION names no class.

Build scopes each fix to its defect's whole class before an implementer or the main agent makes it, as Build §2 states.

Convergence is where a lesson this branch taught is still cheap to keep. Whatever it taught has surfaced by now — through a finding, a probe, or acceptance testing — and writing it down after the merge costs a branch and a pull request for something already known. When this repository has a docs/loom/memory/ directory, that is where such a lesson belongs.

A recorded lesson is functional content like anything else committed: it changes the digest, so it must land in a digest the reviewers read, riding the fix round already in flight rather than arriving after the last one. It never justifies exceeding this episode's digests. A lesson that surfaces once they are spent rides the next change's branch as a batched passenger — which is still not a branch opened only to record something.

Almost nothing qualifies. Most of what a review surfaces is not a durable lesson: a one-off implementation slip belongs in its commit message, a verification result in this change's evidence, an unfinished item in an intent. Zero to one durable lesson per change is the normal outcome. This passage states the moment and the bar; it invokes nothing, requires no plugin to be installed, and asks for no decision from the user.

5. Finalize

Write reviewer output and the adversarial command declarations from Build's hand-off to a temporary JSON input outside the repository:

{
  "verdicts": [
    {"reviewer":"<id>","vendor":"<vendor>","model":"<model>","lens":"code","verdict":"PASS","findings":[]}
  ],
  "findings": [],
  "adversarial": [
    {"command":"python3 -m pytest <path>","artifact":"<path>"}
  ]
}

When Build's hand-off records that the adversary committed no program, the adversarial list holds the no-program outcome and its reason, with no program beside it:

  "adversarial": [
    {"no_program":"<why no program was worth committing>"}
  ]

finalize-review refuses a reason that is blank, is not on one line, has surrounding whitespace or contains an HTML comment, and a no-program record beside any program.

The findings input carries every unresolved adversarial finding that Build's hand-off lists.

Copy each returned probe_confirmations entry into that probe's adversarial item as "confirmation": {"reviewer": "<id>", "reviewed_sha": "<sha>", "quote": "<lines>"}. finalize-review uses a confirmation only for a run whose runner is unlisted or whose output it cannot read.

For a selected outside reviewer, copy its dimension_scores and notes into the attributed verdict as well as the fields shown above; finalization compares them with the raw YAML.

Then run:

"<loom-code>/scripts/loom-python" --repair finalize-review <change-id> --input <temporary-json>

When the required reviewer verdicts and probe evidence are available and §4 permits finalization, run finalize-review in this turn. A progress update alone does not complete this step.

The checker runs the declared package suite and each adversarial program once. Only after all executions and verdicts pass does it atomically generate the attestation bound to the functional-content digest. When finalize-review generates a valid attestation, commit the generated file with any remaining publication metadata in this turn; publication validates that single attestation directly. Once a valid attestation is committed, call loom-code:ship in this turn unless a stated stop condition applies. A progress report alone does not complete the hand-off.

When a step that finalize-review needs (reviewers, adversarial, package-tests) was skipped by the user's plain-words instruction, skip finalize-review and leave the change unattested: tell the user in one line that the PR will show verification absent, and hand the change to Ship.

When finalize-review refuses only over a reviewer confirmation, and the functional content is unchanged, obtain a fresh confirmation from the round's reviewers and re-run finalize-review; that is not a Build round. A confirmation-only refusal is one of these five: the confirmation is missing; it is malformed; its reviewer gave no verdict this round; its reviewed_sha lacks HEAD's functional content; or its quote does not match its own run of the probe. When finalize-review fails for any other cause than these five, return the fix to Build, which repeats its end-of-Build mechanical checks, and the fixed content, a new functional-content digest, must pass the next review round (§4) before finalize-review runs again. No technical design re-look precedes that round unless the episode is stuck. Earlier verdicts are never reused for the fixed content. When no round remains, the fix would need a fourth distinct digest, which §4 forbids, so it ends the episode as NON_CONVERGENT.

Handoff

Report the reviewers, executed commands, functional digest, and unresolved findings. Also report every finding of severity important or worse dismissed after the acceptance tester's last dispatch, with its reason. On PASS, hand the matching attestation to loom-code:ship.

04 同仓库更多 Skills