@cluesmith/codev 2.0.6 → 2.0.8

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.
Files changed (181) hide show
  1. package/dashboard/dist/assets/{index-B-s8BA2l.js → index-BblS3DWL.js} +30 -30
  2. package/dashboard/dist/assets/index-BblS3DWL.js.map +1 -0
  3. package/dashboard/dist/assets/index-Cr9PyjqX.css +32 -0
  4. package/dashboard/dist/index.html +2 -2
  5. package/dist/agent-farm/cli.d.ts.map +1 -1
  6. package/dist/agent-farm/cli.js +23 -48
  7. package/dist/agent-farm/cli.js.map +1 -1
  8. package/dist/agent-farm/commands/architect.d.ts +5 -5
  9. package/dist/agent-farm/commands/architect.d.ts.map +1 -1
  10. package/dist/agent-farm/commands/architect.js +37 -20
  11. package/dist/agent-farm/commands/architect.js.map +1 -1
  12. package/dist/agent-farm/commands/attach.d.ts.map +1 -1
  13. package/dist/agent-farm/commands/attach.js +1 -21
  14. package/dist/agent-farm/commands/attach.js.map +1 -1
  15. package/dist/agent-farm/commands/cleanup.d.ts +12 -0
  16. package/dist/agent-farm/commands/cleanup.d.ts.map +1 -1
  17. package/dist/agent-farm/commands/cleanup.js +108 -7
  18. package/dist/agent-farm/commands/cleanup.js.map +1 -1
  19. package/dist/agent-farm/commands/spawn-worktree.d.ts +1 -2
  20. package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -1
  21. package/dist/agent-farm/commands/spawn-worktree.js +12 -18
  22. package/dist/agent-farm/commands/spawn-worktree.js.map +1 -1
  23. package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
  24. package/dist/agent-farm/commands/spawn.js +30 -26
  25. package/dist/agent-farm/commands/spawn.js.map +1 -1
  26. package/dist/agent-farm/commands/start.d.ts.map +1 -1
  27. package/dist/agent-farm/commands/start.js +2 -6
  28. package/dist/agent-farm/commands/start.js.map +1 -1
  29. package/dist/agent-farm/commands/status.d.ts.map +1 -1
  30. package/dist/agent-farm/commands/status.js +4 -23
  31. package/dist/agent-farm/commands/status.js.map +1 -1
  32. package/dist/agent-farm/commands/stop.d.ts.map +1 -1
  33. package/dist/agent-farm/commands/stop.js +2 -6
  34. package/dist/agent-farm/commands/stop.js.map +1 -1
  35. package/dist/agent-farm/commands/tower-cloud.d.ts +2 -9
  36. package/dist/agent-farm/commands/tower-cloud.d.ts.map +1 -1
  37. package/dist/agent-farm/commands/tower-cloud.js +12 -47
  38. package/dist/agent-farm/commands/tower-cloud.js.map +1 -1
  39. package/dist/agent-farm/commands/tower.d.ts.map +1 -1
  40. package/dist/agent-farm/commands/tower.js +6 -23
  41. package/dist/agent-farm/commands/tower.js.map +1 -1
  42. package/dist/agent-farm/db/index.d.ts.map +1 -1
  43. package/dist/agent-farm/db/index.js +52 -2
  44. package/dist/agent-farm/db/index.js.map +1 -1
  45. package/dist/agent-farm/db/schema.d.ts +1 -1
  46. package/dist/agent-farm/db/schema.d.ts.map +1 -1
  47. package/dist/agent-farm/db/schema.js +1 -1
  48. package/dist/agent-farm/lib/cloud-config.d.ts +1 -0
  49. package/dist/agent-farm/lib/cloud-config.d.ts.map +1 -1
  50. package/dist/agent-farm/lib/cloud-config.js +2 -2
  51. package/dist/agent-farm/lib/cloud-config.js.map +1 -1
  52. package/dist/agent-farm/lib/tower-client.d.ts +49 -0
  53. package/dist/agent-farm/lib/tower-client.d.ts.map +1 -1
  54. package/dist/agent-farm/lib/tower-client.js +32 -2
  55. package/dist/agent-farm/lib/tower-client.js.map +1 -1
  56. package/dist/agent-farm/servers/overview.d.ts +47 -1
  57. package/dist/agent-farm/servers/overview.d.ts.map +1 -1
  58. package/dist/agent-farm/servers/overview.js +298 -58
  59. package/dist/agent-farm/servers/overview.js.map +1 -1
  60. package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -1
  61. package/dist/agent-farm/servers/tower-instances.js +2 -1
  62. package/dist/agent-farm/servers/tower-instances.js.map +1 -1
  63. package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
  64. package/dist/agent-farm/servers/tower-routes.js +21 -20
  65. package/dist/agent-farm/servers/tower-routes.js.map +1 -1
  66. package/dist/agent-farm/servers/tower-server.js +3 -4
  67. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  68. package/dist/agent-farm/servers/tower-terminals.d.ts +1 -1
  69. package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
  70. package/dist/agent-farm/servers/tower-terminals.js +4 -4
  71. package/dist/agent-farm/servers/tower-terminals.js.map +1 -1
  72. package/dist/agent-farm/servers/tower-tunnel.d.ts.map +1 -1
  73. package/dist/agent-farm/servers/tower-tunnel.js +3 -19
  74. package/dist/agent-farm/servers/tower-tunnel.js.map +1 -1
  75. package/dist/agent-farm/servers/tower-websocket.d.ts.map +1 -1
  76. package/dist/agent-farm/servers/tower-websocket.js +2 -1
  77. package/dist/agent-farm/servers/tower-websocket.js.map +1 -1
  78. package/dist/agent-farm/types.d.ts +1 -1
  79. package/dist/agent-farm/types.d.ts.map +1 -1
  80. package/dist/agent-farm/utils/display.d.ts +8 -0
  81. package/dist/agent-farm/utils/display.d.ts.map +1 -0
  82. package/dist/agent-farm/utils/display.js +26 -0
  83. package/dist/agent-farm/utils/display.js.map +1 -0
  84. package/dist/agent-farm/utils/notifications.d.ts.map +1 -1
  85. package/dist/agent-farm/utils/notifications.js +7 -16
  86. package/dist/agent-farm/utils/notifications.js.map +1 -1
  87. package/dist/agent-farm/utils/server-utils.d.ts +4 -0
  88. package/dist/agent-farm/utils/server-utils.d.ts.map +1 -1
  89. package/dist/agent-farm/utils/server-utils.js +20 -0
  90. package/dist/agent-farm/utils/server-utils.js.map +1 -1
  91. package/dist/agent-farm/utils/shell.d.ts +5 -0
  92. package/dist/agent-farm/utils/shell.d.ts.map +1 -1
  93. package/dist/agent-farm/utils/shell.js +15 -11
  94. package/dist/agent-farm/utils/shell.js.map +1 -1
  95. package/dist/cli.d.ts.map +1 -1
  96. package/dist/cli.js +25 -19
  97. package/dist/cli.js.map +1 -1
  98. package/dist/commands/consult/index.d.ts +10 -9
  99. package/dist/commands/consult/index.d.ts.map +1 -1
  100. package/dist/commands/consult/index.js +407 -261
  101. package/dist/commands/consult/index.js.map +1 -1
  102. package/dist/commands/consult/usage-extractor.d.ts +3 -0
  103. package/dist/commands/consult/usage-extractor.d.ts.map +1 -1
  104. package/dist/commands/consult/usage-extractor.js +52 -29
  105. package/dist/commands/consult/usage-extractor.js.map +1 -1
  106. package/dist/commands/porch/index.d.ts.map +1 -1
  107. package/dist/commands/porch/index.js +13 -12
  108. package/dist/commands/porch/index.js.map +1 -1
  109. package/dist/commands/porch/next.d.ts.map +1 -1
  110. package/dist/commands/porch/next.js +7 -18
  111. package/dist/commands/porch/next.js.map +1 -1
  112. package/dist/commands/porch/plan.d.ts.map +1 -1
  113. package/dist/commands/porch/plan.js +17 -2
  114. package/dist/commands/porch/plan.js.map +1 -1
  115. package/dist/commands/porch/prompts.d.ts.map +1 -1
  116. package/dist/commands/porch/prompts.js +6 -3
  117. package/dist/commands/porch/prompts.js.map +1 -1
  118. package/dist/commands/porch/state.d.ts +13 -0
  119. package/dist/commands/porch/state.d.ts.map +1 -1
  120. package/dist/commands/porch/state.js +46 -1
  121. package/dist/commands/porch/state.js.map +1 -1
  122. package/dist/lib/github.d.ts +10 -9
  123. package/dist/lib/github.d.ts.map +1 -1
  124. package/dist/lib/github.js +49 -9
  125. package/dist/lib/github.js.map +1 -1
  126. package/dist/terminal/index.d.ts +2 -0
  127. package/dist/terminal/index.d.ts.map +1 -1
  128. package/dist/terminal/index.js +2 -0
  129. package/dist/terminal/index.js.map +1 -1
  130. package/dist/terminal/pty-manager.js +2 -2
  131. package/dist/terminal/pty-manager.js.map +1 -1
  132. package/dist/terminal/pty-session.js +1 -1
  133. package/dist/terminal/pty-session.js.map +1 -1
  134. package/package.json +1 -1
  135. package/skeleton/.claude/skills/af/SKILL.md +9 -9
  136. package/skeleton/.claude/skills/consult/SKILL.md +55 -38
  137. package/skeleton/.claude/skills/porch/SKILL.md +53 -0
  138. package/skeleton/DEPENDENCIES.md +2 -2
  139. package/skeleton/builders.md +8 -19
  140. package/skeleton/protocol-schema.json +1 -1
  141. package/skeleton/protocols/bugfix/prompts/pr.md +3 -3
  142. package/skeleton/protocols/bugfix/protocol.json +1 -1
  143. package/skeleton/protocols/maintain/consult-types/impl-review.md +72 -0
  144. package/skeleton/protocols/maintain/consult-types/pr-review.md +72 -0
  145. package/skeleton/protocols/maintain/protocol.json +4 -4
  146. package/skeleton/protocols/maintain/protocol.md +3 -3
  147. package/skeleton/protocols/protocol-schema.json +1 -1
  148. package/skeleton/protocols/spir/consult-types/impl-review.md +72 -0
  149. package/skeleton/protocols/spir/consult-types/phase-review.md +72 -0
  150. package/skeleton/protocols/spir/consult-types/pr-review.md +72 -0
  151. package/skeleton/protocols/spir/prompts/plan.md +4 -4
  152. package/skeleton/protocols/spir/prompts/review.md +8 -8
  153. package/skeleton/protocols/spir/prompts/specify.md +6 -6
  154. package/skeleton/protocols/spir/protocol.json +11 -11
  155. package/skeleton/protocols/spir/templates/review.md +2 -2
  156. package/skeleton/protocols/tick/consult-types/impl-review.md +72 -0
  157. package/skeleton/protocols/tick/consult-types/plan-review.md +59 -0
  158. package/skeleton/protocols/tick/consult-types/pr-review.md +72 -0
  159. package/skeleton/protocols/tick/consult-types/spec-review.md +55 -0
  160. package/skeleton/protocols/tick/protocol.json +2 -7
  161. package/skeleton/resources/commands/agent-farm.md +13 -11
  162. package/skeleton/resources/commands/codev.md +0 -35
  163. package/skeleton/resources/commands/consult.md +88 -234
  164. package/skeleton/resources/commands/overview.md +6 -7
  165. package/skeleton/resources/workflow-reference.md +24 -24
  166. package/skeleton/roles/architect.md +29 -29
  167. package/skeleton/roles/builder.md +22 -23
  168. package/skeleton/templates/AGENTS.md +1 -1
  169. package/skeleton/templates/CLAUDE.md +1 -1
  170. package/skeleton/templates/cheatsheet.md +22 -18
  171. package/skeleton/templates/pr-overview.md +5 -5
  172. package/dashboard/dist/assets/index-B-s8BA2l.js.map +0 -1
  173. package/dashboard/dist/assets/index-DB2AxRP7.css +0 -32
  174. package/dist/agent-farm/commands/consult.d.ts +0 -15
  175. package/dist/agent-farm/commands/consult.d.ts.map +0 -1
  176. package/dist/agent-farm/commands/consult.js +0 -39
  177. package/dist/agent-farm/commands/consult.js.map +0 -1
  178. /package/skeleton/{consult-types → protocols/bugfix/consult-types}/impl-review.md +0 -0
  179. /package/skeleton/{consult-types/pr-ready.md → protocols/bugfix/consult-types/pr-review.md} +0 -0
  180. /package/skeleton/{consult-types → protocols/spir/consult-types}/plan-review.md +0 -0
  181. /package/skeleton/{consult-types → protocols/spir/consult-types}/spec-review.md +0 -0
@@ -0,0 +1,55 @@
1
+ # Specification Review Prompt
2
+
3
+ ## Context
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
+
6
+ ## Focus Areas
7
+
8
+ 1. **Completeness**
9
+ - Are all requirements clearly stated?
10
+ - Are success criteria defined?
11
+ - Are edge cases considered?
12
+ - Is scope well-bounded (not too broad or vague)?
13
+
14
+ 2. **Correctness**
15
+ - Do requirements make sense technically?
16
+ - Are there contradictions?
17
+ - Is the problem statement accurate?
18
+
19
+ 3. **Feasibility**
20
+ - Can this be implemented with available tools/constraints?
21
+ - Are there obvious technical blockers?
22
+ - Is the scope realistic for a single spec?
23
+
24
+ 4. **Clarity**
25
+ - Would a builder understand what to build?
26
+ - Are acceptance criteria testable?
27
+ - Is terminology consistent?
28
+
29
+ ## Verdict Format
30
+
31
+ After your review, provide your verdict in exactly this format:
32
+
33
+ ```
34
+ ---
35
+ VERDICT: [APPROVE | REQUEST_CHANGES | COMMENT]
36
+ SUMMARY: [One-line summary of your assessment]
37
+ CONFIDENCE: [HIGH | MEDIUM | LOW]
38
+ ---
39
+ KEY_ISSUES:
40
+ - [Issue 1 or "None"]
41
+ - [Issue 2]
42
+ ...
43
+ ```
44
+
45
+ **Verdict meanings:**
46
+ - `APPROVE`: Spec is ready for human review
47
+ - `REQUEST_CHANGES`: Significant issues must be fixed before proceeding
48
+ - `COMMENT`: Minor suggestions, can proceed but consider feedback
49
+
50
+ ## Notes
51
+
52
+ - You are NOT reviewing code - you are reviewing the specification document
53
+ - Focus on WHAT is being built, not HOW it will be implemented (that's for plan review)
54
+ - Be constructive - identify issues AND suggest solutions
55
+ - If the spec references other specs, note if context seems missing
@@ -119,16 +119,11 @@
119
119
  "consultation": {
120
120
  "on": "review",
121
121
  "models": ["gemini", "codex"],
122
- "type": "impl-review",
122
+ "type": "impl",
123
123
  "parallel": true,
124
124
  "max_rounds": 1
125
125
  },
126
- "gate": {
127
- "name": "pr-ready",
128
- "description": "Amendment ready for PR",
129
- "requires": ["tests_pass", "review_complete"],
130
- "next": null
131
- }
126
+ "gate": "pr"
132
127
  }
133
128
  ],
134
129
  "signals": {
@@ -144,11 +144,13 @@ Does NOT clean up worktrees - use `af cleanup` for that.
144
144
  Spawn a new builder.
145
145
 
146
146
  ```bash
147
- af spawn [options]
147
+ af spawn [issue-number] [options]
148
148
  ```
149
149
 
150
+ **Arguments:**
151
+ - `issue-number` - Issue number to build (positional, e.g., `42`)
152
+
150
153
  **Options:**
151
- - `-p, --project <id>` - Spawn builder for a spec (e.g., `42`)
152
154
  - `--task <text>` - Spawn builder with a task description
153
155
  - `--protocol <name>` - Spawn builder to run a protocol
154
156
  - `--shell` - Spawn a bare Claude session
@@ -166,8 +168,8 @@ Creates a new builder in an isolated git worktree. The builder gets:
166
168
  **Examples:**
167
169
 
168
170
  ```bash
169
- # Spawn builder for spec 42
170
- af spawn -p 42
171
+ # Spawn builder for issue #42
172
+ af spawn 42
171
173
 
172
174
  # Spawn with task description
173
175
  af spawn --task "Fix login bug in auth module"
@@ -176,7 +178,7 @@ af spawn --task "Fix login bug in auth module"
176
178
  af spawn --shell
177
179
 
178
180
  # Spawn with context files
179
- af spawn -p 42 --files "src/auth.ts,tests/auth.test.ts"
181
+ af spawn 42 --files "src/auth.ts,tests/auth.test.ts"
180
182
  ```
181
183
 
182
184
  ---
@@ -199,7 +201,7 @@ Displays the current state of all builders and the architect:
199
201
  ├────────┼──────────────┼─────────────┼─────────┤
200
202
  │ arch │ Architect │ running │ main │
201
203
  │ 42 │ auth-feature │ implementing│ builder/42-auth │
202
- │ 43 │ api-refactor │ pr-ready │ builder/43-api │
204
+ │ 43 │ api-refactor │ pr │ builder/43-api │
203
205
  └────────┴──────────────┴─────────────┴─────────┘
204
206
  ```
205
207
 
@@ -207,7 +209,7 @@ Status values:
207
209
  - `spawning` - Worktree created, builder starting
208
210
  - `implementing` - Actively working
209
211
  - `blocked` - Stuck, needs architect help
210
- - `pr-ready` - Implementation complete
212
+ - `pr` - Implementation complete
211
213
  - `complete` - Merged, can be cleaned up
212
214
 
213
215
  ---
@@ -527,8 +529,8 @@ Customize commands via `af-config.json` at the project root:
527
529
  Or override via CLI flags:
528
530
 
529
531
  ```bash
530
- af start --architect-cmd "claude --model opus"
531
- af spawn -p 42 --builder-cmd "claude --model haiku"
532
+ af dash start --architect-cmd "claude --model opus"
533
+ af spawn 42 --builder-cmd "claude --model haiku"
532
534
  ```
533
535
 
534
536
  ---
@@ -537,8 +539,8 @@ af spawn -p 42 --builder-cmd "claude --model haiku"
537
539
 
538
540
  | File | Description |
539
541
  |------|-------------|
540
- | `.agent-farm/state.json` | Project runtime state |
541
- | `~/.agent-farm/ports.json` | Global port registry |
542
+ | `.agent-farm/state.db` | Project runtime state (SQLite) |
543
+ | `~/.agent-farm/global.db` | Global port registry (SQLite) |
542
544
  | `af-config.json` | Agent Farm configuration (project root) |
543
545
 
544
546
  ---
@@ -94,7 +94,6 @@ Verifies that all required dependencies are installed and properly configured:
94
94
 
95
95
  **Core Dependencies (required):**
96
96
  - Node.js (>= 18.0.0)
97
- - ttyd (>= 1.7.0)
98
97
  - git (>= 2.5.0)
99
98
  - gh (GitHub CLI, authenticated)
100
99
 
@@ -121,7 +120,6 @@ Codev Doctor - Checking your environment
121
120
  Core Dependencies (required for Agent Farm)
122
121
 
123
122
  ✓ Node.js 20.10.0
124
- ✓ ttyd 1.7.4
125
123
  ✓ git 2.42.0
126
124
  ✓ gh authenticated
127
125
  ✓ @cluesmith/codev 1.0.0
@@ -171,39 +169,6 @@ codev update --force
171
169
 
172
170
  ---
173
171
 
174
- ### codev tower
175
-
176
- Cross-project dashboard showing all agent-farm instances.
177
-
178
- ```bash
179
- codev tower [options]
180
- ```
181
-
182
- **Options:**
183
- - `-p, --port <port>` - Port to run on (default: 4100)
184
- - `--stop` - Stop the tower dashboard
185
-
186
- **Description:**
187
-
188
- Starts a web-based dashboard that shows all running agent-farm instances across different projects. Useful when working on multiple codev projects simultaneously.
189
-
190
- The tower aggregates status from the global port registry at `~/.agent-farm/ports.json`.
191
-
192
- **Examples:**
193
-
194
- ```bash
195
- # Start tower dashboard
196
- codev tower
197
-
198
- # Start on custom port
199
- codev tower -p 4200
200
-
201
- # Stop the dashboard
202
- codev tower --stop
203
- ```
204
-
205
- ---
206
-
207
172
  ## See Also
208
173
 
209
174
  - [af](agent-farm.md) - Agent Farm commands
@@ -1,277 +1,139 @@
1
1
  # consult - AI Consultation CLI
2
2
 
3
- The `consult` command provides a unified interface for AI consultation with external models (Gemini, Codex, Claude). Use it for code reviews, spec reviews, and general questions.
3
+ The `consult` command provides a unified interface for AI consultation with external models (Gemini, Codex, Claude). It operates in three modes: general (ad-hoc prompts), protocol-based (structured reviews), and stats.
4
4
 
5
5
  ## Synopsis
6
6
 
7
7
  ```
8
- consult -m <model> <subcommand> [args] [options]
8
+ consult -m <model> [options]
9
+ consult stats [options]
9
10
  ```
10
11
 
11
12
  ## Required Option
12
13
 
13
14
  ```
14
- -m, --model <model> Model to use (required)
15
+ -m, --model <model> Model to use (required for all modes except stats)
15
16
  ```
16
17
 
17
18
  ## Models
18
19
 
19
- | Model | Alias | CLI Used | Notes |
20
- |-------|-------|----------|-------|
21
- | `gemini` | `pro` | gemini-cli | Pure text analysis, fast |
22
- | `codex` | `gpt` | @openai/codex | Shell command exploration, thorough |
23
- | `claude` | `opus` | @anthropic-ai/claude-code | Balanced analysis |
20
+ | Model | Alias | Backend | Notes |
21
+ |-------|-------|---------|-------|
22
+ | `gemini` | `pro` | gemini-cli | File access via --yolo, fast |
23
+ | `codex` | `gpt` | @openai/codex | Read-only sandbox, thorough |
24
+ | `claude` | `opus` | Claude Agent SDK | Balanced analysis with tool use |
24
25
 
25
- ## Options
26
+ ## Modes
26
27
 
27
- ```
28
- -n, --dry-run Show what would execute without running
29
- -t, --type <type> Review type (see Review Types below)
30
- -r, --role <role> Custom role from codev/roles/ (see Custom Roles below)
31
- ```
32
-
33
- ## Subcommands
34
-
35
- ### consult pr
36
-
37
- Review a pull request.
38
-
39
- ```bash
40
- consult -m <model> pr <number>
41
- ```
42
-
43
- **Arguments:**
44
- - `number` - PR number to review
45
-
46
- **Description:**
47
-
48
- Reviews a GitHub pull request. The consultant reads:
49
- - PR info and description
50
- - Comments and discussions
51
- - Diff of all changes
52
- - File metadata
53
-
54
- Outputs a structured review with verdict: APPROVE, REQUEST_CHANGES, or COMMENT.
55
-
56
- **Examples:**
57
-
58
- ```bash
59
- # Review PR #42 with Gemini
60
- consult -m gemini pr 42
61
-
62
- # Review with Codex (more thorough, slower)
63
- consult -m codex pr 42
64
-
65
- # Dry run to see command
66
- consult -m gemini pr 42 --dry-run
67
- ```
28
+ ### General Mode
68
29
 
69
- ---
70
-
71
- ### consult spec
72
-
73
- Review a specification.
74
-
75
- ```bash
76
- consult -m <model> spec <number>
77
- ```
78
-
79
- **Arguments:**
80
- - `number` - Spec number to review (e.g., `42` for `codev/specs/42-*.md`)
81
-
82
- **Description:**
83
-
84
- Reviews a specification file for:
85
- - Clarity and completeness
86
- - Technical feasibility
87
- - Edge cases and error scenarios
88
- - Security considerations
89
- - Testing strategy
90
-
91
- If a matching plan exists, it's included for context.
92
-
93
- **Examples:**
30
+ Send an ad-hoc prompt to a model.
94
31
 
95
32
  ```bash
96
- # Review spec 42
97
- consult -m gemini spec 42
33
+ # Inline prompt
34
+ consult -m gemini --prompt "What's the best way to structure auth middleware?"
98
35
 
99
- # With specific review type
100
- consult -m gemini spec 42 --type spec-review
36
+ # Prompt from file
37
+ consult -m codex --prompt-file review-checklist.md
101
38
  ```
102
39
 
103
- ---
104
-
105
- ### consult plan
106
-
107
- Review an implementation plan.
108
-
109
- ```bash
110
- consult -m <model> plan <number>
111
- ```
112
-
113
- **Arguments:**
114
- - `number` - Plan number to review (e.g., `42` for `codev/plans/42-*.md`)
115
-
116
- **Description:**
117
-
118
- Reviews an implementation plan for:
119
- - Alignment with specification
120
- - Implementation approach
121
- - Task breakdown and ordering
122
- - Risk identification
123
- - Testing strategy
40
+ **Options:**
41
+ - `--prompt <text>` — Inline prompt text
42
+ - `--prompt-file <path>` — Read prompt from a file
124
43
 
125
- If a matching spec exists, it's included for context.
44
+ Cannot combine `--prompt` with `--prompt-file` or `--type`.
126
45
 
127
- **Example:**
46
+ ### Protocol Mode
128
47
 
129
- ```bash
130
- consult -m gemini plan 42
131
- ```
132
-
133
- ---
134
-
135
- ### consult general
136
-
137
- General AI consultation.
48
+ Run structured reviews tied to a development protocol (SPIR, TICK, bugfix, maintain).
138
49
 
139
50
  ```bash
140
- consult -m <model> general "<query>"
141
- ```
142
-
143
- **Arguments:**
144
- - `query` - Question or request (quoted string)
51
+ # Review a spec (auto-detects project context in builder worktrees)
52
+ consult -m gemini --protocol spir --type spec
145
53
 
146
- **Description:**
54
+ # Review a plan
55
+ consult -m codex --protocol spir --type plan
147
56
 
148
- Sends a free-form query to the consultant. The consultant role is still loaded, so responses follow the consultant guidelines.
57
+ # Review implementation
58
+ consult -m claude --protocol spir --type impl
149
59
 
150
- **Examples:**
60
+ # Review a PR
61
+ consult -m gemini --protocol spir --type pr
151
62
 
152
- ```bash
153
- # Ask about code design
154
- consult -m gemini general "What's the best way to structure auth middleware?"
63
+ # Phase-scoped review (builder context only)
64
+ consult -m codex --protocol spir --type phase
155
65
 
156
- # Get architecture advice
157
- consult -m codex general "Review src/lib/database.ts for potential issues"
66
+ # Integration review
67
+ consult -m gemini --type integration
158
68
  ```
159
69
 
160
- ---
161
-
162
- ## Review Types
70
+ **Options:**
71
+ - `--protocol <name>` — Protocol: spir, bugfix, tick, maintain
72
+ - `-t, --type <type>` — Review type: spec, plan, impl, pr, phase, integration
73
+ - `--issue <number>` — Issue number (required from architect context)
163
74
 
164
- Use `--type` to load stage-specific review prompts:
75
+ **Context resolution:**
76
+ - **Builder context** (cwd inside `.builders/`): auto-detects project ID, spec, plan, and PR from porch state
77
+ - **Architect context** (cwd outside `.builders/` or `--issue` provided): requires `--issue <N>` to identify the project
165
78
 
166
- | Type | Stage | Use Case |
167
- |------|-------|----------|
168
- | `spec-review` | conceived | Review specification completeness |
169
- | `plan-review` | specified | Review implementation plan |
170
- | `impl-review` | implementing | Review code implementation |
171
- | `pr-ready` | implemented | Final check before PR |
172
- | `integration-review` | committed | Architect's integration review |
79
+ **Prompt templates:**
80
+ Protocol-specific prompts are loaded from `codev/protocols/<protocol>/consult-types/<type>-review.md`. The `integration` type uses the shared `codev/consult-types/integration-review.md`.
173
81
 
174
- **Location:** Review type prompts are stored in `codev/consult-types/`. You can customize existing prompts or add your own by creating new `.md` files in this directory.
82
+ ### Stats Mode
175
83
 
176
- > **Migration Note (v1.4.0+)**: Review types moved from `codev/roles/review-types/` to `codev/consult-types/`. The old location still works with a deprecation warning. To migrate:
177
- > ```bash
178
- > mkdir -p codev/consult-types
179
- > mv codev/roles/review-types/* codev/consult-types/
180
- > rm -r codev/roles/review-types
181
- > ```
182
-
183
- **Example:**
84
+ View consultation statistics and history.
184
85
 
185
86
  ```bash
186
- consult -m gemini spec 42 --type spec-review
187
- consult -m codex pr 68 --type integration-review
87
+ consult stats
88
+ consult stats --days 7
89
+ consult stats --project 42
90
+ consult stats --last 10
91
+ consult stats --json
188
92
  ```
189
93
 
190
- ---
94
+ **Options:**
95
+ - `--days <n>` — Limit to last N days (default: 30)
96
+ - `--project <id>` — Filter by project ID
97
+ - `--last <n>` — Show last N individual invocations
98
+ - `--json` — Output as JSON
191
99
 
192
- ## Custom Roles
100
+ ## Porch Integration Options
193
101
 
194
- Use `--role` to load a custom role instead of the default consultant:
102
+ These flags are used by porch (the protocol orchestrator) when generating consult commands. They're not typically used directly.
195
103
 
196
- ```bash
197
- consult -m gemini --role security-reviewer general "Audit this API endpoint"
198
- consult -m codex --role gtm-specialist general "Review our landing page copy"
199
104
  ```
200
-
201
- **Arguments:**
202
- - `role` - Name of role file in `codev/roles/` (without `.md` extension)
203
-
204
- **Available roles** depend on your project. Common ones include:
205
- - `architect` - System design perspective
206
- - `builder` - Implementation-focused review
207
- - `consultant` - Default balanced review (used when no `--role` specified)
208
-
209
- **Creating custom roles:**
210
-
211
- 1. Create a markdown file in `codev/roles/`:
212
- ```bash
213
- # codev/roles/security-reviewer.md
214
- # Role: Security Reviewer
215
-
216
- You are a security-focused code reviewer...
217
- ```
218
-
219
- 2. Use it with `--role`:
220
- ```bash
221
- consult -m gemini --role security-reviewer pr 42
222
- ```
223
-
224
- **Role name restrictions:**
225
- - Only letters, numbers, hyphens, and underscores
226
- - No path separators (security: prevents directory traversal)
227
- - Falls back to embedded skeleton if not found locally
228
-
229
- **Example:**
230
-
231
- ```bash
232
- # Use the architect role for high-level review
233
- consult -m gemini --role architect general "Review this system design"
234
-
235
- # Use a custom GTM specialist role
236
- consult -m codex --role gtm-specialist general "Analyze our pricing page"
105
+ --output <path> Write output to file
106
+ --plan-phase <phase> Scope review to a specific plan phase
107
+ --context <path> Context file with previous iteration feedback
108
+ --project-id <id> Project ID for metrics
237
109
  ```
238
110
 
239
- ---
240
-
241
111
  ## Parallel Consultation (3-Way Reviews)
242
112
 
243
113
  For thorough reviews, run multiple models in parallel:
244
114
 
245
115
  ```bash
246
- # Using background processes
247
- consult -m gemini spec 42 &
248
- consult -m codex spec 42 &
249
- consult -m claude spec 42 &
116
+ # 3-way spec review
117
+ consult -m gemini --protocol spir --type spec &
118
+ consult -m codex --protocol spir --type spec &
119
+ consult -m claude --protocol spir --type spec &
250
120
  wait
251
121
  ```
252
122
 
253
- Or with separate terminal sessions for better output separation.
254
-
255
- ---
256
-
257
123
  ## Performance
258
124
 
259
125
  | Model | Typical Time | Approach |
260
126
  |-------|--------------|----------|
261
- | Gemini | ~120-150s | Pure text analysis |
262
- | Codex | ~200-250s | Shell command exploration |
263
- | Claude | ~60-120s | Balanced tool use |
264
-
265
- Codex is slower because it executes shell commands (git show, rg, etc.) sequentially. It's more thorough but takes ~2x longer than Gemini.
266
-
267
- ---
127
+ | Gemini | ~120-150s | File access via --yolo, pure text output |
128
+ | Codex | ~200-250s | Shell command exploration, read-only sandbox |
129
+ | Claude | ~60-120s | Agent SDK with Read/Glob/Grep tools |
268
130
 
269
131
  ## Prerequisites
270
132
 
271
133
  Install the model CLIs you plan to use:
272
134
 
273
135
  ```bash
274
- # Claude
136
+ # Claude Agent SDK
275
137
  npm install -g @anthropic-ai/claude-code
276
138
 
277
139
  # Codex
@@ -286,58 +148,50 @@ Configure API keys:
286
148
  - Codex: `OPENAI_API_KEY`
287
149
  - Gemini: `GOOGLE_API_KEY` or `GEMINI_API_KEY`
288
150
 
289
- ---
290
-
291
151
  ## The Consultant Role
292
152
 
293
153
  The consultant role (`codev/roles/consultant.md`) defines behavior:
294
154
  - Provides second perspectives on decisions
295
155
  - Offers alternatives and considerations
296
156
  - Works constructively (not adversarial, not a rubber stamp)
297
- - Uses `git show <branch>:<file>` for PR reviews
298
-
299
- Customize by copying to your local codev/ directory:
300
-
301
- ```bash
302
- mkdir -p codev/roles
303
- cp $(npm root -g)/@cluesmith/codev/skeleton/roles/consultant.md codev/roles/
304
- ```
305
157
 
306
- ---
158
+ Customize by editing your local `codev/roles/consultant.md`.
307
159
 
308
160
  ## Query Logging
309
161
 
310
162
  All consultations are logged to `.consult/history.log`:
311
163
 
312
164
  ```
313
- 2024-01-15T10:30:00.000Z model=gemini duration=142.3s query=Review spec 42...
165
+ 2026-02-16T10:30:00.000Z model=gemini duration=142.3s query=Review spec...
314
166
  ```
315
167
 
316
- ---
317
-
318
168
  ## Examples
319
169
 
320
170
  ```bash
321
- # Quick spec review
322
- consult -m gemini spec 42
171
+ # General: ask a question
172
+ consult -m gemini --prompt "How should I structure the caching layer?"
173
+
174
+ # General: from file
175
+ consult -m codex --prompt-file design-question.md
323
176
 
324
- # Thorough PR review
325
- consult -m codex pr 68
177
+ # Protocol: spec review (builder context, auto-detected)
178
+ consult -m gemini --protocol spir --type spec
326
179
 
327
- # Architecture question
328
- consult -m claude general "How should I structure the caching layer?"
180
+ # Protocol: PR review (architect context)
181
+ consult -m codex --protocol spir --type pr --issue 42
329
182
 
330
- # Dry run to see command
331
- consult -m gemini pr 42 --dry-run
183
+ # Protocol: implementation review with bugfix protocol
184
+ consult -m claude --protocol bugfix --type impl
332
185
 
333
186
  # 3-way parallel review
334
- consult -m gemini spec 42 &
335
- consult -m codex spec 42 &
336
- consult -m claude spec 42 &
187
+ consult -m gemini --protocol spir --type spec &
188
+ consult -m codex --protocol spir --type spec &
189
+ consult -m claude --protocol spir --type spec &
337
190
  wait
338
- ```
339
191
 
340
- ---
192
+ # Stats
193
+ consult stats --days 7 --json
194
+ ```
341
195
 
342
196
  ## See Also
343
197
 
@@ -24,7 +24,7 @@ codev doctor
24
24
  af dash start
25
25
 
26
26
  # Consult an AI model about a spec
27
- consult -m gemini spec 42
27
+ consult -m gemini --protocol spir --type spec
28
28
  ```
29
29
 
30
30
  ## Installation
@@ -67,12 +67,11 @@ See [agent-farm.md](agent-farm.md) for full documentation.
67
67
 
68
68
  ### consult - AI Consultation
69
69
 
70
- | Subcommand | Description |
71
- |------------|-------------|
72
- | `consult pr <num>` | Review a pull request |
73
- | `consult spec <num>` | Review a specification |
74
- | `consult plan <num>` | Review an implementation plan |
75
- | `consult general "<query>"` | General consultation |
70
+ | Command | Description |
71
+ |---------|-------------|
72
+ | `consult -m <model> --prompt "text"` | General consultation |
73
+ | `consult -m <model> --protocol spir --type spec` | Protocol-based review |
74
+ | `consult stats` | View consultation statistics |
76
75
 
77
76
  See [consult.md](consult.md) for full documentation.
78
77