dual-brain 4.2.0 → 4.5.0
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 +130 -35
- package/README.md +171 -44
- package/hooks/agent-chains.mjs +369 -0
- package/hooks/agent-templates.mjs +441 -0
- package/hooks/atomic-write.mjs +5 -3
- package/hooks/config-validator.mjs +156 -0
- package/hooks/confirmation-policy.mjs +167 -0
- package/hooks/cost-logger.mjs +32 -12
- package/hooks/cost-report.mjs +60 -114
- package/hooks/decision-ledger.mjs +3 -2
- package/hooks/dual-brain-review.mjs +249 -2
- package/hooks/dual-brain-think.mjs +294 -25
- package/hooks/enforce-tier.mjs +246 -87
- package/hooks/error-channel.mjs +68 -0
- package/hooks/failure-detector.mjs +2 -1
- package/hooks/health-check.mjs +16 -17
- package/hooks/risk-classifier.mjs +135 -2
- package/hooks/session-report.mjs +41 -71
- package/hooks/ship-captain.mjs +1176 -0
- package/hooks/ship-gate.mjs +971 -0
- package/hooks/summary-checkpoint.mjs +31 -4
- package/hooks/test-orchestrator.mjs +1975 -11
- package/install.mjs +1064 -31
- package/orchestrator.json +73 -96
- package/package.json +7 -2
package/CLAUDE.md
CHANGED
|
@@ -1,7 +1,33 @@
|
|
|
1
1
|
# Dual-Brain Orchestrator
|
|
2
2
|
|
|
3
|
+
> Extension of data-tools by Steve Moraco. Requires replit-tools for full functionality.
|
|
4
|
+
|
|
3
5
|
This project uses dual-provider orchestration. Config: `.claude/orchestrator.json`.
|
|
4
6
|
|
|
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
|
+
|
|
5
31
|
## Tier Routing
|
|
6
32
|
|
|
7
33
|
Route subagents by task complexity:
|
|
@@ -10,56 +36,96 @@ Route subagents by task complexity:
|
|
|
10
36
|
- **Execute** (`model: "sonnet"`): Edits, tests, git ops. Return: files changed, tests run, edge cases.
|
|
11
37
|
- **Think** (main session, Opus): Architecture, review, planning. Return: decision, alternatives, risks.
|
|
12
38
|
|
|
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
|
+
|
|
13
62
|
## GPT Lane
|
|
14
63
|
|
|
15
64
|
For isolated or parallel work, dispatch to GPT via Codex CLI:
|
|
16
65
|
|
|
17
|
-
- `
|
|
66
|
+
- `npx dual-brain dispatch --task "..." --model gpt-5.4` — execution tasks
|
|
18
67
|
|
|
19
68
|
## Dual-Brain Collaboration
|
|
20
69
|
|
|
21
|
-
|
|
70
|
+
Think and review now auto-complete the full 2-round dialogue by default.
|
|
22
71
|
|
|
23
72
|
**Think flow** (architecture decisions):
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npx dual-brain think --question "should we use Redis?"
|
|
76
|
+
# → GPT Round 1 → Claude analysis → GPT Round 2 → Synthesis
|
|
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>"`
|
|
29
83
|
4. You synthesize both rounds into a final decision
|
|
30
84
|
|
|
31
85
|
**Review flow** (code review):
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npx dual-brain review
|
|
89
|
+
# → GPT Round 1 → Claude review → GPT Round 2 → Final verdict
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Use `--manual` for the old step-by-step flow.
|
|
38
93
|
|
|
39
94
|
## Routing Rules
|
|
40
95
|
|
|
41
96
|
1. Tasks under 3 min → Claude (Codex startup overhead not worth it)
|
|
42
|
-
2. Isolated tasks over 3 min → check balance: `
|
|
43
|
-
3. High-risk decisions → dual-brain think
|
|
97
|
+
2. Isolated tasks over 3 min → check balance: `npx dual-brain budget`
|
|
98
|
+
3. High-risk decisions → dual-brain think (auto-triggered by hooks in auto mode)
|
|
44
99
|
4. When a task spans tiers: think > execute > search
|
|
45
100
|
|
|
46
101
|
## Quality Gate
|
|
47
102
|
|
|
48
103
|
Before ending a session with code changes:
|
|
49
|
-
1. Run `
|
|
50
|
-
2. Run `
|
|
104
|
+
1. Run `npx dual-brain report`
|
|
105
|
+
2. Run `npx dual-brain gate`
|
|
51
106
|
|
|
52
107
|
Gate statuses: `pass` (safe to end), `issues_found` (fix first), `needs_human_review` (GPT unavailable).
|
|
53
108
|
|
|
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
|
+
|
|
54
120
|
## Profiles
|
|
55
121
|
|
|
56
122
|
Active profile controls routing posture, budgets, and quality gate behavior.
|
|
57
123
|
Profile persists to `.claude/dual-brain.profile.json` (gitignored).
|
|
58
124
|
|
|
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
|
|
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. Blocks major tier mismatches.
|
|
126
|
+
- **balanced**: Best model per tier, normal budgets, reviews at medium+ risk. Blocks major mismatches.
|
|
127
|
+
- **cost-saver**: Prefer cheaper models, lower budgets, skip GPT for non-critical. Warns on major mismatches (does not block).
|
|
128
|
+
- **quality-first**: Dual-brain for medium+ risk, higher budgets, stricter reviews. Blocks minor and major mismatches.
|
|
63
129
|
|
|
64
130
|
Switch profiles: `npx dual-brain mode cost-saver`
|
|
65
131
|
Check status: `npx dual-brain status`
|
|
@@ -81,32 +147,61 @@ Casual natural language → structured work. The vibe coding system translates i
|
|
|
81
147
|
|
|
82
148
|
**Intent compiler** — decompose multi-task requests:
|
|
83
149
|
```bash
|
|
84
|
-
|
|
150
|
+
npx dual-brain vibe "fix the login bug and also update the nav"
|
|
85
151
|
```
|
|
86
152
|
Returns structured tasks with tier/risk classification, complexity level, quality gates, and wave strategy.
|
|
87
153
|
|
|
88
154
|
**Plan generator** — Steve-style 3-part markdown plans:
|
|
89
155
|
```bash
|
|
90
|
-
|
|
156
|
+
npx dual-brain plan --utterance "..." [--write]
|
|
91
157
|
```
|
|
92
158
|
Generates: (1) dependency-ordered task table, (2) user stories + edge cases, (3) questions with suggested answers. Pass `--write` to save to `.claude/plans/`.
|
|
93
159
|
|
|
94
160
|
**Durable memory** — preferences persist across sessions:
|
|
95
161
|
```bash
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
162
|
+
npx dual-brain memory # show state
|
|
163
|
+
npx dual-brain memory --set preferences.risk_tolerance=careful
|
|
164
|
+
npx dual-brain memory --threads # active work
|
|
165
|
+
npx dual-brain memory --infer # preference suggestions
|
|
100
166
|
```
|
|
101
167
|
Tracks preferred profile, risk tolerance, active threads, and learns from usage patterns.
|
|
102
168
|
|
|
103
169
|
## Available Tools
|
|
104
170
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
- `
|
|
109
|
-
- `
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
- `
|
|
171
|
+
All commands available via `npx dual-brain <command>`:
|
|
172
|
+
|
|
173
|
+
**Primary workflow:**
|
|
174
|
+
- `npx dual-brain do "..."` — Ship Captain: goal → plan → execute → gate → PR
|
|
175
|
+
- `npx dual-brain resume` — resume last incomplete run
|
|
176
|
+
|
|
177
|
+
**Collaboration:**
|
|
178
|
+
- `npx dual-brain think --question "..."` — dual-brain think (auto 2-round; `--manual` for step-by-step)
|
|
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)
|
package/README.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
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
|
+
|
|
3
8
|
One command. Both brains. Auto-detected. Auto-configured. Default profile: **auto**.
|
|
4
9
|
|
|
5
10
|
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.
|
|
@@ -36,10 +41,10 @@ npx -y dual-brain
|
|
|
36
41
|
|
|
37
42
|
## How it works
|
|
38
43
|
|
|
39
|
-
**Two
|
|
44
|
+
**Two enforcement hooks** are registered in `.claude/settings.json` and fire on each tool use:
|
|
40
45
|
|
|
41
|
-
- **enforce-tier.mjs** (PreToolUse on Agent): Classifies tasks,
|
|
42
|
-
- **cost-logger.mjs** (PostToolUse on all tools): Logs usage to daily rotated files for cost tracking
|
|
46
|
+
- **enforce-tier.mjs** (PreToolUse on Agent): Classifies tasks, assigns the correct model tier, detects duplicates, suggests cross-provider routing. **Blocks severe mismatches** — in auto/balanced/quality-first profiles, major tier mismatches return a hard block rather than a warning.
|
|
47
|
+
- **cost-logger.mjs** (PostToolUse on all tools): Logs usage to daily rotated files for cost tracking.
|
|
43
48
|
|
|
44
49
|
**Three tiers route work by complexity:**
|
|
45
50
|
|
|
@@ -49,7 +54,28 @@ npx -y dual-brain
|
|
|
49
54
|
| Execute | Sonnet | GPT-5.4 | edits, tests, git ops |
|
|
50
55
|
| Think | Opus | GPT-5.5 | architecture, review, planning |
|
|
51
56
|
|
|
52
|
-
**Dual-brain** is
|
|
57
|
+
**Dual-brain** is triggered automatically for high-risk decisions — hooks detect the risk level and initiate dual-brain analysis, where both providers think on the same problem independently. Think and review now run the full 2-round dialogue automatically in one command.
|
|
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
|
|
53
79
|
|
|
54
80
|
## Vibe Coding
|
|
55
81
|
|
|
@@ -57,10 +83,10 @@ Speak naturally. The orchestrator handles the structure.
|
|
|
57
83
|
|
|
58
84
|
```bash
|
|
59
85
|
# Decompose a casual request into structured work
|
|
60
|
-
|
|
86
|
+
npx dual-brain vibe "fix the login bug and also update the nav"
|
|
61
87
|
|
|
62
88
|
# Generate a Steve-style execution plan
|
|
63
|
-
|
|
89
|
+
npx dual-brain plan --utterance "refactor the auth flow" --write
|
|
64
90
|
|
|
65
91
|
# Switch profiles with natural language
|
|
66
92
|
npx dual-brain mode "go aggressive"
|
|
@@ -68,31 +94,97 @@ npx dual-brain mode "be careful"
|
|
|
68
94
|
npx dual-brain mode "cheap"
|
|
69
95
|
|
|
70
96
|
# Check persistent preferences and work threads
|
|
71
|
-
|
|
97
|
+
npx dual-brain memory --threads
|
|
72
98
|
```
|
|
73
99
|
|
|
74
100
|
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.
|
|
75
101
|
|
|
76
|
-
##
|
|
102
|
+
## Automatic Collaboration
|
|
77
103
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
| `hooks/gpt-work-dispatcher.mjs` | Dispatch execution tasks to GPT via Codex CLI |
|
|
89
|
-
| `hooks/session-report.mjs` | Session-end summary: activity, compliance, quality |
|
|
90
|
-
| `hooks/health-check.mjs` | Verify all hooks and dependencies are working |
|
|
91
|
-
| `hooks/test-orchestrator.mjs` | Self-test harness (40 tests) |
|
|
92
|
-
| `hooks/setup-wizard.mjs` | Interactive config (optional — for custom plans) |
|
|
93
|
-
| `hooks/install-git-hooks.mjs` | Git pre-commit hook for quality gate |
|
|
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
|
|
94
114
|
|
|
95
|
-
|
|
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
|
|
96
188
|
|
|
97
189
|
```bash
|
|
98
190
|
npx -y dual-brain # detect, configure, install
|
|
@@ -100,16 +192,9 @@ npx dual-brain --force # overwrite all config
|
|
|
100
192
|
npx dual-brain --dry-run # detect only, don't write
|
|
101
193
|
npx dual-brain --json # output detection as JSON
|
|
102
194
|
npx dual-brain --help # show help
|
|
195
|
+
npx dual-brain --uninstall # remove hooks and clean state
|
|
103
196
|
```
|
|
104
197
|
|
|
105
|
-
## Customize
|
|
106
|
-
|
|
107
|
-
After install, edit these files:
|
|
108
|
-
|
|
109
|
-
- `orchestrator.json` — subscriptions, tiers, quality gate, budgets, routing
|
|
110
|
-
- `review-rules.md` — project-specific rules for GPT code review
|
|
111
|
-
- `settings.json` — hook registrations (auto-generated, safe to extend)
|
|
112
|
-
|
|
113
198
|
## Profiles
|
|
114
199
|
|
|
115
200
|
The active profile controls routing posture, budgets, and quality gate behavior. Default: **auto**.
|
|
@@ -119,33 +204,75 @@ npx dual-brain mode cost-saver # switch profile
|
|
|
119
204
|
npx dual-brain status # check current profile and provider health
|
|
120
205
|
```
|
|
121
206
|
|
|
122
|
-
- **auto** (default): Adapts routing based on task risk, provider health, and outcomes. Auto-escalates tier on repeated failures.
|
|
207
|
+
- **auto** (default): Adapts routing based on task risk, provider health, and outcomes. Auto-escalates tier on repeated failures. Blocks major tier mismatches.
|
|
123
208
|
- **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.
|
|
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.
|
|
126
211
|
|
|
127
212
|
## Troubleshooting
|
|
128
213
|
|
|
129
|
-
**Hooks not firing**
|
|
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.
|
|
130
217
|
|
|
131
|
-
**
|
|
218
|
+
**Auth expired** — Run `claude login` for Claude, `codex login` for OpenAI. Re-run `npx dual-brain` to re-detect.
|
|
132
219
|
|
|
133
|
-
**
|
|
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.
|
|
134
221
|
|
|
135
|
-
**
|
|
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$]`.
|
|
136
223
|
|
|
137
|
-
**
|
|
224
|
+
**Corrupt state / weird behavior** — Run `npx dual-brain repair` for automatic fixes, or `npx dual-brain reset --force` to wipe all state files.
|
|
138
225
|
|
|
139
|
-
**
|
|
226
|
+
**Multiple Claude Code sessions** — State files may have brief write conflicts. Each session tracks independently. Use a single session for best results.
|
|
140
227
|
|
|
141
|
-
**
|
|
228
|
+
**Incomplete run** — Use `npx dual-brain resume` to continue where Ship Captain left off.
|
|
142
229
|
|
|
143
|
-
**Uninstall**
|
|
230
|
+
**Uninstall** — `npx dual-brain --uninstall` removes hooks from settings.json and cleans state files.
|
|
231
|
+
|
|
232
|
+
## Scripts
|
|
233
|
+
|
|
234
|
+
| Script | Purpose |
|
|
235
|
+
|--------|---------|
|
|
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
|
+
| `hooks/vibe-router.mjs` | Decompose casual language into structured work orders |
|
|
240
|
+
| `hooks/plan-generator.mjs` | Generate Steve-style 3-part execution plans |
|
|
241
|
+
| `hooks/vibe-memory.mjs` | Persistent preferences, work threads, preference inference |
|
|
242
|
+
| `hooks/cost-report.mjs` | Activity & cost estimates by model tier |
|
|
243
|
+
| `hooks/dual-brain-review.mjs` | Dual-brain code review (auto 2-round) |
|
|
244
|
+
| `hooks/dual-brain-think.mjs` | Dual-perspective analysis on architecture decisions (auto 2-round) |
|
|
245
|
+
| `hooks/quality-gate.mjs` | Sensitivity-scored quality gate with review artifacts |
|
|
246
|
+
| `hooks/budget-balancer.mjs` | Provider balance and routing recommendations |
|
|
247
|
+
| `hooks/gpt-work-dispatcher.mjs` | Dispatch execution tasks to GPT via Codex CLI |
|
|
248
|
+
| `hooks/session-report.mjs` | Session-end summary: activity, compliance, quality |
|
|
249
|
+
| `hooks/health-check.mjs` | Verify all hooks and dependencies are working |
|
|
250
|
+
| `hooks/test-orchestrator.mjs` | Self-test harness (78 tests) |
|
|
251
|
+
| `hooks/setup-wizard.mjs` | Interactive config (optional — for custom plans) |
|
|
252
|
+
| `hooks/install-git-hooks.mjs` | Git pre-commit hook for quality gate |
|
|
253
|
+
|
|
254
|
+
## Customize
|
|
255
|
+
|
|
256
|
+
After install, edit these files:
|
|
257
|
+
|
|
258
|
+
- `orchestrator.json` — subscriptions, tiers, quality gate, budgets, routing
|
|
259
|
+
- `review-rules.md` — project-specific rules for GPT code review
|
|
260
|
+
- `settings.json` — hook registrations (auto-generated, safe to extend)
|
|
144
261
|
|
|
145
262
|
## Requirements
|
|
146
263
|
|
|
147
264
|
- Node 20+
|
|
148
265
|
- Claude Code (any subscription tier)
|
|
149
266
|
- 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
|
|
150
268
|
|
|
151
269
|
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.
|