@event4u/agent-config 1.31.0 → 1.32.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 (25) hide show
  1. package/.agent-src/skills/feature-planning/SKILL.md +43 -7
  2. package/.agent-src/skills/judge-test-coverage/SKILL.md +4 -0
  3. package/.agent-src/skills/pest-testing/SKILL.md +13 -6
  4. package/.agent-src/skills/quality-tools/SKILL.md +4 -0
  5. package/.agent-src/skills/refine-prompt/SKILL.md +10 -0
  6. package/.agent-src/skills/refine-ticket/SKILL.md +12 -0
  7. package/.agent-src/skills/subagent-orchestration/SKILL.md +77 -12
  8. package/.agent-src/skills/subagent-orchestration/prompts/README.md +29 -0
  9. package/.agent-src/skills/subagent-orchestration/prompts/do-and-judge-two-stage.md +121 -0
  10. package/.agent-src/skills/subagent-orchestration/prompts/do-and-judge.md +60 -0
  11. package/.agent-src/skills/subagent-orchestration/prompts/do-competitively.md +65 -0
  12. package/.agent-src/skills/subagent-orchestration/prompts/do-in-parallel.md +62 -0
  13. package/.agent-src/skills/subagent-orchestration/prompts/do-in-steps.md +62 -0
  14. package/.agent-src/skills/subagent-orchestration/prompts/do-in-worktrees.md +70 -0
  15. package/.agent-src/skills/subagent-orchestration/prompts/judge-with-debate.md +63 -0
  16. package/.agent-src/skills/subagent-orchestration/schemas/subagent-status.json +63 -0
  17. package/.agent-src/skills/test-driven-development/SKILL.md +25 -13
  18. package/.agent-src/skills/testing-anti-patterns/SKILL.md +7 -0
  19. package/.agent-src/skills/testing-anti-patterns/process-anti-patterns.md +67 -0
  20. package/.claude-plugin/marketplace.json +1 -1
  21. package/CHANGELOG.md +24 -0
  22. package/docs/catalog.md +1 -1
  23. package/docs/contracts/file-ownership-matrix.json +341 -0
  24. package/package.json +1 -1
  25. package/scripts/check_bite_sized_granularity.py +99 -0
@@ -67,7 +67,7 @@ Explore → Plan → Refine → Roadmap → Implement
67
67
  ### Full workflow (complex features, 7 phases)
68
68
 
69
69
  Use the full workflow for features that span multiple files, require architecture decisions,
70
- or have unclear requirements. Trigger with `/feature-dev`.
70
+ or have unclear requirements. Trigger with `/feature:dev`.
71
71
 
72
72
  ```
73
73
  Discovery → Exploration → Questions → Architecture → Implementation → Review → Summary
@@ -100,7 +100,7 @@ Discovery → Exploration → Questions → Architecture → Implementation →
100
100
  - **Wait for answers before proceeding.**
101
101
 
102
102
  #### Phase 4: Architecture Design
103
- - Design 2-3 impl approaches with different tradeoffs:
103
+ - Design 2-3 implementation approaches with different tradeoffs:
104
104
  - **Minimal changes** — smallest change, maximum reuse.
105
105
  - **Clean architecture** — maintainability, elegant abstractions.
106
106
  - **Pragmatic balance** — speed + quality.
@@ -114,7 +114,7 @@ Discovery → Exploration → Questions → Architecture → Implementation →
114
114
  - Track progress via task list or roadmap.
115
115
 
116
116
  #### Phase 6: Quality Review
117
- - Review the impl for:
117
+ - Review the implementation for:
118
118
  - Simplicity, DRY, elegance.
119
119
  - Bugs and correctness.
120
120
  - Convention adherence.
@@ -136,9 +136,45 @@ Maintain a running **decision log** throughout the planning process. For each de
136
136
  Include the decision log in the feature plan file under a `## Decisions` section.
137
137
  This ensures future developers (and agents) understand the reasoning, not just the outcome.
138
138
 
139
+ ## Bite-sized task granularity (structural roadmaps only)
140
+
141
+ When a feature plan's generated roadmap declares `complexity: structural` in its frontmatter, every task bullet must be self-contained and 2–5 minutes of work. Lightweight roadmaps (the default) skip this section — coarse-grained tasks ("Add login endpoint", "Update tests") are correct when the work is well-scoped and low-risk.
142
+
143
+ Structural roadmap tasks must include:
144
+
145
+ 1. **Exact file path** — `app/Modules/Auth/Services/LoginService.php`, never *"the login service"*.
146
+ 2. **Complete code** — every method body, import, and signature ready to paste; no `// existing code` ellipses, no `…`.
147
+ 3. **Exact command** — `php artisan migrate --path=database/migrations/2026_05_09_create_logins.php`, never *"run the migration"*.
148
+ 4. **Expected output** — what success looks like (`Migrated: 2026_05_09_create_logins`) and the exit code.
149
+ 5. **No placeholders** — angle-bracket placeholders, `TODO`, `FIXME`, `tbd`, and `???` are blockers; resolve before the task ships.
150
+
151
+ The complexity flag lives in the roadmap's YAML frontmatter:
152
+
153
+ ```yaml
154
+ ---
155
+ complexity: structural # triggers bite-sized granularity
156
+ # or
157
+ complexity: lightweight # default — skips bite-sized granularity
158
+ ---
159
+ ```
160
+
161
+ Source: adapted from `obra/superpowers` `writing-plans/SKILL.md` § Task Structure + § No Placeholders (v5.1.0); complexity-gating is our addition (Council Round 1, Q4 — mitigates UX pushback for senior engineers on well-scoped work).
162
+
163
+ ## Self-review (3-scan checklist)
164
+
165
+ Before presenting any plan, run these three scans in order. Each is a fast pass — not a deep review. Failures block presentation; fix and re-scan.
166
+
167
+ 1. **Spec coverage** — every requirement, AC bullet, or constraint from the input has a corresponding section / AC / scope item in the plan. Walk the input top-to-bottom; tick each requirement against the plan; missing items become open questions or new AC.
168
+ 2. **Placeholder / TODO scan** — grep the draft for `<placeholder>`, `TODO`, `FIXME`, `tbd`, `???`, `XXX`. Either resolve them now or surface them in the *Open questions* section. No placeholder ships unflagged.
169
+ 3. **Type / shape consistency** — proposed data structures, API shapes, file paths, and module names match existing codebase patterns. Cite at least one existing file per new structure as the convention anchor.
170
+
171
+ This scan is **separate from** adversarial-review (below). Self-review catches mechanical gaps (missing AC, leftover placeholders, mis-shaped types); adversarial-review challenges the plan's reasoning.
172
+
173
+ Source: adapted from `obra/superpowers` `writing-plans/SKILL.md` § Self-Review (v5.1.0).
174
+
139
175
  ## Adversarial self-review
140
176
 
141
- After completing a plan, run the **`adversarial-review`** skill before presenting it.
177
+ After the 3-scan self-review passes, run the **`adversarial-review`** skill before presenting.
142
178
  Focus on the "Feature plans / Architecture" attack questions. See that skill for the full process.
143
179
 
144
180
  ## Feature plan format
@@ -183,7 +219,7 @@ module's `agents/` directory:
183
219
  Before creating a feature plan, always:
184
220
  1. **Search the codebase** for related code, existing patterns, and affected areas.
185
221
  2. **Read module docs** if the feature touches a specific module.
186
- 3. **Check existing features** in `agents/features/` for overlap or deps.
222
+ 3. **Check existing features** in `agents/features/` for overlap or dependencies.
187
223
 
188
224
  ### Be collaborative
189
225
 
@@ -194,7 +230,7 @@ Before creating a feature plan, always:
194
230
 
195
231
  ### Keep it navigational
196
232
 
197
- Feature plans are decision documents, not impl guides.
233
+ Feature plans are decision documents, not implementation guides.
198
234
  Implementation details belong in roadmaps.
199
235
 
200
236
  ## Output format
@@ -221,6 +257,6 @@ Implementation details belong in roadmaps.
221
257
 
222
258
  - Do NOT create feature plans without user input — always collaborate.
223
259
  - Do NOT skip codebase research — always check what exists.
224
- - Do NOT put impl steps in the feature plan — that's the roadmap's job.
260
+ - Do NOT put implementation steps in the feature plan — that's the roadmap's job.
225
261
  - Do NOT commit or push without permission.
226
262
  - Do NOT duplicate information from `AGENTS.md` or module docs.
@@ -147,6 +147,10 @@ as a follow-up for the implementer — the judge does not execute tools.
147
147
  model-pairing rules (`subagents.judge_model` one tier above implementer).
148
148
  - [`test-driven-development`](../test-driven-development/SKILL.md) —
149
149
  the write-the-test-first workflow that prevents most findings this judge makes.
150
+ - [`testing-anti-patterns`](../testing-anti-patterns/SKILL.md) and its
151
+ sibling [`process-anti-patterns.md`](../testing-anti-patterns/process-anti-patterns.md) —
152
+ prevention layer this judge backs up; rationalization-table row numbers
153
+ are valid review citations.
150
154
  - Sibling judges: [`judge-bug-hunter`](../judge-bug-hunter/SKILL.md),
151
155
  [`judge-security-auditor`](../judge-security-auditor/SKILL.md),
152
156
  [`judge-code-quality`](../judge-code-quality/SKILL.md) — dispatched
@@ -22,6 +22,13 @@ Use this skill for all Laravel testing tasks, especially when working with:
22
22
 
23
23
  This skill extends `php-coder`, `laravel`, and `eloquent`.
24
24
 
25
+ For prevention layers that fire **before** writing a test — TDD
26
+ discipline, mock-isolation gates, and the 12 process rationalizations
27
+ ("I'll add the test after", "patch first, test later") — see
28
+ [`test-driven-development`](../test-driven-development/SKILL.md),
29
+ [`testing-anti-patterns`](../testing-anti-patterns/SKILL.md), and
30
+ [`process-anti-patterns.md`](../testing-anti-patterns/process-anti-patterns.md).
31
+
25
32
  ## Procedure: Write Pest tests
26
33
 
27
34
  1. **Read the base skills first** — apply `php-coder`, `laravel`, and `eloquent` where relevant.
@@ -53,9 +60,9 @@ For bug fixes and new features, prefer test-driven development:
53
60
 
54
61
  ### Why test-first matters
55
62
 
56
- Tests written **after** impl pass immediately. Passing immediately proves nothing:
63
+ Tests written **after** implementation pass immediately. Passing immediately proves nothing:
57
64
  - The test might test the wrong thing.
58
- - The test might test impl, not behavior.
65
+ - The test might test implementation, not behavior.
59
66
  - You never saw it catch the bug — so you don't know if it would.
60
67
 
61
68
  ### Bug fix TDD
@@ -120,7 +127,7 @@ The test proves the fix works AND prevents regression.
120
127
  - For JSON APIs, assert:
121
128
  - exact relevant fields
122
129
  - error structure when applicable
123
- - DB state after the request
130
+ - database state after the request
124
131
  - Do not only assert `200` — verify meaningful behavior.
125
132
 
126
133
  ## Validation tests
@@ -258,7 +265,7 @@ When reviewing or auditing existing tests, check for these anti-patterns:
258
265
 
259
266
  - Do not test private methods directly.
260
267
  - Do not over-mock Laravel internals.
261
- - Do not assert impl details when behavior assertions are enough.
268
+ - Do not assert implementation details when behavior assertions are enough.
262
269
  - Do not write brittle tests tied to formatting or irrelevant response noise.
263
270
  - Do not create giant tests that cover many behaviors at once.
264
271
  - Do not skip authorization or validation coverage for important endpoints.
@@ -285,7 +292,7 @@ When generating Pest tests:
285
292
  - Don't use `readonly` or `final` on Pest test helper classes — it breaks mocking.
286
293
  - Don't add `use` statements for global classes (`Exception`, `DateTimeImmutable`) in Pest files — they're auto-imported.
287
294
  - The model forgets `$this->travel(5)->seconds()` for time-dependent tests — never rely on `now()` differing between lines.
288
- - Parallel tests share the DB — don't assume column values are null unless you explicitly set them.
295
+ - Parallel tests share the database — don't assume column values are null unless you explicitly set them.
289
296
 
290
297
  ## Do NOT
291
298
 
@@ -297,7 +304,7 @@ When generating Pest tests:
297
304
  When generating new tests, focus on:
298
305
  - **Business logic**: calculations, status transitions, validation rules, data transformations
299
306
  - **Edge cases**: null, empty string, zero, negative numbers, boundary values, max length
300
- - **Error paths**: invalid input, missing deps, exception handling
307
+ - **Error paths**: invalid input, missing dependencies, exception handling
301
308
  - **Different code branches**: if/else, early returns, fallback behavior
302
309
 
303
310
  What NOT to test:
@@ -34,6 +34,10 @@ If both PHP and JS/TS files changed → run **both** pipelines.
34
34
  - `verify-before-complete` rule — timing: run quality tools ONCE at the end, not after each edit
35
35
  - `php-coding` rule → PHPStan section — inline ignores, PHPDoc rules
36
36
  - `verify-before-complete` rule — must run quality checks before claiming work is done
37
+ - [`testing-anti-patterns`](../testing-anti-patterns/SKILL.md) and
38
+ [`process-anti-patterns.md`](../testing-anti-patterns/process-anti-patterns.md) —
39
+ test-side rationalizations these tools cannot catch (e.g. "CI is red,
40
+ patch first, test later").
37
41
 
38
42
  ---
39
43
 
@@ -126,6 +126,16 @@ The rubric (5 dimensions × 0–2, sum / 10) and band thresholds
126
126
  (`high ≥ 0.8`, `medium 0.5–0.79`, `low < 0.5`) are owned by
127
127
  `confidence.py`. Do not re-derive them in prose.
128
128
 
129
+ ### 6. Self-review (3-scan checklist)
130
+
131
+ Before emitting the envelope, run these three scans. Each is a fast pass; failure blocks emission.
132
+
133
+ 1. **Spec coverage** — every concrete signal from step 2 (constraints) and step 3 (assumptions) is reflected somewhere in the AC list. Walk the constraint list top-to-bottom; each must anchor at least one AC bullet or appear in the *Assumptions* block.
134
+ 2. **Placeholder / TODO scan** — the rendered envelope contains no `<placeholder>`, `TODO`, `FIXME`, `tbd`, `???`, `XXX` strings. The literal angle-bracket placeholders in the template (`<one sentence …>`, `<bullet>`) must be replaced with concrete text before emission.
135
+ 3. **Type / shape consistency** — every named file, module, route, or command in the AC matches the project's existing conventions. If the prompt names `auth.service.ts` but the codebase uses `AuthService.php`, surface the mismatch in *Assumptions* rather than adopting the prompt's spelling.
136
+
137
+ Source: adapted from `obra/superpowers` `writing-plans/SKILL.md` § Self-Review (v5.1.0).
138
+
129
139
  ## Band-action mapping
130
140
 
131
141
  The `refine` dispatcher step in `directives/backend/refine.py` reads
@@ -250,6 +250,18 @@ open questions surfaced>
250
250
  The "Refined ticket" section is wrapped in a **copyable Markdown box**
251
251
  so the user can grab it verbatim.
252
252
 
253
+ ## Self-review (3-scan checklist)
254
+
255
+ Run these three scans on the rendered output before the close-prompt. Each is a fast pass; failure blocks emission and forces a fix.
256
+
257
+ 1. **Spec coverage** — every AC bullet and constraint from the original ticket (and every parent-AC line surfaced via `fold_parent_context`) is reflected in the rewritten ticket, the Top-5 risks, or the *Open questions* section. Nothing from the input vanishes silently.
258
+ 2. **Placeholder / TODO scan** — no `<placeholder>`, `TODO`, `FIXME`, `tbd`, `???`, `XXX` strings remain. The angle-bracket placeholders in the template (`<rewritten title>`, `<risk>`, `<one paragraph>`) must be replaced with concrete prose before the close-prompt fires.
259
+ 3. **Type / shape consistency** — every module, file, route, or domain term cited in the rewritten ticket and Top-5 risks matches `repo_context.context_docs` and `recent_branches` vocabulary. Invented terms are flagged in *Open questions* or replaced with the project's actual term.
260
+
261
+ Self-review is mechanical (gaps, leftovers, naming drift); persona voices and orchestration outputs handle reasoning critique. Both run; neither replaces the other.
262
+
263
+ Source: adapted from `obra/superpowers` `writing-plans/SKILL.md` § Self-Review (v5.1.0).
264
+
253
265
  ## Close-prompt (mandatory final step)
254
266
 
255
267
  **Probe write access first (Phase F6).** Before rendering, do a
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: subagent-orchestration
3
- description: "Use when orchestrating implementer/judge subagents — six modes (do-and-judge, do-in-steps, do-in-parallel, do-competitively, judge-with-debate, do-in-worktrees) — models from .agent-settings.yml."
3
+ description: "Use when orchestrating implementer/judge subagents — seven modes (do-and-judge ±two-stage, do-in-steps/parallel/worktrees, do-competitively, judge-with-debate) — models from .agent-settings.yml."
4
4
  source: package
5
5
  ---
6
6
 
@@ -44,7 +44,7 @@ judge is a fresh pair of eyes. If `.agent-settings.yml` resolves to
44
44
  identical implementer and judge models, surface the mismatch before
45
45
  running — do not silently continue.
46
46
 
47
- ## The six modes
47
+ ## The seven modes
48
48
 
49
49
  Each mode has a decision row: when to use, when not, and the expected
50
50
  model pairing. Defaults come from
@@ -60,7 +60,34 @@ back to the user.
60
60
  |---|---|---|
61
61
  | Single-change task with non-trivial risk | Tiny fix, or spike/exploration | implementer = session; judge = one tier up |
62
62
 
63
- ### 2. do-in-steps
63
+ ### 2. do-and-judge-two-stage
64
+
65
+ Implementer produces a diff; **two judges run sequentially** — first a
66
+ spec-compliance reviewer (does the diff satisfy the stated spec /
67
+ acceptance criteria?), then a code-quality reviewer (is the diff well-
68
+ written for the codebase it lands in?). The orchestrator only proceeds
69
+ to stage two if stage one returns `DONE` or `DONE_WITH_CONCERNS`. A
70
+ stage-one `BLOCKED` shortcuts the loop — there is no point quality-
71
+ reviewing a diff that does not satisfy the spec.
72
+
73
+ | When to use | When not | Model pairing |
74
+ |---|---|---|
75
+ | Spec is contested or AC are detailed; diff size makes one judge prone to missing one axis (correctness vs craft) | Spec is one sentence, or the diff is one line (collapse to mode 1) | implementer = session; spec-judge = one tier up; quality-judge = same tier as spec-judge, fresh context |
76
+
77
+ **Why two stages, not one judge with both rubrics:** combining the
78
+ rubrics in one prompt reliably regresses one of them — the judge "spends
79
+ attention" on whichever rubric appears last. Splitting the prompts
80
+ forces each judge to commit fully to its rubric.
81
+
82
+ **Stage-routing rule:**
83
+ - Stage-1 returns `DONE` → run stage-2.
84
+ - Stage-1 returns `DONE_WITH_CONCERNS` → run stage-2; concerns carry
85
+ forward to the final envelope.
86
+ - Stage-1 returns `NEEDS_CONTEXT` → pause; stage-2 does not run.
87
+ - Stage-1 returns `BLOCKED` → final verdict is `BLOCKED`; stage-2
88
+ does not run (saves cost).
89
+
90
+ ### 3. do-in-steps
64
91
 
65
92
  Plan is split into N steps; judge runs **between** steps. A step that
66
93
  fails judgment is revised before the next step starts. Used for
@@ -70,7 +97,7 @@ multi-file changes where a mid-plan mistake would cascade.
70
97
  |---|---|---|
71
98
  | Multi-step plan with ordered dependencies | Single-step change, or when steps are independent (use `do-in-parallel`) | implementer = session; judge = one tier up |
72
99
 
73
- ### 3. do-in-parallel
100
+ ### 4. do-in-parallel
74
101
 
75
102
  Independent slices run concurrently. No judge per slice — judge runs
76
103
  once on the aggregated result. Parallelism capped by
@@ -80,7 +107,7 @@ once on the aggregated result. Parallelism capped by
80
107
  |---|---|---|
81
108
  | Independent slices (different files, non-overlapping) | Any slice touches shared state | implementer = session; judge = one tier up, run once |
82
109
 
83
- ### 4. do-competitively
110
+ ### 5. do-competitively
84
111
 
85
112
  Multiple implementers produce candidate diffs for the **same** slice.
86
113
  Judge picks the winner and rejects the losers. Expensive — use only
@@ -90,7 +117,7 @@ when the solution space is genuinely broad.
90
117
  |---|---|---|
91
118
  | Broad solution space (algorithm choice, API shape) | Well-defined problem with one good answer | implementers = same tier (≥2 instances); judge = one tier up |
92
119
 
93
- ### 5. judge-with-debate
120
+ ### 6. judge-with-debate
94
121
 
95
122
  Two judges each produce a verdict; a meta-judge reconciles
96
123
  disagreements. Used for high-stakes changes (security, data
@@ -100,7 +127,7 @@ migration, public API) where a single judge is too easy to fool.
100
127
  |---|---|---|
101
128
  | Security, data integrity, public API change | Routine internal refactor | judges = same tier (2x); meta-judge = one tier up |
102
129
 
103
- ### 6. do-in-worktrees
130
+ ### 7. do-in-worktrees
104
131
 
105
132
  Cross-wing or cross-skill chain executed across isolated git
106
133
  worktrees — each handoff in the chain runs in its own worktree, so
@@ -130,7 +157,44 @@ end produces a single integration PR.
130
157
  **Anti-pattern:** do not use for fast iteration loops where each
131
158
  step is under ~30 minutes. The branch-creation, context-switch, and
132
159
  worktree-cleanup cost dominates. Stick with mode 1 (do-and-judge)
133
- or mode 2 (do-in-steps) for those.
160
+ or mode 3 (do-in-steps) for those.
161
+
162
+ ## Status taxonomy — every subagent return uses one envelope
163
+
164
+ Every implementer or judge return must conform to
165
+ [`schemas/subagent-status.json`](schemas/subagent-status.json). Four
166
+ statuses, no free-form alternatives:
167
+
168
+ | Status | Meaning | Required keys (beyond `status`, `summary`) |
169
+ |---|---|---|
170
+ | `DONE` | Work shipped, all gates green. | `evidence[]` |
171
+ | `DONE_WITH_CONCERNS` | Work shipped but caller must act on concerns. | `evidence[]`, `concerns[]` |
172
+ | `NEEDS_CONTEXT` | Paused; caller can unblock by answering. | `blocking_question` |
173
+ | `BLOCKED` | No path forward exists. | `blocking_reason` |
174
+
175
+ **Why a fixed taxonomy:** orchestrators (`/do-and-judge`, `/do-in-steps`)
176
+ route on status. Free-form "kind of done" returns force the orchestrator
177
+ to interpret prose, which silently regresses the two-revision ceiling and
178
+ the judge-rejected-do-not-apply rule. The schema makes routing mechanical.
179
+
180
+ **Tests:** `tests/test_subagent_status_schema.py` exercises all four
181
+ statuses plus rejection cases (missing required keys, unknown status,
182
+ extra fields, conditional-key violations).
183
+
184
+ **Distinguishing `NEEDS_CONTEXT` from `BLOCKED`:** `NEEDS_CONTEXT` means
185
+ *"you, the caller, can fix this by telling me X"*. `BLOCKED` means
186
+ *"no input from you unblocks this — escalate or rescope"*. If a subagent
187
+ is unsure, it picks `BLOCKED` and the caller can downgrade.
188
+
189
+ ## Dispatch prompts — externalized
190
+
191
+ Each mode's literal dispatch template lives under
192
+ [`prompts/{mode}.md`](prompts/README.md). The orchestrator loads the
193
+ matching prompt at dispatch time and substitutes `{{placeholders}}`.
194
+ Edits to a prompt do not bloat this skill against the 400-line sunset
195
+ trigger; `tests/test_subagent_prompt_loading.py` confirms each of the
196
+ seven modes resolves to a loadable prompt that cites all four taxonomy
197
+ statuses.
134
198
 
135
199
  ## Procedure
136
200
 
@@ -158,9 +222,10 @@ same context, **stop** and report. Do not improvise.
158
222
 
159
223
  ### 3. Pick the mode
160
224
 
161
- Match task shape to one of the five modes. When two modes could fit,
162
- prefer the cheaper one (`do-and-judge` < `do-in-steps` < `do-in-parallel`
163
- < `do-competitively` < `judge-with-debate`).
225
+ Match task shape to one of the seven modes. When two modes could fit,
226
+ prefer the cheaper one (`do-and-judge` < `do-and-judge-two-stage` <
227
+ `do-in-steps` < `do-in-parallel` < `do-competitively` <
228
+ `judge-with-debate` < `do-in-worktrees`).
164
229
 
165
230
  ### 4. Dispatch
166
231
 
@@ -195,7 +260,7 @@ the judge verdict.
195
260
 
196
261
  ## Output format
197
262
 
198
- 1. **Mode chosen** — one of the five, with the one-line reason
263
+ 1. **Mode chosen** — one of the seven, with the one-line reason
199
264
  2. **Model pairing** — implementer model / judge model (resolved)
200
265
  3. **Verdict** — applied / revised / handed back
201
266
  4. **Evidence** — diff summary, test output, or judge transcript
@@ -0,0 +1,29 @@
1
+ # Subagent dispatch prompts
2
+
3
+ One file per mode in [`SKILL.md`](../SKILL.md) § *The seven modes*. Each
4
+ prompt is the **literal template** the orchestrator hands to the
5
+ subagent on dispatch — externalized so prompt edits do not bloat the
6
+ skill above the 400-line sunset trigger.
7
+
8
+ | Mode | File |
9
+ |---|---|
10
+ | do-and-judge | [`do-and-judge.md`](do-and-judge.md) |
11
+ | do-and-judge-two-stage | [`do-and-judge-two-stage.md`](do-and-judge-two-stage.md) |
12
+ | do-in-steps | [`do-in-steps.md`](do-in-steps.md) |
13
+ | do-in-parallel | [`do-in-parallel.md`](do-in-parallel.md) |
14
+ | do-competitively | [`do-competitively.md`](do-competitively.md) |
15
+ | judge-with-debate | [`judge-with-debate.md`](judge-with-debate.md) |
16
+ | do-in-worktrees | [`do-in-worktrees.md`](do-in-worktrees.md) |
17
+
18
+ ## Contract
19
+
20
+ Every prompt cites the status taxonomy in
21
+ [`../schemas/subagent-status.json`](../schemas/subagent-status.json) and
22
+ ends with the **return-envelope** instruction so the subagent's reply
23
+ validates against `tests/test_subagent_status_schema.py`.
24
+
25
+ ## Loading
26
+
27
+ `tests/test_subagent_prompt_loading.py` asserts that every mode named
28
+ in `SKILL.md` § *The seven modes* has a loadable prompt file under this
29
+ directory and that each prompt mentions all four status enum values.
@@ -0,0 +1,121 @@
1
+ # Prompt — do-and-judge-two-stage
2
+
3
+ Mode reference: [`../SKILL.md`](../SKILL.md) § *2. do-and-judge-two-stage*.
4
+
5
+ ## Implementer prompt
6
+
7
+ ```
8
+ You are the implementer in a do-and-judge-two-stage loop. Two judges
9
+ will review your diff in sequence: first SPEC COMPLIANCE, then CODE
10
+ QUALITY. Spec failure shortcuts the loop — quality is not reviewed if
11
+ spec is wrong.
12
+
13
+ TASK: {{task_description}}
14
+ ACCEPTANCE CRITERIA: {{acceptance_criteria}}
15
+ CONTEXT FILES: {{file_paths}}
16
+
17
+ CONSTRAINTS:
18
+ - Hit every AC literally; do not "interpret" them away.
19
+ - Do not silently expand scope; AC are the contract.
20
+ - Write tests that map 1:1 to the AC so the spec-judge can verify.
21
+
22
+ ON COMPLETION, return ONE envelope per schemas/subagent-status.json:
23
+ - DONE — every AC satisfied, tests pass; evidence[]
24
+ maps each AC to the test that exercises it.
25
+ - DONE_WITH_CONCERNS — every AC satisfied but a trade-off needs
26
+ flagging in concerns[].
27
+ - NEEDS_CONTEXT — an AC is ambiguous; blocking_question must
28
+ name the AC and the interpretation gap.
29
+ - BLOCKED — an AC cannot be satisfied as stated;
30
+ blocking_reason explains why.
31
+ ```
32
+
33
+ ## Stage-1 prompt — SPEC COMPLIANCE judge
34
+
35
+ ```
36
+ You are the SPEC COMPLIANCE judge. Stage 1 of two. Your ONLY job is:
37
+ "does the diff satisfy every acceptance criterion as stated?" Do NOT
38
+ review style, naming, or craft — that is stage 2's job.
39
+
40
+ ACCEPTANCE CRITERIA: {{acceptance_criteria}}
41
+ DIFF: {{diff}}
42
+ TEST OUTPUT: {{test_output}}
43
+ IMPLEMENTER ENVELOPE: {{envelope}}
44
+
45
+ PER-AC SCAN — for each AC, return:
46
+ - SATISFIED — cite the diff hunk + test that proves it.
47
+ - PARTIAL — cite what is missing and why it falls short.
48
+ - MISSING — AC has no corresponding implementation.
49
+
50
+ VERDICT (one envelope, schemas/subagent-status.json):
51
+ - DONE — every AC SATISFIED; evidence[] is the per-AC
52
+ scan above.
53
+ - DONE_WITH_CONCERNS — every AC SATISFIED but a stretch
54
+ interpretation needs flagging (rare at this
55
+ stage).
56
+ - NEEDS_CONTEXT — an AC is ambiguous AND the implementer's
57
+ interpretation is plausible; orchestrator
58
+ must clarify.
59
+ - BLOCKED — one or more AC PARTIAL or MISSING. Stage 2
60
+ will NOT run; implementer revises first.
61
+
62
+ NEVER comment on naming, structure, or style. Stay in your lane —
63
+ that is the value of the two-stage split.
64
+ ```
65
+
66
+ ## Stage-2 prompt — CODE QUALITY judge (only if stage 1 passes)
67
+
68
+ ```
69
+ You are the CODE QUALITY judge. Stage 2 of two. Stage 1 already
70
+ confirmed the diff satisfies the spec. Your ONLY job is craft: is
71
+ the diff well-written for THIS codebase?
72
+
73
+ DIFF: {{diff}}
74
+ NEIGHBORING FILES: {{neighboring_files}}
75
+ PROJECT CONVENTIONS: {{conventions_summary}}
76
+ STAGE-1 CONCERNS (carry-forward): {{stage_1_concerns}}
77
+
78
+ QUALITY DIMENSIONS — cite each in evidence[]:
79
+ 1. Naming consistency with neighbors.
80
+ 2. Structure / responsibility boundary.
81
+ 3. Error handling matches project style.
82
+ 4. Test shape matches project conventions (Pest / pytest / etc.).
83
+ 5. Diff size — could the same intent ship smaller?
84
+
85
+ VERDICT (one envelope, schemas/subagent-status.json):
86
+ - DONE — quality is on par with the codebase;
87
+ evidence[] cites the five dimensions.
88
+ - DONE_WITH_CONCERNS — apply the diff, but concerns[] lists the
89
+ craft issues caller must address (carry
90
+ forward stage-1 concerns too).
91
+ - NEEDS_CONTEXT — convention is unclear; orchestrator must
92
+ name the canonical pattern.
93
+ - BLOCKED — diff is correct per stage 1 but quality is
94
+ unacceptable; implementer must revise.
95
+
96
+ NEVER re-litigate the spec. Stage 1 already settled correctness —
97
+ your job is craft.
98
+ ```
99
+
100
+ ## Stage routing — orchestrator logic
101
+
102
+ Stage-1 status determines whether stage 2 runs:
103
+
104
+ | Stage-1 status | Run stage 2? | Final envelope |
105
+ |---|---|---|
106
+ | `DONE` | Yes | Stage-2 envelope |
107
+ | `DONE_WITH_CONCERNS` | Yes | Stage-2 envelope; merge concerns[] from both |
108
+ | `NEEDS_CONTEXT` | No | Stage-1 envelope; pause |
109
+ | `BLOCKED` | No | Stage-1 envelope; implementer revises |
110
+
111
+ The orchestrator never collapses both stages into one prompt — that
112
+ defeats the purpose of the split (see SKILL.md § "Why two stages, not
113
+ one judge with both rubrics").
114
+
115
+ ## Cost-discipline rule
116
+
117
+ Two-stage = up to **3 subagent calls** per cycle (implementer + two
118
+ judges) versus 2 for plain `do-and-judge`. Use only when AC are
119
+ detailed enough that a single judge would predictably miss one of
120
+ correctness or craft. For one-line fixes or single-AC tasks, mode 1
121
+ (`do-and-judge`) is the right answer.
@@ -0,0 +1,60 @@
1
+ # Prompt — do-and-judge
2
+
3
+ Mode reference: [`../SKILL.md`](../SKILL.md) § *1. do-and-judge*.
4
+
5
+ ## Implementer prompt
6
+
7
+ ```
8
+ You are the implementer in a do-and-judge loop. Hard ceiling: two
9
+ revision cycles before hand-back to the user.
10
+
11
+ TASK: {{task_description}}
12
+
13
+ CONTEXT FILES: {{file_paths}}
14
+
15
+ CONSTRAINTS:
16
+ - Do not modify files outside the cited paths without surfacing why.
17
+ - Do not skip tests; if the task does not include a test, write one.
18
+ - Prefer the smallest diff that satisfies the task.
19
+
20
+ ON COMPLETION, return ONE envelope conforming to
21
+ schemas/subagent-status.json. Pick exactly one status:
22
+ - DONE — work shipped, all gates green; include evidence[].
23
+ - DONE_WITH_CONCERNS — shipped but caller must read concerns[];
24
+ include evidence[] AND concerns[].
25
+ - NEEDS_CONTEXT — paused; the orchestrator can unblock by
26
+ answering blocking_question.
27
+ - BLOCKED — no path forward; include blocking_reason.
28
+
29
+ NEVER invent a fifth status. Free-form "kind of done" prose is rejected
30
+ by the schema validator.
31
+ ```
32
+
33
+ ## Judge prompt
34
+
35
+ ```
36
+ You are the judge reviewing the implementer's diff. The implementer
37
+ returned the envelope below. Validate against the task and constraints.
38
+
39
+ TASK: {{task_description}}
40
+ DIFF: {{diff}}
41
+ IMPLEMENTER ENVELOPE: {{envelope}}
42
+
43
+ VERDICT (return ONE envelope per schemas/subagent-status.json):
44
+ - DONE — apply this diff; cite evidence in evidence[].
45
+ - DONE_WITH_CONCERNS — apply but caller must address concerns[].
46
+ - NEEDS_CONTEXT — orchestrator must clarify blocking_question
47
+ before re-dispatching the implementer.
48
+ - BLOCKED — diff is wrong; explain in blocking_reason.
49
+ Do NOT silently rewrite — that is the
50
+ implementer's job on the revision pass.
51
+
52
+ NEVER apply a diff you would have written differently if your concerns
53
+ were not addressed. Use DONE_WITH_CONCERNS for that case.
54
+ ```
55
+
56
+ ## Revision-loop rule
57
+
58
+ After two revision cycles, the orchestrator stops and hands back to the
59
+ user with the most recent envelope. The judge does not become the
60
+ implementer.
@@ -0,0 +1,65 @@
1
+ # Prompt — do-competitively
2
+
3
+ Mode reference: [`../SKILL.md`](../SKILL.md) § *4. do-competitively*.
4
+
5
+ ## Implementer prompt (per candidate)
6
+
7
+ ```
8
+ You are CANDIDATE {{candidate_id}} of {{n_candidates}} competing on the
9
+ SAME slice. Other implementers are solving the identical problem in
10
+ parallel; the judge will pick exactly one winner.
11
+
12
+ TASK: {{task_description}}
13
+ CONTEXT FILES: {{file_paths}}
14
+
15
+ CONSTRAINTS:
16
+ - Do NOT optimize for "what the judge wants to see" — solve the task.
17
+ - Do NOT copy from other candidates; you do not have access to them.
18
+ - Make a real choice: name the algorithm, the API shape, the trade-off.
19
+ Generic safe answers lose to specific decisive ones.
20
+
21
+ ON COMPLETION, return ONE envelope per schemas/subagent-status.json:
22
+ - DONE — your candidate is complete and tests pass;
23
+ evidence[] cites the test output.
24
+ - DONE_WITH_CONCERNS — complete but flag the trade-off you made so
25
+ the judge can score it.
26
+ - NEEDS_CONTEXT — task ambiguity blocks all candidates; if so,
27
+ all candidates should converge on the same
28
+ blocking_question.
29
+ - BLOCKED — task is malformed; explain in blocking_reason.
30
+ ```
31
+
32
+ ## Judge prompt (winner selection)
33
+
34
+ ```
35
+ You are the judge picking ONE winner from {{n_candidates}} competing
36
+ diffs for the SAME slice. Losers are rejected, not merged.
37
+
38
+ CANDIDATE ENVELOPES: {{envelopes_array}}
39
+ CANDIDATE DIFFS: {{diffs_array}}
40
+ TASK: {{task_description}}
41
+
42
+ SCORING DIMENSIONS (cite each in evidence[]):
43
+ 1. Correctness — does it pass tests AND solve the task?
44
+ 2. Trade-off clarity — is the choice named and defended?
45
+ 3. Maintenance cost — what does the codebase look like in 6 months?
46
+ 4. Diff size — smaller wins ties.
47
+
48
+ VERDICT (one envelope, schemas/subagent-status.json):
49
+ - DONE — winner picked; evidence[] cites the four
50
+ scoring dimensions and names the winner.
51
+ - DONE_WITH_CONCERNS — winner picked but the chosen trade-off has
52
+ carry-over costs (concerns[]).
53
+ - NEEDS_CONTEXT — all candidates need the same clarification.
54
+ - BLOCKED — no candidate is acceptable; rerun with new
55
+ implementers or change the task.
56
+
57
+ NEVER pick a winner because it was the cheapest model. NEVER merge
58
+ two candidates — that is do-in-parallel, not do-competitively.
59
+ ```
60
+
61
+ ## Cost-discipline rule
62
+
63
+ `do-competitively` is N+1 subagent calls per slice. The orchestrator
64
+ confirms budget with the user before dispatch. The losing diffs are
65
+ discarded — that cost is the price of the trade-off survey.