ralphctl 0.21.0 → 0.23.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 (32) hide show
  1. package/README.md +112 -66
  2. package/dist/{cli-3OPZOXH6.mjs → cli-J3MI4B6A.mjs} +7734 -4281
  3. package/dist/cli.mjs +1 -1
  4. package/dist/manifest.json +9 -2
  5. package/dist/prompts/_partials/autonomous-operation.md +16 -0
  6. package/dist/prompts/_partials/decisions.md +1 -1
  7. package/dist/prompts/_partials/evaluation-checkpoint.md +23 -0
  8. package/dist/prompts/_partials/evaluator-failure-modes.md +13 -0
  9. package/dist/prompts/_partials/evidence-bound.md +6 -0
  10. package/dist/prompts/_partials/parallel-tool-calls.md +7 -0
  11. package/dist/prompts/_partials/task-fields.md +35 -0
  12. package/dist/prompts/_partials/task-sizing.md +26 -0
  13. package/dist/prompts/detect-scripts/template.md +10 -10
  14. package/dist/prompts/distill-learnings/template.md +4 -2
  15. package/dist/prompts/evaluate/template.md +20 -49
  16. package/dist/prompts/evaluate-continuation/template.md +14 -45
  17. package/dist/prompts/ideate/template.md +34 -52
  18. package/dist/prompts/implement/template.md +42 -17
  19. package/dist/prompts/implement-continuation/template.md +63 -25
  20. package/dist/prompts/plan/template.md +52 -102
  21. package/dist/prompts/readiness/template.md +25 -26
  22. package/dist/prompts/reproduce/template.md +3 -3
  23. package/dist/skills/ralphctl-alignment/SKILL.md +4 -3
  24. package/dist/skills/ralphctl-cherny-workflow/SKILL.md +3 -3
  25. package/dist/skills/ralphctl-code-review-and-quality/SKILL.md +18 -11
  26. package/dist/skills/ralphctl-debugging-and-error-recovery/SKILL.md +10 -9
  27. package/dist/skills/ralphctl-iterative-review/SKILL.md +8 -4
  28. package/dist/skills/ralphctl-karpathy-guidelines/SKILL.md +2 -2
  29. package/dist/skills/ralphctl-ponytail/SKILL.md +7 -3
  30. package/dist/skills/ralphctl-surgical-simplicity/SKILL.md +5 -3
  31. package/dist/skills/ralphctl-test-driven-development/SKILL.md +4 -3
  32. package/package.json +20 -17
@@ -11,6 +11,8 @@ lifecycle and context compaction.
11
11
 
12
12
  {{HARNESS_CONTEXT}}
13
13
 
14
+ {{AUTONOMOUS_OPERATION}}
15
+
14
16
  Summaries of earlier tasks' outcomes in this sprint, when present below, are for continuity — read
15
17
  them and do not redo work they already cover.
16
18
 
@@ -62,6 +64,10 @@ under its declared check type.
62
64
 
63
65
  <plateau_directive>{{PLATEAU_DIRECTIVE_SECTION}}</plateau_directive>
64
66
 
67
+ When the block above is empty, no plateau escalation applies this round — proceed normally; it
68
+ carries a "change your approach" directive only when the gen-eval loop has stalled and the
69
+ escalation policy granted a same-model retry.
70
+
65
71
  <prior_critique>{{PRIOR_CRITIQUE_SECTION}}</prior_critique>
66
72
 
67
73
  {{PRIOR_ATTEMPTS_SECTION}}
@@ -138,7 +144,11 @@ repository now, trust the repository and record the conflict as a `learning` sig
138
144
  - Include only what an unfamiliar engineer would get wrong without being told. Redundant context
139
145
  measurably raises cost without improving agent success.
140
146
  - Be specific and verifiable. "Use 2-space indentation" beats "format properly".
141
- - Stay under 200 lines, max 7 H2 sections, no H4+. Adherence degrades past these limits.
147
+ - Match the length and structure of a comparable context file already in this ecosystem (this
148
+ project's own file if it has one, or the convention for the format the active provider reads)
149
+ rather than a fixed line or heading count — the right size is provider- and project-dependent.
150
+ Absent a comparable example, keep it short and skimmable: a handful of top-level sections, no
151
+ deep nesting.
142
152
  - Never embed secrets or credentials — those belong in `.env` files or a secret manager, never a
143
153
  committed context file, with no exception.
144
154
  - Never embed slash commands, hooks, MCP server config, or IDE settings — except when a declared
@@ -150,8 +160,8 @@ repository now, trust the repository and record the conflict as a `learning` sig
150
160
  <capabilities>
151
161
  You can read any file in the project and in the mounted sprint directory. You can run shell commands
152
162
  (subject to the harness's sandbox). You can search the repository for patterns. You can modify and
153
- create files under the project path. Write `signals.json` to the output directory specified in
154
- `<output_contract>`.
163
+ create files under the project path. Write `signals.json` to the output directory named in the
164
+ Output contract section at the bottom of this prompt.
155
165
  </capabilities>
156
166
 
157
167
  ## Protocol
@@ -166,6 +176,8 @@ work. Proceed directly for routine file edits and command runs.
166
176
  Then perform these checks before writing any code. The goal is to steer the implementation correctly
167
177
  on the first attempt, not to discover problems after the fact.
168
178
 
179
+ {{PARALLEL_TOOL_CALLS}}
180
+
169
181
  1. **Confirm your working directory** — verify you are in the expected project path (`{{PROJECT_PATH}}`).
170
182
  2. **Prior critique first (rounds 2+)** — if `<prior_critique>` above is non-empty, work through
171
183
  each failed dimension and plan how you will address it before starting new work. If this task
@@ -204,11 +216,11 @@ on the first attempt, not to discover problems after the fact.
204
216
  changing any code. A fix you cannot first reproduce is a guess; re-run the same repro in Phase 3
205
217
  to confirm it now passes.
206
218
 
207
- Before writing any code, restate in your working notes — three to five lines, not part of any
208
- signal — the task goal, the acceptance criteria, and the specific facts from the prior progress or
209
- learnings above that you will rely on. From here on, after roughly every five tool actions, restate
210
- in one line which phase you are in and which acceptance criteria remain — a long session drifts
211
- without this anchor.
219
+ Before writing any code, confirm against the contract at `{{CONTRACT_PATH}}` — not against your
220
+ memory of it — which declared steps and acceptance criteria remain unmet, using `<prior_critique>`
221
+ and `<prior_criteria_verdicts>` above as your starting point. From here on, re-confirm against that
222
+ same contract, rather than your own recollection, whenever you are about to report progress or are
223
+ unsure how much of the task remains — a long session drifts without this anchor.
212
224
 
213
225
  Proceed to Phase 2 once Phase 1 passes.
214
226
 
@@ -269,10 +281,10 @@ In order:
269
281
 
270
282
  4. **Record verification results** — emit `task-verified` with the commands from step 2 and their
271
283
  combined stdout/stderr, plus the end-to-end observation from step 3 when it ran, all in the
272
- `output` field. Include each command, its exit code, every failing
273
- test/check name, and roughly the last 50 lines of output per command; when a command's output
274
- exceeds that, write the full log to a file in your session working directory — never inside
275
- the repository — and cite its path instead of pasting the rest.
284
+ `output` field. Include each command, its exit code, and every failing test/check name.
285
+
286
+ {{EVIDENCE_BOUND}}
287
+
276
288
  5. **Propose the commit message** — emit `commit-message` with a real subject and a body explaining
277
289
  WHY the change exists, what alternatives you weighed, any remaining uncertainty, and — when the
278
290
  change is risky — how to roll it back. Include any follow-ups a reviewer should know. The harness
@@ -287,6 +299,15 @@ In order:
287
299
 
288
300
  ## Failure modes
289
301
 
302
+ When you emit `task-blocked`, prefer something an operator can act on in seconds over a paragraph
303
+ of prose. `reason` is always required. When — and only when — the block is an information gap
304
+ rather than a broken environment, also set: `question` (the single concrete question that, answered,
305
+ unblocks you) and `whatUnblocksMe` (what someone needs to supply or decide). When that gap is
306
+ specifically missing information, an ambiguous request, or contradictory instructions, also set
307
+ `blockerClass` to `missing-information`, `ambiguous-request`, or `contradictory-information`
308
+ respectively — leave it unset for an environment or verification failure, where none of the three
309
+ fit.
310
+
290
311
  **A step fails.** Read the error carefully. Determine whether it is pre-existing or caused by your
291
312
  changes. Fix and re-verify. If unfixable after a reasonable attempt, emit `task-blocked` with the
292
313
  concrete failure as the `reason`.
@@ -296,14 +317,18 @@ test-weakening rule in `<constraints>`). If pre-existing: emit `task-blocked` wi
296
317
  `reason: "Pre-existing test failure: [details]"`.
297
318
 
298
319
  **Blocked by another task.** Emit `task-blocked` with
299
- `reason: "Missing dependency: [what is missing and which task should produce it]"`. Do NOT stub or
300
- mock the missing piece.
320
+ `reason: "Missing dependency: [what is missing and which task should produce it]"`,
321
+ `blockerClass: "missing-information"`, a `question` naming exactly what is missing, and
322
+ `whatUnblocksMe` naming which task or artifact must land first. Do NOT stub or mock the missing piece.
301
323
 
302
- **Scope seems wrong.** See the scope rule in Phase 2 step 3 above — emit `task-blocked` rather than
303
- expanding scope.
324
+ **Scope seems wrong.** See the scope rule in Phase 2 step 3 above — emit `task-blocked` with
325
+ `blockerClass: "ambiguous-request"`, a `question` asking which scope was intended, and
326
+ `whatUnblocksMe` naming the decision that would resolve it, rather than expanding scope.
304
327
 
305
328
  **Cannot complete** — environment failure, contradictory input, or unresolvable ambiguity: emit
306
- `task-blocked` with a concrete reason and stop. Do not invent plausible-looking output.
329
+ `task-blocked` with a concrete reason and stop. For contradictory input specifically, also set
330
+ `blockerClass: "contradictory-information"` and use `question` / `whatUnblocksMe` to name the
331
+ conflicting instructions and what would resolve them. Do not invent plausible-looking output.
307
332
 
308
333
  **Round ends without `task-complete`, or with criteria still failing.** Emit one `note` signal
309
334
  distilling the approaches you attempted, the dead ends you ruled out and why, and the most
@@ -10,21 +10,38 @@ compaction.
10
10
 
11
11
  {{HARNESS_CONTEXT}}
12
12
 
13
+ {{AUTONOMOUS_OPERATION}}
14
+
13
15
  <session_context>
14
16
  This is a continuation turn — the brief, the contract, and your prior rounds are already in this
15
- conversation's history. If this session somehow lacks that prior context (a resumed thread that
16
- did not carry forward), re-read these on-disk files before acting — they are reachable via the
17
- mounted directories:
17
+ conversation's history. The done-criteria in `<task_criteria>` below and the no-test-weakening rule
18
+ in `<success_criteria>` below are restated every round regardless of what the conversation already
19
+ carries, so a compacted or cold-resumed session is never left missing them. If this session lacks
20
+ the REST of that prior context (a resumed thread that did not carry forward), re-read these on-disk
21
+ files before acting — they are reachable via the mounted directories:
18
22
 
19
23
  - task contract — `{{CONTRACT_PATH}}`
20
24
  - sprint journal — `{{PROGRESS_FILE}}` (append-only history of every prior task-attempt)
21
25
 
22
- Read them only when the prior context is missing; when the conversation already carries the brief,
23
- proceed directly to the critique below.
26
+ Read them only when the prior context is missing beyond what is restated below; when the
27
+ conversation already carries the brief, proceed directly to the critique.
24
28
  </session_context>
25
29
 
30
+ <task_criteria>
31
+ The done-criteria this task is graded against:
32
+
33
+ {{VERIFICATION_CRITERIA_SECTION}}
34
+
35
+ When the block above is empty, no criteria were threaded into this round — treat the contract at
36
+ `{{CONTRACT_PATH}}` as authoritative instead.
37
+ </task_criteria>
38
+
26
39
  <plateau_directive>{{PLATEAU_DIRECTIVE_SECTION}}</plateau_directive>
27
40
 
41
+ When the block above is empty, no plateau escalation applies this round — proceed normally; it
42
+ carries a "change your approach" directive only when the gen-eval loop has stalled and the
43
+ escalation policy granted a same-model retry.
44
+
28
45
  <prior_critique>{{PRIOR_CRITIQUE_SECTION}}</prior_critique>
29
46
 
30
47
  {{PRIOR_ATTEMPTS_SECTION}}
@@ -49,26 +66,47 @@ For the complete history — older than the excerpt above — read `{{PROGRESS_F
49
66
  {{DECISIONS_GUIDANCE}}
50
67
 
51
68
  <goal>
52
- Address every dimension the evaluator flagged in `<prior_critique>`, then run each `auto`
53
- criterion's command once. If a command fails intermittently, re-run it once; if the two runs
54
- disagree, report the inconsistency as evidence in `task-verified` rather than asserting a clean
55
- pass or fail. Do NOT run the verify script — the harness runs it after your turn as the
56
- independent commit gate. Exception: when the task defines no `auto` criteria, run the verify
57
- script once yourself. Emit `task-verified` with each command, its exit code, every failing
58
- test/check name, and roughly the last 50 lines of output per command — when a command's output
59
- exceeds that, write the full log to a file in your session working directory (never inside the
60
- repository) and cite its path — propose a `commit-message` when you touched any file, naming any
61
- remaining uncertainty and, when the change is risky, how to roll it back, and emit `task-complete`
62
- only after every flagged dimension is resolved and every criterion command passes. Removing or
63
- disabling a test to make verify pass counts as task failure — fix the implementation, not the test
64
- — except when a declared step explicitly changes the behaviour the test asserts. When a flagged
65
- item is genuinely blocked (missing dependency, contradictory input, unresolvable ambiguity), emit
66
- `task-blocked` with the concrete reason instead of guessing. Emit `change`, `learning`, and `note`
67
- signals as applicable — contrast a now-working approach with what failed in an earlier round when
68
- this round succeeds where a prior one didn't — the harness records them in the sprint journal. When
69
- this round ends without `task-complete` or with criteria still failing, also emit one `note` signal
70
- distilling the approaches attempted, the dead ends ruled out and why, and the most promising untried
71
- direction.
69
+ Address every dimension the evaluator flagged in `<prior_critique>` above, then re-verify against
70
+ `<task_criteria>` above.
72
71
  </goal>
73
72
 
73
+ <success_criteria>
74
+
75
+ - Every dimension named in `<prior_critique>` has been addressed.
76
+ - Every `auto` criterion's command has been run once this round (or, when the task defines no
77
+ `auto` criteria, the verify script has been run once as the fallback evidence source).
78
+ - `task-verified` has been emitted with the bounded evidence described in Protocol step 2.
79
+ - `commit-message` has been emitted when any file was touched, naming any remaining uncertainty
80
+ and, when the change is risky, how to roll it back.
81
+ - `task-complete` has been emitted only once every flagged dimension is resolved and every
82
+ criterion command passes.
83
+ - No test has been removed, disabled, or weakened to reach a pass — fix the implementation, not
84
+ the test — except when a declared step explicitly changes the behaviour the test asserts.
85
+
86
+ </success_criteria>
87
+
88
+ ## Protocol
89
+
90
+ 1. **Re-verify.** Run each `auto` criterion's command once. If a command fails intermittently,
91
+ re-run it once; if the two runs disagree, report the inconsistency as evidence in
92
+ `task-verified` rather than asserting a clean pass or fail. Do NOT run the verify script — the
93
+ harness runs it after your turn as the independent commit gate. Exception: when the task
94
+ defines no `auto` criteria, run the verify script once yourself.
95
+ 2. **Record verification results.** Emit `task-verified` with each command, its exit code, and
96
+ every failing test/check name.
97
+
98
+ {{EVIDENCE_BOUND}}
99
+
100
+ 3. **Propose the commit message.** Emit `commit-message` when you touched any file, naming any
101
+ remaining uncertainty and, when the change is risky, how to roll it back.
102
+ 4. **Emit narrative signals as applicable.** `change`, `learning`, and `note` — contrast a
103
+ now-working approach with what failed in an earlier round when this round succeeds where a
104
+ prior one didn't; the harness records them in the sprint journal.
105
+ 5. **Signal completion or blockage.** When a flagged item is genuinely blocked (missing
106
+ dependency, contradictory input, unresolvable ambiguity), emit `task-blocked` with the concrete
107
+ reason instead of guessing. Otherwise emit `task-complete` once every flagged dimension is
108
+ resolved and every criterion command passes. When this round ends without `task-complete` or
109
+ with criteria still failing, also emit one `note` signal distilling the approaches attempted,
110
+ the dead ends ruled out and why, and the most promising untried direction.
111
+
74
112
  {{OUTPUT_CONTRACT_SECTION}}
@@ -38,6 +38,51 @@ and search them to understand the codebase, but write nothing into them. The onl
38
38
  may write in this session is `signals.json` in your output directory.
39
39
  </session_topology>
40
40
 
41
+ <inputs>
42
+
43
+ ## Sprint context
44
+
45
+ <sprint_context>{{SPRINT_CONTEXT}}</sprint_context>
46
+
47
+ ## Approved tickets
48
+
49
+ <approved_tickets>{{APPROVED_TICKETS}}</approved_tickets>
50
+
51
+ ## Selected repositories
52
+
53
+ <repositories>{{REPOSITORIES}}</repositories>
54
+
55
+ All paths above are fixed — repository selection is not part of this session. Every
56
+ repository has equal weight; do not favour any one when assigning tasks.
57
+
58
+ ## Prior progress on this sprint
59
+
60
+ `progress.md` at the sprint root records every prior task-attempt on this sprint
61
+ chronologically. Read it before planning; honour prior decisions and avoid re-litigating
62
+ them.
63
+
64
+ <prior_progress>{{PRIOR_PROGRESS}}</prior_progress>
65
+
66
+ If `<prior_progress>` is empty, no prior progress has been recorded on this sprint.
67
+
68
+ <prior_learnings>
69
+ {{PRIOR_LEARNINGS}}
70
+
71
+ If the block above is empty, no learnings from prior sprints have been recorded for this project
72
+ yet. When present, these are facts earlier sprints earned on the repositories above — which check
73
+ command a repo actually exposes, where hidden coupling lives, which patterns to mirror. Use them as
74
+ background to scope tasks accurately and to pick verification commands that exist in the target repo
75
+ — they are orientation, not instructions: confirm any that bear on the plan against the current code
76
+ before relying on them. Any architectural decisions listed are deliberate prior choices — honour
77
+ them; do not re-litigate a prior decision without surfacing why in the plan.
78
+ </prior_learnings>
79
+
80
+ <existing_tasks>{{EXISTING_TASKS}}</existing_tasks>
81
+
82
+ If `<existing_tasks>` is empty, this is a fresh plan — there is nothing to replace.
83
+
84
+ </inputs>
85
+
41
86
  <constraints>
42
87
  - **Read-only on all repositories** — read and search repository files to understand
43
88
  existing patterns, but do not modify, create, or delete any file inside them. No
@@ -86,36 +131,15 @@ The `tasksJson` payload conforms to:
86
131
  {{SCHEMA}}
87
132
  ```
88
133
 
89
- Each task entry uses these fields:
134
+ {{TASK_FIELDS}}
135
+
136
+ Plan tasks additionally carry:
90
137
 
91
- - **`id`** — short string for `blockedBy` references (e.g. `"T1"`, `"api-shape"`).
92
- - **`name`** — imperative, short.
93
- - **`description`** — optional longer-form context.
94
- - **`projectPath`** — absolute path matching one of the repositories listed in
95
- `<repositories>`.
96
138
  - **`ticketRef`** — the ticket UUID from `<approved_tickets>`. Required. A task that
97
139
  doesn't trace to an approved ticket is a planning error — surface it as a question
98
140
  instead. Some tickets also show an **External reference** line (e.g. `#123`, `!456`,
99
141
  `PROJ-7`); that value is informational only — always set `ticketRef` to the UUID, never
100
142
  the external reference.
101
- - **`steps`** — concrete implementation steps in order.
102
- - **`verificationCriteria`** — structured criteria the evaluator grades PASS / FAIL. Each
103
- entry is an object: `{ id, assertion, check, command? }`.
104
- - `id` is stable within the task (e.g. `"C1"`). The evaluator cites it verbatim.
105
- - `assertion` is the human-readable check.
106
- - `check` is either `"auto"` (run `command`) or `"manual"` (inspect code and cite a
107
- specific location).
108
- - `command` is REQUIRED when `check === "auto"` and MUST be omitted when
109
- `check === "manual"`. Use the project's own commands — read the project's AI context
110
- file or manifest for the exact verification command this repository expects.
111
- - **`blockedBy`** — `id`s of earlier tasks that must complete first.
112
- - **`extraDimensions`** — optional kebab-case evaluator dimensions beyond the five floor
113
- dimensions (correctness, completeness, safety, consistency, robustness). Attach an extra
114
- dimension ONLY when an acceptance criterion explicitly demands a measurable property that no
115
- floor dimension covers AND no manual criterion already encodes it. When in doubt, omit — the
116
- floor dimensions are almost always sufficient. Example of a justified attachment:
117
- `migration-safety` when the ticket requires a zero-downtime schema change that the five
118
- floor dimensions cannot score on their own. Cap: 2–3 per task; hard max 6.
119
143
 
120
144
  If you cannot produce a sound plan, emit the `task-plan` signal with `tasksJson` set to:
121
145
 
@@ -140,30 +164,12 @@ by a different AI agent using only the verification criteria and the codebase.
140
164
  - **Independence** — implementable without waiting on other tasks (unless declared via
141
165
  `blockedBy`).
142
166
  - **Pattern reference** — steps reference existing similar code the agent should follow.
143
- </task_qualities>
144
-
145
- ### Task Sizing
146
-
147
- The unit is one coherent feature or vertical slice — a change that can be picked up cold,
148
- implemented in a single session, and verified end-to-end against its criteria.
149
167
 
150
- **Do not split when:**
168
+ </task_qualities>
151
169
 
152
- - A utility and its first caller would be separated — create-and-use is always one task, unless the utility already exists in the codebase or a prior task in this plan produces it.
153
- - A feature and its tests would be separated.
154
- - The same pattern applies across N call sites — it is one refactor, not N tasks.
155
-
156
- **Do split when:**
157
-
158
- - Two chunks are independent (different `projectPath`, or independent files with no shared
159
- contract).
160
- - A clean, verifiable boundary exists partway through (e.g. schema + migration land first,
161
- then consumer wiring — the schema is independently testable).
162
- - The change spans multiple repositories — one task per repo, connected via `blockedBy`.
170
+ ### Task Sizing
163
171
 
164
- **Soft ceiling, not a target:** if a task will touch more than ~10 files or ~500 lines of
165
- meaningful change AND a natural split point exists, split it. No natural split point? Keep
166
- it whole.
172
+ {{TASK_SIZING}}
167
173
 
168
174
  Too granular — should be one task, not three:
169
175
 
@@ -179,17 +185,6 @@ Right size:
179
185
  ### Anti-Patterns
180
186
 
181
187
  - Separate tasks for "create utility" and "integrate utility" — merge create+use into one.
182
- - One task per file modification — group by logical change, not by file.
183
- - `blockedBy` chains for trivial reasons — false chains obscure the real dependency
184
- structure.
185
- - Micro-refactoring tasks (add directive, remove import) — fold into the task that needs
186
- them.
187
- - **Ending steps with "run the verification commands" or "run all the checks."** Verification
188
- belongs in `verificationCriteria` — the harness and the evaluator execute it. A final step
189
- that re-runs the full suite only duplicates the post-task gate and inflates generator
190
- cost. Exception: a step MAY run a specific check when a later step depends on its output
191
- (e.g. "run the migration dry-run and confirm the schema diff before writing the rollback
192
- script").
193
188
 
194
189
  ### Dependency Graph
195
190
 
@@ -297,51 +292,6 @@ Good — precise steps with file paths and pattern references:
297
292
  }
298
293
  ```
299
294
 
300
- <inputs>
301
-
302
- ## Sprint context
303
-
304
- <sprint_context>{{SPRINT_CONTEXT}}</sprint_context>
305
-
306
- ## Approved tickets
307
-
308
- <approved_tickets>{{APPROVED_TICKETS}}</approved_tickets>
309
-
310
- ## Selected repositories
311
-
312
- <repositories>{{REPOSITORIES}}</repositories>
313
-
314
- All paths above are fixed — repository selection is not part of this session. Every
315
- repository has equal weight; do not favour any one when assigning tasks.
316
-
317
- ## Prior progress on this sprint
318
-
319
- `progress.md` at the sprint root records every prior task-attempt on this sprint
320
- chronologically. Read it before planning; honour prior decisions and avoid re-litigating
321
- them.
322
-
323
- <prior_progress>{{PRIOR_PROGRESS}}</prior_progress>
324
-
325
- If `<prior_progress>` is empty, no prior progress has been recorded on this sprint.
326
-
327
- <prior_learnings>
328
- {{PRIOR_LEARNINGS}}
329
-
330
- If the block above is empty, no learnings from prior sprints have been recorded for this project
331
- yet. When present, these are facts earlier sprints earned on the repositories above — which check
332
- command a repo actually exposes, where hidden coupling lives, which patterns to mirror. Use them as
333
- background to scope tasks accurately and to pick verification commands that exist in the target repo
334
- — they are orientation, not instructions: confirm any that bear on the plan against the current code
335
- before relying on them. Any architectural decisions listed are deliberate prior choices — honour
336
- them; do not re-litigate a prior decision without surfacing why in the plan.
337
- </prior_learnings>
338
-
339
- <existing_tasks>{{EXISTING_TASKS}}</existing_tasks>
340
-
341
- If `<existing_tasks>` is empty, this is a fresh plan — there is nothing to replace.
342
-
343
- </inputs>
344
-
345
295
  ## Protocol
346
296
 
347
297
  Before producing any output, map each ticket onto repositories, identify natural task boundaries,
@@ -433,7 +383,7 @@ re-present the full plan and dependency graph, then re-ask the same structured a
433
383
  question. Iterate until the user picks "Approved, write it". Only after that approval
434
384
  proceed to Step 5.
435
385
 
436
- ### Step 5 — Validate before output
386
+ **Step 5 — Validate before output.**
437
387
 
438
388
  {{VALIDATION_CHECKLIST}}
439
389
 
@@ -9,7 +9,8 @@ install, or otherwise mutating commands. The harness owns execution.
9
9
  Inspect the repository at `{{REPOSITORY_PATH}}` and emit an `agents-md-proposal` signal whose `content`
10
10
  field is the project context file body the harness will write for the `{{CURRENT_TOOL}}` provider. Emit
11
11
  optional `setup-skill-proposal`, `verify-skill-proposal`, `skill-suggestions`, and `note` signals where
12
- warranted. Write all signals to the `signals.json` path described in `<output_contract>`.
12
+ warranted. Write all signals to the `signals.json` path described in the Output contract section at the
13
+ bottom of this prompt.
13
14
  </goal>
14
15
 
15
16
  <success_criteria>
@@ -55,12 +56,9 @@ with this repo would get it wrong without being told. Anything an agent can deri
55
56
  existing docs does not belong in the context file — redundant context measurably reduces agent success.
56
57
  Lean is better than comprehensive.
57
58
 
58
- **Output length.** Follow the length guidance in `<target_file_conventions>` below — the target and
59
+ **Output length.** Follow the length guidance in `<target_file_conventions>` above — the target and
59
60
  any ceiling are provider-specific. Brevity is a feature — the file is read fresh on every AI session.
60
61
 
61
- **Structure caps.** Exactly one H1; at most 7 H2 sections; no H4 or deeper headings. Prefer bullets and
62
- short sentences.
63
-
64
62
  **Specificity rule.** Every rule must be specific and verifiable. Replace vague guidance ("write clean code")
65
63
  with concrete checks ("run `make test` before committing"). Reserve emphasis tokens (`IMPORTANT`, `YOU MUST`)
66
64
  for genuinely surprising rules — overuse erodes their meaning.
@@ -94,10 +92,6 @@ search the repository for file names or content patterns, and run read-only insp
94
92
  nothing except `signals.json`; never run build, install, or otherwise mutating commands.
95
93
  </capabilities>
96
94
 
97
- <output_contract>
98
- {{OUTPUT_CONTRACT_SECTION}}
99
- </output_contract>
100
-
101
95
  ## Recommended context-file sections
102
96
 
103
97
  Include only sections that carry signal for this specific repo:
@@ -143,26 +137,31 @@ comes first, byte-for-byte. Your additions go as new H2 sections at the bottom
143
137
 
144
138
  ### Phase 4 — Output
145
139
 
146
- Write `signals.json` to the path described in `<output_contract>` with the signals listed there. Do not
147
- emit prose commentary outside the signal file.
140
+ Write `signals.json` to the path named in the Output contract section below, with the signals described
141
+ there. Do not emit prose commentary outside the signal file.
148
142
 
149
143
  If you cannot characterise the repository (e.g. the repo is empty, no manifest files are readable, the
150
144
  inspection scope yields no evidence), emit a single `note` signal whose `text` starts with `missing-input`,
151
145
  followed by a short explanation, and stop.
152
146
  Do not invent stack claims without evidence.
153
147
 
154
- ## Signal summary
155
-
156
- 1. `agents-md-proposal` — REQUIRED. `tag` MUST equal `"{{WIRE_TAG}}"`. `content` is the project context
157
- file body.
158
- 2. `setup-skill-proposal` — optional. Multi-paragraph markdown body describing the project's setup
159
- convention. The harness lands it as `setup/SKILL.md`. Omit entirely when no setup skill is warranted.
160
- 3. `verify-skill-proposal` — optional. Same shape as the setup skill but for verification (typecheck /
161
- lint / test). Omit entirely when the project has no canonical verify command.
162
- 4. `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
- 5. `note` — optional. One short observation. MUST be the only signal emitted when the repo cannot be
166
- characterised.
167
- 6. `learning` — optional. A durable insight worth recording beyond this session (e.g. a
168
- non-obvious convention the inspection uncovered), in its `text` field.
148
+ <output_contract>
149
+ {{OUTPUT_CONTRACT_SECTION}}
150
+
151
+ ### Signal semantics
152
+
153
+ - `agents-md-proposal` — REQUIRED. `tag` MUST equal `"{{WIRE_TAG}}"`. `content` is the project context
154
+ file body.
155
+ - `setup-skill-proposal` — optional. Multi-paragraph markdown body describing the project's setup
156
+ convention. The harness lands it as `setup/SKILL.md`. Omit entirely when no setup skill is warranted.
157
+ - `verify-skill-proposal` — optional. Same shape as the setup skill but for verification (typecheck /
158
+ lint / test). Omit entirely when the project has no canonical verify command.
159
+ - `skill-suggestions` — optional. `names` is a list of kebab-case bundled skill names to link (e.g.
160
+ `["typescript-strict"]`). Each name becomes a directory name, so it must be lowercase alphanumeric
161
+ with single hyphens — no paths, no separators, no spaces. The harness silently drops any other name.
162
+ - `note` — optional. One short observation. MUST be the only signal emitted when the repo cannot be
163
+ characterised.
164
+ - `learning` — optional. A durable insight worth recording beyond this session (e.g. a
165
+ non-obvious convention the inspection uncovered), in its `text` field.
166
+
167
+ </output_contract>
@@ -100,9 +100,9 @@ test file following the project's own conventions.
100
100
 
101
101
  Run the new test in isolation using the project's own test runner. Confirm it fails, and confirm the
102
102
  failure is the reported defect — not a setup, import, or fixture error in the test itself. If it passes,
103
- or fails for the wrong reason, revise the test until it fails for the right one. Record the exact command
104
- and a bounded excerpt of the failing output — roughly the last 50 lines is enough to show the decisive
105
- failure.
103
+ or fails for the wrong reason, revise the test until it fails for the right one. Record the exact command.
104
+
105
+ {{EVIDENCE_BOUND}}
106
106
 
107
107
  ### Phase 4 — Report
108
108
 
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ralphctl-alignment
3
- description: Cross-phase skill — establish a shared understanding of what will and will not be done before producing output. Restate the input back to the user, surface assumptions, name non-goals, and agree before you write. For an input that is still a raw, unshaped idea needing multiple candidate directions before one is chosen, run the ralphctl-idea-refinement skill first when it is installed in this session; alignment then confirms whichever direction comes out of it.
3
+ description: Cross-phase skill — establish a shared understanding of what will and will not be done before producing output. Restates the input back to the user, surfaces assumptions, names non-goals, and reaches agreement before drafting output. Use before writing criteria, tasks, or code whenever the input's scope has not yet been confirmed. For an input that is still a raw, unshaped idea needing multiple candidate directions before one is chosen, run the ralphctl-idea-refinement skill first when it is installed in this session; alignment then confirms whichever direction comes out of it.
4
4
  ---
5
5
 
6
6
  # Alignment
@@ -21,8 +21,9 @@ the whole change.
21
21
  - **Plan** — confirm the planner's read of the requirements before generating tasks. Repo selection, scope
22
22
  boundaries, and dependency assumptions all need to land before task decomposition starts.
23
23
  - **Execute** — re-read the task spec's verification criteria before writing code. The contract is the
24
- arbiter; if your read of it differs from what's written, surface the conflict in a `<note>` rather than
25
- guessing.
24
+ arbiter; if your read of it differs from what's written, surface the conflict rather than guessing —
25
+ write a `note` signal in `signals.json` when the prompt's output-contract section lists it, otherwise
26
+ fold the conflict into the required signal's own fields.
26
27
 
27
28
  ## What to do
28
29
 
@@ -31,7 +31,7 @@ demonstrated or rolled back while it is still small.
31
31
  - Before each step, know its check: the test that should pass, the command that should exit cleanly, the behaviour that should be observable. A step without a check is not ready to execute.
32
32
  - Run the check immediately after the step — never accumulate several unverified steps, because a late failure then points at all of them at once.
33
33
  - Prefer the narrowest check that can falsify the step (one test file, one build target, one focused run) over broad suites; breadth comes at the end, and the harness owns the final post-task verify gate.
34
- - When no automated check exists for a step, create the smallest one that would fail if the step were wrong — or state explicitly in a `<note>` signal that the step is unverified and why.
34
+ - When no automated check exists for a step, create the smallest one that would fail if the step were wrong — or state explicitly that the step is unverified and why, as a `note` signal in `signals.json` when the prompt's output-contract section lists it, otherwise inside the required signal's own fields.
35
35
 
36
36
  ## Small verified increments
37
37
 
@@ -41,7 +41,7 @@ demonstrated or rolled back while it is still small.
41
41
 
42
42
  ## Compounding corrections
43
43
 
44
- - When you discover a project-specific gotcha — a convention that contradicted your instinct, a command that behaves unexpectedly, a fix for a recurring failure — record it as a `<learning>` signal so it persists beyond this session.
44
+ - When you discover a project-specific gotcha — a convention that contradicted your instinct, a command that behaves unexpectedly, a fix for a recurring failure — record it so it persists beyond this session: write a `learning` signal in `signals.json` when the prompt's output-contract section lists it, otherwise fold it into the required signal's own fields.
45
45
  - The habit mirrors how Cherny's team maintains their agent-facing project docs: every observed mistake becomes a written correction, so the same steering is never needed twice.
46
46
  - Record the correction at the moment you learn it — deferred notes don't get written; the exception is mid-verification, where finishing the check comes first.
47
47
 
@@ -58,4 +58,4 @@ demonstrated or rolled back while it is still small.
58
58
  - [ ] The executed steps match the settled plan — or the plan was explicitly revised along the way.
59
59
  - [ ] Every step's check ran and passed at the time the step was made.
60
60
  - [ ] The final diff reads as a sequence of intentional increments, with nothing unexplained.
61
- - [ ] Any durable gotcha discovered this session was recorded as a `<learning>` signal.
61
+ - [ ] Any durable gotcha discovered this session was recorded per the Compounding Corrections guidance above.