dual-brain 7.1.14 → 7.1.15

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 CHANGED
@@ -135,3 +135,13 @@ For most tasks, prefer `dual-brain go "..."` — it runs the same detect→decid
135
135
  | `node .claude/hooks/health-check.mjs` | System health |
136
136
  | `node .claude/hooks/test-orchestrator.mjs` | Self-tests (40 tests) |
137
137
  | `node .claude/hooks/vibe-memory.mjs` | Persistent preferences across sessions |
138
+ | `dual-brain search "..."` | Search across all previous sessions |
139
+
140
+ ## Cross-Session Context
141
+
142
+ When the user references past work ("we did this before", "yesterday we worked on", "remember when we", "didn't we already fix"), use the session search to find relevant context:
143
+
144
+ 1. Run `dual-brain search "keyword"` to search the session index
145
+ 2. Or use the MCP tool `dual_brain_search` if available
146
+
147
+ This surfaces previous conversations so HEAD can provide continuity across sessions without the user having to re-explain.
@@ -99,6 +99,34 @@ const TOOLS = [
99
99
  required: ['preference'],
100
100
  },
101
101
  },
102
+ {
103
+ name: 'dual_brain_search',
104
+ description: 'Search across all previous sessions for context. Use this when the user references past work ("we did this before", "yesterday we worked on", "remember when we", "didn\'t we already"). Returns matching sessions with prompts, topics, and files.',
105
+ inputSchema: {
106
+ type: 'object',
107
+ properties: {
108
+ query: {
109
+ type: 'string',
110
+ description: 'Search keywords to find in previous sessions. Can be topic, file name, or description of past work.',
111
+ },
112
+ },
113
+ required: ['query'],
114
+ },
115
+ },
116
+ {
117
+ name: 'dual_brain_session_context',
118
+ description: 'Get detailed context from a specific previous session. Use after dual_brain_search to retrieve details about what happened in a found session.',
119
+ inputSchema: {
120
+ type: 'object',
121
+ properties: {
122
+ sessionId: {
123
+ type: 'string',
124
+ description: 'The session UUID to get context for (from search results).',
125
+ },
126
+ },
127
+ required: ['sessionId'],
128
+ },
129
+ },
102
130
  ];
103
131
 
104
132
  // ─── Tool handlers ────────────────────────────────────────────────────────────
@@ -217,6 +245,34 @@ async function handleRemember({ preference }) {
217
245
  };
218
246
  }
219
247
 
248
+ async function handleSearch({ query }) {
249
+ const { searchSessions, buildSessionIndex } = await import(`${SRC}/session.mjs`);
250
+ const cwd = process.cwd();
251
+ try { buildSessionIndex(cwd); } catch {}
252
+ const results = searchSessions(query, cwd);
253
+ return {
254
+ count: results.length,
255
+ sessions: results.slice(0, 5).map(s => ({
256
+ id: s.id,
257
+ tool: s.tool,
258
+ date: s.date,
259
+ firstPrompt: s.prompts.first,
260
+ lastPrompt: s.prompts.last,
261
+ topics: s.topics.slice(0, 5),
262
+ files: s.files.slice(0, 10),
263
+ messageCount: s.messageCount,
264
+ })),
265
+ };
266
+ }
267
+
268
+ async function handleSessionContext({ sessionId }) {
269
+ const { getSessionContext } = await import(`${SRC}/session.mjs`);
270
+ const cwd = process.cwd();
271
+ const ctx = getSessionContext(sessionId, cwd);
272
+ if (!ctx) return { error: 'Session not found' };
273
+ return ctx;
274
+ }
275
+
220
276
  // ─── JSON-RPC dispatcher ──────────────────────────────────────────────────────
221
277
 
222
278
  async function dispatchTool(name, args) {
@@ -225,6 +281,8 @@ async function dispatchTool(name, args) {
225
281
  case 'dual_brain_decide': return handleDecide(args);
226
282
  case 'dual_brain_status': return handleStatus();
227
283
  case 'dual_brain_remember': return handleRemember(args);
284
+ case 'dual_brain_search': return handleSearch(args);
285
+ case 'dual_brain_session_context': return handleSessionContext(args);
228
286
  default:
229
287
  throw Object.assign(new Error(`Unknown tool: ${name}`), { code: -32601 });
230
288
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dual-brain",
3
- "version": "7.1.14",
3
+ "version": "7.1.15",
4
4
  "description": "AI orchestration across Claude + OpenAI subscriptions — smart routing, budget awareness, and dual-brain collaboration",
5
5
  "type": "module",
6
6
  "bin": {