Skip to content

Commit b548a4c

Browse files
authored
Merge pull request #670 from MachineWisdomAI/feature-hermes-consult-backend
feat(consult): add Hermes backend support + ignore .hermes artifacts
2 parents 386f68b + 990c876 commit b548a4c

19 files changed

Lines changed: 398 additions & 27 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ tmp/
33
.builders/
44
worktrees/
55
.consult/
6+
.hermes/
67
.agent-farm/
78
.env
89
.update-hashes.json

codev-skeleton/resources/commands/consult.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# consult - AI Consultation CLI
22

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.
3+
The `consult` command provides a unified interface for AI consultation with external models (Gemini, Codex, Claude, Hermes). It operates in three modes: general (ad-hoc prompts), protocol-based (structured reviews), and stats.
44

55
## Synopsis
66

@@ -22,6 +22,7 @@ consult stats [options]
2222
| `gemini` | `pro` | gemini-cli | File access via --yolo, fast |
2323
| `codex` | `gpt` | @openai/codex | Read-only sandbox, thorough |
2424
| `claude` | `opus` | Claude Agent SDK | Balanced analysis with tool use |
25+
| `hermes` | - | hermes CLI (`hermes chat -q`) | Uses Hermes agent as consult backend |
2526

2627
## Modes
2728

@@ -108,16 +109,21 @@ These flags are used by porch (the protocol orchestrator) when generating consul
108109
--project-id <id> Project ID for metrics
109110
```
110111

111-
## Parallel Consultation (3-Way Reviews)
112+
## Parallel Consultation (Multi-Model Reviews)
113+
114+
Default project configuration uses a 3-model set (`gemini`, `codex`, `claude`).
112115

113116
For thorough reviews, run multiple models in parallel:
114117

115118
```bash
116-
# 3-way spec review
119+
# Default 3-way spec review
117120
consult -m gemini --protocol spir --type spec &
118121
consult -m codex --protocol spir --type spec &
119122
consult -m claude --protocol spir --type spec &
120123
wait
124+
125+
# Optional: include Hermes as a 4th reviewer
126+
consult -m hermes --protocol spir --type spec
121127
```
122128

123129
## Performance
@@ -183,12 +189,15 @@ consult -m codex --protocol spir --type pr --issue 42
183189
# Protocol: implementation review with bugfix protocol
184190
consult -m claude --protocol bugfix --type impl
185191

186-
# 3-way parallel review
192+
# Default 3-way parallel review
187193
consult -m gemini --protocol spir --type spec &
188194
consult -m codex --protocol spir --type spec &
189195
consult -m claude --protocol spir --type spec &
190196
wait
191197

198+
# Optional: include Hermes as an additional reviewer
199+
consult -m hermes --protocol spir --type spec
200+
192201
# Stats
193202
consult stats --days 7 --json
194203
```
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Plan 671: Hermes Consult Backend (Optional, Not Default)
2+
3+
## Metadata
4+
- Specification: `codev/specs/671-hermes-consult-optional-backend.md`
5+
- Issue: https://github.com/cluesmith/codev/issues/671
6+
- PR: https://github.com/cluesmith/codev/pull/670
7+
8+
## Executive Summary
9+
Implement Hermes as an additional consult backend with explicit model selection, preserve default 3-way consultation models, and document Hermes as optional. Ensure large prompts avoid ARG_MAX/E2BIG via temp-file indirection.
10+
11+
## Phases (Machine Readable)
12+
13+
```json
14+
{
15+
"phases": [
16+
{"id": "phase_1", "title": "Backend wiring and validation"},
17+
{"id": "phase_2", "title": "Docs and tests alignment"}
18+
]
19+
}
20+
```
21+
22+
## Phase Breakdown
23+
24+
### Phase 1: Backend wiring and validation
25+
Objectives:
26+
- Add Hermes model config and routing in consult command.
27+
- Add Hermes to porch model validation.
28+
- Preserve default consultation model set.
29+
- Add large-prompt guard for CLI argument limits.
30+
31+
Deliverables:
32+
- `packages/codev/src/commands/consult/index.ts`
33+
- `packages/codev/src/commands/porch/next.ts`
34+
- No default change in `packages/codev/src/lib/config.ts`
35+
36+
Acceptance criteria:
37+
- Hermes path is reachable via `-m hermes`.
38+
- Large prompt path uses temp-file indirection.
39+
- Default consultation models remain `['gemini', 'codex', 'claude']`.
40+
41+
### Phase 2: Docs and tests alignment
42+
Objectives:
43+
- Update CLI help and docs to include Hermes.
44+
- Ensure docs frame Hermes as optional.
45+
- Add/adjust tests for Hermes support and large prompt behavior.
46+
47+
Deliverables:
48+
- `packages/codev/src/cli.ts`
49+
- `codev/resources/commands/consult.md`
50+
- `codev-skeleton/resources/commands/consult.md`
51+
- `packages/codev/src/__tests__/consult.test.ts`
52+
- `packages/codev/src/__tests__/cli/consult.e2e.test.ts`
53+
- `packages/codev/src/commands/consult/__tests__/persistent-output.test.ts`
54+
55+
Acceptance criteria:
56+
- Source and skeleton docs are synchronized.
57+
- Examples show default 3-way and optional Hermes usage.
58+
- Test commands pass from `packages/codev/`.
59+
60+
## Validation Commands
61+
Run from `packages/codev/`:
62+
- `pnpm build`
63+
- `pnpm exec vitest run src/commands/porch/__tests__/consultation-models.test.ts src/commands/consult/__tests__/persistent-output.test.ts src/__tests__/consult.test.ts`
64+
- `pnpm exec vitest run --config vitest.cli.config.ts src/__tests__/cli/consult.e2e.test.ts`

codev/projects/671-hermes-consult-optional-backend/671-plan-iter1-rebuttals.md

Whitespace-only changes.

codev/projects/671-hermes-consult-optional-backend/671-specify-iter1-rebuttals.md

Whitespace-only changes.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
id: '671'
2+
title: hermes-consult-optional-backend
3+
protocol: spir
4+
phase: review
5+
plan_phases:
6+
- id: phase_1
7+
title: Backend wiring and validation
8+
status: complete
9+
- id: phase_2
10+
title: Docs and tests alignment
11+
status: complete
12+
current_plan_phase: null
13+
gates:
14+
spec-approval:
15+
status: approved
16+
requested_at: '2026-04-15T20:13:26.446Z'
17+
approved_at: '2026-04-15T20:13:36.692Z'
18+
plan-approval:
19+
status: approved
20+
requested_at: '2026-04-15T20:16:18.381Z'
21+
approved_at: '2026-04-15T20:16:25.454Z'
22+
pr:
23+
status: pending
24+
requested_at: '2026-04-15T21:49:59.445Z'
25+
iteration: 1
26+
build_complete: false
27+
history: []
28+
started_at: '2026-04-15T16:11:54.376Z'
29+
updated_at: '2026-04-15T21:49:59.446Z'

codev/resources/commands/consult.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# consult - AI Consultation CLI
22

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.
3+
The `consult` command provides a unified interface for AI consultation with external models (Gemini, Codex, Claude, Hermes). It operates in three modes: general (ad-hoc prompts), protocol-based (structured reviews), and stats.
44

55
## Synopsis
66

@@ -22,6 +22,7 @@ consult stats [options]
2222
| `gemini` | `pro` | gemini-cli | File access via --yolo, fast |
2323
| `codex` | `gpt` | @openai/codex | Read-only sandbox, thorough |
2424
| `claude` | `opus` | Claude Agent SDK | Balanced analysis with tool use |
25+
| `hermes` | - | hermes CLI (`hermes chat -q`) | Uses Hermes agent as consult backend |
2526

2627
## Modes
2728

@@ -108,16 +109,21 @@ These flags are used by porch (the protocol orchestrator) when generating consul
108109
--project-id <id> Project ID for metrics
109110
```
110111

111-
## Parallel Consultation (3-Way Reviews)
112+
## Parallel Consultation (Multi-Model Reviews)
113+
114+
Default project configuration uses a 3-model set (`gemini`, `codex`, `claude`).
112115

113116
For thorough reviews, run multiple models in parallel:
114117

115118
```bash
116-
# 3-way spec review
119+
# Default 3-way spec review
117120
consult -m gemini --protocol spir --type spec &
118121
consult -m codex --protocol spir --type spec &
119122
consult -m claude --protocol spir --type spec &
120123
wait
124+
125+
# Optional: include Hermes as a 4th reviewer
126+
consult -m hermes --protocol spir --type spec
121127
```
122128

123129
## Performance
@@ -183,12 +189,15 @@ consult -m codex --protocol spir --type pr --issue 42
183189
# Protocol: implementation review with bugfix protocol
184190
consult -m claude --protocol bugfix --type impl
185191

186-
# 3-way parallel review
192+
# Default 3-way parallel review
187193
consult -m gemini --protocol spir --type spec &
188194
consult -m codex --protocol spir --type spec &
189195
consult -m claude --protocol spir --type spec &
190196
wait
191197

198+
# Optional: include Hermes as an additional reviewer
199+
consult -m hermes --protocol spir --type spec
200+
192201
# Stats
193202
consult stats --days 7 --json
194203
```
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Review 671: Hermes Consult Backend (Optional, Not Default)
2+
3+
## Summary
4+
Implemented Hermes as an additional consult backend and kept default consultation fan-out unchanged. Added large-prompt protection for Hermes to avoid CLI argument length failures. Updated docs and tests accordingly.
5+
6+
## Spec Compliance
7+
- [x] Hermes backend available via `consult -m hermes`.
8+
- [x] Porch validation accepts `hermes`.
9+
- [x] Default consultation models remain `gemini`, `codex`, `claude`.
10+
- [x] Large Hermes prompts use temp-file indirection (ARG_MAX/E2BIG mitigation).
11+
- [x] Source/skeleton docs synchronized and clarified as optional Hermes.
12+
- [x] Tests updated for acceptance and large-prompt behavior.
13+
14+
## Implementation Notes
15+
Key changes landed in:
16+
- `packages/codev/src/commands/consult/index.ts`
17+
- `packages/codev/src/commands/porch/next.ts`
18+
- `packages/codev/src/cli.ts`
19+
- `codev/resources/commands/consult.md`
20+
- `codev-skeleton/resources/commands/consult.md`
21+
- `.gitignore`
22+
- test files under `packages/codev/src/__tests__/...`
23+
24+
## Validation
25+
Executed targeted build/test flow from `packages/codev/`:
26+
- `pnpm build`
27+
- `pnpm exec vitest run src/commands/porch/__tests__/consultation-models.test.ts src/commands/consult/__tests__/persistent-output.test.ts src/__tests__/consult.test.ts`
28+
- `pnpm exec vitest run --config vitest.cli.config.ts src/__tests__/cli/consult.e2e.test.ts`
29+
30+
All passed at execution time.
31+
32+
## Deviations and Corrections
33+
- Initial docs examples incorrectly implied 4-way default review.
34+
- Corrected docs to explicitly show 3-way default and Hermes as optional.
35+
- Initial implementation drifted from the spec by treating Hermes as a default consultation backend. Review feedback corrected this before merge by restoring 3-way defaults and moving Hermes coverage to explicit opt-in paths.
36+
37+
## Consultation Feedback
38+
39+
### Specify Phase (Round 1)
40+
41+
#### Gemini
42+
- No concerns raised — approved.
43+
44+
#### Codex
45+
- No concerns raised — approved.
46+
47+
#### Claude
48+
- No concerns raised — approved.
49+
50+
#### Hermes
51+
- No concerns raised — approved.
52+
53+
### Plan Phase (Round 1)
54+
55+
#### Gemini
56+
- No concerns raised — approved.
57+
58+
#### Codex
59+
- No concerns raised — approved.
60+
61+
#### Claude
62+
- No concerns raised — approved.
63+
64+
#### Hermes
65+
- No concerns raised — approved.
66+
67+
### Implement Phase 1 (Round 1)
68+
69+
#### Gemini
70+
- No concerns raised — approved.
71+
72+
#### Codex
73+
- No concerns raised — approved.
74+
75+
#### Claude
76+
- No concerns raised — approved.
77+
78+
#### Hermes
79+
- No concerns raised — approved.
80+
81+
### Implement Phase 2 (Round 1)
82+
83+
#### Gemini
84+
- **Concern**: Hermes must remain optional rather than becoming part of the default fan-out.
85+
- **Addressed**: Restored the default consultation models to `gemini`, `codex`, `claude` and reverted default-facing fixtures to 3-way behavior.
86+
87+
#### Codex
88+
- **Concern**: `afx bench` must not require Hermes by default.
89+
- **Addressed**: Reverted `ENGINES` to the 3-engine default set and updated the bench tests accordingly.
90+
91+
#### Claude
92+
- **Concern**: Tests should distinguish between allowed backends and default backends.
93+
- **Addressed**: Kept Hermes in `VALID_MODELS`, restored 3-way default assertions, and added explicit opt-in Hermes test coverage.
94+
95+
## Architecture Updates
96+
No architecture updates needed. The final change preserves the existing consultation architecture: Hermes remains an allowed backend, but the default orchestration and benchmark topology stay unchanged.
97+
98+
## Lessons Learned Updates
99+
No lessons learned updates needed. This correction reinforces existing lessons already recorded in `codev/resources/lessons-learned.md` about preserving defaults unless product intent explicitly changes and keeping allowlists distinct from defaults.
100+
101+
## Flaky Tests
102+
- No flaky tests encountered in the scoped validation flow used for this project.
103+
104+
## Pull Request
105+
- Existing PR used for this work: `#670`
106+
107+
## Follow-ups
108+
- If additional CLI backends are added later, keep default fan-out stable unless explicitly changed by product decision.
109+
- Preserve large-prompt transport tests for each CLI backend to prevent ARG_MAX regressions.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Spec 671: Hermes Consult Backend (Optional, Not Default)
2+
3+
## Problem
4+
Codev consult supported Gemini, Codex, and Claude, but did not support Hermes. Teams that use Hermes (including pay-as-you-go workflows) could not use `consult -m hermes`.
5+
6+
A second problem appeared during rollout: documentation examples drifted toward 4-way default review, which conflicts with Codev defaults and intended model positioning.
7+
8+
## Desired State
9+
Add Hermes as an additional consult backend while preserving current default behavior.
10+
11+
## Requirements
12+
1. `consult -m hermes` must be supported in CLI routing.
13+
2. Porch consultation model validation must accept `hermes` when explicitly configured.
14+
3. Default consultation fan-out must remain unchanged (`gemini`, `codex`, `claude`).
15+
4. Hermes prompt transport must avoid ARG_MAX/E2BIG failures for large prompts.
16+
5. Docs must present Hermes as optional and keep source/skeleton docs synchronized.
17+
6. Tests must cover model acceptance and large-prompt behavior.
18+
19+
## Non-Goals
20+
- Changing default consultation models to 4-way.
21+
- Adding shorthand alias for Hermes in this iteration.
22+
23+
## Success Criteria
24+
- [ ] Hermes model works in consult command.
25+
- [ ] Large prompts are handled without inline-arg overflow failures.
26+
- [ ] Default model configuration remains 3-way.
27+
- [ ] Docs in `codev/` and `codev-skeleton/` match and state Hermes is optional.
28+
- [ ] Relevant tests pass.
29+
30+
## Risks
31+
- Documentation can drift from runtime defaults.
32+
- Backend-specific prompt transport can regress and reintroduce E2BIG.
33+
34+
## Mitigations
35+
- Add explicit tests for Hermes large-prompt path.
36+
- Keep docs examples aligned with `packages/codev/src/lib/config.ts` defaults.
37+
38+
## References
39+
- Issue: https://github.com/cluesmith/codev/issues/671
40+
- PR: https://github.com/cluesmith/codev/pull/670

packages/codev/src/__tests__/cli/consult.e2e.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ describe('consult command (CLI)', () => {
125125
expect(result.status).toBe(0);
126126
});
127127

128+
it('accepts --model hermes option', () => {
129+
const result = runConsult(['--model', 'hermes', '--help'], env.dir, env.env);
130+
expect(result.status).toBe(0);
131+
});
132+
128133
// === Input Validation ===
129134

130135
it('--type without --model fails', () => {

0 commit comments

Comments
 (0)