superlocalmemory 3.6.13 → 3.6.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.
Files changed (147) hide show
  1. package/.claude-plugin/marketplace.json +17 -0
  2. package/CHANGELOG.md +28 -0
  3. package/README.md +189 -740
  4. package/package.json +12 -5
  5. package/plugin/.claude-plugin/plugin.json +20 -0
  6. package/plugin/.mcp.json +12 -0
  7. package/plugin/CLAUDE.md +44 -0
  8. package/plugin/_GENERATED.md +6 -0
  9. package/plugin/agents/slm-memory-advisor.md +44 -0
  10. package/plugin/agents/slm-optimize-advisor.md +38 -0
  11. package/plugin/hooks/hooks.json +14 -0
  12. package/plugin/requirements.txt +1 -0
  13. package/plugin/scripts/ensure-venv.bat +122 -0
  14. package/plugin/scripts/ensure-venv.sh +105 -0
  15. package/plugin/scripts/slm-launch +15 -0
  16. package/plugin/scripts/slm-launch.bat +17 -0
  17. package/plugin/settings.json +16 -0
  18. package/plugin/skills/slm-cache/SKILL.md +140 -0
  19. package/plugin/skills/slm-compress/SKILL.md +143 -0
  20. package/plugin/skills/slm-graph/SKILL.md +300 -0
  21. package/plugin/skills/slm-recall/SKILL.md +204 -0
  22. package/plugin/skills/slm-remember/SKILL.md +194 -0
  23. package/plugin/skills/slm-session/SKILL.md +207 -0
  24. package/plugin/skills/slm-status/SKILL.md +149 -0
  25. package/plugin-src/.mcp.json +12 -0
  26. package/plugin-src/agents/slm-memory-advisor.md +44 -0
  27. package/plugin-src/agents/slm-optimize-advisor.md +38 -0
  28. package/plugin-src/commands/slm-optimize.md +22 -0
  29. package/plugin-src/commands/slm-recall.md +16 -0
  30. package/plugin-src/commands/slm-remember.md +16 -0
  31. package/plugin-src/commands/slm-status.md +15 -0
  32. package/plugin-src/hooks/.gitkeep +0 -0
  33. package/plugin-src/hooks/hooks.json +14 -0
  34. package/plugin-src/manifest.json +25 -0
  35. package/plugin-src/requirements.txt +1 -0
  36. package/plugin-src/rules/AGENTS.md +91 -0
  37. package/plugin-src/rules/CLAUDE.md.fragment +44 -0
  38. package/plugin-src/scripts/ensure-venv.bat +122 -0
  39. package/plugin-src/scripts/ensure-venv.sh +105 -0
  40. package/plugin-src/scripts/slm-launch +15 -0
  41. package/plugin-src/scripts/slm-launch.bat +17 -0
  42. package/plugin-src/settings.json +16 -0
  43. package/plugin-src/skills/slm-cache/SKILL.md +140 -0
  44. package/plugin-src/skills/slm-compress/SKILL.md +143 -0
  45. package/plugin-src/skills/slm-graph/SKILL.md +300 -0
  46. package/plugin-src/skills/slm-recall/SKILL.md +204 -0
  47. package/plugin-src/skills/slm-remember/SKILL.md +194 -0
  48. package/plugin-src/skills/slm-session/SKILL.md +207 -0
  49. package/plugin-src/skills/slm-status/SKILL.md +149 -0
  50. package/pyproject.toml +6 -2
  51. package/scripts/__tests__/build-plugin.test.mjs +613 -0
  52. package/scripts/_savings_math.py +270 -0
  53. package/scripts/build-plugin.js +742 -0
  54. package/scripts/dogfood_savings.py +490 -0
  55. package/scripts/install-skills.ps1 +4 -334
  56. package/scripts/install-skills.sh +4 -435
  57. package/scripts/postinstall-interactive.js +0 -27
  58. package/scripts/postinstall.js +21 -2
  59. package/src/superlocalmemory/__init__.py +1 -1
  60. package/src/superlocalmemory/cli/_lazy_init.py +115 -0
  61. package/src/superlocalmemory/cli/commands.py +439 -41
  62. package/src/superlocalmemory/cli/main.py +92 -4
  63. package/src/superlocalmemory/cli/setup_wizard.py +47 -6
  64. package/src/superlocalmemory/core/backend_orchestrator.py +12 -8
  65. package/src/superlocalmemory/core/config.py +194 -9
  66. package/src/superlocalmemory/core/embeddings.py +10 -5
  67. package/src/superlocalmemory/core/engine.py +76 -5
  68. package/src/superlocalmemory/core/fact_consolidator.py +20 -3
  69. package/src/superlocalmemory/core/platform_utils.py +8 -0
  70. package/src/superlocalmemory/core/recall_pipeline.py +7 -0
  71. package/src/superlocalmemory/core/recall_worker.py +7 -0
  72. package/src/superlocalmemory/core/store_pipeline.py +23 -1
  73. package/src/superlocalmemory/core/worker_pool.py +14 -2
  74. package/src/superlocalmemory/hooks/claude_code_hooks.py +27 -3
  75. package/src/superlocalmemory/hooks/portable_kit.py +506 -0
  76. package/src/superlocalmemory/hooks/session_registry.py +8 -4
  77. package/src/superlocalmemory/infra/cloud_backup.py +99 -23
  78. package/src/superlocalmemory/mcp/_daemon_proxy.py +12 -2
  79. package/src/superlocalmemory/mcp/_pool_adapter.py +15 -6
  80. package/src/superlocalmemory/mcp/cli_fallback.py +602 -0
  81. package/src/superlocalmemory/mcp/server.py +75 -4
  82. package/src/superlocalmemory/mcp/tools_code_graph.py +3 -3
  83. package/src/superlocalmemory/mcp/tools_core.py +37 -4
  84. package/src/superlocalmemory/mcp/tools_v3.py +6 -1
  85. package/src/superlocalmemory/mcp/tools_v33.py +8 -4
  86. package/src/superlocalmemory/optimize/cache/boundary_store.py +25 -6
  87. package/src/superlocalmemory/optimize/cache/centroid_store.py +27 -4
  88. package/src/superlocalmemory/optimize/cache/manager.py +92 -6
  89. package/src/superlocalmemory/optimize/cache/semantic.py +20 -1
  90. package/src/superlocalmemory/optimize/compress/ccr.py +12 -0
  91. package/src/superlocalmemory/optimize/compress/router.py +46 -13
  92. package/src/superlocalmemory/optimize/config/schema.py +6 -0
  93. package/src/superlocalmemory/optimize/proxy/_helpers.py +111 -8
  94. package/src/superlocalmemory/optimize/proxy/anthropic_surface.py +14 -4
  95. package/src/superlocalmemory/optimize/proxy/gemini_surface.py +23 -6
  96. package/src/superlocalmemory/optimize/proxy/openai_surface.py +10 -4
  97. package/src/superlocalmemory/optimize/proxy/server.py +11 -0
  98. package/src/superlocalmemory/optimize/proxy/vertex_surface.py +246 -0
  99. package/src/superlocalmemory/optimize/storage/db.py +30 -0
  100. package/src/superlocalmemory/retrieval/bm25_channel.py +12 -2
  101. package/src/superlocalmemory/retrieval/engine.py +36 -3
  102. package/src/superlocalmemory/retrieval/entity_channel.py +5 -5
  103. package/src/superlocalmemory/retrieval/hopfield_channel.py +10 -2
  104. package/src/superlocalmemory/retrieval/semantic_channel.py +10 -2
  105. package/src/superlocalmemory/server/recall_serializer.py +3 -1
  106. package/src/superlocalmemory/server/unified_daemon.py +156 -16
  107. package/src/superlocalmemory/storage/database.py +215 -43
  108. package/src/superlocalmemory/storage/migration_runner.py +17 -1
  109. package/src/superlocalmemory/storage/migrations/M016_add_scope_support.py +120 -0
  110. package/src/superlocalmemory/storage/models.py +10 -0
  111. package/src/superlocalmemory/storage/schema.py +15 -10
  112. package/src/superlocalmemory/ui/css/legacy-dashboard.css +18 -0
  113. package/src/superlocalmemory/ui/css/neural-glass.css +5 -0
  114. package/src/superlocalmemory/ui/index.html +2 -2
  115. package/src/superlocalmemory/ui/js/core.js +98 -0
  116. package/src/superlocalmemory/ui/js/dashboard.js +8 -1
  117. package/src/superlocalmemory/ui/js/ide-status.js +16 -3
  118. package/src/superlocalmemory/ui/js/math-health.js +15 -3
  119. package/src/superlocalmemory/ui/js/optimize.js +18 -2
  120. package/src/superlocalmemory/ui/js/trust-dashboard.js +10 -1
  121. package/src/superlocalmemory.egg-info/PKG-INFO +191 -741
  122. package/src/superlocalmemory.egg-info/SOURCES.txt +7 -9
  123. package/src/superlocalmemory.egg-info/requires.txt +1 -0
  124. package/ide/skills/slm-build-graph/SKILL.md +0 -423
  125. package/ide/skills/slm-list-recent/SKILL.md +0 -348
  126. package/ide/skills/slm-recall/SKILL.md +0 -326
  127. package/ide/skills/slm-remember/SKILL.md +0 -194
  128. package/ide/skills/slm-show-patterns/SKILL.md +0 -224
  129. package/ide/skills/slm-status/SKILL.md +0 -363
  130. package/ide/skills/slm-switch-profile/SKILL.md +0 -442
  131. package/skills/slm-build-graph/SKILL.md +0 -423
  132. package/skills/slm-list-recent/SKILL.md +0 -348
  133. package/skills/slm-optimize/README.md +0 -55
  134. package/skills/slm-optimize/SKILL.md +0 -139
  135. package/skills/slm-recall/SKILL.md +0 -343
  136. package/skills/slm-remember/SKILL.md +0 -194
  137. package/skills/slm-show-patterns/SKILL.md +0 -224
  138. package/skills/slm-status/SKILL.md +0 -363
  139. package/skills/slm-switch-profile/SKILL.md +0 -442
  140. package/src/superlocalmemory/cli/doctor_cmd.py +0 -152
  141. package/src/superlocalmemory/skills/slm-build-graph/SKILL.md +0 -423
  142. package/src/superlocalmemory/skills/slm-list-recent/SKILL.md +0 -348
  143. package/src/superlocalmemory/skills/slm-recall/SKILL.md +0 -343
  144. package/src/superlocalmemory/skills/slm-remember/SKILL.md +0 -194
  145. package/src/superlocalmemory/skills/slm-show-patterns/SKILL.md +0 -224
  146. package/src/superlocalmemory/skills/slm-status/SKILL.md +0 -363
  147. package/src/superlocalmemory/skills/slm-switch-profile/SKILL.md +0 -442
@@ -0,0 +1,194 @@
1
+ ---
2
+ name: slm-remember
3
+ description: Capture durable facts, decisions, constraints, and gotchas into SuperLocalMemory. Use when the user says "remember that", "save this decision", "note this constraint", or when a session produces a conclusion worth persisting across sessions. Always recall first to avoid duplicates.
4
+ when_to_use: |
5
+ - "Remember that we use JWT with 1h expiry"
6
+ - "Save this architectural decision"
7
+ - "Store the constraint that X must not Y"
8
+ - "Note this as a gotcha / blocker / convention"
9
+ - After making a non-obvious decision during a coding session
10
+ - After resolving a bug whose root cause should be persisted
11
+ allowed-tools: remember, recall, update_memory, Bash
12
+ ---
13
+
14
+ # slm-remember — Capture Durable Facts
15
+
16
+ Store atomic, durable facts into SuperLocalMemory for retrieval in future
17
+ sessions. One fact per call. Recall before you remember.
18
+
19
+ ---
20
+
21
+ ## What to store (and what not to)
22
+
23
+ **Store:**
24
+ - Architectural decisions ("Decided to use Postgres not MySQL — reason: JSONB support")
25
+ - Project conventions ("All API routes follow /api/v1/resource/{id} pattern")
26
+ - Hard constraints ("Never expose raw SQL errors to the HTTP response")
27
+ - Resolved gotchas ("Ollama needs keep_alive=-1 or it unloads the model between calls")
28
+ - Security rules ("Rate limit all public endpoints at 100 req/min")
29
+
30
+ **Do not store:**
31
+ - Transient context that is only relevant within this conversation
32
+ - Large blobs of code or full file contents (those belong in the project, not memory)
33
+ - Facts the project README already captures
34
+
35
+ ---
36
+
37
+ ## Recall-before-remember (mandatory discipline)
38
+
39
+ Before calling `remember`, always call `recall` first with the core terms of
40
+ what you are about to store. If a near-duplicate exists:
41
+
42
+ - Use `update_memory(fact_id, content)` to refine the existing fact instead
43
+ of creating a new one.
44
+ - Only call `remember` when no sufficiently similar fact is found.
45
+
46
+ Duplicates degrade retrieval quality for every future session.
47
+
48
+ ---
49
+
50
+ ## MCP-first workflow
51
+
52
+ ### 1. Check for duplicates first
53
+
54
+ ```
55
+ recall(query="JWT token expiry auth", limit=5, session_id="<sid>")
56
+ ```
57
+
58
+ If a near-duplicate is returned:
59
+
60
+ ```
61
+ update_memory(
62
+ fact_id="f8a2bc91",
63
+ content="JWT tokens use 1h expiry for API access tokens; refresh tokens 30d (updated 2026-06-16)",
64
+ )
65
+ ```
66
+
67
+ `update_memory` returns `{"success": true, "fact_id": "f8a2bc91", "content": "..."}`.
68
+
69
+ ### 2. Store a new fact
70
+
71
+ ```
72
+ remember(
73
+ content="Decided to use JWT with 1h expiry for API auth; refresh tokens persist 30 days",
74
+ tags="auth,security,decision",
75
+ project="superlocalmemory",
76
+ importance=8,
77
+ session_id="<sid>",
78
+ )
79
+ ```
80
+
81
+ Real response shape:
82
+ ```json
83
+ {
84
+ "success": true,
85
+ "fact_ids": ["c9d4e112"],
86
+ "count": 1,
87
+ "pending": false,
88
+ "message": "Stored (recallable now; enriching async)."
89
+ }
90
+ ```
91
+
92
+ When `pending: true`, the daemon was offline at save time; the fact enters a
93
+ pending queue and becomes recallable once the daemon is back. Do not re-save.
94
+
95
+ **Never claim "saved" unless `success: true` is in the response.**
96
+
97
+ ### 3. Parameter reference
98
+
99
+ ```
100
+ remember(
101
+ content: str, # required — the atomic fact to store
102
+ tags: str = "", # comma-separated tags, e.g. "auth,security,gotcha"
103
+ project: str = "", # project scope, e.g. "superlocalmemory"
104
+ importance: int = 5,# 1–10; see scale below
105
+ session_id: str = "",# from session_init; attributes the write to this session
106
+ scope: str = None, # v3.6.15 multi-scope: "personal" (default) | "shared" | "global"
107
+ shared_with: str = "",# comma-separated profile_ids for scope="shared"
108
+ )
109
+ ```
110
+
111
+ > **Multi-scope (v3.6.15, opt-in):** leave `scope` unset for `personal` (private to
112
+ > this profile — the default, identical to 3.6.14). `"global"` is visible to every
113
+ > profile on the machine; `"shared"` is visible to the profiles in `shared_with`.
114
+ > See [docs/shared-memory.md](../../../docs/shared-memory.md).
115
+
116
+ **importance scale:**
117
+ - 1–3: Low — passing notes, ideas, soft preferences
118
+ - 4–6: Normal — patterns, conventions, standard decisions (default: 5)
119
+ - 7–8: High — architectural decisions, integration contracts, known gotchas
120
+ - 9–10: Critical — security rules, blockers, irreversible decisions
121
+
122
+ Use 7–10 only for facts that would cause real damage if forgotten.
123
+
124
+ ### 4. One fact per call
125
+
126
+ Store one atomic fact per `remember` call. Do not concatenate multiple unrelated
127
+ points into a single content string — they will be hard to update individually
128
+ and harder to retrieve cleanly. If you have three separate decisions, make three
129
+ calls.
130
+
131
+ ### 5. Always set tags and project
132
+
133
+ Untagged, unscoped facts are harder to retrieve and harder to manage. Minimum:
134
+ set `tags` to one or two relevant terms and `project` to the repo/product name.
135
+
136
+ ---
137
+
138
+ ## Deleting stale facts via CLI
139
+
140
+ For deletion, the CLI is the authoritative surface. The MCP `forget` tool in
141
+ v3.6.14 runs an Ebbinghaus decay cycle — it does NOT delete by query. For
142
+ targeted deletion, use the CLI:
143
+
144
+ ```bash
145
+ # Preview what would be deleted (always do this first)
146
+ slm forget "<query>" --dry-run [--json]
147
+
148
+ # Execute deletion after confirming the preview
149
+ slm forget "<query>" --yes [--json]
150
+
151
+ # Delete a specific fact by exact ID (use when you have the fact_id)
152
+ slm delete <fact_id> --yes [--json]
153
+ ```
154
+
155
+ Flags verified in source (main.py):
156
+ - `slm forget`: positional `query`, `--dry-run`, `--yes` / `-y`, `--json`
157
+ - `slm delete`: positional `fact_id`, `--yes` / `-y`, `--json`
158
+
159
+ Always run `--dry-run` first and review the preview before passing `--yes`.
160
+
161
+ ---
162
+
163
+ ## CLI fallback (when MCP is unavailable)
164
+
165
+ ```bash
166
+ # Store a fact
167
+ slm remember "<content>" [--tags a,b,c] [--json]
168
+
169
+ # Store a shared/global fact (v3.6.15, opt-in)
170
+ slm remember "<content>" --scope global
171
+ slm remember "<content>" --scope shared --shared-with alice,bob
172
+
173
+ # Flags verified in source (main.py): --tags, --json, --sync, --scope, --shared-with
174
+ # --sync: wait for full enrichment before returning (default is async)
175
+ # --scope: personal (default) | shared | global ; --shared-with: profile ids for shared
176
+ ```
177
+
178
+ **Flags that do NOT exist** on `slm remember`:
179
+ `--importance`, `--project`, `--format` — these are MCP-only params or fabricated.
180
+
181
+ ---
182
+
183
+ ## Update vs forget discipline
184
+
185
+ | Scenario | Action |
186
+ |----------|--------|
187
+ | Fact is still true but needs refinement | `update_memory(fact_id, new_content)` |
188
+ | Fact is superseded or wrong | `slm forget "<query>" --dry-run` then `--yes` |
189
+ | Duplicate found that matches recall result | `update_memory` on the existing one |
190
+ | Fact has a known ID and is clearly obsolete | `slm delete <fact_id> --yes` |
191
+
192
+ ---
193
+
194
+ *SuperLocalMemory v3.6.15 · Qualixar · AGPL-3.0-or-later*
@@ -0,0 +1,207 @@
1
+ ---
2
+ name: slm-session
3
+ description: Manage SuperLocalMemory session lifecycle — call session_init once at the start of every fresh session to load relevant project context and get a session_id; call close_session when work is meaningfully complete to commit temporal summaries. Correct lifecycle hygiene is what makes SLM's learning loop work.
4
+ when_to_use: |
5
+ - At the start of every session (auto-trigger on first user message in a project context)
6
+ - When the user says "start a new session" or "initialize memory"
7
+ - When meaningful work completes and context should be committed
8
+ - When the user says "close session" or "end session"
9
+ allowed-tools: session_init, close_session, Bash
10
+ ---
11
+
12
+ # slm-session — Session Lifecycle Hygiene
13
+
14
+ Session lifecycle is the mechanism that makes SuperLocalMemory's learning loop
15
+ work. Without it, recall signals are not attributed and temporal summaries are
16
+ not written. This is not optional housekeeping — it is load-bearing.
17
+
18
+ ---
19
+
20
+ ## The lifecycle in one diagram
21
+
22
+ ```
23
+ Session starts
24
+ |
25
+ v
26
+ session_init(project_path, query)
27
+ |--- returns session_id, context, memories
28
+ |
29
+ v
30
+ Use session_id in every recall() and remember() call
31
+ |
32
+ v
33
+ Work completes
34
+ |
35
+ v
36
+ close_session(session_id)
37
+ |--- writes temporal summaries to DB
38
+ ```
39
+
40
+ ---
41
+
42
+ ## session_init — call once per fresh session
43
+
44
+ ### When to call
45
+
46
+ Call `session_init` exactly once at the start of every fresh session, before
47
+ any `recall` or `remember`. Never call it twice in a session — the second call
48
+ would generate a new `session_id` and break signal attribution for any prior
49
+ recalls or remembers in that session.
50
+
51
+ ### Signature
52
+
53
+ ```
54
+ session_init(
55
+ project_path: str = "", # working directory path, e.g. "/Users/me/projects/foo"
56
+ query: str = "", # topic override; if omitted, derived from project_path
57
+ max_results: int = 10, # max memories to return (default: 10)
58
+ max_age_days: int = 30, # suppress memories older than N days unless score >= 0.7
59
+ # set to 0 to disable the age gate entirely
60
+ )
61
+ ```
62
+
63
+ ### What it does
64
+
65
+ 1. Derives a search query from `project_path` (or uses your explicit `query`).
66
+ 2. Runs a 2-tier recall: full 6-channel via daemon (primary) or FTS5 BM25
67
+ (emergency fallback if daemon is unreachable).
68
+ 3. Merges any pinned "core memory" facts with the recall results.
69
+ 4. Applies an age gate — memories older than `max_age_days` are suppressed
70
+ unless their relevance score is 0.70 or above (architectural decisions that
71
+ remain permanently relevant still surface).
72
+ 5. Returns a pre-formatted `context` block and a structured `memories` array
73
+ for your session.
74
+ 6. Generates a stable `session_id` (`slm-YYYYMMDD-<8hex>`) and returns it.
75
+
76
+ ### Real response shape
77
+
78
+ ```json
79
+ {
80
+ "success": true,
81
+ "session_id": "slm-20260616-a3f8c1d2",
82
+ "context": "# Relevant Memory Context\n\n- JWT tokens use 1h expiry ...",
83
+ "memories": [
84
+ {
85
+ "fact_id": "f8a2bc91",
86
+ "content": "JWT tokens use 1h expiry for API auth (2026-06-10)",
87
+ "score": 0.87,
88
+ "is_core": false
89
+ }
90
+ ],
91
+ "memory_count": 3,
92
+ "core_memory": [],
93
+ "degraded_mode": false,
94
+ "retrieval_mode": "full_6_channel",
95
+ "learning": {
96
+ "feedback_signals": 37,
97
+ "phase": 1,
98
+ "status": "collecting"
99
+ }
100
+ }
101
+ ```
102
+
103
+ **Check `degraded_mode`.** When `true`, the daemon was unreachable and only
104
+ FTS5 BM25 was used — semantic, graph, temporal, and structural channels were
105
+ unavailable. The context is still usable; note the degradation if relevant.
106
+
107
+ **Check `learning.phase`:**
108
+ - Phase 1 (< 50 signals): collecting baseline feedback
109
+ - Phase 2 (50–199 signals): active learning
110
+ - Phase 3 (≥ 200 signals): full ML-driven ranking
111
+
112
+ ### How to use the returned session_id
113
+
114
+ Store it and thread it into every `recall` and `remember` call in this session:
115
+
116
+ ```
117
+ session_id = "<value from session_init>"
118
+
119
+ recall(query="auth strategy", session_id=session_id, limit=10)
120
+ remember(content="...", session_id=session_id, tags="auth,decision", project="myapp")
121
+ ```
122
+
123
+ This attribution is what allows the ranker to learn which recalls led to useful
124
+ outcomes for this project.
125
+
126
+ ---
127
+
128
+ ## close_session — call when work is meaningfully complete
129
+
130
+ ### When to call
131
+
132
+ Call `close_session` when a meaningful unit of work is done — end of a coding
133
+ session, after shipping a feature, after a design review. You do not need to
134
+ call it after every small interaction. The signal is "this session's work is
135
+ committed and should be summarised."
136
+
137
+ Do not call it at the start of a new session as a cleanup step — `session_init`
138
+ is the correct opener and it does not require a prior close.
139
+
140
+ ### Signature
141
+
142
+ ```
143
+ close_session(
144
+ session_id: str = "", # the session_id from session_init; if omitted,
145
+ # the system queries the DB for the most recent session
146
+ )
147
+ ```
148
+
149
+ ### What it does
150
+
151
+ Aggregates facts written during the session into per-entity temporal summary
152
+ events. These summaries enable future queries like "what happened during session
153
+ X?" and contribute to the temporal channel in retrieval.
154
+
155
+ ### Real response shape
156
+
157
+ ```json
158
+ {
159
+ "success": true,
160
+ "session_id": "slm-20260616-a3f8c1d2",
161
+ "summary_events_created": 4
162
+ }
163
+ ```
164
+
165
+ `summary_events_created: 0` is normal for short sessions where no new facts
166
+ were written. It is not an error.
167
+
168
+ ---
169
+
170
+ ## Why this matters
171
+
172
+ Every `recall` call with a `session_id` enqueues engagement signals — which
173
+ results were shown, which were acted on. The learning ranker processes these
174
+ signals to gradually up-weight channels and facts that prove useful for your
175
+ project. Without `session_id`, signals land on a fallback identifier and are
176
+ never attributed to a project or agent. Over many sessions this compounds:
177
+ projects where lifecycle is respected have measurably better retrieval quality
178
+ than projects where session_init is skipped.
179
+
180
+ ---
181
+
182
+ ## CLI fallback (when MCP is unavailable)
183
+
184
+ There are no direct `session_init` or `close_session` CLI subcommands.
185
+ When MCP is unavailable, use `slm status` to check system health and
186
+ `slm recall` / `slm remember` directly. Session attribution will not be
187
+ available in degraded CLI-only mode.
188
+
189
+ ```bash
190
+ slm status [--json] # check mode, profile, DB size, fact count
191
+ slm doctor [--json] # preflight check including daemon and embedding worker
192
+ ```
193
+
194
+ ---
195
+
196
+ ## Common mistakes
197
+
198
+ | Mistake | Consequence | Fix |
199
+ |---------|-------------|-----|
200
+ | Calling `session_init` twice in one session | Two session IDs; signals split across them | Call once; store the returned ID |
201
+ | Omitting `session_id` from `recall` / `remember` | No learning attribution | Always pass the stored `session_id` |
202
+ | Never calling `close_session` | Temporal summaries not written | Call at end of each meaningful work unit |
203
+ | Calling `close_session` without a `session_id` when no prior writes exist | Returns error "No session_id found" | Pass the explicit `session_id` from `session_init` |
204
+
205
+ ---
206
+
207
+ *SuperLocalMemory v3.6.15 · Qualixar · AGPL-3.0-or-later*
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: slm-status
3
+ description: Health and optimization stats for SuperLocalMemory — call slm_optimize_stats() for live compression and cache counters (compress_runs, tokens_saved_compress, cache_proxy_hits, cache_proxy_misses, cache_kv_hits, cache_kv_misses); run slm status [--json] for system state (mode, profile, DB size, fact/entity/edge counts) and slm doctor [--json] for preflight including the "Optimize (Surface B)" health line; use together to confirm optimization is actually saving tokens.
4
+ when_to_use: "check slm status, health check, is slm working, optimize stats, tokens saved, cache hits, compress runs, slm doctor, preflight, db size, slm info, diagnose slm"
5
+ allowed-tools: slm_optimize_stats, Bash
6
+ ---
7
+
8
+ # slm-status — Health and Optimize Stats
9
+
10
+ ## Purpose
11
+
12
+ Use this skill to answer: "Is SLM healthy?", "Is compression/caching actually saving tokens?", and "What does the system look like right now?" It covers three surfaces: the MCP stats tool, the `slm status` CLI, and the `slm doctor` preflight.
13
+
14
+ ## Primary MCP Tool: slm_optimize_stats
15
+
16
+ ```
17
+ slm_optimize_stats() -> dict
18
+ ```
19
+
20
+ No arguments. Returns counters from the current daemon and MCP process session.
21
+
22
+ ### Return dict (all keys always present)
23
+
24
+ | Key | Type | Meaning |
25
+ |-----|------|---------|
26
+ | `ok` | bool | `True` on success; `False` on internal error |
27
+ | `compress_runs` | int | Total compress calls recorded by the daemon (persisted across restarts) |
28
+ | `tokens_saved_compress` | int | Cumulative tokens saved by compression (daemon-persisted) |
29
+ | `cache_proxy_hits` | int | Proxy-layer cache hits (daemon-persisted) |
30
+ | `cache_proxy_misses` | int | Proxy-layer cache misses (daemon-persisted) |
31
+ | `cache_kv_hits` | int | MCP KV cache hits — **this MCP process session only**, resets on restart |
32
+ | `cache_kv_misses` | int | MCP KV cache misses — **this MCP process session only**, resets on restart |
33
+ | `ccr_note` | str \| None | Note about CCR entry count (not tracked per-session; see daemon `/api/v1/metrics`) |
34
+ | `note` | str \| None | Scope clarification or error detail |
35
+
36
+ ### Important scope distinction
37
+
38
+ `compress_runs`, `tokens_saved_compress`, `cache_proxy_hits`, and `cache_proxy_misses` are **daemon-persisted** — they survive MCP restarts and accumulate over the full install lifetime.
39
+
40
+ `cache_kv_hits` and `cache_kv_misses` are **in-process counters** — they reset to 0 each time the MCP server starts. Use them to gauge cache effectiveness within the current session only.
41
+
42
+ ### Reading whether optimization is saving tokens
43
+
44
+ ```python
45
+ stats = await slm_optimize_stats()
46
+ if stats["ok"]:
47
+ savings = stats["tokens_saved_compress"]
48
+ kv_hit_rate = (
49
+ stats["cache_kv_hits"] / max(stats["cache_kv_hits"] + stats["cache_kv_misses"], 1)
50
+ )
51
+ # savings > 0 and kv_hit_rate > 0.5 means Surface B is actively reducing costs
52
+ ```
53
+
54
+ If `compress_runs` is 0 after several sessions, compression is not being triggered — check daemon config and whether `slm_compress` is being called.
55
+
56
+ If `cache_kv_hits` is 0 after repeated work, verify key naming consistency (the same key string must be used for set and get).
57
+
58
+ ## Secondary CLI: slm status
59
+
60
+ ```bash
61
+ slm status [--json] [--verbose]
62
+ ```
63
+
64
+ Reports system-level state — not optimization counters. Canonical fields (WP-02):
65
+
66
+ - **mode** — active operation mode (e.g. `local`)
67
+ - **profile** — current memory profile name
68
+ - **DB size** — database file size on disk
69
+ - **fact count** — number of stored memory facts
70
+ - **entity count** — entity graph node count
71
+ - **edge count** — entity graph edge count
72
+
73
+ `--verbose` / `-v` adds: migration log, daemon port, disabled marker, last version.
74
+
75
+ `--json` outputs a machine-readable dict with the same fields — preferred for agent consumption.
76
+
77
+ Example agent-native invocation:
78
+
79
+ ```bash
80
+ slm status --json
81
+ ```
82
+
83
+ Typical JSON shape (exact field names depend on runtime; use `--json` and read what arrives):
84
+
85
+ ```json
86
+ {
87
+ "mode": "local",
88
+ "profile": "code",
89
+ "db_size_mb": 12.4,
90
+ "facts": 384,
91
+ "entities": 201,
92
+ "edges": 519
93
+ }
94
+ ```
95
+
96
+ Do not rely on the human-readable format for parsing — always use `--json` when the output feeds another tool.
97
+
98
+ ## Secondary CLI: slm doctor
99
+
100
+ ```bash
101
+ slm doctor [--json] [--quick]
102
+ ```
103
+
104
+ Preflight check covering dependencies, embedding worker, daemon connectivity, and Surface B health. The **"Optimize (Surface B)"** line (WP-03) confirms whether the compression and cache subsystem initialised correctly.
105
+
106
+ `--quick` skips the daemon and embedding probes — runs only dependency and config checks; faster but incomplete.
107
+
108
+ `--json` outputs structured results per check — use this in automated health pipelines.
109
+
110
+ A passing doctor output confirms:
111
+ - Python deps present
112
+ - Embedding worker reachable
113
+ - Daemon responding
114
+ - Surface B (Optimize) initialised
115
+
116
+ A failing "Optimize (Surface B)" line means `slm_compress`, `slm_cache_set`, and `slm_cache_get` may not function correctly — investigate daemon config before relying on those tools.
117
+
118
+ ## Secondary CLI: slm optimize status
119
+
120
+ ```bash
121
+ slm optimize status [--json]
122
+ ```
123
+
124
+ Shows whether the Optimize module (cache + compress) is currently enabled or disabled at the daemon level. Available subcommands also include `optimize on`, `optimize off`, and `optimize savings`.
125
+
126
+ The `optimize savings` subcommand accepts:
127
+
128
+ ```bash
129
+ slm optimize savings [--since <days>] [--provider anthropic|openai|gemini] [--json]
130
+ ```
131
+
132
+ `--since` defaults to 7 days. `--provider` filters by the target AI provider.
133
+
134
+ Note: the `slm optimize` subcommands have known pre-existing parse-test failures — if a subcommand errors, use `slm_optimize_stats()` via MCP as the authoritative source.
135
+
136
+ ## Recommended Health Workflow
137
+
138
+ 1. Run `slm doctor --json` at session start to confirm all subsystems are up.
139
+ 2. Call `slm_optimize_stats()` after a batch of work to check token savings.
140
+ 3. Run `slm status --json` when you need DB size or memory counts.
141
+ 4. If `ok: false` on any MCP tool — check `note` field, then run `slm doctor` to isolate the failure.
142
+
143
+ ## Fail-Open
144
+
145
+ `slm_optimize_stats()` never raises. On internal error it returns `ok: false` with all counters at 0. Continue the session — stats unavailability does not affect compression or caching operations.
146
+
147
+ ---
148
+
149
+ SuperLocalMemory v3.6.15 · Qualixar · AGPL-3.0-or-later
package/pyproject.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "superlocalmemory"
3
- version = "3.6.13"
3
+ version = "3.6.15"
4
4
  description = "Information-geometric agent memory with mathematical guarantees"
5
5
  readme = "README.md"
6
6
  license = {text = "AGPL-3.0-or-later"}
@@ -48,6 +48,10 @@ dependencies = [
48
48
  "zeroconf>=0.140",
49
49
  "lightgbm==4.6.0",
50
50
  "orjson==3.11.9",
51
+ # TOML writer for portable-kit IDE config (codex uses .codex/config.toml).
52
+ # stdlib tomllib is read-only; without this, connect_ide('codex') silently
53
+ # fails to write the MCP server block.
54
+ "tomli-w==1.2.0",
51
55
  "tree-sitter==0.25.2",
52
56
  "tree-sitter-language-pack==0.13.0",
53
57
  "rustworkx==0.17.1",
@@ -137,7 +141,7 @@ build-backend = "setuptools.build_meta"
137
141
  where = ["src"]
138
142
 
139
143
  [tool.setuptools.package-data]
140
- superlocalmemory = ["ui/**/*", "skills/**/*"]
144
+ superlocalmemory = ["ui/**/*"]
141
145
 
142
146
  [tool.pytest.ini_options]
143
147
  testpaths = ["tests"]