@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,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.
|
|
@@ -30,6 +30,12 @@ You are running in STRICT mode. This means:
|
|
|
30
30
|
Follow the SPIR protocol: `codev/protocols/spir/protocol.md`
|
|
31
31
|
Read and internalize the protocol before starting any work.
|
|
32
32
|
|
|
33
|
+
## Baked Decisions
|
|
34
|
+
|
|
35
|
+
If the issue body contains a section named "Baked Decisions" (any heading level, case-insensitive), treat its contents as fixed architectural decisions baked in by the architect. Do not autonomously override them in your spec, plan, or implementation. If you discover a serious reason to question a baked decision, surface that concern to the architect via `afx send` rather than relitigating it inside the spec/plan/review.
|
|
36
|
+
|
|
37
|
+
If the architect's baked-decisions section contains internal contradictions (e.g., two different language choices), do not pick one — pause, flag the contradiction to the architect via `afx send`, and wait for resolution before proceeding.
|
|
38
|
+
|
|
33
39
|
{{#if spec}}
|
|
34
40
|
## Spec
|
|
35
41
|
Read the specification at: `{{spec.path}}`
|
|
@@ -53,13 +59,23 @@ Follow the implementation plan at: `{{plan.path}}`
|
|
|
53
59
|
{{task_text}}
|
|
54
60
|
{{/if}}
|
|
55
61
|
|
|
56
|
-
##
|
|
62
|
+
## PR Strategy
|
|
63
|
+
|
|
64
|
+
**Do not autonomously open a PR per implementation phase.** Plan phases ship as git commits within a single PR, not as separate PRs. The plan's instruction that "each phase commits independently" refers to git commits, not PRs.
|
|
65
|
+
|
|
66
|
+
By default, the PR is opened during/after the final implement phase, with all phase-commits already on the branch.
|
|
67
|
+
|
|
68
|
+
### Architect-requested PRs
|
|
69
|
+
|
|
70
|
+
The architect MAY request a PR at any point — for spec review, mid-implementation feedback, slicing a large spec into shippable PRs, etc. When the architect explicitly asks for a PR earlier (or for additional PRs), follow that direction. The prohibition is specifically on the *builder* autonomously deciding to open per-phase PRs without architect request.
|
|
71
|
+
|
|
72
|
+
### Multi-PR Mechanics (when the architect requests sequential PRs)
|
|
57
73
|
|
|
58
|
-
Your worktree is persistent — it survives across PR merges.
|
|
74
|
+
Your worktree is persistent — it survives across PR merges. When the architect asks for sequential PRs (e.g., to slice a large spec into shippable pieces), use this loop:
|
|
59
75
|
|
|
60
76
|
1. Cut a branch, open a PR, wait for merge
|
|
61
77
|
2. After merge: `git fetch origin main && git checkout -b <next-branch> origin/main`
|
|
62
|
-
3. Continue to the next
|
|
78
|
+
3. Continue to the next slice, open another PR
|
|
63
79
|
4. Repeat
|
|
64
80
|
|
|
65
81
|
**Important**: Do NOT run `git checkout main` — git worktrees cannot check out a branch that's checked out elsewhere. Always branch off `origin/main` via fetch.
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
## Context
|
|
4
4
|
You are reviewing an implementation plan during the Plan phase. The spec has been approved - now you must evaluate whether the plan adequately describes HOW to implement it.
|
|
5
5
|
|
|
6
|
+
## Baked Decisions
|
|
7
|
+
|
|
8
|
+
If the issue body or the approved spec's Constraints section includes content under a "Baked Decisions" heading, the architect has marked those choices as fixed (this extends the existing "don't re-litigate spec decisions" rule with explicit baked-decision language). Do not autonomously challenge them: do not propose alternative languages, frameworks, deployment shapes, or dependencies that contradict a baked decision. You may `COMMENT` with concerns; reserve `REQUEST_CHANGES` for the case where the plan **fails to honor** a stated baked decision — that is a real defect.
|
|
9
|
+
|
|
10
|
+
If the baked decisions themselves contain contradictions, do not pick one — `REQUEST_CHANGES` and ask the architect to clarify before proceeding.
|
|
11
|
+
|
|
6
12
|
## Focus Areas
|
|
7
13
|
|
|
8
14
|
1. **Spec Coverage**
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
## Context
|
|
4
4
|
You are reviewing a feature specification during the Specify phase. Your role is to ensure the spec is complete, correct, and feasible before it moves to human approval.
|
|
5
5
|
|
|
6
|
+
## Baked Decisions
|
|
7
|
+
|
|
8
|
+
If the issue body or the spec's Constraints section includes content under a "Baked Decisions" heading, the architect has marked those choices as fixed. Do not autonomously challenge them: do not propose alternative languages, frameworks, deployment shapes, or dependencies that contradict a baked decision. You may `COMMENT` with concerns about a baked decision (the architect decides whether to rescind it); reserve `REQUEST_CHANGES` for the case where the spec **fails to honor** a stated baked decision — that is a real defect.
|
|
9
|
+
|
|
10
|
+
If the baked decisions themselves contain contradictions (e.g., two different language choices), do not pick one — `REQUEST_CHANGES` and ask the architect to clarify before proceeding.
|
|
11
|
+
|
|
6
12
|
## Focus Areas
|
|
7
13
|
|
|
8
14
|
1. **Completeness**
|
|
@@ -31,6 +31,12 @@ ls codev/specs/{{project_id}}-*.md
|
|
|
31
31
|
|
|
32
32
|
**If no spec exists:** Proceed to Step 1 below.
|
|
33
33
|
|
|
34
|
+
### 0.5 Baked Decisions
|
|
35
|
+
|
|
36
|
+
Before exploring solution approaches, check the issue body for a section named "Baked Decisions" (any heading level, case-insensitive). If present, copy its content verbatim into the spec's Constraints section and treat each item as fixed. Do not autonomously relitigate the architect's choices in your Solution Exploration. If you discover a serious problem with a baked decision, raise it via `afx send architect` rather than overriding it in the spec.
|
|
37
|
+
|
|
38
|
+
If two baked decisions contradict each other (e.g., two different language choices), do not pick one — pause, flag the contradiction via `afx send`, and wait for resolution before drafting.
|
|
39
|
+
|
|
34
40
|
### 1. Clarifying Questions (ONLY IF NO SPEC EXISTS)
|
|
35
41
|
|
|
36
42
|
Before writing anything, ask clarifying questions to understand:
|
|
@@ -79,6 +79,10 @@ Each phase follows a build-verify loop: build the artifact, then verify with 3-w
|
|
|
79
79
|
- Dependency updates
|
|
80
80
|
- Emergency hotfixes (but do a lightweight retrospective after)
|
|
81
81
|
|
|
82
|
+
## Baked Decisions (Optional)
|
|
83
|
+
|
|
84
|
+
When filing an issue for SPIR, you can pin architectural decisions you don't want the builder or CMAP reviewers to re-litigate. Include a `## Baked Decisions` section (any heading level is fine) anywhere in the issue body. Useful categories: language, framework, deployment shape, key dependencies, decisions deferred to a later spec. The builder will copy the section verbatim into the spec's Constraints and treat each item as fixed; CMAP reviewers will not propose alternatives unless the spec itself fails to honor a stated decision. Leave the section out for issues where you want the builder to explore freely — absence is the no-op default. You can amend or rescind a baked decision at any time by updating the issue and respawning, or by sending the builder a direct instruction via `afx send`.
|
|
85
|
+
|
|
82
86
|
## Protocol Phases
|
|
83
87
|
|
|
84
88
|
### S - Specify (Collaborative Design Exploration)
|
|
@@ -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)
|
|
@@ -10,10 +10,34 @@ This project uses **Codev** for AI-assisted development.
|
|
|
10
10
|
- **ASPIR**: Autonomous SPIR — no human gates on spec/plan (`codev/protocols/aspir/protocol.md`)
|
|
11
11
|
- **AIR**: Autonomous Implement & Review for small features (`codev/protocols/air/protocol.md`)
|
|
12
12
|
- **BUGFIX**: Bug fixes from GitHub issues (`codev/protocols/bugfix/protocol.md`)
|
|
13
|
+
- **PIR**: Plan / Implement / Review — issue-driven with three human gates (plan-approval, dev-approval, pr) (`codev/protocols/pir/protocol.md`)
|
|
13
14
|
- **EXPERIMENT**: Disciplined experimentation (`codev/protocols/experiment/protocol.md`)
|
|
14
15
|
- **MAINTAIN**: Codebase maintenance (`codev/protocols/maintain/protocol.md`)
|
|
15
16
|
- **RESEARCH**: Multi-agent research with 3-way investigation, synthesis, and critique (`codev/protocols/research/protocol.md`)
|
|
16
17
|
|
|
18
|
+
## File Resolution (How Codev Finds Protocols and Templates)
|
|
19
|
+
|
|
20
|
+
Codev resolves protocol files, prompts, agent definitions, and roles through a four-tier lookup (highest priority first):
|
|
21
|
+
|
|
22
|
+
1. `.codev/<path>` — user override (project-local customization)
|
|
23
|
+
2. `codev/<path>` — project-local copy (customized and checked in)
|
|
24
|
+
3. Runtime cache
|
|
25
|
+
4. **Installed package skeleton** — ships with `@cluesmith/codev` (the default for every standard protocol)
|
|
26
|
+
|
|
27
|
+
**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/`.
|
|
28
|
+
|
|
29
|
+
**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.
|
|
30
|
+
|
|
31
|
+
## Protocol Verification (When You Don't Recognize a Protocol Name)
|
|
32
|
+
|
|
33
|
+
If the user mentions a protocol name you don't immediately recognize, verify against the CLI before responding:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
afx spawn --protocol <name> --help
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
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.
|
|
40
|
+
|
|
17
41
|
## Key Locations
|
|
18
42
|
|
|
19
43
|
- **Specs**: `codev/specs/` - Feature specifications (WHAT to build)
|