@cluesmith/codev 3.0.5 → 3.0.6
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/dashboard-dist/assets/{index-Dn9zmcKp.js → index-CR-uu485.js} +29 -29
- package/dashboard-dist/assets/index-CR-uu485.js.map +1 -0
- package/dashboard-dist/assets/{index-BWYZtvwm.css → index-nCeIzV_d.css} +1 -1
- package/dashboard-dist/index.html +2 -2
- package/dist/agent-farm/cli.js +1 -1
- package/dist/agent-farm/cli.js.map +1 -1
- package/dist/agent-farm/commands/cleanup.js +13 -0
- package/dist/agent-farm/commands/cleanup.js.map +1 -1
- package/dist/agent-farm/commands/dev.d.ts.map +1 -1
- package/dist/agent-farm/commands/dev.js +10 -3
- package/dist/agent-farm/commands/dev.js.map +1 -1
- package/dist/agent-farm/commands/spawn-worktree.d.ts +12 -3
- package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn-worktree.js +17 -6
- package/dist/agent-farm/commands/spawn-worktree.js.map +1 -1
- package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn.js +52 -21
- package/dist/agent-farm/commands/spawn.js.map +1 -1
- package/dist/agent-farm/db/index.d.ts.map +1 -1
- package/dist/agent-farm/db/index.js +34 -0
- package/dist/agent-farm/db/index.js.map +1 -1
- package/dist/agent-farm/db/schema.d.ts +1 -1
- package/dist/agent-farm/db/schema.d.ts.map +1 -1
- package/dist/agent-farm/db/schema.js +1 -1
- package/dist/agent-farm/servers/analytics.d.ts.map +1 -1
- package/dist/agent-farm/servers/analytics.js +1 -0
- package/dist/agent-farm/servers/analytics.js.map +1 -1
- package/dist/agent-farm/servers/overview.d.ts +25 -3
- package/dist/agent-farm/servers/overview.d.ts.map +1 -1
- package/dist/agent-farm/servers/overview.js +72 -10
- package/dist/agent-farm/servers/overview.js.map +1 -1
- package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-routes.js +54 -14
- package/dist/agent-farm/servers/tower-routes.js.map +1 -1
- package/dist/agent-farm/types.d.ts +1 -1
- package/dist/agent-farm/types.d.ts.map +1 -1
- package/dist/agent-farm/utils/agent-names.d.ts.map +1 -1
- package/dist/agent-farm/utils/agent-names.js +3 -0
- package/dist/agent-farm/utils/agent-names.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/porch/artifacts.d.ts +23 -1
- package/dist/commands/porch/artifacts.d.ts.map +1 -1
- package/dist/commands/porch/artifacts.js +51 -62
- package/dist/commands/porch/artifacts.js.map +1 -1
- package/dist/commands/porch/index.d.ts +23 -2
- package/dist/commands/porch/index.d.ts.map +1 -1
- package/dist/commands/porch/index.js +83 -4
- package/dist/commands/porch/index.js.map +1 -1
- package/dist/commands/porch/notify.d.ts +27 -5
- package/dist/commands/porch/notify.d.ts.map +1 -1
- package/dist/commands/porch/notify.js +23 -12
- package/dist/commands/porch/notify.js.map +1 -1
- package/dist/commands/porch/state.d.ts +1 -1
- package/dist/commands/porch/state.d.ts.map +1 -1
- package/dist/commands/porch/state.js +8 -6
- package/dist/commands/porch/state.js.map +1 -1
- package/dist/lib/github.d.ts +8 -0
- package/dist/lib/github.d.ts.map +1 -1
- package/dist/lib/github.js +29 -2
- package/dist/lib/github.js.map +1 -1
- package/dist/lib/team-github.d.ts +4 -0
- package/dist/lib/team-github.d.ts.map +1 -1
- package/dist/lib/team-github.js +14 -3
- package/dist/lib/team-github.js.map +1 -1
- package/package.json +4 -4
- package/skeleton/protocols/pir/builder-prompt.md +92 -0
- package/skeleton/protocols/pir/consult-types/impl-review.md +78 -0
- package/skeleton/protocols/pir/consult-types/pr-review.md +65 -0
- package/skeleton/protocols/pir/prompts/implement.md +156 -0
- package/skeleton/protocols/pir/prompts/plan.md +133 -0
- package/skeleton/protocols/pir/prompts/review.md +261 -0
- package/skeleton/protocols/pir/protocol.json +125 -0
- package/skeleton/protocols/pir/protocol.md +204 -0
- package/skeleton/templates/AGENTS.md +24 -0
- package/skeleton/templates/CLAUDE.md +24 -0
- package/dashboard-dist/assets/index-Dn9zmcKp.js.map +0 -1
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# REVIEW Phase Prompt
|
|
2
|
+
|
|
3
|
+
You are executing the **REVIEW** phase of the PIR protocol.
|
|
4
|
+
|
|
5
|
+
## Your Goal
|
|
6
|
+
|
|
7
|
+
Write a retrospective at `codev/reviews/{{artifact_name}}.md` including **Summary**, **Architecture Updates**, and **Lessons Learned Updates** sections. Push, open a PR using the review file as the PR body, record the PR with porch, then signal completion — **porch runs CMAP-2 (Gemini + Codex) once** via the verify block. CMAP is a *single advisory pass* (`max_iterations: 1`): its verdicts are surfaced to the human at the `pr` gate, **not** an iterate-until-APPROVE loop. After the single pass the `pr` gate fires regardless of verdict; you notify the architect (leading with any REQUEST_CHANGES) and wait at the gate while the human merges on GitHub.
|
|
8
|
+
|
|
9
|
+
The retrospective ships with the merged PR — it's durable team knowledge, searchable in `codev/reviews/` on `main`.
|
|
10
|
+
|
|
11
|
+
## Context
|
|
12
|
+
|
|
13
|
+
- **Project ID**: {{project_id}}
|
|
14
|
+
- **Issue Number**: #{{issue.number}}
|
|
15
|
+
- **Plan File**: `codev/plans/{{artifact_name}}.md`
|
|
16
|
+
- **Review File**: `codev/reviews/{{artifact_name}}.md` (you will write this)
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
|
|
20
|
+
- The `dev-approval` gate has been approved (you're here because `porch next` advanced you)
|
|
21
|
+
- Your branch contains the implementation commits
|
|
22
|
+
- Build and tests pass
|
|
23
|
+
|
|
24
|
+
## Process
|
|
25
|
+
|
|
26
|
+
### 1. Write the Review File
|
|
27
|
+
|
|
28
|
+
Create `codev/reviews/{{artifact_name}}.md` with these sections:
|
|
29
|
+
|
|
30
|
+
```markdown
|
|
31
|
+
# PIR Review: <Short Title>
|
|
32
|
+
|
|
33
|
+
Fixes #{{issue.number}}
|
|
34
|
+
|
|
35
|
+
## Summary
|
|
36
|
+
|
|
37
|
+
2–3 sentence overview of what was implemented and why. The reader is someone scanning `codev/reviews/` six months from now trying to understand what this PR did.
|
|
38
|
+
|
|
39
|
+
## Files Changed
|
|
40
|
+
|
|
41
|
+
Output of `git diff --stat main`, formatted as a list:
|
|
42
|
+
|
|
43
|
+
- `path/to/file.ts` (+12 / -3)
|
|
44
|
+
- `path/to/new-file.ts` (+45 / -0)
|
|
45
|
+
|
|
46
|
+
## Commits
|
|
47
|
+
|
|
48
|
+
Output of `git log main..HEAD --oneline`:
|
|
49
|
+
|
|
50
|
+
- `<sha>` [PIR #{{issue.number}}] First change
|
|
51
|
+
- `<sha>` [PIR #{{issue.number}}] Second change
|
|
52
|
+
|
|
53
|
+
## Test Results
|
|
54
|
+
|
|
55
|
+
- `npm run build`: ✓ pass
|
|
56
|
+
- `npm test`: ✓ pass (X tests, Y new)
|
|
57
|
+
- Manual verification: <what was verified, on what platforms — pulled from the human's review at the dev-approval gate if known>
|
|
58
|
+
|
|
59
|
+
## Architecture Updates
|
|
60
|
+
|
|
61
|
+
What changed in `codev/resources/arch.md` (or why no changes were needed). If this PR introduced or modified an architectural pattern, document it here AND update `arch.md` in this same commit. If no architectural updates are needed (typical for small fixes), write a single line explaining why: "No arch changes — this PR fixes a typo without affecting module boundaries."
|
|
62
|
+
|
|
63
|
+
Use the `update-arch-docs` skill if available (`.claude/skills/update-arch-docs/SKILL.md`) — it encodes the discipline for what NOT to include in arch docs.
|
|
64
|
+
|
|
65
|
+
## Lessons Learned Updates
|
|
66
|
+
|
|
67
|
+
What durable engineering wisdom emerged from this PR (or why no lessons were captured). Same pattern as Architecture Updates: if something is worth recording in `codev/resources/lessons-learned.md`, update both files in this commit. If not, explain why: "No lessons captured — change was mechanical."
|
|
68
|
+
|
|
69
|
+
## Things to Look At During PR Review
|
|
70
|
+
|
|
71
|
+
Tricky spots the PR reviewer should focus on. Honest — if a section was hard to get right, flag it.
|
|
72
|
+
|
|
73
|
+
## How to Test Locally
|
|
74
|
+
|
|
75
|
+
For reviewers pulling the branch:
|
|
76
|
+
|
|
77
|
+
- **View diff**: VSCode sidebar → right-click builder pir-{{project_id}} → **Review Diff** (auto-detects the repo's default branch)
|
|
78
|
+
- **Run dev server**: VSCode sidebar → **Run Dev Server**, or `afx dev pir-{{project_id}}`
|
|
79
|
+
- **What to verify**: <bullet list mapped to the plan's Test Plan>
|
|
80
|
+
|
|
81
|
+
## Flaky Tests (if any)
|
|
82
|
+
|
|
83
|
+
List any tests you skipped due to pre-existing flakiness, with file:line refs and a one-line rationale each. Omit this section if none.
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 2. Update Architecture / Lessons Docs (if applicable)
|
|
87
|
+
|
|
88
|
+
If your "Architecture Updates" or "Lessons Learned Updates" section calls out real changes, update `codev/resources/arch.md` and/or `codev/resources/lessons-learned.md` accordingly. Use the `update-arch-docs` skill if it's available.
|
|
89
|
+
|
|
90
|
+
If neither doc needs updating, your review file's sections still need to explain why — the porch `checks` block enforces section presence.
|
|
91
|
+
|
|
92
|
+
### 3. Commit the Review File (and arch / lessons updates)
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
git add codev/reviews/{{artifact_name}}.md
|
|
96
|
+
# Add arch.md / lessons-learned.md only if you changed them
|
|
97
|
+
git add codev/resources/arch.md # only if changed
|
|
98
|
+
git add codev/resources/lessons-learned.md # only if changed
|
|
99
|
+
git commit -m "[PIR #{{issue.number}}] Review + retrospective"
|
|
100
|
+
git push
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 4. Open the PR
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
PR_TITLE="<concise description of the change>"
|
|
107
|
+
BRANCH="$(git branch --show-current)"
|
|
108
|
+
|
|
109
|
+
gh pr create \
|
|
110
|
+
--base main \
|
|
111
|
+
--head "$BRANCH" \
|
|
112
|
+
--title "$PR_TITLE" \
|
|
113
|
+
--body-file codev/reviews/{{artifact_name}}.md
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Verify the PR body contains `Fixes #{{issue.number}}`** (it should — the review file has it at the top). If somehow missing, edit and re-apply:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
gh pr edit <PR-number> --body-file codev/reviews/{{artifact_name}}.md
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Exception**: if this PR only partially addresses the issue, use `Refs #{{issue.number}}` instead — the issue stays open until a follow-up PR closes it.
|
|
123
|
+
|
|
124
|
+
### 4a. Record the PR with Porch
|
|
125
|
+
|
|
126
|
+
Immediately after creating the PR, tell porch about it so `status.yaml` carries the PR number and branch. This is a metadata-only call — it does NOT advance the phase or trigger CMAP:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
porch done {{project_id}} --pr <PR-number> --branch "$(git branch --show-current)"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Without this, porch's `history:` for the project stays empty and downstream tooling (status views, analytics, audit trails) can't link the porch project to its GitHub PR.
|
|
133
|
+
|
|
134
|
+
### 5. Signal Completion to Porch (porch runs CMAP-2)
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
porch done {{project_id}}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Porch will:
|
|
141
|
+
1. Run the `pr_exists` / `review_has_arch_updates` / `review_has_lessons_updates` checks.
|
|
142
|
+
2. **Execute CMAP-2 (Gemini + Codex) automatically** via the protocol's `verify` block. Outputs land in `codev/projects/{{project_id}}-<slug>/{{project_id}}-gemini.txt` and `<id>-codex.txt`.
|
|
143
|
+
3. CMAP runs **exactly once** (`max_iterations: 1`). Whatever the verdicts, porch records them in `status.yaml` and advances to the `pr` gate — there is **no automated re-review pass and no "stays in the review phase" loop**. `APPROVE` and `REQUEST_CHANGES` differ only in what you must surface to the human (steps 6–7), not in whether the gate fires. The output of `porch done` surfaces the verdicts.
|
|
144
|
+
|
|
145
|
+
> **Why CMAP-2, not CMAP-3?** PIR's design parallels BUGFIX/AIR's consult footprint. The human already approved the *running* implementation at the `dev-approval` gate; CMAP at PR is a pre-merge hygiene + code-quality pass, not a functional review.
|
|
146
|
+
|
|
147
|
+
### 6. Handle a REQUEST_CHANGES Verdict (single-pass — no automated re-review)
|
|
148
|
+
|
|
149
|
+
PIR's CMAP is one advisory pass (`max_iterations: 1`). If a reviewer returns `REQUEST_CHANGES`, porch does **not** loop or re-run CMAP — it records the verdict and proceeds to the `pr` gate. There is no iter-2. The correctness backstop for a CMAP-flagged issue is therefore **(a)** your fix + a regression test and **(b)** the human's `pr`-gate review — *not* an independent model re-review. Treat that as load-bearing: a substantive finding you "address and rebut" gets no second AI opinion.
|
|
150
|
+
|
|
151
|
+
For any `REQUEST_CHANGES`:
|
|
152
|
+
|
|
153
|
+
1. Read the finding in full (`codev/projects/{{project_id}}-*/{{project_id}}-<model>.txt`).
|
|
154
|
+
2. **Assess it honestly:**
|
|
155
|
+
- **Real defect** (correctness / cancellation / security / data-loss): fix it in code, add a regression test that fails without the fix, commit + push (the PR updates automatically — no new `gh pr create`). Then document the finding, your fix, and the pinning test in the review file's **"Things to Look At During PR Review"** section.
|
|
156
|
+
- **False positive / out of scope**: write a brief rebuttal in that same section explaining why no change is warranted.
|
|
157
|
+
3. Do **not** re-run `porch done` expecting another CMAP — `max_iterations: 1` means it will not re-review. Proceed to step 7.
|
|
158
|
+
|
|
159
|
+
Whether you fixed it or rebutted it, a `REQUEST_CHANGES` that PIR will never re-check **must be escalated to the human at the `pr` gate** (step 7) — they are the only remaining reviewer of that decision.
|
|
160
|
+
|
|
161
|
+
### 7. Notify the Architect (after the single CMAP pass — gate is now pending)
|
|
162
|
+
|
|
163
|
+
After the one CMAP pass + structural checks, porch fires the **`pr` gate** (pending) **regardless of the verdicts**. Read the verdicts from porch state and notify — and if any verdict is `REQUEST_CHANGES`, **lead with it and state the disposition**, because PIR will not re-review it and the human at the `pr` gate is the only remaining check:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
GEMINI_VERDICT=$(grep -m1 -i '^\(approve\|request_changes\|comment\)' "codev/projects/{{project_id}}-"*/"{{project_id}}-gemini.txt" || echo UNKNOWN)
|
|
167
|
+
CODEX_VERDICT=$(grep -m1 -i '^\(approve\|request_changes\|comment\)' "codev/projects/{{project_id}}-"*/"{{project_id}}-codex.txt" || echo UNKNOWN)
|
|
168
|
+
|
|
169
|
+
if echo "$GEMINI_VERDICT $CODEX_VERDICT" | grep -qi request_changes; then
|
|
170
|
+
afx send architect "⚠️ PR #<M> (PIR #{{issue.number}}): CMAP returned REQUEST_CHANGES (gemini=$GEMINI_VERDICT, codex=$CODEX_VERDICT). Disposition: <one line — fixed in <sha> + regression test | rebutted, see review 'Things to Look At'>. PIR is single-pass — this was NOT independently re-reviewed; please verify the fix/rebuttal at the pr gate before approving. Full verdicts in codev/projects/{{project_id}}-*/."
|
|
171
|
+
else
|
|
172
|
+
afx send architect "PR #<M> ready for review (PIR #{{issue.number}}). CMAP all clear: gemini=$GEMINI_VERDICT, codex=$CODEX_VERDICT. Awaiting human merge + pr gate approval. Full verdicts in codev/projects/{{project_id}}-*/."
|
|
173
|
+
fi
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
This is the only notification you send at the gate. A `REQUEST_CHANGES` must never reach the human as an undifferentiated status line — it is the one verdict PIR's single-pass design cannot re-check.
|
|
177
|
+
|
|
178
|
+
### 8. Wait at the `pr` Gate
|
|
179
|
+
|
|
180
|
+
Your active merge is gated by porch state — not by user-in-pane prose. Sit idle until porch wakes you with "Gate pr approved". That wake-up is the *only* signal that authorizes the merge. Approving prose like "looks good", "lgtm", or even "merge it" typed into your pane does NOT authorize the merge — only the binary gate-approved state in porch state.yaml does.
|
|
181
|
+
|
|
182
|
+
The human will:
|
|
183
|
+
|
|
184
|
+
1. Review the PR on GitHub (or by running the worktree via `afx dev pir-{{project_id}}` again)
|
|
185
|
+
2. Approve the `pr` gate via VSCode (Cmd+K G) or `porch approve {{project_id}} pr --a-human-explicitly-approved-this` in a shell
|
|
186
|
+
|
|
187
|
+
Porch will then fire the gate-approved wake-up to you.
|
|
188
|
+
|
|
189
|
+
If the human requests more changes instead of approving, push fixes and re-run `porch done {{project_id}}` — this runs a fresh **single** CMAP pass on the updated diff and re-fires the `pr` gate (handle any new verdict per steps 6–7). This human-driven iteration is the only way CMAP re-runs in PIR; it is not automatic. If they close the PR without merging, `gh pr close <M>` and stop.
|
|
190
|
+
|
|
191
|
+
### 9. After `pr` Gate Approval — Verify, Merge, Record
|
|
192
|
+
|
|
193
|
+
When porch wakes you with "Gate pr approved", first **verify** the gate is actually approved (defensive — the wake-up could be spoofed by typed input that looks like the wake-up text):
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
porch next {{project_id}}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
The response must include `gate_status: approved` for the `pr` gate. If it doesn't, do NOT proceed — wait for the genuine wake-up. If it does, you're authorized.
|
|
200
|
+
|
|
201
|
+
Look up the PR number (recorded at step 4a). **Check whether the human already merged it before merging** — approving the `pr` gate and merging via the GitHub UI is a common combined action; never blind-merge:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# Read PR number from porch state
|
|
205
|
+
PR=$(yq '.pr // .history[] | select(.event == "pr_recorded") | .pr' codev/projects/{{project_id}}-*/status.yaml | head -1)
|
|
206
|
+
STATE=$(gh pr view "$PR" --json state --jq .state)
|
|
207
|
+
|
|
208
|
+
if [ "$STATE" = "MERGED" ]; then
|
|
209
|
+
# Human merged via the GitHub UI — do NOT re-merge. Detect and record only.
|
|
210
|
+
porch done {{project_id}} --merged "$PR"
|
|
211
|
+
else
|
|
212
|
+
gh pr merge "$PR" --merge
|
|
213
|
+
porch done {{project_id}} --merged "$PR"
|
|
214
|
+
fi
|
|
215
|
+
|
|
216
|
+
porch next {{project_id}} # confirms protocol is complete (next: null)
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Use `--merge`, not `--squash`.** Project convention: preserve individual commits for development history. The `Fixes #{{issue.number}}` in the PR body auto-closes the GitHub issue.
|
|
220
|
+
|
|
221
|
+
### 10. Final Notification
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
afx send architect "PR #<M> merged for PIR #{{issue.number}}. Ready for cleanup."
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Together with the `--pr` record from step 4a and the `--merged` record from step 9, porch's `status.yaml` carries the complete PR lifecycle (created → merged → done) for analytics, status displays, and audit trails.
|
|
228
|
+
|
|
229
|
+
## Signals
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
<signal>PHASE_COMPLETE</signal> # PR merged, project complete
|
|
233
|
+
<signal>BLOCKED:reason</signal> # Cannot proceed
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## What NOT to Do
|
|
237
|
+
|
|
238
|
+
- **Don't merge before the `pr` gate is approved.** CMAP-APPROVE is NOT merge authorization. User-in-pane prose ("looks good", "lgtm", "merge it") is NOT merge authorization. The *only* signal that authorizes `gh pr merge` is porch reporting `gate_status: approved` for the `pr` gate (which only the user can do, via Cmd+K G or `porch approve` from a non-Claude shell). If `porch next` doesn't show the gate as approved, you wait.
|
|
239
|
+
- Don't skip porch's PR/merge records (steps 4a, 9). The `--pr` record (step 4a) lets the gate-pending state link to the actual PR; the `--merged` record (step 9) closes the lifecycle in porch state. Skipping either leaves `history:` empty and downstream tooling blind.
|
|
240
|
+
- Don't run `porch approve` for any gate yourself
|
|
241
|
+
- Don't push to main — only merge via PR
|
|
242
|
+
- Don't skip the Architecture Updates / Lessons Learned sections — porch checks enforce their presence (the section must exist; explaining "no changes needed" in one line is fine)
|
|
243
|
+
- **Don't run `consult` commands yourself** — porch handles consultations via the `verify` block. Manually invoking `consult` causes CMAP to run twice.
|
|
244
|
+
- **Don't fix, skip, or quarantine pre-existing failures unrelated to your change.** Porch's `checks` for this phase are narrow *structural* gates (`pr_exists`, review-section presence) — a green gate does **not** certify the wider build/test suite. If the broader suite surfaces failures your diff did not cause, they are out of scope: note them in the review's Lessons Learned / Things to Look At and proceed. Touching another team's tests to make an unrelated red go green is scope creep, not diligence.
|
|
245
|
+
|
|
246
|
+
## Handling Problems
|
|
247
|
+
|
|
248
|
+
**If the PR cannot be created (e.g., merge conflicts with main):**
|
|
249
|
+
- Rebase on main: `git fetch origin main && git rebase origin/main`
|
|
250
|
+
- Resolve conflicts (do NOT use destructive shortcuts)
|
|
251
|
+
- Force-push with lease: `git push --force-with-lease`
|
|
252
|
+
- Re-run `gh pr create`
|
|
253
|
+
|
|
254
|
+
**If porch's CMAP consults fail (e.g., model unavailable):**
|
|
255
|
+
- `porch done` will report the failure. Inspect `codev/projects/{{project_id}}-*/{{project_id}}-<model>.txt` for the failure details.
|
|
256
|
+
- Re-run `porch done {{project_id}}` once — porch will retry the consult.
|
|
257
|
+
- If the model is persistently unavailable, notify the architect and ask whether to proceed without that model's verdict. They may direct you to skip via a manual override.
|
|
258
|
+
|
|
259
|
+
**If the architect doesn't respond within a reasonable window:**
|
|
260
|
+
- Send one follow-up via `afx send architect "..."` after a few hours
|
|
261
|
+
- Do not auto-merge
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../protocol-schema.json",
|
|
3
|
+
"name": "pir",
|
|
4
|
+
"alias": "plan-implement-review",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": "PIR: Plan → Implement → Review with build-verify cycles and two pre-PR human gates (plan-approval, dev-approval), for GitHub-issue-driven work.",
|
|
7
|
+
"input": {
|
|
8
|
+
"type": "github-issue",
|
|
9
|
+
"required": true,
|
|
10
|
+
"default_for": ["--issue", "-i"]
|
|
11
|
+
},
|
|
12
|
+
"hooks": {
|
|
13
|
+
"pre-spawn": {
|
|
14
|
+
"collision-check": true,
|
|
15
|
+
"comment-on-issue": "On it! Working on this with the PIR protocol (plan + dev-approval gates before PR)."
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"phases": [
|
|
19
|
+
{
|
|
20
|
+
"id": "plan",
|
|
21
|
+
"name": "Plan",
|
|
22
|
+
"description": "Read the issue, investigate the codebase, write codev/plans/<id>-<slug>.md, await plan-approval",
|
|
23
|
+
"type": "build_verify",
|
|
24
|
+
"build": {
|
|
25
|
+
"prompt": "plan.md",
|
|
26
|
+
"artifact": "codev/plans/${PROJECT_TITLE}.md"
|
|
27
|
+
},
|
|
28
|
+
"verify": null,
|
|
29
|
+
"max_iterations": 1,
|
|
30
|
+
"on_complete": {
|
|
31
|
+
"commit": true,
|
|
32
|
+
"push": true
|
|
33
|
+
},
|
|
34
|
+
"checks": {
|
|
35
|
+
"plan_exists": "test -f codev/plans/${PROJECT_TITLE}.md"
|
|
36
|
+
},
|
|
37
|
+
"gate": "plan-approval",
|
|
38
|
+
"next": "implement"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": "implement",
|
|
42
|
+
"name": "Implement",
|
|
43
|
+
"description": "Write code + tests, run build/test checks, await dev-approval on the running worktree",
|
|
44
|
+
"type": "build_verify",
|
|
45
|
+
"build": {
|
|
46
|
+
"prompt": "implement.md",
|
|
47
|
+
"artifact": "src/**/*.{ts,tsx,js,jsx,py,go,rs}"
|
|
48
|
+
},
|
|
49
|
+
"verify": null,
|
|
50
|
+
"max_iterations": 1,
|
|
51
|
+
"on_complete": {
|
|
52
|
+
"commit": true,
|
|
53
|
+
"push": true
|
|
54
|
+
},
|
|
55
|
+
"checks": {
|
|
56
|
+
"build": {
|
|
57
|
+
"command": "npm run build",
|
|
58
|
+
"on_fail": "retry",
|
|
59
|
+
"max_retries": 2
|
|
60
|
+
},
|
|
61
|
+
"tests": {
|
|
62
|
+
"command": "npm test",
|
|
63
|
+
"on_fail": "retry",
|
|
64
|
+
"max_retries": 2
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"gate": "dev-approval",
|
|
68
|
+
"next": "review"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"id": "review",
|
|
72
|
+
"name": "Review",
|
|
73
|
+
"description": "Write retrospective (arch + lessons), push, open PR with review as body, run CMAP, then wait at pr gate while the human merges on GitHub",
|
|
74
|
+
"type": "build_verify",
|
|
75
|
+
"build": {
|
|
76
|
+
"prompt": "review.md",
|
|
77
|
+
"artifact": "codev/reviews/${PROJECT_TITLE}.md"
|
|
78
|
+
},
|
|
79
|
+
"verify": {
|
|
80
|
+
"type": "impl",
|
|
81
|
+
"models": ["gemini", "codex"],
|
|
82
|
+
"parallel": true
|
|
83
|
+
},
|
|
84
|
+
"max_iterations": 1,
|
|
85
|
+
"on_complete": {
|
|
86
|
+
"commit": true,
|
|
87
|
+
"push": true
|
|
88
|
+
},
|
|
89
|
+
"checks": {
|
|
90
|
+
"pr_exists": {
|
|
91
|
+
"command": "gh pr list --state all --head \"$(git branch --show-current)\" --json number --jq 'length' | grep -q '^[1-9]'",
|
|
92
|
+
"description": "PR must be created before signaling completion"
|
|
93
|
+
},
|
|
94
|
+
"review_has_arch_updates": {
|
|
95
|
+
"command": "grep -q '## Architecture Updates' codev/reviews/${PROJECT_TITLE}.md",
|
|
96
|
+
"description": "Review must include '## Architecture Updates' section (what changed in arch.md, or why no changes needed)"
|
|
97
|
+
},
|
|
98
|
+
"review_has_lessons_updates": {
|
|
99
|
+
"command": "grep -q '## Lessons Learned Updates' codev/reviews/${PROJECT_TITLE}.md",
|
|
100
|
+
"description": "Review must include '## Lessons Learned Updates' section (what changed in lessons-learned.md, or why no changes needed)"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"gate": "pr",
|
|
104
|
+
"next": null
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"signals": {
|
|
108
|
+
"PHASE_COMPLETE": {
|
|
109
|
+
"description": "Signal current build phase is complete",
|
|
110
|
+
"transitions_to": "next_phase"
|
|
111
|
+
},
|
|
112
|
+
"BLOCKED": {
|
|
113
|
+
"description": "Signal implementation is blocked",
|
|
114
|
+
"requires": "reason"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"defaults": {
|
|
118
|
+
"mode": "strict",
|
|
119
|
+
"max_iterations": 1,
|
|
120
|
+
"consultation": {
|
|
121
|
+
"enabled": true,
|
|
122
|
+
"parallel": true
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# PIR Protocol
|
|
2
|
+
|
|
3
|
+
> **Plan → Implement → Review** for GitHub-issue-driven work that needs human review of *either* the approach (before code is written) *or* the implementation (before a PR exists), or both. Lighter than SPIR/ASPIR (no `specify` phase — the GitHub issue is the implicit spec) with the human dev-approval moved earlier (pre-PR instead of post-PR). Stronger than BUGFIX/AIR (two human gates before the PR).
|
|
4
|
+
|
|
5
|
+
## When to Use PIR
|
|
6
|
+
|
|
7
|
+
Pick PIR when working from a GitHub Issue and ONE or BOTH of the following apply — based on the *nature* of the change, not its size:
|
|
8
|
+
|
|
9
|
+
### 1. The approach needs review before coding starts
|
|
10
|
+
- Root cause is ambiguous; multiple valid fixes exist
|
|
11
|
+
- Area is unfamiliar or high-blast-radius (shared utilities, auth, migrations, public APIs)
|
|
12
|
+
- Design-sensitive (affects conventions, patterns, architecture)
|
|
13
|
+
- Cheaper to redirect at plan time than at PR time
|
|
14
|
+
|
|
15
|
+
### 2. The implementation needs to be tested before a PR is created
|
|
16
|
+
The PR diff alone is insufficient; the reviewer must *run* the code:
|
|
17
|
+
- Mobile app changes (needs device testing on Android, iOS, possibly web)
|
|
18
|
+
- UI / UX changes (visual inspection, interaction flow, accessibility)
|
|
19
|
+
- Hardware-adjacent behavior (sensors, camera, permissions, notifications)
|
|
20
|
+
- Integration with external services that don't mock cleanly (OAuth, payments, analytics)
|
|
21
|
+
- User-journey changes that need a full-flow exercise
|
|
22
|
+
- Performance-sensitive changes that need profiling on the running app
|
|
23
|
+
|
|
24
|
+
### Use SPIR / ASPIR / BUGFIX / AIR instead when
|
|
25
|
+
- **SPIR / ASPIR**: the change is complex enough to warrant careful specification, multi-agent consultation at every phase, and the full spec → plan → implement → review ceremony with file artifacts. The driving issue is incidental — what matters is that the design work deserves a formal spec and the implementation deserves consult-driven review at each phase
|
|
26
|
+
- **BUGFIX**: small bug fix, no design review needed, diff-on-PR review is enough
|
|
27
|
+
- **AIR**: small feature from an issue, autonomous, diff-on-PR review is enough
|
|
28
|
+
|
|
29
|
+
## How PIR Differs from SPIR
|
|
30
|
+
|
|
31
|
+
PIR is structurally *SPIR minus the `specify` phase*, with the human dev-approval moved earlier (pre-PR instead of post-PR).
|
|
32
|
+
|
|
33
|
+
| Aspect | SPIR | PIR |
|
|
34
|
+
|---|---|---|
|
|
35
|
+
| Phases | specify → plan → implement → review → verify | plan → implement → review |
|
|
36
|
+
| Spec artifact | `codev/specs/<id>-<slug>.md` | GitHub Issue body (implicit spec) |
|
|
37
|
+
| Plan artifact | `codev/plans/<id>-<slug>.md` | Same — committed on builder branch |
|
|
38
|
+
| Review artifact | `codev/reviews/<id>-<slug>.md` (Summary + Architecture Updates + Lessons Learned, becomes PR body) | **Same shape** — `codev/reviews/<id>-<slug>.md` with the same sections, also becomes PR body |
|
|
39
|
+
| Human gates | spec-approval, plan-approval, pr, verify-approval | plan-approval, dev-approval, pr |
|
|
40
|
+
| Where code is reviewed by the human | On the PR (post-creation) — read the diff | Pre-PR (at the `dev-approval` gate) — read the diff **and run the worktree locally** |
|
|
41
|
+
|
|
42
|
+
The review file always includes Summary, Architecture Updates, and Lessons Learned sections so `codev/reviews/` stays semantically consistent across all protocols. PIR's lightness comes from skipping the `specify` phase (the issue body is the spec), not from cutting corners on the retrospective.
|
|
43
|
+
|
|
44
|
+
The `dev-approval` gate is what makes PIR genuinely different: the human gates the *running implementation* via the worktree before the PR exists, instead of gating the PR after creation.
|
|
45
|
+
|
|
46
|
+
## Phases
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
plan → implement → review
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Plan (gated by `plan-approval`)
|
|
53
|
+
|
|
54
|
+
The builder:
|
|
55
|
+
1. Reads the GitHub issue and investigates the codebase
|
|
56
|
+
2. Writes `codev/plans/<id>-<slug>.md` with: Understanding / Proposed change / Files to change / Risks & alternatives / Test plan
|
|
57
|
+
3. Commits the plan on the builder branch and pushes
|
|
58
|
+
4. Runs `porch done` and `porch next` — the `plan-approval` gate becomes pending
|
|
59
|
+
5. Sits at the interactive prompt waiting for review
|
|
60
|
+
|
|
61
|
+
**Reviewer paths** (all equivalent):
|
|
62
|
+
- Open `codev/plans/<id>-<slug>.md` in the worktree, read and / or edit directly, save
|
|
63
|
+
- Type feedback into the builder's PTY pane — the builder is alive in interactive mode
|
|
64
|
+
- `afx send <builder-id> "<feedback>"`
|
|
65
|
+
- Comment on the GitHub issue (sidecar discussion)
|
|
66
|
+
|
|
67
|
+
When satisfied, approve via VSCode's "Approve Gate" command (Cmd+K G) or:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
porch approve <id> plan-approval --a-human-explicitly-approved-this
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Implement (gated by `dev-approval`)
|
|
74
|
+
|
|
75
|
+
The builder:
|
|
76
|
+
1. Reads the approved plan file
|
|
77
|
+
2. Writes code and tests; runs build + tests via the `checks` block
|
|
78
|
+
3. *No AI consult on this phase* — the human at the `dev-approval` gate is the sole reviewer of the running code. Matches BUGFIX / AIR's pattern of "no consult on implementation, one consult at PR creation".
|
|
79
|
+
4. Pushes the branch
|
|
80
|
+
5. Runs `porch done` and `porch next` — the `dev-approval` gate becomes pending
|
|
81
|
+
6. Outputs a **prose** dev-approval summary in the PTY pane (Summary / Files / Test results / Things to look at / How to test locally). This is a transient message to orient the human reviewer — **not a committed file**. The retrospective file is written in the next phase, after the human approves the running code.
|
|
82
|
+
7. Sits at the interactive prompt
|
|
83
|
+
|
|
84
|
+
**The reviewer's killer move**: run the worktree locally.
|
|
85
|
+
|
|
86
|
+
- VSCode: right-click the builder in the Codev sidebar → **Run Dev Server** (spawns `afx dev <builder-id>` via Tower)
|
|
87
|
+
- CLI: `afx dev <builder-id>`
|
|
88
|
+
|
|
89
|
+
The dev server uses **the same ports and URLs as main** intentionally (OAuth callbacks, CORS, cookie scoping all depend on consistent origins). Only one dev env runs at a time; stop main's `pnpm dev` before starting the worktree's, or use VSCode's **Stop Dev Server** to swap.
|
|
90
|
+
|
|
91
|
+
Reviewer tests the change on real devices / browsers / simulators. When satisfied, approves via Cmd+K G or:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
porch approve <id> dev-approval --a-human-explicitly-approved-this
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Review (gated by `pr`)
|
|
98
|
+
|
|
99
|
+
The builder:
|
|
100
|
+
1. Writes `codev/reviews/<id>-<slug>.md` with **Summary**, **Architecture Updates**, **Lessons Learned Updates**, plus the supporting sections (Files Changed, Commits, Test Results, Things to Look At, How to Test Locally).
|
|
101
|
+
2. Updates `codev/resources/arch.md` and/or `codev/resources/lessons-learned.md` if real changes need recording. If not, the review file's sections state "no changes needed" with a one-line explanation (the porch `checks` block enforces section presence, not content).
|
|
102
|
+
3. Commits the review file (and arch / lessons updates if any) and pushes
|
|
103
|
+
4. Opens a PR with `gh pr create`; PR body is the review file content + `Fixes #<N>`. Records the PR with `porch done <id> --pr <M> --branch <name>`.
|
|
104
|
+
5. Runs `porch done <id>` — porch's `verify` block runs CMAP-2 (Gemini + Codex, type=impl) as a **single advisory pass** (`max_iterations: 1`); CMAP outputs land in `codev/projects/<id>-*/`. There is no iterate-until-APPROVE loop: whatever the verdicts, porch records them and advances to the `pr` gate. A `REQUEST_CHANGES` is not auto-re-reviewed — the builder addresses or rebuts it, adds a regression test if it's a real defect, and escalates it in the architect notification so the human verifies it at the `pr` gate. Outcomes are not auto-appended to the PR body; reviewers with the worktree read them from the projects dir.
|
|
105
|
+
6. The `pr` gate fires (pending) regardless of verdict. Builder notifies the architect once — leading with any `REQUEST_CHANGES` and its disposition (since PIR will not re-review it) rather than burying it in a flat status line.
|
|
106
|
+
7. Builder waits at the `pr` gate. The human reviews the PR on GitHub, then approves the `pr` gate (Cmd+K G or `porch approve <id> pr --a-human-explicitly-approved-this`). Porch wakes the builder.
|
|
107
|
+
8. Builder verifies the gate is genuinely approved via `porch next` (defensive — typed prose can't trigger this branch, only real porch state does), then runs `gh pr merge --merge`, records via `porch done --merged <M>`, and sends the cleanup-ready notification. Protocol complete (`next: null`).
|
|
108
|
+
|
|
109
|
+
## Gates
|
|
110
|
+
|
|
111
|
+
PIR uses porch's existing gate machinery. Gate names are opaque strings; no porch engine changes are needed.
|
|
112
|
+
|
|
113
|
+
- **`plan-approval`** — pre-PR. Human reads the plan file (committed on the builder branch) and approves before any code is written. Gates are keyed by `(project_id, gate_name)` so the name is safe to share with other protocols.
|
|
114
|
+
- **`dev-approval`** — pre-PR. The human reviews the *running* worktree (via `afx dev`) before any PR exists. This is PIR's distinctive gate.
|
|
115
|
+
- **`pr`** — post-PR. Gates the merge step. The human reviews the PR on GitHub and approves this gate; porch wakes the builder, which then runs `gh pr merge`. The gate exists so the merge trigger is structured porch state (binary approved/not), not free-text prose typed into the builder's pane. Eliminates the self-merge bug class: builders can't infer authorization from ambiguous user input.
|
|
116
|
+
|
|
117
|
+
When a gate becomes pending, porch broadcasts `overview-changed` via SSE. The VSCode Builders tree picks up the blocked state and renders it with a bell icon; a toast surfaces the new gate-pending event. Architect notification is *not* automatic — gates surface via the toast/sidebar (for IDE users) or by checking the builder pane / `porch pending` (for CLI users). The builder's job at any gate is to write the artifact, commit, signal completion, and wait — never to invoke `porch approve` itself (Claude refuses the `--a-human-explicitly-approved-this` flag by design).
|
|
118
|
+
|
|
119
|
+
## Rejection / Feedback Model
|
|
120
|
+
|
|
121
|
+
There is no formal `porch reject` command. Rejection works via the feedback-iterate pattern:
|
|
122
|
+
|
|
123
|
+
1. Reviewer provides feedback (edit the plan file in VSCode, type in the builder pane, `afx send`, or issue comment)
|
|
124
|
+
2. Builder reads the feedback on its next turn, revises the artifact, recommits
|
|
125
|
+
3. The gate remains pending — porch doesn't advance until the human runs `porch approve`
|
|
126
|
+
|
|
127
|
+
The same pattern works at both gates.
|
|
128
|
+
|
|
129
|
+
## Builder Session Lifetime
|
|
130
|
+
|
|
131
|
+
The builder is a long-running interactive Claude Code session in a PTY pane managed by Tower. The session is launched as `claude "<prompt>"` (no `--print`) inside a `while true` restart loop. That form starts an interactive Claude REPL with the prompt as the first user message; after Claude finishes the prompted work it sits at the input prompt awaiting next user input. The outer `while true` loop only fires if Claude crashes — it is a crash-recovery safety net, not the gate-wait mechanism.
|
|
132
|
+
|
|
133
|
+
This means typed input in the builder pane reaches the live Claude session immediately, exactly like any other interactive Claude Code conversation. There is no "session ended at gate" state to worry about under normal operation.
|
|
134
|
+
|
|
135
|
+
## Configuration
|
|
136
|
+
|
|
137
|
+
PIR uses the same `.codev/config.json` configuration as other protocols. The `worktree` block (from Issue 689) enables the at-gate dev-server review flow:
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"worktree": {
|
|
142
|
+
"symlinks": [".env.local", "packages/*/.env"],
|
|
143
|
+
"postSpawn": ["pnpm install --frozen-lockfile"],
|
|
144
|
+
"devCommand": "pnpm dev"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Without `worktree.devCommand`, `afx dev` won't work and the `dev-approval` gate degenerates to a diff-read — at which point you should probably use AIR or BUGFIX instead.
|
|
150
|
+
|
|
151
|
+
## Multi-Agent Consultation
|
|
152
|
+
|
|
153
|
+
- **plan**: human-only review. No AI consultation.
|
|
154
|
+
- **implement**: no AI consult — the human at the `dev-approval` gate is the sole reviewer of the running code.
|
|
155
|
+
- **review**: CMAP-2 (Gemini + Codex, type=impl) after the PR is opened, as a **single advisory pass** (`max_iterations: 1`). Same pattern as BUGFIX / AIR's PR-creation consult.
|
|
156
|
+
|
|
157
|
+
CMAP at the PR is a single pass — there is **no iterate-until-APPROVE loop**. A `REQUEST_CHANGES` does not block or re-trigger CMAP; the builder addresses or rebuts it and escalates it to the human at the `pr` gate, who is the sole remaining reviewer of any resulting fix (CMAP does not re-check it).
|
|
158
|
+
|
|
159
|
+
Net: PIR runs **two model calls per protocol run**, matching its BUGFIX/AIR peers — its distinguishing features are the two human gates (`plan-approval`, `dev-approval`), not AI-consult density.
|
|
160
|
+
|
|
161
|
+
**The 2-model footprint is a design invariant.** porch's model precedence is *config > protocol* (`porch.consultation.models` in `.codev/config.json` overrides a protocol's declared `verify.models`). A project-wide setting tuned for SPIR (gemini + codex + claude) will silently inflate PIR to a 3-model pass, breaking the BUGFIX/AIR-parity cost story. To keep PIR at CMAP-2, leave `porch.consultation.models` unset or scope it per-protocol.
|
|
162
|
+
|
|
163
|
+
To disable consultation entirely, say "without multi-agent consultation" when starting work.
|
|
164
|
+
|
|
165
|
+
## Signals
|
|
166
|
+
|
|
167
|
+
PIR uses the standard porch signal vocabulary:
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
<signal>PHASE_COMPLETE</signal> # Current phase build complete
|
|
171
|
+
<signal>BLOCKED:reason</signal> # Cannot proceed
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Signals are informational for log readability. The state machine is driven by `porch done` and `porch next` CLI calls inside the builder turn.
|
|
175
|
+
|
|
176
|
+
## Commit Messages
|
|
177
|
+
|
|
178
|
+
Commits during PIR phases use the issue-driven format:
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
[PIR #<N>] Plan draft
|
|
182
|
+
[PIR #<N>] Implement avatar masking
|
|
183
|
+
[PIR #<N>] Add Android-side regression test
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
The PR title follows the project's existing PR convention.
|
|
187
|
+
|
|
188
|
+
## Branch Naming
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
builder/pir-<issue-number>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Example: `builder/pir-842` for a PIR spawn against GitHub issue #842.
|
|
195
|
+
|
|
196
|
+
## File Locations
|
|
197
|
+
|
|
198
|
+
```
|
|
199
|
+
codev/plans/<id>-<slug>.md # written in plan phase, on builder branch
|
|
200
|
+
codev/reviews/<id>-<slug>.md # written in review phase (post-dev-approval-approval), on builder branch; becomes PR body
|
|
201
|
+
codev/projects/<id>-<slug>/status.yaml # porch state, managed automatically
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The plan and review files ship to `main` with the merged PR — durable, searchable, git-versioned. The review file includes Summary + Architecture Updates + Lessons Learned + supporting sections, so `codev/reviews/` stays semantically consistent across protocols.
|
|
@@ -12,10 +12,34 @@ This project uses **Codev** for AI-assisted development.
|
|
|
12
12
|
- **ASPIR**: Autonomous SPIR — no human gates on spec/plan (`codev/protocols/aspir/protocol.md`)
|
|
13
13
|
- **AIR**: Autonomous Implement & Review for small features (`codev/protocols/air/protocol.md`)
|
|
14
14
|
- **BUGFIX**: Bug fixes from GitHub issues (`codev/protocols/bugfix/protocol.md`)
|
|
15
|
+
- **PIR**: Plan / Implement / Review — issue-driven with three human gates (plan-approval, dev-approval, pr) (`codev/protocols/pir/protocol.md`)
|
|
15
16
|
- **EXPERIMENT**: Disciplined experimentation (`codev/protocols/experiment/protocol.md`)
|
|
16
17
|
- **MAINTAIN**: Codebase maintenance (`codev/protocols/maintain/protocol.md`)
|
|
17
18
|
- **RESEARCH**: Multi-agent research with 3-way investigation, synthesis, and critique (`codev/protocols/research/protocol.md`)
|
|
18
19
|
|
|
20
|
+
## File Resolution (How Codev Finds Protocols and Templates)
|
|
21
|
+
|
|
22
|
+
Codev resolves protocol files, prompts, agent definitions, and roles through a four-tier lookup (highest priority first):
|
|
23
|
+
|
|
24
|
+
1. `.codev/<path>` — user override (project-local customization)
|
|
25
|
+
2. `codev/<path>` — project-local copy (customized and checked in)
|
|
26
|
+
3. Runtime cache
|
|
27
|
+
4. **Installed package skeleton** — ships with `@cluesmith/codev` (the default for every standard protocol)
|
|
28
|
+
|
|
29
|
+
**The absence of `codev/protocols/<name>/` on disk is not a missing reference** — it's the normal case for any protocol you haven't customized. The protocol resolves from the installed package's skeleton at runtime. Only protocols you want to customize need to live in your repo's `codev/protocols/`.
|
|
30
|
+
|
|
31
|
+
**Implication for `codev update` and CLAUDE.md / AGENTS.md merges:** when an updated template references a protocol, do NOT drop the reference because `codev/protocols/<name>/` is absent locally. The protocol resolves via the package skeleton, and dropping the reference removes it from your available-protocol list while it's still callable from the CLI.
|
|
32
|
+
|
|
33
|
+
## Protocol Verification (When You Don't Recognize a Protocol Name)
|
|
34
|
+
|
|
35
|
+
If the user mentions a protocol name you don't immediately recognize, verify against the CLI before responding:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
afx spawn --protocol <name> --help
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This succeeds if the protocol is registered (including via the skeleton fallback in tier 4 of the resolution chain) and errors helpfully otherwise. The CLI is the source of truth — defer to it when in doubt.
|
|
42
|
+
|
|
19
43
|
## Key Locations
|
|
20
44
|
|
|
21
45
|
- **Specs**: `codev/specs/` - Feature specifications (WHAT to build)
|