ralphctl 0.4.1 → 0.4.3

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 (36) hide show
  1. package/README.md +13 -11
  2. package/dist/{add-CIM72NE3.mjs → add-MG26JWBP.mjs} +6 -6
  3. package/dist/{add-GX7P7XTT.mjs → add-ZZYL4BSF.mjs} +5 -4
  4. package/dist/chunk-2FT37OZX.mjs +1071 -0
  5. package/dist/{chunk-CTP2A436.mjs → chunk-D2HWXEHH.mjs} +9 -2
  6. package/dist/{chunk-JOQO4HMM.mjs → chunk-EGUFQNRB.mjs} +10 -10
  7. package/dist/{chunk-3HJNVQ7N.mjs → chunk-LCY32RW4.mjs} +621 -976
  8. package/dist/{chunk-NUYQK5MN.mjs → chunk-LDSG7G2T.mjs} +1 -1
  9. package/dist/{chunk-7JLZQICD.mjs → chunk-MDE6KPJQ.mjs} +6 -6
  10. package/dist/{chunk-3QBEBKMZ.mjs → chunk-Q4AVHUZL.mjs} +7 -7
  11. package/dist/{chunk-YCDUVPRT.mjs → chunk-RQGD5WS6.mjs} +4 -72
  12. package/dist/{chunk-D2YGPLIV.mjs → chunk-TDBEEHTS.mjs} +213 -8
  13. package/dist/{chunk-SM4GGZSU.mjs → chunk-WOMGKKZY.mjs} +152 -179
  14. package/dist/{chunk-FKMKOWLA.mjs → chunk-WZTY77GY.mjs} +75 -1
  15. package/dist/cli.mjs +68 -19
  16. package/dist/{create-7WFSCMP4.mjs → create-PQK6KKRD.mjs} +5 -5
  17. package/dist/{handle-BBAZJ44Y.mjs → handle-SYVCFI6Y.mjs} +1 -1
  18. package/dist/{mount-2N6H5CWA.mjs → mount-2ANLHHQE.mjs} +556 -318
  19. package/dist/{project-2IE7VWDB.mjs → project-JF47ZWMF.mjs} +2 -2
  20. package/dist/prompts/check-script-discover.md +69 -0
  21. package/dist/prompts/ideate-auto.md +26 -1
  22. package/dist/prompts/ideate.md +5 -1
  23. package/dist/prompts/plan-auto.md +30 -2
  24. package/dist/prompts/plan-common-examples.md +82 -0
  25. package/dist/prompts/plan-common.md +26 -78
  26. package/dist/prompts/plan-interactive.md +6 -2
  27. package/dist/prompts/repo-onboard.md +111 -0
  28. package/dist/prompts/sprint-feedback.md +6 -2
  29. package/dist/prompts/task-evaluation.md +25 -10
  30. package/dist/prompts/task-execution.md +13 -13
  31. package/dist/prompts/ticket-refine.md +4 -0
  32. package/dist/prompts/validation-checklist.md +4 -0
  33. package/dist/{resolver-EOE5WUMV.mjs → resolver-PG2DZEBX.mjs} +3 -3
  34. package/dist/{sprint-OGOFEJJH.mjs → sprint-54DOSIJK.mjs} +3 -3
  35. package/dist/{start-IUDCXIEA.mjs → start-2SZTBKGF.mjs} +7 -5
  36. package/package.json +6 -6
@@ -11,8 +11,8 @@ import {
11
11
  removeProjectRepo,
12
12
  resolveRepoPath,
13
13
  updateProject
14
- } from "./chunk-NUYQK5MN.mjs";
15
- import "./chunk-CTP2A436.mjs";
14
+ } from "./chunk-LDSG7G2T.mjs";
15
+ import "./chunk-D2HWXEHH.mjs";
16
16
  import {
17
17
  ProjectExistsError,
18
18
  ProjectNotFoundError
@@ -0,0 +1,69 @@
1
+ # Check-Script Discovery Protocol
2
+
3
+ You are a build-system analyst. Inspect the repository at the path below and propose a single shell command that the
4
+ harness can run after every AI task to verify the working tree still passes the project's own quality gates (typecheck
5
+ / lint / tests / build — whatever the project considers "green"). Static ecosystem detection has already returned
6
+ nothing useful, which usually means the project is polyglot, custom, or uses an uncommon build tool.
7
+
8
+ <harness-context>
9
+ This invocation is read-only — do not modify the working tree, do not create files, do not run network calls, do not
10
+ execute the candidate command. The harness owns execution; your only job is to read configuration files and produce a
11
+ recommendation. The user will see your suggestion as an editable default and can accept, modify, or discard it.
12
+ </harness-context>
13
+
14
+ <context>
15
+
16
+ **Repository path:** `{{REPO_PATH}}`
17
+
18
+ </context>
19
+
20
+ <constraints>
21
+
22
+ - Inspect only the files explicitly listed below — do not crawl the entire tree, do not open source files, do not read
23
+ vendored or generated directories
24
+ - Prefer commands that exit non-zero on failure and zero on success — that is the contract the harness relies on to
25
+ decide whether a task passes the post-task gate
26
+ - Combine multiple gates with `&&` so the first failure aborts the chain — example shape: `<install> && <typecheck> &&
27
+ <lint> && <test>` (substitute the project's actual tools)
28
+ - If you find a single canonical entry point — a `Makefile` target like `make check`, a `mise` task, or a top-level
29
+ script in `scripts/` — prefer that over reconstructing the chain by hand
30
+ - Never embed credentials, environment-specific paths, or commands that touch remote services
31
+ - Output exactly one `<check-script>` block, on its own line, containing the bare command (no markdown fences, no
32
+ surrounding prose)
33
+ - If the repo contains nothing actionable, emit `<check-script></check-script>` with empty content — the harness will
34
+ treat that as "no check script" and fall through to manual entry
35
+
36
+ </constraints>
37
+
38
+ <examples>
39
+
40
+ - Polyglot Node + Python:
41
+ `<check-script>pnpm install && pnpm typecheck && pnpm test && uv run pytest</check-script>`
42
+ - Makefile-driven:
43
+ `<check-script>make check</check-script>`
44
+ - mise tasks:
45
+ `<check-script>mise run ci</check-script>`
46
+ - Bare scripts directory:
47
+ `<check-script>./scripts/verify.sh</check-script>`
48
+
49
+ </examples>
50
+
51
+ ## Files to Inspect
52
+
53
+ Read whichever of these exist; ignore the rest:
54
+
55
+ - `package.json` — `scripts` block (look for `test`, `typecheck`, `lint`, `check`, `ci`, `verify`)
56
+ - `pyproject.toml` — `[tool.poetry.scripts]`, `[tool.uv]`, `[tool.hatch]`, `[project.scripts]`
57
+ - `Makefile` — top-level targets (`check`, `test`, `ci`, `verify`, `all`)
58
+ - `mise.toml` / `.mise.toml` — `[tasks]` block
59
+ - `.tool-versions` — runtime hints only; combine with the above
60
+ - `.github/workflows/*.yml` — CI definitions are the most authoritative source of "what passes"
61
+ - `README.md` — explicit "running tests" / "development" sections, if present
62
+ - `flake.nix` — `apps`, `checks`, `devShells.default.shellHook`
63
+ - `WORKSPACE` / `BUILD` — Bazel target conventions (`bazel test //...`)
64
+ - `scripts/` — top-level entries only (do not recurse); look for `check`, `verify`, `ci`, `test`
65
+
66
+ ## Output Contract
67
+
68
+ After your inspection, emit a single `<check-script>…</check-script>` element on its own line. Nothing else — no
69
+ preamble, no explanation, no markdown. The harness parses the first match with a strict regex.
@@ -11,6 +11,27 @@ When finished, emit a signal from the `<signals>` block below.
11
11
 
12
12
  ## Two-Phase Protocol
13
13
 
14
+ ### Phase 0: Think Before Writing
15
+
16
+ Before emitting any JSON, write your reasoning in a `<thinking>…</thinking>` block. Use it to interrogate the idea —
17
+ surface hidden assumptions, identify the real user problem, sketch requirements, and reason about which repositories
18
+ and dependencies the work touches. Explicit reasoning produces sharper output than jumping straight to JSON.
19
+
20
+ The harness's JSON extractor skips everything before the first `{`, so the `<thinking>` block is stripped
21
+ automatically — but the JSON object itself must still be emitted without markdown fences or commentary after it.
22
+
23
+ ```
24
+ <thinking>
25
+ The idea says "webhook notifications" but doesn't say which events. Reviewing the API, the natural candidates are
26
+ task-status transitions. Scope = status-change webhooks only; other event types are out of scope.
27
+ Acceptance: POST to configured URL with JSON payload on task status change; retries on 5xx.
28
+
29
+ </thinking>
30
+ {
31
+ … JSON object …
32
+ }
33
+ ```
34
+
14
35
  ### Phase 1: Refine Requirements (WHAT)
15
36
 
16
37
  Analyze the idea and produce complete, implementation-agnostic requirements:
@@ -87,6 +108,8 @@ If you cannot produce a valid plan, signal the issue instead of outputting incom
87
108
 
88
109
  - `<planning-blocked>reason</planning-blocked>`
89
110
 
111
+ <context>
112
+
90
113
  ## Idea to Implement
91
114
 
92
115
  **Title:** {{IDEA_TITLE}}
@@ -107,6 +130,8 @@ You have access to these repositories:
107
130
 
108
131
  {{COMMON}}
109
132
 
133
+ </context>
134
+
110
135
  {{VALIDATION}}
111
136
 
112
137
  ## Output Format
@@ -148,7 +173,7 @@ If you cannot produce a valid plan, output `<planning-blocked>reason</planning-b
148
173
  "Update src/repositories/export.ts findExports() to add WHERE clause for date filtering",
149
174
  "Add unit tests in src/schemas/__tests__/date-range.test.ts covering valid ranges, invalid formats, and reversed dates",
150
175
  "Add integration test in src/controllers/__tests__/export.test.ts for filtered and unfiltered queries",
151
- "Run pnpm typecheck && pnpm lint && pnpm test — all pass"
176
+ "{{CHECK_GATE_EXAMPLE}}"
152
177
  ],
153
178
  "verificationCriteria": [
154
179
  "TypeScript compiles with no errors",
@@ -118,6 +118,8 @@ Focus: Determine HOW to implement the approved requirements
118
118
 
119
119
  {{VALIDATION}}
120
120
 
121
+ <context>
122
+
121
123
  ## Idea to Refine and Plan
122
124
 
123
125
  **Title:** {{IDEA_TITLE}}
@@ -141,6 +143,8 @@ mention it as an observation.
141
143
 
142
144
  {{COMMON}}
143
145
 
146
+ </context>
147
+
144
148
  ## Output Format
145
149
 
146
150
  When BOTH phases are approved by the user, write the JSON to: {{OUTPUT_FILE}}
@@ -169,7 +173,7 @@ Use this exact JSON Schema:
169
173
  "Update ExportController.getExport() in src/controllers/export.ts to parse and validate date range params",
170
174
  "Add date range filtering to ExportRepository.findRecords() in src/repositories/export.ts",
171
175
  "Write tests in src/controllers/__tests__/export.test.ts for: no dates, valid range, invalid range, start > end",
172
- "Run pnpm typecheck && pnpm lint && pnpm test — all pass"
176
+ "{{CHECK_GATE_EXAMPLE}}"
173
177
  ],
174
178
  "verificationCriteria": [
175
179
  "TypeScript compiles with no errors",
@@ -12,6 +12,27 @@ When finished, emit a signal from the `<signals>` block below.
12
12
 
13
13
  ## Protocol
14
14
 
15
+ ### Step 0: Think Before Writing
16
+
17
+ Before emitting any JSON, write your reasoning in a `<thinking>…</thinking>` block. Use it to work through the problem
18
+ — map tickets to repositories, reason about dependencies, identify risks, and decide on task boundaries. Explicit
19
+ reasoning produces sharper plans than jumping straight to output.
20
+
21
+ The harness's JSON extractor skips everything before the first `[`, so the `<thinking>` block is stripped
22
+ automatically — but the JSON array itself must still be emitted without markdown fences or commentary after it.
23
+
24
+ ```
25
+ <thinking>
26
+ Ticket 1 touches both the API and the worker repo — split into two tasks with a blockedBy edge.
27
+ The shared schema change must land first so the worker can import it.
28
+ Verification criterion for the API task: a contract test against the new schema.
29
+
30
+ </thinking>
31
+ [
32
+ { … JSON array … }
33
+ ]
34
+ ```
35
+
15
36
  ### Step 1: Explore the Project
16
37
 
17
38
  Scope exploration to what will change the plan — read instruction files first, then only the specific files you need
@@ -55,10 +76,14 @@ The sprint contains:
55
76
  - **Existing Tasks**: Tasks from a previous planning run (your output replaces all existing tasks)
56
77
  - **Projects**: Each ticket belongs to a project which may have multiple repository paths
57
78
 
79
+ <context>
80
+
58
81
  {{CONTEXT}}
59
82
 
60
83
  {{COMMON}}
61
84
 
85
+ </context>
86
+
62
87
  ### Step 5: Handle Blockers
63
88
 
64
89
  If you cannot produce a valid task breakdown, signal the issue instead of outputting incomplete JSON:
@@ -73,6 +98,9 @@ If you cannot produce a valid task breakdown, signal the issue instead of output
73
98
 
74
99
  ## Output
75
100
 
101
+ Your output MAY begin with a `<thinking>…</thinking>` block — the harness's JSON extractor skips everything before the
102
+ first `[`. The JSON array itself must still be emitted without markdown fences or surrounding prose.
103
+
76
104
  Output only the JSON document matching the schema below — the harness parses your raw output directly as JSON, so emit
77
105
  it without markdown fences, commentary, or surrounding prose. If you cannot produce tasks, output a
78
106
  `<planning-blocked>` signal instead.
@@ -102,7 +130,7 @@ JSON Schema:
102
130
  "steps": [
103
131
  "Create src/utils/validation.ts with validateEmail(), validatePhone(), validateDateRange()",
104
132
  "Add corresponding unit tests in src/utils/__tests__/validation.test.ts covering valid inputs, invalid inputs, and edge cases (empty strings, unicode)",
105
- "Run pnpm typecheck && pnpm lint && pnpm test — all pass"
133
+ "{{CHECK_GATE_EXAMPLE}}"
106
134
  ],
107
135
  "verificationCriteria": [
108
136
  "TypeScript compiles with no errors",
@@ -123,7 +151,7 @@ JSON Schema:
123
151
  "Wire up validation from src/utils/validation.ts with inline error messages",
124
152
  "Add form submission handler that calls POST /api/users",
125
153
  "Write component tests in src/components/__tests__/RegistrationForm.test.ts for valid submission, validation errors, and API failure",
126
- "Run pnpm typecheck && pnpm lint && pnpm test — all pass"
154
+ "{{CHECK_GATE_EXAMPLE}}"
127
155
  ],
128
156
  "verificationCriteria": [
129
157
  "TypeScript compiles with no errors",
@@ -0,0 +1,82 @@
1
+ <examples>
2
+
3
+ The illustrations below are non-normative — they show good/bad shapes for the rules stated in `plan-common.md`. Use
4
+ them as calibration, not templates to copy literally.
5
+
6
+ ## Verification Criteria — good vs bad
7
+
8
+ > **Good criteria (verifiable, unambiguous):**
9
+ >
10
+ > - "TypeScript compiles with no errors"
11
+ > - "All existing tests pass plus new tests for the added feature"
12
+ > - "GET /api/users returns 200 with paginated user list"
13
+ > - "GET /api/users?page=-1 returns 400 with validation error"
14
+ > - "Component renders without console errors in browser"
15
+ > - "Playwright e2e: login flow completes without errors" _(UI tasks with Playwright configured)_
16
+
17
+ > **Bad criteria (vague, not independently verifiable):**
18
+ >
19
+ > - "Code is clean and well-structured"
20
+ > - "Error handling is appropriate"
21
+ > - "Performance is acceptable"
22
+
23
+ ## Dependency Graph — good vs bad
24
+
25
+ ### Good Dependency Graph
26
+
27
+ ```
28
+ Task 1: Add shared validation utilities (no deps)
29
+ Task 2: Implement user registration form (blockedBy: [1])
30
+ Task 3: Implement user profile editor (blockedBy: [1])
31
+ Task 4: Add form submission analytics (blockedBy: [2, 3])
32
+ ```
33
+
34
+ Tasks 2 and 3 run in parallel (both depend only on 1). Task 4 waits for both.
35
+
36
+ ### Bad Dependency Graph
37
+
38
+ ```
39
+ Task 1: Add validation utilities (no deps)
40
+ Task 2: Implement registration form (blockedBy: [1])
41
+ Task 3: Implement profile editor (blockedBy: [2]) <-- WRONG
42
+ Task 4: Add submission analytics (blockedBy: [3]) <-- WRONG
43
+ ```
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.
47
+
48
+ ## Precise Steps — good vs bad
49
+
50
+ Bad — vague steps that force the agent to guess:
51
+
52
+ ```json
53
+ {
54
+ "name": "Add user authentication",
55
+ "steps": ["Implement auth", "Add tests", "Update docs"]
56
+ }
57
+ ```
58
+
59
+ Good — precise steps with file paths and pattern references:
60
+
61
+ ```json
62
+ {
63
+ "name": "Add user authentication",
64
+ "projectPath": "/Users/dev/my-app",
65
+ "steps": [
66
+ "Create auth service in src/services/auth.ts with login(), logout(), getCurrentUser() — follow the pattern in src/services/user.ts for error handling and return types",
67
+ "Add AuthContext provider in src/contexts/AuthContext.tsx wrapping the app — follow existing ThemeContext pattern",
68
+ "Create useAuth hook in src/hooks/useAuth.ts exposing auth state and actions",
69
+ "Add ProtectedRoute wrapper component in src/components/ProtectedRoute.tsx",
70
+ "Write unit tests in src/services/__tests__/auth.test.ts — follow test patterns in src/services/__tests__/user.test.ts",
71
+ "{{CHECK_GATE_EXAMPLE}}"
72
+ ],
73
+ "verificationCriteria": [
74
+ "TypeScript compiles with no errors",
75
+ "All existing tests pass plus new auth tests",
76
+ "ProtectedRoute redirects unauthenticated users to /login",
77
+ "useAuth hook exposes isAuthenticated, user, login, and logout"
78
+ ]
79
+ }
80
+ ```
81
+
82
+ </examples>
@@ -1,17 +1,22 @@
1
1
  ## Project Resources
2
2
 
3
- Each repository may ship with project-specific instruction files at its root and a `.claude/` configuration directory.
4
- Read them during exploration and reference them throughout planning:
3
+ During exploration, check for project instruction files if present. Treat whichever files exist as authoritative for
4
+ that codebase; skip silently when absent.
5
+
6
+ **Instruction files (any ecosystem):**
7
+
8
+ - **`CLAUDE.md` / `AGENTS.md`** — when present: project-level rules, conventions, and persistent memory
9
+ - **`.github/copilot-instructions.md`** — when present: GitHub Copilot-specific repository instructions
10
+ - **`README.md`** and manifest files (`package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod`, `pom.xml`, …) — setup,
11
+ scripts, and dependencies
12
+
13
+ **Claude-specific configuration (only when the repo has a `.claude/` directory):**
5
14
 
6
- - **`CLAUDE.md` / `AGENTS.md`** — project-level rules, conventions, and persistent memory
7
- - **`.github/copilot-instructions.md`** — GitHub Copilot-specific repository instructions, when present
8
15
  - **`.mcp.json`** — MCP servers the project ships with (Playwright, database inspection, etc.)
9
16
  - **`.claude/agents/`** — subagent definitions for Task-tool delegation
10
17
  - **`.claude/skills/`** — custom skills invokable with the Skill tool for project-specific workflows
11
18
  - **`.claude/settings.json`** / **`.claude/settings.local.json`** — tool permissions, model preferences, hooks
12
19
 
13
- When repository instruction files exist, treat their instructions as authoritative for that codebase.
14
-
15
20
  ## What Makes a Great Task
16
21
 
17
22
  A great task can be picked up cold by an AI agent, implemented independently, and verified as done — by a _different_ AI
@@ -63,6 +68,8 @@ Right size (one task covering the full change):
63
68
 
64
69
  ### Verification Criteria (The Evaluator Contract)
65
70
 
71
+ _See the `<examples>` block at the end of this page for good/bad pairs._
72
+
66
73
  Every task must include a `verificationCriteria` array — these are the **done contract** between the generator (task
67
74
  executor) and the evaluator (independent reviewer). The evaluator grades each criterion as pass/fail across four
68
75
  floor dimensions: correctness, completeness, safety, and consistency. If ANY dimension fails, the task fails
@@ -86,21 +93,6 @@ Write criteria that are:
86
93
  - **Unambiguous** — two reviewers would agree on pass/fail
87
94
  - **Outcome-oriented** — describe WHAT is true when done, not HOW to get there
88
95
 
89
- > **Good criteria (verifiable, unambiguous):**
90
- >
91
- > - "TypeScript compiles with no errors"
92
- > - "All existing tests pass plus new tests for the added feature"
93
- > - "GET /api/users returns 200 with paginated user list"
94
- > - "GET /api/users?page=-1 returns 400 with validation error"
95
- > - "Component renders without console errors in browser"
96
- > - "Playwright e2e: login flow completes without errors" _(UI tasks with Playwright configured)_
97
-
98
- > **Bad criteria (vague, not independently verifiable):**
99
- >
100
- > - "Code is clean and well-structured"
101
- > - "Error handling is appropriate"
102
- > - "Performance is acceptable"
103
-
104
96
  Aim for 2-4 criteria per task. Include at least one criterion that is computationally checkable (test pass, type check,
105
97
  lint clean). For **UI/frontend tasks**, if the project has Playwright configured, add a browser-verifiable criterion —
106
98
  the evaluator will attempt visual verification using Playwright or browser tools when the project supports it.
@@ -108,7 +100,8 @@ the evaluator will attempt visual verification using Playwright or browser tools
108
100
  ### Guidelines
109
101
 
110
102
  1. **Outcome-oriented** — Each task delivers a testable result
111
- 2. **Merge create+use** — Never separate "create X" from "use X" — that is one task
103
+ 2. **Merge create+use** — Keep "create X" and "use X" in one task except when a stable contract makes them
104
+ independently testable (e.g. schema + migration lands first, consumer wiring lands after)
112
105
  3. **Let scope drive task count** — do not aim for a specific number. Fewer, larger coherent tasks beat many
113
106
  micro-tasks; split only when parallelism or a clean boundary justifies it
114
107
  4. **Merge serial chains** — If tasks only make sense when run in sequence, fold them into one task
@@ -134,6 +127,8 @@ the evaluator will attempt visual verification using Playwright or browser tools
134
127
 
135
128
  ## Dependency Graph
136
129
 
130
+ _See the `<examples>` block at the end of this page for good/bad pairs._
131
+
137
132
  Tasks execute in dependency order — foundations before dependents.
138
133
 
139
134
  ### Guidelines
@@ -143,29 +138,6 @@ Tasks execute in dependency order — foundations before dependents.
143
138
  3. **Maximize parallelism** — Only add `blockedBy` when there is a real code dependency
144
139
  4. **Validate the DAG** — No cycles; earlier tasks cannot depend on later ones
145
140
 
146
- ### Good Dependency Graph
147
-
148
- ```
149
- Task 1: Add shared validation utilities (no deps)
150
- Task 2: Implement user registration form (blockedBy: [1])
151
- Task 3: Implement user profile editor (blockedBy: [1])
152
- Task 4: Add form submission analytics (blockedBy: [2, 3])
153
- ```
154
-
155
- Tasks 2 and 3 run in parallel (both depend only on 1). Task 4 waits for both.
156
-
157
- ### Bad Dependency Graph
158
-
159
- ```
160
- Task 1: Add validation utilities (no deps)
161
- Task 2: Implement registration form (blockedBy: [1])
162
- Task 3: Implement profile editor (blockedBy: [2]) <-- WRONG
163
- Task 4: Add submission analytics (blockedBy: [3]) <-- WRONG
164
- ```
165
-
166
- Task 3 does not actually need Task 2 — it only needs Task 1. This creates a false serial chain that prevents parallel
167
- execution.
168
-
169
141
  **Dependency test**: For each `blockedBy` entry, ask: "Does this task literally use code produced by the blocker?" If
170
142
  not, remove the dependency.
171
143
 
@@ -177,10 +149,14 @@ Each task must specify which repository it executes in via `projectPath`:
177
149
  2. **Split by repo** — If a ticket affects multiple repos, create separate tasks per repo with dependencies
178
150
  3. **Use exact paths** — `projectPath` must be one of the absolute paths from the project's Repositories section
179
151
 
180
- Never create a task that modifies files in multiple repossplit it.
152
+ Split cross-repo work into one task per repo with `blockedBy`except when atomicity is genuinely required (a
153
+ single commit must land in both repos to avoid broken state), in which case flag the task and surface the need for
154
+ human coordination.
181
155
 
182
156
  ## Precise Step Declarations
183
157
 
158
+ _See the `<examples>` block at the end of this page for good/bad pairs._
159
+
184
160
  Every task must include explicit, actionable steps — the implementation checklist.
185
161
 
186
162
  ### Step Requirements
@@ -194,38 +170,6 @@ Every task must include explicit, actionable steps — the implementation checkl
194
170
  instruction files
195
171
  5. **No ambiguity** — Another developer should be able to follow steps without guessing
196
172
 
197
- Bad — vague steps that force the agent to guess:
198
-
199
- ```json
200
- {
201
- "name": "Add user authentication",
202
- "steps": ["Implement auth", "Add tests", "Update docs"]
203
- }
204
- ```
205
-
206
- Good — precise steps with file paths and pattern references:
207
-
208
- ```json
209
- {
210
- "name": "Add user authentication",
211
- "projectPath": "/Users/dev/my-app",
212
- "steps": [
213
- "Create auth service in src/services/auth.ts with login(), logout(), getCurrentUser() — follow the pattern in src/services/user.ts for error handling and return types",
214
- "Add AuthContext provider in src/contexts/AuthContext.tsx wrapping the app — follow existing ThemeContext pattern",
215
- "Create useAuth hook in src/hooks/useAuth.ts exposing auth state and actions",
216
- "Add ProtectedRoute wrapper component in src/components/ProtectedRoute.tsx",
217
- "Write unit tests in src/services/__tests__/auth.test.ts — follow test patterns in src/services/__tests__/user.test.ts",
218
- "Run pnpm typecheck && pnpm lint && pnpm test — all pass"
219
- ],
220
- "verificationCriteria": [
221
- "TypeScript compiles with no errors",
222
- "All existing tests pass plus new auth tests",
223
- "ProtectedRoute redirects unauthenticated users to /login",
224
- "useAuth hook exposes isAuthenticated, user, login, and logout"
225
- ]
226
- }
227
- ```
228
-
229
173
  Use actual file paths discovered during exploration. Reference the repository instruction files for verification
230
174
  commands.
231
175
 
@@ -234,6 +178,10 @@ commands.
234
178
  Start with an action verb (Add, Create, Update, Fix, Refactor, Remove, Migrate). Include the feature/concept, not files.
235
179
  Keep under 60 characters. Avoid vague verbs (Improve, Enhance, Handle).
236
180
 
181
+ See `<examples>` below for concrete good/bad pairs.
182
+
183
+ {{PLAN_COMMON_EXAMPLES}}
184
+
237
185
  ## Delegation to Available Tooling
238
186
 
239
187
  The "Project Tooling" section below (when present) lists subagents, skills, and MCP servers detected in the target
@@ -72,7 +72,7 @@ before the plan is finalized.
72
72
  **Steps:**
73
73
  1. Create src/utils/csvExport.ts with column formatters for date, number, and string types
74
74
  2. Add unit tests in src/utils/__tests__/csvExport.test.ts covering empty data, special characters, and large datasets
75
- 3. Run `pnpm typecheck && pnpm lint && pnpm test` — all pass
75
+ 3. Run the project's check/test/build gate — all pass
76
76
  ```
77
77
 
78
78
  2. **Show the dependency graph** — Make it obvious which tasks run in parallel vs sequentially, and why each dependency
@@ -123,10 +123,14 @@ The sprint contains:
123
123
  - **Existing Tasks**: Tasks from a previous planning run (your output replaces all existing tasks)
124
124
  - **Projects**: Each ticket belongs to a project which may have multiple repository paths
125
125
 
126
+ <context>
127
+
126
128
  {{CONTEXT}}
127
129
 
128
130
  {{COMMON}}
129
131
 
132
+ </context>
133
+
130
134
  ### Repository Assignment
131
135
 
132
136
  Repositories have been pre-selected by the user. Only create tasks targeting these repositories — the harness executes
@@ -166,7 +170,7 @@ Use this exact JSON Schema:
166
170
  "Update ExportController.getExport() in src/controllers/export.ts to parse and validate date range params",
167
171
  "Add date range filtering to ExportRepository.findRecords() in src/repositories/export.ts",
168
172
  "Write tests in src/controllers/__tests__/export.test.ts for: no dates, valid range, invalid range, start > end",
169
- "Run pnpm typecheck && pnpm lint && pnpm test — all pass"
173
+ "{{CHECK_GATE_EXAMPLE}}"
170
174
  ],
171
175
  "verificationCriteria": [
172
176
  "TypeScript compiles with no errors",
@@ -0,0 +1,111 @@
1
+ # Repository Onboarding Protocol
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.
8
+
9
+ <harness-context>
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.
12
+ </harness-context>
13
+
14
+ <context>
15
+
16
+ **Repository path:** `{{REPO_PATH}}`
17
+ **Target file:** `{{FILE_NAME}}` — the harness will write the body you emit to this path.
18
+ **Mode:** `{{MODE}}` — one of `bootstrap` (no prior project context file), `adopt` (authored project context file
19
+ exists, do not clobber), `update` (prior harness-managed project context file exists; propose a prune + augment).
20
+ **Project type hint:** `{{PROJECT_TYPE}}`
21
+ **Static check-script suggestion (may be empty):** `{{CHECK_SCRIPT_SUGGESTION}}`
22
+
23
+ {{EXISTING_AGENTS_MD}}
24
+
25
+ </context>
26
+
27
+ <constraints>
28
+
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 sentences — target 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`).
61
+
62
+ </constraints>
63
+
64
+ <examples>
65
+
66
+ - Minimal Node.js API:
67
+
68
+ ```
69
+ # Acme API
70
+
71
+ ## Project Overview
72
+ Internal REST service for order ingestion — consumed by the dashboard and the worker fleet.
73
+
74
+ ## Build & Run
75
+ - `pnpm install` then `pnpm dev` for local hot-reload on port 3000.
76
+
77
+ ## Testing
78
+ - `pnpm test` — unit + integration (Vitest).
79
+
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.
88
+
89
+ ## 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.
92
+
93
+ ## Performance Constraints
94
+ - LOW-CONFIDENCE: no explicit budgets documented; default to p95 under 100 ms for read endpoints.
95
+ ```
96
+
97
+ </examples>
98
+
99
+ ## Output Contract
100
+
101
+ After your inspection, emit exactly two elements on their own lines — nothing else (no preamble, no summary):
102
+
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.
106
+
107
+ In `update` mode, also emit a third element describing the delta:
108
+
109
+ 3. `<changes>…bullet list…</changes>` — one bullet per non-obvious prune or addition.
110
+
111
+ No markdown fences around the elements. No commentary between them.
@@ -19,16 +19,20 @@ something entirely new (create a file, add a feature, tweak a script), do exactl
19
19
 
20
20
  ## User Feedback — Implement this
21
21
 
22
+ <task-specification>
23
+
22
24
  {{FEEDBACK}}
23
25
 
26
+ </task-specification>
27
+
24
28
  ## Protocol
25
29
 
26
30
  1. **Parse the feedback as an instruction** — Identify the concrete change(s) requested. If it says "create X", create
27
31
  X. If it says "change Y", change Y. Do not ask for clarification unless the instruction is genuinely contradictory.
28
32
  2. **Implement the change** — Create or edit the files required to satisfy the feedback. Make the smallest change that
29
33
  fully carries out the instruction.
30
- 3. **Run verification** — If the project has a check script (e.g., `pnpm test`, `pnpm typecheck`), run it and confirm
31
- it passes. If no check script is configured, skip this step.
34
+ 3. **Run verification** — If the project has a check script (test, typecheck, lint, or build command), run it and
35
+ confirm it passes. If no check script is configured, skip this step.
32
36
  4. **Output verification results** — Wrap any verification output in `<task-verified>...</task-verified>`. If you
33
37
  skipped step 3, emit `<task-verified>no check script configured; change applied</task-verified>`.
34
38
  5. **Commit your work** — Stage the modified files and create a git commit with a descriptive message summarising the