dual-brain 0.2.30 → 0.3.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.
Files changed (312) hide show
  1. package/.dual-brain/docs/claude-code-extension-points.md +32 -0
  2. package/.dual-brain/docs/data-tools-capabilities.md +181 -0
  3. package/.dual-brain/docs/ecosystem-tools.md +91 -0
  4. package/.dual-brain/docs/panel-handoff.md +124 -0
  5. package/.dual-brain/docs/ruflo-analysis.md +48 -0
  6. package/bin/dual-brain.mjs +56 -56
  7. package/dist/mcp-server/index.d.ts +27 -0
  8. package/dist/mcp-server/index.js +359 -0
  9. package/dist/mcp-server/index.js.map +1 -0
  10. package/dist/src/agent-protocol.d.ts +163 -0
  11. package/dist/src/agent-protocol.js +368 -0
  12. package/dist/src/agent-protocol.js.map +1 -0
  13. package/dist/src/agents/registry.d.ts +52 -0
  14. package/dist/src/agents/registry.js +393 -0
  15. package/dist/src/agents/registry.js.map +1 -0
  16. package/dist/src/awareness.d.ts +93 -0
  17. package/dist/src/awareness.js +406 -0
  18. package/dist/src/awareness.js.map +1 -0
  19. package/dist/src/brief.d.ts +48 -0
  20. package/dist/src/brief.js +179 -0
  21. package/dist/src/brief.js.map +1 -0
  22. package/dist/src/calibration.d.ts +32 -0
  23. package/dist/src/calibration.js +133 -0
  24. package/dist/src/calibration.js.map +1 -0
  25. package/dist/src/checkpoint.d.ts +33 -0
  26. package/dist/src/checkpoint.js +99 -0
  27. package/dist/src/checkpoint.js.map +1 -0
  28. package/dist/src/ci-triage.d.ts +33 -0
  29. package/dist/src/ci-triage.js +193 -0
  30. package/dist/src/ci-triage.js.map +1 -0
  31. package/dist/src/cognitive-loop.d.ts +56 -0
  32. package/dist/src/cognitive-loop.js +495 -0
  33. package/dist/src/cognitive-loop.js.map +1 -0
  34. package/dist/src/collaboration.d.ts +147 -0
  35. package/dist/src/collaboration.js +438 -0
  36. package/dist/src/collaboration.js.map +1 -0
  37. package/dist/src/context-intel.d.ts +47 -0
  38. package/dist/src/context-intel.js +156 -0
  39. package/dist/src/context-intel.js.map +1 -0
  40. package/dist/src/context.d.ts +53 -0
  41. package/dist/src/context.js +332 -0
  42. package/dist/src/context.js.map +1 -0
  43. package/dist/src/continuity.d.ts +89 -0
  44. package/dist/src/continuity.js +230 -0
  45. package/dist/src/continuity.js.map +1 -0
  46. package/dist/src/cost-tracker.d.ts +47 -0
  47. package/dist/src/cost-tracker.js +170 -0
  48. package/dist/src/cost-tracker.js.map +1 -0
  49. package/dist/src/debrief.d.ts +53 -0
  50. package/dist/src/debrief.js +222 -0
  51. package/dist/src/debrief.js.map +1 -0
  52. package/dist/src/decide.d.ts +96 -0
  53. package/dist/src/decide.js +744 -0
  54. package/dist/src/decide.js.map +1 -0
  55. package/dist/src/decompose.d.ts +39 -0
  56. package/dist/src/decompose.js +218 -0
  57. package/dist/src/decompose.js.map +1 -0
  58. package/dist/src/detect.d.ts +91 -0
  59. package/dist/src/detect.js +544 -0
  60. package/dist/src/detect.js.map +1 -0
  61. package/dist/src/dispatch.d.ts +154 -0
  62. package/dist/src/dispatch.js +1306 -0
  63. package/dist/src/dispatch.js.map +1 -0
  64. package/dist/src/doctor.d.ts +421 -0
  65. package/dist/src/doctor.js +1689 -0
  66. package/dist/src/doctor.js.map +1 -0
  67. package/dist/src/engine.d.ts +70 -0
  68. package/dist/src/engine.js +155 -0
  69. package/dist/src/engine.js.map +1 -0
  70. package/dist/src/envelope.d.ts +36 -0
  71. package/dist/src/envelope.js +80 -0
  72. package/dist/src/envelope.js.map +1 -0
  73. package/dist/src/failure-memory.d.ts +55 -0
  74. package/dist/src/failure-memory.js +175 -0
  75. package/dist/src/failure-memory.js.map +1 -0
  76. package/dist/src/fx.d.ts +87 -0
  77. package/dist/src/fx.js +272 -0
  78. package/dist/src/fx.js.map +1 -0
  79. package/dist/src/governance.d.ts +93 -0
  80. package/dist/src/governance.js +261 -0
  81. package/dist/src/governance.js.map +1 -0
  82. package/dist/src/handoff.d.ts +11 -0
  83. package/dist/src/handoff.js +90 -0
  84. package/dist/src/handoff.js.map +1 -0
  85. package/dist/src/head-protocol.d.ts +76 -0
  86. package/dist/src/head-protocol.js +109 -0
  87. package/dist/src/head-protocol.js.map +1 -0
  88. package/dist/src/head.d.ts +222 -0
  89. package/dist/src/head.js +765 -0
  90. package/dist/src/head.js.map +1 -0
  91. package/dist/src/health.d.ts +132 -0
  92. package/dist/src/health.js +435 -0
  93. package/dist/src/health.js.map +1 -0
  94. package/dist/src/inbox.d.ts +70 -0
  95. package/dist/src/inbox.js +218 -0
  96. package/dist/src/inbox.js.map +1 -0
  97. package/dist/src/index.d.ts +33 -0
  98. package/dist/src/index.js +38 -0
  99. package/dist/src/index.js.map +1 -0
  100. package/dist/src/install-hooks.d.ts +13 -0
  101. package/dist/src/install-hooks.js +88 -0
  102. package/dist/src/install-hooks.js.map +1 -0
  103. package/dist/src/integrity.d.ts +59 -0
  104. package/dist/src/integrity.js +206 -0
  105. package/dist/src/integrity.js.map +1 -0
  106. package/dist/src/intelligence.d.ts +104 -0
  107. package/dist/src/intelligence.js +391 -0
  108. package/dist/src/intelligence.js.map +1 -0
  109. package/dist/src/ledger.d.ts +54 -0
  110. package/dist/src/ledger.js +179 -0
  111. package/dist/src/ledger.js.map +1 -0
  112. package/dist/src/living-docs.d.ts +14 -0
  113. package/dist/src/living-docs.js +197 -0
  114. package/dist/src/living-docs.js.map +1 -0
  115. package/dist/src/memory-tiers.d.ts +37 -0
  116. package/dist/src/memory-tiers.js +160 -0
  117. package/dist/src/memory-tiers.js.map +1 -0
  118. package/dist/src/model-profiles.d.ts +65 -0
  119. package/dist/src/model-profiles.js +568 -0
  120. package/dist/src/model-profiles.js.map +1 -0
  121. package/dist/src/models.d.ts +58 -0
  122. package/dist/src/models.js +327 -0
  123. package/dist/src/models.js.map +1 -0
  124. package/dist/src/narrative.d.ts +54 -0
  125. package/dist/src/narrative.js +163 -0
  126. package/dist/src/narrative.js.map +1 -0
  127. package/dist/src/nextstep.d.ts +16 -0
  128. package/dist/src/nextstep.js +103 -0
  129. package/dist/src/nextstep.js.map +1 -0
  130. package/dist/src/observer.d.ts +18 -0
  131. package/dist/src/observer.js +251 -0
  132. package/dist/src/observer.js.map +1 -0
  133. package/dist/src/outcome.d.ts +110 -0
  134. package/dist/src/outcome.js +377 -0
  135. package/dist/src/outcome.js.map +1 -0
  136. package/dist/src/pipeline.d.ts +167 -0
  137. package/dist/src/pipeline.js +1503 -0
  138. package/dist/src/pipeline.js.map +1 -0
  139. package/dist/src/playbook.d.ts +59 -0
  140. package/dist/src/playbook.js +238 -0
  141. package/dist/src/playbook.js.map +1 -0
  142. package/dist/src/pr-agent.d.ts +97 -0
  143. package/dist/src/pr-agent.js +195 -0
  144. package/dist/src/pr-agent.js.map +1 -0
  145. package/dist/src/predictive.d.ts +57 -0
  146. package/dist/src/predictive.js +230 -0
  147. package/dist/src/predictive.js.map +1 -0
  148. package/dist/src/profile.d.ts +294 -0
  149. package/dist/src/profile.js +1347 -0
  150. package/dist/src/profile.js.map +1 -0
  151. package/dist/src/prompt-audit.d.ts +22 -0
  152. package/dist/src/prompt-audit.js +194 -0
  153. package/dist/src/prompt-audit.js.map +1 -0
  154. package/dist/src/prompt-intel.d.ts +12 -0
  155. package/dist/src/prompt-intel.js +321 -0
  156. package/dist/src/prompt-intel.js.map +1 -0
  157. package/dist/src/provider-context.d.ts +121 -0
  158. package/dist/src/provider-context.js +222 -0
  159. package/dist/src/provider-context.js.map +1 -0
  160. package/dist/src/provider-manager.d.ts +92 -0
  161. package/dist/src/provider-manager.js +428 -0
  162. package/dist/src/provider-manager.js.map +1 -0
  163. package/dist/src/receipt.d.ts +87 -0
  164. package/dist/src/receipt.js +326 -0
  165. package/dist/src/receipt.js.map +1 -0
  166. package/dist/src/recommendations.d.ts +13 -0
  167. package/dist/src/recommendations.js +291 -0
  168. package/dist/src/recommendations.js.map +1 -0
  169. package/dist/src/redact.d.ts +15 -0
  170. package/dist/src/redact.js +129 -0
  171. package/dist/src/redact.js.map +1 -0
  172. package/dist/src/replit.d.ts +397 -0
  173. package/dist/src/replit.js +1160 -0
  174. package/dist/src/replit.js.map +1 -0
  175. package/dist/src/repo.d.ts +149 -0
  176. package/dist/src/repo.js +416 -0
  177. package/dist/src/repo.js.map +1 -0
  178. package/dist/src/revert.d.ts +30 -0
  179. package/dist/src/revert.js +166 -0
  180. package/dist/src/revert.js.map +1 -0
  181. package/dist/src/room.d.ts +102 -0
  182. package/dist/src/room.js +212 -0
  183. package/dist/src/room.js.map +1 -0
  184. package/dist/src/routing-advisor.d.ts +57 -0
  185. package/dist/src/routing-advisor.js +221 -0
  186. package/dist/src/routing-advisor.js.map +1 -0
  187. package/dist/src/self-correct.d.ts +40 -0
  188. package/dist/src/self-correct.js +137 -0
  189. package/dist/src/self-correct.js.map +1 -0
  190. package/dist/src/session-lock.d.ts +35 -0
  191. package/dist/src/session-lock.js +134 -0
  192. package/dist/src/session-lock.js.map +1 -0
  193. package/dist/src/session.d.ts +267 -0
  194. package/dist/src/session.js +1660 -0
  195. package/dist/src/session.js.map +1 -0
  196. package/dist/src/settings-tui.d.ts +5 -0
  197. package/dist/src/settings-tui.js +422 -0
  198. package/dist/src/settings-tui.js.map +1 -0
  199. package/dist/src/setup-flow.d.ts +63 -0
  200. package/dist/src/setup-flow.js +233 -0
  201. package/dist/src/setup-flow.js.map +1 -0
  202. package/dist/src/signal.d.ts +19 -0
  203. package/dist/src/signal.js +122 -0
  204. package/dist/src/signal.js.map +1 -0
  205. package/dist/src/simmer.d.ts +85 -0
  206. package/dist/src/simmer.js +224 -0
  207. package/dist/src/simmer.js.map +1 -0
  208. package/dist/src/state-export.d.ts +129 -0
  209. package/dist/src/state-export.js +233 -0
  210. package/dist/src/state-export.js.map +1 -0
  211. package/dist/src/strategy.d.ts +54 -0
  212. package/dist/src/strategy.js +95 -0
  213. package/dist/src/strategy.js.map +1 -0
  214. package/dist/src/subscription.d.ts +40 -0
  215. package/dist/src/subscription.js +189 -0
  216. package/dist/src/subscription.js.map +1 -0
  217. package/dist/src/templates.d.ts +208 -0
  218. package/dist/src/templates.js +238 -0
  219. package/dist/src/templates.js.map +1 -0
  220. package/dist/src/test.d.ts +9 -0
  221. package/dist/src/test.js +1173 -0
  222. package/dist/src/test.js.map +1 -0
  223. package/dist/src/think-engine.d.ts +67 -0
  224. package/dist/src/think-engine.js +412 -0
  225. package/dist/src/think-engine.js.map +1 -0
  226. package/dist/src/tui.d.ts +71 -0
  227. package/dist/src/tui.js +242 -0
  228. package/dist/src/tui.js.map +1 -0
  229. package/dist/src/types.d.ts +177 -0
  230. package/dist/src/types.js +6 -0
  231. package/dist/src/types.js.map +1 -0
  232. package/dist/src/update-check.d.ts +7 -0
  233. package/dist/src/update-check.js +36 -0
  234. package/dist/src/update-check.js.map +1 -0
  235. package/dist/src/wave-planner.d.ts +30 -0
  236. package/dist/src/wave-planner.js +281 -0
  237. package/dist/src/wave-planner.js.map +1 -0
  238. package/hooks/head-guard.sh +41 -0
  239. package/hooks/precompact.mjs +3 -3
  240. package/hooks/session-end.mjs +3 -3
  241. package/hooks/task-classifier.mjs +328 -0
  242. package/hooks/vibe-router.mjs +387 -0
  243. package/install.mjs +2 -2
  244. package/package.json +29 -153
  245. package/src/agents/registry.mjs +0 -405
  246. package/src/awareness.mjs +0 -425
  247. package/src/brief.mjs +0 -266
  248. package/src/calibration.mjs +0 -148
  249. package/src/checkpoint.mjs +0 -109
  250. package/src/ci-triage.mjs +0 -191
  251. package/src/cognitive-loop.mjs +0 -562
  252. package/src/collaboration.mjs +0 -545
  253. package/src/context-intel.mjs +0 -158
  254. package/src/context.mjs +0 -389
  255. package/src/continuity.mjs +0 -298
  256. package/src/cost-tracker.mjs +0 -184
  257. package/src/debrief.mjs +0 -228
  258. package/src/decide.mjs +0 -1099
  259. package/src/decompose.mjs +0 -331
  260. package/src/detect.mjs +0 -702
  261. package/src/dispatch.mjs +0 -1447
  262. package/src/doctor.mjs +0 -1607
  263. package/src/envelope.mjs +0 -139
  264. package/src/failure-memory.mjs +0 -178
  265. package/src/fx.mjs +0 -276
  266. package/src/governance.mjs +0 -279
  267. package/src/handoff.mjs +0 -87
  268. package/src/head-protocol.mjs +0 -128
  269. package/src/head.mjs +0 -952
  270. package/src/health.mjs +0 -528
  271. package/src/inbox.mjs +0 -195
  272. package/src/index.mjs +0 -44
  273. package/src/install-hooks.mjs +0 -100
  274. package/src/integrity.mjs +0 -245
  275. package/src/intelligence.mjs +0 -447
  276. package/src/ledger.mjs +0 -196
  277. package/src/living-docs.mjs +0 -210
  278. package/src/memory-tiers.mjs +0 -193
  279. package/src/models.mjs +0 -363
  280. package/src/narrative.mjs +0 -169
  281. package/src/nextstep.mjs +0 -100
  282. package/src/observer.mjs +0 -241
  283. package/src/outcome.mjs +0 -400
  284. package/src/pipeline.mjs +0 -1711
  285. package/src/playbook.mjs +0 -257
  286. package/src/pr-agent.mjs +0 -214
  287. package/src/predictive.mjs +0 -250
  288. package/src/profile.mjs +0 -1411
  289. package/src/prompt-audit.mjs +0 -231
  290. package/src/prompt-intel.mjs +0 -325
  291. package/src/provider-context.mjs +0 -257
  292. package/src/receipt.mjs +0 -344
  293. package/src/recommendations.mjs +0 -296
  294. package/src/redact.mjs +0 -192
  295. package/src/replit.mjs +0 -1210
  296. package/src/repo.mjs +0 -445
  297. package/src/revert.mjs +0 -149
  298. package/src/routing-advisor.mjs +0 -204
  299. package/src/self-correct.mjs +0 -147
  300. package/src/session-lock.mjs +0 -160
  301. package/src/session.mjs +0 -1655
  302. package/src/settings-tui.mjs +0 -373
  303. package/src/setup-flow.mjs +0 -223
  304. package/src/signal.mjs +0 -115
  305. package/src/simmer.mjs +0 -241
  306. package/src/strategy.mjs +0 -235
  307. package/src/subscription.mjs +0 -212
  308. package/src/templates.mjs +0 -260
  309. package/src/think-engine.mjs +0 -428
  310. package/src/tui.mjs +0 -276
  311. package/src/update-check.mjs +0 -35
  312. package/src/wave-planner.mjs +0 -294
@@ -0,0 +1,32 @@
1
+ # Claude Code Extension Points (Verified May 2026)
2
+
3
+ **NOTE**: Claude Code does NOT have a plugin system. No manifest, no marketplace, no `.claude-plugin/` format.
4
+
5
+ ## Actual Extension Points
6
+
7
+ | Mechanism | Location | What It Does |
8
+ |-----------|----------|-------------|
9
+ | Hooks | `.claude/settings.json` → hooks | Shell commands at lifecycle events (PreToolUse, PostToolUse, Stop, SessionStart, etc.) |
10
+ | Skills | `.claude/skills/*.md` | Instruction injection when skill is matched |
11
+ | Custom commands | `.claude/commands/*.md` | Become `/project:command-name` slash commands |
12
+ | MCP servers | `.claude/settings.json` → mcpServers | External tool servers |
13
+ | Custom agents | `.claude/agents/*.md` | Subagent definitions |
14
+ | CLAUDE.md | `.claude/CLAUDE.md` | Project instructions loaded every session |
15
+
16
+ ## Distribution Pattern
17
+
18
+ No higher-level abstraction exists. The proven pattern:
19
+
20
+ 1. **npm package** with hook scripts + install CLI
21
+ 2. `npx dual-brain install` merges hooks into settings.json, copies skills/commands/agents
22
+ 3. `npx dual-brain uninstall` reverses the above
23
+ 4. Version the settings merge to avoid clobbering user config
24
+
25
+ Our existing `dual-brain install --global` is already the right approach.
26
+
27
+ ## What We Ship
28
+
29
+ - `~/.claude/hooks/` — 30+ hook scripts (head-guard, enforce-tier, cost-logger, etc.)
30
+ - `~/.claude/settings.json` — hook event bindings
31
+ - `~/.claude/CLAUDE.md` — global instructions
32
+ - npm postinstall wires everything up
@@ -0,0 +1,181 @@
1
+ # DATA Tools (data-remote) — Complete Capability Reference
2
+
3
+ **Package**: data-remote on npm
4
+ **Author**: Steve Moraco (stevemoraco/DATAtools)
5
+ **Version**: 1.2.42
6
+ **Location**: `/home/runner/workspace/.replit-tools/`
7
+ **Last audited**: 2026-05-17
8
+
9
+ ---
10
+
11
+ ## Core Scripts
12
+
13
+ ### 1. setup-claude-code.sh (522 lines)
14
+ Master initialization — runs on every container startup.
15
+
16
+ | Capability | Detail |
17
+ |------------|--------|
18
+ | Auto-update | Checks npm for newer data-remote, self-updates |
19
+ | Symlink management | ~/.claude, ~/.codex, ~/.ssh, ~/.local/share/claude/versions |
20
+ | Binary management | Finds/caches/symlinks Claude Code binary |
21
+ | Persistence sync | Applies config.json to Claude cleanupPeriodDays + Codex max_bytes |
22
+ | Mirror sync | Appends sessions to .session-archive/ (append-only) |
23
+ | OAuth refresh | Proactively refreshes tokens < 2h from expiry |
24
+ | Install fallback | Runs official install.sh if Claude not found |
25
+ | Env exports | CLAUDE_PERSISTENT, CODEX_PERSISTENT, REPLIT_TOOLS, PATH |
26
+
27
+ ### 2. claude-session-manager.sh (792 lines)
28
+ Interactive multi-terminal session picker + state tracker.
29
+
30
+ | Capability | Detail |
31
+ |------------|--------|
32
+ | Terminal ID | Gets TTY/PID to track per-terminal state |
33
+ | Session enumeration | Reads history.jsonl + project JSONL + Codex hierarchy |
34
+ | Recent filtering | configurable window (default 48h), skips system/agent prompts |
35
+ | Terminal state | Per-terminal JSON: last session ID + tool used |
36
+ | Interactive menu | [1-9] quick-pick, [r] full list, [n] new, [c] resume |
37
+ | Running instance count | Counts active claude/codex processes |
38
+ | Aliases | cr, claude-resume, claude-pick, j, k, cm, claude-menu |
39
+
40
+ ### 3. claude-auth-refresh.sh (231 lines)
41
+ OAuth token lifecycle management.
42
+
43
+ | Capability | Detail |
44
+ |------------|--------|
45
+ | Token status | Reads .credentials.json, returns hours remaining |
46
+ | Proactive refresh | Threshold: 2h, calls Anthropic OAuth endpoint |
47
+ | Failure handling | Backup before update, retry cooldown (.auth-refresh-failed marker) |
48
+ | API key support | Detects permanent keys, skips refresh |
49
+ | Commands | --status, --force, --auto |
50
+ | Client ID | 9d1c250a-e61b-44d9-88ed-5944d1962f5e |
51
+
52
+ ---
53
+
54
+ ## Persistence Directories
55
+
56
+ ### .claude-persistent/
57
+ | Path | Contents |
58
+ |------|----------|
59
+ | settings.json | Model config, hooks, cleanup period |
60
+ | .claude.json | OAuth account, telemetry, feature flags, session tracking |
61
+ | .credentials.json | OAuth tokens (access, refresh, expiresAt) |
62
+ | history.jsonl | Global session history (539 events) |
63
+ | sessions/ | Per-process state (PID.json: sessionId, cwd, status) |
64
+ | projects/ | Workspace-specific session JSONL + memory system |
65
+ | file-history/ | Per-session edit snapshots (790 files across 12+ sessions) |
66
+ | tasks/ | Per-session task queue |
67
+ | paste-cache/ | Clipboard cache (88 files, session-scoped) |
68
+ | shell-snapshots/ | Bash state captures (740 files) |
69
+ | session-env/ | Per-session env var snapshots (216 files) |
70
+ | plugins/marketplaces/ | MCP plugins (discord, telegram, github, etc.) |
71
+ | cache/ | Changelog (310KB), GitHub issues metadata |
72
+ | backups/ | Rolling .claude.json backups (5 recent, timestamped) |
73
+ | mcp-needs-auth-cache.json | MCP server auth status (Gmail, Calendar, Drive) |
74
+
75
+ ### .codex-persistent/
76
+ | Path | Contents |
77
+ |------|----------|
78
+ | auth.json | OpenAI/ChatGPT OAuth (Google-based) |
79
+ | config.toml | Trust levels, history persistence, max_bytes |
80
+ | models_cache.json | Cached model list from OpenAI API |
81
+ | sessions/YYYY/MM/DD/ | Hierarchical session JSONL |
82
+ | skills/.system/ | Built-in: imagegen, openai-docs, plugin-creator, skill-creator, skill-installer |
83
+ | cache/codex_apps_tools/ | Plugin ecosystem cache |
84
+ | shell_snapshots/ | Context captures |
85
+ | memories/ | Per-session memory |
86
+
87
+ ### .gh-persistent/
88
+ | Path | Contents |
89
+ |------|----------|
90
+ | config.yml | Protocol: https, aliases: co=pr checkout |
91
+ | hosts.yml | OAuth token for 1xmint, repo+user scoped |
92
+
93
+ ### .npm-persistent/
94
+ | Path | Contents |
95
+ |------|----------|
96
+ | .npmrc | Auth token for npmjs.org (enables publish) |
97
+
98
+ ### .ssh-persistent/
99
+ SSH keys + config, permissions maintained (700/600/644).
100
+
101
+ ### .session-archive/ (Append-Only Mirror)
102
+ ```
103
+ claude/history.jsonl
104
+ claude/projects/-home-runner-workspace/{sessionId}.jsonl
105
+ claude/projects/memory/*.md
106
+ codex/(similar)
107
+ ```
108
+ Files ONLY GROW. Preserves deleted sessions. Synced on every startup.
109
+
110
+ ### .claude-sessions/
111
+ Per-terminal state files ({TERMINAL_ID}.json) for session manager.
112
+
113
+ ### .logs/
114
+ auth-refresh.log (174KB) — timestamped token checks on every startup.
115
+
116
+ ### .claude-versions/
117
+ Binary copies of Claude Code versions. Only latest symlinked.
118
+
119
+ ---
120
+
121
+ ## Configuration
122
+
123
+ ### config.json
124
+ ```json
125
+ {
126
+ "recentWindowHours": 48,
127
+ "persistenceDays": 365250,
128
+ "mirror": { "enabled": true }
129
+ }
130
+ ```
131
+
132
+ ### Hooks Defined (in settings.json)
133
+ | Event | Matcher | Script |
134
+ |-------|---------|--------|
135
+ | PreToolUse | Edit/Write/NotebookEdit/Bash | head-guard.mjs |
136
+ | PreToolUse | Agent | enforce-tier.mjs |
137
+ | PostToolUse | * | cost-logger.mjs |
138
+ | PostToolUse | * | auto-update-wrapper.mjs |
139
+
140
+ ---
141
+
142
+ ## What Dual-Brain Currently Uses
143
+
144
+ | Capability | How |
145
+ |------------|-----|
146
+ | Session persistence | .claude-sessions/*.json tracks active sessions |
147
+ | OAuth auto-refresh | Keeps tokens alive across long agent runs |
148
+ | Multi-terminal sessions | Independent Claude instances per TTY |
149
+ | Credential persistence | Survives container restarts |
150
+ | Auto-update | Self-updates from npm on shell startup |
151
+ | Binary management | Handles Claude symlinks/install/versioning |
152
+ | Codex integration | .codex-persistent/ for GPT-side auth |
153
+ | Mirror config | Append-only session backup |
154
+ | Memory persistence | .claude-persistent/projects/ memory system |
155
+ | Session archiving | .session-archive/ long-term history |
156
+
157
+ ## What Dual-Brain Should Leverage More
158
+
159
+ | Opportunity | Rationale |
160
+ |-------------|-----------|
161
+ | Session manager for Manager agents | Steve's per-terminal tracking → register persistent managers |
162
+ | Mirror for dual-brain debate | mirror.enabled syncs between Claude+Codex → route debate through it |
163
+ | Auth refresh → Provider Manager | Integrate token expiry into health/failover |
164
+ | Terminal tracking → agent hierarchy | HEAD on pts-0, Manager on pts-1 |
165
+ | Shell snapshots → context loading | 740 snapshots = rich context for new agents |
166
+ | File history → undo/revert | 790 edit snapshots = built-in time travel |
167
+ | Append-only archive → audit trail | Compliance/debugging across sessions |
168
+ | Codex skills system | Plugin architecture we could mirror |
169
+
170
+ ## What Dual-Brain Built (Not In DATA Tools)
171
+
172
+ | Module | Why |
173
+ |--------|-----|
174
+ | Room system (room.ts) | File-based inter-agent messaging |
175
+ | Provider Manager (provider-manager.ts) | Cross-provider failover + rate limit tracking |
176
+ | Agent Protocol (agent-protocol.ts) | Typed hierarchy contracts |
177
+ | Model Profiles (model-profiles.ts) | Capability taxonomy for routing |
178
+ | Signal Scoring (signal.ts) | Outcome quality measurement |
179
+ | Routing Advisor (routing-advisor.ts) | EMA-based learned routing |
180
+ | Pipeline (pipeline.ts) | Gated execution with principle checks |
181
+ | Cognitive Loop (cognitive-loop.ts) | Multi-wave parallel agent orchestration |
@@ -0,0 +1,91 @@
1
+ # AI Orchestration Ecosystem — Tool Audit
2
+
3
+ **Audited**: 2026-05-17
4
+ **Purpose**: Tools/packages relevant to dual-brain's multi-provider orchestration
5
+
6
+ ---
7
+
8
+ ## Direct Competitors / Analogs
9
+
10
+ ### Ruflo (formerly claude-flow)
11
+ - **npm**: claude-flow | **GitHub**: ruvnet/ruflo
12
+ - 100+ specialized agents, multi-provider routing (Claude, GPT, Gemini, Cohere, Ollama)
13
+ - SQLite-backed shared memory, swarm coordination
14
+ - 27-hook lifecycle system, MCP server layer
15
+ - **Maturity**: v3.5+, actively developed
16
+ - **Borrow**: Router architecture, hook taxonomy (27 hooks covering full agent lifecycle)
17
+ - **Difference from us**: Heavily opinionated, monolithic. We're lighter, file-based, subscription-only.
18
+
19
+ ### claude-code-flow (INTGworld)
20
+ - Lighter swarm orchestration for Claude Code
21
+ - Code-first, recursive agent cycles
22
+ - Less mature than Ruflo, simpler
23
+ - **Borrow**: Pattern study only
24
+
25
+ ---
26
+
27
+ ## Cost Tracking Tools
28
+
29
+ ### ai-cost-tracker
30
+ - TypeScript/Node.js, SQLite-backed
31
+ - Per-user/per-feature token costs across models
32
+ - Production-ready
33
+ - **Borrow**: SQLite cost schema with per-model pricing tables
34
+
35
+ ### CodeBurn
36
+ - `npm i -g codeburn`
37
+ - Terminal dashboard for Claude Code / Codex cost monitoring
38
+ - **Borrow**: TUI/UX reference for our frontend overhaul
39
+
40
+ ### Tokscale (junhoyeo)
41
+ - Tracks token usage across Claude Code, Codex, Gemini
42
+ - Global leaderboard, contribution graphs
43
+ - **Borrow**: Multi-provider cost comparison patterns
44
+
45
+ ---
46
+
47
+ ## Claude Code Plugin System
48
+
49
+ Claude Code has a formal plugin system:
50
+ - `.claude-plugin/plugin.json` manifests
51
+ - Skills, agents, hooks, MCP servers
52
+ - Curated: awesome-claude-code-plugins (ccplugins)
53
+ - **Action**: Package dual-brain hooks as a `.claude-plugin` for distribution
54
+
55
+ ---
56
+
57
+ ## Multi-Agent Frameworks (learn-from)
58
+
59
+ ### CrewAI
60
+ - Role-based DSL, enterprise observability (2026)
61
+ - Our HEAD/Manager/Supervisor/Worker maps to CrewAI's role model
62
+ - **Borrow**: Role hierarchy patterns, observability approach
63
+
64
+ ### AutoGen/AG2
65
+ - Event-driven, async-first since v1.0 GA
66
+ - Microsoft shifting to maintenance mode — caution
67
+ - **Borrow**: Event-driven patterns only
68
+
69
+ ### LangGraph v0.4
70
+ - State persistence and checkpointing
71
+ - State machine approach mirrors our head.ts
72
+ - **Borrow**: State machine persistence patterns for HEAD brain
73
+
74
+ ---
75
+
76
+ ## Replit-Specific
77
+
78
+ ### @replit/database
79
+ - Official KV store for Replit
80
+ - Simple persistence, no relational queries
81
+ - **Note**: data-remote may be unpublished/internal npm package
82
+
83
+ ---
84
+
85
+ ## Priority Actions
86
+
87
+ 1. Study Ruflo's 27-hook taxonomy — see if we're missing lifecycle hooks
88
+ 2. Look at ai-cost-tracker's SQLite schema — could replace our JSON cost tracking
89
+ 3. Package as Claude Code plugin — distribution path for non-Replit users
90
+ 4. Study CodeBurn's TUI — UX reference for our frontend overhaul
91
+ 5. LangGraph state persistence — validate our HEAD state machine approach
@@ -0,0 +1,124 @@
1
+ # Dual-Brain Panel Handoff — For HeyVera Session
2
+
3
+ ## What This Is
4
+
5
+ Dual-brain is an AI orchestration CLI that routes between Claude and GPT. It writes its state to JSON files that an external web panel can consume. This doc tells you how to build that panel.
6
+
7
+ ## Your Task
8
+
9
+ 1. Find the existing "Pulse" panel (X.com marketing agent dashboard)
10
+ 2. Make TWO copies:
11
+ - **Copy A**: Social marketing panel → integrate into heyvera.org (DO LATER, just copy it clean for now)
12
+ - **Copy B**: Strip all X.com/marketing code → rebuild as dual-brain orchestration portal
13
+ 3. Copy B becomes a page on heyvera.org
14
+
15
+ ## Data Contract
16
+
17
+ Dual-brain writes JSON files to `.dual-brain/state/`. The panel reads these.
18
+
19
+ ### File: `providers.json`
20
+ ```typescript
21
+ interface ProvidersState {
22
+ timestamp: string;
23
+ providers: Record<string, {
24
+ score: number; // 0-1 health score
25
+ cooldownUntil?: number; // unix ms, if rate-limited
26
+ lastError?: string;
27
+ degraded?: boolean;
28
+ dispatchCount: number;
29
+ }>;
30
+ }
31
+ ```
32
+
33
+ ### File: `routing.json`
34
+ ```typescript
35
+ interface RoutingState {
36
+ timestamp: string;
37
+ totalObservations: number;
38
+ cells: Record<string, Record<string, {
39
+ ema: number; // 0-1 performance score
40
+ observations: number;
41
+ }>>;
42
+ topPerformers: Array<{ cell: string; model: string; ema: number; observations: number }>;
43
+ worstPerformers: Array<{ cell: string; model: string; ema: number; observations: number }>;
44
+ }
45
+ ```
46
+
47
+ ### File: `rooms.json`
48
+ ```typescript
49
+ interface RoomsState {
50
+ timestamp: string;
51
+ rooms: Array<{
52
+ id: string;
53
+ project: string;
54
+ status: 'active' | 'closed';
55
+ createdAt: string;
56
+ workerCount: number;
57
+ }>;
58
+ }
59
+ ```
60
+
61
+ ### File: `decisions.json` (ring buffer, max 50)
62
+ ```typescript
63
+ interface Decision {
64
+ timestamp: string;
65
+ promptSummary: string; // first 100 chars
66
+ provider: string;
67
+ model: string;
68
+ tier: string;
69
+ reason: string;
70
+ explored: boolean; // was this an exploration pick?
71
+ }
72
+ ```
73
+
74
+ ### File: `outcomes.json` (ring buffer, max 200)
75
+ ```typescript
76
+ interface Outcome {
77
+ timestamp: string;
78
+ roomId: string;
79
+ success: boolean;
80
+ score: number; // 0-1 composite quality
81
+ durationMs: number;
82
+ provider: string;
83
+ model: string;
84
+ }
85
+ ```
86
+
87
+ ### File: `costs.json`
88
+ ```typescript
89
+ interface CostsState {
90
+ timestamp: string;
91
+ session: {
92
+ totalTokens: number;
93
+ inputTokens: number;
94
+ outputTokens: number;
95
+ estimatedCostUsd: number;
96
+ };
97
+ byProvider: Record<string, {
98
+ tokens: number;
99
+ estimatedCostUsd: number;
100
+ }>;
101
+ }
102
+ ```
103
+
104
+ ## What the Panel Should Show
105
+
106
+ ### Dashboard View (Copy B — Orchestration Portal)
107
+ 1. **Provider Health** — two cards (Claude / GPT), each showing health score, cooldown status, dispatch count
108
+ 2. **Routing Intelligence** — which model is winning for which task type (EMA scores), exploration rate
109
+ 3. **Live Feed** — scrolling list of recent decisions and outcomes
110
+ 4. **Cost Gauge** — session cost, per-provider breakdown
111
+ 5. **Active Rooms** — current agent tasks in flight
112
+ 6. **Performance Chart** — outcome scores over time
113
+
114
+ ### Future: Voice Input
115
+ The panel will eventually accept voice input (browser Speech API), transcribe it, and send it to dual-brain's HEAD. For now, just build the read-only dashboard.
116
+
117
+ ### Future: Multi-Repo View
118
+ The panel will show multiple repos with a manager-per-repo. Each repo card shows its active manager, workers, and costs.
119
+
120
+ ## Tech Notes
121
+ - Poll the JSON files every 2-5 seconds (they're small)
122
+ - Or use `fs.watch` if same machine
123
+ - All files use atomic writes (write .tmp then rename) so reads never get partial data
124
+ - The `getExportedState()` function in dual-brain returns all state as one object if you want an API instead of file polling
@@ -0,0 +1,48 @@
1
+ # Ruflo (claude-flow) — Competitive Analysis
2
+
3
+ **Audited**: 2026-05-17
4
+ **Package**: claude-flow on npm, ruvnet/ruflo on GitHub
5
+ **Version**: v3.5+
6
+
7
+ ---
8
+
9
+ ## Reality vs Marketing
10
+
11
+ | Claim | Reality |
12
+ |-------|---------|
13
+ | "27 hooks" | 8 Claude Code lifecycle events with multiple matchers. All exit 0, never block. |
14
+ | "210 MCP tools" | Real MCP layer, but tool count inflated. Express proxy to stdio backends. |
15
+ | "Vector DB / HNSW" | JSON files with a Map. Vector features may be in npm binary, not open source. |
16
+ | "Intelligent routing" | Regex pattern matcher. Static confidence (0.8 match, 0.5 default). No learning. |
17
+
18
+ ## Where We're Ahead
19
+
20
+ | Area | Ruflo | Dual-Brain |
21
+ |------|-------|------------|
22
+ | Routing | Static regex → hardcoded agent maps | EMA-based learned routing with exploration |
23
+ | Hook enforcement | All `|| true`, never block | head-guard blocks HEAD from implementing |
24
+ | Type safety | Markdown agents, no runtime validation | TypeScript contracts, typed protocols |
25
+ | Architecture honesty | Marketing > codebase | What we claim = what we ship |
26
+
27
+ ## Where Ruflo's Ahead
28
+
29
+ | Area | What They Have | What We Should Build |
30
+ |------|---------------|---------------------|
31
+ | MCP server | Orchestration exposed as MCP tools — any Claude Code session can use it | Yes — expose routing/dispatch/status as MCP tools |
32
+ | Plugin format | `.claude-plugin/plugin.json` manifest with agents/commands/skills/scripts | Study as model for future extension system |
33
+ | Session lifecycle | Automatic save/restore with clean start/end | Improve our session.ts persistence |
34
+
35
+ ## Their Architecture
36
+
37
+ - **Router**: `router.cjs` — regex keyword-to-agent maps ("implement|create|build" → coder)
38
+ - **Agent comms**: File-based mailbox via bash scripts (`.claude-flow/swarm/queue/`, `.claude-flow/swarm/mailbox/{agent}/`)
39
+ - **Memory**: Flat JSON files (memory.json, auto-memory-store.json, ranked-context.json)
40
+ - **MCP bridge**: Express server proxying to stdio backends
41
+ - **Plugins**: 32 plugins in `plugins/ruflo-*`, each with manifest + agents + commands
42
+
43
+ ## Action Items
44
+
45
+ 1. **Build MCP server layer** — expose dual-brain orchestration as MCP tools (highest value)
46
+ 2. **Study their plugin manifest** — good pattern for extension packaging
47
+ 3. **Don't copy their routing** — ours is fundamentally better (learned vs static)
48
+ 4. **Don't copy their hooks** — ours actually enforce boundaries, theirs are cosmetic