dual-brain 4.6.0 → 4.7.1
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/CLAUDE.md +35 -130
- package/README.md +34 -179
- package/hooks/control-panel.mjs +379 -8
- package/hooks/cost-logger.mjs +11 -53
- package/hooks/cost-report.mjs +126 -65
- package/hooks/decision-ledger.mjs +3 -53
- package/hooks/dual-brain-review.mjs +25 -261
- package/hooks/dual-brain-think.mjs +37 -300
- package/hooks/enforce-tier.mjs +93 -265
- package/hooks/failure-detector.mjs +1 -3
- package/hooks/gpt-work-dispatcher.mjs +153 -12
- package/hooks/health-check.mjs +25 -17
- package/hooks/quality-gate.mjs +11 -6
- package/hooks/risk-classifier.mjs +2 -135
- package/hooks/session-report.mjs +71 -41
- package/hooks/summary-checkpoint.mjs +8 -35
- package/hooks/test-orchestrator.mjs +31 -2080
- package/install.mjs +628 -1557
- package/orchestrator.json +96 -73
- package/package.json +2 -7
- package/hooks/agent-chains.mjs +0 -369
- package/hooks/agent-templates.mjs +0 -441
- package/hooks/atomic-write.mjs +0 -109
- package/hooks/config-validator.mjs +0 -156
- package/hooks/confirmation-policy.mjs +0 -167
- package/hooks/error-channel.mjs +0 -68
- package/hooks/ship-captain.mjs +0 -1176
- package/hooks/ship-gate.mjs +0 -971
package/CLAUDE.md
CHANGED
|
@@ -1,33 +1,7 @@
|
|
|
1
1
|
# Dual-Brain Orchestrator
|
|
2
2
|
|
|
3
|
-
> Extension of data-tools by Steve Moraco. Requires replit-tools for full functionality.
|
|
4
|
-
|
|
5
3
|
This project uses dual-provider orchestration. Config: `.claude/orchestrator.json`.
|
|
6
4
|
|
|
7
|
-
## Ship Captain — Primary Workflow
|
|
8
|
-
|
|
9
|
-
The preferred way to start any task:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npx dual-brain do "fix the auth bug and write tests"
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Automatically: decomposes goal → selects agents via intent detection → executes →
|
|
16
|
-
runs tests → quality gate → self-heals issues (2 retries) → creates branch → opens PR.
|
|
17
|
-
|
|
18
|
-
**Flags:**
|
|
19
|
-
- `--yolo` — skip confirmations (still runs tests/gate, never auto-merges)
|
|
20
|
-
- `--careful` — confirm every step
|
|
21
|
-
- `--plan-only` — preview the plan without executing
|
|
22
|
-
- `--no-pr` — skip PR creation
|
|
23
|
-
|
|
24
|
-
**Intent detection** routes goals automatically: `fix`/`add` → execute chain, `explore`/`understand` → search-then-execute chain, `review` → dual-brain review chain.
|
|
25
|
-
|
|
26
|
-
**Resume an incomplete run:**
|
|
27
|
-
```bash
|
|
28
|
-
npx dual-brain resume
|
|
29
|
-
```
|
|
30
|
-
|
|
31
5
|
## Tier Routing
|
|
32
6
|
|
|
33
7
|
Route subagents by task complexity:
|
|
@@ -36,96 +10,56 @@ Route subagents by task complexity:
|
|
|
36
10
|
- **Execute** (`model: "sonnet"`): Edits, tests, git ops. Return: files changed, tests run, edge cases.
|
|
37
11
|
- **Think** (main session, Opus): Architecture, review, planning. Return: decision, alternatives, risks.
|
|
38
12
|
|
|
39
|
-
The `enforce-tier` hook **blocks** severe mismatches in auto/balanced/quality-first profiles rather than just warning.
|
|
40
|
-
|
|
41
|
-
## Agent Templates
|
|
42
|
-
|
|
43
|
-
Pre-built specialist agents for common tasks:
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
npx dual-brain agents # list all templates
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Templates include `explorer`, `fixer`, `reviewer`, `tester`, and more. Ship Captain selects the right template automatically based on intent detection.
|
|
50
|
-
|
|
51
|
-
## Agent Chains
|
|
52
|
-
|
|
53
|
-
Multi-step workflows that compose templates:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npx dual-brain chains # list all chains
|
|
57
|
-
npx dual-brain do "explore auth then fix" # auto-selects explore-then-fix chain
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Built-in chains: `explore-then-fix`, `test-and-fix`, `review-and-apply`.
|
|
61
|
-
|
|
62
13
|
## GPT Lane
|
|
63
14
|
|
|
64
15
|
For isolated or parallel work, dispatch to GPT via Codex CLI:
|
|
65
16
|
|
|
66
|
-
- `
|
|
17
|
+
- `node .claude/hooks/gpt-work-dispatcher.mjs --task "..." --model gpt-5.4` — execution tasks
|
|
67
18
|
|
|
68
19
|
## Dual-Brain Collaboration
|
|
69
20
|
|
|
70
|
-
|
|
21
|
+
Dual-brain is a multi-round conversation between Claude and GPT — not a single-shot dispatch.
|
|
71
22
|
|
|
72
23
|
**Think flow** (architecture decisions):
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
Use `--manual` to step through rounds yourself:
|
|
80
|
-
1. Round 1: `npx dual-brain think --question "..." --manual`
|
|
81
|
-
2. You analyze independently
|
|
82
|
-
3. Round 2: `npx dual-brain think --question "..." --round 2 --claude-says "<your analysis>"`
|
|
24
|
+
1. Round 1: `node .claude/hooks/dual-brain-think.mjs --question "..."`
|
|
25
|
+
→ GPT gives independent analysis
|
|
26
|
+
2. You analyze the same question independently
|
|
27
|
+
3. Round 2: `node .claude/hooks/dual-brain-think.mjs --question "..." --round 2 --claude-says "<your analysis>"`
|
|
28
|
+
→ GPT responds to your points: agreements, pushback, refined recommendation
|
|
83
29
|
4. You synthesize both rounds into a final decision
|
|
84
30
|
|
|
85
31
|
**Review flow** (code review):
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
Use `--manual` for the old step-by-step flow.
|
|
32
|
+
1. Round 1: `node .claude/hooks/dual-brain-review.mjs`
|
|
33
|
+
→ GPT reviews the diff independently
|
|
34
|
+
2. You review the same diff independently
|
|
35
|
+
3. Round 2: `node .claude/hooks/dual-brain-review.mjs --round 2 --claude-review "<your findings>"`
|
|
36
|
+
→ GPT confirms shared findings, acknowledges misses, disputes false positives
|
|
37
|
+
4. You synthesize into a final review verdict
|
|
93
38
|
|
|
94
39
|
## Routing Rules
|
|
95
40
|
|
|
96
41
|
1. Tasks under 3 min → Claude (Codex startup overhead not worth it)
|
|
97
|
-
2. Isolated tasks over 3 min → check balance: `
|
|
98
|
-
3. High-risk decisions → dual-brain think
|
|
42
|
+
2. Isolated tasks over 3 min → check balance: `node .claude/hooks/budget-balancer.mjs`
|
|
43
|
+
3. High-risk decisions → dual-brain think
|
|
99
44
|
4. When a task spans tiers: think > execute > search
|
|
100
45
|
|
|
101
46
|
## Quality Gate
|
|
102
47
|
|
|
103
48
|
Before ending a session with code changes:
|
|
104
|
-
1. Run `
|
|
105
|
-
2. Run `
|
|
49
|
+
1. Run `node .claude/hooks/session-report.mjs`
|
|
50
|
+
2. Run `node .claude/hooks/quality-gate.mjs`
|
|
106
51
|
|
|
107
52
|
Gate statuses: `pass` (safe to end), `issues_found` (fix first), `needs_human_review` (GPT unavailable).
|
|
108
53
|
|
|
109
|
-
**Self-healing:** When Ship Captain is running, gate issues are automatically fixed and retried up to 2 times. Test failures are also auto-fixed (2 retries) before surfacing to the user.
|
|
110
|
-
|
|
111
|
-
## Recovery
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
npx dual-brain doctor # check system health and report issues
|
|
115
|
-
npx dual-brain repair # fix corrupt files, stale locks, re-register hooks
|
|
116
|
-
npx dual-brain reset # clear all state files (keeps config/hooks)
|
|
117
|
-
npx dual-brain resume # resume last incomplete Ship Captain run
|
|
118
|
-
```
|
|
119
|
-
|
|
120
54
|
## Profiles
|
|
121
55
|
|
|
122
56
|
Active profile controls routing posture, budgets, and quality gate behavior.
|
|
123
57
|
Profile persists to `.claude/dual-brain.profile.json` (gitignored).
|
|
124
58
|
|
|
125
|
-
- **auto** (default): Adapts routing based on task risk, provider health, and outcomes. Uses file-path risk classification and failure-loop detection to auto-escalate when needed.
|
|
126
|
-
- **balanced**: Best model per tier, normal budgets, reviews at medium+ risk
|
|
127
|
-
- **cost-saver**: Prefer cheaper models, lower budgets, skip GPT for non-critical
|
|
128
|
-
- **quality-first**: Dual-brain for medium+ risk, higher budgets, stricter reviews
|
|
59
|
+
- **auto** (default): Adapts routing based on task risk, provider health, and outcomes. Uses file-path risk classification and failure-loop detection to auto-escalate when needed.
|
|
60
|
+
- **balanced**: Best model per tier, normal budgets, reviews at medium+ risk
|
|
61
|
+
- **cost-saver**: Prefer cheaper models, lower budgets, skip GPT for non-critical
|
|
62
|
+
- **quality-first**: Dual-brain for medium+ risk, higher budgets, stricter reviews
|
|
129
63
|
|
|
130
64
|
Switch profiles: `npx dual-brain mode cost-saver`
|
|
131
65
|
Check status: `npx dual-brain status`
|
|
@@ -147,61 +81,32 @@ Casual natural language → structured work. The vibe coding system translates i
|
|
|
147
81
|
|
|
148
82
|
**Intent compiler** — decompose multi-task requests:
|
|
149
83
|
```bash
|
|
150
|
-
|
|
84
|
+
node .claude/hooks/vibe-router.mjs "fix the login bug and also update the nav"
|
|
151
85
|
```
|
|
152
86
|
Returns structured tasks with tier/risk classification, complexity level, quality gates, and wave strategy.
|
|
153
87
|
|
|
154
88
|
**Plan generator** — Steve-style 3-part markdown plans:
|
|
155
89
|
```bash
|
|
156
|
-
|
|
90
|
+
node .claude/hooks/plan-generator.mjs --utterance "..." [--write]
|
|
157
91
|
```
|
|
158
92
|
Generates: (1) dependency-ordered task table, (2) user stories + edge cases, (3) questions with suggested answers. Pass `--write` to save to `.claude/plans/`.
|
|
159
93
|
|
|
160
94
|
**Durable memory** — preferences persist across sessions:
|
|
161
95
|
```bash
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
96
|
+
node .claude/hooks/vibe-memory.mjs # show state
|
|
97
|
+
node .claude/hooks/vibe-memory.mjs --set preferences.risk_tolerance=careful
|
|
98
|
+
node .claude/hooks/vibe-memory.mjs --threads # active work
|
|
99
|
+
node .claude/hooks/vibe-memory.mjs --infer # preference suggestions
|
|
166
100
|
```
|
|
167
101
|
Tracks preferred profile, risk tolerance, active threads, and learns from usage patterns.
|
|
168
102
|
|
|
169
103
|
## Available Tools
|
|
170
104
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
- `
|
|
175
|
-
- `
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
- `
|
|
179
|
-
- `npx dual-brain review` — dual-brain code review (auto 2-round; `--manual` for step-by-step)
|
|
180
|
-
- `npx dual-brain dispatch --task "..."` — dispatch work to GPT
|
|
181
|
-
|
|
182
|
-
**Vibe coding:**
|
|
183
|
-
- `npx dual-brain vibe "..."` — decompose casual requests into structured work
|
|
184
|
-
- `npx dual-brain plan --utterance "..."` — generate execution plans
|
|
185
|
-
- `npx dual-brain memory` — persistent preferences and work threads
|
|
186
|
-
|
|
187
|
-
**Agents and chains:**
|
|
188
|
-
- `npx dual-brain agents` — list agent templates
|
|
189
|
-
- `npx dual-brain chains` — list agent chains
|
|
190
|
-
|
|
191
|
-
**Quality and reporting:**
|
|
192
|
-
- `npx dual-brain gate` — run quality gate
|
|
193
|
-
- `npx dual-brain report` — generate session report
|
|
194
|
-
- `npx dual-brain cost` — activity and cost estimates
|
|
195
|
-
- `npx dual-brain ledger` — routing outcome insights
|
|
196
|
-
|
|
197
|
-
**Profiles and config:**
|
|
198
|
-
- `npx dual-brain mode <profile>` — switch profile
|
|
199
|
-
- `npx dual-brain status` — current profile and provider health
|
|
200
|
-
- `npx dual-brain budget` — provider balance status
|
|
201
|
-
|
|
202
|
-
**Recovery:**
|
|
203
|
-
- `npx dual-brain doctor` — check system health and report issues
|
|
204
|
-
- `npx dual-brain repair` — fix corrupt files, stale locks, re-register hooks
|
|
205
|
-
- `npx dual-brain reset` — clear all state files (keeps config/hooks)
|
|
206
|
-
- `npx dual-brain health` — verify all hooks and dependencies
|
|
207
|
-
- `npx dual-brain test` — run self-tests (78 tests)
|
|
105
|
+
- `node .claude/hooks/vibe-router.mjs "..."` — decompose casual requests into structured work
|
|
106
|
+
- `node .claude/hooks/plan-generator.mjs --utterance "..."` — generate execution plans
|
|
107
|
+
- `node .claude/hooks/vibe-memory.mjs` — persistent preferences and work threads
|
|
108
|
+
- `node .claude/hooks/cost-report.mjs` — activity and cost estimates
|
|
109
|
+
- `node .claude/hooks/health-check.mjs` — verify system health
|
|
110
|
+
- `node .claude/hooks/budget-balancer.mjs` — provider balance status
|
|
111
|
+
- `node .claude/hooks/decision-ledger.mjs` — routing outcome insights
|
|
112
|
+
- `node .claude/hooks/test-orchestrator.mjs` — run self-tests (40 tests)
|
package/README.md
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
# Dual-Brain Orchestrator
|
|
2
2
|
|
|
3
|
-
> **Part of the [data-tools](https://github.com/stevemoraco) ecosystem by Steve Moraco**
|
|
4
|
-
>
|
|
5
|
-
> dual-brain extends data-tools/replit-tools with dual-provider AI orchestration.
|
|
6
|
-
> Best experienced with replit-tools installed for persistent auth, session management, and container survival.
|
|
7
|
-
|
|
8
3
|
One command. Both brains. Auto-detected. Auto-configured. Default profile: **auto**.
|
|
9
4
|
|
|
10
5
|
Dual-provider orchestration for Claude Code across Claude and OpenAI subscriptions. Routes search to cheap models, execution to mid-tier, thinking to the most capable. Dispatches work to GPT via Codex CLI. Dual-brain analysis for high-risk decisions.
|
|
@@ -41,10 +36,10 @@ npx -y dual-brain
|
|
|
41
36
|
|
|
42
37
|
## How it works
|
|
43
38
|
|
|
44
|
-
**Two
|
|
39
|
+
**Two advisory hooks** are registered in `.claude/settings.json` and fire on each tool use. They detect and recommend — they do not execute actions without user confirmation:
|
|
45
40
|
|
|
46
|
-
- **enforce-tier.mjs** (PreToolUse on Agent): Classifies tasks,
|
|
47
|
-
- **cost-logger.mjs** (PostToolUse on all tools): Logs usage to daily rotated files for cost tracking
|
|
41
|
+
- **enforce-tier.mjs** (PreToolUse on Agent): Classifies tasks, recommends the correct model tier, detects duplicates, suggests cross-provider routing
|
|
42
|
+
- **cost-logger.mjs** (PostToolUse on all tools): Logs usage to daily rotated files for cost tracking
|
|
48
43
|
|
|
49
44
|
**Three tiers route work by complexity:**
|
|
50
45
|
|
|
@@ -54,28 +49,7 @@ npx -y dual-brain
|
|
|
54
49
|
| Execute | Sonnet | GPT-5.4 | edits, tests, git ops |
|
|
55
50
|
| Think | Opus | GPT-5.5 | architecture, review, planning |
|
|
56
51
|
|
|
57
|
-
**Dual-brain** is
|
|
58
|
-
|
|
59
|
-
**Intent detection** — the Ship Captain reads your natural language goal and routes it to the right chain automatically: `fix` → execute, `explore`/`understand` → search-then-execute, `review` → dual-brain review.
|
|
60
|
-
|
|
61
|
-
**Self-healing** — gate issues and test failures are automatically retried up to 2 times before surfacing to the user.
|
|
62
|
-
|
|
63
|
-
## Ship Captain — Intent to PR
|
|
64
|
-
|
|
65
|
-
One command does everything:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
npx dual-brain do "fix the auth bug and write tests"
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Automatically: decomposes goal → selects agents → executes → runs tests →
|
|
72
|
-
quality gate → self-heals issues (2 retries) → creates branch → opens PR.
|
|
73
|
-
|
|
74
|
-
Flags:
|
|
75
|
-
- `--yolo` — skip confirmations (still tests/gates, never merges)
|
|
76
|
-
- `--careful` — confirm every step
|
|
77
|
-
- `--plan-only` — preview without executing
|
|
78
|
-
- `--no-pr` — skip PR creation
|
|
52
|
+
**Dual-brain** is recommended automatically for high-risk decisions — hooks detect the risk level and suggest dual-brain analysis, where both providers think on the same problem independently.
|
|
79
53
|
|
|
80
54
|
## Vibe Coding
|
|
81
55
|
|
|
@@ -83,10 +57,10 @@ Speak naturally. The orchestrator handles the structure.
|
|
|
83
57
|
|
|
84
58
|
```bash
|
|
85
59
|
# Decompose a casual request into structured work
|
|
86
|
-
|
|
60
|
+
node .claude/hooks/vibe-router.mjs "fix the login bug and also update the nav"
|
|
87
61
|
|
|
88
62
|
# Generate a Steve-style execution plan
|
|
89
|
-
|
|
63
|
+
node .claude/hooks/plan-generator.mjs --utterance "refactor the auth flow" --write
|
|
90
64
|
|
|
91
65
|
# Switch profiles with natural language
|
|
92
66
|
npx dual-brain mode "go aggressive"
|
|
@@ -94,163 +68,40 @@ npx dual-brain mode "be careful"
|
|
|
94
68
|
npx dual-brain mode "cheap"
|
|
95
69
|
|
|
96
70
|
# Check persistent preferences and work threads
|
|
97
|
-
|
|
71
|
+
node .claude/hooks/vibe-memory.mjs --threads
|
|
98
72
|
```
|
|
99
73
|
|
|
100
74
|
The vibe-router splits multi-task requests, classifies risk, assigns tiers, and recommends quality gates. The plan-generator produces 3-part plans (dependency-ordered tasks, user stories, questions with suggested answers). Vibe-memory learns your preferences over time.
|
|
101
75
|
|
|
102
|
-
## Automatic Collaboration
|
|
103
|
-
|
|
104
|
-
Think and review now auto-complete the full 2-round dialogue:
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
npx dual-brain think --question "should we use Redis?"
|
|
108
|
-
# → GPT Round 1 → Claude analysis → GPT Round 2 → Synthesis
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
Use `--manual` to step through rounds yourself (old behavior).
|
|
112
|
-
|
|
113
|
-
## Agent Templates and Chains
|
|
114
|
-
|
|
115
|
-
Pre-built specialist agents and opinionated multi-step workflows:
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
npx dual-brain agents # list all templates
|
|
119
|
-
npx dual-brain chains # list all chains
|
|
120
|
-
npx dual-brain do "explore auth then fix bug" # auto-selects explore-then-fix chain
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
Templates include: `explorer`, `fixer`, `reviewer`, `tester`, and more. Chains compose templates into end-to-end workflows — `explore-then-fix`, `test-and-fix`, `review-and-apply`.
|
|
124
|
-
|
|
125
|
-
## Commands
|
|
126
|
-
|
|
127
|
-
### Primary workflow
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
npx dual-brain do "..." # Ship Captain: goal → PR in one command
|
|
131
|
-
npx dual-brain do "..." --yolo # Skip confirmations
|
|
132
|
-
npx dual-brain do "..." --careful # Confirm every step
|
|
133
|
-
npx dual-brain do "..." --plan-only # Preview plan without executing
|
|
134
|
-
npx dual-brain do "..." --no-pr # Skip PR creation
|
|
135
|
-
npx dual-brain resume # Resume last incomplete run
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Collaboration
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
npx dual-brain think --question "..." # Dual-brain think (auto 2-round)
|
|
142
|
-
npx dual-brain review # Dual-brain code review (auto 2-round)
|
|
143
|
-
npx dual-brain dispatch --task "..." # Dispatch task to GPT
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
### Vibe coding
|
|
147
|
-
|
|
148
|
-
```bash
|
|
149
|
-
npx dual-brain vibe "..." # Decompose casual request
|
|
150
|
-
npx dual-brain plan --utterance "..." # Generate execution plan
|
|
151
|
-
npx dual-brain memory # Show preferences and threads
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
### Agents and chains
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
npx dual-brain agents # List agent templates
|
|
158
|
-
npx dual-brain chains # List agent chains
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Quality and reporting
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
npx dual-brain gate # Run quality gate
|
|
165
|
-
npx dual-brain report # Session report
|
|
166
|
-
npx dual-brain cost # Activity and cost estimates
|
|
167
|
-
npx dual-brain ledger # Routing outcome insights
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### Profiles and config
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
npx dual-brain mode cost-saver # Switch profile
|
|
174
|
-
npx dual-brain status # Current profile and provider health
|
|
175
|
-
npx dual-brain budget # Provider balance status
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### Recovery
|
|
179
|
-
|
|
180
|
-
```bash
|
|
181
|
-
npx dual-brain doctor # Check system health and report issues
|
|
182
|
-
npx dual-brain repair # Fix corrupt files, stale locks, re-register hooks
|
|
183
|
-
npx dual-brain reset # Clear all state files (keeps config/hooks)
|
|
184
|
-
npx dual-brain health # Verify all hooks and dependencies
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
### Install
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
npx -y dual-brain # detect, configure, install
|
|
191
|
-
npx dual-brain --force # overwrite all config
|
|
192
|
-
npx dual-brain --dry-run # detect only, don't write
|
|
193
|
-
npx dual-brain --json # output detection as JSON
|
|
194
|
-
npx dual-brain --help # show help
|
|
195
|
-
npx dual-brain --uninstall # remove hooks and clean state
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
## Profiles
|
|
199
|
-
|
|
200
|
-
The active profile controls routing posture, budgets, and quality gate behavior. Default: **auto**.
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
npx dual-brain mode cost-saver # switch profile
|
|
204
|
-
npx dual-brain status # check current profile and provider health
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
- **auto** (default): Adapts routing based on task risk, provider health, and outcomes. Auto-escalates tier on repeated failures. Blocks major tier mismatches.
|
|
208
|
-
- **balanced**: Best model per tier, normal budgets, reviews at medium+ risk.
|
|
209
|
-
- **cost-saver**: Prefer cheaper models, lower budgets, skip GPT for non-critical work. Warns on major mismatches (does not block).
|
|
210
|
-
- **quality-first**: Dual-brain for medium+ risk, higher budgets, stricter reviews. Blocks both minor and major mismatches.
|
|
211
|
-
|
|
212
|
-
## Troubleshooting
|
|
213
|
-
|
|
214
|
-
**Hooks not firing** — Run `npx dual-brain doctor`. Check that `.claude/settings.json` has the hook entries. Run `npx dual-brain repair` to re-register.
|
|
215
|
-
|
|
216
|
-
**Codex/GPT features unavailable** — Run `codex --version` and `codex login`. If Codex CLI isn't installed: `npm i -g @openai/codex`. Re-run `npx dual-brain` to detect.
|
|
217
|
-
|
|
218
|
-
**Auth expired** — Run `claude login` for Claude, `codex login` for OpenAI. Re-run `npx dual-brain` to re-detect.
|
|
219
|
-
|
|
220
|
-
**Duplicate warnings every time** — Normal during agent waves (3+ agents in 90s). The system auto-suppresses. If persistent with single agents, check for identical task descriptions.
|
|
221
|
-
|
|
222
|
-
**Budget warnings too aggressive/too lenient** — Switch profile: `npx dual-brain mode cost-saver` or `npx dual-brain mode quality-first`. Or set custom limits with `npx dual-brain budget <session$> [daily$]`.
|
|
223
|
-
|
|
224
|
-
**Corrupt state / weird behavior** — Run `npx dual-brain repair` for automatic fixes, or `npx dual-brain reset --force` to wipe all state files.
|
|
225
|
-
|
|
226
|
-
**Multiple Claude Code sessions** — State files may have brief write conflicts. Each session tracks independently. Use a single session for best results.
|
|
227
|
-
|
|
228
|
-
**Incomplete run** — Use `npx dual-brain resume` to continue where Ship Captain left off.
|
|
229
|
-
|
|
230
|
-
**Uninstall** — `npx dual-brain --uninstall` removes hooks from settings.json and cleans state files.
|
|
231
|
-
|
|
232
76
|
## Scripts
|
|
233
77
|
|
|
234
78
|
| Script | Purpose |
|
|
235
79
|
|--------|---------|
|
|
236
|
-
| `hooks/ship-captain.mjs` | End-to-end executor: goal → plan → execute → gate → PR |
|
|
237
|
-
| `hooks/agent-templates.mjs` | Pre-built specialist agent templates |
|
|
238
|
-
| `hooks/agent-chains.mjs` | Multi-step agent workflows (explore-then-fix, etc.) |
|
|
239
80
|
| `hooks/vibe-router.mjs` | Decompose casual language into structured work orders |
|
|
240
81
|
| `hooks/plan-generator.mjs` | Generate Steve-style 3-part execution plans |
|
|
241
82
|
| `hooks/vibe-memory.mjs` | Persistent preferences, work threads, preference inference |
|
|
242
83
|
| `hooks/cost-report.mjs` | Activity & cost estimates by model tier |
|
|
243
|
-
| `hooks/dual-brain-review.mjs` |
|
|
244
|
-
| `hooks/dual-brain-think.mjs` | Dual-perspective analysis on architecture decisions
|
|
84
|
+
| `hooks/dual-brain-review.mjs` | Send git diff to GPT for independent review |
|
|
85
|
+
| `hooks/dual-brain-think.mjs` | Dual-perspective analysis on architecture decisions |
|
|
245
86
|
| `hooks/quality-gate.mjs` | Sensitivity-scored quality gate with review artifacts |
|
|
246
87
|
| `hooks/budget-balancer.mjs` | Provider balance and routing recommendations |
|
|
247
88
|
| `hooks/gpt-work-dispatcher.mjs` | Dispatch execution tasks to GPT via Codex CLI |
|
|
248
89
|
| `hooks/session-report.mjs` | Session-end summary: activity, compliance, quality |
|
|
249
90
|
| `hooks/health-check.mjs` | Verify all hooks and dependencies are working |
|
|
250
|
-
| `hooks/test-orchestrator.mjs` | Self-test harness (
|
|
91
|
+
| `hooks/test-orchestrator.mjs` | Self-test harness (40 tests) |
|
|
251
92
|
| `hooks/setup-wizard.mjs` | Interactive config (optional — for custom plans) |
|
|
252
93
|
| `hooks/install-git-hooks.mjs` | Git pre-commit hook for quality gate |
|
|
253
94
|
|
|
95
|
+
## CLI options
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npx -y dual-brain # detect, configure, install
|
|
99
|
+
npx dual-brain --force # overwrite all config
|
|
100
|
+
npx dual-brain --dry-run # detect only, don't write
|
|
101
|
+
npx dual-brain --json # output detection as JSON
|
|
102
|
+
npx dual-brain --help # show help
|
|
103
|
+
```
|
|
104
|
+
|
|
254
105
|
## Customize
|
|
255
106
|
|
|
256
107
|
After install, edit these files:
|
|
@@ -259,20 +110,24 @@ After install, edit these files:
|
|
|
259
110
|
- `review-rules.md` — project-specific rules for GPT code review
|
|
260
111
|
- `settings.json` — hook registrations (auto-generated, safe to extend)
|
|
261
112
|
|
|
113
|
+
## Profiles
|
|
114
|
+
|
|
115
|
+
The active profile controls routing posture, budgets, and quality gate behavior. Default: **auto**.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
npx dual-brain mode cost-saver # switch profile
|
|
119
|
+
npx dual-brain status # check current profile and provider health
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
- **auto** (default): Adapts routing based on task risk, provider health, and outcomes. Auto-escalates tier on repeated failures.
|
|
123
|
+
- **balanced**: Best model per tier, normal budgets, reviews at medium+ risk.
|
|
124
|
+
- **cost-saver**: Prefer cheaper models, lower budgets, skip GPT for non-critical work.
|
|
125
|
+
- **quality-first**: Dual-brain for medium+ risk, higher budgets, stricter reviews.
|
|
126
|
+
|
|
262
127
|
## Requirements
|
|
263
128
|
|
|
264
129
|
- Node 20+
|
|
265
130
|
- Claude Code (any subscription tier)
|
|
266
131
|
- Codex CLI (optional) — `npm i -g @openai/codex && codex login`
|
|
267
|
-
- replit-tools (recommended on Replit) — `npx -y replit-tools` — provides persistent auth, session management, and container survival
|
|
268
132
|
|
|
269
133
|
Works with any subscription combination. Without OpenAI, GPT features gracefully degrade — all work routes through Claude.
|
|
270
|
-
On Replit, replit-tools is strongly recommended — dual-brain's persistent state features depend on it.
|
|
271
|
-
|
|
272
|
-
## Credits
|
|
273
|
-
|
|
274
|
-
Built as an extension of **data-tools** by [Steve Moraco](https://github.com/stevemoraco).
|
|
275
|
-
|
|
276
|
-
data-tools/replit-tools provides the foundation: persistent state across container restarts,
|
|
277
|
-
multi-terminal session management, auto-updating scripts, and SSH key persistence.
|
|
278
|
-
dual-brain adds dual-provider orchestration on top.
|