agy-squad 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/.agents/skills/full-review/SKILL.md +89 -0
  2. package/.agents/skills/full-review/references/evidence-intake.md +146 -0
  3. package/.agents/skills/full-review/references/report-template.md +216 -0
  4. package/.agents/skills/full-review/references/review-roles.md +91 -0
  5. package/.agents/skills/pr-review/SKILL.md +60 -0
  6. package/.agents/skills/pr-review/references/pr-review-standard.md +163 -0
  7. package/.agents/skills/self-diagnosis/SKILL.md +63 -0
  8. package/.agents/skills/self-diagnosis/references/execution-and-teardown.md +71 -0
  9. package/.agents/skills/self-diagnosis/references/optimization-and-review-rubric.md +61 -0
  10. package/.agents/skills/self-diagnosis/resources/comparative-research-manifest.json +42 -0
  11. package/.agents/skills/self-diagnosis/resources/self-diagnosis-manifest.json +144 -0
  12. package/.agents/skills/self-diagnosis/scripts/diagnose.mjs +1971 -0
  13. package/.agents/skills/swarm-governance/SKILL.md +59 -0
  14. package/.agents/skills/swarm-governance/references/bundling-and-wire-format.md +88 -0
  15. package/.agents/skills/swarm-governance/references/intake-and-planning.md +120 -0
  16. package/.agents/skills/swarm-governance/references/large-swarms.md +39 -0
  17. package/CHANGELOG.md +26 -0
  18. package/LICENSE +21 -0
  19. package/README.md +121 -2
  20. package/bin/agy-squad.mjs +293 -0
  21. package/docs/assets/architecture-overview.svg +39 -0
  22. package/docs/assets/manifest-and-modes.svg +39 -0
  23. package/docs/assets/role-and-verdict-gate.svg +39 -0
  24. package/docs/assets/skill-role-workflows.svg +39 -0
  25. package/docs/assets/swarm-lifecycle.svg +39 -0
  26. package/docs/benchmarks.md +154 -0
  27. package/docs/concepts.md +81 -0
  28. package/docs/core-workflows.md +128 -0
  29. package/docs/getting-started.md +116 -0
  30. package/docs/index.md +47 -0
  31. package/docs/plans/LEDGER.md +24 -0
  32. package/docs/plans/comparative-harness-architecture-retest.md +1174 -0
  33. package/docs/plans/comparative-harness-architecture-teamwork.md +1170 -0
  34. package/docs/plans/comparative-harness-architecture.md +256 -0
  35. package/docs/plans/native-enforcement-ledger.md +126 -0
  36. package/docs/plans/pr3-option-b-fixes.md +803 -0
  37. package/docs/plans/wsl-cli-verification.md +55 -0
  38. package/docs/reviews/post-pr5-governance-review.md +221 -0
  39. package/docs/reviews/pr1-code-review-ledger.md +581 -0
  40. package/docs/reviews/pr1-production-readiness-review.md +764 -0
  41. package/docs/reviews/pr2-documentation-review-ledger.md +380 -0
  42. package/docs/reviews/pr3-squad-alignment-full-review.md +1021 -0
  43. package/docs/reviews/pr4-swarm-governance-pivot-review.md +593 -0
  44. package/docs/reviews/pr5-full-review-direction.md +330 -0
  45. package/docs/reviews/pr5-independent-review.md +266 -0
  46. package/docs/reviews/pr5-layered-swarm-review.md +513 -0
  47. package/docs/reviews/pr5-phase2-swarm-planner-review.md +470 -0
  48. package/docs/reviews/pr5-reconciled-review.md +573 -0
  49. package/docs/reviews/rebuild-wsl-dispatch-review-r2.md +427 -0
  50. package/docs/reviews/rebuild-wsl-dispatch-review.md +552 -0
  51. package/docs/reviews/v0.1.1-review.md +397 -0
  52. package/docs/roles-and-workflows.md +115 -0
  53. package/docs/stopping-agents.md +39 -0
  54. package/docs/tools.md +123 -0
  55. package/install.ps1 +5 -0
  56. package/install.sh +4 -0
  57. package/mcp/briefs.mjs +206 -0
  58. package/mcp/dispatch.mjs +343 -0
  59. package/mcp/handoffs.mjs +814 -0
  60. package/mcp/index.js +359 -0
  61. package/mcp/planner.mjs +761 -0
  62. package/mcp/verdicts.mjs +224 -0
  63. package/package.json +57 -4
  64. package/plugin.json +20 -0
  65. package/scripts/install-register.mjs +510 -0
  66. package/scripts/release-preflight.mjs +171 -0
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: full-review
3
+ description: >-
4
+ [Task Spec — non-diff triage, evidence bundles & Direction decisions; pair with
5
+ swarm-governance on /swarm] Use when the user asks for a full review, triage,
6
+ diagnosis, or direction recommendation on Agy-Squad using repository state or
7
+ supplied evidence (transcripts, logs, CI output, review ledgers, diffs),
8
+ including work that is not a pull request. Applies the Agy-Squad PR Review
9
+ Standard v1.4.0 with cited, commit-pinned evidence and 1-ID-per-row findings.
10
+ ---
11
+
12
+ # Agy-Squad Full Review Skill (Standard v1.4.0)
13
+
14
+ Review a repository target, change, or evidence bundle and answer the question the user asked. This skill is a **Task Spec** for non-diff reviews, evidence triage, and direction decisions (distinct from `pr-review` for branch/PR diffs and `self-diagnosis` for automated harness self-audits). When executed as a team or `/swarm`, compose it with the `swarm-governance` **Execution Modifier** and choose `squad_planner` (`node bin/agy-squad.mjs plan`) for `/swarm` or `dispatch_squad` (`node bin/agy-squad.mjs dispatch`) for `invoke_subagent`.
15
+
16
+ The governing report contract is [Agy-Squad PR Review Standard v1.4.0](../pr-review/references/pr-review-standard.md); see [Roles & skill workflows](../../../docs/roles-and-workflows.md#full-review) for the composition matrix, MCP/CLI surface map, and 4-check runtime closure gate. Passing tests, docs, prior approvals, and transcripts are inputs, not proof of architecture or claimed verification.
17
+
18
+ ## Use this skill when
19
+
20
+ - The user asks for a review, audit, triage, or root cause of Agy-Squad, a commit range, subsystem, skill, or document beyond a single PR diff.
21
+ - The user supplies non-diff evidence (transcripts, logs, CI runs, ledgers, benchmarks) or asks a direction question (merge/rework, keep/close, option selection, sequencing).
22
+ - A PR review needs multi-artifact evidence or a Direction decision section.
23
+
24
+ For a standard PR/branch diff without non-diff direction framing, prefer `pr-review`. Keep diagnosis separate from unauthorized code edits.
25
+
26
+ ## Invariants (Non-negotiables)
27
+
28
+ 1. **Read the standard first.** Its ten categories, category records, finding schema, status enums, evidence rules, and report structure are mandatory; this skill adds non-PR intake and Direction decisions.
29
+ 2. **Pin target and evidence.** Record revisions, SHA-256 hashes, dirty state, access status, and unexamined scope.
30
+ 3. **Architecture before runtime.** Trace `design thesis / invariant -> architecture decision -> public contract -> implementation -> verification` before judging behavior; record contract mismatches as findings.
31
+ 4. **All ten categories, all three triage buckets.** Every category (`ARCH`, `DOC`, `SKILL`, `MCP`, `RUN`, `SVC`, `DB`, `SCRIPT`, `TEST`, `DEP`) records scope, coverage, P1, P2, P3, verification, and verdict (`Not applicable` or `None identified within reviewed scope` or `Not assessed` — never silent skips).
32
+ 5. **`1 ID = 1 Row`.** One stable ID per independently remediable defect (no umbrella ranges or silent drops). One canonical status per row; `Informational` applies only to non-defects in Section 8.
33
+ 6. **Cite exact locators and label evidence.** Cite commit-pinned line ranges, transcript steps/timestamps, exact commands + exit codes, or dated URLs. Separate observed execution from `Source-derived inference`.
34
+ 7. **Do not inherit prior verdicts or waive findings from pass counts.** Revalidate prior items explicitly (accept, revise, or reject).
35
+ 8. **Separate content acceptance from integrity audit.** Content reviewer/lead owns `PASS`/`FAIL`/`BLOCKED` (or `APPROVE`/`REQUEST_CHANGES`); an independent auditor (`audit-<id>` on `/swarm` or `integrity_auditor[:<target>]` via slot) owns `CLEAN`/`INTEGRITY VIOLATION` and cannot waive content defects. Lead re-reviews after `CLEAN`. See [review roles](references/review-roles.md).
36
+ 9. **Enforce report readability.** Reserve inline backticks for code identifiers, file paths, flags, CLI commands, and verdict enums. Write plain numbers, counts, English statuses, labels, and quoted sentences as clean prose (no backtick-pill clutter).
37
+
38
+ ### Citation contract
39
+
40
+ - **Code:** commit-pinned `path#Lx-Ly` with `HEAD`/tree pinned in Section 1.
41
+ - **Transcript:** manifest SHA-256 hash, `step N @ ISO timestamp`, and verbatim quote.
42
+ - **Command:** working directory, exact command, exit code, and observed output excerpt.
43
+ - **External source:** title, URL, version/date, access date; label inference as `Source-derived inference`.
44
+ - **Prior review:** prior report + finding ID + explicit status (`accepted`, `revised`, or `rejected`).
45
+
46
+ ## Workflow
47
+
48
+ ### Step 0 — Frame the request and execution mode
49
+
50
+ 1. State the decision/review question in one sentence, name the target type (`PR/branch`, `working tree`, `commit range`, `repository/subsystem`, `evidence bundle`, `direction question`, or `incident/regression`), and pin minimum evidence per [references/evidence-intake.md](references/evidence-intake.md).
51
+ 2. Check ambiguity once upfront without asking for facts already visible in git/evidence:
52
+ - If stacked on an unmerged PR base, confirm base branch and merge order.
53
+ - If running on `/swarm`, delegate Step 0 intake (neutral `Flat` vs `Layered` topology, `workspaceIsolation`, retention, coordinator-default model), `open_board` (`?tab=graph`), `swarm_wait`, pointer receipts, multi-cycle continuation, and shutdown to [`swarm-governance`](../swarm-governance/SKILL.md#step-0-pre-flight-intake-ask-when-unspecified) and [swarm intake & UI lifecycle](../swarm-governance/references/intake-and-planning.md#step-0-intake-question-templates).
54
+
55
+ ### Step 1 — Pin the review
56
+
57
+ Populate Section 1 of [references/report-template.md](references/report-template.md): repository, target, base, date, reviewer, standard version, executed trees, **Session Provenance** table, **Evidence manifest**, artifact inventory, and explicit scope/exclusions. For a new `HEAD`, invalidate affected prior conclusions and state which prior findings carry forward.
58
+
59
+ ### Step 2 — Ingest evidence in batches
60
+
61
+ Index large transcripts/logs once and read targeted windows (never poll step-by-step):
62
+ 1. Record size, SHA-256 hash, format, and entry count.
63
+ 2. Extract skeleton first (user turns, final messages, tool names/failures, step/time index).
64
+ 3. Inspect targeted windows around decision points, reversals, constraints, verdicts, and quoted claims.
65
+ 4. Separate user assertions, model claims, tool outputs, and external claims; log skipped or truncated ranges.
66
+
67
+ See [references/evidence-intake.md](references/evidence-intake.md) for batch extraction and hashing commands.
68
+
69
+ ### Step 3 — Trace architecture before runtime
70
+
71
+ Trace `design thesis / invariant -> architecture decision -> public contract -> implementation -> verification` using normative records (`docs/plans/LEDGER.md`, `docs/plans/wsl-cli-verification.md`, commit `ee10ebc`). Distinguish historical design records from active contracts and note compatibility impacts of intentional changes.
72
+
73
+ ### Step 4 — Review the ten categories & record findings
74
+
75
+ Map each artifact to one primary category and cross-reference secondary impacts without double-counting. Record concise 10-field blocks for `P0`/`P1`/`P2` and `1 ID = 1 Row` table entries for `P3` per [pr-review-standard.md](../pr-review/references/pr-review-standard.md). Use Section 8 (`Post-Remediation Residuals & Deferred Dispositions`) as the mandatory sink for residuals, deferred proposals, by-design closures, and informational items. A zero-finding ("No findings") result is valid; finding quotas are prohibited.
76
+
77
+ ### Step 5 — Answer direction questions (when requested)
78
+
79
+ Add a **Direction decision** subsection to Section 7 containing:
80
+ 1. One-sentence **Decision question**.
81
+ 2. Cited **Constraints** (hard constraints vs preferences).
82
+ 3. **Options** (including status quo and a minimal/do-less option) with preserved invariants, costs, dependencies, reversibility, blast radius, and pros/cons evidence.
83
+ 4. **Recommendation** with load-bearing evidence, **Falsifiers**, ordered **Immediate next actions** (each with an acceptance test), and **What not to do**.
84
+
85
+ Keep coverage and disposition separate: do not recommend merging while material categories are unreviewed or P1/P2 blockers stay open.
86
+
87
+ ### Step 6 — Write, recheck, and close
88
+
89
+ Save under `docs/reviews/<review-slug>.md` using [references/report-template.md](references/report-template.md) (omit Section 9 unless `/self-diagnosis` cohorts ran; write `None (0 open residuals, 0 deferred items)` if Section 8 is empty). Recheck fixes against primary and cross-referenced categories at the fixed revision—a fix commit alone is not closure. Before delivering, verify all checks in [references/report-template.md](references/report-template.md#quality-gates).
@@ -0,0 +1,146 @@
1
+ # Evidence intake for full reviews
2
+
3
+ This reference supports Step 1 and Step 2 of [../SKILL.md](../SKILL.md). It is a procedure, not a substitute for the [PR Review Standard v1.4.0](../../pr-review/references/pr-review-standard.md).
4
+
5
+ ## 0. Target types and minimum evidence
6
+
7
+ | Target type | Baseline to pin | Minimum evidence |
8
+ | --- | --- | --- |
9
+ | Pull request / branch | merge-base and head SHA | diff, changed-file inventory, CI commit, prior review ledger |
10
+ | Working tree | `HEAD` plus dirty delta | tracked diff, untracked inventory, commands run |
11
+ | Commit range | base..head | changed files, affected contracts, tests |
12
+ | Whole repository or subsystem | one pinned SHA | inventory, dependencies, normative records |
13
+ | Evidence bundle | artifact hashes and locators | transcript/log/CI plus the claims they are meant to prove |
14
+ | Direction question | pinned state plus decision constraints | options, prior decisions, evidence for and against each option |
15
+ | Incident / regression | last known good..bad | reproduction, logs, timeline, blast radius |
16
+
17
+ ## 1. Build the evidence manifest first
18
+
19
+ Every artifact that will be cited gets an `EID`, a locator, a content hash or size, a class, an access status, and an examined scope. The manifest is part of the report, not private scratch work.
20
+
21
+ | Field | Meaning |
22
+ | --- | --- |
23
+ | `EID` | Stable ID such as `E01`; findings cite it. |
24
+ | `Artifact` | File name, transcript, CI run, URL, or command output. |
25
+ | `Locator` | Path, URL, commit, step range, or line range. |
26
+ | `SHA-256 / size` | Content identity; use the hash when available, size plus date otherwise. |
27
+ | `Class` | Repository source, normative design record, user-provided evidence, local execution, CI log, external source, or prior review. |
28
+ | `Access` | `Examined`, `Partially examined`, `Unavailable`, or `Not examined`. |
29
+ | `Examined` | Exact sections, steps, lines, or queries actually read. |
30
+
31
+ Rules:
32
+
33
+ - A hash proves identity, not truth. It does not prove that the content was read or that its claims are correct.
34
+ - State when an attachment, environment, CI run, or external source was unavailable. Do not fill the gap with inference.
35
+ - Keep user-provided evidence separate from repository evidence. A transcript is a record of claims, not an authoritative design record.
36
+ - If the evidence is large, record the index you built and the windows you read. Do not imply full coverage from targeted reads.
37
+
38
+ ## 2. Pin revisions and working state
39
+
40
+ For a Git target, record at minimum:
41
+
42
+ ```bash
43
+ git rev-parse HEAD
44
+ git rev-parse <base>
45
+ git status --porcelain
46
+ git diff --stat <base>..HEAD
47
+ git diff --name-status <base>..HEAD
48
+ ```
49
+
50
+ For a working-tree review, also capture the tracked diff and the untracked inventory. For a PR, record the PR URL, base branch, head branch, head SHA, mergeability, and the exact commit each CI run executed. Distinguish the PR head from GitHub's generated merge commit.
51
+
52
+ For local execution, record the runtime and environment, not just the command:
53
+
54
+ ```text
55
+ cwd: <path>
56
+ runtime: <node/python version, OS, sandbox mode>
57
+ command: <exact command>
58
+ exit: <code>
59
+ output: <relevant excerpt, with truncation marked>
60
+ ```
61
+
62
+ ## 3. Transcript protocol (batch, never poll)
63
+
64
+ A typical JSONL transcript has one object per step with fields such as `step_index`, `source`, `type`, `status`, `created_at`, `content`, `thinking`, and `tool_calls`. Do not assume that schema; inspect the first and last records and the key distribution.
65
+
66
+ ### 3.1 Index once
67
+
68
+ Use one batch pass to produce:
69
+
70
+ - total records, byte size, hash, first and last timestamps;
71
+ - counts by `type` and `source`;
72
+ - every user turn with step and timestamp;
73
+ - every assistant message with non-empty `content`, with length and a short prefix;
74
+ - tool call counts by name and error counts;
75
+ - a step/time index around quoted evidence.
76
+
77
+ A compact Node recipe for user-supplied or exported JSONL files (for internal Antigravity `.system_generated/` transcripts, shell reads are hook-blocked under `L6`; call `query_transcript` / `read_transcript` in one batch pass from the coordinator session if `/swarm` workers lack those MCP tools):
78
+
79
+ ```bash
80
+ node -e '
81
+ const fs = require("node:fs");
82
+ const p = process.argv[1];
83
+ const rows = fs.readFileSync(p, "utf8").trim().split(/\r?\n/).map(JSON.parse);
84
+ const counts = {};
85
+ for (const r of rows) counts[r.type] = (counts[r.type] ?? 0) + 1;
86
+ console.log(JSON.stringify({ rows: rows.length, counts }, null, 2));
87
+ for (const r of rows) {
88
+ if (r.type === "USER_INPUT") console.log(`USER step=${r.step_index} at=${r.created_at}\n${String(r.content ?? "").slice(0, 500)}\n`);
89
+ }
90
+ ' transcript_full.jsonl
91
+ ```
92
+
93
+ Add a second pass for assistant messages and tool calls only when the index shows they matter. Never call a transcript-reading tool once per step; that is the quadratic pattern this protocol exists to prevent.
94
+
95
+ ### 3.2 Read targeted windows
96
+
97
+ For each key step, read a bounded window (for example ±3 steps) and record:
98
+
99
+ - the exact user request or model claim, quoted;
100
+ - whether it is a user assertion, a model claim, a tool result, or an external-source claim;
101
+ - the tool command and result if the claim depends on execution;
102
+ - the timestamp and step;
103
+ - what the surrounding window does not establish.
104
+
105
+ ### 3.3 Separate the four evidence layers
106
+
107
+ | Layer | What it proves | What it does not prove |
108
+ | --- | --- | --- |
109
+ | User statement | The user's requirement, verdict, or constraint | That the claim is factually correct |
110
+ | Model statement | What the model asserted or proposed | That the assertion was executed or verified |
111
+ | Tool result | What the tool returned in that run | That the run was representative or complete |
112
+ | Repository source | What the code or document currently says | That it behaves that way at runtime |
113
+
114
+ Do not cite a model's summary of a transcript as if it were the transcript. Quote the underlying step or tool result.
115
+
116
+ ## 4. Logs, CI, and command output
117
+
118
+ - Record the exact revision, job, command, and environment.
119
+ - Distinguish a passing summary from the assertions that were executed. A green suite that never exercises the named guarantee is not evidence for that guarantee.
120
+ - A failure caused by the review environment (missing OS feature, sandbox denial, unavailable service) is an environment limitation, not a product defect. State it as such and do not count it against the target.
121
+ - If a test cannot run, give the reproduction steps and label the expected result as source-derived. Do not claim it passed or failed.
122
+
123
+ ## 5. Citation formats
124
+
125
+ | Evidence | Format |
126
+ | --- | --- |
127
+ | Code at a commit | `https://github.com/paragon-ux/Agy-Squad/blob/<sha>/path#Lx-Ly` |
128
+ | Local code | `path#Lx-Ly` with the SHA pinned in Section 1 |
129
+ | Transcript | `transcript_full.jsonl step 1375 @ 2026-11-10T06:29:55Z` plus a short quote |
130
+ | Command | `cwd`, command, exit code, output excerpt |
131
+ | CI | workflow, job, revision, URL, conclusion, and the asserted check |
132
+ | External | title, URL, version/date, access date |
133
+ | Prior review | report path, finding ID, and the prior revision |
134
+
135
+ Mark `Observed` for execution you performed or output you inspected, and `Source-derived inference` for conclusions drawn from code or documents without execution. Never blur the two.
136
+
137
+ ## 6. Intake failure modes to avoid
138
+
139
+ - Reading the first and last transcript entries and calling it a review.
140
+ - Polling a transcript one or two steps at a time and inflating the token cost.
141
+ - Treating a model's self-report ("I ran the tests", "I searched the web") as execution evidence.
142
+ - Treating a green test summary as proof of the guarantee the test names.
143
+ - Treating a hash as proof of correctness rather than identity.
144
+ - Citing a file you fetched but did not read, or a section you read but did not understand.
145
+ - Letting a prior review's verdict stand without revalidating its findings.
146
+ - Hiding unavailable evidence inside a confident narrative.
@@ -0,0 +1,216 @@
1
+ # Full review report template
2
+
3
+ Copy this skeleton into `docs/reviews/<review-slug>.md` and replace every `<...>` placeholder. Delete no mandatory section; use Not applicable with a reason where a section does not apply, and None identified within reviewed scope or Not assessed inside each triage bucket as the standard requires.
4
+
5
+ **Formatting & Readability:** Keep reports scannable in plain prose and Markdown tables. Reserve backticks strictly for exact code identifiers, file paths, CLI flags, and commands—never wrap plain numbers, statuses (Closed, Open, PASS), or quoted sentences inside inline backticks or fenced code blocks inside table cells.
6
+
7
+ ---
8
+
9
+ # <Review title>
10
+
11
+ **Governing Standard:** Agy-Squad PR Review Standard `v1.4.0` ([`pr-review-standard.md`](../../pr-review/references/pr-review-standard.md))
12
+ **Review type:** `<PR / branch / working tree / subsystem / evidence bundle / direction decision>`
13
+ **Review date:** `<YYYY-MM-DD>`
14
+ **Reviewer:** `<name / agent>`
15
+ **Standard version:** `1.4.0`
16
+
17
+ ## 1. Review metadata, Session Provenance, and evidence limits
18
+
19
+ ### 1.1 Target
20
+
21
+ | Field | Value |
22
+ | --- | --- |
23
+ | Repository | `paragon-ux/Agy-Squad` |
24
+ | Target | `<PR URL / branch / commit / working tree / evidence bundle>` |
25
+ | Comparison base | `<base SHA / tag / none>` |
26
+ | Head / tree | `<head SHA / tree>` |
27
+ | Working-tree state | `<clean / dirty delta / untracked files>` |
28
+ | CI revision | `<exact commit / run URL>` |
29
+ | Prior review | `<path and finding IDs, or None>` |
30
+
31
+ ### 1.2 Session Provenance
32
+
33
+ | Session # | Operator Conversation ID | Parent Session | Date | Base..Head + Working-Tree State | Skill / Topology Invoked |
34
+ | --- | --- | --- | --- | --- | --- |
35
+ | `<n>` | `<id or Unavailable>` | `<parent or None>` | `<YYYY-MM-DD>` | `<base..head + state>` | `<skill / single-agent / cohort>` |
36
+
37
+ ### 1.3 Evidence manifest
38
+
39
+ | EID | Artifact | Locator | SHA-256 / size | Class | Access | Examined |
40
+ | --- | --- | --- | --- | --- | --- | --- |
41
+ | `E01` | `<file/transcript/CI>` | `<path/URL/step>` | `<hash/size>` | `<class>` | `<Examined / Partial / Unavailable>` | `<lines/steps>` |
42
+
43
+ ### 1.4 Evidence limits
44
+
45
+ - `<Unavailable or partial evidence, with reason>`
46
+ - `<Environment limitations, e.g. WSL unavailable, sandbox denial>`
47
+ - `<Claims that remain source-derived rather than observed>`
48
+
49
+ ## 2. File/artifact-to-category inventory and coverage matrix
50
+
51
+ | Artifact | Change / role | Primary category | Cross-references | Coverage |
52
+ | --- | --- | --- | --- | --- |
53
+ | `<path>` | `<added/modified/unchanged>` | `<ARCH...DEP>` | `<categories>` | `<Complete/Partial/Not reviewed>` |
54
+
55
+ | Category | Scope covered | Coverage | Verdict |
56
+ | --- | --- | --- | --- |
57
+ | `ARCH` | `<files/evidence>` | `<Complete/Partial/Not reviewed>` | `<Changes required / No findings / Incomplete / Not applicable>` |
58
+ | `DOC` | | | |
59
+ | `SKILL` | | | |
60
+ | `MCP` | | | |
61
+ | `RUN` | | | |
62
+ | `SVC` | | | |
63
+ | `DB` | | | |
64
+ | `SCRIPT` | | | |
65
+ | `TEST` | | | |
66
+ | `DEP` | | | |
67
+
68
+ ## 3. Architecture-to-implementation trace
69
+
70
+ For each behavior or claim:
71
+
72
+ `design thesis / invariant -> architecture decision -> public contract -> implementation -> verification`
73
+
74
+ | Claim | Normative source | Architecture decision | Public contract | Implementation | Verification | Result |
75
+ | --- | --- | --- | --- | --- | --- | --- |
76
+ | `<claim>` | `<LEDGER ID / standard / user requirement>` | `<decision>` | `<schema/docs>` | `<code>` | `<test/run/evidence>` | `<satisfied / mismatch / unverified>` |
77
+
78
+ Narrative: `<what the trace establishes and what it does not>`
79
+
80
+ ## 4. Category reviews
81
+
82
+ ### 4.1 `ARCH` — Architecture and contracts
83
+
84
+ - **Scope:** `<changed and unchanged artifacts examined>`
85
+ - **Coverage:** `<Complete / Partial / Not reviewed; what remains>`
86
+ - **P1 — high priority:** `<finding IDs or None identified within reviewed scope / Not assessed>`
87
+ - **P2 — medium priority:** `<finding IDs or ...>`
88
+ - **P3 — low priority:** `<finding IDs or ...>`
89
+ - **Verification:** `<tests inspected/executed, CI, missing proof>`
90
+ - **Verdict:** `<Changes required / No findings within reviewed scope / Incomplete / Not applicable>`
91
+
92
+ Repeat this seven-item record for `DOC`, `SKILL`, `MCP`, `RUN`, `SVC`, `DB`, `SCRIPT`, `TEST`, and `DEP`.
93
+
94
+ ### 4.12 Integrity audit record (when an integrity audit is used)
95
+
96
+ - **Role contract:** see [review roles](review-roles.md).
97
+ - **Auditor / independence:** `<who, parent, independence from the reviewed work>`
98
+ - **Verdict enum:** `CLEAN` / `INTEGRITY VIOLATION`
99
+ - **Coverage:** `<transcripts and step ranges, tool traces, artifacts, evidence classes; what was not covered>`
100
+ - **Findings:** `<IDs or None identified within reviewed scope / Not assessed>`
101
+ - **Lead re-review after CLEAN:** `<who re-reviewed the final artifacts and the resulting content verdict>`
102
+ - **Enforcement:** `<violation block, rejection/re-run, penalty or ledger record>`
103
+ - **Verdict:** `<CLEAN / INTEGRITY VIOLATION / Not applicable>`
104
+
105
+ ## 5. Findings
106
+
107
+ ### 5.1 P0/P1/P2 finding records
108
+
109
+ #### `<ID>` — `<title>` (`P1`, `Open (Pre-Remediation)`)
110
+
111
+ 1. **Title, priority, status:** `<...>`
112
+ 2. **Contract provenance:** `<exact invariant / decision / contract / external norm>`
113
+ 3. **Source evidence:** `<commit-pinned links, lines, symbol, transcript step>`
114
+ 4. **Trigger:** `<concrete input/state/interleaving/instruction>`
115
+ 5. **Expected / actual:** `<mismatch; observed vs source-derived>`
116
+ 6. **Impact:** `<consequence and scope>`
117
+ 7. **Required remediation:** `<behavior to restore, compatibility constraints, affected surfaces>`
118
+ 8. **Acceptance evidence:** `<regression case and assertions, or source reconciliation>`
119
+ 9. **Root cause / related IDs:** `<cross-layer connection>`
120
+ 10. **Closure:** `<fix commit, evidence at that revision, recheck, residual limits>`
121
+
122
+ ### 5.2 P3 advisory table
123
+
124
+ | ID | Wave/Session | Cat | Status | Source | Defect / Proposal | Disposition / Fix | Verification & Bundle SHA |
125
+ | --- | --- | --- | --- | --- | --- | --- | --- |
126
+ | `<ID>` | &lt;wave/session&gt; | &lt;cat&gt; | &lt;status&gt; | `<path#line>` | &lt;defect summary&gt; | &lt;fix summary&gt; | `<evidence or sha>` |
127
+
128
+ ## 6. Cross-category root causes and remediation order
129
+
130
+ - **Root cause 1:** `<description>` — `<categories and IDs>`
131
+ - **Remediation order:** `<ordered steps with dependencies and rationale>`
132
+
133
+ ## 7. Overall disposition, Direction decision, and finding closure
134
+
135
+ ### 7.1 Overall disposition
136
+
137
+ - **Coverage:** `<complete / partial / incomplete>` across `<n>` material categories.
138
+ - **Blocking findings:** `<IDs>` or `None`.
139
+ - **Disposition:** `<Approve / Request changes / Incomplete / Not applicable>`.
140
+ - **Reason:** `<coverage and blocking-finding basis; never a pass percentage>`.
141
+
142
+ ### 7.2 Direction decision (required when the user asks what to do)
143
+
144
+ - **Decision question:** `<one sentence>`
145
+ - **Role separation:** `<content owner / integrity auditor / lead re-review after CLEAN, or Not applicable>`
146
+ - **Hard constraints:** `<constraint>` — `<citation>`
147
+ - **Preferences:** `<preference>` — `<citation>`
148
+
149
+ | Option | Preserves | Costs / risks | Dependencies | Reversibility | Evidence for | Evidence against |
150
+ | --- | --- | --- | --- | --- | --- | --- |
151
+ | `<status quo>` | | | | | | |
152
+ | `<option B>` | | | | | | |
153
+ | `<option C>` | | | | | | |
154
+
155
+ - **Recommendation:** `<option and rationale>`
156
+ - **Load-bearing evidence:** `<IDs and citations>`
157
+ - **Falsifiers:** `<what evidence would change the recommendation>`
158
+ - **Immediate next actions:** `<ordered actions with acceptance tests>`
159
+ - **What not to do:** `<ruled-out action and evidence>`
160
+
161
+ ### 7.3 Finding closure table
162
+
163
+ | ID | Category | Priority | Status | Fix / evidence at revision | Recheck result |
164
+ | --- | --- | --- | --- | --- | --- |
165
+ | `<ID>` | `<cat>` | `<P#>` | `<status>` | `<commit/link>` | `<closed/residual>` |
166
+
167
+ ## 8. Post-Remediation Residuals & Deferred Dispositions
168
+
169
+ `<None (0 open residuals, 0 deferred items)>` or the atomic table:
170
+
171
+ | ID | Wave/Session | Cat | Status | Source | Defect / Proposal | Disposition / Fix | Verification & Bundle SHA |
172
+ | --- | --- | --- | --- | --- | --- | --- | --- |
173
+ | `<ID>` | `<wave>` | `<cat>` | `<Residual (Open) / Closed (Post-Remediation) / Deferred / Won't Fix / Closed (By Design) / Informational>` | `<link>` | `<defect>` | `<disposition>` | `<evidence>` |
174
+
175
+ ## 9. `/self-diagnosis` Cohort & Bundle Ledger
176
+
177
+ Include only when cohorts were dispatched.
178
+
179
+ ### 9.1 Cohort Provenance
180
+
181
+ | Wave | Session ID | Stage | Subagent IDs | Pre-Fix Bundle SHA | Re-Verify Bundle SHA | Teardown |
182
+ | --- | --- | --- | --- | --- | --- | --- |
183
+ | `<wave>` | `<id>` | `<stage>` | `<ids>` | `<sha or N/A>` | `<sha>` | `<retained/torn down>` |
184
+
185
+ ### 9.2 Wave Finding Ledger
186
+
187
+ | ID | Category | Priority | Status | Specialist / Cohort Verification |
188
+ | --- | --- | --- | --- | --- |
189
+ | `<ID>` | `<cat>` | `<P#>` | `<status>` | `<evidence>` |
190
+
191
+ ## Appendix A — Verification record
192
+
193
+ | Check | Revision | Environment | Result | Evidence |
194
+ | --- | --- | --- | --- | --- |
195
+ | `<command>` | `<sha>` | `<OS/runtime>` | `<pass/fail/blocked>` | `<output/link>` |
196
+
197
+ ## Appendix B — Quoted evidence
198
+
199
+ | EID / locator | Quote | Class | What it establishes |
200
+ | --- | --- | --- | --- |
201
+ | `<step/line>` | &lt;short verbatim quote&gt; | &lt;user/model/tool/source&gt; | &lt;bounded claim&gt; |
202
+
203
+ ## Quality gates
204
+
205
+ - [ ] The standard was read; target, base, dirty state, evidence manifest, and exclusions are pinned.
206
+ - [ ] Every changed file or artifact is mapped to one primary category; all ten categories have scope, coverage, P1/P2/P3, verification, and verdict.
207
+ - [ ] Every finding has one ID, one status, and the required fields; no umbrella or range IDs.
208
+ - [ ] Every material claim has a locator; observed and inferred are separated.
209
+ - [ ] Prior findings are explicitly accepted, revised, or rejected.
210
+ - [ ] Verification gaps are separate from defects; unavailable evidence is stated.
211
+ - [ ] Section 8 contains every residual, deferred, by-design, and informational item.
212
+ - [ ] A requested direction decision has constraints, options, a recommendation, and falsifiers.
213
+ - [ ] When an integrity audit is used: the content and integrity verdicts are separate, the auditor did not approve content, the lead re-reviewed after `CLEAN`, and `INTEGRITY VIOLATION` hard-blocks acceptance.
214
+ - [ ] The disposition matches coverage and open findings; no approval from a pass rate or an unreviewed category.
215
+ - [ ] Formatting & Readability: prose and table cells avoid unnecessary inline backticks on numbers, statuses, and quoted sentences, and avoid fenced code blocks inside narrative/tables.
216
+ - [ ] The report is saved at a stable path and linked from the response.
@@ -0,0 +1,91 @@
1
+ # Review roles: content acceptance vs integrity audit
2
+
3
+ This reference supports the `full-review` non-negotiable on role separation. It exists because a review can fail even when every checklist item is covered: the reviewer may conflate **whether the content is acceptable** with **whether the work was produced authentically**.
4
+
5
+ ## 1. Two questions, two verdicts
6
+
7
+ | Role | Question | Verdict enum | Authority | Typical evidence |
8
+ | --- | --- | --- | --- | --- |
9
+ | Responsible reviewer / squad lead | Does the deliverable satisfy the request and its contracts? | `APPROVE` / `REQUEST_CHANGES`, or `PASS` / `FAIL` / `BLOCKED` | Final content acceptance; parent of the leaf agents | requirements, artifacts, tests, diffs, source lines |
10
+ | Independent integrity auditor | Was the deliverable produced authentically, with the claimed tool execution and evidence, without gaming the process or the result? | `CLEAN` / `INTEGRITY VIOLATION` | Cannot approve content; can block acceptance and require rework | transcripts, tool traces, hashes, execution logs, reasoning/evidence correspondence |
11
+
12
+ Do not collapse these into one role. An integrity auditor that issues `PASS` becomes a second content gate; a content reviewer that waives integrity defects as “advisories” becomes an accomplice.
13
+
14
+ ## 2. Required ordering
15
+
16
+ 1. The responsible reviewer or lead prepares the content verdict on the draft. This is provisional.
17
+ 2. The independent integrity auditor runs after the working cohort has completed and before acceptance. It audits process and evidence, not content quality.
18
+ 3. If the audit is `CLEAN`, the responsible reviewer re-reviews the final artifacts and issues the **final content verdict**. The auditor does not issue it.
19
+ 4. If the audit is `INTEGRITY VIOLATION`, acceptance stops. Record the violation, reject the work, and require a re-run or a recorded remediation. The violation cannot be downgraded to `PASS with advisories`.
20
+ 5. The acceptance record contains both verdicts, the auditor identity, the reviewed revision, and the lead's post-audit recheck.
21
+
22
+ A content `PASS` that predates the integrity audit is not final. A `CLEAN` audit is necessary but not sufficient for acceptance.
23
+
24
+ ## 3. Verdict discipline
25
+
26
+ - Content verdicts are exact enum values: `PASS`, `FAIL`, `BLOCKED` or `APPROVE`, `REQUEST_CHANGES`. No `PASS with …`, `CONDITIONAL PASS`, `PASS (advisories)`, or other compound forms.
27
+ - Integrity verdicts are exact enum values: `CLEAN`, `INTEGRITY VIOLATION`. No `PASS`, no `FAIL`, no `CLEAN with advisories`.
28
+ - An advisory or observation is a separate record. It is not a verdict and cannot soften an `INTEGRITY VIOLATION`.
29
+ - A compound or conditional verdict is itself a finding: it usually means the role is confused or the parser can be evaded.
30
+
31
+ ## 4. What the integrity auditor must examine
32
+
33
+ - Tool execution versus claims: did the agent actually run the commands/searches it cites? Are exit codes and outputs present and consistent?
34
+ - Reasoning versus evidence: does the reported conclusion follow from observed evidence, or was it pre-concluded and then backfilled?
35
+ - Artifact authenticity: are files, hashes, and citations real, current, and within scope? Were tests or fixtures fabricated, stubbed, or bypassed?
36
+ - Process compliance: scope limits, banned behaviors, prompt-injection resistance, and whether the agent tried to satisfy a checker rather than the task.
37
+ - Result validity is necessary but not sufficient. A valid-looking deliverable can still be an integrity violation if the process or evidence was fabricated.
38
+
39
+ ## 5. Enforcement, not prose
40
+
41
+ A warning such as “cheating will be detected and rejected” is only true if a mechanism exists:
42
+
43
+ - an independent auditor with the authority to issue `INTEGRITY VIOLATION`;
44
+ - a hard acceptance block on that verdict, with no `PASS` override;
45
+ - a recorded violation and a re-run/remediation requirement;
46
+ - a visible penalty or ledger entry that survives teardown.
47
+
48
+ If no such mechanism exists, label the warning as advisory. Do not claim it is enforced. Prose alone does not deter a model that is optimizing for the visible verdict.
49
+
50
+ ### Warning template (only with enforcement)
51
+
52
+ > **MANDATORY INTEGRITY WARNING:**
53
+ >
54
+ > DO NOT CHEAT. All implementations must be genuine. DO NOT hardcode test results, create dummy/facade implementations, or circumvent the intended task. An independent integrity auditor will verify your work. Integrity violations WILL be detected and your work WILL be rejected.
55
+
56
+ Do not use this text unless the independent auditor, the `INTEGRITY VIOLATION` block, the rejection/re-run path, and the recorded penalty actually exist. Otherwise the warning is a false claim, which is worse than no warning.
57
+
58
+ ## 6. Proportional coverage and transcript audits
59
+
60
+ - **Layered cohort:** Phase 2 Agy-Squad cohorts (`mcp/planner.mjs`, `docs/roles-and-workflows.md`) default to one flat peer `audit-<id>` Integrity Auditor (`integrity_auditor:<id>`); use hierarchical multi-layer auditors only when manually configured without flat `audit-<id>`.
61
+ - **Flat cohort:** use a flat integrity audit; every specialist is covered directly.
62
+ - Coverage must be explicit: which transcripts, which step ranges, which tool traces, which artifacts, and which evidence classes. State what was not covered.
63
+ - Define a query budget and merge/deduplicate transcript ranges. A single-pass batch query is the default; repeated overlapping queries are a finding unless a new evidence class requires them.
64
+ - The specialist doing transcript forensics needs the batch/coverage instruction too, not only the lead. Otherwise one specialist over-queries and another barely queries, and the audit quality becomes random.
65
+
66
+ ## 7. Worked contrast (Agy-Squad PR #3)
67
+
68
+ | System | Integrity role | Verdict | Content role | Verdict |
69
+ | --- | --- | --- | --- | --- |
70
+ | Teamwork audit (`35bebb82…`, step 0/89) | `teamwork_auditor`, forensic integrity auditor | `CLEAN` / `INTEGRITY VIOLATION` | `teamwork_reviewer` (`3f31598b…`, step 0/105) | `APPROVE` / `REQUEST_CHANGES` |
71
+ | PR #3 adversarial squad (`3303968c…`, step 0/111) | Adversarial Review Lead | `PASS` / `FAIL` / `BLOCKED` | Working squad lead | Already issued `PASS` before the audit; no post-audit re-review |
72
+
73
+ Observed consequences in PR #3:
74
+
75
+ - The adversarial lead's brief required `Verdict: PASS or FAIL/BLOCKED`; its report returned `PASS with Preserved Advisories & Corrective Remediation Ledger` (`3303968c…`, step 111/159).
76
+ - Specialist 1 returned `CONDITIONAL PASS / PARTIAL COMPLIANCE` (`eaad8f1a…`, step 73); Specialist 2 returned `PASS with Preserved Advisories & Temporal Working Tree Notice` (`bba13371…`, step 111).
77
+ - The lead tested the verdict parser, saw `Set(2) { 'PASS', 'FAIL' }`, then produced a report whose verdict set was `Set(1) { 'PASS' }` (`3303968c…`, steps 156–158). That is a content-verdict optimization applied to an integrity role.
78
+ - Specialist 1 made 10 `query_transcript` calls over overlapping ranges; Specialist 2 made 2 summary queries (`eaad8f1a…`, steps 27–45; `bba13371…`, steps 75/77). The leaf brief did not contain the batch-efficiency instruction given to the lead.
79
+
80
+ Lesson: the integrity auditor must not be asked to produce a content verdict. If it is, it will optimize the content verdict and can waive the integrity defects it was created to catch.
81
+
82
+ ## 8. Review checklist
83
+
84
+ - [ ] Is content acceptance owned by a named reviewer/lead, not the integrity auditor?
85
+ - [ ] Is the integrity auditor independent of the work being audited?
86
+ - [ ] Are the two verdict enums distinct and exact?
87
+ - [ ] Does the lead re-review and issue the final content verdict after a `CLEAN` audit?
88
+ - [ ] Does `INTEGRITY VIOLATION` hard-block acceptance, with a recorded violation and re-run/penalty?
89
+ - [ ] Is audit coverage proportional, explicit, and recorded?
90
+ - [ ] Are transcript queries batch-oriented, deduplicated, and budgeted?
91
+ - [ ] Are compound/conditional verdicts treated as findings?
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: pr-review
3
+ description: >-
4
+ [Task Spec — PR/branch diff & CI review; pair with swarm-governance on /swarm]
5
+ Use this skill when the user asks to perform, update, or verify a pull request
6
+ or branch review in Agy-Squad. Enforces the Agy-Squad PR Review Standard
7
+ (v1.4.0) with commit-pinned and session-pinned metadata, architecture-before-runtime
8
+ tracing, ten mandatory categories (ARCH, DOC, SKILL, MCP, RUN, SVC, DB,
9
+ SCRIPT, TEST, DEP), 1-ID-per-row finding records, post-remediation residual
10
+ tracking, and structured reports under docs/reviews/.
11
+ ---
12
+
13
+ # Agy-Squad PR Review Skill (Standard v1.4.0)
14
+
15
+ Conduct pull request and branch diff/CI reviews in `Agy-Squad`. For broad non-diff evidence bundles, repo-wide triage, or Direction decisions, use [`full-review`](../full-review/SKILL.md). To run multi-agent reviews on `/swarm`, pair this **Task Spec** with [`swarm-governance`](../swarm-governance/SKILL.md) (which owns `squad_planner` / `node bin/agy-squad.mjs plan`, `open_board`, `swarm_wait`, pointer receipts, and closure; `dispatch_squad` / `agy-squad dispatch` is `invoke_subagent` fallback only). Consult [references/pr-review-standard.md](./references/pr-review-standard.md), [Core workflows](../../../docs/core-workflows.md), and [Roles & skill workflows](../../../docs/roles-and-workflows.md#pr-review).
16
+
17
+ ---
18
+
19
+ ## Invariants
20
+
21
+ 1. **Architecture Before Runtime & Ledger Distinction:** Passing tests, polished docs, and prior approvals are inputs, not proof that implementation satisfies architecture. For every behavior change, trace `design thesis / invariant -> current architecture decision -> public contract -> implementation -> verification`, distinguishing [`docs/plans/LEDGER.md`](../../../docs/plans/LEDGER.md) records: active POSIX/WSL architecture (`L1–L7, L21, L29–L31, L40–L43`), retired/superseded records (`L17` PTY `agy-squad run` retired, `L16`, `L8–L12, L35, L36, L38`), and external shared allocations (`L13–L15, L25–L27, L32–L34`). Never rewrite contracts or docs to match defective code.
22
+ 2. **Ten Mandatory Categories & Zero Finding Quotas:** Map every changed artifact to **one primary category** (`ARCH`, `DOC`, `SKILL`, `MCP`, `RUN`, `SVC`, `DB`, `SCRIPT`, `TEST`, `DEP`) and cross-reference affected categories without double-counting (`"No findings"` is valid; finding quotas are banned; mark filesystem-only persistence under `RUN`/`SVC` and `DB` as `Not applicable`).
23
+ 3. **Evidence Separation & Agy-Squad Runtime Boundaries:** Separate source inspection, attempted reproduction, local execution, and CI logs; inspect actual test assertions. Verify relevant boundaries:
24
+ - *Schema & Stdio Framing:* `request.jsonrpc === "2.0"`, `tools/list` (`mcp/index.js`) vs `dispatch_squad` / `squad_planner`, positive integer `AGY_MAX_STDIO_PAYLOAD_BYTES`, and `10 MiB` stdio cap.
25
+ - *Workspace & Descriptor Containment:* workspace-internal symlink resolution + `O_NOFOLLOW`/`O_NONBLOCK` + `/proc/self/fd/${fd}` in `mcp/dispatch.mjs`; strict symlink rejection in `mcp/handoffs.mjs`.
26
+ - *Worker Capability, Model Provenance & Input Guards:* disallowed built-in `TypeName`s (`research`, `browser`, `image-generator`), manifest agent `workspace === "inherit"` for `invoke_subagent` and `squad_planner` (`/swarm` copy isolation uses top-level `workspaceIsolation`), `modelProvenance` caveats vs `/swarm` pinning, `scopeFiles` path safety + writable overlap diagnostics, boolean `readOnly`, and camelCase/PascalCase conflict rejection.
27
+ - *Pointer-Over-Wire & Bundling:* `<= 500` UTF-8 byte single-line `READY`/`PARTIAL`/`NO_REPORT` grammar, custom `reportRoot` containment, atomic `publish()`, strict single-line verdicts (`mcp/verdicts.mjs`), default `requireIntegrityAudit: true` binding, and `bundle`/`verify`/`prune` SHA-256 verification.
28
+ - *External MCP & CLI:* real stdio subprocesses and `node bin/agy-squad.mjs` (`plan|dispatch|fingerprint|inspect|bundle|verify|prune|verdict`) vs in-process calls.
29
+ 4. **Strict Content vs. Integrity Gate:** Never conflate content acceptance (`Approve` / `Request Changes` or `Content Verdict: PASS | FAIL | BLOCKED`) with the flat Integrity Auditor gate (`audit-<id>` in `/swarm` or `integrity_auditor[:<id>]` in `invoke_subagent`: `Integrity Verdict: CLEAN | INTEGRITY VIOLATION`; `adversarial_*` was retired in Phase 2). Only finalize `Approve` after `CLEAN` and post-remediation re-verification at the fixed revision.
30
+ 5. **1 ID = 1 Row Durability & Plain-Text Readability:** Assign one stable ID per independently remediable problem and one of the 6 canonical statuses (`Open (Pre-Remediation)`, `Closed`, `Residual (Open)`, `Closed (Post-Remediation)`, `Deferred / Won't Fix`, `Closed (By Design)`; `Informational` in Section 8 only). Zero compression or omission: `docs/reviews/<slug>.md` is the surviving durable ledger once `prune` / `--teardown` removes `scratch/`. Reserve inline backticks strictly for identifiers, file paths, flags, and commands—never wrap plain numbers, English statuses, or multi-sentence quotes in inline backticks or fenced code blocks inside prose or table cells.
31
+
32
+ ---
33
+
34
+ ## Workflow
35
+
36
+ ### Step 0: Pre-Flight Intake (Neutral Topology, Evidence & Integrity Gate)
37
+ If topology, workspace isolation, model, or retention options are unspecified, ask via `ask_question` (or multiple-choice prompt) without biasing `Flat` vs `Layered` (for `/swarm` launch templates, `open_board`, `swarm_wait`, and shutdown rules, follow [`swarm-governance`](../swarm-governance/SKILL.md#step-0-pre-flight-intake-ask-when-unspecified)):
38
+ 1. **Execution Topology & Isolation (Ask if Unspecified):**
39
+ - `Flat Cohort`: Specialists report directly to coordinator (`squad_planner` without per-squad leads; fewer coordination hops).
40
+ - `Layered Cohort`: Category specialists + squad leads + coordinator (domain synthesis per squad; higher coordination cost).
41
+ - `Single-Agent Audit`: Direct trace by one reviewer.
42
+ - On `/swarm`, confirm `workspaceIsolation` (`inherit` vs `share` vs `branch`) and model (coordinator default unless the user specifies otherwise).
43
+ 2. **Evidence Retention (`Scope 2` vs `Scope 3`):**
44
+ - `Scope 2 — Swarm bundle prune`: Pass `--keep-reports` to `node bin/agy-squad.mjs prune` to retain loose specialist reports in `scratch/agy-squad/squad-<id>/`, or omit to delete loose specialist files after SHA-256 bundling.
45
+ - `Scope 3 — Self-diagnosis teardown (L41)`: Delete completed `/self-diagnosis` directories (`diagnose.mjs --teardown`) once `docs/reviews/<slug>.md` is updated, or defer cleanup during active multi-wave triage.
46
+ 3. **Integrity Gate:** Confirm `Mandatory Flat Integrity Auditor Gate` (`audit-<id>` on `/swarm` or `integrity_auditor[:<id>]` on `invoke_subagent`).
47
+
48
+ ### Step 1: Pin Review & Session Provenance
49
+ Record repository, target PR/branch/tree state, date, reviewer, standard version `1.4.0`, base/head SHAs, dirty delta, CI SHAs, and **Session Provenance** (`Session # | Operator Conversation ID | Parent Session | Date | Base..Head + Working-Tree State | Skill / Topology Invoked`). List changed files and unchanged dependencies, available evidence (`docs/plans/LEDGER.md`, `docs/plans/wsl-cli-verification.md`, prior reviews, transcripts, CI logs), and explicit exclusions.
50
+
51
+ ### Step 2: Trace Architecture Before Runtime
52
+ For every behavior change, inspect and document the architecture chain (`design thesis -> decision -> contract -> implementation -> verification`) against `LEDGER.md` and public contracts before running or trusting runtime checks.
53
+
54
+ ### Steps 3–4: Execute Category Review, Runtime Verification & Record Findings
55
+ Evaluate every primary and cross-referenced category (`ARCH` through `DEP`) and verify the runtime boundaries from Invariant 3 cleanly (coordinating multi-agent `/swarm` waves and flat `audit-<id>` via [`swarm-governance`](../swarm-governance/SKILL.md)). Record every distinct finding atomically:
56
+ - **`P0` / `P1` / `P2`:** Concise 10-field records (title/priority/status, contract provenance, commit-pinned source evidence, trigger, expected/actual, impact, remediation, acceptance evidence, root cause/related IDs, closure).
57
+ - **`P3`:** Atomic 1-row-per-ID table (`ID | Wave/Session | Cat | Status | Source | Defect / Proposal | Disposition / Fix | Verification & Bundle SHA`).
58
+
59
+ ### Step 5: Verdict, Remediation Re-Verification & Report Closure (`docs/reviews/`)
60
+ Request changes if blocking (`P1`/`P2`) findings remain; mark `Incomplete` if a material category is unreviewed; recommend `Approve` only when all material categories are covered, `Integrity Verdict: CLEAN` completes (when audited), blocking findings are rechecked at the fixed revision, and verification has evidence. Write `docs/reviews/<review-slug>.md` using [references/pr-review-standard.md](./references/pr-review-standard.md) Sections 1–8 (plus Section 9 only when `/self-diagnosis` cohorts run; write `None (0 open residuals, 0 deferred items)` when Section 8 is empty).