@cluesmith/codev 2.1.0-rc.1 → 2.1.0-rc.2
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-PDBY4L6b.js → index-CALp-XEo.js} +34 -34
- package/dashboard/dist/assets/index-CALp-XEo.js.map +1 -0
- package/dashboard/dist/assets/index-MVvud9Tr.css +32 -0
- 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/open.d.ts.map +1 -1
- package/dist/agent-farm/commands/open.js +7 -5
- package/dist/agent-farm/commands/open.js.map +1 -1
- package/dist/agent-farm/db/index.d.ts.map +1 -1
- package/dist/agent-farm/db/index.js +12 -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 -0
- package/dist/agent-farm/db/schema.js.map +1 -1
- package/dist/agent-farm/servers/send-buffer.d.ts.map +1 -1
- package/dist/agent-farm/servers/send-buffer.js +4 -3
- package/dist/agent-farm/servers/send-buffer.js.map +1 -1
- package/dist/agent-farm/servers/tower-instances.d.ts +1 -1
- package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-instances.js +2 -2
- package/dist/agent-farm/servers/tower-instances.js.map +1 -1
- package/dist/agent-farm/servers/tower-routes.js +14 -41
- package/dist/agent-farm/servers/tower-routes.js.map +1 -1
- package/dist/agent-farm/servers/tower-terminals.d.ts +1 -1
- package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-terminals.js +11 -8
- package/dist/agent-farm/servers/tower-terminals.js.map +1 -1
- package/dist/agent-farm/servers/tower-types.d.ts +1 -0
- package/dist/agent-farm/servers/tower-types.d.ts.map +1 -1
- package/dist/agent-farm/utils/config.d.ts +1 -1
- package/dist/agent-farm/utils/config.d.ts.map +1 -1
- package/dist/agent-farm/utils/config.js +2 -2
- package/dist/agent-farm/utils/config.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/terminal/pty-session.d.ts +3 -0
- package/dist/terminal/pty-session.d.ts.map +1 -1
- package/dist/terminal/pty-session.js +7 -0
- package/dist/terminal/pty-session.js.map +1 -1
- package/package.json +1 -1
- package/skeleton/protocols/air/builder-prompt.md +69 -0
- package/skeleton/protocols/air/consult-types/impl-review.md +58 -0
- package/skeleton/protocols/air/consult-types/pr-review.md +58 -0
- package/skeleton/protocols/air/prompts/implement.md +89 -0
- package/skeleton/protocols/air/prompts/pr.md +98 -0
- package/skeleton/protocols/air/protocol.json +109 -0
- package/skeleton/protocols/air/protocol.md +88 -0
- package/skeleton/resources/risk-triage.md +111 -0
- package/skeleton/resources/workflow-reference.md +14 -6
- package/skeleton/roles/architect.md +62 -12
- package/dashboard/dist/assets/index-D7YYtcVQ.css +0 -32
- package/dashboard/dist/assets/index-PDBY4L6b.js.map +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# IMPLEMENT Phase Prompt
|
|
2
|
+
|
|
3
|
+
You are executing the **IMPLEMENT** phase of the AIR protocol.
|
|
4
|
+
|
|
5
|
+
## Your Goal
|
|
6
|
+
|
|
7
|
+
Read the GitHub issue, implement the feature, and add tests. Keep it focused and under 300 LOC.
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
- **Issue**: #{{issue.number}} — {{issue.title}}
|
|
12
|
+
- **Current State**: {{current_state}}
|
|
13
|
+
|
|
14
|
+
## Process
|
|
15
|
+
|
|
16
|
+
### 1. Read the Issue
|
|
17
|
+
|
|
18
|
+
Read the full issue description. Identify:
|
|
19
|
+
- What is the desired behavior?
|
|
20
|
+
- What are the acceptance criteria?
|
|
21
|
+
- Are there examples or mockups?
|
|
22
|
+
- What files/modules are likely affected?
|
|
23
|
+
|
|
24
|
+
### 2. Implement the Feature
|
|
25
|
+
|
|
26
|
+
Apply a focused implementation:
|
|
27
|
+
- Implement what the issue describes — no more, no less
|
|
28
|
+
- Do NOT refactor surrounding code
|
|
29
|
+
- Do NOT add features beyond what's described in the issue
|
|
30
|
+
- Do NOT fix unrelated bugs you happen to notice (file separate issues)
|
|
31
|
+
|
|
32
|
+
**Code Quality**:
|
|
33
|
+
- Self-documenting code (clear names, obvious structure)
|
|
34
|
+
- No commented-out code or debug prints
|
|
35
|
+
- Follow existing project conventions
|
|
36
|
+
|
|
37
|
+
### 3. Add Tests
|
|
38
|
+
|
|
39
|
+
Write tests that:
|
|
40
|
+
- Cover the main happy path
|
|
41
|
+
- Cover key edge cases
|
|
42
|
+
- Are deterministic (not flaky)
|
|
43
|
+
|
|
44
|
+
Place tests following project conventions (`__tests__/`, `*.test.ts`, etc.).
|
|
45
|
+
|
|
46
|
+
### 4. Verify the Build
|
|
47
|
+
|
|
48
|
+
Run build and tests:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm run build # Must pass
|
|
52
|
+
npm test # Must pass
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Fix any failures before proceeding. If build/test commands don't exist, check `package.json`.
|
|
56
|
+
|
|
57
|
+
### 5. Commit
|
|
58
|
+
|
|
59
|
+
Stage and commit your changes:
|
|
60
|
+
- Use explicit file paths (never `git add -A` or `git add .`)
|
|
61
|
+
- Commit message: `[Air #{{issue.number}}] feat: <brief description>`
|
|
62
|
+
|
|
63
|
+
## Signals
|
|
64
|
+
|
|
65
|
+
When implementation and tests are complete and passing:
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
<signal>PHASE_COMPLETE</signal>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
If the feature is too complex for AIR (> 300 LOC or architectural):
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
<signal>TOO_COMPLEX</signal>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
If you're blocked (missing context, unclear requirements, etc.):
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
<signal>BLOCKED:reason goes here</signal>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Important Notes
|
|
84
|
+
|
|
85
|
+
1. **Stay focused** — Implement what the issue describes, nothing else
|
|
86
|
+
2. **Tests are expected** — Add tests unless the change is purely declarative (e.g., config only)
|
|
87
|
+
3. **Build AND tests must pass** — Don't signal complete until both pass
|
|
88
|
+
4. **Stay under 300 LOC** — If the feature grows beyond this, signal `TOO_COMPLEX`
|
|
89
|
+
5. **No spec/plan artifacts** — AIR does not create files in `codev/specs/` or `codev/plans/`
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# PR Phase Prompt
|
|
2
|
+
|
|
3
|
+
You are executing the **PR** phase of the AIR protocol.
|
|
4
|
+
|
|
5
|
+
## Your Goal
|
|
6
|
+
|
|
7
|
+
Create a pull request with the review embedded in the PR body, optionally run CMAP, and notify the architect.
|
|
8
|
+
|
|
9
|
+
## Context
|
|
10
|
+
|
|
11
|
+
- **Issue**: #{{issue.number}} — {{issue.title}}
|
|
12
|
+
- **Current State**: {{current_state}}
|
|
13
|
+
|
|
14
|
+
## Process
|
|
15
|
+
|
|
16
|
+
### 1. Create the Pull Request
|
|
17
|
+
|
|
18
|
+
Create a PR that links to the issue. The PR body IS the review — include a summary, key decisions, and test plan:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
gh pr create --title "[Air #{{issue.number}}] feat: <brief description>" --body "$(cat <<'EOF'
|
|
22
|
+
## Summary
|
|
23
|
+
|
|
24
|
+
<1-2 sentence description of the feature>
|
|
25
|
+
|
|
26
|
+
Implements #{{issue.number}}
|
|
27
|
+
|
|
28
|
+
## What Changed
|
|
29
|
+
|
|
30
|
+
<Brief explanation of the implementation approach>
|
|
31
|
+
|
|
32
|
+
## Key Decisions
|
|
33
|
+
|
|
34
|
+
<Any notable decisions made during implementation, or "None — straightforward implementation">
|
|
35
|
+
|
|
36
|
+
## Test Plan
|
|
37
|
+
|
|
38
|
+
- [ ] Unit tests added
|
|
39
|
+
- [ ] Build passes
|
|
40
|
+
- [ ] All tests pass
|
|
41
|
+
|
|
42
|
+
## Review Notes
|
|
43
|
+
|
|
44
|
+
<Anything the reviewer should pay special attention to, or "Standard implementation — no special concerns">
|
|
45
|
+
EOF
|
|
46
|
+
)"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**IMPORTANT**: Do NOT create a review file in `codev/reviews/`. The PR body IS the review for AIR.
|
|
50
|
+
|
|
51
|
+
### 2. Optional CMAP Review
|
|
52
|
+
|
|
53
|
+
If the implementation is non-trivial, run 3-way consultation:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
consult -m gemini --protocol air --type pr &
|
|
57
|
+
consult -m codex --protocol air --type pr &
|
|
58
|
+
consult -m claude --protocol air --type pr &
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
All three should run in the background (`run_in_background: true`).
|
|
62
|
+
|
|
63
|
+
**This is optional** — use your judgement. For simple features (config changes, small UI additions), you may skip consultation. For features touching core logic or multiple modules, run it.
|
|
64
|
+
|
|
65
|
+
### 3. Address Feedback (if CMAP was run)
|
|
66
|
+
|
|
67
|
+
If you ran CMAP:
|
|
68
|
+
- Wait for all consultations to complete
|
|
69
|
+
- Record each model's verdict
|
|
70
|
+
- Fix any issues identified
|
|
71
|
+
- Push updates to the PR branch
|
|
72
|
+
|
|
73
|
+
### 4. Notify Architect
|
|
74
|
+
|
|
75
|
+
Send notification with PR link:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
af send architect "PR #<number> ready for review (implements issue #{{issue.number}})"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
If CMAP was run, include verdicts:
|
|
82
|
+
```bash
|
|
83
|
+
af send architect "PR #<number> ready for review (implements issue #{{issue.number}}). CMAP: gemini=<verdict>, codex=<verdict>, claude=<verdict>"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Signals
|
|
87
|
+
|
|
88
|
+
When PR is created and ready for review:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
<signal>PHASE_COMPLETE</signal>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
If you're blocked:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
<signal>BLOCKED:reason goes here</signal>
|
|
98
|
+
```
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../protocol-schema.json",
|
|
3
|
+
"name": "air",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "AIR: Autonomous Implement & Review — lightweight protocol for small features from GitHub Issues",
|
|
6
|
+
"input": {
|
|
7
|
+
"type": "github-issue",
|
|
8
|
+
"required": false,
|
|
9
|
+
"default_for": ["--issue", "-i"]
|
|
10
|
+
},
|
|
11
|
+
"hooks": {
|
|
12
|
+
"pre-spawn": {
|
|
13
|
+
"collision-check": true,
|
|
14
|
+
"comment-on-issue": "On it! Implementing this feature now."
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"phases": [
|
|
18
|
+
{
|
|
19
|
+
"id": "implement",
|
|
20
|
+
"name": "Implement",
|
|
21
|
+
"description": "Implement the feature and add tests",
|
|
22
|
+
"type": "once",
|
|
23
|
+
"steps": [
|
|
24
|
+
"read_issue",
|
|
25
|
+
"implement_feature",
|
|
26
|
+
"add_tests",
|
|
27
|
+
"verify_build",
|
|
28
|
+
"commit"
|
|
29
|
+
],
|
|
30
|
+
"checks": {
|
|
31
|
+
"build": {
|
|
32
|
+
"command": "npm run build",
|
|
33
|
+
"on_fail": "retry",
|
|
34
|
+
"max_retries": 2
|
|
35
|
+
},
|
|
36
|
+
"tests": {
|
|
37
|
+
"command": "npm test -- --exclude='**/e2e/**'",
|
|
38
|
+
"description": "Unit tests only - e2e tests run in PR phase",
|
|
39
|
+
"on_fail": "retry",
|
|
40
|
+
"max_retries": 2
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"transition": {
|
|
44
|
+
"on_complete": "pr",
|
|
45
|
+
"on_too_complex": "escalate"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"id": "pr",
|
|
50
|
+
"name": "Create PR",
|
|
51
|
+
"description": "Create pull request with review in PR body",
|
|
52
|
+
"type": "once",
|
|
53
|
+
"steps": [
|
|
54
|
+
"create_pr",
|
|
55
|
+
"link_issue",
|
|
56
|
+
"optional_consultation",
|
|
57
|
+
"notify_architect"
|
|
58
|
+
],
|
|
59
|
+
"consultation": {
|
|
60
|
+
"on": "review",
|
|
61
|
+
"models": ["gemini", "codex"],
|
|
62
|
+
"type": "impl",
|
|
63
|
+
"parallel": true,
|
|
64
|
+
"max_rounds": 1
|
|
65
|
+
},
|
|
66
|
+
"checks": {
|
|
67
|
+
"pr_exists": {
|
|
68
|
+
"command": "gh pr list --head \"$(git branch --show-current)\" --json number --jq 'length' | grep -q '^[1-9]'",
|
|
69
|
+
"description": "PR must be created before signaling completion"
|
|
70
|
+
},
|
|
71
|
+
"e2e_tests": {
|
|
72
|
+
"command": "npm run test:e2e 2>&1 || echo 'e2e tests skipped (not configured)'",
|
|
73
|
+
"description": "Full e2e test suite",
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"gate": "pr",
|
|
78
|
+
"transition": {
|
|
79
|
+
"on_complete": null
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"signals": {
|
|
84
|
+
"PHASE_COMPLETE": {
|
|
85
|
+
"description": "Signal current phase is complete",
|
|
86
|
+
"transitions_to": "next_phase"
|
|
87
|
+
},
|
|
88
|
+
"TOO_COMPLEX": {
|
|
89
|
+
"description": "Feature is too complex for AIR, escalate to ASPIR",
|
|
90
|
+
"transitions_to": "escalate"
|
|
91
|
+
},
|
|
92
|
+
"BLOCKED": {
|
|
93
|
+
"description": "Signal implementation is blocked",
|
|
94
|
+
"requires": "reason"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"defaults": {
|
|
98
|
+
"mode": "strict",
|
|
99
|
+
"consultation": {
|
|
100
|
+
"enabled": true,
|
|
101
|
+
"models": ["gemini", "codex"],
|
|
102
|
+
"parallel": true
|
|
103
|
+
},
|
|
104
|
+
"checks": {
|
|
105
|
+
"build": "npm run build",
|
|
106
|
+
"test": "npm test"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# AIR Protocol
|
|
2
|
+
|
|
3
|
+
> **AIR** = **A**utonomous **I**mplement & **R**eview
|
|
4
|
+
>
|
|
5
|
+
> A lightweight protocol for small features that are fully specified by their GitHub issue.
|
|
6
|
+
> Two phases: Implement → Review. No spec/plan artifacts.
|
|
7
|
+
|
|
8
|
+
## What is AIR?
|
|
9
|
+
|
|
10
|
+
AIR is a minimal protocol for implementing small features (< 300 LOC) where the GitHub issue provides all the requirements. It skips the Specify and Plan phases entirely — the builder implements directly from the issue and creates a PR with the review embedded in the PR body.
|
|
11
|
+
|
|
12
|
+
### How AIR Compares
|
|
13
|
+
|
|
14
|
+
| Aspect | BUGFIX | AIR | ASPIR/SPIR |
|
|
15
|
+
|--------|--------|-----|------------|
|
|
16
|
+
| **Use case** | Bug fixes | Small features | New features |
|
|
17
|
+
| **Input** | GitHub Issue | GitHub Issue | GitHub Issue → Spec |
|
|
18
|
+
| **Phases** | Investigate → Fix → PR | Implement → PR | Specify → Plan → Implement → Review |
|
|
19
|
+
| **Artifacts** | None | None | Spec, plan, review files |
|
|
20
|
+
| **Review location** | PR body | PR body | `codev/reviews/` file |
|
|
21
|
+
| **Consultation** | PR phase only | Optional (builder decides) | Every phase (3-way) |
|
|
22
|
+
| **Human gates** | None (PR gate) | None (PR gate) | Spec + Plan + PR gates (SPIR) |
|
|
23
|
+
| **LOC limit** | < 300 | < 300 | No limit |
|
|
24
|
+
|
|
25
|
+
### When to Use AIR
|
|
26
|
+
|
|
27
|
+
- Small features (< 300 LOC)
|
|
28
|
+
- Requirements are clear from the GitHub issue
|
|
29
|
+
- No architectural decisions needed
|
|
30
|
+
- No new abstractions or significant refactoring required
|
|
31
|
+
- Would be overkill for full SPIR/ASPIR ceremony
|
|
32
|
+
|
|
33
|
+
### When NOT to Use AIR
|
|
34
|
+
|
|
35
|
+
- Bug fixes → use **BUGFIX**
|
|
36
|
+
- Features needing spec discussion → use **SPIR** or **ASPIR**
|
|
37
|
+
- Amendments to existing specs → use **TICK**
|
|
38
|
+
- Architectural changes → use **SPIR**
|
|
39
|
+
- Complex features with multiple phases → use **SPIR** or **ASPIR**
|
|
40
|
+
|
|
41
|
+
## Protocol Phases
|
|
42
|
+
|
|
43
|
+
### I - Implement
|
|
44
|
+
|
|
45
|
+
The builder reads the GitHub issue and implements the feature:
|
|
46
|
+
|
|
47
|
+
1. Read and understand the issue requirements
|
|
48
|
+
2. Implement the feature (< 300 LOC)
|
|
49
|
+
3. Write tests
|
|
50
|
+
4. Verify build and tests pass
|
|
51
|
+
5. Commit with descriptive message
|
|
52
|
+
|
|
53
|
+
If the feature grows beyond 300 LOC or requires architectural decisions, the builder signals `TOO_COMPLEX` to escalate to ASPIR.
|
|
54
|
+
|
|
55
|
+
### R - Review (PR)
|
|
56
|
+
|
|
57
|
+
The builder creates a PR with the review embedded in the PR body:
|
|
58
|
+
|
|
59
|
+
1. Create PR linking to the issue
|
|
60
|
+
2. Include a review section in the PR body (summary, key decisions, test plan)
|
|
61
|
+
3. Optionally run CMAP consultation if the builder judges the complexity warrants it
|
|
62
|
+
4. Notify the architect
|
|
63
|
+
|
|
64
|
+
The **PR gate** is preserved — a human reviews all code before merge.
|
|
65
|
+
|
|
66
|
+
## Usage
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Spawn a builder using AIR
|
|
70
|
+
af spawn 42 --protocol air
|
|
71
|
+
|
|
72
|
+
# The builder implements autonomously and stops at the PR gate
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## File Structure
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
codev-skeleton/protocols/air/
|
|
79
|
+
├── protocol.json # Protocol definition
|
|
80
|
+
├── protocol.md # This file
|
|
81
|
+
├── builder-prompt.md # Builder instructions (Handlebars template)
|
|
82
|
+
├── prompts/
|
|
83
|
+
│ ├── implement.md # Implement phase prompt
|
|
84
|
+
│ └── pr.md # PR phase prompt
|
|
85
|
+
└── consult-types/
|
|
86
|
+
├── impl-review.md # Implementation consultation guide
|
|
87
|
+
└── pr-review.md # PR consultation guide
|
|
88
|
+
```
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# PR Review Risk Triage Guide
|
|
2
|
+
|
|
3
|
+
Quick reference for the architect's risk-based PR review process. For the full integration review workflow, see `codev/roles/architect.md` Section 4.
|
|
4
|
+
|
|
5
|
+
## Risk Assessment
|
|
6
|
+
|
|
7
|
+
When a builder PR arrives, assess risk before choosing review depth.
|
|
8
|
+
|
|
9
|
+
### Step 1: Check Size and Scope
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
gh pr diff --stat <N>
|
|
13
|
+
gh pr view <N> --json files | jq '.files[].path'
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
### Step 2: Determine Risk Level
|
|
17
|
+
|
|
18
|
+
**Precedence: highest factor wins.** If any single factor is high, the overall risk is high.
|
|
19
|
+
|
|
20
|
+
| Factor | Low | Medium | High |
|
|
21
|
+
|--------|-----|--------|------|
|
|
22
|
+
| **Lines changed** | < 100 | 100-500 | > 500 |
|
|
23
|
+
| **Files touched** | 1-3 | 4-10 | > 10 |
|
|
24
|
+
| **Subsystem** | Docs, tests, cosmetic | Features, commands, shared libs | Protocol, state mgmt, security |
|
|
25
|
+
| **Cross-cutting** | No shared interfaces | Some shared code | Core interfaces, APIs |
|
|
26
|
+
|
|
27
|
+
### Step 3: Execute Review
|
|
28
|
+
|
|
29
|
+
| Risk | Action | Cost |
|
|
30
|
+
|------|--------|------|
|
|
31
|
+
| **Low** | Read PR, summarize, tell builder to merge | $0 |
|
|
32
|
+
| **Medium** | `consult -m claude --type integration pr N` | ~$1-2 |
|
|
33
|
+
| **High** | 3-way CMAP (Gemini + Codex + Claude in parallel) | ~$4-5 |
|
|
34
|
+
|
|
35
|
+
## Subsystem Path Mappings
|
|
36
|
+
|
|
37
|
+
| Path Pattern | Subsystem | Risk |
|
|
38
|
+
|-------------|-----------|------|
|
|
39
|
+
| `packages/codev/src/commands/porch/` | Protocol orchestrator | High |
|
|
40
|
+
| `packages/codev/src/tower/` | Tower architecture | High |
|
|
41
|
+
| `packages/codev/src/state/` | State management | High |
|
|
42
|
+
| `codev/protocols/` | Protocol definitions | High |
|
|
43
|
+
| `codev-skeleton/protocols/` | Protocol templates | High |
|
|
44
|
+
| `packages/codev/src/commands/af/` | Agent Farm commands | Medium |
|
|
45
|
+
| `packages/codev/src/commands/consult/` | Consultation system | Medium |
|
|
46
|
+
| `packages/codev/src/lib/` | Shared libraries | Medium |
|
|
47
|
+
| `packages/codev/src/commands/` (other) | CLI commands | Medium |
|
|
48
|
+
| `codev/roles/` | Role definitions | Medium |
|
|
49
|
+
| `codev-skeleton/roles/` | Role templates | Medium |
|
|
50
|
+
| `codev/resources/` | Documentation | Low |
|
|
51
|
+
| `codev/specs/`, `codev/plans/`, `codev/reviews/` | Project artifacts | Low |
|
|
52
|
+
| `packages/codev/tests/` | Tests only | Low |
|
|
53
|
+
| `*.md` (not in `protocols/`) | Documentation | Low |
|
|
54
|
+
|
|
55
|
+
## Typical Mappings by Protocol
|
|
56
|
+
|
|
57
|
+
- **Low**: Most bugfixes, ASPIR features, documentation, UI tweaks, config updates
|
|
58
|
+
- **Medium**: SPIR features, new commands, refactors touching 3+ files, new utility modules
|
|
59
|
+
- **High**: Protocol changes, porch state machine, Tower architecture, security model changes
|
|
60
|
+
|
|
61
|
+
**Note:** Protocol type is a heuristic, not the primary signal. An ASPIR PR that changes core state management should still be high-risk. Always check the actual diff.
|
|
62
|
+
|
|
63
|
+
## Example Workflows
|
|
64
|
+
|
|
65
|
+
### Low Risk: Bugfix (12 lines, 1 file, tests/)
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
$ gh pr diff --stat 120
|
|
69
|
+
packages/codev/tests/unit/foo.test.ts | 12 ++++++------
|
|
70
|
+
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
71
|
+
|
|
72
|
+
# Low risk — read and approve
|
|
73
|
+
gh pr comment 120 --body "## Architect Review
|
|
74
|
+
|
|
75
|
+
Low-risk test fix. Corrects assertion in foo.test.ts.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
Architect review"
|
|
79
|
+
|
|
80
|
+
af send 0042 "PR approved, please merge"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Medium Risk: New Feature (180 lines, 3 files, commands/)
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
$ gh pr diff --stat 121
|
|
87
|
+
packages/codev/src/commands/consult/risk.ts | 120 +++++++++++++
|
|
88
|
+
packages/codev/src/cli.ts | 15 ++
|
|
89
|
+
packages/codev/tests/unit/risk.test.ts | 45 +++++
|
|
90
|
+
3 files changed, 180 insertions(+)
|
|
91
|
+
|
|
92
|
+
# Medium risk — single-model review
|
|
93
|
+
consult -m claude --type integration pr 121
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### High Risk: Protocol Change (650 lines, 14 files, porch/)
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
$ gh pr diff --stat 122
|
|
100
|
+
packages/codev/src/commands/porch/run.ts | 200 ++++++++++++------
|
|
101
|
+
packages/codev/src/commands/porch/next.ts | 150 ++++++++++----
|
|
102
|
+
packages/codev/src/state/project.ts | 80 +++++---
|
|
103
|
+
... 11 more files
|
|
104
|
+
14 files changed, 420 insertions(+), 230 deletions(-)
|
|
105
|
+
|
|
106
|
+
# High risk — full 3-way CMAP
|
|
107
|
+
consult -m gemini --type integration pr 122 &
|
|
108
|
+
consult -m codex --type integration pr 122 &
|
|
109
|
+
consult -m claude --type integration pr 122 &
|
|
110
|
+
wait
|
|
111
|
+
```
|
|
@@ -38,7 +38,8 @@ Quick reference for the 7-stage project workflow. For protocol details, see `cod
|
|
|
38
38
|
│ HANDOFF / INTEGRATION │
|
|
39
39
|
├─────────────────────────────────────────────────────────────────────────────────────┤
|
|
40
40
|
│ → 6. COMMITTED │
|
|
41
|
-
│ Architect
|
|
41
|
+
│ Architect assesses PR risk: gh pr diff --stat N │
|
|
42
|
+
│ Low: Read + merge | Medium: 1-model review | High: 3-way CMAP │
|
|
42
43
|
│ Architect iterates with builder via PR comments │
|
|
43
44
|
│ Architect tells builder to merge │
|
|
44
45
|
│ Builder merges PR (NO --delete-branch flag) │
|
|
@@ -59,7 +60,7 @@ Quick reference for the 7-stage project workflow. For protocol details, see `cod
|
|
|
59
60
|
| 3 | planned | Architect | Commit spec + plan | Committed to main |
|
|
60
61
|
| 4 | implementing | Builder | IDE loop per phase | All phases complete |
|
|
61
62
|
| 5 | implemented | Builder | Write review, create PR | PR created |
|
|
62
|
-
| 6 | committed | Architect + Builder |
|
|
63
|
+
| 6 | committed | Architect + Builder | Risk-based integration review, merge | PR merged |
|
|
63
64
|
| 7 | integrated | Human | Validate production | Human confirms |
|
|
64
65
|
|
|
65
66
|
## Human Gates
|
|
@@ -143,9 +144,15 @@ consult -m codex --protocol spir --type impl
|
|
|
143
144
|
consult -m gemini --protocol spir --type pr
|
|
144
145
|
consult -m codex --protocol spir --type pr
|
|
145
146
|
|
|
146
|
-
# Integration review (during Stage 6)
|
|
147
|
-
consult
|
|
148
|
-
|
|
147
|
+
# Integration review (during Stage 6 — depth depends on risk)
|
|
148
|
+
# Low risk: no consult needed, architect reads and merges
|
|
149
|
+
# Medium risk: single-model review
|
|
150
|
+
consult -m claude --type integration pr N
|
|
151
|
+
# High risk: full 3-way CMAP
|
|
152
|
+
consult -m gemini --type integration pr N &
|
|
153
|
+
consult -m codex --type integration pr N &
|
|
154
|
+
consult -m claude --type integration pr N &
|
|
155
|
+
wait
|
|
149
156
|
|
|
150
157
|
# Parallel 3-way reviews (run all three concurrently)
|
|
151
158
|
consult -m gemini --protocol spir --type spec &
|
|
@@ -162,7 +169,7 @@ wait
|
|
|
162
169
|
| `plan` | Stage 2 | Implementation approach, phase breakdown, risk assessment |
|
|
163
170
|
| `impl` | Stage 4 | Code quality, test coverage, spec adherence |
|
|
164
171
|
| `pr` | Stage 5 | Final self-check before PR creation |
|
|
165
|
-
| `integration` | Stage 6 | System fit, architectural consistency, side effects |
|
|
172
|
+
| `integration` | Stage 6 | System fit, architectural consistency, side effects (depth varies by risk — see `codev/resources/risk-triage.md`) |
|
|
166
173
|
|
|
167
174
|
## Builder Lifecycle
|
|
168
175
|
|
|
@@ -240,3 +247,4 @@ af cleanup -p XXXX --force
|
|
|
240
247
|
- Builder role: `codev/roles/builder.md`
|
|
241
248
|
- Architect role: `codev/roles/architect.md`
|
|
242
249
|
- Consultant role: `codev/roles/consultant.md`
|
|
250
|
+
- Risk triage guide: `codev/resources/risk-triage.md`
|
|
@@ -53,7 +53,10 @@ porch pending # List pending gates
|
|
|
53
53
|
### Consult Tool (for integration reviews)
|
|
54
54
|
|
|
55
55
|
```bash
|
|
56
|
-
#
|
|
56
|
+
# Single-model review (medium risk)
|
|
57
|
+
consult -m claude --type integration pr 35
|
|
58
|
+
|
|
59
|
+
# 3-way parallel review (high risk)
|
|
57
60
|
consult -m gemini --type integration pr 35 &
|
|
58
61
|
consult -m codex --type integration pr 35 &
|
|
59
62
|
consult -m claude --type integration pr 35 &
|
|
@@ -117,12 +120,63 @@ af status # Overview of all builders
|
|
|
117
120
|
porch status 0042 # Detailed state for one project (strict mode)
|
|
118
121
|
```
|
|
119
122
|
|
|
120
|
-
### 4. Integration Review
|
|
123
|
+
### 4. Integration Review (Risk-Based Triage)
|
|
124
|
+
|
|
125
|
+
When the builder creates a PR, **assess risk first** before deciding review depth.
|
|
126
|
+
|
|
127
|
+
> **Full reference**: See `codev/resources/risk-triage.md` for subsystem mappings and examples.
|
|
128
|
+
|
|
129
|
+
#### Step 1: Assess Risk
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
gh pr diff --stat <N> # See lines changed and files touched
|
|
133
|
+
gh pr view <N> --json files | jq '.files[].path' # See which subsystems
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### Step 2: Triage
|
|
137
|
+
|
|
138
|
+
| Risk | Criteria | Action |
|
|
139
|
+
|------|----------|--------|
|
|
140
|
+
| **Low** | <100 lines, 1-3 files, isolated (docs, tests, cosmetic, bugfixes) | Read PR, summarize root cause + fix, tell builder to merge |
|
|
141
|
+
| **Medium** | 100-500 lines, 4-10 files, touches shared code (features, commands) | Single-model review: `consult -m claude --type integration pr N` |
|
|
142
|
+
| **High** | >500 lines, >10 files, core subsystems (porch, Tower, protocols, security) | Full 3-way CMAP (see below) |
|
|
143
|
+
|
|
144
|
+
**Precedence: highest factor wins.** If any single factor (lines, files, subsystem, or cross-cutting scope) is high-risk, treat the whole PR as high-risk.
|
|
145
|
+
|
|
146
|
+
**Typical mappings:**
|
|
147
|
+
- **Low**: Most bugfixes, ASPIR features, documentation, UI tweaks
|
|
148
|
+
- **Medium**: SPIR features, new commands, refactors touching 3+ files
|
|
149
|
+
- **High**: Protocol changes, porch state machine, Tower architecture, security model
|
|
150
|
+
|
|
151
|
+
#### Step 3: Execute Review
|
|
152
|
+
|
|
153
|
+
**Low risk** — no external models needed:
|
|
154
|
+
```bash
|
|
155
|
+
# Read the PR yourself, then approve
|
|
156
|
+
gh pr comment 83 --body "## Architect Review
|
|
157
|
+
|
|
158
|
+
Low-risk change. [Summary of what changed and why.]
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
Architect review"
|
|
162
|
+
|
|
163
|
+
af send 0042 "PR approved, please merge"
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Medium risk** — single-model review:
|
|
167
|
+
```bash
|
|
168
|
+
consult -m claude --type integration pr 83
|
|
169
|
+
|
|
170
|
+
# Post findings as PR comment
|
|
171
|
+
gh pr comment 83 --body "## Architect Integration Review
|
|
172
|
+
...
|
|
173
|
+
Architect integration review"
|
|
121
174
|
|
|
122
|
-
|
|
175
|
+
af send 0042 "PR approved, please merge"
|
|
176
|
+
```
|
|
123
177
|
|
|
178
|
+
**High risk** — full 3-way CMAP:
|
|
124
179
|
```bash
|
|
125
|
-
# Run 3-way integration review
|
|
126
180
|
consult -m gemini --type integration pr 83 &
|
|
127
181
|
consult -m codex --type integration pr 83 &
|
|
128
182
|
consult -m claude --type integration pr 83 &
|
|
@@ -130,15 +184,9 @@ wait
|
|
|
130
184
|
|
|
131
185
|
# Post findings as PR comment
|
|
132
186
|
gh pr comment 83 --body "## Architect Integration Review
|
|
133
|
-
|
|
134
|
-
**Verdict: APPROVE**
|
|
135
|
-
|
|
136
|
-
Integration looks good. No conflicts with existing modules.
|
|
137
|
-
|
|
138
|
-
---
|
|
187
|
+
...
|
|
139
188
|
Architect integration review"
|
|
140
189
|
|
|
141
|
-
# Notify builder
|
|
142
190
|
af send 0042 "PR approved, please merge"
|
|
143
191
|
```
|
|
144
192
|
|
|
@@ -225,6 +273,8 @@ Before approving implementations with UX requirements:
|
|
|
225
273
|
| Approve spec | `porch approve <id> spec-approval` |
|
|
226
274
|
| Approve plan | `porch approve <id> plan-approval` |
|
|
227
275
|
| See pending gates | `porch pending` |
|
|
228
|
-
|
|
|
276
|
+
| Assess PR risk | `gh pr diff --stat N` |
|
|
277
|
+
| Integration review (medium) | `consult -m claude --type integration pr N` |
|
|
278
|
+
| Integration review (high) | 3-way CMAP (see Section 4) |
|
|
229
279
|
| Message builder | `af send <id> "short message"` |
|
|
230
280
|
| Cleanup builder | `af cleanup -p <id>` |
|