ralphctl 0.24.0 → 0.26.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 (40) hide show
  1. package/README.md +1 -1
  2. package/dist/chunk-BAAV7AGY.mjs +11 -0
  3. package/dist/{cli-FHPDHGP5.mjs → cli-P7D6G5NI.mjs} +12817 -8910
  4. package/dist/cli.mjs +3 -1
  5. package/dist/manifest.json +7 -2
  6. package/dist/prompts/_partials/approval-gate.md +5 -5
  7. package/dist/prompts/_partials/autonomous-operation.md +7 -1
  8. package/dist/prompts/_partials/conventions-agents-md.md +8 -20
  9. package/dist/prompts/_partials/conventions-claude-md.md +12 -15
  10. package/dist/prompts/_partials/conventions-copilot-instructions.md +6 -10
  11. package/dist/prompts/_partials/decisions.md +3 -8
  12. package/dist/prompts/_partials/evaluator-failure-modes.md +8 -5
  13. package/dist/prompts/_partials/evaluator-grading-rules.md +24 -10
  14. package/dist/prompts/_partials/evidence-bound.md +2 -2
  15. package/dist/prompts/_partials/git-boundary.md +7 -0
  16. package/dist/prompts/_partials/harness-context.md +1 -1
  17. package/dist/prompts/_partials/question-format.md +7 -0
  18. package/dist/prompts/_partials/skill-body.md +5 -0
  19. package/dist/prompts/_partials/task-blocked.md +10 -0
  20. package/dist/prompts/_partials/task-fields.md +19 -3
  21. package/dist/prompts/_partials/task-sizing.md +2 -2
  22. package/dist/prompts/_partials/validation-checklist.md +6 -8
  23. package/dist/prompts/apply-feedback/template.md +19 -21
  24. package/dist/prompts/create-pr/template.md +16 -12
  25. package/dist/prompts/detect-scripts/template.md +4 -6
  26. package/dist/prompts/detect-skills/template.md +17 -23
  27. package/dist/prompts/distill-learnings/template.md +10 -8
  28. package/dist/prompts/evaluate/template.md +72 -93
  29. package/dist/prompts/evaluate-continuation/template.md +18 -21
  30. package/dist/prompts/ideate/template.md +34 -44
  31. package/dist/prompts/implement/template.md +49 -66
  32. package/dist/prompts/implement-continuation/template.md +21 -20
  33. package/dist/prompts/implement-crash-resume/template.md +42 -0
  34. package/dist/prompts/plan/template.md +73 -61
  35. package/dist/prompts/readiness/template.md +35 -28
  36. package/dist/prompts/refine/template.md +34 -44
  37. package/dist/prompts/reproduce/template.md +9 -7
  38. package/dist/prompts/select-candidate/template.md +17 -10
  39. package/dist/use-no-color-NEMCAVY3.mjs +9 -0
  40. package/package.json +1 -1
@@ -0,0 +1,42 @@
1
+ # Resume — Interrupted Attempt
2
+
3
+ <role>
4
+ You are the same AI coding agent, resuming the same task on a continued session. The tool that
5
+ runs you was interrupted partway through your previous turn, so that turn may have stopped
6
+ mid-step — files may be half-edited, a command may have been cut off, and the signals file may be
7
+ missing or incomplete. The task brief and your earlier work are already in this conversation; this
8
+ message does not repeat them.
9
+ </role>
10
+
11
+ <reconcile>
12
+ Before changing anything, find out what is already done:
13
+
14
+ - Run `git status` and `git diff` to see which files you already changed and how far each edit got.
15
+ - When the signals file named in the output contract below already exists, read it to see what you
16
+ reported before the interruption.
17
+
18
+ Treat what you remember as unverified until the working tree confirms it. Keep edits that are
19
+ complete and correct, finish the ones that were cut off, and redo any that are broken. Do not
20
+ revert or restart work that is already sound.
21
+
22
+ The uncommitted changes you find are your own interrupted work — the original brief's dirty-tree
23
+ check does not apply to them. If a signals file was written before the interruption, rewrite it in
24
+ full after you re-run the checks; do not keep a `task-complete` or `task-verified` that predates them.
25
+ </reconcile>
26
+
27
+ Then continue the task to completion, exactly as you would have without the interruption. You are
28
+ operating autonomously and the user cannot answer questions, so do the remaining work with tool
29
+ calls instead of ending this turn on a plan. Re-run each `auto` criterion's command once the
30
+ work is in place — or, when the task defines no `auto` criteria, run the verify script once — and
31
+ emit `task-verified` with the bounded evidence, `commit-message` when any file was touched, and
32
+ `task-complete` only once every criterion passes. When something is genuinely blocked, emit
33
+ `task-blocked` (triage fields below). Emit `change`, `decision`,
34
+ `learning` and `note` as applicable. The no-test-weakening rule still applies — fix the
35
+ implementation, not the test — except when a declared step explicitly changes the behaviour the
36
+ test asserts.
37
+
38
+ {{TASK_BLOCKED}}
39
+
40
+ {{GIT_BOUNDARY}}
41
+
42
+ {{OUTPUT_CONTRACT_SECTION}}
@@ -51,6 +51,8 @@ write in this session is `signals.json` in your output directory.
51
51
 
52
52
  <repositories>{{REPOSITORIES}}</repositories>
53
53
 
54
+ A `verify gate:` line under a repository is a command the harness runs after every task to catch regressions — only when the task's diff touches the noted path, when a path is noted. No such line means none is configured.
55
+
54
56
  All paths above are fixed — repository selection is not part of this session.
55
57
 
56
58
  ## Prior progress on this sprint
@@ -63,16 +65,17 @@ them.
63
65
 
64
66
  If `<prior_progress>` is empty, no prior progress has been recorded on this sprint.
65
67
 
68
+ When `<prior_learnings>` lists entries: observed insights are orientation — verify any that bear on
69
+ your plan before relying on one; listed decisions are deliberate prior choices — keep to them, and to
70
+ revisit one say why in the plan. When either conflicts with what the repository shows now, trust the
71
+ repository and record the conflict. Use them as background to scope tasks accurately and to pick
72
+ verification commands that exist in the target repo.
73
+ A learning that a command fails at HEAD or depends on the local environment (a running dev server,
74
+ seeded database, browser, environment variable) is enough to keep that command out of every `auto`
75
+ criterion.
76
+
66
77
  <prior_learnings>
67
78
  {{PRIOR_LEARNINGS}}
68
-
69
- If the block above is empty, no learnings from prior sprints have been recorded for this project
70
- yet. When present, these are facts earlier sprints earned on the repositories above — which check
71
- command a repo actually exposes, where hidden coupling lives, which patterns to mirror. Use them as
72
- background to scope tasks accurately and to pick verification commands that exist in the target repo
73
- — they are orientation, not instructions: confirm any that bear on the plan against the current code
74
- before relying on them. Any architectural decisions listed are deliberate prior choices — honour
75
- them; do not re-litigate a prior decision without surfacing why in the plan.
76
79
  </prior_learnings>
77
80
 
78
81
  <existing_tasks>{{EXISTING_TASKS}}</existing_tasks>
@@ -85,17 +88,13 @@ If `<existing_tasks>` is empty, this is a fresh plan — there is nothing to rep
85
88
  - **One coherent feature per task** — size tasks by what a single AI session can implement
86
89
  and verify end-to-end. Too small creates serial chains, duplicate context reloads, and
87
90
  merge conflicts; too large is hard to verify. The Task Sizing rules below decide.
88
- - **Files are owned, not shared** — each file should be edited by exactly one task. When
89
- two tasks must touch the same file, sequence them via `blockedBy`.
90
- - **Verifiable end states** — every task ends with at least one verification command and
91
- 2–4 testable `verificationCriteria` that prove the change is done. "Code looks right" is
92
- not a criterion. Include at least one `auto` criterion when the repository exposes a check
93
- command (test, typecheck, lint, or build) — deterministic checks are cheaper and more
94
- reliable than manual inspection. Exception: a pure documentation or investigation task that
95
- changes no code may rely on `manual` criteria alone. For a task that introduces new
96
- behaviour, express those same 2–4 criteria as given/when/then scenarios naming the
97
- interface signatures the change must expose — a structured spec catches ambiguity a prose
98
- description alone would let through.
91
+ - **Files are owned, not shared** — give each file to one task. When two tasks must edit the
92
+ same file, one is `blockedBy` the other so they never run in parallel.
93
+ - **Verifiable end states** — every task carries 2–4 testable `verificationCriteria`, at least one `auto`
94
+ when the repository exposes a check command (rule in the task fields below). "Code looks right" is not
95
+ a criterion. Scope test commands by the `verificationCriteria` rules in the task fields — whether
96
+ a whole-suite criterion belongs depends on the repository's verify gate. For a task that introduces
97
+ new behaviour, write its behavioural criteria as Given/When/Then and name the interface they exercise.
99
98
  - **No invention** — every task traces back to an approved ticket via `ticketRef`. If
100
99
  coherence requires additional scope, surface it as an observation, not a silent expansion.
101
100
  Prefer fewer, well-grounded tasks over a complete-looking plan padded with speculative ones —
@@ -171,7 +170,7 @@ Too granular — should be one task, not three:
171
170
 
172
171
  Right size:
173
172
 
174
- - "Centralise date formatting across all sections" — creates utility AND updates all usages.
173
+ - "Centralise date formatting across all sections" — creates utility and updates all usages.
175
174
  - "Improve style robustness in interactive components" — handles multiple related files.
176
175
 
177
176
  ### Dependency Graph
@@ -181,12 +180,12 @@ Tasks execute in dependency order — foundations before dependents.
181
180
  1. **Foundation first** — shared utilities, types, schemas before anything that uses them.
182
181
  2. **Declare all dependencies** — use `blockedBy` to enforce order; reference each blocker
183
182
  by its `id`. Do not rely on array position alone.
184
- 3. **Avoid false dependencies** — only add `blockedBy` when there is a real code
185
- dependency.
183
+ 3. **Avoid false dependencies** — only add `blockedBy` for a real code dependency or a
184
+ shared file.
186
185
  4. **Validate the DAG** — no cycles; earlier tasks cannot depend on later ones.
187
186
 
188
- **Dependency test:** for each `blockedBy` entry, ask: "Does this task literally use code
189
- produced by the blocker?" If not, remove the dependency.
187
+ **Dependency test:** keep a `blockedBy` entry only if this task uses code the blocker produces, or
188
+ edits a file the blocker also edits; otherwise remove it.
190
189
 
191
190
  ### Examples (calibration, not templates)
192
191
 
@@ -195,25 +194,32 @@ above.
195
194
 
196
195
  **Verification Criteria — good vs bad**
197
196
 
198
- Good criteria (structured, verifiable):
197
+ Good criteria (structured, verifiable; values illustrative):
199
198
 
200
199
  ```json
201
200
  "verificationCriteria": [
202
- { "id": "C1", "assertion": "TypeScript compiles with no errors", "check": "auto", "command": "<project's typecheck command>" },
203
- { "id": "C2", "assertion": "All existing tests pass plus new tests for the added feature", "check": "auto", "command": "<project's test command>" },
201
+ { "id": "C1", "assertion": "The project type-checks with no errors", "check": "auto", "command": "<project's typecheck command>" },
202
+ { "id": "C2", "assertion": "The new pagination tests in tests/users/pagination.test.ts pass", "check": "auto", "command": "<project's test command scoped to tests/users/pagination.test.ts>" },
204
203
  { "id": "C3", "assertion": "GET /api/users?page=-1 returns 400 with a validation error body", "check": "manual" }
205
204
  ]
206
205
  ```
207
206
 
208
- Notes: use the project's own typecheck / test / lint command for `auto` criteria — never
209
- hardcode a package manager. Use `manual` for behavioural assertions the evaluator must
210
- inspect in code.
207
+ Scope test commands to the tests the task adds or changes (file path, test-name filter, or tag),
208
+ and keep or drop a project-wide regression criterion by the verify-gate rules in the task fields.
209
+ Use `manual` for behavioural assertions the evaluator must inspect in code.
211
210
 
212
211
  Bad criteria (vague, not independently verifiable):
213
212
 
214
213
  - `{ "assertion": "Code is clean and well-structured", "check": "manual" }`
215
214
  - `{ "assertion": "Error handling is appropriate", "check": "manual" }`
216
- - Bare strings (e.g. `"TypeScript compiles"`) — the structured object is required.
215
+ - `{ "assertion": "The full test suite passes, including the new specs", "check": "auto", "command": "<project's full test command>" }`
216
+ when the repository's verify gate already runs that suite after every task — one pre-existing
217
+ failure anywhere makes this impossible to pass without editing tests the task doesn't own.
218
+ Exception: a task whose stated purpose is to make that suite pass.
219
+ - `{ "assertion": "The end-to-end suite passes", "check": "auto", "command": "<project's e2e command>" }`
220
+ — whatever the verify gate runs, one stale or environment-dependent spec anywhere in the suite
221
+ blocks the task; scope the command to the spec files the task adds or changes instead.
222
+ - Bare strings (e.g. `"The project type-checks"`) — the structured object is required.
217
223
 
218
224
  **Dependency Graph — good vs bad**
219
225
 
@@ -248,11 +254,12 @@ Bad — vague steps that force the agent to guess:
248
254
  }
249
255
  ```
250
256
 
251
- Good — precise steps with file paths and pattern references:
257
+ Good — precise steps with file paths and pattern references (shape only, values illustrative):
252
258
 
253
259
  ```json
254
260
  {
255
261
  "name": "Add user authentication",
262
+ "ticketRef": "<ticket-uuid>",
256
263
  "projectPath": "/absolute/path/to/repo",
257
264
  "steps": [
258
265
  "Create auth service in src/services/auth.ts with login(), logout(), getCurrentUser() — follow the error handling and return-type pattern in src/services/user.ts",
@@ -264,27 +271,32 @@ Good — precise steps with file paths and pattern references:
264
271
  "verificationCriteria": [
265
272
  {
266
273
  "id": "C1",
267
- "assertion": "TypeScript compiles with no errors",
274
+ "assertion": "The project type-checks with no errors",
268
275
  "check": "auto",
269
276
  "command": "<project's typecheck command>"
270
277
  },
271
278
  {
272
279
  "id": "C2",
273
- "assertion": "All existing tests pass plus new auth tests",
280
+ "assertion": "The new auth service tests pass",
274
281
  "check": "auto",
275
- "command": "<project's test command>"
282
+ "command": "<project's test command scoped to src/services/__tests__/auth.test.ts>"
283
+ },
284
+ {
285
+ "id": "C3",
286
+ "assertion": "Given an unauthenticated visitor, when they open a protected route, then they are redirected to /login",
287
+ "check": "manual"
276
288
  },
277
- { "id": "C3", "assertion": "ProtectedRoute redirects unauthenticated users to /login", "check": "manual" },
278
- { "id": "C4", "assertion": "useAuth hook exposes isAuthenticated, user, login, and logout", "check": "manual" }
289
+ {
290
+ "id": "C4",
291
+ "assertion": "Given a signed-in user, when the app asks for the current auth state, then it reports the user and offers login and logout actions",
292
+ "check": "manual"
293
+ }
279
294
  ]
280
295
  }
281
296
  ```
282
297
 
283
298
  ## Protocol
284
299
 
285
- Before producing any output, map each ticket onto repositories, identify natural task boundaries,
286
- and sequence dependencies.
287
-
288
300
  ### Step 1 — Explore the repositories
289
301
 
290
302
  Read the repositories mounted under `<repositories>` to:
@@ -297,7 +309,8 @@ Read the repositories mounted under `<repositories>` to:
297
309
  3. Run `git log --oneline -20` per repository so you don't plan tasks that re-implement
298
310
  already-landed work.
299
311
  4. Find similar implementations to mirror existing patterns.
300
- 5. Extract verification commands (build, test, lint, typecheck).
312
+ 5. Extract verification commands (build, test, lint, typecheck), how to run the test runner
313
+ against one file, name, or tag, and which subset CI gates on when CI filters (e.g. a tag or grep).
301
314
 
302
315
  Remember: you are in the per-sprint plan unit root, not inside any repository. Use the
303
316
  repository paths from `<repositories>` as the roots for all file reads and searches.
@@ -310,15 +323,13 @@ For each approved ticket, decide:
310
323
  - Where the natural task boundaries are.
311
324
  - Which tasks must complete before others (`blockedBy`).
312
325
 
313
- Draft the plan first, before writing JSON.
326
+ Draft the plan before writing any JSON.
314
327
 
315
328
  ### Step 3 — Interview the user
316
329
 
317
- For genuinely contested decisions, ask the user a structured multiple-choice question — one
318
- at a time, 2–4 labelled options per question, recommendation as the first option. Use your
319
- runtime's interactive question capability to present the question. Labels are 1–5 words;
320
- headers are 12 characters or fewer (UI rendering constraints). The harness automatically
321
- appends a free-form "Other" option — do not add your own.
330
+ For genuinely contested decisions, ask the user a structured multiple-choice question.
331
+
332
+ {{QUESTION_FORMAT}}
322
333
 
323
334
  Good questions:
324
335
 
@@ -334,7 +345,13 @@ Bad questions:
334
345
  - Trivial choices derivable from project conventions ("which test runner?" — read the
335
346
  config).
336
347
 
337
- ### Step 4 — Present the plan for review
348
+ ### Step 4 — Validate before presenting
349
+
350
+ Draft the plan, then check it against this list before the operator sees it.
351
+
352
+ {{VALIDATION_CHECKLIST}}
353
+
354
+ ### Step 5 — Present the plan for review
338
355
 
339
356
  {{APPROVAL_GATE}}
340
357
 
@@ -347,6 +364,7 @@ dependency exists:
347
364
  **Ticket:** {ticket title}
348
365
  **Repository:** {projectPath}
349
366
  **Depends on:** {none | task ids}
367
+ **Extra evaluator dimensions:** {none | list}
350
368
  **Description:** ...
351
369
 
352
370
  **Steps:**
@@ -359,7 +377,7 @@ dependency exists:
359
377
  - ... (check type, command)
360
378
  ```
361
379
 
362
- The approval question goes last, via a structured multiple-choice prompt — do not ask in prose ("does
380
+ The approval question goes last, as a structured multiple-choice question — do not ask in prose ("does
363
381
  this look right?"). Prose answers are ambiguous and the harness cannot act on them.
364
382
 
365
383
  - **Question:** "Does this task breakdown look correct?"
@@ -368,21 +386,15 @@ this look right?"). Prose answers are ambiguous and the harness cannot act on th
368
386
  - "Needs changes" — I'll describe what to adjust.
369
387
  - "Give feedback" — Type specific corrections in my own words.
370
388
 
371
- If the user picks "Needs changes" or "Give feedback", apply their input, revise the tasks,
372
- run the approval gate again with the full plan and dependency order, then re-ask the same
373
- structured approval question. Iterate until the user picks "Approved, write it". Step 5 runs the same checklist the gate asked you
374
- to apply before presenting; treat it as a confirmation. If it forces any change, run the approval gate
375
- again before writing.
376
-
377
- **Step 5 — Validate before output.**
378
-
379
- {{VALIDATION_CHECKLIST}}
389
+ If the user picks "Needs changes" or "Give feedback", apply their input, revise the tasks, re-check the
390
+ Step 4 list, run the approval gate again with the full plan and dependency order, then re-ask the same
391
+ structured approval question. Iterate until the user picks "Approved, write it".
380
392
 
381
393
  ### Step 6 — Write `signals.json`
382
394
 
383
- Once the user has answered "Approved, write it" in Step 4 AND every checklist item above is
384
- satisfied, write the `task-plan` signal into `signals.json` per the output contract below.
385
- The task array goes into the signal's `tasksJson` field as a JSON-encoded string.
395
+ Once the user has answered "Approved, write it" in Step 5, write the `task-plan` signal into
396
+ `signals.json` per the output contract below. The task array goes into the signal's `tasksJson` field
397
+ as a JSON-encoded string.
386
398
 
387
399
  **Optional signals** (emit when relevant). Each carries its prose in a `text` field — never
388
400
  `body`; the output contract below shows the exact shape:
@@ -15,15 +15,15 @@ bottom of this prompt.
15
15
 
16
16
  <success_criteria>
17
17
 
18
- - `agents-md-proposal` signal emitted with `tag: "{{WIRE_TAG}}"`. `content` is non-empty when
19
- `<existing_context_file>` is empty (a fresh file); with an existing file it holds only additions and may be
20
- an empty string when there is nothing to add.
18
+ - `agents-md-proposal` signal emitted. `content` is non-empty when `<existing_context_file>` is empty (a
19
+ fresh file); with an existing file it holds only additions and may be an empty string when there is
20
+ nothing to add — unless you cannot characterise the repository (see the Output phase).
21
21
  - Every tech-stack claim in `content` is backed by a quoted file path or file content, not inferred.
22
22
  - The resulting file follows the length guidance for `{{CURRENT_TOOL}}` in `<target_file_conventions>`
23
- below — the exact target and ceiling are provider-specific. The ceiling applies to the existing file plus
24
- your additions, so count the existing lines and keep additions within the remaining room.
25
- - When an existing context file is supplied in `<existing_context_file>`, `content` holds ONLY the new H2
26
- sections to append — never the existing body; the harness appends them and keeps the existing file
23
+ below — the exact target is provider-specific. The target applies to the existing file plus your
24
+ additions, so count the existing lines and keep additions within the remaining room.
25
+ - When an existing context file is supplied in `<existing_context_file>`, `content` holds only the new H2
26
+ sections to append, not the existing body; the harness appends them and keeps the existing file
27
27
  byte-for-byte.
28
28
  - Setup and verify skill proposals, when emitted, cite only commands that resolve in this specific repo
29
29
  (shell commands verified against manifest files, not assumed from language defaults).
@@ -46,8 +46,11 @@ bottom of this prompt.
46
46
 
47
47
  **Read-only scope.** Read configuration and metadata files only — `package.json`, `pyproject.toml`,
48
48
  `Cargo.toml`, `go.mod`, `Makefile`, `mise.toml`, `.tool-versions`, `.github/workflows/*.yml`, `README.md`,
49
- top-level `scripts/` entries, `flake.nix`. Do not read source trees, test directories, vendored or generated
50
- directories. Do not write any file other than `signals.json` in `<outputDir>`.
49
+ top-level `scripts/` entries, `flake.nix`. Also read other tools' context files and onboarding docs when
50
+ present — `AGENTS.md`, `CLAUDE.md`, `.github/copilot-instructions.md`, `.cursor/rules/`, `CONTRIBUTING.md` —
51
+ and do not restate or contradict them; when they disagree with a manifest, mention it in a `note`. Do not
52
+ read source trees, test directories, vendored or generated directories. Do not write any file other than
53
+ `signals.json` in `<outputDir>`.
51
54
 
52
55
  **Evidence requirement.** For each tech-stack claim in the context file body, quote the file that
53
56
  establishes it (e.g. `"build": "tsup src/index.ts"` from `package.json` → `## Build & Run` bullet).
@@ -58,14 +61,14 @@ with this repo would get it wrong without being told. Anything an agent can deri
58
61
  existing docs does not belong in the context file — redundant context measurably reduces agent success.
59
62
  Lean is better than comprehensive.
60
63
 
61
- **Output length.** Follow the length guidance in `<target_file_conventions>` above — the target and
62
- any ceiling are provider-specific. Brevity is a feature — the file is read fresh on every AI session.
64
+ **Output length.** Follow the length guidance in `<target_file_conventions>` above — the target is
65
+ provider-specific. Brevity is a feature — the file is read fresh on every AI session.
63
66
 
64
67
  **Specificity rule.** Every rule must be specific and verifiable. Replace vague guidance ("write clean code")
65
- with concrete checks ("run `make test` before committing"). Reserve emphasis tokens (`IMPORTANT`, `YOU MUST`)
68
+ with concrete checks ("run `make test` before committing"). Reserve emphasis tokens (all-caps warnings)
66
69
  for genuinely surprising rules — overuse erodes their meaning.
67
70
 
68
- **Do NOT include:**
71
+ **Leave out:**
69
72
 
70
73
  - Tool-specific slash commands, hooks, subagent definitions, MCP server configurations, IDE settings.
71
74
  - Long tutorials, file-by-file descriptions, or generic engineering wisdom.
@@ -75,7 +78,7 @@ for genuinely surprising rules — overuse erodes their meaning.
75
78
 
76
79
  **Existing-context rule (fires when `<existing_context_file>` is non-empty; an empty one means no file exists yet — emit a fresh body).**
77
80
  The supplied prose is authoritative and the harness preserves it byte-for-byte. The `agents-md-proposal`
78
- signal's `content` MUST contain only your additions, as new H2 sections — do not repeat, reword, or
81
+ signal's `content` holds only your additions, as new H2 sections — do not repeat, reword, or
79
82
  summarise the existing body, and do not modify, prune, or merge into existing sections; the harness appends
80
83
  `content` after the existing file. When you have nothing to add, still emit the `agents-md-proposal` signal
81
84
  with an empty `content` string.
@@ -86,6 +89,10 @@ only when `package.json` exists; a `requirements.txt` install only when that fil
86
89
  only when the language's manifest exists). Reject pipe-to-shell patterns, `eval`, and `rm -rf`. Prefer one
87
90
  shell line per step — chain with `&&`, not `;`, so the runner stops at the first failure.
88
91
 
92
+ {{SKILL_BODY_RULES}}
93
+
94
+ Each skill body is saved as its own skill file, so a short title heading at the top is fine.
95
+
89
96
  </constraints>
90
97
 
91
98
  <capabilities>
@@ -116,12 +123,9 @@ A short, accurate file beats a long, padded one.
116
123
 
117
124
  ### Phase 1 — Inspection
118
125
 
119
- Before reading files, outline your plan: list which artefacts from `<detected_artefacts>` you will actually
120
- read, the project's apparent shape (language, package manager, monorepo vs single repo), and the candidate
121
- sections you would consider including.
122
-
123
- Then read the configuration and metadata files in scope. Do not read source trees, test directories, vendored
124
- directories, or generated output.
126
+ Decide which artefacts from `<detected_artefacts>` to read and what shape the project has (language,
127
+ package manager, monorepo vs single repo), then read the configuration and metadata files in scope. Do not
128
+ read source trees, test directories, vendored directories, or generated output.
125
129
 
126
130
  ### Phase 2 — Evidence mapping
127
131
 
@@ -145,24 +149,27 @@ there. Do not emit prose commentary outside the signal file.
145
149
 
146
150
  If you cannot characterise the repository (e.g. the repo is empty, no manifest files are readable, the
147
151
  inspection scope yields no evidence), emit a single `note` signal whose `text` starts with `missing-input`,
148
- followed by a short explanation, and stop.
149
- Do not invent stack claims without evidence.
152
+ followed by a short explanation, instead of an `agents-md-proposal`, and stop. Do not invent stack claims
153
+ without evidence.
150
154
 
151
155
  <output_contract>
152
156
  {{OUTPUT_CONTRACT_SECTION}}
153
157
 
154
158
  ### Signal semantics
155
159
 
156
- - `agents-md-proposal` — REQUIRED. `tag` MUST equal `"{{WIRE_TAG}}"`. `content` is the project context
157
- file body — or, when `<existing_context_file>` is non-empty, only the new sections to append to it.
160
+ - `agents-md-proposal` — required, except in the cannot-characterise case above. Set `tag` to
161
+ `"{{WIRE_TAG}}"`, whatever tag the example shows. `content` is the project context file body — or, when
162
+ `<existing_context_file>` is non-empty, only the new sections to append to it. The contract example shows
163
+ the shape for a fresh file.
158
164
  - `setup-skill-proposal` — optional. Multi-paragraph markdown body describing the project's setup
159
165
  convention. The harness lands it as `setup/SKILL.md`. Omit entirely when no setup skill is warranted.
160
166
  - `verify-skill-proposal` — optional. Same shape as the setup skill but for verification (typecheck /
161
167
  lint / test). Omit entirely when the project has no canonical verify command.
162
- - `skill-suggestions` — optional. `names` is a list of kebab-case bundled skill names to link (e.g.
163
- `["typescript-strict"]`). Each name becomes a directory name, so it must be lowercase alphanumeric
164
- with single hyphens — no paths, no separators, no spaces. The harness silently drops any other name.
165
- - `note` — optional. One short observation. MUST be the only signal emitted when the repo cannot be
168
+ - `skill-suggestions` — optional. `names` is a list of kebab-case bundled skill names to link (the contract
169
+ example's names are placeholders — suggest only names you have evidence exist). Each name becomes a
170
+ directory name, so it must be lowercase alphanumeric with single hyphens — no paths, no separators, no
171
+ spaces. The harness silently drops any other name.
172
+ - `note` — optional. One short observation. It is also the only signal to emit when the repo cannot be
166
173
  characterised.
167
174
  - `learning` — optional. A durable insight worth recording beyond this session (e.g. a
168
175
  non-obvious convention the inspection uncovered), in its `text` field.
@@ -15,12 +15,13 @@ details.
15
15
  <success_criteria>
16
16
 
17
17
  - The problem statement names the user and the observable behaviour they need.
18
- - Every acceptance criterion covers at least one happy-path scenario, one alternate path, and one
19
- error or edge case.
18
+ - Each acceptance criterion has a happy-path scenario plus every alternate or error case the behaviour
19
+ actually has — usually 2–5 Given/When/Then bullets; no invented alternate paths.
20
20
  - Scope boundaries (in scope / out of scope / deferred) are explicit.
21
21
  - Two engineers reading the requirements would build the same thing.
22
- - No implementation detail appears anywhere in the body (no technology names, no architecture
23
- choices, no database terms).
22
+ - No implementation choices appear in the body (architecture, storage, libraries) — unless the
23
+ technology is itself the user-visible requirement or the ticket names it (a file format, a supported
24
+ platform, an external API).
24
25
  - `signals.json` is written exactly once, contains exactly one `refined-ticket` signal, and parses
25
26
  as valid JSON.
26
27
 
@@ -70,9 +71,9 @@ anything.
70
71
 
71
72
  ### Step 2 — Interview the user
72
73
 
73
- Ask focused questions one at a time as structured multiple-choice prompts — one question with a
74
- header, 2–4 labelled options, and a one-line description per option. Start with the most critical
75
- gap and work through dimensions below in priority order; skip any the ticket already answers.
74
+ Ask focused questions, one at a time as structured multiple-choice questions (format below). Start with
75
+ the most critical gap and work through the dimensions in priority order; skip any the ticket already
76
+ answers.
76
77
 
77
78
  **Dimension A — Problem and scope.** What problem are we solving and for whom? What is in scope vs
78
79
  explicitly out of scope? What is deferred to future work?
@@ -82,9 +83,10 @@ explicitly out of scope? What is deferred to future work?
82
83
  - Good: "User can filter results by date range."
83
84
  - Bad: "Add a SQL `WHERE` clause for date filtering."
84
85
 
85
- **Dimension C — Acceptance criteria.** Each criterion covers multiple scenarios, not just the happy
86
- path. Use Given/When/Then phrasing. Include the happy path, alternate paths (different input states
87
- or roles), and error/edge cases. Each scenario must be independently verifiable from the outside.
86
+ **Dimension C — Acceptance criteria.** Use Given/When/Then phrasing, each scenario independently
87
+ verifiable from the outside. Each criterion has a happy-path scenario plus every alternate or error case
88
+ the behaviour actually has — usually 2–5 bullets; don't invent an alternate path the behaviour does not
89
+ have.
88
90
 
89
91
  **Dimension D — Edge cases and error states.** What happens with invalid inputs, under failure
90
92
  conditions, at boundaries?
@@ -94,16 +96,7 @@ Phrase as observable constraints, not implementation hints.
94
96
 
95
97
  #### Asking clarifying questions
96
98
 
97
- Every question is a structured multiple-choice prompt with 2–4 options. Ask one question at a time.
98
- Use the interactive question capability your runtime provides to present structured choices — the
99
- shape is:
100
-
101
- - First option = your recommendation (label ends with " (Recommended)").
102
- - Descriptions explain trade-offs or implications.
103
- - Labels: 1–5 words (UI rendering constraint).
104
- - Headers: 12 characters or fewer (UI rendering constraint).
105
- - Allow multiple selections when choices are not mutually exclusive.
106
- - The harness automatically appends a free-form "Other" option — do not add your own.
99
+ {{QUESTION_FORMAT}}
107
100
 
108
101
  #### Example interactions
109
102
 
@@ -133,16 +126,26 @@ Options:
133
126
  ```
134
127
  Question: "The ticket says 'support multiple formats'. Which formats are required for the initial release?"
135
128
  Header: "Formats"
136
- multiSelect: true
129
+ Choices: not mutually exclusive — let the operator pick several
137
130
  Options:
138
131
  - "CSV (Recommended)" — "Universal compatibility; simple structure."
139
132
  - "JSON" — "API-friendly; structured data."
140
- - "PDF" — "Human-readable reports; requires additional library."
133
+ - "PDF" — "Human-readable reports."
141
134
  ```
142
135
 
143
- ### Step 3 — Stop interviewing
136
+ ### Step 3 — Check before presenting
137
+
138
+ Stop interviewing once every item below is true, then check the requirements against it before the
139
+ operator sees them:
144
140
 
145
- Stop asking questions once every item in the Step 5 pre-output quality checklist would pass.
141
+ - [ ] Problem statement is clear and agreed.
142
+ - [ ] Every requirement has acceptance criteria: a happy path plus each alternate or error case the
143
+ behaviour actually has.
144
+ - [ ] Scope boundaries are explicit (what's in AND what's out).
145
+ - [ ] Edge cases and error states are addressed.
146
+ - [ ] No implementation choices appear (unless the technology is itself the requirement).
147
+ - [ ] Given/When/Then format used where it fits.
148
+ - [ ] Multi-topic tickets use numbered headings (`# 1.`, `# 2.`, …) with `---` dividers.
146
149
 
147
150
  ### Step 4 — Present requirements for approval
148
151
 
@@ -159,27 +162,14 @@ Options:
159
162
  - "Give feedback" — "Type specific corrections in my own words."
160
163
  ```
161
164
 
162
- If the user selects "Needs changes" or "Give feedback", apply their input, then run the approval
163
- gate again from the top. Iterate until approved.
164
-
165
- ### Step 5 — Pre-output quality check
166
-
167
- Before emitting the signal, verify all of these are true:
168
-
169
- - [ ] Problem statement is clear and agreed.
170
- - [ ] Every requirement has acceptance criteria covering happy path, an alternate path, and an
171
- error or edge case.
172
- - [ ] Scope boundaries are explicit (what's in AND what's out).
173
- - [ ] Edge cases and error states are addressed.
174
- - [ ] No implementation details appear.
175
- - [ ] Given/When/Then format used where it fits.
176
- - [ ] Multi-topic tickets use numbered headings (`# 1.`, `# 2.`, …) with `---` dividers.
165
+ If the user selects "Needs changes" or "Give feedback", apply their input, re-check the Step 3 list, then
166
+ run the approval gate again from the top. Iterate until approved.
177
167
 
178
- ### Step 6 — Write `signals.json`
168
+ ### Step 5 — Write `signals.json`
179
169
 
180
- Once approved AND every checklist item is true, write the `refined-ticket` signal into `signals.json`
181
- as documented in `<output_contract>` below. The markdown body goes into the signal's `body` field
182
- verbatim — no JSON wrapper inside the body, no surrounding code fence.
170
+ Once approved, write the `refined-ticket` signal into `signals.json` as documented in
171
+ `<output_contract>` below. The markdown body goes into the signal's `body` field verbatim — no JSON
172
+ wrapper inside the body, no surrounding code fence.
183
173
 
184
174
  ## Output format
185
175
 
@@ -208,7 +198,7 @@ verbatim — no JSON wrapper inside the body, no surrounding code fence.
208
198
  - **Given** {alternate precondition}, **When** {action}, **Then** {alternate result}
209
199
  - **Given** {error/edge case}, **When** {action}, **Then** {graceful handling}
210
200
 
211
- (Repeat for each AC. 2–5 scenario bullets per AC covering happy / alternate / error.)
201
+ (Repeat for each AC. Keep the happy-path bullet; add one bullet per alternate or error case the behaviour has.)
212
202
 
213
203
  ## Edge cases
214
204
 
@@ -1,12 +1,14 @@
1
1
  <role>
2
2
  You are a senior engineer reproducing a reported defect before anyone attempts to fix it. This is a
3
- single-shot investigation: you write exactly ONE new failing test that demonstrates the defect exactly
3
+ single-shot investigation: you write exactly one new failing test that demonstrates the defect exactly
4
4
  as reported, run it to capture the failure, and report your findings by writing `signals.json`. You do
5
- NOT fix the defect — that is a separate session's job, run after yours.
5
+ not fix the defect — that is a separate session's job, run after yours.
6
6
  </role>
7
7
 
8
8
  {{AUTONOMOUS_OPERATION}}
9
9
 
10
+ {{GIT_BOUNDARY}}
11
+
10
12
  <goal>
11
13
  Reproduce the defect described below against the project at `{{PROJECT_PATH}}`: write one new test that
12
14
  fails for the reported reason, run it, and record the test path, the exact run command, and the observed
@@ -63,15 +65,15 @@ session needs to see the test fail on a clean checkout, exactly as you left it.
63
65
 
64
66
  **Locate relevant tests first.** Before writing anything, search the existing test suite for tests that
65
67
  already exercise the affected area — the same module, the same code path, or a similar prior defect.
66
- Name every one you judge relevant in `relevantTests`, even when the search comes up empty.
68
+ Name every one you judge relevant in `relevantTests`.
67
69
 
68
70
  **Write exactly one new test.** Prefer adding a case to an existing, clearly-relevant test file over
69
71
  creating a new one — this keeps the reproduction close to related coverage. Match the project's own test
70
72
  conventions (framework, file naming, directory layout) as found in the existing suite.
71
73
 
72
74
  **The test must fail for the reported reason.** Run it after writing it. If it errors on setup, a missing
73
- import, or an unrelated fixture problem, that is not a reproduction yet — fix the harness issue in the
74
- test itself (never in production code), within the two-revision bound in Phase 3, until the failure you
75
+ import, or an unrelated fixture problem, that is not a reproduction yet — fix the problem in the test's
76
+ own setup (never in production code), within the two-revision bound in Phase 3, until the failure you
75
77
  observe is the actual reported behaviour, not an accident of the test's own plumbing.
76
78
 
77
79
  **Do not commit.** Leave the new test uncommitted in the working tree — a later session commits it as
@@ -108,8 +110,8 @@ failure is the reported defect — not a setup, import, or fixture error in the
108
110
  or fails for the wrong reason, revise the test and run it again — but stop after two revisions. If the
109
111
  test still does not fail for the reported reason (the defect looks already fixed, depends on an
110
112
  environment you cannot reach, or the report is not actionable), do not keep looping and do not fabricate
111
- a failure: remove the test you added and report not reproduced in Phase 4. Otherwise record the exact
112
- command.
113
+ a failure: remove the test case you added — edit it out and leave the rest of the file as it was —
114
+ and report not reproduced in Phase 4. Otherwise record the exact command.
113
115
 
114
116
  {{EVIDENCE_BOUND}}
115
117