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.
- package/.agents/skills/full-review/SKILL.md +89 -0
- package/.agents/skills/full-review/references/evidence-intake.md +146 -0
- package/.agents/skills/full-review/references/report-template.md +216 -0
- package/.agents/skills/full-review/references/review-roles.md +91 -0
- package/.agents/skills/pr-review/SKILL.md +60 -0
- package/.agents/skills/pr-review/references/pr-review-standard.md +163 -0
- package/.agents/skills/self-diagnosis/SKILL.md +63 -0
- package/.agents/skills/self-diagnosis/references/execution-and-teardown.md +71 -0
- package/.agents/skills/self-diagnosis/references/optimization-and-review-rubric.md +61 -0
- package/.agents/skills/self-diagnosis/resources/comparative-research-manifest.json +42 -0
- package/.agents/skills/self-diagnosis/resources/self-diagnosis-manifest.json +144 -0
- package/.agents/skills/self-diagnosis/scripts/diagnose.mjs +1971 -0
- package/.agents/skills/swarm-governance/SKILL.md +59 -0
- package/.agents/skills/swarm-governance/references/bundling-and-wire-format.md +88 -0
- package/.agents/skills/swarm-governance/references/intake-and-planning.md +120 -0
- package/.agents/skills/swarm-governance/references/large-swarms.md +39 -0
- package/CHANGELOG.md +26 -0
- package/LICENSE +21 -0
- package/README.md +121 -2
- package/bin/agy-squad.mjs +293 -0
- package/docs/assets/architecture-overview.svg +39 -0
- package/docs/assets/manifest-and-modes.svg +39 -0
- package/docs/assets/role-and-verdict-gate.svg +39 -0
- package/docs/assets/skill-role-workflows.svg +39 -0
- package/docs/assets/swarm-lifecycle.svg +39 -0
- package/docs/benchmarks.md +154 -0
- package/docs/concepts.md +81 -0
- package/docs/core-workflows.md +128 -0
- package/docs/getting-started.md +116 -0
- package/docs/index.md +47 -0
- package/docs/plans/LEDGER.md +24 -0
- package/docs/plans/comparative-harness-architecture-retest.md +1174 -0
- package/docs/plans/comparative-harness-architecture-teamwork.md +1170 -0
- package/docs/plans/comparative-harness-architecture.md +256 -0
- package/docs/plans/native-enforcement-ledger.md +126 -0
- package/docs/plans/pr3-option-b-fixes.md +803 -0
- package/docs/plans/wsl-cli-verification.md +55 -0
- package/docs/reviews/post-pr5-governance-review.md +221 -0
- package/docs/reviews/pr1-code-review-ledger.md +581 -0
- package/docs/reviews/pr1-production-readiness-review.md +764 -0
- package/docs/reviews/pr2-documentation-review-ledger.md +380 -0
- package/docs/reviews/pr3-squad-alignment-full-review.md +1021 -0
- package/docs/reviews/pr4-swarm-governance-pivot-review.md +593 -0
- package/docs/reviews/pr5-full-review-direction.md +330 -0
- package/docs/reviews/pr5-independent-review.md +266 -0
- package/docs/reviews/pr5-layered-swarm-review.md +513 -0
- package/docs/reviews/pr5-phase2-swarm-planner-review.md +470 -0
- package/docs/reviews/pr5-reconciled-review.md +573 -0
- package/docs/reviews/rebuild-wsl-dispatch-review-r2.md +427 -0
- package/docs/reviews/rebuild-wsl-dispatch-review.md +552 -0
- package/docs/reviews/v0.1.1-review.md +397 -0
- package/docs/roles-and-workflows.md +115 -0
- package/docs/stopping-agents.md +39 -0
- package/docs/tools.md +123 -0
- package/install.ps1 +5 -0
- package/install.sh +4 -0
- package/mcp/briefs.mjs +206 -0
- package/mcp/dispatch.mjs +343 -0
- package/mcp/handoffs.mjs +814 -0
- package/mcp/index.js +359 -0
- package/mcp/planner.mjs +761 -0
- package/mcp/verdicts.mjs +224 -0
- package/package.json +57 -4
- package/plugin.json +20 -0
- package/scripts/install-register.mjs +510 -0
- package/scripts/release-preflight.mjs +171 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Agy-Squad PR Review Standard
|
|
2
|
+
|
|
3
|
+
Version: 1.4.0
|
|
4
|
+
Status: Active repository workflow standard (enforced by `.agents/skills/pr-review/SKILL.md` and `.agents/skills/self-diagnosis/SKILL.md`)
|
|
5
|
+
Established: 2026-11-08
|
|
6
|
+
|
|
7
|
+
## Purpose and authority
|
|
8
|
+
|
|
9
|
+
A review must make its coverage, reasoning, findings, and evidence inspectable by category. Passing tests, a polished change document, and a previous approval are inputs; none establishes that the implementation satisfies its architecture.
|
|
10
|
+
|
|
11
|
+
Use this standard for a PR review. Implementation status updates are separate from that review.
|
|
12
|
+
|
|
13
|
+
Changes to this standard require a version bump, a rationale, and a PR that identifies which review requirements change. A reviewer cannot silently omit or weaken a category. This is a repository workflow contract, not a claim that GitHub branch protection or an automated merge gate has been installed.
|
|
14
|
+
|
|
15
|
+
## 1. Pin the review
|
|
16
|
+
|
|
17
|
+
Record:
|
|
18
|
+
|
|
19
|
+
- Repository, PR URL, review date, reviewer, standard version, base SHA, and head SHA (plus any uncommitted working-tree delta).
|
|
20
|
+
- Append-only **Session Provenance** table (`Session # | Operator Conversation ID | Parent Session | Date | Base..Head + Working-Tree State | Skill / Topology Invoked`) so parent, resumed, and branched review or `/self-diagnosis` sessions and their exact `HEAD` state are distinguishable at the top of the report.
|
|
21
|
+
- Exact commit or tree executed by each cited CI run. Distinguish a PR head from GitHub's generated merge commit.
|
|
22
|
+
- Changed-file inventory from the base/head comparison, plus unchanged dependencies examined.
|
|
23
|
+
- Evidence actually available: repository sources, normative design records (`docs/plans/LEDGER.md`, `docs/plans/wsl-cli-verification.md`, base commit `ee10ebc`), prior review, transcript, local reproduction, and CI logs. State when an attachment or environment was unavailable.
|
|
24
|
+
- Scope and exclusions. Fetching a file is not the same as reviewing it.
|
|
25
|
+
|
|
26
|
+
A new head invalidates claims about changed behavior until the delta and affected categories are re-reviewed. Retain the previous review and record which findings carry forward.
|
|
27
|
+
|
|
28
|
+
## 2. Review architecture before runtime
|
|
29
|
+
|
|
30
|
+
For every behavior change, trace:
|
|
31
|
+
|
|
32
|
+
design thesis / invariant -> current architecture decision -> public contract -> implementation -> verification.
|
|
33
|
+
|
|
34
|
+
Read the normative design records (`docs/plans/LEDGER.md`, `docs/plans/wsl-cli-verification.md`, and historical commit `ee10ebc`) when assessing preservation or modification of project invariants. Separate historical design records, normative current contracts, as-built descriptions, and external evidence. Existing implementation does not automatically override a higher-priority contract.
|
|
35
|
+
|
|
36
|
+
When modernization relies on a current ecosystem norm, cite a primary source, its version or date, the exact capability, the demonstrated gap, and why closing that gap benefits Agy-Squad. Unsupported generalizations such as "modern agents expect this" are not evidence.
|
|
37
|
+
|
|
38
|
+
For each intentional departure from a contract, require a recorded decision, compatibility implications, and acceptance criteria before recommending runtime changes. Do not resolve a mismatch by silently rewriting documentation to match code.
|
|
39
|
+
|
|
40
|
+
## 3. Required categories
|
|
41
|
+
|
|
42
|
+
Each category has its own coverage statement, independently triaged P1/P2/P3 finding lists, verification gaps, and verdict.
|
|
43
|
+
|
|
44
|
+
| ID | Category | Required review questions |
|
|
45
|
+
| --- | --- | --- |
|
|
46
|
+
| ARCH | Architecture and contracts | Are boundaries, guarantees, ownership, compatibility, and resource limits explicit? Does implementation satisfy the selected decisions? |
|
|
47
|
+
| DOC | Documentation and change records | Do active docs agree with normative contracts and actual behavior? Are historical records distinguished? Are completion and benchmark claims supported? |
|
|
48
|
+
| SKILL | Skills and agent instructions | Are referenced APIs, enums, fields, commands, and guarantees real and current? Do instructions guide correct implementation and review? |
|
|
49
|
+
| MCP | MCP schemas and public API | Do discovery schemas, runtime acceptance, errors, defaults, nullability, bounds, and documented responses agree? |
|
|
50
|
+
| RUN | Core runtime, parsing, and validation | Are inputs untrusted, failures deterministic, workspace/descriptor containment enforced, and stage compilation/reporting accurate? |
|
|
51
|
+
| SVC | Services, orchestration, and audit semantics | Are retries, lineage, request identity, recovery, and shared entry points consistent with the contracts? |
|
|
52
|
+
| DB | Database, migrations, replay, and concurrency | When SQL/database persistence exists, are reads/writes transactionally coherent and migrations verified? When only filesystem state exists (`scratch/agy-squad/`), is state persistence covered under `RUN`/`SVC` and `DB` marked `Not applicable`? |
|
|
53
|
+
| SCRIPT | Scripts, evaluation, and developer tooling | Do scripts fail on unexpected results? Are exceptions scenario-specific? Are measurement claims limited to what was measured? |
|
|
54
|
+
| TEST | Tests and CI | Do tests prove the guarantees, including adversarial cases? What ran, where, against which revision, and what remains unverified? |
|
|
55
|
+
| DEP | Dependencies, packaging, and configuration | Are installation paths, lockfiles, supported versions, configuration names, and startup assumptions coherent? |
|
|
56
|
+
|
|
57
|
+
Map every changed file to one primary category. Cross-reference affected categories without counting the same defect twice. Split a category into named subsections when necessary; additions cannot replace the required categories. A documentation file defining architecture can belong primarily to ARCH.
|
|
58
|
+
|
|
59
|
+
"No findings" is permitted. A finding quota is prohibited.
|
|
60
|
+
|
|
61
|
+
## 4. Required category record
|
|
62
|
+
|
|
63
|
+
For each category include:
|
|
64
|
+
|
|
65
|
+
1. **Scope:** changed files and relevant unchanged dependencies examined.
|
|
66
|
+
2. **Coverage:** complete, partial, or not reviewed; specify what remains.
|
|
67
|
+
3. **P1 — high priority:** independently triaged blocking findings, or an explicit empty/unassessed statement.
|
|
68
|
+
4. **P2 — medium priority:** independently triaged actionable findings, or an explicit empty/unassessed statement.
|
|
69
|
+
5. **P3 — low priority:** independently triaged advisory findings, or an explicit empty/unassessed statement.
|
|
70
|
+
6. **Verification:** tests inspected, tests executed, CI evidence inspected, and missing proof.
|
|
71
|
+
7. **Verdict:** changes required, no findings within reviewed scope, incomplete, or not applicable with a reason.
|
|
72
|
+
|
|
73
|
+
Every category must contain all three triage headings, even when a bucket is empty. For reviewed scope, write "None identified within reviewed scope"; for unreviewed scope, write "Not assessed." Do not equate an empty bucket with complete coverage. Order findings by severity within their owning category. Classify each finding from its impact and trigger; do not copy priority from a previous review automatically.
|
|
74
|
+
|
|
75
|
+
Verification gaps and unresolved questions remain separate from the P1/P2/P3 finding buckets unless evidence establishes a concrete defect. Record priority changes with a reason and preserve finding IDs. An exceptional P0 emergency is escalated explicitly in addition to the required three buckets.
|
|
76
|
+
|
|
77
|
+
A category with findings and partial coverage records both facts. "Not applicable" means the category has no relevant change or dependency, not that it was skipped.
|
|
78
|
+
|
|
79
|
+
## 5. Required finding record
|
|
80
|
+
|
|
81
|
+
Enforce a strict **`1 ID = 1 Row / Record`** and **zero lead/bundle compression or silent omission** rule: assign one stable ID per independently remediable problem (e.g., `MCP-001`) and preserve IDs across revisions. Because `node bin/agy-squad.mjs prune` (via `mcp/handoffs.mjs`) removes specialist reports and `diagnose.mjs --teardown` removes `scratch/agy-squad/squad-<id>/lead/report.md` (`L41`), the `docs/reviews/` report is the sole surviving record; compressing findings into multi-defect umbrella IDs (`R5-HARDEN-P3-1`, `R5-OPT-P3-1`), range-compressed IDs (`TEST-2..4`), or multi-ID combined rows (`A & B`), or silently omitting deferred/residual items, is prohibited because it prevents distinguishing solved defects from hidden ones. Only duplicate reports of the exact same underlying defect are merged into one canonical ID (cross-referencing the duplicate report alias in parentheses per Section 3).
|
|
82
|
+
|
|
83
|
+
**Report readability & backtick discipline:** Keep review reports scannable in plain prose and Markdown tables. Reserve inline backticks strictly for exact code identifiers, file paths (`path#L10-L20`), CLI flags, and commands—never wrap plain numbers (`0`, `1`, `42`), English statuses/disposition labels (Closed, Open, Changes required, PASS), or multi-sentence quotations inside inline backticks or fenced code blocks inside prose or table cells. Use fenced code blocks sparingly for multi-line command invocations or exact diff hunks only.
|
|
84
|
+
|
|
85
|
+
Every surfaced `P0`–`P3` item must carry one explicit canonical status: `Open (Pre-Remediation)`, `Closed`, `Residual (Open)`, `Closed (Post-Remediation)`, `Deferred / Won't Fix`, or `Closed (By Design)` (with `Informational` permitted for non-defect observations in Section 8). Section 8 is the mandatory sink for all `Residual (Open)` / `Closed (Post-Remediation)`, `Deferred / Won't Fix`, and `Closed (By Design)` / `Informational` items—never bury them inside a `Closed` row's prose or omit them.
|
|
86
|
+
|
|
87
|
+
Tiered record density (instead of row compression):
|
|
88
|
+
|
|
89
|
+
- **`P0` / `P1` / `P2` defects** require all 10 fields below, written as concise 1-line entries without repeating multi-paragraph prose across sections:
|
|
90
|
+
- **Title, priority, status.**
|
|
91
|
+
- **Contract provenance:** exact invariant, architecture decision (`docs/plans/LEDGER.md`), public contract, or evidenced external norm.
|
|
92
|
+
- **Source evidence:** immutable commit-pinned file links and relevant line ranges, plus the affected symbol.
|
|
93
|
+
- **Trigger:** concrete input, state, interleaving, or document instruction that exposes the issue.
|
|
94
|
+
- **Expected / actual:** explain the mismatch and distinguish observed execution from source-derived inference.
|
|
95
|
+
- **Impact:** concrete consequence and affected scope.
|
|
96
|
+
- **Required remediation:** precise behavior to restore, compatibility constraints, and affected contract surfaces.
|
|
97
|
+
- **Acceptance evidence:** regression case and assertions; use source reconciliation for low-impact prose changes where a test would add no value.
|
|
98
|
+
- **Root cause / related IDs:** connect cross-layer defects without duplicating the finding.
|
|
99
|
+
- **Closure:** fix commit, evidence at that revision, reviewer recheck, and residual limitations.
|
|
100
|
+
- **`P3` advisories and optimizations** use a compact **1-row-per-ID** structured table schema (`ID | Wave/Session | Cat | Status | Source | Defect / Proposal | Disposition / Fix | Verification & Bundle SHA`), preserving 100% per-finding granularity without prose bloat.
|
|
101
|
+
|
|
102
|
+
Priorities:
|
|
103
|
+
|
|
104
|
+
- P0: immediate critical failure requiring emergency handling.
|
|
105
|
+
- P1: high-impact correctness, data loss, security, or reliability failure.
|
|
106
|
+
- P2: actionable correctness or contract problem that should be fixed.
|
|
107
|
+
- P3: lower-impact issue or improvement; identify whether it is advisory.
|
|
108
|
+
|
|
109
|
+
A verification gap alone is not proof of a production defect. Label it as a gap. Do not inflate severity or finding counts to fill categories.
|
|
110
|
+
|
|
111
|
+
## 6. Evidence rules
|
|
112
|
+
|
|
113
|
+
- Separate source inspection, attempted reproduction, local execution, and inspected CI logs.
|
|
114
|
+
- Give reproduction steps even when execution is unavailable; label the expected failure as source-derived.
|
|
115
|
+
- Test names, comments, string-presence assertions, and a green summary do not prove the named guarantee. Inspect what is asserted.
|
|
116
|
+
- Never inherit a previous review's verdict. Revalidate its findings and explicitly accept, revise, or reject them.
|
|
117
|
+
- Identify assumptions, unresolved questions, and unverified external claims.
|
|
118
|
+
- Do not claim that a transcript, attachment, or design record was read unless its contents were accessible and examined.
|
|
119
|
+
|
|
120
|
+
Agy-Squad-specific verification:
|
|
121
|
+
|
|
122
|
+
- **Schema & Stdio Framing:** exercise documented omitted/null/valid/invalid values through `request.jsonrpc === "2.0"` validation, actual `tools/list` schemas (`mcp/index.js`), and the `dispatch_squad` (`mcp/dispatch.mjs`) and `squad_planner` (`mcp/planner.mjs`) runtime boundaries, including positive-integer `AGY_MAX_STDIO_PAYLOAD_BYTES` and the 10MB stdio frame limit.
|
|
123
|
+
- **Workspace & Descriptor Containment:** verify workspace-internal symlink resolution (`fs.realpathSync` + `O_NOFOLLOW`, `O_NONBLOCK`, and `/proc/self/fd/${fd}` regular-file verification) for manifests in `mcp/dispatch.mjs`; strict symlink rejection (`O_NOFOLLOW`, `O_NONBLOCK`, symlink directory rejection, and `/proc/self/fd/${fd}` verification) for reports and bundles in `mcp/handoffs.mjs`.
|
|
124
|
+
- **Subagent Capability, Model Provenance & Input Guards:** verify built-in `TypeName` rejection (`research`, `browser`, `image-generator`; default `"self"`), manifest `workspace === "inherit"` in `invoke_subagent` and `squad_planner` (with `/swarm` copy isolation via top-level `workspaceIsolation`), honest `modelProvenance` disclosure vs. `/swarm` pinning, `scopeFiles` path normalization and writable overlap warnings, and camelCase/PascalCase conflict rejection (`mcp/briefs.mjs`, `mcp/planner.mjs`).
|
|
125
|
+
- **Pointer-Over-Wire Handoffs & Bundling:** verify single-line `<= 500` UTF-8 byte `READY`/`PARTIAL`/`NO_REPORT` receipt grammar, custom `reportRoot` alignment in `inspectReports`/`bundleReports`, atomic `publish()` link/rename semantics, strict single-line verdicts (`mcp/verdicts.mjs`), `integrityAudit` binding, and `bundle`/`verify`/`prune` SHA-256 verification (`mcp/handoffs.mjs`).
|
|
126
|
+
- **External MCP & Governance CLI:** distinguish an in-process adapter call from a real stdio subprocess and CLI execution (`node bin/agy-squad.mjs plan|dispatch|fingerprint|inspect|bundle|verify|prune|verdict`).
|
|
127
|
+
|
|
128
|
+
Run checks appropriate to the change. A documentation-only review-standard change does not require rerunning the product suite.
|
|
129
|
+
|
|
130
|
+
## 7. Verdict and closure
|
|
131
|
+
|
|
132
|
+
Keep coverage and merge disposition separate.
|
|
133
|
+
|
|
134
|
+
- Request changes when blocking correctness or contract findings remain.
|
|
135
|
+
- Mark the review incomplete when a material category is unreviewed; this can coexist with request changes.
|
|
136
|
+
- Recommend approval only after all material categories are covered, blocking findings are resolved and rechecked, and required verification has evidence.
|
|
137
|
+
- Never calculate approval from a pass percentage, number of findings, test count, or absence of findings in an unreviewed category.
|
|
138
|
+
|
|
139
|
+
Re-review each fix in its primary category and all affected categories. A fix commit is not closure by itself. Every closed finding needs the relevant evidence and reviewer recheck.
|
|
140
|
+
|
|
141
|
+
## 8. Required report structure
|
|
142
|
+
|
|
143
|
+
1. Review metadata, Session Provenance table, and evidence limits.
|
|
144
|
+
2. File-to-category inventory and coverage matrix.
|
|
145
|
+
3. Architecture-to-implementation trace.
|
|
146
|
+
4. Ten category sections, each with separate P1, P2, and P3 finding lists, verification gaps, and its own verdict.
|
|
147
|
+
5. Cross-category root causes and rationale for remediation order.
|
|
148
|
+
6. Verification record and remaining gaps.
|
|
149
|
+
7. Overall disposition and finding closure table.
|
|
150
|
+
8. **Post-Remediation Residuals & Deferred Dispositions** (mandatory): atomic 1-ID-per-row table (`ID | Wave/Session | Cat | Status | Source | Defect / Proposal | Disposition / Fix | Verification & Bundle SHA`) recording every advisory surfaced during re-verification (`Residual (Open)` -> `Closed (Post-Remediation)`), `Deferred / Won't Fix` item, and `Closed (By Design)` / `Informational` item—never buried inside a `Closed` row's prose cell. Record `None (0 open residuals, 0 deferred items)` when empty.
|
|
151
|
+
9. **`/self-diagnosis` Cohort & Bundle Ledger** (mandatory whenever `/self-diagnosis` cohorts are dispatched against the target branch/PR): one canonical **Cohort Provenance** table (`Wave | Session ID | Stage | Subagent IDs | Pre-Fix Bundle SHA | Re-Verify Bundle SHA | Teardown`) plus one atomic 1-ID-per-row **Wave Finding Ledger**, keeping `docs/reviews/` to one clean file per PR review cycle rather than bespoke per-wave sections or proliferating files.
|
|
152
|
+
|
|
153
|
+
Keep local review reports under `docs/reviews/`. Cite the reviewed base and head, category coverage, findings, evidence and verdict in the PR. Identify the previous review when recording a follow-up.
|
|
154
|
+
|
|
155
|
+
## Change history
|
|
156
|
+
|
|
157
|
+
| Version | Date | Change |
|
|
158
|
+
| --- | --- | --- |
|
|
159
|
+
| 1.4.0 | 2026-11-14 | Enforce mandatory Sections `1–8` and cross-section ID-status consistency in `validateTargetReviewLedger`; surface open P0–P2 ledger blockers explicitly; require `Evidence Digest: <64-hex>` binding (`agy-squad digest`), multi-auditor `integrityAudits[]` consensus, persisted bundle `auditPolicy`, atomic pre-delete teardown preflight, and documented single- vs multi-squad audit slots (`squad-integrity_auditor` vs `squad-integrity_auditor-<id>`). |
|
|
160
|
+
| 1.3.0 | 2026-11-08 | Enforce `1 ID = 1 Row` (ban umbrella/range IDs) and 6-status enum, add tiered record density for `P3` tables, require Section 1 Session Provenance and mandatory Section 8 (`Post-Remediation Residuals & Deferred Dispositions`), and standardize Section 9 (`/self-diagnosis` Cohort & Bundle Ledger). |
|
|
161
|
+
| 1.2.0 | 2026-11-08 | Adapt standard to Agy-Squad with 5 WSL runtime verification boundaries, durable review ledger coupling with `/self-diagnosis`, and distinct version bump per Section 0. |
|
|
162
|
+
| 1.1.0 | 2026-10-20 | Require explicit P1/P2/P3 triage inside every category, including empty versus unassessed buckets; preserve separate verification gaps. |
|
|
163
|
+
| 1.0.0 | 2026-10-20 | Establish category-separated review, provenance, explicit coverage, evidence distinctions, and finding closure. |
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: self-diagnosis
|
|
3
|
+
description: >-
|
|
4
|
+
[Task Spec — Agy-Squad self-audit & optimization; pair with swarm-governance on
|
|
5
|
+
/swarm] Use when the user asks to self-diagnose, troubleshoot, audit, or
|
|
6
|
+
optimize Agy-Squad or its workspace skills (.agents/skills/). Uses
|
|
7
|
+
diagnose.mjs, squad_planner (or dispatch_squad for invoke_subagent), the
|
|
8
|
+
bin/agy-squad.mjs Pointer-Over-Wire pipeline, and the Agy-Squad PR Review
|
|
9
|
+
Standard v1.4.0.
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Agy-Squad Self-Diagnosis & Optimization Skill
|
|
13
|
+
|
|
14
|
+
Self-diagnose, audit, and optimize `Agy-Squad` and its workspace skills (including [`pr-review`](../pr-review/SKILL.md), [`full-review`](../full-review/SKILL.md), and [`swarm-governance`](../swarm-governance/SKILL.md)). This skill is a **Task Spec** for repository and harness self-audits; when run on `/swarm` or multi-agent teams, compose it with [`swarm-governance`](../swarm-governance/SKILL.md) (which owns `/swarm` launch, `open_board`, `swarm_wait`, pointer receipts, and closure).
|
|
15
|
+
|
|
16
|
+
It dogfoods `Agy-Squad`'s `/swarm` planner (`mcp/planner.mjs` via `squad_planner` / `node bin/agy-squad.mjs plan`), `invoke_subagent` compiler (`mcp/dispatch.mjs` via `dispatch_squad` / `node bin/agy-squad.mjs dispatch`), Pointer-Over-Wire CLI (`node bin/agy-squad.mjs`), and [Agy-Squad PR Review Standard v1.4.0](../pr-review/references/pr-review-standard.md). Consult [Optimization & Review Rubric](./references/optimization-and-review-rubric.md) for budgets, [Execution & Teardown Reference](./references/execution-and-teardown.md) for uncondensed multi-squad and `--teardown` edge cases, and [Core workflows](../../../docs/core-workflows.md) for the 3-scope retention contract.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Invariants
|
|
21
|
+
|
|
22
|
+
1. **Zero-Subagent Local Profiler (`L7`):** [`diagnose.mjs`](./scripts/diagnose.mjs) launches zero agents; pass `--allow-active-cohort` while `scratch/agy-squad/squad-*` cohorts are active.
|
|
23
|
+
2. **Self-Contained Instruction Standard:** Never use unanchored abbreviations or unexpanded section codes in briefs; state exact paths, constraints, and deliverable formats explicitly.
|
|
24
|
+
3. **Non-Negotiable Pre-Remediation & Pre-Teardown Gate (`docs/reviews/`):** Before editing code or running `--teardown`, record every distinct defect/proposal `1-to-1` (`1 ID = 1 Row`, zero umbrella compression or silent drops) in `docs/reviews/<target-review-slug>.md` per [pr-review-standard.md](../pr-review/references/pr-review-standard.md) (Section 1 Session Provenance, Section 9 Cohort Provenance & Wave Finding Ledger, Section 8 residuals/deferred/closed items, plain-text readability rules without decorative backticks on numbers or English statuses).
|
|
25
|
+
4. **Three-Scope Teardown Isolation (`Scope 2` vs `Scope 3`, `L41`):** `Scope 2` (`bin/agy-squad.mjs prune [--keep-reports]`) manages loose specialist reports under verified SHA-256 bundles; `Scope 3` (`diagnose.mjs --teardown ... --ledger <slug>.md`) refuses deletion until `lead/report.sources.json` verifies and the target ledger has `mtime >= bundle mtime` (unless `--force` is passed). See [Scope 3 refusal & partial cleanup rules](./references/execution-and-teardown.md#pre-teardown-refusal-conditions-and-partial-cleanup).
|
|
26
|
+
5. **Same-Cohort Re-Verification & Runtime Closure:** Keep existing `/swarm` workers (`swarm_wait` / `post_message`) or `invoke_subagent` children (`send_message`) alive to re-verify remediation fixes in place; spawn fresh cohorts only for independent new audits. Kill workers only after `0` open blockers remain, ledger rows close, and teardown finishes, then complete the 4-check closure gate (`manage_subagents`, `manage_task`, `swarm status` including `monitor`, child OS processes; see [Roles & skill workflows](../../../docs/roles-and-workflows.md#self-diagnosis)).
|
|
27
|
+
6. **Empirical Measurement & Architecture Trace:** Verify `design thesis / invariant (L1-L7, L21, L29-L31, L40-L43) -> public contract -> implementation -> verification` before altering runtime or skill code, record exact UTF-8 byte deltas, token estimates, and timings from `diagnose.mjs`, and confirm `npm test` passes after final edits.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Workflow
|
|
32
|
+
|
|
33
|
+
### Step 0: Pre-Flight Intake Interview (Neutral Alignment Gate)
|
|
34
|
+
Ask once before compiling manifests or launching workers whenever any choice below is unspecified (skip questions already answered; defer `/swarm` launch, `open_board`, and `swarm_wait` rules to [`swarm-governance`](../swarm-governance/SKILL.md#step-0-pre-flight-intake-ask-when-unspecified)):
|
|
35
|
+
1. **Execution Mode, Topology & Isolation (neutral, no default bias):**
|
|
36
|
+
- `/swarm` via `squad_planner` (`diagnose.mjs --print-plan [--topology flat|layered | --flat]`): **Flat Specialist Swarm** (6 read-only specialists -> coordinator) or **Layered Squad Swarm** (3 leads -> 6 specialists), plus `workspaceIsolation` (`inherit` for read-only audits vs `share`/`branch` for writers) and model (coordinator default unless user specifies otherwise).
|
|
37
|
+
- `invoke_subagent` fallback via `diagnose.mjs --print-dispatch <target>` (`all_l1`, `all_specialists`, or one squad; MCP `dispatch_squad` accepts `all_l1`, `<squadId>`, or `integrity_auditor[:<target>]`, whereas `all_specialists` is `diagnose.mjs` only).
|
|
38
|
+
- **Local Profiler Only:** run `diagnose.mjs` locally with zero agents launched.
|
|
39
|
+
2. **Retention & Teardown (`Scope 2` vs `Scope 3`):** Keep loose reports via `prune --keep-reports` or prune after SHA-256 bundling (`Scope 2`); run `--teardown` after updating `docs/reviews/<target-review-slug>.md` or defer cleanup across active waves (`Scope 3`).
|
|
40
|
+
3. **Integrity Audit Gate:** Independent Integrity Auditor enabled (`audit-<id>` on `/swarm` or `integrity_auditor[:<target>]` slot) enforcing `Integrity Verdict: CLEAN` before acceptance, vs working-squad synthesis only (`--allow-unaudited`).
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
### Step 1: Run the Automated Profiler (`L7`-Safe)
|
|
45
|
+
Run `node .agents/skills/self-diagnosis/scripts/diagnose.mjs [--ledger docs/reviews/<slug>.md] --markdown`:
|
|
46
|
+
1. **Skill & Doc Health (`SKILL`, `DOC`):** Validates frontmatter, entry budgets (`<= 10,240 B` / `<= 250` lines for `SKILL.md`; warns above `12,288 B` / `300` lines; `<= 70%` entry share when `> 8 KB`), relative links, `zensical.toml` `nav` & `docs/assets/*.svg`, closure checklists, and `v1.4.0` ledgers (`1 ID = 1 Row`, no retired symbol drift).
|
|
47
|
+
2. **Planner, Dispatch & Pointer-Over-Wire Canary (`RUN`, `SVC`, `MCP`):** Compiles [`self-diagnosis-manifest.json`](./resources/self-diagnosis-manifest.json) for both tools, checks disjoint write scopes (skipping `readOnly: true`), and tests `fingerprint -> inspect -> bundle -> verify -> integrity -> prune` in temp storage.
|
|
48
|
+
3. **Byte & Token Telemetry (`SKILL`, `RUN`):** Reports brief sizes, UTF-8/token overhead, and specialist timing regressions across `dispatch_squad`, `squad_planner`, handoff bundling, and MCP stdio checks.
|
|
49
|
+
4. **Workspace Hygiene (`SVC`):** Detects orphaned `scratch/agy-squad/squad-*` cohorts against `--allow-active-cohort` and `--ledger`.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
### Step 2: Execute Cohort, Verify Bundles & Tear Down
|
|
54
|
+
Plan cohorts per [Planning & Dispatch Commands](./references/execution-and-teardown.md#planning-and-dispatch-commands) (working squads in [`self-diagnosis-manifest.json`](./resources/self-diagnosis-manifest.json): `skill_and_pr_review_audit`, `runtime_and_contract_diagnosis`, and `token_and_execution_optimization`; omit `squadId` on `/swarm` to compile all three, and follow [`swarm-governance`](../swarm-governance/SKILL.md#stage-1-plan-launch--park) for launch and UI lifecycle):
|
|
55
|
+
|
|
56
|
+
1. **Bundle per Squad (`Scope 2`):** Assemble `<bundle-record.json>` from `--print-plan` `bundleRecordTemplates` plus `fingerprint` digests, run `digest` before `audit-*` signs `CLEAN`, and run `verdict`, `verdict --integrity`, `inspect`, `bundle`, `verify`, and `prune [--keep-reports]` for every working squad per [Multi-Squad Bundling & Prune](./references/execution-and-teardown.md#multi-squad-bundling-and-scope-2-prune).
|
|
57
|
+
2. **Transcribe Ledger (`docs/reviews/`):** Record every distinct defect and proposal `1-to-1` (`1 ID = 1 Row`) into `docs/reviews/<target-review-slug>.md` before editing code or running teardown.
|
|
58
|
+
3. **Atomic Teardown (`L41`, `Scope 3`), Remediation & Closure:** After the target ledger has `mtime >= bundle mtime`, run `diagnose.mjs --teardown` per [Scope 3 Atomic Teardown](./references/execution-and-teardown.md#scope-3-atomic-teardown-and-failure-modes), re-verify remediation fixes with the **same** specialists/workers, kill agents (`swarm{action: "kill"}` / `manage_subagents`), and complete the 4-check closure gate.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### Step 3: Triage & Verify Optimizations with `pr-review`
|
|
63
|
+
Activate [`pr-review`](../pr-review/SKILL.md) with rubric thresholds from Sections 2–3 of [Optimization & Review Rubric](./references/optimization-and-review-rubric.md), trace invariants first, and prove exact before/after metrics and `npm test` pass after final edits.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Self-Diagnosis Execution, Bundling & Teardown Reference
|
|
2
|
+
|
|
3
|
+
Uncondensed execution examples, multi-squad bundling workflows, and Scope 2 / Scope 3 `--teardown` edge cases for [`.agents/skills/self-diagnosis/SKILL.md`](../SKILL.md).
|
|
4
|
+
|
|
5
|
+
## Planning and Dispatch Commands
|
|
6
|
+
|
|
7
|
+
Run [`scripts/diagnose.mjs`](../scripts/diagnose.mjs) from the repository root (`node .agents/skills/self-diagnosis/scripts/diagnose.mjs`):
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# 1. Zero-subagent local profiler (add --allow-active-cohort when scratch/agy-squad/squad-* is in flight):
|
|
11
|
+
node .agents/skills/self-diagnosis/scripts/diagnose.mjs --markdown
|
|
12
|
+
node .agents/skills/self-diagnosis/scripts/diagnose.mjs --ledger docs/reviews/<slug>.md --markdown
|
|
13
|
+
|
|
14
|
+
# 2. Primary /swarm cohort plan (squad_planner): omit squadId to plan all 3 working squads, or pass --topology flat|layered:
|
|
15
|
+
node .agents/skills/self-diagnosis/scripts/diagnose.mjs \
|
|
16
|
+
--print-plan [squadId] [--topology flat|layered | --flat] [--mode swarm|subagent] [--workspace-isolation inherit|share|branch]
|
|
17
|
+
|
|
18
|
+
# 3. Fallback invoke_subagent stage compiler (all_l1, all_specialists, or single squadId):
|
|
19
|
+
node .agents/skills/self-diagnosis/scripts/diagnose.mjs \
|
|
20
|
+
--print-dispatch <all_l1|all_specialists|squadId> --parent-id <parent-conversation-id>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- **Note on `all_specialists`:** `all_specialists` is supported only by `diagnose.mjs --print-dispatch`; MCP `dispatch_squad` accepts `all_l1`, a single `<squadId>`, or `integrity_auditor[:<target>]`.
|
|
24
|
+
- **Self-diagnosis working squads (`self-diagnosis-manifest.json`, `readOnly: true` specialists):**
|
|
25
|
+
- `skill_and_pr_review_audit`: 2 specialists covering `SKILL`, `DOC`, `ARCH`, `SCRIPT`.
|
|
26
|
+
- `runtime_and_contract_diagnosis`: 2 specialists covering `MCP`, `RUN`, `SVC`, `SCRIPT`, `TEST`, `DEP`.
|
|
27
|
+
- `token_and_execution_optimization`: 2 specialists covering `RUN`, `SKILL`, `SVC`, `ARCH`.
|
|
28
|
+
|
|
29
|
+
## Multi-Squad Bundling and Scope 2 Prune
|
|
30
|
+
|
|
31
|
+
When running all three squads in Layered mode (or any multi-squad plan), each working squad owns its own report directory (`scratch/agy-squad/squad-<squadId>/`), its own flat integrity auditor (`audit-<squadId>` -> `scratch/agy-squad/squad-integrity_auditor-<squadId>/specialist-1/report.md`), and its own `<bundle-record.json>`:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Per working squad (<id> = skill_and_pr_review_audit | runtime_and_contract_diagnosis | token_and_execution_optimization, or self_diagnosis in flat mode):
|
|
35
|
+
node bin/agy-squad.mjs verdict scratch/agy-squad/squad-<id>/lead/report.md
|
|
36
|
+
node bin/agy-squad.mjs fingerprint <verified-file...>
|
|
37
|
+
node bin/agy-squad.mjs digest <bundle-record-<id>.json>
|
|
38
|
+
node bin/agy-squad.mjs verdict --integrity scratch/agy-squad/squad-integrity_auditor[-<id>]/specialist-1/report.md
|
|
39
|
+
node bin/agy-squad.mjs inspect <bundle-record-<id>.json>
|
|
40
|
+
node bin/agy-squad.mjs bundle <bundle-record-<id>.json>
|
|
41
|
+
node bin/agy-squad.mjs verify scratch/agy-squad/squad-<id>/lead/report.sources.json
|
|
42
|
+
node bin/agy-squad.mjs prune scratch/agy-squad/squad-<id>/lead/report.sources.json <accepted-sha256> [--keep-reports]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- **Scope 2 (`prune`) vs. Scope 3 (`--teardown`):** `prune` removes only verified loose `specialist-<N>/report.md` files (preserving `lead/report.md` and `lead/report.sources.json`) unless `--keep-reports` is passed. `Scope 3` (`--teardown`) removes the entire `scratch/agy-squad/squad-*` cohort tree after durable ledger verification.
|
|
46
|
+
|
|
47
|
+
## Scope 3 Atomic Teardown and Failure Modes
|
|
48
|
+
|
|
49
|
+
Run `--teardown` **only after** every distinct finding from the cohort is transcribed `1-to-1` (`1 ID = 1 Row`) into `docs/reviews/<target-review-slug>.md`:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Tear down one verified squad (optional --accept <sha256> pins expected bundle digest):
|
|
53
|
+
node .agents/skills/self-diagnosis/scripts/diagnose.mjs \
|
|
54
|
+
--teardown <squadId> [--accept <64-hex-sha256>] --ledger docs/reviews/<target-review-slug>.md
|
|
55
|
+
|
|
56
|
+
# Tear down all completed self-diagnosis squads and accompanying integrity_auditor* directories:
|
|
57
|
+
node .agents/skills/self-diagnosis/scripts/diagnose.mjs \
|
|
58
|
+
--teardown all --ledger docs/reviews/<target-review-slug>.md
|
|
59
|
+
|
|
60
|
+
# Override refusal only when discarding an aborted or superseded diagnostic cohort:
|
|
61
|
+
node .agents/skills/self-diagnosis/scripts/diagnose.mjs \
|
|
62
|
+
--teardown all --ledger docs/reviews/<target-review-slug>.md --force
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Pre-Teardown Refusal Conditions and Partial Cleanup
|
|
66
|
+
|
|
67
|
+
1. **Unbundled evidence refusal:** If `scratch/agy-squad/squad-<id>/lead/report.sources.json` is missing or fails `verifyBundle()`, `--teardown` exits `1` (`unbundled evidence`) and deletes nothing unless `--force` is passed.
|
|
68
|
+
2. **Stale ledger refusal (`mtime < bundle mtime`):** If the target `docs/reviews/<target-review-slug>.md` has not been modified at or after the bundle's creation timestamp (or fails v1.4.0 ledger schema validation), `--teardown` exits `1` without deleting `scratch/`.
|
|
69
|
+
3. **Finding-ID coverage check:** Scoped teardown verifies that findings referenced in the verified bundle/reports appear in the target ledger before removing evidence.
|
|
70
|
+
4. **Scoped vs. `all` teardown with auditors:** Single-squad `--teardown <squadId>` removes `squad-<squadId>`; `--teardown all` deletes working squad directories and removes verified bundle artifacts only alongside valid ledger gates—never call `--teardown` before saving the durable ledger or running same-cohort remediation re-checks.
|
|
71
|
+
5. **Partial permission failure during cleanup:** Check command exit codes and `ls scratch/` afterwards; if a partial deletion failure leaves orphaned files after fixing permissions, re-run `--teardown` (or `prune` for `Scope 2`) to finish cleaning empty `scratch/agy-squad/` and `scratch/` directories.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Agy-Squad Self-Diagnosis, PR-Review & Optimization Rubric
|
|
2
|
+
|
|
3
|
+
This reference pairs the `self-diagnosis` skill with the [Agy-Squad PR Review Standard v1.4.0](../../pr-review/references/pr-review-standard.md) ([`pr-review` skill](../../pr-review/SKILL.md)). Use it to classify self-diagnosis findings, verify skill and runtime invariants, and evaluate token and execution optimizations.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Coupling `self-diagnosis` with `pr-review` (Standard v1.4.0)
|
|
8
|
+
|
|
9
|
+
Every self-diagnosis pass evaluates `Agy-Squad` and its skills (`.agents/skills/self-diagnosis/`, `.agents/skills/pr-review/`) using the `pr-review` v1.4.0 trace chain:
|
|
10
|
+
|
|
11
|
+
`design thesis / invariant -> current architecture decision (LEDGER.md) -> public contract -> implementation -> verification`
|
|
12
|
+
|
|
13
|
+
Map every diagnosed defect or optimization opportunity to **one primary category** from the 10 mandatory `pr-review` categories (cross-referencing related categories without double-counting):
|
|
14
|
+
|
|
15
|
+
| Category | Self-Diagnosis & Optimization Focus |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| `ARCH` | `L1`–`L43` ledger alignment, host-enforced vs. receipt-verified boundaries, workspace containment, and cohort topology. |
|
|
18
|
+
| `DOC` | `README.md`, `docs/tools.md`, `docs/plans/LEDGER.md`, and `docs/reviews/` parity with runtime behavior and benchmark/trial evidence. |
|
|
19
|
+
| `SKILL` | `.agents/skills/*/SKILL.md` frontmatter (`name`, `description`), relative link integrity, progressive disclosure ratio (`SKILL.md` vs. `references/` and `scripts/`), and accuracy of referenced tools/flags. |
|
|
20
|
+
| `MCP` | `mcp/index.js` JSON-RPC 2.0 compliance, positive integer `AGY_MAX_STDIO_PAYLOAD_BYTES` limits, and `dispatch_squad` / `squad_planner` schema compactness. |
|
|
21
|
+
| `RUN` | `mcp/dispatch.mjs`, `mcp/briefs.mjs`, and `mcp/planner.mjs` symlink/fd checks, `TypeName: "self"` + rejected built-ins (`research`, `browser`, `image-generator`), `modelProvenance`, and scope overlap checks. |
|
|
22
|
+
| `SVC` | `mcp/handoffs.mjs`, `mcp/verdicts.mjs`, and `bin/agy-squad.mjs` receipt reconciliation, custom `reportRoot` handling, `readSynthesis` PASS verdict, `integrityAudit` binding, atomic bundle replacement, and `--teardown`. |
|
|
23
|
+
| `DB` | Verify absence of unreviewed database state (file-backed atomic bundle persistence is audited under `SVC`). |
|
|
24
|
+
| `SCRIPT` | `bin/agy-squad.mjs` (`plan`, `dispatch`, `fingerprint`, `inspect`, `bundle`, `verify`, `prune`, `verdict`) and `.agents/skills/self-diagnosis/scripts/diagnose.mjs` deterministic exit codes and argument validation (`mcp/handoffs.mjs` is the internal library module, not a CLI). |
|
|
25
|
+
| `TEST` | `tests/test-*.mjs` assertion strength, adversarial coverage, two-process concurrency, and supervised live subagent verification. |
|
|
26
|
+
| `DEP` | `package.json`, `zensical.toml`, `.gitignore`, and `.github/workflows/*.yml` coherence. |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. Quantitative Optimization Budgets & Thresholds
|
|
31
|
+
|
|
32
|
+
`scripts/diagnose.mjs` measures the following budgets and flags violations or optimization opportunities:
|
|
33
|
+
|
|
34
|
+
| Metric | Target Budget | Warning / Optimization Threshold | Triage When Exceeded |
|
|
35
|
+
| --- | --- | --- | --- |
|
|
36
|
+
| **`SKILL.md` Entry Size (Progressive Disclosure)** | $\le 250$ lines and $\le 10,240$ UTF-8 bytes ($\approx 2,500$ tokens) per `SKILL.md` | $> 300$ lines or $> 12,288$ UTF-8 bytes, or $> 70\%$ of total skill text inlined in `SKILL.md` when total skill size $> 8\text{ KiB}$ | `P2` (if instructions conflict/truncate) or `P3` Advisory (`SKILL`) — extract bulky tables/examples into `references/` or `scripts/`. |
|
|
37
|
+
| **Compiled Specialist Brief Overhead** | $\le 1,600$ UTF-8 bytes ($\approx 400$ tokens) of fixed template text in `buildSubagentSpec` | $> 1,800$ UTF-8 bytes of fixed template text | `P3` Advisory (`RUN` / `SKILL`) — tighten `mcp/briefs.mjs` prompt lines without dropping required handoff rules. |
|
|
38
|
+
| **Compiled Lead Brief Overhead** | $\le 3,100$ UTF-8 bytes ($\approx 775$ tokens) of fixed template text (including `superviseCohort`) | $> 3,300$ UTF-8 bytes of fixed template text | `P3` Advisory (`RUN` / `SKILL`). |
|
|
39
|
+
| **MCP `tools/list` Schema Response** | $\le 3,072$ UTF-8 bytes (`dispatch_squad` + `squad_planner`) | $> 4,096$ UTF-8 bytes (`MCP-BUDGET-SCHEMA`) | `P3` Advisory (`MCP`) — tighten schema descriptions in `mcp/index.js`. |
|
|
40
|
+
| **Pointer-Over-Wire Receipt Headroom** | `READY <slot> — ` prefix $\le 150$ UTF-8 bytes, leaving $\ge 350$ bytes of the `500`-byte `messageLimit` for the observation | Prefix $> 160$ UTF-8 bytes | `P2` (`SVC` / `RUN`) — shorten `squadId` or slot path encoding. |
|
|
41
|
+
| **Sibling Specialist `scopeFiles` Overlap** | $0\%$ overlapping files across specialists in the same squad | $> 25\%$ overlapping `scopeFiles` within one squad | `P2` (for concurrent writers) or `P3` Advisory (for readers) — partition `scopeFiles` cleanly across specialists or use `/swarm` `workspace: "share"`. |
|
|
42
|
+
| **Stage Compilation & Planner Latency (`handleDispatchSquad` / `planSquadCohort`)** | $< 10\text{ ms}$ per call on local SSD/WSL | $> 25\text{ ms}$ per call | `P3` Advisory (`RUN`) — inspect redundant `realpathSync` / manifest re-reads. |
|
|
43
|
+
| **Handoff & Bundle Pipeline Latency (`inspect` + `bundle` + `verify` + `prune`)** | $< 20\text{ ms}$ for a 2-specialist cohort | $> 50\text{ ms}$ for a 2-specialist cohort | `P3` Advisory (`SVC`) — inspect redundant file opens in `verifyFiles` / `verifyBundle`. |
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 3. Failure-to-Category Triage Matrix
|
|
48
|
+
|
|
49
|
+
| Diagnostic Check | Failure Symptom | Primary Category & Priority | Root Cause & Remediation |
|
|
50
|
+
| --- | --- | --- | --- |
|
|
51
|
+
| **Skill Frontmatter & Links** | Missing `name` / `description` YAML frontmatter or broken relative link (`[...](./path)`) in `.agents/skills/*/SKILL.md` | `SKILL` (**P1** if broken script/manifest link; **P2** if broken doc link) | Fix frontmatter or restore the missing target file under `.agents/skills/<skill>/`. |
|
|
52
|
+
| **Skill Tool/API Drift** | Skill instructs use of retired Phase 1/2 symbols (`subagent_brief`, `spawnPacingMs`, `agy-squad run`, `terminal.py`, `run-state.mjs`, `AGY_SQUAD_RUN_DIR`, `AGY_SQUAD_SESSION`, `.mcp-ready`, `managed manifest`, `adversarial_l1`, `adversarial_flat`, `adversarial_review`, `node mcp/handoffs.mjs`, `integrity-auditor`) as active | `SKILL` (**P2**) | Update skill instructions to use `squad_planner` (`manifestPath`, inline `manifest`, or `task`), `dispatch_squad` (subagent mode only), `integrity_auditor[:<target>]` / `audit-<id>`, and `node bin/agy-squad.mjs` exclusively. |
|
|
53
|
+
| **Report Readability & Formatting** | Review reports wrap plain numbers, English statuses, or multi-sentence quotes inside inline backticks or fenced code boxes in tables/prose | `DOC` / `SKILL` (**P3**) | Keep inline backticks strictly for code identifiers, paths, flags, and commands per `pr-review-standard.md` Section 5. |
|
|
54
|
+
| **Preset Capability Check** | Specialist compiled with `TypeName: "research"` or `Workspace !== "inherit"` | `RUN` (**P1**) | Ensure `buildSubagentSpec` in `mcp/briefs.mjs` defaults `TypeName` to `"self"`, rejects `"research"`, and requires `Workspace === "inherit"`. |
|
|
55
|
+
| **Synthesis Verdict Gate** | `bundleReports` or `verifyBundle` accepts a `lead/report.md` containing `FAIL`, `BLOCKED`, or no `PASS` token | `SVC` (**P1**) | Ensure `readSynthesis` in `mcp/handoffs.mjs` validates line-anchored `PASS` and rejects `FAIL` / `BLOCKED` across both `bundleReports` and `verifyBundle`. |
|
|
56
|
+
| **Receipt Reconciliation** | Handoff rejected for `> 500` UTF-8 bytes, multiline text, wrong sender, or wrong slot | `SVC` (**P2**) | Ensure child sends single-line `READY <assigned-slot> — <observation>` within `500` UTF-8 bytes (`Buffer.byteLength`). |
|
|
57
|
+
| **MCP Framing & Planner Boundary** | Oversized stdio payload allowed past `AGY_MAX_STDIO_PAYLOAD_BYTES`, negative byte limit accepted, or `squad_planner` omits `modelProvenance` / `provenanceScaffold` | `MCP` (**P1** / **P2**) | Verify positive integer `AGY_MAX_STDIO_PAYLOAD_BYTES` guard in `mcp/index.js` and `planSquadCohort` invariants in `mcp/planner.mjs`. |
|
|
58
|
+
| **Durable Target PR Review Ledger Gate & `v1.4.0` Schema (`docs/reviews/`)** | Missing target ledger, starting code edits or `--teardown` before updating `docs/reviews/<target-review-slug>.md`, missing Sections `1–8` (`Session Provenance`, `Post-Remediation Residuals & Deferred Dispositions`, cross-section ID-status conflicts) or Section 9 (`/self-diagnosis` Cohort & Bundle Ledger), open P0–P2 ledger blockers, or umbrella IDs (`DOC-LEDGER-MISSING`, `DOC-LEDGER-SCHEMA`, `DOC-LEDGER-OPEN-BLOCKERS`) | `DOC` / `SVC` (**P1** if missing/stale pre-teardown; **P2** if schema/umbrella/open-blocker violation; **P3** `DOC-LEDGER-RESIDUALS-OPEN` while Section 8 `Residual (Open)` rows await fix) | Update `docs/reviews/<target-review-slug>.md` in place before remediation or `--teardown` with consistent `v1.4.0` Sections `1–8` (+ Section 9 for `/self-diagnosis` cohorts). |
|
|
59
|
+
| **Self-Diagnosis Directory Teardown (`L41`)** | Lingering `scratch/agy-squad/squad-<id>` or `self-diag-canary-*` directories left in workspace after verification (`SVC-TEARDOWN-*`) | `SVC` (**P2** post-cohort; **P3** advisory when `--allow-active-cohort` is passed mid-cohort) | Run `node .agents/skills/self-diagnosis/scripts/diagnose.mjs --teardown [all | <squadId> [--accept <sha256>]] [--ledger docs/reviews/<slug>.md]` after updating the target `docs/reviews/` ledger to atomically verify bundles and remove self-diagnosis directories and empty `scratch/agy-squad` / `scratch` parent directories. |
|
|
60
|
+
| **Cohort Agent Freshness vs. Remediation Check** | Reusing an old pass's subagent `conversationId` for an unrelated pass (`invoke_subagent` required), or spawning a brand-new squad when the operator requested verifying remediations on the active squad's exact findings (`send_message` required) | `SVC` (**P2**) | Launch fresh subagents (`invoke_subagent`) for new independent passes; message the **same** cohort (`send_message`) after `prune`/`--teardown` when verifying that their exact reported findings were remediated. |
|
|
61
|
+
| **Post-Cohort Subagent Termination** | Completed subagents left lingering in `idle` state in the session table after final bundle verification and `--teardown` | `SVC` (**P2**) | Call `manage_subagents(Action='kill', ConversationIds=[...])` for all spawned subagents once the cohort's final verification (including any same-squad remediation check) and `--teardown` complete. |
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"squads": {
|
|
3
|
+
"harness_comparative_audit": {
|
|
4
|
+
"lead": {
|
|
5
|
+
"role": "Harness Comparative Architecture Lead",
|
|
6
|
+
"objective": "Synthesize findings from both research specialists into docs/plans/comparative-harness-architecture-retest.md, score all harnesses objectively against the 5-Axis Rubric, enforce the Squad Lead Patrol Gate against sycophancy, and verify citations.",
|
|
7
|
+
"scopeFiles": [
|
|
8
|
+
"docs/concepts.md",
|
|
9
|
+
"docs/core-workflows.md",
|
|
10
|
+
"benchmarks/teamwork-vs-squad/README.md",
|
|
11
|
+
"docs/plans/comparative-harness-architecture-retest.md"
|
|
12
|
+
],
|
|
13
|
+
"instructions": "Wait for READY receipts from specialist-1 and specialist-2. Enforce the Squad Lead Patrol Gate: inspect specialist reports and tool traces via rtk read. Verify that specialists executed search_web and cited primary sources without parametric guessing or flattering bias. Synthesize the unified scoring matrix and comparative dossier in your lead report at your assigned slot and write the complete deliverable to docs/plans/comparative-harness-architecture-retest.md. Send a <=500B READY receipt to parent.",
|
|
14
|
+
"expectedDeliverable": "Synthesis report with Content Verdict: PASS | FAIL | BLOCKED, objective 5-Axis Rubric scores, and docs/plans/comparative-harness-architecture-retest.md."
|
|
15
|
+
},
|
|
16
|
+
"specialists": [
|
|
17
|
+
{
|
|
18
|
+
"role": "General Workflow & Graph Harness Specialist",
|
|
19
|
+
"objective": "Empirically audit MetaGPT (SOP-driven), CrewAI (role-playing), AutoGen / Swarm (conversational broadcast), and LangGraph (statechart DAGs). Contrast their IPC token footprints, state machines, and scratch handling against Agy-Squad's Pointer-Over-Wire model.",
|
|
20
|
+
"scopeFiles": [
|
|
21
|
+
"mcp/briefs.mjs",
|
|
22
|
+
"mcp/dispatch.mjs",
|
|
23
|
+
"docs/concepts.md"
|
|
24
|
+
],
|
|
25
|
+
"instructions": "Execute search_web to audit external architecture documentation and papers for MetaGPT, CrewAI, AutoGen, and LangGraph. Profile token transmission overhead per turn compared to Agy-Squad's 500-byte receipt ceiling. Do not rely on parametric memory or internal flattery. Write your detailed markdown report with citations to your specialist slot.",
|
|
26
|
+
"expectedDeliverable": "Markdown evidence report with comparative matrix, protocol sequence diagrams, and 5-axis ratings for the 4 general workflow harnesses."
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"role": "Autonomous Coding & SWE Harness Specialist",
|
|
30
|
+
"objective": "Empirically audit Devin/Sol (sandboxed SWE workspace), Claude Code / SWE-agent (interactive command execution), and Google Antigravity Native /teamwork. Compare their evidence retention, sandbox boundaries, and context compaction against Agy-Squad.",
|
|
31
|
+
"scopeFiles": [
|
|
32
|
+
"bin/agy-squad.mjs",
|
|
33
|
+
"mcp/planner.mjs",
|
|
34
|
+
"benchmarks/teamwork-vs-squad/README.md"
|
|
35
|
+
],
|
|
36
|
+
"instructions": "Execute search_web and inspect benchmark files to audit Devin/SWE-agent execution patterns and Antigravity native /teamwork. Measure context consumption under heavy test runs and compare with Agy-Squad's swarm planning and L41 teardown. Do not rely on parametric memory or internal flattery. Write your detailed markdown report with citations to your specialist slot.",
|
|
37
|
+
"expectedDeliverable": "Markdown evidence report with comparative matrix, blast-radius analysis, and 5-axis ratings for the 3 coding agent harnesses."
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
{
|
|
2
|
+
"squads": {
|
|
3
|
+
"skill_and_pr_review_audit": {
|
|
4
|
+
"lead": {
|
|
5
|
+
"role": "Skill & PR-Review Standard Lead",
|
|
6
|
+
"readOnly": true,
|
|
7
|
+
"objective": "Apply the Agy-Squad PR Review Standard v1.4.0 (.agents/skills/pr-review/SKILL.md) to audit .agents/skills/self-diagnosis and .agents/skills/pr-review for contract accuracy, progressive disclosure, and token efficiency.",
|
|
8
|
+
"scopeFiles": [
|
|
9
|
+
".agents/skills/self-diagnosis/SKILL.md",
|
|
10
|
+
".agents/skills/self-diagnosis/scripts/diagnose.mjs",
|
|
11
|
+
".agents/skills/pr-review/SKILL.md",
|
|
12
|
+
"docs/tools.md"
|
|
13
|
+
],
|
|
14
|
+
"instructions": "For subagent fallback, compile via 'diagnose.mjs --print-dispatch skill_and_pr_review_audit --parent-id <id>'. On /swarm, wait via swarm_wait for READY receipts, inspect specialist reports with rtk read, write verified synthesis ('Content Verdict: PASS', FAIL, or BLOCKED) preserving 1-ID-per-finding granularity (never compress or omit distinct P0-P3/optimization/residual items before prune), verify planner-assigned flat audit-* reports 'Integrity Verdict: CLEAN', run 'node bin/agy-squad.mjs' (fingerprint, inspect, bundle, verify, prune), and post <=500B READY.",
|
|
15
|
+
"expectedDeliverable": "Synthesis report with Content Verdict: PASS | FAIL | BLOCKED, SKILL/DOC/ARCH/SCRIPT triage, and verified SHA-256 hashes."
|
|
16
|
+
},
|
|
17
|
+
"specialists": [
|
|
18
|
+
{
|
|
19
|
+
"role": "Self-Diagnosis Skill & Progressive Disclosure Auditor",
|
|
20
|
+
"readOnly": true,
|
|
21
|
+
"objective": "Audit .agents/skills/self-diagnosis/SKILL.md, scripts/diagnose.mjs, resources/self-diagnosis-manifest.json, and references/optimization-and-review-rubric.md using pr-review SKILL/DOC/SCRIPT criteria: verify frontmatter, relative links, CLI flags, progressive disclosure ratio (SKILL.md vs references/), and propose concrete token or runtime optimizations.",
|
|
22
|
+
"scopeFiles": [
|
|
23
|
+
".agents/skills/self-diagnosis/SKILL.md",
|
|
24
|
+
".agents/skills/self-diagnosis/scripts/diagnose.mjs",
|
|
25
|
+
".agents/skills/self-diagnosis/resources/self-diagnosis-manifest.json",
|
|
26
|
+
".agents/skills/self-diagnosis/references/optimization-and-review-rubric.md"
|
|
27
|
+
],
|
|
28
|
+
"instructions": "Use rtk read via run_command to inspect your scopeFiles (never call read_file; pass --allow-active-cohort when running diagnose.mjs while sibling cohorts are active, and never run --teardown mid-cohort).",
|
|
29
|
+
"expectedDeliverable": "Markdown evidence report with SKILL/DOC/SCRIPT P1/P2/P3 triage, progressive disclosure byte counts, concrete optimization proposals, and exact line references."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"role": "PR-Review Skill & Contract Alignment Auditor",
|
|
33
|
+
"readOnly": true,
|
|
34
|
+
"objective": "Cross-check .agents/skills/pr-review/SKILL.md and references/pr-review-standard.md against current Agy-Squad runtime contracts (mcp/index.js, mcp/dispatch.mjs, mcp/briefs.mjs, mcp/handoffs.mjs, docs/plans/LEDGER.md, docs/tools.md) and identify any stale guidance or token/prompt optimization opportunities.",
|
|
35
|
+
"scopeFiles": [
|
|
36
|
+
".agents/skills/pr-review/SKILL.md",
|
|
37
|
+
".agents/skills/pr-review/references/pr-review-standard.md",
|
|
38
|
+
"docs/plans/LEDGER.md",
|
|
39
|
+
"docs/tools.md"
|
|
40
|
+
],
|
|
41
|
+
"instructions": "Use rtk read via run_command to inspect your scopeFiles (never call read_file).",
|
|
42
|
+
"expectedDeliverable": "Markdown evidence report with SKILL/ARCH/DOC P1/P2/P3 triage, contract provenance checks, and concrete optimization recommendations."
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"runtime_and_contract_diagnosis": {
|
|
47
|
+
"lead": {
|
|
48
|
+
"role": "Runtime & Contract Diagnostics Lead",
|
|
49
|
+
"readOnly": true,
|
|
50
|
+
"objective": "Execute a pr-review v1.4.0 audit across MCP, RUN, SVC, SCRIPT, TEST, and DEP categories to detect unhandled edge cases, boundary gaps, or state-cleanup defects in Agy-Squad.",
|
|
51
|
+
"scopeFiles": [
|
|
52
|
+
"mcp/index.js",
|
|
53
|
+
"mcp/dispatch.mjs",
|
|
54
|
+
"mcp/briefs.mjs",
|
|
55
|
+
"mcp/handoffs.mjs",
|
|
56
|
+
"mcp/planner.mjs",
|
|
57
|
+
"bin/agy-squad.mjs"
|
|
58
|
+
],
|
|
59
|
+
"instructions": "For subagent fallback, compile via 'diagnose.mjs --print-dispatch runtime_and_contract_diagnosis --parent-id <id>'. On /swarm, wait via swarm_wait for READY receipts, inspect specialist reports with rtk read, write verified synthesis ('Content Verdict: PASS', FAIL, or BLOCKED) preserving 1-ID-per-finding granularity (never compress or omit distinct P0-P3/optimization/residual items before prune), verify planner-assigned flat audit-* reports 'Integrity Verdict: CLEAN', run 'node bin/agy-squad.mjs' (fingerprint, inspect, bundle, verify, prune), and post <=500B READY.",
|
|
60
|
+
"expectedDeliverable": "Synthesis report with Content Verdict: PASS | FAIL | BLOCKED summarizing MCP/RUN/SVC/SCRIPT/TEST/DEP findings."
|
|
61
|
+
},
|
|
62
|
+
"specialists": [
|
|
63
|
+
{
|
|
64
|
+
"role": "MCP, Dispatch, Planner & Handoff Boundary Inspector",
|
|
65
|
+
"readOnly": true,
|
|
66
|
+
"objective": "Audit mcp/index.js, mcp/dispatch.mjs, mcp/briefs.mjs, mcp/handoffs.mjs, mcp/verdicts.mjs, and mcp/planner.mjs under pr-review MCP, RUN, and SVC criteria: verify input validation, symlink/fd containment, TypeName/Workspace invariants, <= 500 byte receipt grammar, model provenance caveats, and readSynthesis verdict enforcement.",
|
|
67
|
+
"scopeFiles": [
|
|
68
|
+
"mcp/index.js",
|
|
69
|
+
"mcp/dispatch.mjs",
|
|
70
|
+
"mcp/briefs.mjs",
|
|
71
|
+
"mcp/handoffs.mjs",
|
|
72
|
+
"mcp/verdicts.mjs",
|
|
73
|
+
"mcp/planner.mjs"
|
|
74
|
+
],
|
|
75
|
+
"instructions": "Use rtk read via run_command to inspect your scopeFiles (never call read_file).",
|
|
76
|
+
"expectedDeliverable": "Markdown evidence report with MCP/RUN/SVC P1/P2/P3 triage and reproduction or test coverage evidence."
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"role": "Governance CLI, Bundler & Test Coverage Inspector",
|
|
80
|
+
"readOnly": true,
|
|
81
|
+
"objective": "Audit bin/agy-squad.mjs and tests/ under pr-review SCRIPT, TEST, and DEP criteria: verify CLI argument validation, --allow-unaudited override behavior, bundle integrity verification, and adversarial test assertions.",
|
|
82
|
+
"scopeFiles": [
|
|
83
|
+
"bin/agy-squad.mjs",
|
|
84
|
+
"tests/test-verdicts-and-pivot.mjs",
|
|
85
|
+
"tests/test-dispatch.mjs",
|
|
86
|
+
"tests/test-planner.mjs",
|
|
87
|
+
"tests/test-handoffs.mjs",
|
|
88
|
+
"tests/test-run.mjs",
|
|
89
|
+
"tests/test-server.mjs"
|
|
90
|
+
],
|
|
91
|
+
"instructions": "Use rtk read via run_command to inspect your scopeFiles (never call read_file).",
|
|
92
|
+
"expectedDeliverable": "Markdown evidence report with SCRIPT/TEST/DEP P1/P2/P3 triage and verification gap analysis."
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
"token_and_execution_optimization": {
|
|
97
|
+
"lead": {
|
|
98
|
+
"role": "Token & Execution Optimization Lead",
|
|
99
|
+
"readOnly": true,
|
|
100
|
+
"objective": "Profile and optimize Agy-Squad's context footprint, compiled brief byte budgets, squad manifest topology, and filesystem/IPC hot paths without weakening L1-L43 guarantees.",
|
|
101
|
+
"scopeFiles": [
|
|
102
|
+
"mcp/briefs.mjs",
|
|
103
|
+
"mcp/dispatch.mjs",
|
|
104
|
+
"mcp/handoffs.mjs",
|
|
105
|
+
"mcp/planner.mjs",
|
|
106
|
+
"mcp/index.js",
|
|
107
|
+
"bin/agy-squad.mjs",
|
|
108
|
+
".agents/skills/self-diagnosis/SKILL.md",
|
|
109
|
+
".agents/skills/pr-review/SKILL.md"
|
|
110
|
+
],
|
|
111
|
+
"instructions": "For subagent fallback, compile via 'diagnose.mjs --print-dispatch token_and_execution_optimization --parent-id <id>'. On /swarm, wait via swarm_wait for READY receipts, inspect specialist reports with rtk read, write verified synthesis ('Content Verdict: PASS', FAIL, or BLOCKED) preserving 1-ID-per-finding granularity (never compress or omit distinct P0-P3/optimization/residual items before prune), verify planner-assigned flat audit-* reports 'Integrity Verdict: CLEAN', run 'node bin/agy-squad.mjs' (fingerprint, inspect, bundle, verify, prune), and post <=500B READY.",
|
|
112
|
+
"expectedDeliverable": "Synthesis report with Content Verdict: PASS | FAIL | BLOCKED, ranked optimizations, and measured byte/latency deltas."
|
|
113
|
+
},
|
|
114
|
+
"specialists": [
|
|
115
|
+
{
|
|
116
|
+
"role": "Prompt, Schema & Skill Token Optimizer",
|
|
117
|
+
"readOnly": true,
|
|
118
|
+
"objective": "Measure UTF-8 byte and token budgets across mcp/briefs.mjs (superviseCohort, superviseIntegrityCohort, compiled lead/specialist prompts), mcp/index.js (tools/list schema), and .agents/skills/*/SKILL.md; identify concrete wording or progressive-disclosure optimizations that reduce context overhead while preserving all contract invariants.",
|
|
119
|
+
"scopeFiles": [
|
|
120
|
+
"mcp/briefs.mjs",
|
|
121
|
+
"mcp/index.js",
|
|
122
|
+
".agents/skills/self-diagnosis/SKILL.md",
|
|
123
|
+
".agents/skills/pr-review/SKILL.md"
|
|
124
|
+
],
|
|
125
|
+
"instructions": "Use rtk read via run_command to inspect your scopeFiles (never call read_file).",
|
|
126
|
+
"expectedDeliverable": "Markdown evidence report with exact byte/token measurements and concrete before/after optimization proposals."
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"role": "I/O, Concurrency & Cohort Topology Optimizer",
|
|
130
|
+
"readOnly": true,
|
|
131
|
+
"objective": "Inspect mcp/dispatch.mjs, mcp/planner.mjs, mcp/handoffs.mjs, and bin/agy-squad.mjs for redundant filesystem syscalls (realpathSync, openSync, statSync), cohort fan-out bottlenecks, and scopeFiles overlap; propose measurable runtime optimizations.",
|
|
132
|
+
"scopeFiles": [
|
|
133
|
+
"mcp/dispatch.mjs",
|
|
134
|
+
"mcp/planner.mjs",
|
|
135
|
+
"mcp/handoffs.mjs",
|
|
136
|
+
"bin/agy-squad.mjs"
|
|
137
|
+
],
|
|
138
|
+
"instructions": "Use rtk read via run_command to inspect your scopeFiles (never call read_file).",
|
|
139
|
+
"expectedDeliverable": "Markdown evidence report with syscall/latency analysis and ranked runtime optimization proposals."
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|