opencode-codeops 2.0.3 → 2.1.0

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 (38) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/README.md +5 -2
  3. package/_shared/specialist-agents.md +63 -9
  4. package/agent-templates/codebase-scout.md +1 -0
  5. package/agent-templates/concurrency-auditor.md +1 -0
  6. package/agent-templates/design-challenger.md +1 -0
  7. package/agent-templates/financial-integrity-auditor.md +1 -0
  8. package/agent-templates/perf-auditor.md +1 -0
  9. package/agent-templates/phase-reviewer.md +1 -0
  10. package/agent-templates/plan-task-executor-opus.md +1 -0
  11. package/agent-templates/plan-task-executor.md +1 -0
  12. package/agent-templates/preflight-auditor.md +1 -0
  13. package/agent-templates/security-auditor.md +1 -0
  14. package/agent-templates/semantics-reviewer.md +1 -0
  15. package/agent-templates/spec-test-author.md +1 -0
  16. package/agents/concurrency-auditor.md +7 -2
  17. package/agents/correctness-reviewer.md +7 -2
  18. package/agents/demanding-executor.md +7 -2
  19. package/agents/design-challenger.md +7 -2
  20. package/agents/executor.md +7 -2
  21. package/agents/explorer.md +7 -2
  22. package/agents/financial-integrity-auditor.md +7 -2
  23. package/agents/performance-auditor.md +7 -2
  24. package/agents/preflight-auditor.md +7 -2
  25. package/agents/security-auditor.md +7 -2
  26. package/agents/semantics-reviewer.md +7 -2
  27. package/agents/spec-test-author.md +7 -2
  28. package/package.json +1 -1
  29. package/scripts/__pycache__/install_agents.cpython-312.pyc +0 -0
  30. package/scripts/fixtures/catalog-executor.golden.md +3 -2
  31. package/scripts/install_agents.py +61 -11
  32. package/skills/analyze-agents/SKILL.md +78 -0
  33. package/skills/analyze-project/SKILL.md +1 -1
  34. package/skills/exec-plan/SKILL.md +3 -3
  35. package/skills/exec-plan/execution-protocol.md +11 -3
  36. package/skills/make-plan/SKILL.md +3 -1
  37. package/skills/make-plan/quality-checklist.md +1 -0
  38. package/skills/make-requirements/SKILL.md +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,77 @@
2
2
 
3
3
  All notable changes to CodeOps are recorded here.
4
4
 
5
+ ## 2.1.0 — 2026-10-09
6
+
7
+ ### Documentation
8
+
9
+ - readme: list the analyze-agents skill and the on-demand detection flow
10
+ - exec-plan: record ruling batches in the per-plan findings ledger
11
+ - skills: complete T-07 with the coverage-line smoke and render clarifications
12
+ - skills: surface specialist checks and split proposals from the creation gate
13
+ - plans: resolve the analyze-agents preflight findings and pass the plan
14
+ - plans: add the analyze-agents feature plan set (gate passed)
15
+ - changelog: add the 2.0.4 upgrade notes and record the release
16
+
17
+ ### Chores
18
+
19
+ - plan: record the 3.1.1 live smoke
20
+ - plan: record 2.1.3 full verification
21
+ - plan: record 1.1.3 full verification
22
+ - plan: use plain-bullet deliverables so progress counts only tasks
23
+ - plan: record T-07.3 full verification
24
+ - plan: complete T-06 - v2.0.4 verified and issue #2 closed
25
+
26
+ ### Fixes
27
+
28
+ - skills: harden the ledger assertions per the phase-2 review
29
+ - skills: anchor the phase-1 review assertions and clarify the fallback wording
30
+ - tests: drop the borrowed ST id from the T-07 content suite
31
+ - skills: resolve the T-07 review findings
32
+
33
+ ### Tests
34
+
35
+ - skills: extend the analyze-agents content tests with the ledger wiring (red phase)
36
+ - skills: add analyze-agents content spec tests (red phase)
37
+ - skills: add specialist awareness content tests (red phase)
38
+
39
+ ### Features
40
+
41
+ - skills: add the analyze-agents check skill and protocol wiring
42
+
43
+ ## 2.0.4 — 2026-10-09
44
+
45
+ ### Upgrade Notes
46
+
47
+ - Existing installs upgrade in place: run `npx opencode-codeops update` (package-scope installs) or
48
+ re-run `install_agents.py --roles` / `--custom` (project-generated agents); `--check` reports
49
+ `STALE` until the files are regenerated.
50
+ - Generated agent files now open with `---`, so OpenCode parses `mode`, `hidden`, `permissions`,
51
+ descriptions, and model pins. Catalog roles are hidden subagents instead of selectable primary
52
+ agents. `temperature`/`reasoningEffort` values remain preserved but are not yet sent by the
53
+ OpenCode V2 runner.
54
+
55
+ ### Chores
56
+
57
+ - plan: sync the T-06 progress header (6/8 tasks)
58
+ - plan: record T-06.6 live spot-check on OpenCode 2.0.24
59
+ - plan: record T-06.5 full verification and legacy-upgrade check
60
+
61
+ ### Documentation
62
+
63
+ - plans: add the specialist-awareness task plan and the analyze-agents register
64
+
65
+ ### Fixes
66
+
67
+ - agents: restore curated role descriptions and harden --check
68
+ - agents: regenerate the packaged agent files in the frontmatter-first layout
69
+ - agents: emit frontmatter-first agent files and keep legacy installs upgradeable
70
+
71
+ ### Tests
72
+
73
+ - agents: move layout helpers and the catalog golden to frontmatter-first
74
+ - agents: add frontmatter-first regression tests (red phase)
75
+
5
76
  ## 2.0.3 — 2026-10-06
6
77
 
7
78
  ### CI
package/README.md CHANGED
@@ -16,6 +16,7 @@ Turn an idea or existing system into ambiguity-free requirements, grounded speci
16
16
  | `exec-plan` | Execute a plan — implement → verify → commit loop with quality reviews |
17
17
  | `roadmap` | Live feature-set roadmap — make, update, review, archive |
18
18
  | `analyze-project` | Analyze repo and create/refresh CodeOps-aware `AGENTS.md` guidance |
19
+ | `analyze-agents` | Run the project-level specialist check on demand — proposals or a recorded None, with check state |
19
20
  | `setup-codeops` | Set up or migrate CodeOps in a git repo |
20
21
  | `setup-routing` | Configure per-role subagent model and policy routing |
21
22
  | `upgrade-plan` | Upgrade legacy CodeOps artifacts to current schema |
@@ -191,8 +192,10 @@ capability gap the twelve catalog roles and dynamic packets cannot close. Specia
191
192
  only with your explicit approval — the `--auto-design` mode cannot approve them.
192
193
 
193
194
  - **Detect** — `make-requirements`, `make-plan`, and `analyze-project` run an evidence-based check
194
- and record the outcome (including a negative one). At most two candidates are proposed per
195
- requirements set or plan.
195
+ and record the outcome (including a negative one); the `analyze-agents` skill runs the same
196
+ check on demand and maintains `codeops/specialist-check.json` for the coverage line. At most two
197
+ candidates per scope surface as lightweight, evidence-backed proposals; the creation gate
198
+ applies when you choose to proceed.
196
199
  - **Create** — after you approve the candidate packet, `setup-routing` writes a brief at
197
200
  `codeops/specialists/<role>.md`, writes routing policy first, generates a visible agent with
198
201
  `install_agents.py --custom <role>`, and updates a managed index block in `AGENTS.md` with
@@ -64,6 +64,52 @@ escalation)` entry.
64
64
  - Rejection and deferral are valid outcomes. A rejected candidate may not reappear in the same
65
65
  scope without new evidence.
66
66
 
67
+ ## Proposals and the creation gate
68
+
69
+ A **lightweight proposal** is a short, evidence-backed suggestion — role slug, kind, one-line
70
+ capability, evidence (`file:line`), the smallest alternative and why it is insufficient — surfaced
71
+ in the normal findings/plan flow. Proposals need no gate: they are suggestions, not machinery.
72
+
73
+ The Complexity Escalation Gate, the independent challenger verdict, and the reserved-authority
74
+ decision apply only when the user chooses to proceed to creation. Approved roles are then created
75
+ through `setup-routing` as described below; the lightweight proposal format is what `analyze-agents`
76
+ and every detection step emit for at most two candidates per scope.
77
+
78
+ ## Check state
79
+
80
+ Running the check records one small project file:
81
+
82
+ ```json
83
+ {
84
+ "checkedAt": "<ISO-8601 timestamp>",
85
+ "plans": ["<plan folder>", "<plan folder>"]
86
+ }
87
+ ```
88
+
89
+ - Path: `codeops/specialist-check.json` (project-level in both layouts).
90
+ - Written at the end of every check run — including `None` outcomes — by the execution surface
91
+ (`analyze-agents`); the `plans` list is layout-aware.
92
+ - Absent, unreadable, or malformed state means **never checked** for consumers; the
93
+ `analyze-project` coverage line then recommends a run. Fail loud, never silent.
94
+
95
+ ## Findings ledger
96
+
97
+ `exec-plan` records each ruling batch in the plan's findings ledger — one compact row per batch,
98
+ identifiers and area tokens only:
99
+
100
+ - Location: `plans/<plan>/05-findings.md` (flat) or
101
+ `codeops/features/<f>/plans/<plan>/05-findings.md` (nested), per
102
+ [`layout-convention.md`](layout-convention.md).
103
+ - Format:
104
+
105
+ | Finding | Phase | Severity | Area | Ruling |
106
+ | ------- | ----- | -------- | ---- | ------ |
107
+ | RV-001 | 2 | MAJOR | scripts/install_agents.py | fixed |
108
+
109
+ - Writer: `exec-plan`'s ruling step appends the batch's rows after each ruling batch; runtime
110
+ complexity decisions stay in the ambiguity register.
111
+ - The `analyze-agents` check reads these rows for finding-area recurrence.
112
+
67
113
  ## Routing layers
68
114
 
69
115
  | Layer | Owner | Content | Consumer |
@@ -76,15 +122,21 @@ escalation)` entry.
76
122
 
77
123
  ## Detection integration
78
124
 
125
+ The `analyze-agents` skill is the execution surface for the criteria in every flow below; each
126
+ step keeps an instruction referencing these criteria so the flow still works when the skill is
127
+ unavailable.
128
+
79
129
  ### make-requirements
80
130
 
81
131
  1. After domain-lens selection and scope confirmation, run the detection criteria.
82
- 2. For each candidate, open an ambiguity-register entry (`Technical (complexity escalation)`) with
83
- the candidate packet, run the challenger, and obtain the user's decision.
132
+ 2. Surface at most two candidates in one batch as lightweight proposals (§Proposals and the
133
+ creation gate). When the user chooses to proceed to creation, open an ambiguity-register entry
134
+ (`Technical (complexity escalation)`) with the candidate packet, run the challenger, and obtain
135
+ the user's decision.
84
136
  3. Approved candidates are created through `setup-routing` or noted for creation before the first
85
137
  implementing plan; rejected candidates are recorded and dropped.
86
- 4. Record the check in the final summary. No new requirements-template section is created; the
87
- brief and the register are the durable records.
138
+ 4. Record the check in the final summary as a `Specialist check:` line. No new requirements-template
139
+ section is created; the brief and the register are the durable records.
88
140
 
89
141
  ### make-plan
90
142
 
@@ -111,16 +163,18 @@ escalation)` entry.
111
163
  standing specialist would close.
112
164
  ```
113
165
 
114
- 3. Candidate approval, challenger, and persistence follow the shared gate exactly. Approved roles
115
- are created through `setup-routing` before execution begins; the plan remains valid without them
116
- via dynamic-packet fallback.
166
+ 3. Candidates surface as lightweight proposals (§Proposals and the creation gate); when the user
167
+ chooses to proceed to creation, the Complexity Escalation Gate, the challenger, and persistence
168
+ apply exactly as defined there. Approved roles are created through `setup-routing` before
169
+ execution begins; the plan remains valid without them via dynamic-packet fallback.
117
170
 
118
171
  ### analyze-project
119
172
 
120
173
  1. While inspecting manifests and conventions, note specialization signals (specialized
121
174
  framework/DSL, domain invariants, conventions a generic agent would miss).
122
- 2. When a signal is strong and no specialist exists, report the candidate with evidence and
123
- recommend running `setup-routing`; never write agent files or candidate artifacts, and keep
175
+ 2. When a signal is strong and no specialist exists, surface the candidate as a lightweight
176
+ proposal (§Proposals and the creation gate) with evidence, and recommend running `setup-routing`
177
+ when the user chooses to proceed; never write agent files or candidate artifacts, and keep
124
178
  `AGENTS.md` compact.
125
179
  3. Preserve the `<!-- CODEOPS-SPECIALISTS:START -->` / `<!-- CODEOPS-SPECIALISTS:END -->` block
126
180
  byte-for-byte when refreshing managed guidance.
@@ -1,4 +1,5 @@
1
1
  <!-- Agent template: codebase-scout
2
+ description: Answers factual questions about a codebase with file:line evidence — locations, signatures, patterns, conventions in use. Returns FACTS only: zero opinions, zero recommendations, and an honest "not found" (with what was searched) rather than a guess. Cheap and fast; the dispatching skill caps scout dispatches at 3 per skill run. Dispatched by CodeOps skills that need grounding before deciding or authoring.
2
3
  See agents/ for the OpenCode agent definition files generated from this template.
3
4
  Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Agent template: concurrency-auditor
2
+ description: Independently audits a bounded change for races, deadlocks, atomicity violations, ordering defects, cancellation leaks, and unsafe retry behavior.
2
3
  See agents/ for the OpenCode agent definition files generated from this template.
3
4
  Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Agent template: design-challenger
2
+ description: Independent second opinion on a consequential decision. Receives the problem and candidate options WITHOUT the parent's preferred choice, evaluates them on the merits (adding overlooked options where justified), and returns its own recommendation with grounded rationale and per-option risks. Read-only, no Bash. Dispatched per the recommendation-hardening protocol for high-stakes recommendations.
2
3
  See agents/ for the OpenCode agent definition files generated from this template.
3
4
  Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Agent template: financial-integrity-auditor
2
+ description: Independently audits a bounded change for ledger, money-movement, precision, idempotency, atomicity, reconciliation, and auditability defects.
2
3
  See agents/ for the OpenCode agent definition files generated from this template.
3
4
  Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Agent template: perf-auditor
2
+ description: Reviews ONE completed CodeOps phase diff for performance risks — hot paths, allocations, algorithmic complexity, N+1 query patterns, blocking I/O. Reports PE-NNN findings — severity, file:line, cost model, remedy — or an explicit "no findings". Read-only: never edits, fixes, or commits. Dispatched by exec-plan only when the repo's quality profile sets perf_critical and the phase diff touches code; supersedes the phase reviewer's perf lens.
2
3
  See agents/ for the OpenCode agent definition files generated from this template.
3
4
  Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Agent template: phase-reviewer
2
+ description: Reviews ONE completed CodeOps phase diff against its dispatch packet through the always-on lenses (correctness, maintainability, standards) plus the packet's add-on lenses. Verifies spec-test integrity (no *.spec.test.* file touched). Reports RV-NNN findings — severity, lens, file:line, remedy — or an explicit "no findings". Read-only: never edits, fixes, or commits. Dispatched by exec-plan's post-phase quality step when the repo's quality profile is active.
2
3
  See agents/ for the OpenCode agent definition files generated from this template.
3
4
  Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Agent template: plan-task-executor-opus
2
+ description: Executes one dispatched high-sensitivity or complex unit — normally a whole phase, occasionally a single task — from a CodeOps exec-plan — semantic analysis, codegen, query lowering, concurrency, security, or performance-critical work. Use for complex and sensitive phases when a cheaper model than the session's is warranted.
2
3
  See agents/ for the OpenCode agent definition files generated from this template.
3
4
  Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Agent template: plan-task-executor
2
+ description: Executes one dispatched lower-sensitivity unit — normally a whole phase, occasionally a single task — from a CodeOps exec-plan. Implements code, writes/updates tests, runs the project verify command, reports pass/fail per task. Use for trivial and standard phases when a cheaper model than the session's is warranted.
2
3
  See agents/ for the OpenCode agent definition files generated from this template.
3
4
  Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Agent template: preflight-auditor
2
+ description: Audits ONE artifact (requirements set, plan, or document) against ONE assigned dimension cluster from the preflight skill's 13-dimension scan. Every finding must cite file:line evidence and survive the auditor's own refutation attempt before being reported. Returns PA-NNN findings for the dispatching preflight session to merge into its PF numbering. Read-only. Dispatched by the preflight skill's clustered fan-out.
2
3
  See agents/ for the OpenCode agent definition files generated from this template.
3
4
  Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Agent template: security-auditor
2
+ description: Audits ONE completed CodeOps phase diff against the union of the repo's active security-profile checklists (owasp-web, auth-protocol, financial-integrity, tenant-isolation, mcp-agent) in a single dispatch. Reports SA-NNN findings — severity, checklist, file:line, remedy — or an explicit "no findings". Read-only: never edits, fixes, or commits. Dispatched by exec-plan when the repo's quality profile names at least one security profile; supersedes the phase reviewer's security lens.
2
3
  See agents/ for the OpenCode agent definition files generated from this template.
3
4
  Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Agent template: semantics-reviewer
2
+ description: Reviews compiler, language, protocol, or other formal-semantics changes for completeness, internal consistency, and preservation across phases.
2
3
  See agents/ for the OpenCode agent definition files generated from this template.
3
4
  Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
4
5
 
@@ -1,4 +1,5 @@
1
1
  <!-- Agent template: spec-test-author
2
+ description: Writes specification tests (*.spec.test.*) for ONE feature/phase from the packet's spec excerpts and planned interface signatures ONLY — implementation-blind by contract, with a FORBIDDEN file list it must never open. Runs the verify command expecting RED and reports the red status per test. Never weakens an expectation to ease authoring. Dispatched by exec-plan at phase start for plan-marked spec-test tasks when the repo's quality profile is active.
2
3
  See agents/ for the OpenCode agent definition files generated from this template.
3
4
  Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
4
5
 
@@ -1,8 +1,8 @@
1
+ ---
1
2
  # Generated by CodeOps install_agents.py
2
3
  # Role: concurrency-auditor | Template: concurrency-auditor
3
4
  # Do not edit this file manually — regenerate with: install_agents.py
4
- ---
5
- description: Independently audits a bounded change for races, deadlocks, atomicity violations, ordering defects, cancellation leaks, and unsafe retry behavior.
5
+ description: "Independently audits a bounded change for races, deadlocks, atomicity violations, ordering defects, cancellation leaks, and unsafe retry behavior."
6
6
  mode: subagent
7
7
  temperature: 0.1
8
8
  hidden: true
@@ -12,6 +12,11 @@ permission:
12
12
  bash: deny
13
13
  ---
14
14
 
15
+ <!-- Agent template: concurrency-auditor
16
+ description: Independently audits a bounded change for races, deadlocks, atomicity violations, ordering defects, cancellation leaks, and unsafe retry behavior.
17
+ See agents/ for the OpenCode agent definition files generated from this template.
18
+ Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
19
+
15
20
  Audit exactly the supplied change packet. Establish shared state, ownership, synchronization, ordering, cancellation, retry, timeout, and failure semantics before judging the diff. Hunt for data races, check-then-act gaps, lost updates, deadlocks, starvation, unsafe publication, reentrancy, duplicate work, stale reads, partial commits, and unbounded concurrency. Construct realistic interleavings that could violate stated invariants. Cite file and line evidence and distinguish proven defects from unverified risk. Return surviving findings with severity, interleaving, violated invariant, and remedy, or an explicit clean result. Remain read-only.
16
21
 
17
22
  - **Workspace hygiene (non-negotiable).** Temporary artifacts you create — logs, diffs, patches,
@@ -1,8 +1,8 @@
1
+ ---
1
2
  # Generated by CodeOps install_agents.py
2
3
  # Role: correctness-reviewer | Template: phase-reviewer
3
4
  # Do not edit this file manually — regenerate with: install_agents.py
4
- ---
5
- description: Reviews ONE completed CodeOps phase diff against its dispatch packet through the always-on lenses (correctness, maintainability, standards) plus the packet's add-on lenses. Verifies spec-test integrity (no *.spec.test.* file touched). Reports RV-NNN findings — severity, lens, file:line, remedy — or an explicit "no findings". Read-only: never edits, fixes, or commits. Dispatched by exec-plan's post-phase quality step when the repo's quality profile is active.
5
+ description: "Reviews ONE completed CodeOps phase diff against its dispatch packet through the always-on lenses (correctness, maintainability, standards) plus the packet's add-on lenses. Verifies spec-test integrity (no *.spec.test.* file touched). Reports RV-NNN findings \u2014 severity, lens, file:line, remedy \u2014 or an explicit \"no findings\". Read-only: never edits, fixes, or commits. Dispatched by exec-plan's post-phase quality step when the repo's quality profile is active."
6
6
  mode: subagent
7
7
  temperature: 0.1
8
8
  hidden: true
@@ -14,6 +14,11 @@ permission:
14
14
  bash: allow
15
15
  ---
16
16
 
17
+ <!-- Agent template: phase-reviewer
18
+ description: Reviews ONE completed CodeOps phase diff against its dispatch packet through the always-on lenses (correctness, maintainability, standards) plus the packet's add-on lenses. Verifies spec-test integrity (no *.spec.test.* file touched). Reports RV-NNN findings — severity, lens, file:line, remedy — or an explicit "no findings". Read-only: never edits, fixes, or commits. Dispatched by exec-plan's post-phase quality step when the repo's quality profile is active.
19
+ See agents/ for the OpenCode agent definition files generated from this template.
20
+ Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
21
+
17
22
  You review exactly ONE completed phase of work, via a review packet (the phase diff, the phase's
18
23
  task and Deliverable lines, original goal, smallest viable design, approved complexity decisions,
19
24
  the active lenses, the repo's quality-profile excerpt, and the verify command with its last result).
@@ -1,8 +1,8 @@
1
+ ---
1
2
  # Generated by CodeOps install_agents.py
2
3
  # Role: demanding-executor | Template: plan-task-executor-opus
3
4
  # Do not edit this file manually — regenerate with: install_agents.py
4
- ---
5
- description: Executes one dispatched high-sensitivity or complex unit — normally a whole phase, occasionally a single task — from a CodeOps exec-plan — semantic analysis, codegen, query lowering, concurrency, security, or performance-critical work. Use for complex and sensitive phases when a cheaper model than the session's is warranted.
5
+ description: "Executes one dispatched high-sensitivity or complex unit \u2014 normally a whole phase, occasionally a single task \u2014 from a CodeOps exec-plan \u2014 semantic analysis, codegen, query lowering, concurrency, security, or performance-critical work. Use for complex and sensitive phases when a cheaper model than the session's is warranted."
6
6
  mode: subagent
7
7
  temperature: 0.1
8
8
  hidden: true
@@ -14,6 +14,11 @@ permission:
14
14
  bash: allow
15
15
  ---
16
16
 
17
+ <!-- Agent template: plan-task-executor-opus
18
+ description: Executes one dispatched high-sensitivity or complex unit — normally a whole phase, occasionally a single task — from a CodeOps exec-plan — semantic analysis, codegen, query lowering, concurrency, security, or performance-critical work. Use for complex and sensitive phases when a cheaper model than the session's is warranted.
19
+ See agents/ for the OpenCode agent definition files generated from this template.
20
+ Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
21
+
17
22
  You execute exactly ONE dispatched high-sensitivity unit — normally a whole phase, occasionally
18
23
  a single task — from a CodeOps execution plan, via a phase packet (the phase's task lines,
19
24
  Deliverables and Verify lines, spec excerpts, ST-cases, AR decisions, relevant approved complexity
@@ -1,8 +1,8 @@
1
+ ---
1
2
  # Generated by CodeOps install_agents.py
2
3
  # Role: design-challenger | Template: design-challenger
3
4
  # Do not edit this file manually — regenerate with: install_agents.py
4
- ---
5
- description: Independent second opinion on a consequential decision. Receives the problem and candidate options WITHOUT the parent's preferred choice, evaluates them on the merits (adding overlooked options where justified), and returns its own recommendation with grounded rationale and per-option risks. Read-only, no Bash. Dispatched per the recommendation-hardening protocol for high-stakes recommendations.
5
+ description: "Independent second opinion on a consequential decision. Receives the problem and candidate options WITHOUT the parent's preferred choice, evaluates them on the merits (adding overlooked options where justified), and returns its own recommendation with grounded rationale and per-option risks. Read-only, no Bash. Dispatched per the recommendation-hardening protocol for high-stakes recommendations."
6
6
  mode: subagent
7
7
  temperature: 0.1
8
8
  hidden: true
@@ -14,6 +14,11 @@ permission:
14
14
  bash: deny
15
15
  ---
16
16
 
17
+ <!-- Agent template: design-challenger
18
+ description: Independent second opinion on a consequential decision. Receives the problem and candidate options WITHOUT the parent's preferred choice, evaluates them on the merits (adding overlooked options where justified), and returns its own recommendation with grounded rationale and per-option risks. Read-only, no Bash. Dispatched per the recommendation-hardening protocol for high-stakes recommendations.
19
+ See agents/ for the OpenCode agent definition files generated from this template.
20
+ Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
21
+
17
22
  You provide an independent recommendation on exactly ONE decision, via a challenger packet (the
18
23
  problem statement, constraints, and candidate options — deliberately WITHOUT the dispatching
19
24
  session's own preference, so your judgment stays uncontaminated). The dispatch rules and budget
@@ -1,8 +1,8 @@
1
+ ---
1
2
  # Generated by CodeOps install_agents.py
2
3
  # Role: executor | Template: plan-task-executor
3
4
  # Do not edit this file manually — regenerate with: install_agents.py
4
- ---
5
- description: Executes one dispatched lower-sensitivity unit — normally a whole phase, occasionally a single task — from a CodeOps exec-plan. Implements code, writes/updates tests, runs the project verify command, reports pass/fail per task. Use for trivial and standard phases when a cheaper model than the session's is warranted.
5
+ description: "Executes one dispatched lower-sensitivity unit \u2014 normally a whole phase, occasionally a single task \u2014 from a CodeOps exec-plan. Implements code, writes/updates tests, runs the project verify command, reports pass/fail per task. Use for trivial and standard phases when a cheaper model than the session's is warranted."
6
6
  mode: subagent
7
7
  temperature: 0.1
8
8
  hidden: true
@@ -14,6 +14,11 @@ permission:
14
14
  bash: allow
15
15
  ---
16
16
 
17
+ <!-- Agent template: plan-task-executor
18
+ description: Executes one dispatched lower-sensitivity unit — normally a whole phase, occasionally a single task — from a CodeOps exec-plan. Implements code, writes/updates tests, runs the project verify command, reports pass/fail per task. Use for trivial and standard phases when a cheaper model than the session's is warranted.
19
+ See agents/ for the OpenCode agent definition files generated from this template.
20
+ Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
21
+
17
22
  You execute exactly ONE dispatched unit — normally a whole phase, occasionally a single task —
18
23
  from a CodeOps execution plan, via a phase packet (the phase's task lines, Deliverables and
19
24
  Verify lines, spec excerpts, ST-cases, AR decisions, relevant approved complexity PF/RV decisions,
@@ -1,8 +1,8 @@
1
+ ---
1
2
  # Generated by CodeOps install_agents.py
2
3
  # Role: explorer | Template: codebase-scout
3
4
  # Do not edit this file manually — regenerate with: install_agents.py
4
- ---
5
- description: Answers factual questions about a codebase with file:line evidence — locations, signatures, patterns, conventions in use. Returns FACTS only: zero opinions, zero recommendations, and an honest "not found" (with what was searched) rather than a guess. Cheap and fast; the dispatching skill caps scout dispatches at 3 per skill run. Dispatched by CodeOps skills that need grounding before deciding or authoring.
5
+ description: "Answers factual questions about a codebase with file:line evidence \u2014 locations, signatures, patterns, conventions in use. Returns FACTS only: zero opinions, zero recommendations, and an honest \"not found\" (with what was searched) rather than a guess. Cheap and fast; the dispatching skill caps scout dispatches at 3 per skill run. Dispatched by CodeOps skills that need grounding before deciding or authoring."
6
6
  mode: subagent
7
7
  temperature: 0.1
8
8
  hidden: true
@@ -14,6 +14,11 @@ permission:
14
14
  bash: deny
15
15
  ---
16
16
 
17
+ <!-- Agent template: codebase-scout
18
+ description: Answers factual questions about a codebase with file:line evidence — locations, signatures, patterns, conventions in use. Returns FACTS only: zero opinions, zero recommendations, and an honest "not found" (with what was searched) rather than a guess. Cheap and fast; the dispatching skill caps scout dispatches at 3 per skill run. Dispatched by CodeOps skills that need grounding before deciding or authoring.
19
+ See agents/ for the OpenCode agent definition files generated from this template.
20
+ Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
21
+
17
22
  You answer a small set of factual questions about the current codebase, via a scout packet (the
18
23
  questions, optional search hints, and the facts-only contract from `_shared/quality-profile.md`).
19
24
 
@@ -1,8 +1,8 @@
1
+ ---
1
2
  # Generated by CodeOps install_agents.py
2
3
  # Role: financial-integrity-auditor | Template: financial-integrity-auditor
3
4
  # Do not edit this file manually — regenerate with: install_agents.py
4
- ---
5
- description: Independently audits a bounded change for ledger, money-movement, precision, idempotency, atomicity, reconciliation, and auditability defects.
5
+ description: "Independently audits a bounded change for ledger, money-movement, precision, idempotency, atomicity, reconciliation, and auditability defects."
6
6
  mode: subagent
7
7
  temperature: 0.1
8
8
  hidden: true
@@ -12,6 +12,11 @@ permission:
12
12
  bash: deny
13
13
  ---
14
14
 
15
+ <!-- Agent template: financial-integrity-auditor
16
+ description: Independently audits a bounded change for ledger, money-movement, precision, idempotency, atomicity, reconciliation, and auditability defects.
17
+ See agents/ for the OpenCode agent definition files generated from this template.
18
+ Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
19
+
15
20
  Audit exactly the supplied change packet. Treat monetary correctness and auditability as invariants. Check balanced accounting, integer minor-unit or explicitly justified decimal arithmetic, currency/unit consistency, idempotency and duplicate submission, transaction atomicity, retry and partial-failure behavior, reconciliation, authorization, immutable audit evidence, overflow and negative amounts, time boundaries, and reversal/refund semantics. Attempt to falsify every claimed invariant using concrete counterexamples. Cite file and line evidence. Return only surviving findings with severity, violated invariant, failure scenario, and remedy, or an explicit clean result. Remain read-only and do not accept implementation convenience as a reason to weaken financial semantics.
16
21
 
17
22
  - **Workspace hygiene (non-negotiable).** Temporary artifacts you create — logs, diffs, patches,
@@ -1,8 +1,8 @@
1
+ ---
1
2
  # Generated by CodeOps install_agents.py
2
3
  # Role: performance-auditor | Template: perf-auditor
3
4
  # Do not edit this file manually — regenerate with: install_agents.py
4
- ---
5
- description: Reviews ONE completed CodeOps phase diff for performance risks — hot paths, allocations, algorithmic complexity, N+1 query patterns, blocking I/O. Reports PE-NNN findings — severity, file:line, cost model, remedy — or an explicit "no findings". Read-only: never edits, fixes, or commits. Dispatched by exec-plan only when the repo's quality profile sets perf_critical and the phase diff touches code; supersedes the phase reviewer's perf lens.
5
+ description: "Reviews ONE completed CodeOps phase diff for performance risks \u2014 hot paths, allocations, algorithmic complexity, N+1 query patterns, blocking I/O. Reports PE-NNN findings \u2014 severity, file:line, cost model, remedy \u2014 or an explicit \"no findings\". Read-only: never edits, fixes, or commits. Dispatched by exec-plan only when the repo's quality profile sets perf_critical and the phase diff touches code; supersedes the phase reviewer's perf lens."
6
6
  mode: subagent
7
7
  temperature: 0.1
8
8
  hidden: true
@@ -14,6 +14,11 @@ permission:
14
14
  bash: allow
15
15
  ---
16
16
 
17
+ <!-- Agent template: perf-auditor
18
+ description: Reviews ONE completed CodeOps phase diff for performance risks — hot paths, allocations, algorithmic complexity, N+1 query patterns, blocking I/O. Reports PE-NNN findings — severity, file:line, cost model, remedy — or an explicit "no findings". Read-only: never edits, fixes, or commits. Dispatched by exec-plan only when the repo's quality profile sets perf_critical and the phase diff touches code; supersedes the phase reviewer's perf lens.
19
+ See agents/ for the OpenCode agent definition files generated from this template.
20
+ Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
21
+
17
22
  You performance-review exactly ONE completed phase of work, via a review packet (the phase
18
23
  diff, the phase's task and Deliverable lines, the profile excerpt, and the verify command with
19
24
  its last result). The conventions behind the packet live in `_shared/quality-profile.md`.
@@ -1,8 +1,8 @@
1
+ ---
1
2
  # Generated by CodeOps install_agents.py
2
3
  # Role: preflight-auditor | Template: preflight-auditor
3
4
  # Do not edit this file manually — regenerate with: install_agents.py
4
- ---
5
- description: Audits ONE artifact (requirements set, plan, or document) against ONE assigned dimension cluster from the preflight skill's 13-dimension scan. Every finding must cite file:line evidence and survive the auditor's own refutation attempt before being reported. Returns PA-NNN findings for the dispatching preflight session to merge into its PF numbering. Read-only. Dispatched by the preflight skill's clustered fan-out.
5
+ description: "Audits ONE artifact (requirements set, plan, or document) against ONE assigned dimension cluster from the preflight skill's 13-dimension scan. Every finding must cite file:line evidence and survive the auditor's own refutation attempt before being reported. Returns PA-NNN findings for the dispatching preflight session to merge into its PF numbering. Read-only. Dispatched by the preflight skill's clustered fan-out."
6
6
  mode: subagent
7
7
  temperature: 0.1
8
8
  hidden: true
@@ -14,6 +14,11 @@ permission:
14
14
  bash: allow
15
15
  ---
16
16
 
17
+ <!-- Agent template: preflight-auditor
18
+ description: Audits ONE artifact (requirements set, plan, or document) against ONE assigned dimension cluster from the preflight skill's 13-dimension scan. Every finding must cite file:line evidence and survive the auditor's own refutation attempt before being reported. Returns PA-NNN findings for the dispatching preflight session to merge into its PF numbering. Read-only. Dispatched by the preflight skill's clustered fan-out.
19
+ See agents/ for the OpenCode agent definition files generated from this template.
20
+ Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
21
+
17
22
  You audit exactly ONE artifact against exactly ONE dimension cluster, via an audit packet (the
18
23
  artifact or its path, the assigned cluster with its dimensions, the original goal, the smallest
19
24
  viable design, relevant approved complexity decisions, and any codebase context the dimensions
@@ -1,8 +1,8 @@
1
+ ---
1
2
  # Generated by CodeOps install_agents.py
2
3
  # Role: security-auditor | Template: security-auditor
3
4
  # Do not edit this file manually — regenerate with: install_agents.py
4
- ---
5
- description: Audits ONE completed CodeOps phase diff against the union of the repo's active security-profile checklists (owasp-web, auth-protocol, financial-integrity, tenant-isolation, mcp-agent) in a single dispatch. Reports SA-NNN findings — severity, checklist, file:line, remedy — or an explicit "no findings". Read-only: never edits, fixes, or commits. Dispatched by exec-plan when the repo's quality profile names at least one security profile; supersedes the phase reviewer's security lens.
5
+ description: "Audits ONE completed CodeOps phase diff against the union of the repo's active security-profile checklists (owasp-web, auth-protocol, financial-integrity, tenant-isolation, mcp-agent) in a single dispatch. Reports SA-NNN findings \u2014 severity, checklist, file:line, remedy \u2014 or an explicit \"no findings\". Read-only: never edits, fixes, or commits. Dispatched by exec-plan when the repo's quality profile names at least one security profile; supersedes the phase reviewer's security lens."
6
6
  mode: subagent
7
7
  temperature: 0.1
8
8
  hidden: true
@@ -14,6 +14,11 @@ permission:
14
14
  bash: allow
15
15
  ---
16
16
 
17
+ <!-- Agent template: security-auditor
18
+ description: Audits ONE completed CodeOps phase diff against the union of the repo's active security-profile checklists (owasp-web, auth-protocol, financial-integrity, tenant-isolation, mcp-agent) in a single dispatch. Reports SA-NNN findings — severity, checklist, file:line, remedy — or an explicit "no findings". Read-only: never edits, fixes, or commits. Dispatched by exec-plan when the repo's quality profile names at least one security profile; supersedes the phase reviewer's security lens.
19
+ See agents/ for the OpenCode agent definition files generated from this template.
20
+ Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
21
+
17
22
  You security-audit exactly ONE completed phase of work, via an audit packet (the phase diff, the
18
23
  phase's task and Deliverable lines, the repo's active security profiles, the profile excerpt,
19
24
  and the verify command with its last result). You run ONCE per phase with the union of every
@@ -1,8 +1,8 @@
1
+ ---
1
2
  # Generated by CodeOps install_agents.py
2
3
  # Role: semantics-reviewer | Template: semantics-reviewer
3
4
  # Do not edit this file manually — regenerate with: install_agents.py
4
- ---
5
- description: Reviews compiler, language, protocol, or other formal-semantics changes for completeness, internal consistency, and preservation across phases.
5
+ description: "Reviews compiler, language, protocol, or other formal-semantics changes for completeness, internal consistency, and preservation across phases."
6
6
  mode: subagent
7
7
  temperature: 0.1
8
8
  hidden: true
@@ -12,6 +12,11 @@ permission:
12
12
  bash: deny
13
13
  ---
14
14
 
15
+ <!-- Agent template: semantics-reviewer
16
+ description: Reviews compiler, language, protocol, or other formal-semantics changes for completeness, internal consistency, and preservation across phases.
17
+ See agents/ for the OpenCode agent definition files generated from this template.
18
+ Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
19
+
15
20
  Review exactly the supplied semantic specification or implementation packet. Trace behavior across syntax/decoding, name or identity resolution, typing/validation, intermediate representations, evaluation/lowering, optimization/transformation, diagnostics, serialization, and compatibility as applicable. Seek ambiguous rules, non-total behavior, phase disagreement, unsound transformations, nondeterminism, invalid recovery, and diagnostics that expose implementation accidents. Use counterexamples and minimal programs/messages to falsify the claimed semantics. Cite evidence and return surviving findings with severity, example, affected phases, and resolution, or an explicit clean result. Remain read-only.
16
21
 
17
22
  - **Workspace hygiene (non-negotiable).** Temporary artifacts you create — logs, diffs, patches,
@@ -1,8 +1,8 @@
1
+ ---
1
2
  # Generated by CodeOps install_agents.py
2
3
  # Role: spec-test-author | Template: spec-test-author
3
4
  # Do not edit this file manually — regenerate with: install_agents.py
4
- ---
5
- description: Writes specification tests (*.spec.test.*) for ONE feature/phase from the packet's spec excerpts and planned interface signatures ONLY — implementation-blind by contract, with a FORBIDDEN file list it must never open. Runs the verify command expecting RED and reports the red status per test. Never weakens an expectation to ease authoring. Dispatched by exec-plan at phase start for plan-marked spec-test tasks when the repo's quality profile is active.
5
+ description: "Writes specification tests (*.spec.test.*) for ONE feature/phase from the packet's spec excerpts and planned interface signatures ONLY \u2014 implementation-blind by contract, with a FORBIDDEN file list it must never open. Runs the verify command expecting RED and reports the red status per test. Never weakens an expectation to ease authoring. Dispatched by exec-plan at phase start for plan-marked spec-test tasks when the repo's quality profile is active."
6
6
  mode: subagent
7
7
  temperature: 0.1
8
8
  hidden: true
@@ -14,6 +14,11 @@ permission:
14
14
  bash: allow
15
15
  ---
16
16
 
17
+ <!-- Agent template: spec-test-author
18
+ description: Writes specification tests (*.spec.test.*) for ONE feature/phase from the packet's spec excerpts and planned interface signatures ONLY — implementation-blind by contract, with a FORBIDDEN file list it must never open. Runs the verify command expecting RED and reports the red status per test. Never weakens an expectation to ease authoring. Dispatched by exec-plan at phase start for plan-marked spec-test tasks when the repo's quality profile is active.
19
+ See agents/ for the OpenCode agent definition files generated from this template.
20
+ Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
21
+
17
22
  You author the specification tests for exactly ONE feature or phase, via a spec packet (spec
18
23
  excerpts, the expected test cases, planned interface signatures from the plan documents, the
19
24
  repo's test framework and conventions, the FORBIDDEN implementation-file list, and the verify
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-codeops",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "description": "Specification-first engineering for complex systems — CodeOps plugin for OpenCode",
5
5
  "type": "module",
6
6
  "engines": {
@@ -1,8 +1,8 @@
1
+ ---
1
2
  # Generated by CodeOps install_agents.py
2
3
  # Role: executor | Template: plan-task-executor
3
4
  # Do not edit this file manually — regenerate with: install_agents.py
4
- ---
5
- description: CodeOps plan-task-executor agent
5
+ description: "Executes one dispatched lower-sensitivity unit \u2014 normally a whole phase, occasionally a single task \u2014 from a CodeOps exec-plan. Implements code, writes/updates tests, runs the project verify command, reports pass/fail per task. Use for trivial and standard phases when a cheaper model than the session's is warranted."
6
6
  mode: subagent
7
7
  temperature: 0.1
8
8
  hidden: true
@@ -15,6 +15,7 @@ permission:
15
15
  ---
16
16
 
17
17
  <!-- Agent template: plan-task-executor
18
+ description: Executes one dispatched lower-sensitivity unit — normally a whole phase, occasionally a single task — from a CodeOps exec-plan. Implements code, writes/updates tests, runs the project verify command, reports pass/fail per task. Use for trivial and standard phases when a cheaper model than the session's is warranted.
18
19
  See agents/ for the OpenCode agent definition files generated from this template.
19
20
  Do not add YAML frontmatter here — use install_agents.py to generate agent files. -->
20
21
 
@@ -434,13 +434,18 @@ def build_agent_frontmatter(
434
434
  permissions: dict[str, str],
435
435
  sandbox: Optional[str],
436
436
  ) -> str:
437
- """Construct the OpenCode agent YAML frontmatter block."""
437
+ """Construct the OpenCode agent YAML frontmatter block.
438
+
439
+ The opening `---` delimiter must be the file's first line: OpenCode parses
440
+ agent frontmatter only when the file begins with it. The CodeOps provenance
441
+ banner therefore lives inside the block as YAML comment lines.
442
+ """
438
443
  lines = [
444
+ "---",
439
445
  CODEOPS_MARKER,
440
446
  f"# Role: {role} | Template: {template_name}",
441
447
  "# Do not edit this file manually — regenerate with: install_agents.py",
442
- "---",
443
- f"description: {description}",
448
+ f"description: {json.dumps(description)}",
444
449
  "mode: subagent",
445
450
  ]
446
451
  if model:
@@ -457,12 +462,20 @@ def build_agent_frontmatter(
457
462
 
458
463
 
459
464
  def load_template_description(plugin_root: Path, template_name: str) -> str:
460
- """Extract description from an agent template's original frontmatter."""
465
+ """Extract the description embedded in a template's provenance comment.
466
+
467
+ Templates deliberately carry no YAML frontmatter; the description lives as a
468
+ `description:` line inside the leading HTML comment and is copied verbatim
469
+ into the generated agent's frontmatter. The search is scoped to that comment
470
+ so body text can never be mistaken for the description.
471
+ """
461
472
  path = plugin_root / "agent-templates" / f"{template_name}.md"
462
473
  if not path.exists():
463
474
  return f"CodeOps {template_name} agent"
464
475
  content = path.read_text(encoding="utf-8")
465
- m = re.search(r"^description:\s*(.+)$", content, re.MULTILINE)
476
+ comment = re.match(r"^<!--([\s\S]*?)-->", content)
477
+ scope = comment.group(1) if comment else content
478
+ m = re.search(r"^\s*description:\s*(.+)$", scope, re.MULTILINE)
466
479
  return m.group(1).strip() if m else f"CodeOps {template_name} agent"
467
480
 
468
481
 
@@ -506,6 +519,14 @@ def generate_agent_file(
506
519
  def is_codeops_generated(path: Path) -> bool:
507
520
  """Return True if the file was generated by this script (has the CodeOps marker).
508
521
 
522
+ Two layouts are recognized so existing installs upgrade in place instead of
523
+ being skipped as hand-authored:
524
+
525
+ - current: the file opens with `---` and the marker appears within the
526
+ first eight lines (OpenCode parses the block only in this layout);
527
+ - legacy: the marker is the first line and the frontmatter block follows
528
+ the provenance banner.
529
+
509
530
  Unreadable or non-UTF-8 files are treated as not generated, so a corrupt
510
531
  file is reported as a state instead of crashing the caller.
511
532
 
@@ -513,20 +534,28 @@ def is_codeops_generated(path: Path) -> bool:
513
534
  path: Candidate generated agent file.
514
535
 
515
536
  Returns:
516
- True when the first line carries the CodeOps ownership marker.
537
+ True when the file carries the CodeOps ownership marker in either layout.
517
538
  """
518
539
  if not path.is_file():
519
540
  return False
520
541
  try:
521
- first_line = path.read_text(encoding="utf-8").split("\n", 1)[0]
542
+ lines = [line.strip() for line in path.read_text(encoding="utf-8").split("\n", 8)[:8]]
522
543
  except (OSError, UnicodeDecodeError):
523
544
  return False
524
- return first_line.strip() == CODEOPS_MARKER
545
+ if not lines:
546
+ return False
547
+ if lines[0] == CODEOPS_MARKER:
548
+ return True
549
+ return lines[0] == "---" and CODEOPS_MARKER in lines[1:]
525
550
 
526
551
 
527
552
  def generate_custom_agent(plugin_root: Path, role: str, brief: dict, role_config: dict) -> str:
528
553
  """Generate the full content of a specialist agent file.
529
554
 
555
+ The file opens with the `---` frontmatter delimiter because OpenCode parses
556
+ agent frontmatter only when the file begins with it; the provenance banner
557
+ is emitted inside the block as YAML comments.
558
+
530
559
  The generated file embeds two things: the generic template contract chosen
531
560
  by the brief's `kind`, and the project brief body. Text that can contain
532
561
  arbitrary characters (the description and a routing model pin) is written
@@ -582,10 +611,10 @@ def generate_custom_agent(plugin_root: Path, role: str, brief: dict, role_config
582
611
  permissions["edit"] = "deny"
583
612
 
584
613
  lines = [
614
+ "---",
585
615
  CODEOPS_MARKER,
586
616
  f"# Role: {role} | Template: {template_name}",
587
617
  "# Do not edit this file manually — regenerate with: install_agents.py",
588
- "---",
589
618
  f"description: {json.dumps(brief['description'])}",
590
619
  "mode: subagent",
591
620
  ]
@@ -708,7 +737,7 @@ def generated_custom_template(path: Path) -> Optional[str]:
708
737
  if not is_codeops_generated(path):
709
738
  return None
710
739
  try:
711
- lines = path.read_text(encoding="utf-8").split("\n", 3)[:3]
740
+ lines = path.read_text(encoding="utf-8").split("\n", 6)[:6]
712
741
  except (OSError, UnicodeDecodeError):
713
742
  return None
714
743
  for line in lines:
@@ -868,6 +897,10 @@ def run_sync_agents_md(project: Path, dry_run: bool) -> int:
868
897
  def run_check(project: Path, plugin_root: Path, roles: list, routing_roles: dict) -> int:
869
898
  """Report catalog, custom, orphan, and AGENTS.md states.
870
899
 
900
+ Catalog roles are additionally content-compared against the generator
901
+ output, so a generated file whose layout or fields no longer match is
902
+ reported as STALE instead of silently passing the check.
903
+
871
904
  Args:
872
905
  project: Resolved project root.
873
906
  plugin_root: Package root containing `agent-templates/`.
@@ -882,10 +915,27 @@ def run_check(project: Path, plugin_root: Path, roles: list, routing_roles: dict
882
915
  issues: list[str] = []
883
916
  for role in roles:
884
917
  out_path = agents_dir / f"{role}.md"
918
+ if out_path.is_symlink():
919
+ issues.append(f"HAND-AUTHORED (skip): {out_path}")
920
+ continue
885
921
  if not out_path.exists():
886
922
  issues.append(f"MISSING: {out_path}")
887
- elif not is_codeops_generated(out_path):
923
+ continue
924
+ if not is_codeops_generated(out_path):
888
925
  issues.append(f"HAND-AUTHORED (skip): {out_path}")
926
+ continue
927
+ try:
928
+ expected = generate_agent_file(plugin_root, role, routing_roles.get(role, {}))
929
+ except (BriefError, OSError, UnicodeDecodeError) as exc:
930
+ issues.append(f"INVALID: {role} — {exc}")
931
+ continue
932
+ try:
933
+ current = out_path.read_text(encoding="utf-8")
934
+ except (OSError, UnicodeDecodeError):
935
+ issues.append(f"STALE: {role}")
936
+ continue
937
+ if current != expected:
938
+ issues.append(f"STALE: {role}")
889
939
 
890
940
  briefs, errors = collect_briefs(project)
891
941
  issues.extend(errors)
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: analyze-agents
3
+ description: Run the project-level specialist check on demand. Reads the repository's requirements, plans, findings ledgers, and manifests directly (no script), applies the specialist-agent detection criteria, presents at most two evidence-backed lightweight proposals or a None with evidence, and records the check state consumed by the analyze-project coverage line.
4
+ ---
5
+
6
+ # analyze-agents
7
+
8
+ Run this check to re-evaluate whether a project would benefit from a project-specific specialist
9
+ subagent — on request, or because `analyze-project` reported the coverage as due. This skill is the
10
+ execution surface for the detection criteria in
11
+ [`../../_shared/specialist-agents.md`](../../_shared/specialist-agents.md); it reads the
12
+ repository's own artifacts and never invokes a script.
13
+
14
+ ## Evidence
15
+
16
+ Read these sources for the current project. All paths are layout-aware per
17
+ [`../../_shared/layout-convention.md`](../../_shared/layout-convention.md): flat `plans/` or nested
18
+ `codeops/features/<f>/plans/`.
19
+
20
+ - requirements and plan documents — domain/lens tags and scope history;
21
+ - per-plan findings ledgers (`05-findings.md`) — finding-area recurrence;
22
+ - manifests (`package.json`, `pyproject.toml`, `go.mod`, and similar) — specialized framework,
23
+ DSL, codegen, or protocol signals;
24
+ - existing `codeops/specialists/` briefs and `codeops/codeops.json` routing roles —
25
+ deduplicate against installed specialists;
26
+ - `codeops/specialist-check.json` — the prior check state.
27
+
28
+ ## Detection flow
29
+
30
+ 1. Collect the evidence sources above.
31
+ 2. Apply the detection criteria and disqualifiers from the protocol document: a candidate needs
32
+ evidenced strong signal(s) and no disqualifier.
33
+ 3. Recurrence anchor: one area appearing in at least two plans or three findings ranks as a strong
34
+ signal; thresholds anchor judgment, not hard gates.
35
+ 4. Present at most two candidates in one batch as **lightweight proposals** — role slug, kind, a
36
+ one-line capability, evidence with `file:line`, and the smallest alternative with why it is
37
+ insufficient — or record `None` with evidence.
38
+ 5. Write the check state (below) on every run, including a `None` outcome.
39
+ 6. Hand-off: on user interest, hand off to the `setup-routing` flow for creation. Never create or
40
+ modify agent files, briefs, routing policy, or `AGENTS.md`.
41
+
42
+ ## Check state
43
+
44
+ Write `codeops/specialist-check.json` (project-level in both layouts; create the `codeops/`
45
+ directory lazily when it does not exist):
46
+
47
+ ```json
48
+ {
49
+ "checkedAt": "<ISO-8601 timestamp>",
50
+ "plans": ["<plan folder>", "<plan folder>"]
51
+ }
52
+ ```
53
+
54
+ The `plans` list contains the plan folders present at check time (layout-aware). Consumers treat
55
+ absent, unreadable, or malformed state as **never checked** and recommend a run — fail loud, never
56
+ silent.
57
+
58
+ ## Output
59
+
60
+ A short human summary: the candidate proposals in the lightweight format above, or `None` with
61
+ evidence, plus the state write result. The state file is the machine-readable artifact; there is no
62
+ separate JSON output mode.
63
+
64
+ ## Degradation
65
+
66
+ - Missing findings ledger: the output states that the ledger was missing and the check ran on
67
+ reduced evidence (documents and manifests only).
68
+ - Malformed ledger rows: skip the row with a note; never guess its fields.
69
+ - Empty repository (no plans or requirements): record `None` with evidence and still write the
70
+ check state.
71
+
72
+ ---
73
+
74
+ > **Workspace hygiene (non-negotiable):** put every temporary artifact this run creates in
75
+ > `$CODEOPS_TMPDIR` (fallback: the OS temp directory), never in the repository, and delete them
76
+ > all before reporting completion. Never delete user files, versioned artifacts, worktrees, or
77
+ > another session's temporary files. Full rules:
78
+ > [_shared/workspace-hygiene.md](../../_shared/workspace-hygiene.md).
@@ -24,7 +24,7 @@ description: Analyze the current repository and create or refresh concise CodeOp
24
24
  7. On a non-integration branch, preview changes to repository-wide guidance and ask before writing unless repository policy explicitly permits branch-local updates.
25
25
  8. In compact mode, remove duplication and stale generated detail from the managed section only. Flag suspected hand-authored bloat; never silently rewrite it.
26
26
  9. Validate every recorded command or mark it explicitly unverified.
27
- 10. When a specialization signal is strong and no specialist covers it, report the candidate with evidence and recommend the `setup-routing` creation flow ([../../_shared/specialist-agents.md](../../_shared/specialist-agents.md)); never write agent files here. Preserve the `<!-- CODEOPS-SPECIALISTS:START -->` / `<!-- CODEOPS-SPECIALISTS:END -->` block byte-for-byte when refreshing the managed section.
27
+ 10. Specialist coverage: read `codeops/specialist-check.json` when present and include a `Specialist coverage:` line in the managed section — `up to date (<YYYY-MM-DD>)` (from `checkedAt`) when the recorded plan set matches the current one; `check due — run analyze-agents` otherwise; when the state is absent or corrupt, render `check due — run analyze-agents (never checked)`. The `analyze-agents` skill runs the check (criteria: [../../_shared/specialist-agents.md](../../_shared/specialist-agents.md)); when a specialization signal is strong and no specialist covers it, report the candidate with evidence and recommend the `setup-routing` creation flow; never write agent files here. Preserve the `<!-- CODEOPS-SPECIALISTS:START -->` / `<!-- CODEOPS-SPECIALISTS:END -->` block byte-for-byte when refreshing the managed section.
28
28
 
29
29
  Keep `AGENTS.md` small. Operational routing belongs in `codeops/codeops.json` or `opencode.json`, not prose.
30
30
 
@@ -229,9 +229,9 @@ links to them, never restates them.
229
229
  The flow: the protocol records a phase-start ref when the phase begins; after the phase's last
230
230
  task verifies, the correctness reviewer and any active auditors are dispatched **in parallel** on
231
231
  the phase diff, their findings are merged and presented in severity-grouped batches, and each
232
- ruling is recorded in the durable finding artifact. Specialist roles listed in the plan's
233
- `## Specialist Agents` table dispatch per `_shared/quality-profile.md`; an unavailable specialist
234
- falls back to a generic packet and the fallback is reported.
232
+ ruling is recorded in the plan's findings ledger (`05-findings.md`). Specialist roles listed in
233
+ the plan's `## Specialist Agents` table dispatch per `_shared/quality-profile.md`; an unavailable
234
+ specialist falls back to a generic packet and the fallback is reported.
235
235
 
236
236
  > **🚨 Finding gate (load-bearing).** In normal mode, 🔴 CRITICAL and 🟠 MAJOR findings PAUSE
237
237
  > execution for the user's ruling in ALL commit modes. With active auto-design, select and record
@@ -199,9 +199,17 @@ whole-task diff. Activation rules, packets, supersession, and caps are defined i
199
199
  `[!]`, preserve the diff without marking it verified, and switch to the full standalone-plan
200
200
  path. The new `00-ambiguity-register.md` owns the packet and decision. Resume only after that
201
201
  plan's gates pass.
202
- 4. **Record decisions durably** in the finding artifact after each ruling batch. When the user
203
- approves larger machinery, also append a `Technical (complexity escalation)` runtime AR with
204
- every approval-evidence field required by the shared gate; the RV finding references that AR.
202
+ 4. **Record decisions durably** in the plan's findings ledger after each ruling batch. The ledger
203
+ is `plans/<plan>/05-findings.md` (flat) or
204
+ `codeops/features/<f>/plans/<plan>/05-findings.md` (nested), created lazily on first use, with a
205
+ one-line title and one compact row per batch:
206
+ `| Finding | Phase | Severity | Area | Ruling |` — finding ids use the review prefixes
207
+ `RV-`/`SA-`/`PE-`/`SR-` (for example `RV-001`), followed by the phase number,
208
+ `CRITICAL`/`MAJOR`/`MINOR`, a path or domain token, and
209
+ `fixed`/`accepted`/`deferred`/`dismissed`; identifiers and area tokens only, never prose. Task
210
+ mini-plans keep their ledger in their own plan folder. When the user approves larger machinery,
211
+ also append a `Technical (complexity escalation)` runtime AR with every approval-evidence field
212
+ required by the shared gate; the RV finding references that AR.
205
213
  5. **Accepted fixes:** implement → verify → follow-up commit per the commit mode. If any 🔴/🟠
206
214
  fix was applied, dispatch ONE re-review scoped to the fix diff — never a third pass. A fix
207
215
  the re-review still rejects is reported. Normal mode returns the ruling to the user; active
@@ -71,7 +71,7 @@ with active scope exploration.
71
71
 
72
72
  Re-run [../../references/domains/selection.md](../../references/domains/selection.md) before component decomposition. Requirements-stage lens selection is evidence, not a permanent assumption. Apply every selected lens to specifications, acceptance criteria, failure narratives, and test strategy.
73
73
 
74
- After lens selection and phase decomposition, run the specialist-gap check in [../../_shared/specialist-agents.md](../../_shared/specialist-agents.md). Record the outcome in `00-index.md` under `## Specialist Agents` — always, including `None` with its reason and evidence. Candidate creation is reserved authority: `--auto-design` may not approve it, and approved roles are created through `setup-routing`.
74
+ After lens selection and phase decomposition, run the specialist-gap check in [../../_shared/specialist-agents.md](../../_shared/specialist-agents.md). The `analyze-agents` skill executes the same detection flow on demand; the manual criteria in the linked protocol document remain the fallback when the skill is unavailable. Record the outcome in `00-index.md` under `## Specialist Agents` — always, including `None` with its reason and evidence. In the final plan summary, include a `Specialist check:` line — `None — <evidence>` or the candidate names. Candidate creation is reserved authority: `--auto-design` may not approve it, and approved roles are created through `setup-routing`.
75
75
 
76
76
  A folder `plans/<feature-name>/` containing:
77
77
 
@@ -274,6 +274,8 @@ Report what was created:
274
274
 
275
275
  **Summary:** Total Phases: X · Total Sessions: X · Estimated Time: X–X hours
276
276
 
277
+ **Specialist check:** [None — evidence / candidate names]
278
+
277
279
  **To begin implementation:** use the exec-plan skill on `[feature-name]`.
278
280
  ```
279
281
 
@@ -7,6 +7,7 @@ Run this before finalizing the plan documents. The **Specification-First Testing
7
7
  - [ ] All affected components identified
8
8
  - [ ] All scope decisions documented
9
9
  - [ ] All dependencies mapped
10
+ - [ ] The `## Specialist Agents` outcome is recorded in `00-index.md` (candidate or `None` with evidence)
10
11
  - [ ] Every planned item traces to the confirmed scope baseline or a user-kept `SE-*` entry
11
12
  - [ ] Strict scope contains no optional suggestions; exploration proposals remain non-executable
12
13
  until the user chooses `Keep`
@@ -55,7 +55,7 @@ than stored as a second mutable status.
55
55
 
56
56
  Before discovery, read [../../references/domains/selection.md](../../references/domains/selection.md), select every applicable system lens, and read those lens files completely. Record selected lenses and evidence in the requirements index. Re-evaluate selection when discovery reveals another domain; a financial web service, for example, requires financial, web, distributed/concurrent, and data/migration lenses.
57
57
 
58
- After lens selection and scope confirmation, run the specialist-gap check in [../../_shared/specialist-agents.md](../../_shared/specialist-agents.md). Propose at most two candidates in one batch, each through the Complexity Escalation Gate; creation is reserved authority (`--auto-design` may never approve it). Record the check outcome — including "none" — in the final summary.
58
+ After lens selection and scope confirmation, run the specialist-gap check in [../../_shared/specialist-agents.md](../../_shared/specialist-agents.md). The `analyze-agents` skill executes the same detection flow on demand; the manual criteria in the linked protocol document remain the fallback when the skill is unavailable. Surface at most two candidates in one batch as lightweight proposals (that document's §Proposals and the creation gate); the Complexity Escalation Gate and the reserved-authority approval apply only when the user chooses to proceed to creation (`--auto-design` may never approve it). Record the outcome in the final summary as a `Specialist check:` line — including `Specialist check: None — <evidence>`.
59
59
 
60
60
  You are NOT a passive interviewer. You are a **domain-aware consultant** that:
61
61