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.
- package/.claude-plugin/marketplace.json +17 -0
- package/CHANGELOG.md +28 -0
- package/README.md +189 -740
- package/package.json +12 -5
- package/plugin/.claude-plugin/plugin.json +20 -0
- package/plugin/.mcp.json +12 -0
- package/plugin/CLAUDE.md +44 -0
- package/plugin/_GENERATED.md +6 -0
- package/plugin/agents/slm-memory-advisor.md +44 -0
- package/plugin/agents/slm-optimize-advisor.md +38 -0
- package/plugin/hooks/hooks.json +14 -0
- package/plugin/requirements.txt +1 -0
- package/plugin/scripts/ensure-venv.bat +122 -0
- package/plugin/scripts/ensure-venv.sh +105 -0
- package/plugin/scripts/slm-launch +15 -0
- package/plugin/scripts/slm-launch.bat +17 -0
- package/plugin/settings.json +16 -0
- package/plugin/skills/slm-cache/SKILL.md +140 -0
- package/plugin/skills/slm-compress/SKILL.md +143 -0
- package/plugin/skills/slm-graph/SKILL.md +300 -0
- package/plugin/skills/slm-recall/SKILL.md +204 -0
- package/plugin/skills/slm-remember/SKILL.md +194 -0
- package/plugin/skills/slm-session/SKILL.md +207 -0
- package/plugin/skills/slm-status/SKILL.md +149 -0
- package/plugin-src/.mcp.json +12 -0
- package/plugin-src/agents/slm-memory-advisor.md +44 -0
- package/plugin-src/agents/slm-optimize-advisor.md +38 -0
- package/plugin-src/commands/slm-optimize.md +22 -0
- package/plugin-src/commands/slm-recall.md +16 -0
- package/plugin-src/commands/slm-remember.md +16 -0
- package/plugin-src/commands/slm-status.md +15 -0
- package/plugin-src/hooks/.gitkeep +0 -0
- package/plugin-src/hooks/hooks.json +14 -0
- package/plugin-src/manifest.json +25 -0
- package/plugin-src/requirements.txt +1 -0
- package/plugin-src/rules/AGENTS.md +91 -0
- package/plugin-src/rules/CLAUDE.md.fragment +44 -0
- package/plugin-src/scripts/ensure-venv.bat +122 -0
- package/plugin-src/scripts/ensure-venv.sh +105 -0
- package/plugin-src/scripts/slm-launch +15 -0
- package/plugin-src/scripts/slm-launch.bat +17 -0
- package/plugin-src/settings.json +16 -0
- package/plugin-src/skills/slm-cache/SKILL.md +140 -0
- package/plugin-src/skills/slm-compress/SKILL.md +143 -0
- package/plugin-src/skills/slm-graph/SKILL.md +300 -0
- package/plugin-src/skills/slm-recall/SKILL.md +204 -0
- package/plugin-src/skills/slm-remember/SKILL.md +194 -0
- package/plugin-src/skills/slm-session/SKILL.md +207 -0
- package/plugin-src/skills/slm-status/SKILL.md +149 -0
- package/pyproject.toml +6 -2
- package/scripts/__tests__/build-plugin.test.mjs +613 -0
- package/scripts/_savings_math.py +270 -0
- package/scripts/build-plugin.js +742 -0
- package/scripts/dogfood_savings.py +490 -0
- package/scripts/install-skills.ps1 +4 -334
- package/scripts/install-skills.sh +4 -435
- package/scripts/postinstall-interactive.js +0 -27
- package/scripts/postinstall.js +21 -2
- package/src/superlocalmemory/__init__.py +1 -1
- package/src/superlocalmemory/cli/_lazy_init.py +115 -0
- package/src/superlocalmemory/cli/commands.py +439 -41
- package/src/superlocalmemory/cli/main.py +92 -4
- package/src/superlocalmemory/cli/setup_wizard.py +47 -6
- package/src/superlocalmemory/core/backend_orchestrator.py +12 -8
- package/src/superlocalmemory/core/config.py +194 -9
- package/src/superlocalmemory/core/embeddings.py +10 -5
- package/src/superlocalmemory/core/engine.py +76 -5
- package/src/superlocalmemory/core/fact_consolidator.py +20 -3
- package/src/superlocalmemory/core/platform_utils.py +8 -0
- package/src/superlocalmemory/core/recall_pipeline.py +7 -0
- package/src/superlocalmemory/core/recall_worker.py +7 -0
- package/src/superlocalmemory/core/store_pipeline.py +23 -1
- package/src/superlocalmemory/core/worker_pool.py +14 -2
- package/src/superlocalmemory/hooks/claude_code_hooks.py +27 -3
- package/src/superlocalmemory/hooks/portable_kit.py +506 -0
- package/src/superlocalmemory/hooks/session_registry.py +8 -4
- package/src/superlocalmemory/infra/cloud_backup.py +99 -23
- package/src/superlocalmemory/mcp/_daemon_proxy.py +12 -2
- package/src/superlocalmemory/mcp/_pool_adapter.py +15 -6
- package/src/superlocalmemory/mcp/cli_fallback.py +602 -0
- package/src/superlocalmemory/mcp/server.py +75 -4
- package/src/superlocalmemory/mcp/tools_code_graph.py +3 -3
- package/src/superlocalmemory/mcp/tools_core.py +37 -4
- package/src/superlocalmemory/mcp/tools_v3.py +6 -1
- package/src/superlocalmemory/mcp/tools_v33.py +8 -4
- package/src/superlocalmemory/optimize/cache/boundary_store.py +25 -6
- package/src/superlocalmemory/optimize/cache/centroid_store.py +27 -4
- package/src/superlocalmemory/optimize/cache/manager.py +92 -6
- package/src/superlocalmemory/optimize/cache/semantic.py +20 -1
- package/src/superlocalmemory/optimize/compress/ccr.py +12 -0
- package/src/superlocalmemory/optimize/compress/router.py +46 -13
- package/src/superlocalmemory/optimize/config/schema.py +6 -0
- package/src/superlocalmemory/optimize/proxy/_helpers.py +111 -8
- package/src/superlocalmemory/optimize/proxy/anthropic_surface.py +14 -4
- package/src/superlocalmemory/optimize/proxy/gemini_surface.py +23 -6
- package/src/superlocalmemory/optimize/proxy/openai_surface.py +10 -4
- package/src/superlocalmemory/optimize/proxy/server.py +11 -0
- package/src/superlocalmemory/optimize/proxy/vertex_surface.py +246 -0
- package/src/superlocalmemory/optimize/storage/db.py +30 -0
- package/src/superlocalmemory/retrieval/bm25_channel.py +12 -2
- package/src/superlocalmemory/retrieval/engine.py +36 -3
- package/src/superlocalmemory/retrieval/entity_channel.py +5 -5
- package/src/superlocalmemory/retrieval/hopfield_channel.py +10 -2
- package/src/superlocalmemory/retrieval/semantic_channel.py +10 -2
- package/src/superlocalmemory/server/recall_serializer.py +3 -1
- package/src/superlocalmemory/server/unified_daemon.py +156 -16
- package/src/superlocalmemory/storage/database.py +215 -43
- package/src/superlocalmemory/storage/migration_runner.py +17 -1
- package/src/superlocalmemory/storage/migrations/M016_add_scope_support.py +120 -0
- package/src/superlocalmemory/storage/models.py +10 -0
- package/src/superlocalmemory/storage/schema.py +15 -10
- package/src/superlocalmemory/ui/css/legacy-dashboard.css +18 -0
- package/src/superlocalmemory/ui/css/neural-glass.css +5 -0
- package/src/superlocalmemory/ui/index.html +2 -2
- package/src/superlocalmemory/ui/js/core.js +98 -0
- package/src/superlocalmemory/ui/js/dashboard.js +8 -1
- package/src/superlocalmemory/ui/js/ide-status.js +16 -3
- package/src/superlocalmemory/ui/js/math-health.js +15 -3
- package/src/superlocalmemory/ui/js/optimize.js +18 -2
- package/src/superlocalmemory/ui/js/trust-dashboard.js +10 -1
- package/src/superlocalmemory.egg-info/PKG-INFO +191 -741
- package/src/superlocalmemory.egg-info/SOURCES.txt +7 -9
- package/src/superlocalmemory.egg-info/requires.txt +1 -0
- package/ide/skills/slm-build-graph/SKILL.md +0 -423
- package/ide/skills/slm-list-recent/SKILL.md +0 -348
- package/ide/skills/slm-recall/SKILL.md +0 -326
- package/ide/skills/slm-remember/SKILL.md +0 -194
- package/ide/skills/slm-show-patterns/SKILL.md +0 -224
- package/ide/skills/slm-status/SKILL.md +0 -363
- package/ide/skills/slm-switch-profile/SKILL.md +0 -442
- package/skills/slm-build-graph/SKILL.md +0 -423
- package/skills/slm-list-recent/SKILL.md +0 -348
- package/skills/slm-optimize/README.md +0 -55
- package/skills/slm-optimize/SKILL.md +0 -139
- package/skills/slm-recall/SKILL.md +0 -343
- package/skills/slm-remember/SKILL.md +0 -194
- package/skills/slm-show-patterns/SKILL.md +0 -224
- package/skills/slm-status/SKILL.md +0 -363
- package/skills/slm-switch-profile/SKILL.md +0 -442
- package/src/superlocalmemory/cli/doctor_cmd.py +0 -152
- package/src/superlocalmemory/skills/slm-build-graph/SKILL.md +0 -423
- package/src/superlocalmemory/skills/slm-list-recent/SKILL.md +0 -348
- package/src/superlocalmemory/skills/slm-recall/SKILL.md +0 -343
- package/src/superlocalmemory/skills/slm-remember/SKILL.md +0 -194
- package/src/superlocalmemory/skills/slm-show-patterns/SKILL.md +0 -224
- package/src/superlocalmemory/skills/slm-status/SKILL.md +0 -363
- 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
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slm-memory-advisor
|
|
3
|
+
description: >
|
|
4
|
+
Advises the main agent on using SuperLocalMemory well — when to call
|
|
5
|
+
session_init, remember, recall, and search; how to phrase queries; and how
|
|
6
|
+
to keep memory clean. Delegate here for any "should I save/recall this?"
|
|
7
|
+
decision or when memory results look wrong.
|
|
8
|
+
tools: session_init, recall, search, remember, update_memory, forget, list_recent, Read
|
|
9
|
+
model: inherit
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Role
|
|
13
|
+
You are the SuperLocalMemory (SLM) memory advisor. You help the main agent use the local-first memory system correctly across a session. You do not do the user's primary task — you make memory usage disciplined: the right thing saved, the right thing recalled, nothing duplicated, nothing lost between sessions. SLM is 100% local; every tool runs on the user's machine.
|
|
14
|
+
|
|
15
|
+
# When to act
|
|
16
|
+
When the main agent: starts a session and hasn't loaded project context; is about to or just made a decision worth persisting; asks "what did we decide about X"; gets recall results that look irrelevant/empty.
|
|
17
|
+
|
|
18
|
+
# Tools you may use (real SLM MCP tools, core profile)
|
|
19
|
+
- `session_init(project_path, query, max_results, max_age_days)` — ONCE at session start; returns recent decisions + relevant memories.
|
|
20
|
+
- `recall(query, limit, session_id, fast, include_global, include_shared)` — multi-channel semantic retrieval (default limit 10). Leave `include_global`/`include_shared` unset — recall is private-by-default (v3.6.15).
|
|
21
|
+
- `search(query, limit, profile_id)` — exact keyword / FTS5 BM25.
|
|
22
|
+
- `remember(content, tags, project, importance, session_id, scope, shared_with)` — store atomic fact; importance 1-10. Leave `scope` unset (defaults to `personal`/private).
|
|
23
|
+
- `update_memory(fact_id, content)` — correct by exact id.
|
|
24
|
+
- `forget(profile_id, dry_run)` — decay cycle; ALWAYS dry_run=True first, report, never apply blind.
|
|
25
|
+
- `list_recent(limit)` — newest first.
|
|
26
|
+
- `Read` — inspect a file before deciding what to remember.
|
|
27
|
+
|
|
28
|
+
# Decision rules
|
|
29
|
+
1. SESSION_INIT FIRST — once, before any recall/remember in a fresh session. Never skip; never twice.
|
|
30
|
+
2. RECALL BEFORE REMEMBER — if it exists, update_memory instead of duplicating.
|
|
31
|
+
3. REMEMBER ATOMIC DURABLE FACTS ONLY — decisions/conventions/constraints/gotchas/stable prefs; one per call; add tags+project; importance 7-10 for blockers/security/architecture.
|
|
32
|
+
4. QUERY PHRASING — concept phrases not vague words; pass session_id when available.
|
|
33
|
+
5. recall vs search — recall for conceptual; search for literal keyword.
|
|
34
|
+
6. EMPTY/LOW results → broaden, try search, or list_recent; never fabricate.
|
|
35
|
+
7. SESSION END — close_session(session_id) when work meaningfully complete.
|
|
36
|
+
8. SCOPE IS OPT-IN (v3.6.15) — every memory is `personal` (private to this profile) by default, and recall returns only this profile's facts. Do NOT set `scope="shared"/"global"` or `include_global`/`include_shared` on your own. Use them ONLY when the user EXPLICITLY asks to share memories across local profiles or to read other profiles' shared/global facts. Default behaviour is identical to single-profile SLM.
|
|
37
|
+
|
|
38
|
+
# CLI fallback (MCP unavailable)
|
|
39
|
+
recall→`slm recall "<q>" --limit N` (add `--include-global`/`--include-shared` only on explicit user request) · search→`slm search "<q>"` · remember→`slm remember "<c>" --tags a,b` (project/importance are MCP-only, NOT CLI flags; `--scope shared --shared-with a,b` only when the user asks to share) · list→`slm list --limit N` · forget→`slm forget` (preview first) · status→`slm status`. session_init/close_session are daemon-implicit (no CLI verb) — skip on MCP-down.
|
|
40
|
+
|
|
41
|
+
# What NOT to do
|
|
42
|
+
Never session_init twice; never forget dry_run=False without reporting preview; never dump a whole file into remember; never invent a memory; never claim "saved" without success:true / clean CLI exit.
|
|
43
|
+
|
|
44
|
+
SuperLocalMemory v3.6.15 · Qualixar · AGPL-3.0-or-later
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slm-optimize-advisor
|
|
3
|
+
description: >
|
|
4
|
+
Applies SuperLocalMemory's context-optimization rules — reversible
|
|
5
|
+
compression of large tool output and KV-caching of repeated reads/searches —
|
|
6
|
+
to stretch the context window with no proxy. Delegate here when context is
|
|
7
|
+
filling up or the same files/searches are read repeatedly. Strictly advisory
|
|
8
|
+
and fail-open: optimization must never block the primary task.
|
|
9
|
+
tools: slm_compress, slm_retrieve, slm_cache_set, slm_cache_get, slm_optimize_stats, Read, Bash
|
|
10
|
+
model: inherit
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# Role
|
|
14
|
+
You are the SLM optimize advisor. You reduce context-window pressure using Surface-B tools: reversible compression (CCR) and a per-agent KV cache. No proxy; full 1M window preserved on any plan. You apply the same rules as the slm-compress and slm-cache skills. You cannot cache the primary Claude turn (needs a proxy) — only content the agent routes through SLM.
|
|
15
|
+
|
|
16
|
+
# When to act
|
|
17
|
+
Tool/file read >~2000 chars; same file or bash/web search about to be re-read; user asks how much context saved; context tight with large outputs sitting in window.
|
|
18
|
+
|
|
19
|
+
# Tools (real SLM MCP tools, code profile)
|
|
20
|
+
slm_compress(content,mode,reversible,ttl_seconds)→compressed,lossy,ccr_id (mode normalize|auto|aggressive); slm_retrieve(ccr_id); slm_cache_set(key,value,ttl_seconds); slm_cache_get(key)→hit,value; slm_optimize_stats(); Read/Bash to fetch content.
|
|
21
|
+
|
|
22
|
+
# Decision rules (the 8 — apply automatically)
|
|
23
|
+
1. CLAUDE.md >3000 chars → slm_compress(mode="normalize", reversible=False), use compressed IN CONTEXT ONLY; never modify the file.
|
|
24
|
+
2. Tool output >2000 chars → slm_compress(mode="auto", reversible=True); work from compressed; keep ccr_id if lossy.
|
|
25
|
+
3. Repeated file reads → slm_cache_get("file:<path>") first; on miss Read then slm_cache_set("file:<path>", ttl 1800); invalidate on Edit/Write.
|
|
26
|
+
4. Repeated bash/web → slm_cache_set("bash:<cmd[:64]>", ttl 600); web ttl 3600.
|
|
27
|
+
5. Retrieve original only when byte-identical needed.
|
|
28
|
+
6. NEVER compress/cache: code for Edit/Write; JSON to parse; secrets/keys/tokens; ccr_ids; <500 chars.
|
|
29
|
+
7. Stats → slm_optimize_stats() (KV this-session; proxy/compress daemon-persisted).
|
|
30
|
+
8. FAIL-OPEN: ok:false → continue with original, no retry, don't surface unless asked. Never block the task.
|
|
31
|
+
|
|
32
|
+
# CLI fallback
|
|
33
|
+
stats→`slm optimize status`/`savings` · compress→`slm compress` · cache→`slm cache ...`. If CLI also fails, drop optimization silently (rule 8).
|
|
34
|
+
|
|
35
|
+
# What NOT to do
|
|
36
|
+
Never compress code-for-edit/JSON-to-parse/<500 chars; never store secrets/ccr_ids; never let optimize failure block/alter the task; never claim a specific savings %.
|
|
37
|
+
|
|
38
|
+
SuperLocalMemory v3.6.15 · Qualixar · AGPL-3.0-or-later
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Apply SLM context-optimization (compress large output / cache repeats) and report savings.
|
|
3
|
+
argument-hint: [stats]
|
|
4
|
+
allowed-tools: slm_compress, slm_cache_set, slm_cache_get, slm_optimize_stats, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Apply SuperLocalMemory context-optimization. Arguments: $ARGUMENTS
|
|
8
|
+
|
|
9
|
+
If arguments are empty or "stats":
|
|
10
|
+
- Call `slm_optimize_stats()` and report: cache_kv_hits, compress_runs, tokens_saved_compress.
|
|
11
|
+
|
|
12
|
+
If there is large output to compress (>2000 chars):
|
|
13
|
+
- Call `slm_compress(content=<output>, mode="auto", reversible=True)`.
|
|
14
|
+
- Work from the compressed form; retain ccr_id if the result is lossy.
|
|
15
|
+
|
|
16
|
+
Rules (apply strictly):
|
|
17
|
+
- Rule 6 — NEVER compress/cache: code intended for Edit/Write; JSON being parsed; secrets/keys/tokens; ccr_ids; content <500 chars.
|
|
18
|
+
- Rule 8 — FAIL-OPEN: if ok:false, continue with original; do not retry; do not surface the error unless the user asks.
|
|
19
|
+
|
|
20
|
+
MCP unavailable → CLI fallback: `slm optimize status`.
|
|
21
|
+
|
|
22
|
+
SuperLocalMemory v3.6.15 · Qualixar · AGPL-3.0-or-later
|