ralphctl 0.4.6 → 0.6.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 (58) hide show
  1. package/README.md +29 -16
  2. package/dist/absolute-path-WUTZQ37D.mjs +8 -0
  3. package/dist/chunk-6RDMCLWU.mjs +108 -0
  4. package/dist/chunk-HIU74KTO.mjs +1046 -0
  5. package/dist/chunk-S3PTDH57.mjs +78 -0
  6. package/dist/chunk-WV4D2CPG.mjs +26 -0
  7. package/dist/cli.mjs +22413 -717
  8. package/dist/manifest.json +24 -0
  9. package/dist/prompt-adapter-JQICGVX7.mjs +7 -0
  10. package/dist/prompts/ideate.md +3 -1
  11. package/dist/prompts/plan-auto.md +23 -8
  12. package/dist/prompts/plan-common-examples.md +3 -3
  13. package/dist/prompts/plan-common.md +6 -5
  14. package/dist/prompts/plan-interactive.md +30 -7
  15. package/dist/prompts/repo-onboard.md +154 -64
  16. package/dist/prompts/signals-task.md +3 -0
  17. package/dist/prompts/sprint-feedback.md +3 -0
  18. package/dist/prompts/task-evaluation.md +74 -53
  19. package/dist/prompts/task-execution.md +65 -21
  20. package/dist/prompts/ticket-refine.md +11 -8
  21. package/dist/prompts/validation-checklist.md +3 -2
  22. package/dist/skills/default/abstraction-first/SKILL.md +45 -0
  23. package/dist/skills/default/alignment/SKILL.md +46 -0
  24. package/dist/skills/default/iterative-review/SKILL.md +48 -0
  25. package/dist/skills/exec/.gitkeep +0 -0
  26. package/dist/skills/plan/.gitkeep +0 -0
  27. package/dist/skills/refine/.gitkeep +0 -0
  28. package/dist/storage-paths-IPNZZM5D.mjs +15 -0
  29. package/dist/validation-error-QT6Q7FYU.mjs +7 -0
  30. package/package.json +9 -4
  31. package/dist/add-DVPVHENV.mjs +0 -18
  32. package/dist/add-YVXM34RP.mjs +0 -17
  33. package/dist/bootstrap-FMHG6DRY.mjs +0 -11
  34. package/dist/chunk-747KW2RW.mjs +0 -24
  35. package/dist/chunk-B3RCOHW3.mjs +0 -5519
  36. package/dist/chunk-BSB4EDGR.mjs +0 -260
  37. package/dist/chunk-CBMFRQ4Y.mjs +0 -441
  38. package/dist/chunk-CFUVE2BP.mjs +0 -16
  39. package/dist/chunk-FNAAA32W.mjs +0 -103
  40. package/dist/chunk-GQ2WFKBN.mjs +0 -269
  41. package/dist/chunk-IWXBJD2D.mjs +0 -27
  42. package/dist/chunk-O566EEDL.mjs +0 -5542
  43. package/dist/chunk-OGEXYSFS.mjs +0 -228
  44. package/dist/chunk-PYZEQ2VK.mjs +0 -787
  45. package/dist/chunk-VAZ3LJBI.mjs +0 -179
  46. package/dist/chunk-WDMLPXOD.mjs +0 -363
  47. package/dist/chunk-XN2UIHBY.mjs +0 -589
  48. package/dist/chunk-ZLWSPLWI.mjs +0 -1117
  49. package/dist/create-Z635FQKO.mjs +0 -15
  50. package/dist/handle-23EFF3BE.mjs +0 -22
  51. package/dist/mount-B3MLHNVY.mjs +0 -7434
  52. package/dist/project-DQHF4ISP.mjs +0 -34
  53. package/dist/prompts/check-script-discover.md +0 -69
  54. package/dist/prompts/ideate-auto.md +0 -195
  55. package/dist/prompts/task-evaluation-resume.md +0 -41
  56. package/dist/resolver-OVPYVW6Q.mjs +0 -163
  57. package/dist/sprint-4E26AB5F.mjs +0 -38
  58. package/dist/start-FP7MVN5P.mjs +0 -19
@@ -0,0 +1,24 @@
1
+ {
2
+ "version": 1,
3
+ "generatedAt": "2026-05-04T20:12:39.622Z",
4
+ "assets": [
5
+ "prompts/harness-context.md",
6
+ "prompts/ideate.md",
7
+ "prompts/plan-auto.md",
8
+ "prompts/plan-common-examples.md",
9
+ "prompts/plan-common.md",
10
+ "prompts/plan-interactive.md",
11
+ "prompts/repo-onboard.md",
12
+ "prompts/signals-evaluation.md",
13
+ "prompts/signals-planning.md",
14
+ "prompts/signals-task.md",
15
+ "prompts/sprint-feedback.md",
16
+ "prompts/task-evaluation.md",
17
+ "prompts/task-execution.md",
18
+ "prompts/ticket-refine.md",
19
+ "prompts/validation-checklist.md",
20
+ "skills/default/abstraction-first/SKILL.md",
21
+ "skills/default/alignment/SKILL.md",
22
+ "skills/default/iterative-review/SKILL.md"
23
+ ]
24
+ }
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ InkPromptAdapter
4
+ } from "./chunk-HIU74KTO.mjs";
5
+ export {
6
+ InkPromptAdapter
7
+ };
@@ -40,7 +40,7 @@ Focus: Clarify WHAT needs to be built (implementation-agnostic)
40
40
  - No remaining ambiguity about what the feature should do — two developers reading these requirements would build
41
41
  the same observable behavior
42
42
 
43
- If the idea description already answers all of these, skip directly to Step 4.
43
+ If the idea description already answers all of these, skip directly to Step 4 — state "All clarifying questions answered by the description" so the user knows the interview was intentionally skipped.
44
44
 
45
45
  4. **Present requirements** — Show the complete refined requirements in readable markdown, then ask for approval using
46
46
  AskUserQuestion:
@@ -136,6 +136,8 @@ The user pre-selected these repositories for exploration:
136
136
 
137
137
  {{REPOSITORIES}}
138
138
 
139
+ These repositories were selected by the user before this session started — do not ask the user to confirm or change them; surface observations only.
140
+
139
141
  These paths are fixed — repository selection is a separate workflow step. If a critical repository seems missing,
140
142
  mention it as an observation.
141
143
 
@@ -2,9 +2,8 @@
2
2
 
3
3
  You are a task planning specialist. Produce a dependency-ordered set of implementation tasks — each one a self-contained
4
4
  mini-spec that an AI agent can pick up cold and complete in a single session. Think carefully and step-by-step as you
5
- plan: understand the codebase, map each ticket to the right repository, and order tasks to maximise parallelism without
6
- breaking real dependencies. Make all decisions autonomously based on codebase analysis — there is no user to interact
7
- with.
5
+ plan: understand the codebase, map each ticket to the right repository, and declare only real dependencies via
6
+ `blockedBy`. Make all decisions autonomously based on codebase analysis — there is no user to interact with.
8
7
 
9
8
  {{HARNESS_CONTEXT}}
10
9
 
@@ -50,7 +49,21 @@ for patterns and verification commands:
50
49
 
51
50
  ### Step 2: Review Ticket Requirements
52
51
 
53
- Each ticket should have refined requirements from Phase 1:
52
+ The user-approved requirements for this sprint are staged in your
53
+ working directory at `./requirements.json`. Read it directly — it is the
54
+ single source of truth. Schema:
55
+
56
+ ```json
57
+ {
58
+ "sprintId": "...",
59
+ "sprintName": "...",
60
+ "generatedAt": "<ISO timestamp>",
61
+ "tickets": [{ "ticketId": "...", "title": "...", "requirements": "<markdown body>" }]
62
+ }
63
+ ```
64
+
65
+ Only approved tickets are present; rejected or skipped tickets must not
66
+ be planned for. For each entry:
54
67
 
55
68
  1. **Read the requirements** — Understand WHAT needs to be built
56
69
  2. **Note constraints** — Business rules, acceptance criteria, scope boundaries
@@ -111,11 +124,13 @@ JSON Schema:
111
124
  {{SCHEMA}}
112
125
  ```
113
126
 
114
- **Dependencies**: Give tasks an `id` field, then reference those IDs in `blockedBy`:
127
+ **Dependencies**: Give each task an `id` field any unique placeholder string — and reference earlier tasks via `blockedBy`:
115
128
 
116
- - Each task can have an optional `id` field (e.g., `"id": "1"` or `"id": "auth-setup"`)
117
- - Reference earlier tasks by ID: `"blockedBy": ["1"]` or `"blockedBy": ["auth-setup"]`
118
- - Dependencies must reference tasks that appear earlier in the array
129
+ - `id` is a placeholder local to this output (e.g. `"1"`, `"auth-setup"`, `"add-validation"`). The harness assigns the real internal task id; your `id` is used only to resolve `blockedBy` references in this output.
130
+ - Reference earlier tasks by their placeholder: `"blockedBy": ["1"]` or `"blockedBy": ["auth-setup"]`.
131
+ - Every entry in `blockedBy` must match the `id` of an earlier task in the same array.
132
+ - Placeholders must be unique across the array.
133
+ - Dependencies must reference tasks that appear earlier in the array (no forward refs, no cycles).
119
134
 
120
135
  ### Example Well-Formed Output
121
136
 
@@ -31,7 +31,7 @@ Task 3: Implement user profile editor (blockedBy: [1])
31
31
  Task 4: Add form submission analytics (blockedBy: [2, 3])
32
32
  ```
33
33
 
34
- Tasks 2 and 3 run in parallel (both depend only on 1). Task 4 waits for both.
34
+ Tasks 2 and 3 are independent (both depend only on 1). Task 4 waits for both.
35
35
 
36
36
  ### Bad Dependency Graph
37
37
 
@@ -42,8 +42,8 @@ Task 3: Implement profile editor (blockedBy: [2]) <-- WRONG
42
42
  Task 4: Add submission analytics (blockedBy: [3]) <-- WRONG
43
43
  ```
44
44
 
45
- Task 3 does not actually need Task 2 — it only needs Task 1. This creates a false serial chain that prevents parallel
46
- execution.
45
+ Task 3 does not actually need Task 2 — it only needs Task 1. This creates a false serial chain that obscures the real
46
+ dependency structure.
47
47
 
48
48
  ## Precise Steps — good vs bad
49
49
 
@@ -47,7 +47,7 @@ more than they save.
47
47
 
48
48
  **Do split when:**
49
49
 
50
- - Two chunks can run in parallel (different `projectPath`, or independent files with no shared contract)
50
+ - Two chunks are independent (different `projectPath`, or independent files with no shared contract)
51
51
  - A clean, verifiable boundary exists partway through (e.g. schema + migration land first, then consumer wiring — the
52
52
  schema is independently testable and unblocks parallel consumers)
53
53
  - The change spans multiple repositories — one task per repo, connected via `blockedBy`
@@ -103,14 +103,15 @@ the evaluator will attempt visual verification using Playwright or browser tools
103
103
  2. **Merge create+use** — Keep "create X" and "use X" in one task — except when a stable contract makes them
104
104
  independently testable (e.g. schema + migration lands first, consumer wiring lands after)
105
105
  3. **Let scope drive task count** — do not aim for a specific number. Fewer, larger coherent tasks beat many
106
- micro-tasks; split only when parallelism or a clean boundary justifies it
106
+ micro-tasks; split only when a clean boundary justifies it
107
107
  4. **Merge serial chains** — If tasks only make sense when run in sequence, fold them into one task
108
108
 
109
109
  ### Anti-Patterns
110
110
 
111
111
  - Separate tasks for "create utility" and "integrate utility" — always merge create+use
112
112
  - One task per file modification — group by logical change, not by file
113
- - Tasks that are "blocked by" the previous task for trivial reasons — false chains kill parallelism
113
+ - Tasks that are "blocked by" the previous task for trivial reasons — false chains create artificial ordering and
114
+ obscure the real dependency structure
114
115
  - Micro-refactoring tasks (add directive, remove import, etc.) — fold into the task that needs them
115
116
 
116
117
  ## Non-Overlapping File Ownership
@@ -134,8 +135,8 @@ Tasks execute in dependency order — foundations before dependents.
134
135
  ### Guidelines
135
136
 
136
137
  1. **Foundation first** — Shared utilities, types, schemas before anything that uses them
137
- 2. **Declare all dependencies** — Use `blockedBy` to enforce order. Do not rely on array position alone.
138
- 3. **Maximize parallelism** — Only add `blockedBy` when there is a real code dependency
138
+ 2. **Declare all dependencies** — Use `blockedBy` to enforce order; reference each blocker by its `id` placeholder (any unique string). Do not rely on array position alone.
139
+ 3. **Avoid false dependencies** — Only add `blockedBy` when there is a real code dependency
139
140
  4. **Validate the DAG** — No cycles; earlier tasks cannot depend on later ones
140
141
 
141
142
  **Dependency test**: For each `blockedBy` entry, ask: "Does this task literally use code produced by the blocker?" If
@@ -26,7 +26,25 @@ Before planning, understand the codebase:
26
26
 
27
27
  ### Step 2: Review Ticket Requirements
28
28
 
29
- Each ticket should have refined requirements from Phase 1 (Requirements Refinement):
29
+ The canonical, user-approved requirements for this sprint are staged
30
+ inside your working directory at `./requirements.json`. Read that file
31
+ directly — it is the single source of truth.
32
+
33
+ Schema:
34
+
35
+ ```json
36
+ {
37
+ "sprintId": "...",
38
+ "sprintName": "...",
39
+ "generatedAt": "<ISO timestamp>",
40
+ "tickets": [{ "ticketId": "...", "title": "...", "requirements": "<markdown body>" }]
41
+ }
42
+ ```
43
+
44
+ Only tickets the user approved during refinement are present. Tickets
45
+ that were skipped or rejected do not appear and must not be planned for.
46
+
47
+ For each entry:
30
48
 
31
49
  1. **Read the requirements** — Understand WHAT needs to be built
32
50
  2. **Note constraints** — Business rules, acceptance criteria, scope boundaries from refinement
@@ -75,8 +93,7 @@ before the plan is finalized.
75
93
  3. Run the project's check/test/build gate — all pass
76
94
  ```
77
95
 
78
- 2. **Show the dependency graph** — Make it obvious which tasks run in parallel vs sequentially, and why each dependency
79
- exists:
96
+ 2. **Show the dependency graph** — Make the dependency structure obvious, and explain why each dependency exists:
80
97
 
81
98
  ```
82
99
  Dependency graph:
@@ -110,6 +127,7 @@ If you encounter issues that prevent planning, communicate clearly:
110
127
  - **Inaccessible repository** — Tell the user and ask if they want to proceed without it
111
128
  - **Contradictory requirements** — Present the conflict and ask the user to resolve it
112
129
  - **Missing context** — Ask the user using AskUserQuestion before proceeding with assumptions
130
+ - **No approved tickets** — Read `./requirements.json`; if it contains no entries, signal `<planning-blocked>No approved tickets to plan for</planning-blocked>`
113
131
 
114
132
  ### Step 7: Pre-Output Checklist
115
133
 
@@ -137,6 +155,9 @@ Repositories have been pre-selected by the user. Only create tasks targeting the
137
155
  each task in its `projectPath` directory, so tasks targeting unlisted repos would fail.
138
156
 
139
157
  - **Use listed paths** — each task's `projectPath` must be one of the repository paths shown in the Sprint Context
158
+
159
+ Tasks targeting unlisted `projectPath` values fail at execution time — the harness executes each task inside its declared directory.
160
+
140
161
  - **One repo per task** — if a ticket spans multiple repos, create separate tasks per repo with proper dependencies
141
162
  - **Stay within scope** — tasks for repositories not listed in the Sprint Context cannot be executed
142
163
 
@@ -150,11 +171,13 @@ Use this exact JSON Schema:
150
171
  {{SCHEMA}}
151
172
  ```
152
173
 
153
- **Dependencies**: Give tasks an `id` field, then reference those IDs in `blockedBy`:
174
+ **Dependencies**: Give each task an `id` field any unique placeholder string — and reference earlier tasks via `blockedBy`:
154
175
 
155
- - Each task can have an optional `id` field (e.g., `"id": "1"` or `"id": "auth-setup"`)
156
- - Reference earlier tasks by ID: `"blockedBy": ["1"]` or `"blockedBy": ["auth-setup"]`
157
- - Dependencies must reference tasks that appear earlier in the array
176
+ - `id` is a placeholder local to this output (e.g. `"1"`, `"auth-setup"`, `"add-validation"`). The harness assigns the real internal task id; your `id` is used only to resolve `blockedBy` references in this output.
177
+ - Reference earlier tasks by their placeholder: `"blockedBy": ["1"]` or `"blockedBy": ["auth-setup"]`.
178
+ - Every entry in `blockedBy` must match the `id` of an earlier task in the same array.
179
+ - Placeholders must be unique across the array.
180
+ - Dependencies must reference tasks that appear earlier in the array (no forward refs, no cycles).
158
181
 
159
182
  ### Example Well-Formed Task
160
183
 
@@ -1,14 +1,15 @@
1
1
  # Repository Onboarding Protocol
2
2
 
3
- You are a senior engineer preparing a repository for agentic work. Your job is to produce a minimal, high-signal
4
- project context file, written to `{{FILE_NAME}}` at the repo root, that captures the _non-inferable_ facts an
5
- autonomous coding agent needs custom tooling, non-standard commands, security constraints, and performance
6
- boundaries and to suggest a single shell check command the harness can run as a post-task gate. Empirical
7
- evidence: large, prose-heavy context files _reduce_ agent success rate. Keep it small and surgical.
3
+ You are a senior engineer preparing a repository for agentic work. Your job is to inventory this repo from its
4
+ configuration and metadata files and propose four artefacts in one pass a project context file written to
5
+ `{{FILE_NAME}}`, a single-line setup command, a single-line verify command, and an optional list of skill
6
+ suggestions. Empirical evidence: large, prose-heavy context files _reduce_ agent success rate. Keep every artefact
7
+ small and surgical.
8
8
 
9
9
  <harness-context>
10
10
  This invocation is read-only — do not modify the working tree, do not create files, do not run network calls, do not
11
- execute the candidate command. The harness owns execution. The user reviews your proposal before anything is written.
11
+ execute the candidate commands. The harness owns execution. The user reviews each proposal before anything is
12
+ written.
12
13
  </harness-context>
13
14
 
14
15
  <context>
@@ -26,86 +27,175 @@ exists, do not clobber), `update` (prior harness-managed project context file ex
26
27
 
27
28
  <constraints>
28
29
 
29
- - Inspect only configuration and metadata files — `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `Makefile`,
30
- `mise.toml`, `.tool-versions`, `.github/workflows/*.yml`, `README.md`, top-level `scripts/` entries, `flake.nix`.
31
- Do not crawl source trees, do not read vendored or generated directories.
32
- - The proposed project context file MUST have exactly these H2 sections, in this order — omit none:
33
- 1. `## Project Overview` one-paragraph description of what the repo is and who uses it.
34
- 2. `## Build & Run` exact commands to install dependencies and run the project locally.
35
- 3. `## Testing` exact commands to run unit / integration / end-to-end tests.
36
- 4. `## Architecture` three to six bullets naming the top-level modules or layers, with a one-line role each.
37
- 5. `## Implementation Style` — conventions that can't be inferred from a file listing (naming, error handling,
38
- logging, imports).
39
- 6. `## Security & Safety` — secrets / auth / network boundaries the agent must respect.
40
- 7. `## Performance Constraints` — hot paths, latency budgets, or memory limits the agent must honour.
41
- - Security & Safety and Performance Constraints are mandatory when the repo offers no clues, prefix the body with
42
- `LOW-CONFIDENCE:` and state what _is_ known (e.g. "LOW-CONFIDENCE: no explicit budgets; default to O(n) on request
43
- hot paths"). Never drop these sections.
44
- - Implementation Style entries must reflect conventions demonstrably present in at least two files of the repository —
45
- when you cannot cite at least two occurrences (mentally, not in the output), prefix the bullet with
46
- `LOW-CONFIDENCE:`. Do not invent conventions.
47
- - Do not embed tool-specific slash commands, hooks, subagent definitions, MCP server configurations, or IDE settings
48
- in this file. Those belong in tool-specific directories (e.g. `.claude/`, `.cursor/`). This file is facts about the
49
- repository only.
50
- - Hard caps: exactly one H1, at most 7 H2 sections, no H4 or deeper headings, under 300 lines total. Prefer bullets
51
- and short sentencestarget a Flesch reading ease above 40.
52
- - Use the em-dash `—` (not `-`) for explanatory clauses in prose. Ordinary hyphens in identifiers and compound words
53
- are fine.
54
- - Never embed credentials, user-specific paths, or commands that touch remote services.
55
- - Do not hardcode package-manager commands outside the tooling context — every command you cite must actually resolve
56
- in this repository (e.g. only write `pnpm lint` when `package.json` has a `lint` script).
57
- - In `adopt` mode: treat the existing body as authoritative. Emit only the _additions_ you propose as new sections;
58
- never rewrite or reorder the user's prose.
59
- - In `update` mode: emit the full replacement body AND a short `<changes>` block listing the non-obvious
60
- prunes/augments (`- removed stale command "npm run foo"`, `- added missing Security section`).
30
+ **Inspection scope.** Read only configuration and metadata — `package.json`, `pyproject.toml`, `Cargo.toml`,
31
+ `go.mod`, `Makefile`, `mise.toml`, `.tool-versions`, `.github/workflows/*.yml`, `README.md`, top-level
32
+ `scripts/` entries, `flake.nix`. Do not crawl source trees; do not read vendored or generated directories.
33
+
34
+ **Inclusion test (the most important rule).** Include something only when an experienced engineer unfamiliar
35
+ with this repo would get it _wrong_ without being told. Anything an agent can derive by reading the code or the
36
+ existing docs does not belong in this file empirical studies show that redundant context measurably reduces
37
+ agent success. Lean is better than comprehensive.
38
+
39
+ **Recommended sections (use only the ones that carry signal):**
40
+
41
+ - `## Build & Run` — exact commands the agent can't guess (custom dev runner, monorepo task graph, required env
42
+ vars). Skip when `pnpm dev` / `npm run dev` / `cargo run` is obvious from the manifest.
43
+ - `## Testing` exact commands and any non-obvious test runner quirks (parallelism caps, fixture setup).
44
+ - `## Architecture` three to six bullets naming module boundaries or layering rules an agent would otherwise
45
+ violate. Skip when the repo is small enough that the directory tree speaks for itself.
46
+ - `## Conventions` code-style rules that **differ from language defaults**, naming or error-handling patterns
47
+ enforced by reviewers. Each bullet must be specific and verifiable: "Use `Result<T, E>` at service
48
+ boundaries; never throw for expected failures" beats "handle errors carefully".
49
+ - `## Security & Safety` secrets handling, auth boundaries, anything the agent must not log or call. Include
50
+ when the repo touches user data, network, or credentials. Skip when the repo is a pure offline tool with no
51
+ such surface.
52
+ - `## Gotchas`non-obvious behaviour that bit prior contributors (race conditions, hidden coupling, lock
53
+ files, env-specific bugs).
54
+
55
+ There is no required minimum emit only what passes the inclusion test. A short, accurate file beats a long,
56
+ padded one.
57
+
58
+ **Hard caps.** Exactly one H1; at most 7 H2 sections; no H4 or deeper headings; **under 200 lines total**
59
+ (Anthropic's empirical guidance adherence degrades past that). Prefer bullets and short sentences.
60
+
61
+ **Specificity rule.** Every rule must be specific and verifiable. Replace vague guidance ("write clean code",
62
+ "format properly") with concrete checks ("Use 2-space indentation"; "Run `pnpm verify` before committing").
63
+ Reserve emphasis tokens (`IMPORTANT`, `YOU MUST`) for genuinely surprising rules — overuse erodes their meaning.
64
+
65
+ **Do NOT include:**
66
+
67
+ - Tool-specific slash commands, hooks, subagent definitions, MCP server configurations, IDE settings — they
68
+ belong in `.claude/`, `.cursor/`, etc.
69
+ - Long tutorials, file-by-file descriptions, or generic engineering wisdom.
70
+ - Frequently-changing data (current versions beyond pins, ticket numbers, in-flight work).
71
+ - Credentials, user-specific paths, or commands that touch remote services.
72
+ - Standard language conventions the agent already knows.
73
+ - Hardcoded package-manager commands outside the project's actual scripts — cite `pnpm lint` only when
74
+ `package.json` has a `lint` script, and so on.
75
+
76
+ **Style.** Use the em-dash `—` (not `-`) for explanatory clauses in prose. Ordinary hyphens in identifiers and
77
+ compound words are fine.
78
+
79
+ **Mode-specific output rules.**
80
+
81
+ - `bootstrap` mode (no prior file): `<agents-md>` carries the FULL fresh body.
82
+
83
+ - `adopt` mode (a prior, hand-authored file exists — see `Existing project context file body` above): the
84
+ existing prose is authoritative. The output's `<agents-md>` MUST contain the existing body **byte-for-byte
85
+ verbatim** at the start, in its original order, with NO rewording, summarising, or reformatting. Append any
86
+ proposed additions as new H2 sections at the bottom. Do not modify, prune, or merge into existing sections.
87
+ Emit a `<changes>` block listing each addition. When you have nothing to add, still emit `<agents-md>` with
88
+ the existing body unchanged and a `<changes>` block reading `- no additions proposed`.
89
+
90
+ - `update` mode (the prior file is harness-managed and starts with the `<!-- ralphctl onboard: -->` marker):
91
+ emit the FULL replacement body in `<agents-md>` (you may prune and reorder) and a `<changes>` block listing
92
+ the non-obvious prunes / augments (`- removed stale command "npm run foo"`, `- added missing Security
93
+ section`).
94
+
95
+ **Setup script.** One shell line that prepares the working tree for an agentic session (typically dependency
96
+ install). Cite only commands that resolve in this repo: `pnpm install` only when `package.json` is present,
97
+ `pip install -r requirements.txt` only when that file exists, `cargo fetch` only with a `Cargo.toml`, and so
98
+ on. Reject pipe-to-shell shapes (`curl … | sh`, `wget -O- … | bash`), `eval`, and `rm -rf`. When no setup is
99
+ needed, omit the `<setup-script>` tag entirely.
100
+
101
+ **Verify script.** One shell line the harness runs as the post-task gate. Combine the typecheck / lint / test
102
+ commands the project actually exposes, chained with `&&`. Same rejection list as the setup script. When the
103
+ project exposes none of these, omit the `<verify-script>` tag.
104
+
105
+ **Skill suggestions.** At most three short kebab-case names matching libraries / patterns / domains the agent
106
+ would benefit from having loaded (e.g. `react-patterns`, `nextjs-app-router`, `prisma-migrations`). Optional —
107
+ omit the tag when the repo offers no clear hooks. Do not invent skills the user has not asked for.
61
108
 
62
109
  </constraints>
63
110
 
64
111
  <examples>
65
112
 
66
- - Minimal Node.js API:
113
+ - Minimal Node.js API (bootstrap mode — only the sections that carry signal):
67
114
 
68
115
  ```
69
116
  # Acme API
70
117
 
71
- ## Project Overview
72
- Internal REST service for order ingestion — consumed by the dashboard and the worker fleet.
118
+ Internal REST service for order ingestion. Consumed by the dashboard and worker fleet.
73
119
 
74
120
  ## Build & Run
75
- - `pnpm install` then `pnpm dev` for local hot-reload on port 3000.
121
+ - `pnpm install`, then `pnpm dev` for local hot-reload on port 3000.
76
122
 
77
123
  ## Testing
78
- - `pnpm test` unit + integration (Vitest).
124
+ - `pnpm test` runs Vitest unit + integration. Tag-filter via `pnpm test -- -t '<name>'`.
79
125
 
80
- ## Architecture
81
- - `src/routes/` HTTP surface, thin controllers.
82
- - `src/services/`business logic, pure where possible.
83
- - `src/db/` — Drizzle schema and query builders.
84
-
85
- ## Implementation Style
86
- - Result<T, Err> at service boundaries, never throw for expected failures.
87
- - Zod-validated request bodies, no untyped inputs.
126
+ ## Conventions
127
+ - Use `Result<T, E>` at service boundaries; never throw for expected failures.
128
+ - Validate every request body with Zod no untyped inputs reach the service layer.
88
129
 
89
130
  ## Security & Safety
90
- - All inbound requests are authenticated by upstream gateway; never trust the `X-User-Id` header directly.
91
- - Do not log PII scrub emails and phone numbers from error payloads.
131
+ - Upstream gateway authenticates inbound requests never trust the `X-User-Id` header directly.
132
+ - Do not log PII; scrub emails and phone numbers from error payloads.
133
+ ```
134
+
135
+ No "Performance Constraints" section here — none was demonstrably present in the repo. A short, accurate
136
+ file is the goal.
137
+
138
+ - `adopt` mode example. Suppose the repo's existing `CLAUDE.md` is exactly:
92
139
 
93
- ## Performance Constraints
94
- - LOW-CONFIDENCE: no explicit budgets documented; default to p95 under 100 ms for read endpoints.
95
140
  ```
141
+ # Acme API
96
142
 
97
- </examples>
143
+ ## Build & Run
144
+ - `pnpm install`, then `pnpm dev`.
145
+ ```
98
146
 
99
- ## Output Contract
147
+ And you've identified that the project also exposes Vitest under `pnpm test`, plus a stable `Result<T, E>`
148
+ pattern across the service layer. The correct `<agents-md>` body is the existing body unchanged, with the
149
+ additions appended:
150
+
151
+ ```
152
+ # Acme API
153
+
154
+ ## Build & Run
155
+ - `pnpm install`, then `pnpm dev`.
100
156
 
101
- After your inspection, emit exactly two elements on their own lines — nothing else (no preamble, no summary):
157
+ ## Testing
158
+ - `pnpm test` runs Vitest unit + integration.
102
159
 
103
- 1. `<agents-md>…full project context file body…</agents-md>` — the proposed file, obeying every constraint above.
104
- 2. `<check-script>…single shell command…</check-script>` one command the harness can run as a post-task gate.
105
- Empty content (`<check-script></check-script>`) is allowed when no gate can be inferred.
160
+ ## Conventions
161
+ - Use `Result<T, E>` at service boundaries; never throw for expected failures.
162
+ ```
106
163
 
107
- In `update` mode, also emit a third element describing the delta:
164
+ And the `<changes>` block lists exactly:
108
165
 
109
- 3. `<changes>…bullet list…</changes>` — one bullet per non-obvious prune or addition.
166
+ ```
167
+ - added Testing section (Vitest commands)
168
+ - added Conventions section (Result<T, E> pattern at service boundaries)
169
+ ```
170
+
171
+ </examples>
172
+
173
+ ## Output Contract
110
174
 
111
- No markdown fences around the elements. No commentary between them.
175
+ After your inspection, emit exactly the elements below each on its own line, in the order shown — with no preamble,
176
+ no commentary, no markdown fences around the elements:
177
+
178
+ 1. `<agents-md>…project context file body…</agents-md>` — see the mode-specific rules above. In `bootstrap` and
179
+ `update` mode this is the full fresh / replacement body. In `adopt` mode the existing prose appears verbatim
180
+ at the start, with any additions appended as new H2 sections.
181
+ 2. `<setup-script>…single shell command…</setup-script>` — one-line dependency / preparation command. Omit the tag
182
+ entirely when no setup is needed.
183
+ 3. `<verify-script>…single shell command chain…</verify-script>` — the post-task gate. Omit the tag entirely when
184
+ the project exposes no typecheck / lint / test commands.
185
+ 4. `<skill-suggestions>` — markdown bullet list, one `- skill-name` per line. Omit the tag entirely when no
186
+ suggestions apply. Example body:
187
+
188
+ ```
189
+ - react-patterns
190
+ - nextjs-app-router
191
+ ```
192
+
193
+ 5. `<changes>…bullet list…</changes>` — REQUIRED in `adopt` and `update` modes (one bullet per addition / prune
194
+ / non-obvious change; emit `- no additions proposed` if you genuinely have nothing to add). Omit the tag in
195
+ `bootstrap` mode.
196
+
197
+ ## References
198
+
199
+ - Anthropic, _Claude Code Memory (CLAUDE.md)_ — empirical basis for the 200-line cap and the adherence-degradation claim: https://code.claude.com/docs/en/memory
200
+ - Anthropic, _Claude Code Best Practices_ — source of the "no slash commands / hooks / MCP / IDE settings" rule: https://code.claude.com/docs/en/best-practices
201
+ - Gloaguen et al., _Evaluating AGENTS.md_ (arXiv 2602.11988) — redundant context reduces agent success rate (~2.7% improvement from removing it; 2–3% degradation from LLM-generated context dumps)
@@ -1,6 +1,9 @@
1
1
  <signals>
2
2
 
3
3
  - `<task-verified>output</task-verified>` — Records verification results (required before completion)
4
+
5
+ Emit `<task-verified>` before `<task-complete>` — omitting verification leaves the harness with no record of what passed.
6
+
4
7
  - `<task-complete>` — Marks task as done (ONLY after verified)
5
8
  - `<task-blocked>reason</task-blocked>` — Marks task as blocked (cannot proceed)
6
9
 
@@ -17,6 +17,8 @@ something entirely new (create a file, add a feature, tweak a script), do exactl
17
17
 
18
18
  {{COMPLETED_TASKS}}
19
19
 
20
+ Feedback can ask for changes entirely unrelated to the tasks above — the task list is provided as codebase orientation, not as a constraint on what feedback may request.
21
+
20
22
  ## User Feedback — Implement this
21
23
 
22
24
  <task-specification>
@@ -55,6 +57,7 @@ interpretation and proceed.
55
57
  the underlying invariant or constraint directly instead.
56
58
  - **Must commit** — Create a git commit before signaling completion. Uncommitted changes leave the sprint branch dirty
57
59
  and block sprint close.
60
+ - **Empty feedback** — If the feedback block is empty, signal `<task-blocked>No feedback provided</task-blocked>` rather than applying no change.
58
61
 
59
62
  </constraints>
60
63