ralphctl 0.25.0 → 0.27.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 (59) hide show
  1. package/README.md +11 -5
  2. package/THIRD-PARTY-NOTICES.md +65 -2
  3. package/dist/agent-definitions/ralphctl-generator.md +3 -2
  4. package/dist/{cli-GQBXYNFN.mjs → cli-EYDXERW6.mjs} +9423 -6665
  5. package/dist/cli.mjs +1 -1
  6. package/dist/manifest.json +20 -3
  7. package/dist/prompts/_partials/approval-gate.md +5 -5
  8. package/dist/prompts/_partials/autonomous-operation.md +23 -6
  9. package/dist/prompts/_partials/conventions-agents-md.md +8 -20
  10. package/dist/prompts/_partials/conventions-claude-md.md +12 -15
  11. package/dist/prompts/_partials/conventions-copilot-instructions.md +6 -10
  12. package/dist/prompts/_partials/decisions.md +3 -9
  13. package/dist/prompts/_partials/evaluator-failure-modes.md +11 -5
  14. package/dist/prompts/_partials/evaluator-grading-rules.md +25 -10
  15. package/dist/prompts/_partials/evidence-bound.md +2 -2
  16. package/dist/prompts/_partials/git-boundary.md +7 -0
  17. package/dist/prompts/_partials/harness-context.md +1 -1
  18. package/dist/prompts/_partials/one-shot-operation.md +6 -0
  19. package/dist/prompts/_partials/question-format.md +7 -0
  20. package/dist/prompts/_partials/skill-body.md +5 -0
  21. package/dist/prompts/_partials/task-blocked.md +10 -0
  22. package/dist/prompts/_partials/task-fields.md +19 -3
  23. package/dist/prompts/_partials/task-sizing.md +2 -2
  24. package/dist/prompts/_partials/validation-checklist.md +6 -8
  25. package/dist/prompts/apply-feedback/template.md +24 -25
  26. package/dist/prompts/create-pr/template.md +21 -15
  27. package/dist/prompts/detect-scripts/template.md +10 -9
  28. package/dist/prompts/detect-skills/template.md +19 -23
  29. package/dist/prompts/distill-learnings/template.md +10 -8
  30. package/dist/prompts/evaluate/template.md +74 -93
  31. package/dist/prompts/evaluate-continuation/template.md +19 -22
  32. package/dist/prompts/ideate/template.md +36 -47
  33. package/dist/prompts/implement/template.md +59 -73
  34. package/dist/prompts/implement-continuation/template.md +21 -20
  35. package/dist/prompts/implement-crash-resume/template.md +13 -4
  36. package/dist/prompts/plan/template.md +75 -64
  37. package/dist/prompts/readiness/template.md +36 -27
  38. package/dist/prompts/refine/template.md +37 -50
  39. package/dist/prompts/reproduce/template.md +9 -7
  40. package/dist/prompts/select-candidate/template.md +17 -10
  41. package/dist/skills/ralphctl-api-and-interface-design/SKILL.md +117 -0
  42. package/dist/skills/ralphctl-code-review-and-quality/SKILL.md +119 -8
  43. package/dist/skills/ralphctl-code-simplification/SKILL.md +100 -0
  44. package/dist/skills/ralphctl-codebase-design/SKILL.md +82 -0
  45. package/dist/skills/ralphctl-debugging-and-error-recovery/SKILL.md +23 -5
  46. package/dist/skills/ralphctl-deprecation-and-migration/SKILL.md +106 -0
  47. package/dist/skills/ralphctl-frontend-ui-engineering/SKILL.md +94 -0
  48. package/dist/skills/ralphctl-humanizer/SKILL.md +137 -0
  49. package/dist/skills/ralphctl-idea-refinement/SKILL.md +2 -0
  50. package/dist/skills/ralphctl-iterative-review/SKILL.md +10 -4
  51. package/dist/skills/ralphctl-observability-and-instrumentation/SKILL.md +104 -0
  52. package/dist/skills/ralphctl-performance-optimization/SKILL.md +123 -0
  53. package/dist/skills/ralphctl-ponytail/SKILL.md +38 -28
  54. package/dist/skills/ralphctl-security-and-hardening/SKILL.md +259 -0
  55. package/dist/skills/ralphctl-source-driven-development/SKILL.md +103 -0
  56. package/dist/skills/ralphctl-spec-driven-development/SKILL.md +148 -0
  57. package/dist/skills/ralphctl-test-driven-development/SKILL.md +29 -2
  58. package/dist/skills/ralphctl-writing-for-agents/SKILL.md +113 -0
  59. package/package.json +10 -10
@@ -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,10 +309,10 @@ 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
- Remember: you are in the per-sprint plan unit root, not inside any repository. Use the
303
- repository paths from `<repositories>` as the roots for all file reads and searches.
315
+ Use the repository paths from `<repositories>` as the roots for all file reads and searches.
304
316
 
305
317
  ### Step 2 — Map tickets to tasks
306
318
 
@@ -310,15 +322,13 @@ For each approved ticket, decide:
310
322
  - Where the natural task boundaries are.
311
323
  - Which tasks must complete before others (`blockedBy`).
312
324
 
313
- Draft the plan first, before writing JSON.
325
+ Draft the plan before writing any JSON.
314
326
 
315
327
  ### Step 3 — Interview the user
316
328
 
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.
329
+ For genuinely contested decisions, ask the user a structured multiple-choice question.
330
+
331
+ {{QUESTION_FORMAT}}
322
332
 
323
333
  Good questions:
324
334
 
@@ -334,7 +344,13 @@ Bad questions:
334
344
  - Trivial choices derivable from project conventions ("which test runner?" — read the
335
345
  config).
336
346
 
337
- ### Step 4 — Present the plan for review
347
+ ### Step 4 — Validate before presenting
348
+
349
+ Draft the plan, then check it against this list before the operator sees it.
350
+
351
+ {{VALIDATION_CHECKLIST}}
352
+
353
+ ### Step 5 — Present the plan for review
338
354
 
339
355
  {{APPROVAL_GATE}}
340
356
 
@@ -347,6 +363,7 @@ dependency exists:
347
363
  **Ticket:** {ticket title}
348
364
  **Repository:** {projectPath}
349
365
  **Depends on:** {none | task ids}
366
+ **Extra evaluator dimensions:** {none | list}
350
367
  **Description:** ...
351
368
 
352
369
  **Steps:**
@@ -359,8 +376,8 @@ dependency exists:
359
376
  - ... (check type, command)
360
377
  ```
361
378
 
362
- The approval question goes last, via a structured multiple-choice prompt — do not ask in prose ("does
363
- this look right?"). Prose answers are ambiguous and the harness cannot act on them.
379
+ The approval question goes last, as a structured multiple-choice question (or the numbered-list fallback
380
+ in `<approval-gate>`) — not an open prose question like "does this look right?", whose answer is ambiguous.
364
381
 
365
382
  - **Question:** "Does this task breakdown look correct?"
366
383
  - **Options:**
@@ -368,21 +385,15 @@ this look right?"). Prose answers are ambiguous and the harness cannot act on th
368
385
  - "Needs changes" — I'll describe what to adjust.
369
386
  - "Give feedback" — Type specific corrections in my own words.
370
387
 
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}}
388
+ If the user picks "Needs changes" or "Give feedback", apply their input, revise the tasks, re-check the
389
+ Step 4 list, run the approval gate again with the full plan and dependency order, then re-ask the same
390
+ structured approval question. Iterate until the user picks "Approved, write it".
380
391
 
381
392
  ### Step 6 — Write `signals.json`
382
393
 
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.
394
+ Once the user has answered "Approved, write it" in Step 5, write the `task-plan` signal into
395
+ `signals.json` per the output contract below. The task array goes into the signal's `tasksJson` field
396
+ as a JSON-encoded string.
386
397
 
387
398
  **Optional signals** (emit when relevant). Each carries its prose in a `text` field — never
388
399
  `body`; the output contract below shows the exact shape:
@@ -5,6 +5,8 @@ review. Write nothing except `signals.json`; run only read-only inspection comma
5
5
  install, or otherwise mutating commands. The harness owns execution.
6
6
  </role>
7
7
 
8
+ {{ONE_SHOT_OPERATION}}
9
+
8
10
  <goal>
9
11
  Inspect the repository at `{{REPOSITORY_PATH}}` and emit an `agents-md-proposal` signal whose `content`
10
12
  field is the project context file body the harness will write for the `{{CURRENT_TOOL}}` provider. Emit
@@ -15,15 +17,15 @@ bottom of this prompt.
15
17
 
16
18
  <success_criteria>
17
19
 
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.
20
+ - `agents-md-proposal` signal emitted. `content` is non-empty when `<existing_context_file>` is empty (a
21
+ fresh file); with an existing file it holds only additions and may be an empty string when there is
22
+ nothing to add — unless you cannot characterise the repository (see the Output phase).
21
23
  - Every tech-stack claim in `content` is backed by a quoted file path or file content, not inferred.
22
24
  - 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
25
+ below — the exact target is provider-specific. The target applies to the existing file plus your
26
+ additions, so count the existing lines and keep additions within the remaining room.
27
+ - When an existing context file is supplied in `<existing_context_file>`, `content` holds only the new H2
28
+ sections to append, not the existing body; the harness appends them and keeps the existing file
27
29
  byte-for-byte.
28
30
  - Setup and verify skill proposals, when emitted, cite only commands that resolve in this specific repo
29
31
  (shell commands verified against manifest files, not assumed from language defaults).
@@ -46,7 +48,10 @@ bottom of this prompt.
46
48
 
47
49
  **Read-only scope.** Read configuration and metadata files only — `package.json`, `pyproject.toml`,
48
50
  `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
51
+ top-level `scripts/` entries, `flake.nix`. Also read other tools' context files and onboarding docs when
52
+ present — `AGENTS.md`, `CLAUDE.md`, `.github/copilot-instructions.md`, `.cursor/rules/`, `.grok/rules/`,
53
+ `.claude/rules/`, `CONTRIBUTING.md` — and do not restate or contradict them; when they disagree with a
54
+ manifest, mention it in a `note`. Do not read source trees, test directories, vendored or generated
50
55
  directories. Do not write any file other than `signals.json` in `<outputDir>`.
51
56
 
52
57
  **Evidence requirement.** For each tech-stack claim in the context file body, quote the file that
@@ -58,14 +63,14 @@ with this repo would get it wrong without being told. Anything an agent can deri
58
63
  existing docs does not belong in the context file — redundant context measurably reduces agent success.
59
64
  Lean is better than comprehensive.
60
65
 
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.
66
+ **Output length.** Follow the length guidance in `<target_file_conventions>` above — the target is
67
+ provider-specific. Brevity is a feature — the file is read fresh on every AI session.
63
68
 
64
69
  **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`)
70
+ with concrete checks ("run `make test` before committing"). Reserve emphasis tokens (all-caps warnings)
66
71
  for genuinely surprising rules — overuse erodes their meaning.
67
72
 
68
- **Do NOT include:**
73
+ **Leave out:**
69
74
 
70
75
  - Tool-specific slash commands, hooks, subagent definitions, MCP server configurations, IDE settings.
71
76
  - Long tutorials, file-by-file descriptions, or generic engineering wisdom.
@@ -75,7 +80,7 @@ for genuinely surprising rules — overuse erodes their meaning.
75
80
 
76
81
  **Existing-context rule (fires when `<existing_context_file>` is non-empty; an empty one means no file exists yet — emit a fresh body).**
77
82
  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
83
+ signal's `content` holds only your additions, as new H2 sections — do not repeat, reword, or
79
84
  summarise the existing body, and do not modify, prune, or merge into existing sections; the harness appends
80
85
  `content` after the existing file. When you have nothing to add, still emit the `agents-md-proposal` signal
81
86
  with an empty `content` string.
@@ -86,6 +91,10 @@ only when `package.json` exists; a `requirements.txt` install only when that fil
86
91
  only when the language's manifest exists). Reject pipe-to-shell patterns, `eval`, and `rm -rf`. Prefer one
87
92
  shell line per step — chain with `&&`, not `;`, so the runner stops at the first failure.
88
93
 
94
+ {{SKILL_BODY_RULES}}
95
+
96
+ Each skill body is saved as its own skill file, so a short title heading at the top is fine.
97
+
89
98
  </constraints>
90
99
 
91
100
  <capabilities>
@@ -116,12 +125,9 @@ A short, accurate file beats a long, padded one.
116
125
 
117
126
  ### Phase 1 — Inspection
118
127
 
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.
128
+ Decide which artefacts from `<detected_artefacts>` to read and what shape the project has (language,
129
+ package manager, monorepo vs single repo), then read the configuration and metadata files in scope. Do not
130
+ read source trees, test directories, vendored directories, or generated output.
125
131
 
126
132
  ### Phase 2 — Evidence mapping
127
133
 
@@ -145,24 +151,27 @@ there. Do not emit prose commentary outside the signal file.
145
151
 
146
152
  If you cannot characterise the repository (e.g. the repo is empty, no manifest files are readable, the
147
153
  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.
154
+ followed by a short explanation, instead of an `agents-md-proposal`, and stop. Do not invent stack claims
155
+ without evidence.
150
156
 
151
157
  <output_contract>
152
158
  {{OUTPUT_CONTRACT_SECTION}}
153
159
 
154
160
  ### Signal semantics
155
161
 
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.
162
+ - `agents-md-proposal` — required, except in the cannot-characterise case above. Set `tag` to
163
+ `"{{WIRE_TAG}}"`, whatever tag the example shows. `content` is the project context file body — or, when
164
+ `<existing_context_file>` is non-empty, only the new sections to append to it. The contract example shows
165
+ the shape for a fresh file.
158
166
  - `setup-skill-proposal` — optional. Multi-paragraph markdown body describing the project's setup
159
167
  convention. The harness lands it as `setup/SKILL.md`. Omit entirely when no setup skill is warranted.
160
168
  - `verify-skill-proposal` — optional. Same shape as the setup skill but for verification (typecheck /
161
169
  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
170
+ - `skill-suggestions` — optional. `names` is a list of kebab-case bundled skill names to link (the contract
171
+ example's names are placeholders — suggest only names you have evidence exist). Each name becomes a
172
+ directory name, so it must be lowercase alphanumeric with single hyphens — no paths, no separators, no
173
+ spaces. The harness silently drops any other name.
174
+ - `note` — optional. One short observation. It is also the only signal to emit when the repo cannot be
166
175
  characterised.
167
176
  - `learning` — optional. A durable insight worth recording beyond this session (e.g. a
168
177
  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
 
@@ -56,10 +57,7 @@ If the `<context>` block above is empty or absent, no upstream issue body was av
56
57
 
57
58
  ### Step 1 — Analyse the ticket
58
59
 
59
- Before producing any output, work through what is clear, what is ambiguous, and what edge cases the
60
- ticket omits.
61
-
62
- Then identify, in order:
60
+ Before asking anything, identify, in order:
63
61
 
64
62
  1. What is already clear and doesn't need clarification.
65
63
  2. What is ambiguous, missing, or underspecified.
@@ -70,9 +68,9 @@ anything.
70
68
 
71
69
  ### Step 2 — Interview the user
72
70
 
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.
71
+ Ask focused questions, one at a time as structured multiple-choice questions (format below). Start with
72
+ the most critical gap and work through the dimensions in priority order; skip any the ticket already
73
+ answers.
76
74
 
77
75
  **Dimension A — Problem and scope.** What problem are we solving and for whom? What is in scope vs
78
76
  explicitly out of scope? What is deferred to future work?
@@ -82,9 +80,10 @@ explicitly out of scope? What is deferred to future work?
82
80
  - Good: "User can filter results by date range."
83
81
  - Bad: "Add a SQL `WHERE` clause for date filtering."
84
82
 
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.
83
+ **Dimension C — Acceptance criteria.** Use Given/When/Then phrasing, each scenario independently
84
+ verifiable from the outside. Each criterion has a happy-path scenario plus every alternate or error case
85
+ the behaviour actually has — usually 2–5 bullets; don't invent an alternate path the behaviour does not
86
+ have.
88
87
 
89
88
  **Dimension D — Edge cases and error states.** What happens with invalid inputs, under failure
90
89
  conditions, at boundaries?
@@ -94,16 +93,7 @@ Phrase as observable constraints, not implementation hints.
94
93
 
95
94
  #### Asking clarifying questions
96
95
 
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.
96
+ {{QUESTION_FORMAT}}
107
97
 
108
98
  #### Example interactions
109
99
 
@@ -133,16 +123,26 @@ Options:
133
123
  ```
134
124
  Question: "The ticket says 'support multiple formats'. Which formats are required for the initial release?"
135
125
  Header: "Formats"
136
- multiSelect: true
126
+ Choices: not mutually exclusive — let the operator pick several
137
127
  Options:
138
128
  - "CSV (Recommended)" — "Universal compatibility; simple structure."
139
129
  - "JSON" — "API-friendly; structured data."
140
- - "PDF" — "Human-readable reports; requires additional library."
130
+ - "PDF" — "Human-readable reports."
141
131
  ```
142
132
 
143
- ### Step 3 — Stop interviewing
133
+ ### Step 3 — Check before presenting
144
134
 
145
- Stop asking questions once every item in the Step 5 pre-output quality checklist would pass.
135
+ Stop interviewing once every item below is true, then check the requirements against it before the
136
+ operator sees them:
137
+
138
+ - [ ] Problem statement is clear and agreed.
139
+ - [ ] Every requirement has acceptance criteria: a happy path plus each alternate or error case the
140
+ behaviour actually has.
141
+ - [ ] Scope boundaries are explicit (what's in AND what's out).
142
+ - [ ] Edge cases and error states are addressed.
143
+ - [ ] No implementation choices appear (unless the technology is itself the requirement).
144
+ - [ ] Given/When/Then format used where it fits.
145
+ - [ ] Multi-topic tickets use numbered headings (`# 1.`, `# 2.`, …) with `---` dividers.
146
146
 
147
147
  ### Step 4 — Present requirements for approval
148
148
 
@@ -159,27 +159,14 @@ Options:
159
159
  - "Give feedback" — "Type specific corrections in my own words."
160
160
  ```
161
161
 
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.
162
+ If the user selects "Needs changes" or "Give feedback", apply their input, re-check the Step 3 list, then
163
+ run the approval gate again from the top. Iterate until approved.
177
164
 
178
- ### Step 6 — Write `signals.json`
165
+ ### Step 5 — Write `signals.json`
179
166
 
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.
167
+ Once approved, write the `refined-ticket` signal into `signals.json` as documented in
168
+ `<output_contract>` below. The markdown body goes into the signal's `body` field verbatim — no JSON
169
+ wrapper inside the body, no surrounding code fence.
183
170
 
184
171
  ## Output format
185
172
 
@@ -208,7 +195,7 @@ verbatim — no JSON wrapper inside the body, no surrounding code fence.
208
195
  - **Given** {alternate precondition}, **When** {action}, **Then** {alternate result}
209
196
  - **Given** {error/edge case}, **When** {action}, **Then** {graceful handling}
210
197
 
211
- (Repeat for each AC. 2–5 scenario bullets per AC covering happy / alternate / error.)
198
+ (Repeat for each AC. Keep the happy-path bullet; add one bullet per alternate or error case the behaviour has.)
212
199
 
213
200
  ## Edge cases
214
201
 
@@ -254,8 +241,8 @@ Field names differ by kind — match the `signals.json` shape below exactly:
254
241
  - `note` (OPTIONAL) — narrative annotation in its `text` field; use sparingly for facts worth surfacing to the operator.
255
242
  - `learning` (OPTIONAL) — a non-obvious finding about the ticket, in its `text` field, worth recording in the sprint
256
243
  log.
257
- - `decision` (OPTIONAL) — a scope or design decision made during the interview, in its `text` field (keep it
258
- concise — roughly 500 characters).
244
+ - `decision` (OPTIONAL) — a scope or design decision made during the interview, in its `text` field (one or two
245
+ sentences).
259
246
 
260
247
  **Failure mode.** If, after the interview, the ticket cannot be refined as stated — due to
261
248
  contradictory requirements or information you cannot extract from the user — emit the `refined-ticket`
@@ -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