superlocalmemory 4.0.7 → 4.0.8

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 (53) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/README.md +3 -3
  3. package/package.json +1 -1
  4. package/plugin/.claude-plugin/plugin.json +1 -1
  5. package/plugin/CLAUDE.md +3 -3
  6. package/plugin/agents/slm-governance-advisor.md +1 -1
  7. package/plugin/agents/slm-loop-runner.md +1 -1
  8. package/plugin/agents/slm-memory-advisor.md +1 -1
  9. package/plugin/agents/slm-optimize-advisor.md +1 -1
  10. package/plugin/requirements.txt +1 -1
  11. package/plugin/skills/slm-cache/SKILL.md +1 -1
  12. package/plugin/skills/slm-compress/SKILL.md +1 -1
  13. package/plugin/skills/slm-governance/SKILL.md +1 -1
  14. package/plugin/skills/slm-graph/SKILL.md +1 -1
  15. package/plugin/skills/slm-loop/SKILL.md +1 -1
  16. package/plugin/skills/slm-mesh/SKILL.md +1 -1
  17. package/plugin/skills/slm-profile/SKILL.md +1 -1
  18. package/plugin/skills/slm-recall/SKILL.md +1 -1
  19. package/plugin/skills/slm-remember/SKILL.md +1 -1
  20. package/plugin/skills/slm-scope/SKILL.md +1 -1
  21. package/plugin/skills/slm-session/SKILL.md +1 -1
  22. package/plugin/skills/slm-status/SKILL.md +1 -1
  23. package/plugin-src/rules/AGENTS.md +1 -1
  24. package/pyproject.toml +1 -1
  25. package/src/superlocalmemory/__init__.py +1 -1
  26. package/src/superlocalmemory/cli/summary_cmd.py +23 -3
  27. package/src/superlocalmemory/code_graph/bridge/maintenance.py +7 -1
  28. package/src/superlocalmemory/core/consolidation_engine.py +14 -15
  29. package/src/superlocalmemory/core/recall_worker.py +4 -0
  30. package/src/superlocalmemory/evolution/skill_evolver.py +16 -1
  31. package/src/superlocalmemory/hooks/hook_handlers.py +38 -11
  32. package/src/superlocalmemory/learning/pattern_miner.py +12 -7
  33. package/src/superlocalmemory/mcp/profiles.py +10 -3
  34. package/src/superlocalmemory/mcp/server.py +7 -0
  35. package/src/superlocalmemory/mcp/tools_summaries.py +147 -0
  36. package/src/superlocalmemory/server/consolidation_runner.py +140 -0
  37. package/src/superlocalmemory/server/recall_serializer.py +34 -2
  38. package/src/superlocalmemory/server/routes/agents.py +52 -8
  39. package/src/superlocalmemory/server/routes/brain.py +108 -0
  40. package/src/superlocalmemory/server/routes/memories.py +153 -0
  41. package/src/superlocalmemory/server/routes/v3_api.py +24 -46
  42. package/src/superlocalmemory/server/unified_daemon.py +107 -0
  43. package/src/superlocalmemory/summaries/base.py +159 -0
  44. package/src/superlocalmemory/summaries/daily_reflection.py +55 -8
  45. package/src/superlocalmemory/summaries/project_work_log.py +23 -7
  46. package/src/superlocalmemory/summaries/session_summary.py +9 -5
  47. package/src/superlocalmemory/ui/index.html +9 -3
  48. package/src/superlocalmemory/ui/js/od-boundedloops.js +324 -0
  49. package/src/superlocalmemory/ui/js/od-memories.js +337 -12
  50. package/src/superlocalmemory/ui/js/od-mesh.js +97 -5
  51. package/src/superlocalmemory/ui/js/od-operations.js +1 -150
  52. package/src/superlocalmemory/ui/js/od-optimize.js +36 -9
  53. package/src/superlocalmemory/ui/js/od-shell.js +10 -0
@@ -95,7 +95,6 @@
95
95
  '<button class="tab" data-od-tab="access">Access &amp; Users</button>' +
96
96
  '<button class="tab" data-od-tab="trust">Trust</button>' +
97
97
  '<button class="tab" data-od-tab="compliance">Compliance</button>' +
98
- '<button class="tab" data-od-tab="loops">Bounded Loops</button>' +
99
98
  // Ingestion tab — restored: re-mounts #ingestion-overview + #ingestion-adapters
100
99
  // so ng-ingestion.js (loaded in index.html) can populate them on call.
101
100
  '<button class="tab" data-od-tab="ingestion">Ingestion</button>' +
@@ -203,155 +202,6 @@
203
202
  '</div>' +
204
203
  '</section>' +
205
204
 
206
- // ══════ BOUNDED LOOPS TAB ════════════════════════════════════════
207
- // Static info card — no backend calls.
208
- // A bounded loop advances only when an INDEPENDENT gate passes, not
209
- // when the agent claims success. Laps are persisted as SLM memory
210
- // (tag loop:<name>) so the full run history is queryable.
211
- '<section class="tabpane" data-od-pane="loops">' +
212
-
213
- '<div class="page-head" style="margin-bottom:16px">' +
214
- '<h2 style="font-size:20px;margin-bottom:6px">Bounded Loops</h2>' +
215
- '<p style="font-size:13.5px">An iteration control pattern for agentic ' +
216
- 'frameworks &mdash; the loop advances only when an <strong>independent ' +
217
- 'gate</strong> passes, not when the agent claims success. Prevents ' +
218
- 'rationalisation: the model cannot self-certify completion.</p>' +
219
- '</div>' +
220
-
221
- // Two-column: concept + CLI reference
222
- '<div class="grid" style="grid-template-columns:1fr 1fr;align-items:start;margin-bottom:16px">' +
223
-
224
- '<div class="card">' +
225
- '<div class="card-head"><h3>How it works</h3></div>' +
226
- '<div class="card-pad">' +
227
- '<p style="font-size:13px;line-height:1.6;margin-bottom:12px">' +
228
- 'Standard agentic loops let the model declare itself done &mdash; ' +
229
- 'a known failure mode when the model rationalises instead of verifying. ' +
230
- 'A bounded loop separates <em>execution</em> (the agent) from ' +
231
- '<em>verification</em> (an independent gate such as a test suite, ' +
232
- 'linter, or judge LLM).' +
233
- '</p>' +
234
- '<p style="font-size:13px;line-height:1.6;margin-bottom:12px">' +
235
- 'The loop terminates only when the gate returns <code>DONE</code>, ' +
236
- 'or when a hard lap cap is reached (<code>HALT</code>). Each lap is ' +
237
- 'persisted as a queryable SLM memory tagged ' +
238
- '<code>loop:&lt;name&gt;</code>.' +
239
- '</p>' +
240
- '<div style="background:var(--card-2);border-radius:var(--r-md);' +
241
- 'padding:10px 14px;font-size:12.5px;line-height:1.7">' +
242
- '<div><span class="badge ok" style="margin-right:8px">DONE</span>' +
243
- 'Gate passed &mdash; loop succeeded cleanly</div>' +
244
- '<div style="margin-top:6px"><span class="badge warn" style="margin-right:8px">HALT</span>' +
245
- 'Lap cap reached &mdash; hard stop applied</div>' +
246
- '<div style="margin-top:6px"><span class="badge cyan" style="margin-right:8px">PAUSE</span>' +
247
- 'Awaiting external input or approval</div>' +
248
- '<div style="margin-top:6px"><span class="badge danger" style="margin-right:8px">KILLED</span>' +
249
- 'Manually stopped by the operator</div>' +
250
- '<div style="margin-top:6px"><span class="badge neutral" style="margin-right:8px">ERROR</span>' +
251
- 'Unrecoverable failure during a lap</div>' +
252
- '</div>' +
253
- '</div>' +
254
- '</div>' +
255
-
256
- '<div class="card">' +
257
- '<div class="card-head"><h3>Run it: CLI &middot; command &middot; MCP</h3></div>' +
258
- '<div class="card-pad">' +
259
- '<p style="font-size:13px;margin-bottom:14px">' +
260
- 'Bounded loops ship on three surfaces &mdash; the same engine and ' +
261
- 'the same queryable ledger behind each.' +
262
- '</p>' +
263
-
264
- '<div style="font-size:12px;font-weight:600;color:var(--fg-2);margin-bottom:6px">CLI</div>' +
265
- '<div style="display:flex;flex-direction:column;gap:8px;margin-bottom:14px">' +
266
- '<div class="list-row">' +
267
- '<span class="mono" style="min-width:190px;font-size:13px">slm loop demo</span>' +
268
- '<span style="font-size:12.5px;color:var(--fg-2)">Run a live demo bounded loop</span>' +
269
- '</div>' +
270
- '<div class="list-row">' +
271
- '<span class="mono" style="min-width:190px;font-size:13px">slm loop history</span>' +
272
- '<span style="font-size:12.5px;color:var(--fg-2)">List loop runs for this profile</span>' +
273
- '</div>' +
274
- '<div class="list-row">' +
275
- '<span class="mono" style="min-width:190px;font-size:13px">slm loop show &lt;run_id&gt;</span>' +
276
- '<span style="font-size:12.5px;color:var(--fg-2)">Inspect a run lap-by-lap</span>' +
277
- '</div>' +
278
- '</div>' +
279
-
280
- '<div style="font-size:12px;font-weight:600;color:var(--fg-2);margin-bottom:6px">Command (Claude Code / Codex)</div>' +
281
- '<div style="display:flex;flex-direction:column;gap:8px;margin-bottom:14px">' +
282
- '<div class="list-row">' +
283
- '<span class="mono" style="min-width:190px;font-size:13px">/slm-loop</span>' +
284
- '<span style="font-size:12.5px;color:var(--fg-2)">Slash command bound to the slm-loop skill + runner agent</span>' +
285
- '</div>' +
286
- '</div>' +
287
-
288
- '<div style="font-size:12px;font-weight:600;color:var(--fg-2);margin-bottom:6px">MCP tools (code / full / power profiles)</div>' +
289
- '<div style="display:flex;flex-direction:column;gap:8px">' +
290
- '<div class="list-row">' +
291
- '<span class="mono" style="min-width:190px;font-size:13px">slm_loop_run</span>' +
292
- '<span style="font-size:12.5px;color:var(--fg-2)">Run a gated loop &mdash; the gate is an independent SLM recall</span>' +
293
- '</div>' +
294
- '<div class="list-row">' +
295
- '<span class="mono" style="min-width:190px;font-size:13px">slm_loop_history</span>' +
296
- '<span style="font-size:12.5px;color:var(--fg-2)">List runs (read-only)</span>' +
297
- '</div>' +
298
- '<div class="list-row">' +
299
- '<span class="mono" style="min-width:190px;font-size:13px">slm_loop_show</span>' +
300
- '<span style="font-size:12.5px;color:var(--fg-2)">Show a run lap-by-lap (read-only)</span>' +
301
- '</div>' +
302
- '</div>' +
303
- '<div style="margin-top:18px;padding:10px 14px;background:var(--card-2);' +
304
- 'border-radius:var(--r-md);font-size:12.5px;line-height:1.6">' +
305
- '<b>Memory tagging:</b> each lap is stored with tag ' +
306
- '<code>loop:&lt;name&gt;</code>. Recall the full history with ' +
307
- '<br><code>slm recall --tag loop:my-loop-name</code>' +
308
- '</div>' +
309
- '</div>' +
310
- '</div>' +
311
-
312
- '</div>' + // end two-column grid
313
-
314
- // Framework adapters note
315
- '<div class="card">' +
316
- '<div class="card-head"><h3>Framework adapters</h3></div>' +
317
- '<div class="card-pad">' +
318
- '<p style="font-size:13px;line-height:1.6;margin-bottom:14px">' +
319
- 'Bounded loops integrate with any agentic framework that supports ' +
320
- 'tool-call round-trips. The gate is an ordinary SLM memory check &mdash; ' +
321
- 'no special framework wiring required. Each framework stamps ' +
322
- '<code>SLM_AGENT_ID</code> so lap history is attribution-aware.' +
323
- '</p>' +
324
- '<div style="display:flex;flex-wrap:wrap;gap:8px">' +
325
- '<span style="padding:4px 12px;border-radius:99px;font-size:12px;' +
326
- 'background:var(--card-2);color:var(--fg-2)">CrewAI</span>' +
327
- '<span style="padding:4px 12px;border-radius:99px;font-size:12px;' +
328
- 'background:var(--card-2);color:var(--fg-2)">LangChain</span>' +
329
- '<span style="padding:4px 12px;border-radius:99px;font-size:12px;' +
330
- 'background:var(--card-2);color:var(--fg-2)">LangGraph</span>' +
331
- '<span style="padding:4px 12px;border-radius:99px;font-size:12px;' +
332
- 'background:var(--card-2);color:var(--fg-2)">Semantic Kernel</span>' +
333
- '<span style="padding:4px 12px;border-radius:99px;font-size:12px;' +
334
- 'background:var(--card-2);color:var(--fg-2)">LlamaIndex</span>' +
335
- '<span style="padding:4px 12px;border-radius:99px;font-size:12px;' +
336
- 'background:var(--card-2);color:var(--fg-2)">Microsoft Agent Framework</span>' +
337
- '<span style="padding:4px 12px;border-radius:99px;font-size:12px;' +
338
- 'background:var(--card-2);color:var(--fg-2)">AutoGen</span>' +
339
- '<span style="padding:4px 12px;border-radius:99px;font-size:12px;' +
340
- 'background:var(--card-2);color:var(--fg-2)">Google ADK</span>' +
341
- '<span style="padding:4px 12px;border-radius:99px;font-size:12px;' +
342
- 'background:var(--card-2);color:var(--fg-2)">OpenAI Agents</span>' +
343
- '<span style="padding:4px 12px;border-radius:99px;font-size:12px;' +
344
- 'background:var(--card-2);color:var(--fg-2)">Any MCP-compatible agent</span>' +
345
- '</div>' +
346
- '<p style="margin-top:12px;font-size:12.5px;color:var(--fg-2)">' +
347
- 'Learn the full pattern: run <code>/slm-loop</code> (the slm-loop skill) ' +
348
- 'inside Claude Code for an interactive walkthrough with live examples.' +
349
- '</p>' +
350
- '</div>' +
351
- '</div>' +
352
-
353
- '</section>' +
354
-
355
205
  // ══════ COMPLIANCE TAB ════════════════════════════════════════════
356
206
  '<section class="tabpane" data-od-pane="compliance">' +
357
207
 
@@ -494,6 +344,7 @@
494
344
  });
495
345
  }
496
346
 
347
+
497
348
  // ─── Lifecycle ────────────────────────────────────────────────────────────
498
349
  /**
499
350
  * Populate the lifecycle KPI strip.
@@ -195,6 +195,18 @@
195
195
  '</button>' +
196
196
  '</div>' +
197
197
 
198
+ // Shown only while every counter is zero — see renderSavings(). Without
199
+ // it, "enabled" toggles above four zeros reads as a broken feature
200
+ // rather than an unused one.
201
+ '<div id="od-opt-unused-note" style="display:none;margin-bottom:14px;' +
202
+ 'padding:12px 14px;border:1px dashed var(--border);border-radius:var(--r-md);' +
203
+ 'font-size:13px;color:var(--fg-2);line-height:1.6">' +
204
+ '<strong style="color:var(--fg)">Enabled, but nothing has used it yet.</strong> ' +
205
+ 'Caching and compression are opt-in: your AI assistant has to ask for ' +
206
+ 'them. Turning them on here does not make savings happen by itself — ' +
207
+ 'the numbers below stay at zero until an assistant calls them.' +
208
+ '</div>' +
209
+
198
210
  // KPI strip — 4 cards using .kpi-strip + .card.kpi classes
199
211
  '<section class="kpi-strip" style="margin-bottom:16px">' +
200
212
 
@@ -204,7 +216,11 @@
204
216
  '<span data-ic="bolt"></span> Tokens saved' +
205
217
  '</div>' +
206
218
  '<div class="value num" id="od-opt-tokens-saved">—</div>' +
207
- '<div class="delta up" id="od-opt-tokens-delta">▲ this month</div>' +
219
+ // Was a hardcoded " this month" delta — an upward trend indicator
220
+ // that no code ever set from data, on a counter that is cumulative
221
+ // since install and not monthly at all. Both halves of that label
222
+ // were wrong. State what the number actually is.
223
+ '<div class="delta" id="od-opt-tokens-delta">since install</div>' +
208
224
  '</div>' +
209
225
 
210
226
  // Cache hit rate + sparkline
@@ -420,15 +436,26 @@
420
436
  setText('od-opt-usd-saved', fmtUSD(data.cost_saved && data.cost_saved.usd));
421
437
  setText('od-opt-inr-saved', fmtINR(data.cost_saved && data.cost_saved.inr));
422
438
 
423
- // Hit-rate sparkline
439
+ // The hit-rate sparkline used to be drawn from
440
+ // [rate*0.7, rate*0.78, rate*0.83, rate*0.88, rate*0.93, rate]
441
+ // — six points invented by scaling the CURRENT value, rendering a tidy
442
+ // upward trend that no measurement supports. There is no history to plot:
443
+ // llmcache_metrics is a single cumulative row (id=1) and nothing anywhere
444
+ // stores a time series. A chart that fabricates its own past is worse than
445
+ // no chart, especially in a product that asks users to trust its numbers.
446
+ //
447
+ // Removed rather than replaced. When a real series exists, plot that.
424
448
  var sparkEl = document.getElementById('od-opt-hit-rate-spark');
425
- if (sparkEl && typeof window.slmSpark === 'function') {
426
- var rate = (data.hit_rate || 0) * 100;
427
- var pts = [
428
- Math.round(rate * 0.7), Math.round(rate * 0.78), Math.round(rate * 0.83),
429
- Math.round(rate * 0.88), Math.round(rate * 0.93), Math.round(rate)
430
- ];
431
- sparkEl.innerHTML = window.slmSpark(pts, { color: 'var(--cyan)', w: 96, h: 34 });
449
+ if (sparkEl) sparkEl.innerHTML = '';
450
+
451
+ // Everything reads zero while the toggles read ON, which looks broken. It
452
+ // is not: caching and compression are opt-in tools an agent has to call.
453
+ // Say so, rather than leaving the user to guess.
454
+ var noteEl = document.getElementById('od-opt-unused-note');
455
+ if (noteEl) {
456
+ var used = (data.hit_rate || 0) > 0 || tok > 0 ||
457
+ (data.compress_ratio || 0) > 0;
458
+ noteEl.style.display = used ? 'none' : '';
432
459
  }
433
460
 
434
461
  // Provider table footnote removed in v2.1 (od-opt-prov-total element no longer exists).
@@ -81,6 +81,13 @@
81
81
  { g: 'Integrations', items: [
82
82
  { k: 'mcp-pane', t: 'MCP & Tools', i: 'plug', crumb: 'Integrations' },
83
83
  { k: 'mesh-pane', t: 'Mesh Peers', i: 'mesh', crumb: 'Integrations' },
84
+ // 4.0.8: was a tab inside Governance. Every other Governance tab governs
85
+ // SLM's OWN data — lifecycle, access, trust, compliance, ingestion.
86
+ // Bounded Loops governs none of it: it is a separate product SLM
87
+ // optionally observes over a published contract, which is exactly what
88
+ // Integrations already means. "Not installed" is also an unremarkable
89
+ // answer here, where in a plane of its own an empty pane reads as broken.
90
+ { k: 'loops-pane', t: 'Bounded Loops', i: 'shield', crumb: 'Integrations' },
84
91
  ]},
85
92
  { g: 'Config', items: [
86
93
  { k: 'settings-pane', t: 'Settings', i: 'settings', crumb: 'Config' },
@@ -517,6 +524,9 @@
517
524
  if (od('odRenderMesh')) return true;
518
525
  if (typeof loadMeshPeers === 'function') loadMeshPeers();
519
526
  return true;
527
+ case 'loops-pane':
528
+ od('odRenderLoops');
529
+ return true;
520
530
  case 'settings-pane':
521
531
  if (od('odRenderSettings')) return true;
522
532
  if (typeof loadSettings === 'function') loadSettings();