monomind 2.1.8 → 2.1.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monomind",
3
- "version": "2.1.8",
3
+ "version": "2.1.9",
4
4
  "description": "Open-source CLI extension for Claude Code. Adds an MCP server with a codebase knowledge graph, persistent memory, multi-agent coordination, and reusable slash commands. MIT licensed, runs locally, no data leaves your machine.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -393,8 +393,49 @@ async function handleSubagentStop(hookInput) {
393
393
  // remaining event that carries a genuine failure signal, since post-task
394
394
  // (TeammateIdle/TaskCompleted) is dead code (those aren't valid Claude
395
395
  // Code hook events and are stripped from settings.json on init).
396
+ const _subagentSuccess = deriveSubagentSuccess(summary, lastToolError);
396
397
  try {
397
- require('../intelligence.cjs').feedback(deriveSubagentSuccess(summary, lastToolError));
398
+ require('../intelligence.cjs').feedback(_subagentSuccess);
399
+ } catch (e) { /* non-fatal — feedback recording must never block subagent-stop */ }
400
+
401
+ // ── Routing Feedback Loop (per-subagent) ──────────────────────────────
402
+ // session-handler.cjs's SessionEnd writes one routing-feedback.jsonl entry
403
+ // per SESSION — but a session that never ends (e.g. a long-running
404
+ // `monomind org run` daemon session, observed running 2+ days without a
405
+ // SessionEnd in production) never contributes any entry at all, even
406
+ // though real subagent activity (and real success/failure signal) is
407
+ // happening continuously inside it. SubagentStop fires independently of
408
+ // session boundaries, so writing a routing-feedback entry HERE — one per
409
+ // actual routing decision (this subagent spawn), not one per session —
410
+ // keeps the "Routing Learning" signal live regardless of session length,
411
+ // instead of it going silently stale for anyone running persistent orgs.
412
+ try {
413
+ var _agentSlug = String(agentType || '').trim().toLowerCase().replace(/\s+/g, '-');
414
+ if (_agentSlug && _agentSlug !== 'ai-selecting' && _agentSlug !== 'unknown') {
415
+ var _rfEntry = {
416
+ timestamp: new Date().toISOString(),
417
+ suggestedAgent: _agentSlug,
418
+ sessionId: String(session || snap.session || hookInput.sessionId || hookInput.session_id || '').slice(0, 128),
419
+ intelligenceFeedback: _subagentSuccess,
420
+ };
421
+ // Best-effort confidence from the routing decision that led to this
422
+ // spawn — may not correspond exactly to THIS subagent if another
423
+ // routing decision overwrote last-route.json in between (same
424
+ // imprecision session-handler.cjs's session-level entries already had).
425
+ try {
426
+ var _lastRoutePath = path.join(CWD, '.monomind', 'last-route.json');
427
+ var _MAX_ROUTE = 64 * 1024;
428
+ if (fs.existsSync(_lastRoutePath) && fs.statSync(_lastRoutePath).size <= _MAX_ROUTE) {
429
+ var _lastRoute = JSON.parse(fs.readFileSync(_lastRoutePath, 'utf-8'));
430
+ if (typeof _lastRoute.confidence === 'number') _rfEntry.confidence = _lastRoute.confidence;
431
+ }
432
+ } catch (_) {}
433
+ appendJsonlWithRotation(
434
+ path.join(CWD, '.monomind', 'routing-feedback.jsonl'),
435
+ JSON.stringify(_rfEntry),
436
+ 1000
437
+ );
438
+ }
398
439
  } catch (e) { /* non-fatal — feedback recording must never block subagent-stop */ }
399
440
 
400
441
  if (!org && !session) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monoes/monomindcli",
3
- "version": "2.1.8",
3
+ "version": "2.1.9",
4
4
  "type": "module",
5
5
  "description": "CLI engine for Monomind — an open-source MCP server that extends Claude Code with a codebase knowledge graph (tree-sitter + SQLite), persistent memory, multi-agent task coordination, and session hooks. MIT licensed, fully local.",
6
6
  "main": "dist/src/index.js",