@cluesmith/codev 3.0.3 → 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.d.ts.map +1 -1
- package/dist/agent-farm/cli.js +16 -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 +82 -36
- package/dist/agent-farm/commands/spawn.js.map +1 -1
- package/dist/agent-farm/commands/stop.d.ts.map +1 -1
- package/dist/agent-farm/commands/stop.js +15 -8
- package/dist/agent-farm/commands/stop.js.map +1 -1
- package/dist/agent-farm/commands/workspace-add-architect.d.ts +18 -0
- package/dist/agent-farm/commands/workspace-add-architect.d.ts.map +1 -0
- package/dist/agent-farm/commands/workspace-add-architect.js +54 -0
- package/dist/agent-farm/commands/workspace-add-architect.js.map +1 -0
- package/dist/agent-farm/db/index.d.ts.map +1 -1
- package/dist/agent-farm/db/index.js +88 -1
- package/dist/agent-farm/db/index.js.map +1 -1
- package/dist/agent-farm/db/migrate.js +2 -2
- package/dist/agent-farm/db/migrate.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 +4 -3
- package/dist/agent-farm/db/schema.js.map +1 -1
- package/dist/agent-farm/db/types.d.ts +7 -2
- package/dist/agent-farm/db/types.d.ts.map +1 -1
- package/dist/agent-farm/db/types.js +2 -0
- package/dist/agent-farm/db/types.js.map +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-instances.d.ts +18 -0
- package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-instances.js +260 -16
- package/dist/agent-farm/servers/tower-instances.js.map +1 -1
- package/dist/agent-farm/servers/tower-messages.d.ts +10 -1
- package/dist/agent-farm/servers/tower-messages.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-messages.js +137 -7
- package/dist/agent-farm/servers/tower-messages.js.map +1 -1
- package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-routes.js +124 -20
- package/dist/agent-farm/servers/tower-routes.js.map +1 -1
- package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-terminals.js +58 -28
- package/dist/agent-farm/servers/tower-terminals.js.map +1 -1
- package/dist/agent-farm/servers/tower-tunnel.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-tunnel.js +3 -2
- package/dist/agent-farm/servers/tower-tunnel.js.map +1 -1
- package/dist/agent-farm/servers/tower-types.d.ts +9 -2
- package/dist/agent-farm/servers/tower-types.d.ts.map +1 -1
- package/dist/agent-farm/state.d.ts +50 -4
- package/dist/agent-farm/state.d.ts.map +1 -1
- package/dist/agent-farm/state.js +118 -12
- package/dist/agent-farm/state.js.map +1 -1
- package/dist/agent-farm/types.d.ts +3 -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/agent-farm/utils/architect-name.d.ts +37 -0
- package/dist/agent-farm/utils/architect-name.d.ts.map +1 -0
- package/dist/agent-farm/utils/architect-name.js +63 -0
- package/dist/agent-farm/utils/architect-name.js.map +1 -0
- package/dist/agent-farm/utils/git.d.ts +29 -0
- package/dist/agent-farm/utils/git.d.ts.map +1 -0
- package/dist/agent-farm/utils/git.js +38 -0
- package/dist/agent-farm/utils/git.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/consult/index.d.ts.map +1 -1
- package/dist/commands/consult/index.js +2 -0
- package/dist/commands/consult/index.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 +5 -5
- package/skeleton/protocols/air/builder-prompt.md +6 -0
- package/skeleton/protocols/air/consult-types/impl-review.md +6 -0
- package/skeleton/protocols/air/consult-types/pr-review.md +6 -0
- package/skeleton/protocols/air/prompts/implement.md +6 -0
- package/skeleton/protocols/air/protocol.md +4 -0
- package/skeleton/protocols/aspir/builder-prompt.md +19 -3
- package/skeleton/protocols/aspir/consult-types/plan-review.md +6 -0
- package/skeleton/protocols/aspir/consult-types/spec-review.md +6 -0
- package/skeleton/protocols/aspir/prompts/specify.md +6 -0
- package/skeleton/protocols/aspir/protocol.md +4 -0
- package/skeleton/protocols/bugfix/consult-types/impl-review.md +44 -37
- package/skeleton/protocols/bugfix/consult-types/pr-review.md +65 -40
- 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/protocols/spir/builder-prompt.md +19 -3
- package/skeleton/protocols/spir/consult-types/plan-review.md +6 -0
- package/skeleton/protocols/spir/consult-types/spec-review.md +6 -0
- package/skeleton/protocols/spir/prompts/specify.md +6 -0
- package/skeleton/protocols/spir/protocol.md +4 -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,156 @@
|
|
|
1
|
+
# IMPLEMENT Phase Prompt
|
|
2
|
+
|
|
3
|
+
You are executing the **IMPLEMENT** phase of the PIR protocol.
|
|
4
|
+
|
|
5
|
+
## Your Goal
|
|
6
|
+
|
|
7
|
+
Implement the approved plan, write tests, and pause at the `dev-approval` gate so the human can verify behavior by running the worktree locally. No file artifact is produced in this phase — the retrospective (review file) is written in the next phase, after the human has approved the running code.
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
- **Project ID**: {{project_id}}
|
|
12
|
+
- **Issue Number**: #{{issue.number}}
|
|
13
|
+
- **Issue Title**: {{issue.title}}
|
|
14
|
+
- **Plan File**: `codev/plans/{{artifact_name}}.md` (already approved)
|
|
15
|
+
|
|
16
|
+
## Resumption Check (do this FIRST)
|
|
17
|
+
|
|
18
|
+
Run `porch next {{project_id}}`. If the response is `gate_pending` on `dev-approval`, the code is already written and you're awaiting review. In that case:
|
|
19
|
+
|
|
20
|
+
1. Check for feedback:
|
|
21
|
+
- `git diff main` — has the reviewer made any direct edits to your code?
|
|
22
|
+
- `gh issue view {{issue.number}} --comments`
|
|
23
|
+
- `afx send` queue messages
|
|
24
|
+
2. If feedback requires code changes: make them, re-run build + tests, recommit.
|
|
25
|
+
3. If feedback is a discussion question: respond and stay in the session.
|
|
26
|
+
|
|
27
|
+
Otherwise (`tasks` response — first run), continue below.
|
|
28
|
+
|
|
29
|
+
## Process
|
|
30
|
+
|
|
31
|
+
### 1. Re-Read the Plan
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
cat codev/plans/{{artifact_name}}.md
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The plan is your authoritative scope. Stick to it. If you discover the plan is wrong while implementing, stop and signal `BLOCKED` rather than silently deviating.
|
|
38
|
+
|
|
39
|
+
### 2. Implement the Code
|
|
40
|
+
|
|
41
|
+
Follow the plan's "Files to Change" section. Apply the changes.
|
|
42
|
+
|
|
43
|
+
**Code quality standards:**
|
|
44
|
+
- Self-documenting code (clear names, obvious structure)
|
|
45
|
+
- No commented-out code
|
|
46
|
+
- No debug prints
|
|
47
|
+
- Explicit error handling
|
|
48
|
+
- Follow project style guide
|
|
49
|
+
|
|
50
|
+
**Commit cadence:** commit each logical unit separately. Use the format:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
[PIR #{{issue.number}}] <Concise description of this commit's change>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Never use `git add .` or `git add -A`.** Stage files explicitly:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
git add path/to/changed-file.ts
|
|
60
|
+
git commit -m "[PIR #{{issue.number}}] ..."
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 3. Write Tests
|
|
64
|
+
|
|
65
|
+
The plan's "Test Plan" section lists what to verify. Write the corresponding tests:
|
|
66
|
+
|
|
67
|
+
- Unit tests for new functions
|
|
68
|
+
- Integration tests for cross-component flows
|
|
69
|
+
- Regression tests for any bug fixes
|
|
70
|
+
|
|
71
|
+
**Test quality:**
|
|
72
|
+
- Test behavior, not implementation
|
|
73
|
+
- Avoid overmocking — only mock external dependencies (APIs, databases, file systems)
|
|
74
|
+
- Use real implementations for internal module boundaries
|
|
75
|
+
|
|
76
|
+
### 4. Verify Everything Works
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npm run build # or project equivalent
|
|
80
|
+
npm test # or project equivalent
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Both MUST pass before signaling phase complete. If a test is flaky (intermittent failure unrelated to your changes), skip it with annotation — you'll document each skipped test in the review file in the next phase.
|
|
84
|
+
|
|
85
|
+
**Flaky ≠ pre-existing unrelated failure.** If the suite surfaces a *deterministic* failure your diff did not cause (e.g., a stale test broken by another team's earlier refactor, or a type error in an unrelated package), that is **out of scope** — do not fix it, skip it, or quarantine it to force a green. Note it for the review file's Lessons Learned and proceed. Porch's gate `checks` are narrow structural assertions, not a full-suite proof; making an unrelated red go green is scope creep, not diligence.
|
|
86
|
+
|
|
87
|
+
### 5. Push Your Branch
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
git push -u origin "$(git branch --show-current)"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
So the reviewer can pull / inspect from elsewhere if they want.
|
|
94
|
+
|
|
95
|
+
### 6. Signal Phase Complete
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
porch done {{project_id}}
|
|
99
|
+
porch next {{project_id}}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
PIR's `implement` phase has no AI consult — the `dev-approval` gate becomes pending immediately, and the human is the sole reviewer of the running code. (CMAP-2 runs later, in the `review` phase, after the human approves the gate and the PR is opened.)
|
|
103
|
+
|
|
104
|
+
### 7. End Your Turn With a Code-Review Summary (Prose, Not a File)
|
|
105
|
+
|
|
106
|
+
When the gate goes pending, output a short prose summary in the pane to orient the human reviewer. This is **not** a committed file — it's a transient message to help them inspect the change. Structure:
|
|
107
|
+
|
|
108
|
+
> **What changed**: 2–3 sentence summary.
|
|
109
|
+
>
|
|
110
|
+
> **Files**: `git diff --stat main` style list — paths and +/-.
|
|
111
|
+
>
|
|
112
|
+
> **Test results**: `npm run build` ✓, `npm test` ✓ (X tests, Y new).
|
|
113
|
+
>
|
|
114
|
+
> **Things to look at**: tricky spots, platform-specific behavior, anything you want the reviewer to focus on.
|
|
115
|
+
>
|
|
116
|
+
> **How to test locally**: VSCode → right-click builder → **Run Dev Server**, or `afx dev pir-{{project_id}}`. View diff via VSCode → **View Diff** (auto-detects the repo's default branch).
|
|
117
|
+
>
|
|
118
|
+
> Ready for review — type feedback here, or approve with `porch approve {{project_id}} dev-approval --a-human-explicitly-approved-this` (Cmd+K G in VSCode).
|
|
119
|
+
|
|
120
|
+
Then **stay in the interactive session**. Do not exit. Wait for the user's next message.
|
|
121
|
+
|
|
122
|
+
(Optional: if your team prefers an issue-thread record, you can also post a one-line comment on the GitHub issue pointing reviewers at the worktree branch. The summary itself stays in the pane — don't duplicate it as a committed file. That's the next phase's job, and that file will be a proper retrospective with arch + lessons updates, not a transient dev-approval note.)
|
|
123
|
+
|
|
124
|
+
## Signals
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
<signal>PHASE_COMPLETE</signal> # Implementation + tests done; dev-approval gate becomes pending
|
|
128
|
+
<signal>BLOCKED:reason</signal> # Cannot proceed
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## What NOT to Do
|
|
132
|
+
|
|
133
|
+
- **Don't write `codev/reviews/<id>-<slug>.md` in this phase** — it's the next phase's artifact, with a different shape (retrospective with arch + lessons updates)
|
|
134
|
+
- Don't add features not in the plan — scope creep is a `BLOCKED` signal, not a free expansion
|
|
135
|
+
- Don't run `porch approve` yourself
|
|
136
|
+
- Don't push to main — only to your builder branch
|
|
137
|
+
- Don't squash commits — let the merge commit preserve history
|
|
138
|
+
- Don't use `git add .` or `git add -A`
|
|
139
|
+
- Don't open the PR yet — that's the `review` phase
|
|
140
|
+
- Don't exit the interactive session at the gate
|
|
141
|
+
|
|
142
|
+
## Handling Feedback at the Gate
|
|
143
|
+
|
|
144
|
+
The reviewer will run your code via `afx dev` and test it. They may:
|
|
145
|
+
|
|
146
|
+
- Approve immediately → porch advances to the `review` phase
|
|
147
|
+
- Type feedback in the pane / send via `afx send` / edit code in the worktree / comment on the issue
|
|
148
|
+
- Ask clarifying questions about specific files or behaviors
|
|
149
|
+
|
|
150
|
+
When they provide feedback:
|
|
151
|
+
|
|
152
|
+
1. If it's code feedback: make the change, run build + tests, recommit
|
|
153
|
+
2. If it's a discussion question: answer it in the pane
|
|
154
|
+
3. Don't re-run `porch done` unless porch's `verify` block needs to re-validate — porch will tell you
|
|
155
|
+
|
|
156
|
+
The gate stays pending until the human approves.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# PLAN Phase Prompt
|
|
2
|
+
|
|
3
|
+
You are executing the **PLAN** phase of the PIR protocol.
|
|
4
|
+
|
|
5
|
+
## Your Goal
|
|
6
|
+
|
|
7
|
+
Read the GitHub issue, investigate the codebase, and write a plan to `codev/plans/{{artifact_name}}.md`. The plan is reviewed by a human at the `plan-approval` gate before any code is written.
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
- **Project ID**: {{project_id}}
|
|
12
|
+
- **Issue Number**: #{{issue.number}}
|
|
13
|
+
- **Issue Title**: {{issue.title}}
|
|
14
|
+
- **Artifact**: `codev/plans/{{artifact_name}}.md`
|
|
15
|
+
|
|
16
|
+
## Resumption Check (do this FIRST)
|
|
17
|
+
|
|
18
|
+
Run `porch next {{project_id}}`. If the response is `gate_pending`, you have already drafted the plan and are awaiting review. In that case:
|
|
19
|
+
|
|
20
|
+
1. Read your current plan file: `cat codev/plans/{{artifact_name}}.md`
|
|
21
|
+
2. Check for new feedback that may have arrived while you were idle:
|
|
22
|
+
- `git diff HEAD~1 codev/plans/{{artifact_name}}.md` — the reviewer may have edited the file directly
|
|
23
|
+
- `gh issue view {{issue.number}} --comments` — check for new comments
|
|
24
|
+
- Read any `afx send` queue messages
|
|
25
|
+
3. If feedback exists, revise the plan and recommit. If not, end the turn with a short "still awaiting review" message and stay in the interactive session.
|
|
26
|
+
|
|
27
|
+
Otherwise (`tasks` response — this is your first run), continue with the steps below.
|
|
28
|
+
|
|
29
|
+
## Process
|
|
30
|
+
|
|
31
|
+
### 1. Read the Issue
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
gh issue view {{issue.number}}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Understand what's being asked. For a bug, identify the symptom. For a feature, identify the desired outcome.
|
|
38
|
+
|
|
39
|
+
### 2. Investigate the Codebase
|
|
40
|
+
|
|
41
|
+
- Use Glob / Grep / Read to find the relevant code
|
|
42
|
+
- For a bug: trace the failure path, identify the root cause
|
|
43
|
+
- For a feature: find the existing patterns and integration points
|
|
44
|
+
- Note any existing utilities, components, or conventions you should reuse
|
|
45
|
+
|
|
46
|
+
### 3. Write the Plan
|
|
47
|
+
|
|
48
|
+
Create `codev/plans/{{artifact_name}}.md` where `<slug>` is a short kebab-case description of the change. Use this structure:
|
|
49
|
+
|
|
50
|
+
```markdown
|
|
51
|
+
# PIR Plan: <Short Title>
|
|
52
|
+
|
|
53
|
+
## Understanding
|
|
54
|
+
|
|
55
|
+
What the issue is asking for, in your own words. For a bug, include the root cause you identified — back it up with file:line references.
|
|
56
|
+
|
|
57
|
+
## Proposed Change
|
|
58
|
+
|
|
59
|
+
The approach you intend to take. Be specific. If there are multiple valid approaches, pick one and explain why.
|
|
60
|
+
|
|
61
|
+
## Files to Change
|
|
62
|
+
|
|
63
|
+
Concrete file paths. Use `file:line` format for specific edits where possible.
|
|
64
|
+
|
|
65
|
+
- `path/to/file.ts:42-55` — what changes
|
|
66
|
+
- `path/to/new-file.ts` — new file, what it does
|
|
67
|
+
|
|
68
|
+
## Risks & Alternatives Considered
|
|
69
|
+
|
|
70
|
+
- Risk: what could go wrong; mitigation
|
|
71
|
+
- Alternative: <other approach>; why rejected
|
|
72
|
+
|
|
73
|
+
## Test Plan
|
|
74
|
+
|
|
75
|
+
How to verify this works once implemented. The reviewer will use this at the `dev-approval` gate to test the running worktree.
|
|
76
|
+
|
|
77
|
+
- Unit test: <what to test>
|
|
78
|
+
- Manual: <what to click / observe>
|
|
79
|
+
- Cross-platform: <if applicable — what to verify on iOS / Android / web>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 4. Commit and Push
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
git add codev/plans/{{artifact_name}}.md
|
|
86
|
+
git commit -m "[PIR #{{issue.number}}] Plan draft"
|
|
87
|
+
git push -u origin "$(git branch --show-current)"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Never use `git add .` or `git add -A`.**
|
|
91
|
+
|
|
92
|
+
### 5. Signal Phase Complete
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
porch done {{project_id}}
|
|
96
|
+
porch next {{project_id}}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`porch next` will respond with `gate_pending` on the `plan-approval` gate. Porch automatically notifies the architect.
|
|
100
|
+
|
|
101
|
+
### 6. End Your Turn With a Prose Summary
|
|
102
|
+
|
|
103
|
+
Output something like:
|
|
104
|
+
|
|
105
|
+
> Plan written to `codev/plans/{{artifact_name}}.md` and committed. Ready for review — type any feedback here, edit the plan file directly in VSCode, or approve with `porch approve {{project_id}} plan-approval --a-human-explicitly-approved-this` (Cmd+K G in VSCode).
|
|
106
|
+
|
|
107
|
+
Then **stay in the interactive session**. Do not exit. Wait for the user's next message.
|
|
108
|
+
|
|
109
|
+
## Signals
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
<signal>PHASE_COMPLETE</signal> # Plan drafted (informational; the real signal is porch done)
|
|
113
|
+
<signal>BLOCKED:reason</signal> # Cannot proceed
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## What NOT to Do
|
|
117
|
+
|
|
118
|
+
- Don't write code — that's the implement phase
|
|
119
|
+
- Don't run `porch approve` yourself — only the human can approve the gate
|
|
120
|
+
- Don't post the plan content as a GitHub issue comment — the plan lives in the file, not the issue thread. A one-line pointer comment on the issue is fine if you think it helps the discussion.
|
|
121
|
+
- Don't use `git add .` or `git add -A`
|
|
122
|
+
- Don't exit the interactive session at the gate
|
|
123
|
+
|
|
124
|
+
## Handling Feedback
|
|
125
|
+
|
|
126
|
+
When the reviewer provides feedback (typed in pane, file-edit, `afx send`, or issue comment):
|
|
127
|
+
|
|
128
|
+
1. Re-read the plan file (the user may have edited it)
|
|
129
|
+
2. Apply the requested changes to your plan
|
|
130
|
+
3. Recommit: `git add codev/plans/{{artifact_name}}.md && git commit -m "[PIR #{{issue.number}}] Plan revised"`
|
|
131
|
+
4. Push
|
|
132
|
+
5. Output a short "Revised — see commit X" message
|
|
133
|
+
6. Wait for next input — the gate remains pending until the human approves
|
|
@@ -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
|
+
}
|