pi-feature-dev 1.2.0 → 1.3.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.
- package/README.md +34 -6
- package/package.json +3 -2
- package/skills/plan-exec/SKILL.md +322 -0
- package/skills/plan-exec/references/agents/documentation.txt +55 -0
- package/skills/plan-exec/references/agents/implementation.txt +26 -0
- package/skills/plan-exec/references/agents/quality.txt +37 -0
- package/skills/plan-exec/references/agents/simplification.txt +54 -0
- package/skills/plan-exec/references/agents/smells.txt +43 -0
- package/skills/plan-exec/references/agents/testing.txt +51 -0
- package/skills/plan-exec/references/prompts/finalizer.md +57 -0
- package/skills/plan-exec/references/prompts/fixer.md +58 -0
- package/skills/plan-exec/references/prompts/progress-file.md +73 -0
- package/skills/plan-exec/references/prompts/review.md +104 -0
- package/skills/plan-exec/references/prompts/stats.md +82 -0
- package/skills/plan-exec/references/prompts/task.md +57 -0
- package/skills/plan-exec/scripts/append-progress.sh +23 -0
- package/skills/plan-exec/scripts/create-branch.sh +46 -0
- package/skills/plan-exec/scripts/detect-branch.sh +32 -0
- package/skills/plan-exec/scripts/init-progress.sh +24 -0
- package/skills/plan-exec/scripts/stage-and-commit.sh +21 -0
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# pi-feature-dev
|
|
2
2
|
|
|
3
|
-
Portable
|
|
3
|
+
Portable coding-agent workflows, packaged as Pi skills.
|
|
4
4
|
|
|
5
|
-
The skill describes a tool-agnostic process for non-trivial
|
|
5
|
+
The `feature-dev` skill describes a tool-agnostic process for non-trivial
|
|
6
|
+
feature work:
|
|
6
7
|
|
|
7
8
|
- clarify requirements before coding
|
|
8
9
|
- explore the existing codebase before design
|
|
@@ -13,6 +14,11 @@ The skill describes a tool-agnostic process for non-trivial feature work:
|
|
|
13
14
|
|
|
14
15
|
It does not require specific task-tracking, question, delegation, or review tools. If the current environment provides equivalent capabilities, use them; otherwise follow the same workflow directly in chat and with normal code tools.
|
|
15
16
|
|
|
17
|
+
The `plan-exec` skill executes implementation plan files task by task with
|
|
18
|
+
isolated workers, Git task commits, internal reviews, finalize, and a portable
|
|
19
|
+
run summary. It is portable across host agents that provide fresh-context
|
|
20
|
+
isolated workers and Git access.
|
|
21
|
+
|
|
16
22
|
## Install
|
|
17
23
|
|
|
18
24
|
From npm:
|
|
@@ -43,6 +49,14 @@ pi install -l ~/Projects/pi-feature-dev
|
|
|
43
49
|
|
|
44
50
|
No companion package is required. Optional Pi packages can improve specific parts of the workflow, such as progress tracking, structured choices, delegation, large-output handling, web/code research, or session coordination.
|
|
45
51
|
|
|
52
|
+
## Credits
|
|
53
|
+
|
|
54
|
+
The original Claude Code skills and workflows that informed these portable
|
|
55
|
+
versions came from:
|
|
56
|
+
|
|
57
|
+
- [umputun/cc-thingz](https://github.com/umputun/cc-thingz)
|
|
58
|
+
- [anthropics/claude-code feature-dev plugin](https://github.com/anthropics/claude-code/tree/main/plugins/feature-dev)
|
|
59
|
+
|
|
46
60
|
## Usage
|
|
47
61
|
|
|
48
62
|
Skill command in Pi:
|
|
@@ -59,11 +73,17 @@ Use feature-dev to implement API rate limiting.
|
|
|
59
73
|
|
|
60
74
|
The `skills/feature-dev/SKILL.md` file is portable markdown and can be adapted for other coding assistant environments.
|
|
61
75
|
|
|
62
|
-
|
|
76
|
+
Run a plan with `plan-exec`:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
/skill:plan-exec docs/plans/20260518-example.md
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This package is intentionally skill-only. It does not provide prompt template shortcuts; use `/skill:<name>` for explicit Pi invocation.
|
|
63
83
|
|
|
64
|
-
##
|
|
84
|
+
## Feature-dev workflow
|
|
65
85
|
|
|
66
|
-
The skill guides a coding assistant through a seven-phase process:
|
|
86
|
+
The `feature-dev` skill guides a coding assistant through a seven-phase process:
|
|
67
87
|
|
|
68
88
|
1. Discovery — understand the feature and establish lightweight progress tracking
|
|
69
89
|
2. Codebase exploration — inspect relevant code and patterns, optionally with read-only helper passes
|
|
@@ -79,7 +99,15 @@ The skill guides a coding assistant through a seven-phase process:
|
|
|
79
99
|
pi-feature-dev/
|
|
80
100
|
├── package.json
|
|
81
101
|
└── skills/
|
|
82
|
-
|
|
102
|
+
├── feature-dev/
|
|
103
|
+
│ └── SKILL.md
|
|
104
|
+
├── plan-exec/
|
|
105
|
+
│ ├── SKILL.md
|
|
106
|
+
│ ├── references/
|
|
107
|
+
│ └── scripts/
|
|
108
|
+
├── plan-make/
|
|
109
|
+
│ └── SKILL.md
|
|
110
|
+
└── plan-review/
|
|
83
111
|
└── SKILL.md
|
|
84
112
|
```
|
|
85
113
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-feature-dev",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Portable
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"description": "Portable coding-agent workflows packaged as skills.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"repository": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"feature-development",
|
|
20
|
+
"plan-execution",
|
|
20
21
|
"coding-assistants",
|
|
21
22
|
"workflow",
|
|
22
23
|
"skills"
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: plan-exec
|
|
3
|
+
description: Execute implementation plan files task by task with isolated workers, task commits, internal reviews, finalize, and a portable run summary.
|
|
4
|
+
compatibility: "Portable across coding assistant environments that support fresh-context isolated workers, repository file access, shell commands, and Git commits. If isolated workers are unavailable, stop instead of running inline."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Plan Exec
|
|
8
|
+
|
|
9
|
+
Execute a plan file one task section at a time. The main session is the
|
|
10
|
+
orchestrator. Implementation, fixing, finalization, and summary work happens in
|
|
11
|
+
fresh-context isolated workers.
|
|
12
|
+
|
|
13
|
+
This skill is agent-agnostic, but not lowest-common-denominator. It requires a
|
|
14
|
+
host agent that can launch isolated workers with repository access.
|
|
15
|
+
|
|
16
|
+
## Required Capabilities
|
|
17
|
+
|
|
18
|
+
Before starting, verify that the current host agent supports all required
|
|
19
|
+
capabilities:
|
|
20
|
+
|
|
21
|
+
- Read and edit files in the repository.
|
|
22
|
+
- Run shell commands in the repository.
|
|
23
|
+
- Launch fresh-context isolated workers.
|
|
24
|
+
- Give implementation and fixer workers write authority.
|
|
25
|
+
- Give review and summary workers read-only authority.
|
|
26
|
+
- Commit selected files with Git.
|
|
27
|
+
|
|
28
|
+
If any required capability is missing, stop and explain which capability is not
|
|
29
|
+
available. Do not perform implementation work in the main orchestrating session.
|
|
30
|
+
|
|
31
|
+
## Compatibility Boundaries
|
|
32
|
+
|
|
33
|
+
- Git only. Stop if the current directory is not inside a Git repository.
|
|
34
|
+
- In-place execution only. Do not create Git worktrees.
|
|
35
|
+
- No prompt overrides. Always use the bundled prompt and reviewer files shipped
|
|
36
|
+
inside this skill.
|
|
37
|
+
- No custom rules loading. Follow the host agent, user, and repository
|
|
38
|
+
instructions that are already in effect.
|
|
39
|
+
- No external review tools. All reviews are performed by isolated workers in the
|
|
40
|
+
current host agent.
|
|
41
|
+
- Do not push, open pull requests, or move the plan file unless the plan itself
|
|
42
|
+
explicitly requires it.
|
|
43
|
+
|
|
44
|
+
## Arguments
|
|
45
|
+
|
|
46
|
+
- Optional plan path. If omitted, choose from `docs/plans/`.
|
|
47
|
+
|
|
48
|
+
## Bundled Files
|
|
49
|
+
|
|
50
|
+
Set `PLAN_EXEC_ROOT` to the absolute path of the directory containing this
|
|
51
|
+
`SKILL.md`. Read bundled files directly from:
|
|
52
|
+
|
|
53
|
+
- `PLAN_EXEC_ROOT/references/prompts/task.md`
|
|
54
|
+
- `PLAN_EXEC_ROOT/references/prompts/review.md`
|
|
55
|
+
- `PLAN_EXEC_ROOT/references/prompts/fixer.md`
|
|
56
|
+
- `PLAN_EXEC_ROOT/references/prompts/finalizer.md`
|
|
57
|
+
- `PLAN_EXEC_ROOT/references/prompts/stats.md`
|
|
58
|
+
- `PLAN_EXEC_ROOT/references/agents/*.txt`
|
|
59
|
+
- `PLAN_EXEC_ROOT/scripts/*.sh`
|
|
60
|
+
|
|
61
|
+
After reading a bundled prompt, replace all placeholders before passing it to a
|
|
62
|
+
worker:
|
|
63
|
+
|
|
64
|
+
- `PLAN_FILE_PATH`
|
|
65
|
+
- `PROGRESS_FILE_PATH`
|
|
66
|
+
- `DEFAULT_BRANCH`
|
|
67
|
+
- `PLAN_EXEC_ROOT`
|
|
68
|
+
- `FINDINGS_LIST` when using the fixer prompt
|
|
69
|
+
- `REVIEW_PHASE` when using the review playbook
|
|
70
|
+
|
|
71
|
+
## Process
|
|
72
|
+
|
|
73
|
+
### Step 1. Resolve Plan File
|
|
74
|
+
|
|
75
|
+
If a plan path was provided, use it. Otherwise, list markdown files in
|
|
76
|
+
`docs/plans/`, excluding `docs/plans/completed/`.
|
|
77
|
+
|
|
78
|
+
- If exactly one plan is found, use it.
|
|
79
|
+
- If multiple plans are found, ask the user to choose one.
|
|
80
|
+
- If no plan is found, stop and ask for a plan path.
|
|
81
|
+
|
|
82
|
+
Read the plan file. Count all `### Task N:` and `### Iteration N:` sections so
|
|
83
|
+
the run has a visible scope.
|
|
84
|
+
|
|
85
|
+
Determine the default branch:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
bash PLAN_EXEC_ROOT/scripts/detect-branch.sh
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Capture the result as `DEFAULT_BRANCH`.
|
|
92
|
+
|
|
93
|
+
### Step 2. Create Or Update Progress Tracking
|
|
94
|
+
|
|
95
|
+
Use any host-provided task/progress UI when available. Otherwise keep a concise
|
|
96
|
+
checklist in chat. Track one item per plan task plus these fixed phases:
|
|
97
|
+
|
|
98
|
+
- Review phase 1: comprehensive and critical re-checks
|
|
99
|
+
- Review phase 2: code smells
|
|
100
|
+
- Review phase 3: critical only
|
|
101
|
+
- Finalize
|
|
102
|
+
- Run summary
|
|
103
|
+
|
|
104
|
+
### Step 3. Create Or Reuse Feature Branch
|
|
105
|
+
|
|
106
|
+
Run in the current checkout only. Do not create or enter a worktree.
|
|
107
|
+
|
|
108
|
+
Create a feature branch when currently on the default branch, or keep using the
|
|
109
|
+
current branch when already on a non-default branch:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
bash PLAN_EXEC_ROOT/scripts/create-branch.sh PLAN_FILE_PATH
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The script derives a branch name from the plan filename by stripping a leading
|
|
116
|
+
date prefix. Capture the branch name it prints.
|
|
117
|
+
|
|
118
|
+
### Step 4. Initialize Progress File
|
|
119
|
+
|
|
120
|
+
Create a progress file in `/tmp` using the plan filename stem, for example
|
|
121
|
+
`/tmp/progress-fix-issues.txt`:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
bash PLAN_EXEC_ROOT/scripts/init-progress.sh /tmp/progress-<plan-name>.txt PLAN_FILE_PATH <branch-name>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Report the full progress file path to the user.
|
|
128
|
+
|
|
129
|
+
After initialization, append only through:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
bash PLAN_EXEC_ROOT/scripts/append-progress.sh PROGRESS_FILE_PATH "message"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
or by piping multiline content into that script.
|
|
136
|
+
|
|
137
|
+
### Step 5. Task Loop
|
|
138
|
+
|
|
139
|
+
Repeat until no unchecked checkboxes remain in any `### Task N:` or
|
|
140
|
+
`### Iteration N:` section.
|
|
141
|
+
|
|
142
|
+
1. Re-read the plan file. Workers may have modified it.
|
|
143
|
+
2. Find the first task or iteration section containing `[ ]`.
|
|
144
|
+
3. If no such section exists, continue to review phase 1.
|
|
145
|
+
4. Announce the task to the user before launching the worker:
|
|
146
|
+
|
|
147
|
+
```text
|
|
148
|
+
--- Task N: <title> ---
|
|
149
|
+
- [ ] <unchecked item>
|
|
150
|
+
- [ ] <unchecked item>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
5. Spawn one isolated implementation worker with the bundled `task.md` prompt.
|
|
154
|
+
Substitute `PLAN_FILE_PATH`, `PROGRESS_FILE_PATH`, and `PLAN_EXEC_ROOT`.
|
|
155
|
+
6. After the worker returns, re-read the plan file and verify that the task
|
|
156
|
+
section has no remaining `[ ]` items.
|
|
157
|
+
7. If the task is complete, report `Task N completed` and continue.
|
|
158
|
+
8. If the task still has unchecked items, retry with a fresh isolated worker up
|
|
159
|
+
to `task_retries` times. Default `task_retries` is `1` if the host or user did
|
|
160
|
+
not configure it.
|
|
161
|
+
9. If all retries fail, stop and report the failure.
|
|
162
|
+
|
|
163
|
+
The only success signal is the plan file state. Do not rely on the worker's
|
|
164
|
+
final message alone.
|
|
165
|
+
|
|
166
|
+
Orchestrator constraints:
|
|
167
|
+
|
|
168
|
+
- Do not implement code yourself.
|
|
169
|
+
- Do not debug or fix worker failures yourself.
|
|
170
|
+
- If a worker leaves compiler errors, test failures, or incomplete checkboxes,
|
|
171
|
+
retry with a fresh worker and include the failure details in the prompt.
|
|
172
|
+
- Do not modify the plan file yourself; implementation workers own plan
|
|
173
|
+
checkbox updates.
|
|
174
|
+
|
|
175
|
+
Maximum task loop iterations: 50. If reached, stop and report the safety limit.
|
|
176
|
+
|
|
177
|
+
### Step 6. Review Phase 1 - Comprehensive Then Critical Re-Checks
|
|
178
|
+
|
|
179
|
+
Report:
|
|
180
|
+
|
|
181
|
+
```text
|
|
182
|
+
--- Review phase 1: comprehensive ---
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Loop up to `review_iterations` times. Default `review_iterations` is `5` if the
|
|
186
|
+
host or user did not configure it.
|
|
187
|
+
|
|
188
|
+
For iteration 1, use `REVIEW_PHASE=comprehensive` in the bundled `review.md`
|
|
189
|
+
playbook. It launches five read-only review workers:
|
|
190
|
+
|
|
191
|
+
- quality
|
|
192
|
+
- implementation
|
|
193
|
+
- testing
|
|
194
|
+
- simplification
|
|
195
|
+
- documentation
|
|
196
|
+
|
|
197
|
+
For iteration 2 and later, report:
|
|
198
|
+
|
|
199
|
+
```text
|
|
200
|
+
--- Review phase 1: critical re-check (iteration N) ---
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Use `REVIEW_PHASE=critical`. It launches two read-only review workers:
|
|
204
|
+
|
|
205
|
+
- quality
|
|
206
|
+
- implementation
|
|
207
|
+
|
|
208
|
+
Parallel review workers are preferred when the host supports parallel isolated
|
|
209
|
+
workers. If parallel launch is unavailable, run the review workers sequentially,
|
|
210
|
+
but they must still be isolated read-only workers.
|
|
211
|
+
|
|
212
|
+
Collect the complete output from all review workers. Do not summarize, filter,
|
|
213
|
+
verify, dismiss, or reclassify findings. Log the collected findings to the
|
|
214
|
+
progress file, then pass the full unedited finding list to a fixer worker using
|
|
215
|
+
the bundled `fixer.md` prompt.
|
|
216
|
+
|
|
217
|
+
If all review workers report no issues, report `Review phase 1: clean` and move
|
|
218
|
+
to review phase 2.
|
|
219
|
+
|
|
220
|
+
After the fixer returns, show its `FIXES:` section to the user, report
|
|
221
|
+
`Review phase 1: iteration N fixes applied`, and loop back for a re-check.
|
|
222
|
+
|
|
223
|
+
If `review_iterations` is reached with issues still found, report
|
|
224
|
+
`Review phase 1: max iterations reached, moving on` and continue.
|
|
225
|
+
|
|
226
|
+
### Step 7. Review Phase 2 - Code Smells
|
|
227
|
+
|
|
228
|
+
Report:
|
|
229
|
+
|
|
230
|
+
```text
|
|
231
|
+
--- Review phase 2: code smells analysis ---
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Run one read-only isolated worker with
|
|
235
|
+
`PLAN_EXEC_ROOT/references/agents/smells.txt`.
|
|
236
|
+
|
|
237
|
+
The smells worker must inspect the diff against `DEFAULT_BRANCH`, read changed
|
|
238
|
+
files for context, and report only problems.
|
|
239
|
+
|
|
240
|
+
If no issues are found, report `Smells analysis: clean` and continue.
|
|
241
|
+
|
|
242
|
+
If issues are found, log the full output to the progress file and launch a fixer
|
|
243
|
+
worker with the bundled `fixer.md` prompt. Pass the full smells output as
|
|
244
|
+
`FINDINGS_LIST`. Show the fixer's `FIXES:` section when it returns.
|
|
245
|
+
|
|
246
|
+
### Step 8. Review Phase 3 - Critical Only
|
|
247
|
+
|
|
248
|
+
Report:
|
|
249
|
+
|
|
250
|
+
```text
|
|
251
|
+
--- Review phase 3: critical/major only ---
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Use the bundled `review.md` playbook with `REVIEW_PHASE=critical` for one final
|
|
255
|
+
single pass. Launch the quality and implementation read-only workers. Pass any
|
|
256
|
+
critical or major findings to a fixer worker. Ignore minor findings in this
|
|
257
|
+
phase.
|
|
258
|
+
|
|
259
|
+
If neither worker reports critical or major findings, report
|
|
260
|
+
`Review phase 3: clean`.
|
|
261
|
+
|
|
262
|
+
### Step 9. Finalize
|
|
263
|
+
|
|
264
|
+
Check `finalize_enabled`. Default is `true` if the host or user did not
|
|
265
|
+
configure it. If false, skip this step.
|
|
266
|
+
|
|
267
|
+
Report:
|
|
268
|
+
|
|
269
|
+
```text
|
|
270
|
+
--- Finalize: rebase and clean up commits ---
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Spawn one isolated finalizer worker with the bundled `finalizer.md` prompt.
|
|
274
|
+
Substitute `DEFAULT_BRANCH`, `PLAN_FILE_PATH`, `PROGRESS_FILE_PATH`, and
|
|
275
|
+
`PLAN_EXEC_ROOT`.
|
|
276
|
+
|
|
277
|
+
Finalize is best-effort. If rebase or commit cleanup fails, the finalizer must
|
|
278
|
+
leave the branch in a coherent state and report the issue. Do not block the run
|
|
279
|
+
only because commit cleanup was not possible.
|
|
280
|
+
|
|
281
|
+
### Step 10. Portable Run Summary
|
|
282
|
+
|
|
283
|
+
Spawn one read-only isolated summary worker with the bundled `stats.md` prompt.
|
|
284
|
+
Substitute `DEFAULT_BRANCH`, `PLAN_FILE_PATH`, and `PROGRESS_FILE_PATH`.
|
|
285
|
+
|
|
286
|
+
The summary worker reads only the plan file, progress file, and Git state. It
|
|
287
|
+
must not read host-specific telemetry logs or token accounting files.
|
|
288
|
+
|
|
289
|
+
Show the summary worker's full markdown output to the user.
|
|
290
|
+
|
|
291
|
+
If the summary worker fails, report the failure but do not block completion.
|
|
292
|
+
|
|
293
|
+
### Step 11. Completion
|
|
294
|
+
|
|
295
|
+
Append completion to the progress file:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
bash PLAN_EXEC_ROOT/scripts/append-progress.sh PROGRESS_FILE_PATH "completed"
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Report:
|
|
302
|
+
|
|
303
|
+
```text
|
|
304
|
+
All N tasks completed, reviews passed, branch finalized
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
Do not push, create a pull request, or move the plan file unless the user or the
|
|
308
|
+
plan explicitly asked for that.
|
|
309
|
+
|
|
310
|
+
## Key Rules
|
|
311
|
+
|
|
312
|
+
- The main session is the orchestrator.
|
|
313
|
+
- Isolated workers do implementation, fixes, finalization, reviews, and summary.
|
|
314
|
+
- Each implementation worker handles exactly one task section.
|
|
315
|
+
- Each implementation or fixer worker must commit its own changes before
|
|
316
|
+
reporting success.
|
|
317
|
+
- The plan file is the source of truth for task completion.
|
|
318
|
+
- The progress file carries context between phases.
|
|
319
|
+
- Review findings are passed in full to fixer workers.
|
|
320
|
+
- All prompts come from the bundled prompt set.
|
|
321
|
+
- Git worktrees, prompt overrides, custom rules loading, Mercurial support, and
|
|
322
|
+
external review tools are out of scope.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Review code changes and identify missing documentation updates.
|
|
2
|
+
|
|
3
|
+
## README.md (Human Documentation)
|
|
4
|
+
|
|
5
|
+
Check if changes require README updates:
|
|
6
|
+
|
|
7
|
+
Must document:
|
|
8
|
+
- New features or capabilities
|
|
9
|
+
- New CLI flags or command-line options
|
|
10
|
+
- New API endpoints or interfaces
|
|
11
|
+
- New configuration options
|
|
12
|
+
- Changed behavior that affects users
|
|
13
|
+
- New dependencies or system requirements
|
|
14
|
+
- Breaking changes
|
|
15
|
+
|
|
16
|
+
Skip:
|
|
17
|
+
- Internal refactoring with no user-visible changes
|
|
18
|
+
- Bug fixes that restore documented behavior
|
|
19
|
+
- Test additions
|
|
20
|
+
- Code style changes
|
|
21
|
+
|
|
22
|
+
## Agent and Project Guidance
|
|
23
|
+
|
|
24
|
+
Check if changes require updates to repository guidance files such as AGENTS.md,
|
|
25
|
+
CLAUDE.md, CONTRIBUTING.md, developer docs, or local conventions docs:
|
|
26
|
+
|
|
27
|
+
Must document:
|
|
28
|
+
- New architectural patterns discovered/established
|
|
29
|
+
- New conventions or coding standards
|
|
30
|
+
- New build/test commands
|
|
31
|
+
- New libraries or tools integrated
|
|
32
|
+
- Project structure changes
|
|
33
|
+
- Workflow changes
|
|
34
|
+
- Non-obvious debugging techniques
|
|
35
|
+
|
|
36
|
+
Skip:
|
|
37
|
+
- Standard code additions following existing patterns
|
|
38
|
+
- Simple bug fixes
|
|
39
|
+
- Test additions using existing patterns
|
|
40
|
+
|
|
41
|
+
## Plan Files
|
|
42
|
+
|
|
43
|
+
If changes relate to an existing plan:
|
|
44
|
+
- Mark completed items as done
|
|
45
|
+
- Update plan status if needed
|
|
46
|
+
- Note which plan items this change addresses
|
|
47
|
+
|
|
48
|
+
## What to Report
|
|
49
|
+
|
|
50
|
+
For each gap:
|
|
51
|
+
- Missing: what needs to be documented
|
|
52
|
+
- Section: where in the documentation it should go
|
|
53
|
+
- Suggested content: draft text or outline
|
|
54
|
+
|
|
55
|
+
Report problems only - no positive observations.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Review whether the implementation achieves the stated goal/requirement.
|
|
2
|
+
|
|
3
|
+
## Core Review Responsibilities
|
|
4
|
+
|
|
5
|
+
1. Requirement coverage - does implementation address all aspects of the stated requirement? Are there edge cases or scenarios not handled?
|
|
6
|
+
|
|
7
|
+
2. Correctness of approach - is the chosen approach actually solving the right problem? Could it fail to achieve the goal in certain conditions?
|
|
8
|
+
|
|
9
|
+
3. Wiring and integration - is everything connected properly? Are new components registered, routes added, handlers wired, configs updated?
|
|
10
|
+
|
|
11
|
+
4. Completeness - are there missing pieces that would prevent the feature from working? Missing imports, unimplemented interfaces, incomplete migrations?
|
|
12
|
+
|
|
13
|
+
5. Logic flow - does data flow correctly from input to output? Are transformations correct? Is state managed properly?
|
|
14
|
+
|
|
15
|
+
6. Edge cases - are boundary conditions handled? Empty inputs, null values, concurrent access, error paths?
|
|
16
|
+
|
|
17
|
+
## What to Report
|
|
18
|
+
|
|
19
|
+
For each issue found:
|
|
20
|
+
- Issue: clear description of what's wrong
|
|
21
|
+
- Impact: how this prevents achieving the goal
|
|
22
|
+
- Location: file and line reference
|
|
23
|
+
- Fix: what needs to be added or changed
|
|
24
|
+
|
|
25
|
+
Focus on correctness of approach, not code style.
|
|
26
|
+
Report problems only - no positive observations.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Review code for bugs, security issues, and quality problems.
|
|
2
|
+
|
|
3
|
+
## Correctness Review
|
|
4
|
+
|
|
5
|
+
1. Logic errors - off-by-one errors, incorrect conditionals, wrong operators
|
|
6
|
+
2. Edge cases - empty inputs, nil/null values, boundary conditions, concurrent access
|
|
7
|
+
3. Error handling - all errors checked, appropriate error wrapping, no silent failures
|
|
8
|
+
4. Resource management - proper cleanup, no leaks, correct resource release
|
|
9
|
+
5. Concurrency issues - race conditions, deadlocks, thread/coroutine leaks
|
|
10
|
+
6. Data integrity - validation, sanitization, consistent state management
|
|
11
|
+
|
|
12
|
+
## Security Analysis
|
|
13
|
+
|
|
14
|
+
1. Input validation - all user inputs validated and sanitized
|
|
15
|
+
2. Authentication/authorization - proper checks in place
|
|
16
|
+
3. Injection vulnerabilities - SQL, command, path traversal
|
|
17
|
+
4. Secret exposure - no hardcoded credentials or keys
|
|
18
|
+
5. Information disclosure - error messages, logs, debug info
|
|
19
|
+
|
|
20
|
+
## Simplicity Assessment
|
|
21
|
+
|
|
22
|
+
1. Direct solutions first - if simple approach works, don't use complex pattern
|
|
23
|
+
2. No enterprise patterns for simple problems - avoid factories, builders for straightforward code
|
|
24
|
+
3. Question every abstraction - each interface/abstraction must solve real problem
|
|
25
|
+
4. No scope creep - changes solve only the stated problem
|
|
26
|
+
5. No premature optimization - unless addressing proven bottlenecks
|
|
27
|
+
|
|
28
|
+
## What to Report
|
|
29
|
+
|
|
30
|
+
For each issue:
|
|
31
|
+
- Location: exact file path and line number
|
|
32
|
+
- Issue: clear description
|
|
33
|
+
- Impact: how this affects the code
|
|
34
|
+
- Fix: specific suggestion
|
|
35
|
+
|
|
36
|
+
Focus on defects that would cause runtime failures, security vulnerabilities, or maintainability problems.
|
|
37
|
+
Report problems only - no positive observations.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Detect over-engineered and overcomplicated code - code that works but is more complex than necessary.
|
|
2
|
+
|
|
3
|
+
## Excessive Abstraction Layers
|
|
4
|
+
|
|
5
|
+
- Wrapper adds nothing - method just calls another method with same signature
|
|
6
|
+
- Factory for single implementation - factory pattern when only one concrete type exists
|
|
7
|
+
- Interface on producer side - interface defined where implemented, not where consumed
|
|
8
|
+
- Layer cake anti-pattern - handler -> service -> repository when each just passes through
|
|
9
|
+
- DTO/Mapper overkill - multiple types representing same data with conversion functions
|
|
10
|
+
|
|
11
|
+
## Premature Generalization
|
|
12
|
+
|
|
13
|
+
- Generic solution for specific problem - event bus for one event type
|
|
14
|
+
- Config objects for 2-3 options - options pattern when direct parameters suffice
|
|
15
|
+
- Plugin architecture for fixed functionality - extension points nothing extends
|
|
16
|
+
- Overloaded struct - one type handling all variations with many optional fields
|
|
17
|
+
|
|
18
|
+
## Unnecessary Indirection
|
|
19
|
+
|
|
20
|
+
- Pass-through wrappers - methods that only delegate to dependencies
|
|
21
|
+
- Excessive method chaining - builder pattern for simple constructions
|
|
22
|
+
- Interface wrapping primitives - custom types for standard library types
|
|
23
|
+
- Middleware stacking - multiple middlewares that could be one
|
|
24
|
+
|
|
25
|
+
## Future-Proofing Excess
|
|
26
|
+
|
|
27
|
+
- Unused extension points - hooks, callbacks, plugins with no callers
|
|
28
|
+
- Versioned internal APIs - v1/v2 when only one version used
|
|
29
|
+
- Feature flags for permanent decisions - flags always on/off
|
|
30
|
+
|
|
31
|
+
## Unnecessary Fallbacks
|
|
32
|
+
|
|
33
|
+
- Fallback that never triggers - default path conditions never met
|
|
34
|
+
- Legacy mode kept just in case - old code path always disabled
|
|
35
|
+
- Dual implementations - old + new logic when old has no callers
|
|
36
|
+
- Silent fallbacks hiding problems - catching errors and falling back instead of failing fast
|
|
37
|
+
|
|
38
|
+
## Premature Optimization
|
|
39
|
+
|
|
40
|
+
- Caching rarely-accessed data - cache for data read once at startup
|
|
41
|
+
- Custom data structures - complex structures when arrays/maps work
|
|
42
|
+
- Worker pools for occasional tasks - pooling for operations/hour
|
|
43
|
+
- Connection pooling overkill - complex pooling for single connection
|
|
44
|
+
|
|
45
|
+
## What to Report
|
|
46
|
+
|
|
47
|
+
For each finding:
|
|
48
|
+
- Location: file and line reference
|
|
49
|
+
- Pattern: which over-engineering pattern detected
|
|
50
|
+
- Problem: why this adds unnecessary complexity
|
|
51
|
+
- Simplification: what simpler code would look like
|
|
52
|
+
- Effort: trivial/small/medium/large
|
|
53
|
+
|
|
54
|
+
Report problems only - no positive observations.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
Review code for style consistency, convention adherence, and code smells.
|
|
2
|
+
|
|
3
|
+
## Project Convention Check
|
|
4
|
+
|
|
5
|
+
1. Read repository guidance files when present, such as AGENTS.md, CLAUDE.md, CONTRIBUTING.md, README.md, or local docs, to understand project rules
|
|
6
|
+
2. Read any documentation files referenced by those guidance files (coding standards, style guides)
|
|
7
|
+
3. Check if changed code follows the established conventions
|
|
8
|
+
|
|
9
|
+
## Style Consistency
|
|
10
|
+
|
|
11
|
+
1. Naming conventions - do new names follow the same patterns as existing code?
|
|
12
|
+
2. Code organization - is new code structured like existing code in the same package/module?
|
|
13
|
+
3. Import ordering - does it match the rest of the project?
|
|
14
|
+
4. Comment style - do comments follow project conventions?
|
|
15
|
+
5. Error handling patterns - does error handling match the project's established patterns?
|
|
16
|
+
6. Logging patterns - are log calls consistent with the rest of the codebase?
|
|
17
|
+
|
|
18
|
+
## Code Smells
|
|
19
|
+
|
|
20
|
+
1. Dead code - unused functions, variables, imports, parameters
|
|
21
|
+
2. Duplicated logic - copy-paste code that should be consolidated
|
|
22
|
+
3. Long functions - functions doing too many things
|
|
23
|
+
4. Deep nesting - excessive if/else or loop nesting
|
|
24
|
+
5. Magic numbers/strings - unexplained literal values
|
|
25
|
+
6. Inconsistent abstraction levels - mixing high and low level operations
|
|
26
|
+
|
|
27
|
+
## Anti-patterns
|
|
28
|
+
|
|
29
|
+
1. God objects - types with too many responsibilities
|
|
30
|
+
2. Shotgun surgery - one change requires touching many unrelated files
|
|
31
|
+
3. Feature envy - code that uses another module's data more than its own
|
|
32
|
+
4. Primitive obsession - using primitives where a domain type would be clearer
|
|
33
|
+
|
|
34
|
+
## What to Report
|
|
35
|
+
|
|
36
|
+
For each finding:
|
|
37
|
+
- Location: file and line reference
|
|
38
|
+
- Issue: what's inconsistent or smelly
|
|
39
|
+
- Convention: what the project convention is (cite CLAUDE.md or existing code as evidence)
|
|
40
|
+
- Fix: specific suggestion to align with conventions
|
|
41
|
+
|
|
42
|
+
Report problems only - no positive observations.
|
|
43
|
+
Focus on consistency with existing code, not personal preferences.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Review test coverage and quality.
|
|
2
|
+
|
|
3
|
+
## Test Existence and Coverage
|
|
4
|
+
|
|
5
|
+
1. Missing tests - new code paths without corresponding tests
|
|
6
|
+
2. Untested error paths - error conditions not verified
|
|
7
|
+
3. Coverage gaps - functions or branches without test coverage
|
|
8
|
+
4. Integration test needs - system boundaries requiring integration tests
|
|
9
|
+
|
|
10
|
+
## Test Quality
|
|
11
|
+
|
|
12
|
+
1. Tests verify behavior, not implementation details
|
|
13
|
+
2. Each test is independent, can run in any order
|
|
14
|
+
3. Descriptive test names that explain what is being tested
|
|
15
|
+
4. Both success and error paths tested
|
|
16
|
+
5. Edge cases and boundary conditions covered
|
|
17
|
+
|
|
18
|
+
## Fake Test Detection
|
|
19
|
+
|
|
20
|
+
Watch for tests that don't actually verify code:
|
|
21
|
+
- Tests that always pass regardless of code changes
|
|
22
|
+
- Tests checking hardcoded values instead of actual output
|
|
23
|
+
- Tests verifying mock behavior instead of code using the mock
|
|
24
|
+
- Ignored errors with _ or empty error checks
|
|
25
|
+
- Conditional assertions that always pass
|
|
26
|
+
- Commented out failing test cases
|
|
27
|
+
|
|
28
|
+
## Test Independence
|
|
29
|
+
|
|
30
|
+
1. No shared mutable state between tests
|
|
31
|
+
2. Proper setup and teardown
|
|
32
|
+
3. No order dependencies between tests
|
|
33
|
+
4. Resources properly cleaned up
|
|
34
|
+
|
|
35
|
+
## Edge Case Coverage
|
|
36
|
+
|
|
37
|
+
1. Empty inputs and collections
|
|
38
|
+
2. Null/nil values
|
|
39
|
+
3. Boundary values (zero, max, min)
|
|
40
|
+
4. Concurrent access scenarios
|
|
41
|
+
5. Timeout and cancellation handling
|
|
42
|
+
|
|
43
|
+
## What to Report
|
|
44
|
+
|
|
45
|
+
For each finding:
|
|
46
|
+
- Location: test file and function
|
|
47
|
+
- Issue: what's wrong with the test
|
|
48
|
+
- Impact: what bugs could slip through
|
|
49
|
+
- Fix: how to improve the test
|
|
50
|
+
|
|
51
|
+
Report problems only - no positive observations.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Finalizer worker prompt
|
|
2
|
+
|
|
3
|
+
Use this prompt after all reviews pass. Replace `DEFAULT_BRANCH`,
|
|
4
|
+
`PLAN_FILE_PATH`, `PROGRESS_FILE_PATH`, and `PLAN_EXEC_ROOT` before launch.
|
|
5
|
+
|
|
6
|
+
```text
|
|
7
|
+
Post-completion finalize step. Organize the branch for merge.
|
|
8
|
+
|
|
9
|
+
Plan file: PLAN_FILE_PATH
|
|
10
|
+
Default branch: DEFAULT_BRANCH
|
|
11
|
+
Progress file: PROGRESS_FILE_PATH
|
|
12
|
+
|
|
13
|
+
STEP 1 - REBASE:
|
|
14
|
+
- Run `git fetch origin`.
|
|
15
|
+
- If `origin/DEFAULT_BRANCH` exists, rebase onto it:
|
|
16
|
+
`git rebase origin/DEFAULT_BRANCH`
|
|
17
|
+
- Otherwise, rebase onto the local default branch:
|
|
18
|
+
`git rebase DEFAULT_BRANCH`
|
|
19
|
+
- If conflicts occur, resolve them and continue when safe.
|
|
20
|
+
- If rebase cannot be completed safely, abort with `git rebase --abort`, report
|
|
21
|
+
the issue, and continue to the report step.
|
|
22
|
+
|
|
23
|
+
STEP 2 - CLEAN UP COMMITS:
|
|
24
|
+
- Inspect commits with `git log --oneline DEFAULT_BRANCH..HEAD`.
|
|
25
|
+
- If there are 5 or more commits, squash related fix commits into their parent
|
|
26
|
+
feature commits when this can be done safely.
|
|
27
|
+
- Keep meaningful boundaries: feature task commits separate from review-fix
|
|
28
|
+
commits.
|
|
29
|
+
- If safe non-interactive cleanup is not practical, leave commits as-is and
|
|
30
|
+
report why.
|
|
31
|
+
|
|
32
|
+
STEP 3 - VERIFY:
|
|
33
|
+
- Run validation commands from the plan file.
|
|
34
|
+
- If the plan does not list exact commands, infer the narrowest relevant
|
|
35
|
+
validation commands from the repository.
|
|
36
|
+
- If validation fails, fix and re-run when the fix is clearly within scope.
|
|
37
|
+
|
|
38
|
+
STEP 4 - LOG PROGRESS:
|
|
39
|
+
- Append:
|
|
40
|
+
`bash PLAN_EXEC_ROOT/scripts/append-progress.sh PROGRESS_FILE_PATH "finalize: completed"`
|
|
41
|
+
- Then pipe details:
|
|
42
|
+
`printf '%s\n' "- rebase: <success/failed/skipped>" "- commits before: <N>, after: <M>" "- squashed: <list or none>" "- validation: <passed/failed>" | bash PLAN_EXEC_ROOT/scripts/append-progress.sh PROGRESS_FILE_PATH`
|
|
43
|
+
- Use only `append-progress.sh` for writing to the progress file.
|
|
44
|
+
|
|
45
|
+
STEP 5 - PLAN DEVIATION ANALYSIS:
|
|
46
|
+
- Read PROGRESS_FILE_PATH in full.
|
|
47
|
+
- Compare it against PLAN_FILE_PATH.
|
|
48
|
+
- Report deviations from the original plan, obstacles or blockers, incomplete
|
|
49
|
+
delivery, cut corners, or review findings that went beyond the original plan.
|
|
50
|
+
|
|
51
|
+
STEP 6 - REPORT:
|
|
52
|
+
Report what was done: number of commits before and after, whether rebase
|
|
53
|
+
succeeded, validation results, and plan deviation analysis.
|
|
54
|
+
|
|
55
|
+
This step is best-effort. If rebase or commit cleanup fails, explain why and
|
|
56
|
+
leave the branch in a coherent state.
|
|
57
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Fixer worker prompt
|
|
2
|
+
|
|
3
|
+
Use this prompt after collecting review findings. Replace `PLAN_FILE_PATH`,
|
|
4
|
+
`PROGRESS_FILE_PATH`, `PLAN_EXEC_ROOT`, and `FINDINGS_LIST` before launch.
|
|
5
|
+
|
|
6
|
+
```text
|
|
7
|
+
Code review found the following issues. Verify and fix them.
|
|
8
|
+
|
|
9
|
+
Plan file: PLAN_FILE_PATH
|
|
10
|
+
Progress file: PROGRESS_FILE_PATH
|
|
11
|
+
|
|
12
|
+
FINDINGS:
|
|
13
|
+
FINDINGS_LIST
|
|
14
|
+
|
|
15
|
+
STEP 1 - VERIFY:
|
|
16
|
+
For each finding, read the actual code at the specified file and line. Inspect
|
|
17
|
+
enough surrounding context to understand the issue. Classify each finding as:
|
|
18
|
+
- CONFIRMED: real issue, fix it.
|
|
19
|
+
- FALSE POSITIVE: does not exist, is already mitigated, or is outside the
|
|
20
|
+
changed behavior.
|
|
21
|
+
|
|
22
|
+
STEP 2 - FIX:
|
|
23
|
+
- Fix all confirmed issues.
|
|
24
|
+
- Add or update tests when the finding is about behavior, correctness, or a
|
|
25
|
+
regression risk.
|
|
26
|
+
- Keep fixes scoped to the reported issues.
|
|
27
|
+
|
|
28
|
+
STEP 3 - VALIDATE:
|
|
29
|
+
- Run the build, test, lint, typecheck, or validation commands from
|
|
30
|
+
PLAN_FILE_PATH.
|
|
31
|
+
- If the plan does not list exact commands, infer the narrowest relevant
|
|
32
|
+
validation commands from the repository.
|
|
33
|
+
- If anything fails, fix it and re-run validation.
|
|
34
|
+
- Never commit broken code.
|
|
35
|
+
|
|
36
|
+
STEP 4 - COMMIT:
|
|
37
|
+
- Commit fixes only after validation passes:
|
|
38
|
+
`bash PLAN_EXEC_ROOT/scripts/stage-and-commit.sh "fix: address code review findings" <changed-files>`
|
|
39
|
+
- List every changed file explicitly.
|
|
40
|
+
- If all findings are false positives and no files changed, do not create an
|
|
41
|
+
empty commit.
|
|
42
|
+
|
|
43
|
+
STEP 5 - LOG PROGRESS:
|
|
44
|
+
- Pipe details:
|
|
45
|
+
`printf '%s\n' "- confirmed: <list>" "- false positives: <list>" "- fixes: <what changed>" "- validation: <what passed>" | bash PLAN_EXEC_ROOT/scripts/append-progress.sh PROGRESS_FILE_PATH`
|
|
46
|
+
- Use only `append-progress.sh` for writing to the progress file. Do not write to
|
|
47
|
+
the progress file directly.
|
|
48
|
+
|
|
49
|
+
STEP 6 - REPORT:
|
|
50
|
+
Your final response must include a structured summary starting with `FIXES:` on
|
|
51
|
+
its own line, followed by one line per fix or false positive:
|
|
52
|
+
|
|
53
|
+
FIXES:
|
|
54
|
+
- fixed: <file>:<line> - <what was fixed>
|
|
55
|
+
- false positive: <description> - <why discarded>
|
|
56
|
+
|
|
57
|
+
This report is shown to the user. Be specific about what changed.
|
|
58
|
+
```
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Progress file
|
|
2
|
+
|
|
3
|
+
The orchestrator maintains a progress file at `/tmp/progress-<plan-name>.txt`,
|
|
4
|
+
derived from the plan filename stem. The file carries context across task,
|
|
5
|
+
review, fixer, finalizer, and summary phases.
|
|
6
|
+
|
|
7
|
+
## When to write
|
|
8
|
+
|
|
9
|
+
Use `PLAN_EXEC_ROOT/scripts/append-progress.sh` for all appends. Do not write
|
|
10
|
+
directly to the progress file.
|
|
11
|
+
|
|
12
|
+
At start, `init-progress.sh` writes:
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
# progress
|
|
16
|
+
Plan: <plan-file-path>
|
|
17
|
+
Branch: <branch-name>
|
|
18
|
+
Started: <timestamp>
|
|
19
|
+
---
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
After each task completes:
|
|
23
|
+
|
|
24
|
+
```text
|
|
25
|
+
[task] Task N: <title> - completed
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
After each task fails:
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
[task] Task N: <title> - FAILED (retry N)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Before each review phase:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
--- review phase N: <type> ---
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
After review workers return, before the fixer:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
[review] phase N iteration M findings:
|
|
44
|
+
<full worker output>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
After a fixer completes:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
[fixer] phase N iteration M:
|
|
51
|
+
<fixer report>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
After finalize:
|
|
55
|
+
|
|
56
|
+
```text
|
|
57
|
+
[finalize]
|
|
58
|
+
<finalizer report>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
At completion:
|
|
62
|
+
|
|
63
|
+
```text
|
|
64
|
+
---
|
|
65
|
+
Completed: <timestamp>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## How to pass it
|
|
69
|
+
|
|
70
|
+
- Pass the progress file path to task, fixer, finalizer, and summary workers.
|
|
71
|
+
- Review workers may read the progress file for context, but must remain
|
|
72
|
+
read-only.
|
|
73
|
+
- The summary worker uses it to derive portable run statistics.
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Internal review playbook
|
|
2
|
+
|
|
3
|
+
This file is a playbook for the main orchestrator session, not a worker prompt.
|
|
4
|
+
Replace `DEFAULT_BRANCH`, `PLAN_FILE_PATH`, `PROGRESS_FILE_PATH`,
|
|
5
|
+
`PLAN_EXEC_ROOT`, and `REVIEW_PHASE`, then follow the instructions from the main
|
|
6
|
+
session.
|
|
7
|
+
|
|
8
|
+
All review work must be done by isolated read-only workers. If the host supports
|
|
9
|
+
parallel isolated workers, launch all workers for the phase together. If parallel
|
|
10
|
+
launch is unavailable, run the workers sequentially. Do not review or fix issues
|
|
11
|
+
in the orchestrator session.
|
|
12
|
+
|
|
13
|
+
Each review worker prompt must start with this preamble:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
CRITICAL: You are a READ-ONLY reviewer. Do not run git stash, git checkout, git
|
|
17
|
+
reset, git commit, or any command that modifies the working tree. Other workers
|
|
18
|
+
may run in parallel. Only use read-only commands such as git diff, git log, git
|
|
19
|
+
show, and file reads.
|
|
20
|
+
|
|
21
|
+
Run `git diff DEFAULT_BRANCH...HEAD` to see the full branch diff. Read the
|
|
22
|
+
actual source files for context; do not review from the diff alone.
|
|
23
|
+
|
|
24
|
+
The plan file at PLAN_FILE_PATH describes the goal and requirements.
|
|
25
|
+
The progress file at PROGRESS_FILE_PATH describes previous task and fix work.
|
|
26
|
+
Re-evaluate findings independently. Previous fixes may be incomplete.
|
|
27
|
+
|
|
28
|
+
Tag every finding with severity:
|
|
29
|
+
- CRITICAL: crash, data loss, security vulnerability, race condition, or broken
|
|
30
|
+
core behavior.
|
|
31
|
+
- MAJOR: real correctness issue, missing critical error handling, broken
|
|
32
|
+
contract, or incomplete requirement.
|
|
33
|
+
- MINOR: style, documentation drift, convention mismatch, simplification, or
|
|
34
|
+
optional improvement.
|
|
35
|
+
|
|
36
|
+
Format each finding on its own line:
|
|
37
|
+
`SEVERITY: file:line - description`
|
|
38
|
+
|
|
39
|
+
Report problems only. If you find no issues, report exactly:
|
|
40
|
+
`NO ISSUES FOUND`
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Comprehensive Mode
|
|
44
|
+
|
|
45
|
+
Used when `REVIEW_PHASE` is `comprehensive`.
|
|
46
|
+
|
|
47
|
+
Launch five read-only workers using these bundled reviewer files:
|
|
48
|
+
|
|
49
|
+
- `PLAN_EXEC_ROOT/references/agents/quality.txt`
|
|
50
|
+
- `PLAN_EXEC_ROOT/references/agents/implementation.txt`
|
|
51
|
+
- `PLAN_EXEC_ROOT/references/agents/testing.txt`
|
|
52
|
+
- `PLAN_EXEC_ROOT/references/agents/simplification.txt`
|
|
53
|
+
- `PLAN_EXEC_ROOT/references/agents/documentation.txt`
|
|
54
|
+
|
|
55
|
+
For each worker, prepend the read-only preamble above to the corresponding
|
|
56
|
+
reviewer file content.
|
|
57
|
+
|
|
58
|
+
After all workers return, produce a strict finding report:
|
|
59
|
+
|
|
60
|
+
- Group findings by severity in this order: `CRITICAL`, `MAJOR`, `MINOR`.
|
|
61
|
+
- Use a heading per severity: `### CRITICAL`, `### MAJOR`, `### MINOR`.
|
|
62
|
+
- Skip severity headings with zero findings.
|
|
63
|
+
- Under each heading, use exactly:
|
|
64
|
+
`- <reviewer-name>: <file:line> - <description>`
|
|
65
|
+
- Preserve reviewer attribution: `quality`, `implementation`, `testing`,
|
|
66
|
+
`simplification`, or `documentation`.
|
|
67
|
+
- If two reviewers report the same file, line, and issue, merge into one bullet
|
|
68
|
+
and join reviewer names with `+`.
|
|
69
|
+
- Do not verify, fix, dismiss, or rewrite findings.
|
|
70
|
+
- Omit reviewers that found nothing.
|
|
71
|
+
- After the bullet list, emit:
|
|
72
|
+
`Total: <N> findings (<C> critical, <M> major, <m> minor)`
|
|
73
|
+
|
|
74
|
+
If all workers report `NO ISSUES FOUND`, emit exactly:
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
Comprehensive review: clean - no findings.
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Critical-Only Mode
|
|
81
|
+
|
|
82
|
+
Used when `REVIEW_PHASE` is `critical`.
|
|
83
|
+
|
|
84
|
+
Launch two read-only workers using these bundled reviewer files:
|
|
85
|
+
|
|
86
|
+
- `PLAN_EXEC_ROOT/references/agents/quality.txt`
|
|
87
|
+
- `PLAN_EXEC_ROOT/references/agents/implementation.txt`
|
|
88
|
+
|
|
89
|
+
For each worker, prepend the read-only preamble above plus this additional
|
|
90
|
+
instruction:
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
Report only CRITICAL and MAJOR issues. Ignore MINOR findings, style concerns,
|
|
94
|
+
optional improvements, documentation nits, and simplification opportunities.
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
After both workers return, produce the same strict finding report as
|
|
98
|
+
comprehensive mode, but include only `CRITICAL` and `MAJOR` sections.
|
|
99
|
+
|
|
100
|
+
If neither worker reports critical or major findings, emit exactly:
|
|
101
|
+
|
|
102
|
+
```text
|
|
103
|
+
Critical review: clean - no critical/major findings.
|
|
104
|
+
```
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Portable run summary prompt
|
|
2
|
+
|
|
3
|
+
Use this for the read-only summary worker after finalize completes. Replace
|
|
4
|
+
`DEFAULT_BRANCH`, `PLAN_FILE_PATH`, and `PROGRESS_FILE_PATH` before launch.
|
|
5
|
+
|
|
6
|
+
```text
|
|
7
|
+
You are a read-only summary worker for a plan-exec run that just finished.
|
|
8
|
+
Produce a concise markdown summary from the plan file, progress file, and Git
|
|
9
|
+
state only.
|
|
10
|
+
|
|
11
|
+
Plan file: PLAN_FILE_PATH
|
|
12
|
+
Progress file: PROGRESS_FILE_PATH
|
|
13
|
+
Default branch: DEFAULT_BRANCH
|
|
14
|
+
|
|
15
|
+
READ-ONLY CONSTRAINTS:
|
|
16
|
+
- Do not modify files.
|
|
17
|
+
- Do not edit the plan.
|
|
18
|
+
- Do not commit.
|
|
19
|
+
- Do not read host-specific telemetry logs, token logs, session JSONL files, or
|
|
20
|
+
assistant-internal metadata.
|
|
21
|
+
|
|
22
|
+
STEP 1 - READ RUN STATE:
|
|
23
|
+
- Read PLAN_FILE_PATH.
|
|
24
|
+
- Read PROGRESS_FILE_PATH if it exists.
|
|
25
|
+
- Determine the current branch with `git branch --show-current`.
|
|
26
|
+
|
|
27
|
+
STEP 2 - PLAN PROGRESS:
|
|
28
|
+
- Count completed and remaining checkboxes in task or iteration sections.
|
|
29
|
+
- Identify the final run state from the progress file when possible:
|
|
30
|
+
completed, max-iterations-hit, aborted, or unknown.
|
|
31
|
+
- Count implementation task entries in the progress file when possible.
|
|
32
|
+
- Count review and fixer iterations in the progress file when possible.
|
|
33
|
+
|
|
34
|
+
STEP 3 - GIT STATS:
|
|
35
|
+
Run read-only Git commands:
|
|
36
|
+
- `git diff --shortstat DEFAULT_BRANCH...HEAD`
|
|
37
|
+
- `git diff --stat DEFAULT_BRANCH...HEAD`
|
|
38
|
+
- `git log --oneline DEFAULT_BRANCH..HEAD`
|
|
39
|
+
|
|
40
|
+
If those commands fail because DEFAULT_BRANCH is unavailable, retry against
|
|
41
|
+
`origin/DEFAULT_BRANCH` when it exists. If both fail, report `n/a`.
|
|
42
|
+
|
|
43
|
+
STEP 4 - OUTPUT:
|
|
44
|
+
Emit only this markdown report. Keep it compact.
|
|
45
|
+
|
|
46
|
+
## Run summary
|
|
47
|
+
|
|
48
|
+
**Branch:** <current branch>
|
|
49
|
+
**Plan:** PLAN_FILE_PATH
|
|
50
|
+
**Final state:** <completed | max-iterations-hit | aborted | unknown>
|
|
51
|
+
|
|
52
|
+
### Plan progress
|
|
53
|
+
|
|
54
|
+
- Task sections complete: <N>/<M>
|
|
55
|
+
- Remaining unchecked items: <N>
|
|
56
|
+
- Implementation task runs: <N or n/a>
|
|
57
|
+
|
|
58
|
+
### Review and fixes
|
|
59
|
+
|
|
60
|
+
- Review phase 1 iterations: <N or n/a>
|
|
61
|
+
- Smells review: <clean | fixed | findings | n/a>
|
|
62
|
+
- Critical review: <clean | fixed | findings | n/a>
|
|
63
|
+
- Fixer runs: <N or n/a>
|
|
64
|
+
|
|
65
|
+
### Branch changes
|
|
66
|
+
|
|
67
|
+
- Commits on branch: <N or n/a>
|
|
68
|
+
- Diff shortstat: <shortstat or n/a>
|
|
69
|
+
|
|
70
|
+
Top files by churn:
|
|
71
|
+
- <file> <stats>
|
|
72
|
+
- <file> <stats>
|
|
73
|
+
- <file> <stats>
|
|
74
|
+
|
|
75
|
+
### Notable
|
|
76
|
+
|
|
77
|
+
- Rebase/finalize: <summary or n/a>
|
|
78
|
+
- Validation: <summary or n/a>
|
|
79
|
+
- Deviations/blockers: <summary or n/a>
|
|
80
|
+
|
|
81
|
+
If a section has no data, write `n/a` rather than inventing numbers.
|
|
82
|
+
```
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Task worker prompt
|
|
2
|
+
|
|
3
|
+
Use this prompt when spawning each implementation worker. Replace
|
|
4
|
+
`PLAN_FILE_PATH`, `PROGRESS_FILE_PATH`, and `PLAN_EXEC_ROOT` before launch.
|
|
5
|
+
|
|
6
|
+
```text
|
|
7
|
+
Read the plan file at PLAN_FILE_PATH. Find the FIRST Task section
|
|
8
|
+
(`### Task N:` or `### Iteration N:`) that has uncompleted checkboxes (`[ ]`).
|
|
9
|
+
|
|
10
|
+
If a task section has `[ ]` checkboxes you cannot complete because they require
|
|
11
|
+
manual testing, deployment verification, credentials, or external systems, mark
|
|
12
|
+
them `[x]` with a note like `[x] manual test (skipped - not automatable)` and
|
|
13
|
+
continue.
|
|
14
|
+
|
|
15
|
+
CRITICAL CONSTRAINT: Complete ONE task section per worker run.
|
|
16
|
+
A task section is a `### Task N:` or `### Iteration N:` heading with all
|
|
17
|
+
checkboxes underneath it. Complete all checkboxes in that section, then stop.
|
|
18
|
+
Do not continue to the next section.
|
|
19
|
+
|
|
20
|
+
STEP 1 - IMPLEMENT:
|
|
21
|
+
- Read the plan's Overview, Context, Review Handoff, Development Approach,
|
|
22
|
+
Testing Strategy, and Technical Details sections when present.
|
|
23
|
+
- Implement all items in the current task section.
|
|
24
|
+
- Write or update tests for the implementation.
|
|
25
|
+
|
|
26
|
+
STEP 2 - VALIDATE:
|
|
27
|
+
- Run the test, lint, typecheck, build, or validation commands specified in the
|
|
28
|
+
plan.
|
|
29
|
+
- If the plan does not list exact commands, infer the narrowest relevant
|
|
30
|
+
validation commands from the repository.
|
|
31
|
+
- Fix any failures and repeat validation until it passes.
|
|
32
|
+
|
|
33
|
+
STEP 3 - COMPLETE:
|
|
34
|
+
- Edit PLAN_FILE_PATH and change `[ ]` to `[x]` for every checkbox you completed
|
|
35
|
+
in the current task section.
|
|
36
|
+
- If all task sections are complete and higher-level success criteria checkboxes
|
|
37
|
+
are now satisfied, mark those `[x]` too.
|
|
38
|
+
- Commit all changed files with:
|
|
39
|
+
`bash PLAN_EXEC_ROOT/scripts/stage-and-commit.sh "feat: <brief task description>" file1 file2 ...`
|
|
40
|
+
- List every changed file explicitly, including source files, tests, and the plan
|
|
41
|
+
file.
|
|
42
|
+
|
|
43
|
+
STEP 4 - LOG PROGRESS:
|
|
44
|
+
- Append a header:
|
|
45
|
+
`bash PLAN_EXEC_ROOT/scripts/append-progress.sh PROGRESS_FILE_PATH "task N: <title>"`
|
|
46
|
+
- Then pipe details:
|
|
47
|
+
`printf '%s\n' "- modified: <files>" "- implemented: <what was done>" "- tests: <what tests were added or why skipped>" "- validation: <what commands passed>" | bash PLAN_EXEC_ROOT/scripts/append-progress.sh PROGRESS_FILE_PATH`
|
|
48
|
+
- Use only `append-progress.sh` for writing to the progress file. Do not write to
|
|
49
|
+
the progress file directly.
|
|
50
|
+
|
|
51
|
+
STOP after committing and logging progress.
|
|
52
|
+
|
|
53
|
+
If any phase fails after reasonable fix attempts, log the failure to
|
|
54
|
+
PROGRESS_FILE_PATH and report what failed.
|
|
55
|
+
|
|
56
|
+
One task section per run. After commit and progress log, stop.
|
|
57
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# append to the progress file with timestamp
|
|
3
|
+
# usage: append-progress.sh <progress-file> [message]
|
|
4
|
+
# if message is provided, appends single timestamped line
|
|
5
|
+
# if no message, reads stdin and appends all lines (for multi-line content)
|
|
6
|
+
|
|
7
|
+
set -e
|
|
8
|
+
|
|
9
|
+
if [ $# -lt 1 ]; then
|
|
10
|
+
echo "error: usage: append-progress.sh <file> [message]" >&2
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
file="$1"
|
|
15
|
+
shift
|
|
16
|
+
|
|
17
|
+
if [ $# -gt 0 ]; then
|
|
18
|
+
# single line with timestamp
|
|
19
|
+
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*" >> "$file"
|
|
20
|
+
else
|
|
21
|
+
# multi-line from stdin
|
|
22
|
+
cat >> "$file"
|
|
23
|
+
fi
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# create a feature branch from a plan file name if currently on the default branch
|
|
3
|
+
# usage: create-branch.sh <plan-file-path>
|
|
4
|
+
# exits 0 if a branch was created or an existing feature branch is already active
|
|
5
|
+
# outputs the branch name to stdout
|
|
6
|
+
#
|
|
7
|
+
# strips leading YYYYMMDD- or YYYY-MM-DD- date prefixes from branch names
|
|
8
|
+
|
|
9
|
+
set -e
|
|
10
|
+
|
|
11
|
+
if [ -z "${1:-}" ]; then
|
|
12
|
+
echo "error: plan file path required" >&2
|
|
13
|
+
exit 1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then
|
|
17
|
+
echo "error: not a git repository" >&2
|
|
18
|
+
exit 1
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
22
|
+
|
|
23
|
+
derive_branch_name() {
|
|
24
|
+
local name
|
|
25
|
+
name=$(basename "$1" .md)
|
|
26
|
+
name=$(echo "$name" | sed 's/^[0-9]\{4\}-\{0,1\}[0-9]\{2\}-\{0,1\}[0-9]\{2\}-//')
|
|
27
|
+
echo "$name"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
current_branch=$(git branch --show-current)
|
|
31
|
+
default_branch=$(bash "$SCRIPT_DIR/detect-branch.sh")
|
|
32
|
+
|
|
33
|
+
if [ -n "$current_branch" ] && [ "$current_branch" != "$default_branch" ]; then
|
|
34
|
+
echo "$current_branch"
|
|
35
|
+
exit 0
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
branch_name=$(derive_branch_name "$1")
|
|
39
|
+
|
|
40
|
+
if git show-ref --verify --quiet "refs/heads/$branch_name" 2>/dev/null; then
|
|
41
|
+
git checkout "$branch_name"
|
|
42
|
+
else
|
|
43
|
+
git checkout -b "$branch_name"
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
echo "$branch_name"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# detect the default branch name of the current Git repository
|
|
3
|
+
# outputs the branch name to stdout
|
|
4
|
+
# avoids network calls when possible
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then
|
|
9
|
+
echo "error: not a git repository" >&2
|
|
10
|
+
exit 1
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
branch=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
|
|
14
|
+
|
|
15
|
+
if [ -z "$branch" ]; then
|
|
16
|
+
for candidate in main master trunk develop; do
|
|
17
|
+
if git show-ref --verify --quiet "refs/heads/$candidate" 2>/dev/null; then
|
|
18
|
+
branch="$candidate"
|
|
19
|
+
break
|
|
20
|
+
fi
|
|
21
|
+
done
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
if [ -z "$branch" ]; then
|
|
25
|
+
branch=$(git remote show origin 2>/dev/null | grep 'HEAD branch' | sed 's/.*: //')
|
|
26
|
+
fi
|
|
27
|
+
|
|
28
|
+
if [ -z "$branch" ]; then
|
|
29
|
+
branch="main"
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
echo "$branch"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# initialize the progress file with a header
|
|
3
|
+
# usage: init-progress.sh <progress-file> <plan-path> <branch-name>
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
file="$1"
|
|
8
|
+
plan="$2"
|
|
9
|
+
branch="$3"
|
|
10
|
+
|
|
11
|
+
if [ -z "$file" ] || [ -z "$plan" ] || [ -z "$branch" ]; then
|
|
12
|
+
echo "error: usage: init-progress.sh <progress-file> <plan-path> <branch-name>" >&2
|
|
13
|
+
exit 1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
cat > "$file" <<EOF
|
|
17
|
+
# progress
|
|
18
|
+
Plan: $plan
|
|
19
|
+
Branch: $branch
|
|
20
|
+
Started: $(date '+%Y-%m-%d %H:%M:%S')
|
|
21
|
+
---
|
|
22
|
+
EOF
|
|
23
|
+
|
|
24
|
+
echo "$file"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# stage explicit files and commit with a message
|
|
3
|
+
# usage: stage-and-commit.sh <message> <file1> [file2 ...]
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
if [ $# -lt 2 ]; then
|
|
8
|
+
echo "error: usage: stage-and-commit.sh <message> <file1> [file2 ...]" >&2
|
|
9
|
+
exit 1
|
|
10
|
+
fi
|
|
11
|
+
|
|
12
|
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then
|
|
13
|
+
echo "error: not a git repository" >&2
|
|
14
|
+
exit 1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
msg="$1"
|
|
18
|
+
shift
|
|
19
|
+
|
|
20
|
+
git add -- "$@"
|
|
21
|
+
git commit -m "$msg"
|