superlocalmemory 4.1.22 → 4.1.23

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 (172) hide show
  1. package/.claude-plugin/marketplace.json +2 -2
  2. package/CHANGELOG.md +99 -0
  3. package/README.md +50 -27
  4. package/antigravity-plugin/_GENERATED.md +33 -0
  5. package/antigravity-plugin/agents/slm-governance-advisor.md +78 -0
  6. package/antigravity-plugin/agents/slm-loop-runner.md +82 -0
  7. package/antigravity-plugin/agents/slm-memory-advisor.md +50 -0
  8. package/antigravity-plugin/agents/slm-optimize-advisor.md +44 -0
  9. package/antigravity-plugin/commands/slm-loop.md +33 -0
  10. package/antigravity-plugin/hooks/hooks.json +59 -0
  11. package/antigravity-plugin/hooks.json +42 -0
  12. package/antigravity-plugin/mcp_config.json +14 -0
  13. package/antigravity-plugin/plugin.json +25 -0
  14. package/antigravity-plugin/scripts/antigravity_hook_adapter.py +85 -0
  15. package/antigravity-plugin/skills/slm-bot-memory/SKILL.md +146 -0
  16. package/antigravity-plugin/skills/slm-cache/SKILL.md +147 -0
  17. package/antigravity-plugin/skills/slm-compress/SKILL.md +150 -0
  18. package/antigravity-plugin/skills/slm-getting-started-bot/SKILL.md +146 -0
  19. package/antigravity-plugin/skills/slm-governance/SKILL.md +221 -0
  20. package/antigravity-plugin/skills/slm-graph/SKILL.md +327 -0
  21. package/antigravity-plugin/skills/slm-loop/SKILL.md +153 -0
  22. package/antigravity-plugin/skills/slm-mesh/SKILL.md +287 -0
  23. package/antigravity-plugin/skills/slm-profile/SKILL.md +159 -0
  24. package/antigravity-plugin/skills/slm-recall/SKILL.md +430 -0
  25. package/antigravity-plugin/skills/slm-remember/SKILL.md +370 -0
  26. package/antigravity-plugin/skills/slm-scope/SKILL.md +183 -0
  27. package/antigravity-plugin/skills/slm-session/SKILL.md +291 -0
  28. package/antigravity-plugin/skills/slm-status/SKILL.md +185 -0
  29. package/antigravity-plugin/skills/slm-web-access/SKILL.md +91 -0
  30. package/codex-plugin/.claude-plugin/plugin.json +19 -0
  31. package/codex-plugin/.codex/config.toml +40 -0
  32. package/codex-plugin/.codex-plugin/plugin.json +43 -0
  33. package/codex-plugin/.mcp.json +16 -0
  34. package/codex-plugin/AGENTS.md +161 -0
  35. package/codex-plugin/README.md +205 -0
  36. package/codex-plugin/_GENERATED.md +52 -0
  37. package/codex-plugin/agents/slm-governance-advisor.md +78 -0
  38. package/codex-plugin/agents/slm-loop-runner.md +82 -0
  39. package/codex-plugin/agents/slm-memory-advisor.md +50 -0
  40. package/codex-plugin/agents/slm-optimize-advisor.md +44 -0
  41. package/codex-plugin/commands/slm-loop.md +33 -0
  42. package/codex-plugin/hooks/hooks.json +59 -0
  43. package/codex-plugin/scripts/ensure-venv.bat +108 -0
  44. package/codex-plugin/scripts/ensure-venv.sh +100 -0
  45. package/codex-plugin/scripts/slm-launch +55 -0
  46. package/codex-plugin/scripts/slm-launch.bat +30 -0
  47. package/codex-plugin/skills/slm-bot-memory/SKILL.md +146 -0
  48. package/codex-plugin/skills/slm-cache/SKILL.md +147 -0
  49. package/codex-plugin/skills/slm-compress/SKILL.md +150 -0
  50. package/codex-plugin/skills/slm-getting-started-bot/SKILL.md +146 -0
  51. package/codex-plugin/skills/slm-governance/SKILL.md +221 -0
  52. package/codex-plugin/skills/slm-graph/SKILL.md +327 -0
  53. package/codex-plugin/skills/slm-loop/SKILL.md +153 -0
  54. package/codex-plugin/skills/slm-mesh/SKILL.md +287 -0
  55. package/codex-plugin/skills/slm-profile/SKILL.md +159 -0
  56. package/codex-plugin/skills/slm-recall/SKILL.md +430 -0
  57. package/codex-plugin/skills/slm-remember/SKILL.md +370 -0
  58. package/codex-plugin/skills/slm-scope/SKILL.md +183 -0
  59. package/codex-plugin/skills/slm-session/SKILL.md +291 -0
  60. package/codex-plugin/skills/slm-status/SKILL.md +185 -0
  61. package/codex-plugin/skills/slm-web-access/SKILL.md +91 -0
  62. package/copilot-plugin/.github/agents/slm-governance-advisor.agent.md +80 -0
  63. package/copilot-plugin/.github/agents/slm-loop-runner.agent.md +84 -0
  64. package/copilot-plugin/.github/agents/slm-memory-advisor.agent.md +52 -0
  65. package/copilot-plugin/.github/agents/slm-optimize-advisor.agent.md +46 -0
  66. package/copilot-plugin/.github/copilot-instructions.md +52 -0
  67. package/copilot-plugin/.github/hooks/slm-hooks.json +44 -0
  68. package/copilot-plugin/.github/prompts/slm-bot-memory.prompt.md +147 -0
  69. package/copilot-plugin/.github/prompts/slm-cache.prompt.md +151 -0
  70. package/copilot-plugin/.github/prompts/slm-compress.prompt.md +154 -0
  71. package/copilot-plugin/.github/prompts/slm-getting-started-bot.prompt.md +147 -0
  72. package/copilot-plugin/.github/prompts/slm-governance.prompt.md +224 -0
  73. package/copilot-plugin/.github/prompts/slm-graph.prompt.md +322 -0
  74. package/copilot-plugin/.github/prompts/slm-loop.prompt.md +159 -0
  75. package/copilot-plugin/.github/prompts/slm-mesh.prompt.md +290 -0
  76. package/copilot-plugin/.github/prompts/slm-profile.prompt.md +155 -0
  77. package/copilot-plugin/.github/prompts/slm-recall.prompt.md +434 -0
  78. package/copilot-plugin/.github/prompts/slm-remember.prompt.md +375 -0
  79. package/copilot-plugin/.github/prompts/slm-scope.prompt.md +183 -0
  80. package/copilot-plugin/.github/prompts/slm-session.prompt.md +291 -0
  81. package/copilot-plugin/.github/prompts/slm-status.prompt.md +190 -0
  82. package/copilot-plugin/.github/prompts/slm-web-access.prompt.md +95 -0
  83. package/copilot-plugin/.vscode/mcp.json +11 -0
  84. package/copilot-plugin/README.md +26 -0
  85. package/copilot-plugin/_GENERATED.md +49 -0
  86. package/copilot-plugin/scripts/ensure-venv.bat +122 -0
  87. package/copilot-plugin/scripts/ensure-venv.sh +169 -0
  88. package/copilot-plugin/scripts/slm-launch +207 -0
  89. package/copilot-plugin/scripts/slm-launch.bat +32 -0
  90. package/copilot-plugin/scripts/slm-resolve.sh +128 -0
  91. package/copilot-plugin/scripts/slm-run +76 -0
  92. package/copilot-plugin/scripts/torch-cpu-resolve.sh +86 -0
  93. package/docs/pi-dev-integration.md +0 -2
  94. package/hermes-plugin/README.md +30 -0
  95. package/hermes-plugin/_GENERATED.md +3 -0
  96. package/hermes-plugin/__init__.py +417 -0
  97. package/hermes-plugin/agents/slm-governance-advisor.md +78 -0
  98. package/hermes-plugin/agents/slm-loop-runner.md +82 -0
  99. package/hermes-plugin/agents/slm-memory-advisor.md +50 -0
  100. package/hermes-plugin/agents/slm-optimize-advisor.md +44 -0
  101. package/hermes-plugin/command-inventory.json +7 -0
  102. package/hermes-plugin/plugin.yaml +24 -0
  103. package/hermes-plugin/remote.py +390 -0
  104. package/hermes-plugin/skills/slm-bot-memory/SKILL.md +146 -0
  105. package/hermes-plugin/skills/slm-cache/SKILL.md +147 -0
  106. package/hermes-plugin/skills/slm-compress/SKILL.md +150 -0
  107. package/hermes-plugin/skills/slm-getting-started-bot/SKILL.md +146 -0
  108. package/hermes-plugin/skills/slm-governance/SKILL.md +221 -0
  109. package/hermes-plugin/skills/slm-graph/SKILL.md +327 -0
  110. package/hermes-plugin/skills/slm-loop/SKILL.md +153 -0
  111. package/hermes-plugin/skills/slm-mesh/SKILL.md +287 -0
  112. package/hermes-plugin/skills/slm-profile/SKILL.md +159 -0
  113. package/hermes-plugin/skills/slm-recall/SKILL.md +430 -0
  114. package/hermes-plugin/skills/slm-remember/SKILL.md +370 -0
  115. package/hermes-plugin/skills/slm-scope/SKILL.md +183 -0
  116. package/hermes-plugin/skills/slm-session/SKILL.md +291 -0
  117. package/hermes-plugin/skills/slm-status/SKILL.md +185 -0
  118. package/hermes-plugin/skills/slm-web-access/SKILL.md +91 -0
  119. package/package.json +9 -18
  120. package/plugin/.claude-plugin/plugin.json +1 -1
  121. package/plugin/.cursor-plugin/plugin.json +1 -1
  122. package/plugin/CLAUDE.md +14 -12
  123. package/plugin/agents/slm-governance-advisor.md +14 -16
  124. package/plugin/agents/slm-loop-runner.md +22 -11
  125. package/plugin/agents/slm-memory-advisor.md +14 -14
  126. package/plugin/agents/slm-optimize-advisor.md +5 -5
  127. package/plugin/commands/slm-loop.md +5 -3
  128. package/plugin/cursor-skills/slm-bot-memory/SKILL.md +19 -12
  129. package/plugin/cursor-skills/slm-getting-started-bot/SKILL.md +17 -9
  130. package/plugin/cursor-skills/slm-recall/SKILL.md +151 -54
  131. package/plugin/cursor-skills/slm-remember/SKILL.md +132 -35
  132. package/plugin/cursor-skills/slm-scope/SKILL.md +24 -17
  133. package/plugin/cursor-skills/slm-session/SKILL.md +77 -57
  134. package/plugin/mcp.cursor.json +1 -1
  135. package/plugin/requirements.txt +1 -1
  136. package/plugin/skills/slm-bot-memory/SKILL.md +19 -12
  137. package/plugin/skills/slm-cache/SKILL.md +6 -7
  138. package/plugin/skills/slm-compress/SKILL.md +3 -3
  139. package/plugin/skills/slm-getting-started-bot/SKILL.md +17 -9
  140. package/plugin/skills/slm-governance/SKILL.md +126 -153
  141. package/plugin/skills/slm-graph/SKILL.md +27 -15
  142. package/plugin/skills/slm-loop/SKILL.md +74 -20
  143. package/plugin/skills/slm-mesh/SKILL.md +17 -12
  144. package/plugin/skills/slm-profile/SKILL.md +101 -92
  145. package/plugin/skills/slm-recall/SKILL.md +151 -54
  146. package/plugin/skills/slm-remember/SKILL.md +132 -35
  147. package/plugin/skills/slm-scope/SKILL.md +24 -17
  148. package/plugin/skills/slm-session/SKILL.md +77 -57
  149. package/plugin/skills/slm-status/SKILL.md +54 -35
  150. package/plugin/skills/slm-web-access/SKILL.md +91 -0
  151. package/plugin-src/agents/slm-governance-advisor.md +78 -0
  152. package/plugin-src/agents/slm-loop-runner.md +82 -0
  153. package/plugin-src/agents/slm-memory-advisor.md +14 -14
  154. package/plugin-src/agents/slm-optimize-advisor.md +5 -5
  155. package/plugin-src/commands/slm-loop.md +33 -0
  156. package/plugin-src/rules/AGENTS.md +45 -36
  157. package/plugin-src/rules/CLAUDE.md.fragment +47 -0
  158. package/plugin-src/skills/slm-bot-memory/SKILL.md +19 -12
  159. package/plugin-src/skills/slm-cache/SKILL.md +6 -7
  160. package/plugin-src/skills/slm-compress/SKILL.md +3 -3
  161. package/plugin-src/skills/slm-getting-started-bot/SKILL.md +17 -9
  162. package/plugin-src/skills/slm-governance/SKILL.md +126 -153
  163. package/plugin-src/skills/slm-graph/SKILL.md +27 -15
  164. package/plugin-src/skills/slm-loop/SKILL.md +74 -20
  165. package/plugin-src/skills/slm-mesh/SKILL.md +17 -12
  166. package/plugin-src/skills/slm-profile/SKILL.md +101 -92
  167. package/plugin-src/skills/slm-recall/SKILL.md +151 -54
  168. package/plugin-src/skills/slm-remember/SKILL.md +132 -35
  169. package/plugin-src/skills/slm-scope/SKILL.md +24 -17
  170. package/plugin-src/skills/slm-session/SKILL.md +77 -57
  171. package/plugin-src/skills/slm-status/SKILL.md +54 -35
  172. package/plugin-src/skills/slm-web-access/SKILL.md +91 -0
@@ -0,0 +1,33 @@
1
+ ---
2
+ description: Run a task as a bounded, gate-verified loop backed by SuperLocalMemory — iterate until an independent gate passes, never on the agent's own claim.
3
+ argument-hint: <task that has a checkable acceptance condition (tests, schema, lint, reconciliation)>
4
+ ---
5
+
6
+ Run this task as a **bounded loop** using SuperLocalMemory as the durable ledger:
7
+
8
+ > $ARGUMENTS
9
+
10
+ Delegate the execution to the **slm-loop-runner** agent and follow the
11
+ **slm-loop** skill. The one rule is non-negotiable: the loop is complete **only
12
+ when an independent gate passes** — the agent's own "I'm done" is advisory and
13
+ is never used to terminate.
14
+
15
+ Procedure:
16
+
17
+ 1. **Name the gate.** State the mechanical check that proves this task is done
18
+ (e.g. `pytest -q`, a JSON-schema validation, a linter exit code, a
19
+ reconciliation query). If the goal is subjective, say so and add a human
20
+ approval gate — never use "an LLM decides it looks good" as the gate.
21
+ 2. **State the bounds.** Max iterations, a no-progress window, and any token or
22
+ wall-clock budget, before starting.
23
+ 3. **Iterate.** Each lap: propose a change, then run the gate independently.
24
+ A command gate (tests, schema, lint) you run yourself; SLM does not execute
25
+ commands. To wait for a memory another agent will write, use the
26
+ `slm_loop_run` MCP tool, whose laps persist as queryable SLM memory (tag
27
+ `loop:<name>`); inspect runs with `slm loop history` and
28
+ `slm loop show <run_id>`. `slm loop demo` shows the control flow end to end.
29
+ 4. **Report the exact terminal status** — `DONE` (gate passed + approved),
30
+ `HALT` (a bound tripped), `PAUSE` (approval pending), `KILLED` (kill switch),
31
+ or `ERROR` (runner/gate failed). Never describe a non-DONE outcome as
32
+ success; when halted, name the bound; when errored, quote the short detail
33
+ and the ledger `run_id`.
@@ -0,0 +1,59 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "slm hook mandate 2>/dev/null || true",
9
+ "timeout": 5
10
+ }
11
+ ]
12
+ },
13
+ {
14
+ "hooks": [
15
+ {
16
+ "type": "command",
17
+ "command": "slm hook start 2>/dev/null || true",
18
+ "timeout": 15
19
+ }
20
+ ]
21
+ }
22
+ ],
23
+ "PreToolUse": [
24
+ {
25
+ "matcher": "WebSearch|WebFetch",
26
+ "hooks": [
27
+ {
28
+ "type": "command",
29
+ "command": "slm hook before_web 2>/dev/null || true",
30
+ "timeout": 5
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "PostToolUse": [
36
+ {
37
+ "matcher": "Bash|Read|Write|Edit|Glob|Grep|Agent|WebFetch|WebSearch|NotebookEdit",
38
+ "hooks": [
39
+ {
40
+ "type": "command",
41
+ "command": "slm hook post_tool_outcome 2>/dev/null || true",
42
+ "timeout": 5
43
+ }
44
+ ]
45
+ }
46
+ ],
47
+ "Stop": [
48
+ {
49
+ "hooks": [
50
+ {
51
+ "type": "command",
52
+ "command": "slm hook stop_outcome 2>/dev/null || true",
53
+ "timeout": 10
54
+ }
55
+ ]
56
+ }
57
+ ]
58
+ }
59
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "slm-lifecycle": {
3
+ "PreInvocation": [
4
+ {
5
+ "type": "command",
6
+ "command": "python3 ./scripts/antigravity_hook_adapter.py pre-invocation",
7
+ "timeout": 15
8
+ }
9
+ ],
10
+ "PreToolUse": [
11
+ {
12
+ "matcher": "web_search|web_fetch",
13
+ "hooks": [
14
+ {
15
+ "type": "command",
16
+ "command": "python3 ./scripts/antigravity_hook_adapter.py pre-tool",
17
+ "timeout": 5
18
+ }
19
+ ]
20
+ }
21
+ ],
22
+ "PostToolUse": [
23
+ {
24
+ "matcher": "view_file|write_to_file|replace_file_content|run_command|search_files|web_fetch|web_search|invoke_subagent|generate_image",
25
+ "hooks": [
26
+ {
27
+ "type": "command",
28
+ "command": "python3 ./scripts/antigravity_hook_adapter.py post-tool",
29
+ "timeout": 5
30
+ }
31
+ ]
32
+ }
33
+ ],
34
+ "Stop": [
35
+ {
36
+ "type": "command",
37
+ "command": "python3 ./scripts/antigravity_hook_adapter.py stop",
38
+ "timeout": 10
39
+ }
40
+ ]
41
+ }
42
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "mcpServers": {
3
+ "superlocalmemory": {
4
+ "command": "slm",
5
+ "args": [
6
+ "mcp"
7
+ ],
8
+ "env": {
9
+ "SLM_AGENT_ID": "antigravity",
10
+ "SLM_MCP_PROFILE": "power"
11
+ }
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "superlocalmemory",
3
+ "version": "4.1.23",
4
+ "description": "Local-first agent memory with auditable hybrid retrieval. Remember decisions and recall them by asking, entirely on your machine.",
5
+ "author": {
6
+ "name": "Qualixar",
7
+ "email": "varun.pratap.bhardwaj@gmail.com",
8
+ "url": "https://github.com/qualixar"
9
+ },
10
+ "homepage": "https://qualixar.com",
11
+ "repository": "https://github.com/qualixar/superlocalmemory",
12
+ "license": "AGPL-3.0-or-later",
13
+ "keywords": [
14
+ "memory",
15
+ "mcp",
16
+ "agents",
17
+ "local-first",
18
+ "context-compression"
19
+ ],
20
+ "skills": "./skills/",
21
+ "agents": "./agents/",
22
+ "commands": "./commands/",
23
+ "hooks": "./hooks/hooks.json",
24
+ "mcpServers": "./mcp_config.json"
25
+ }
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env python3
2
+ import json
3
+ import hashlib
4
+ import os
5
+ import subprocess
6
+ import sys
7
+ import tempfile
8
+
9
+
10
+ def payload():
11
+ try:
12
+ value = json.load(sys.stdin)
13
+ return value if isinstance(value, dict) else {}
14
+ except Exception:
15
+ return {}
16
+
17
+
18
+ def slm(action, data):
19
+ workspace_paths = data.get("workspacePaths")
20
+ env = dict(os.environ)
21
+ if isinstance(workspace_paths, list) and workspace_paths and isinstance(workspace_paths[0], str):
22
+ env["CLAUDE_PROJECT_DIR"] = workspace_paths[0]
23
+ try:
24
+ result = subprocess.run(
25
+ ["slm", "hook", action], input=json.dumps(data), text=True,
26
+ capture_output=True, timeout=8, env=env,
27
+ )
28
+ return result.stdout.strip()
29
+ except Exception:
30
+ return ""
31
+
32
+
33
+ def lifecycle_marker(data):
34
+ conversation_id = data.get("conversationId")
35
+ if not isinstance(conversation_id, str) or not conversation_id:
36
+ return None
37
+ digest = hashlib.sha256(conversation_id.encode("utf-8")).hexdigest()[:16]
38
+ return os.path.join(tempfile.gettempdir(), "slm-antigravity-" + digest)
39
+
40
+
41
+ def main():
42
+ event = sys.argv[1] if len(sys.argv) == 2 else ""
43
+ data = payload()
44
+ if event == "pre-invocation":
45
+ marker = lifecycle_marker(data)
46
+ if marker and os.path.exists(marker):
47
+ print(json.dumps({"injectSteps": []}))
48
+ return
49
+ context = "\n\n".join(part for part in (slm("mandate", data), slm("start", data)) if part)
50
+ if marker:
51
+ try:
52
+ with open(marker, "x", encoding="utf-8"):
53
+ pass
54
+ except FileExistsError:
55
+ print(json.dumps({"injectSteps": []}))
56
+ return
57
+ print(json.dumps({"injectSteps": [{"ephemeralMessage": context}]} if context else {"injectSteps": []}))
58
+ elif event == "pre-tool":
59
+ tool_call = data.get("toolCall") if isinstance(data.get("toolCall"), dict) else {}
60
+ slm("before_web", {"tool_input": tool_call.get("args", {})})
61
+ print(json.dumps({"decision": "allow"}))
62
+ elif event == "post-tool":
63
+ tool_call = data.get("toolCall") if isinstance(data.get("toolCall"), dict) else {}
64
+ slm("post_tool_outcome", {
65
+ "tool_name": tool_call.get("name", ""),
66
+ "tool_input": tool_call.get("args", {}),
67
+ "tool_response": data.get("toolResponse", data.get("error", "")),
68
+ })
69
+ print("{}")
70
+ elif event == "stop":
71
+ slm("stop", data)
72
+ slm("stop_outcome", data)
73
+ marker = lifecycle_marker(data)
74
+ if marker:
75
+ try:
76
+ os.remove(marker)
77
+ except OSError:
78
+ pass
79
+ print(json.dumps({"decision": "allow"}))
80
+ else:
81
+ print("{}")
82
+
83
+
84
+ if __name__ == "__main__":
85
+ main()
@@ -0,0 +1,146 @@
1
+ ---
2
+ name: slm-bot-memory
3
+ description: Cross-bot memory on a shared computer (Grok Bot, Cursor plugin, any host where several agents share one machine). Explains agent_id attribution vs. profile/scope access, how to namespace by agent_id + profile + scope, and what must never be written to memory. Read this before the first remember/recall on a new Grok-Bot-style host.
4
+ when_to_use: |
5
+ - First session on a Grok Bot computer or any shared-bot host
6
+ - "Will my other bots see this memory?"
7
+ - "How do I keep this bot's notes separate from that one?"
8
+ - Deciding whether to store something that looks like a secret or personal data
9
+ - Setting up a second bot on a computer that already has SLM configured
10
+ allowed-tools: remember, recall, search, session_init, switch_profile
11
+ ---
12
+
13
+ # slm-bot-memory — Cross-Bot Memory on a Shared Host
14
+
15
+ SuperLocalMemory ships as an MCP server. On a single-user laptop, one bot is
16
+ the only thing talking to it. On a **shared-bot host** — Grok Bot's "one
17
+ computer, shared by all your Bots" model, several Cursor windows, or any
18
+ setup where more than one agent process points at the same install — several
19
+ agents can reach the same memory store at once. This skill is about that
20
+ case: what is actually isolated, what is not, and what must never be written
21
+ regardless.
22
+
23
+ ---
24
+
25
+ ## Three things that sound like isolation and are not the same
26
+
27
+ | Setting | What it controls | Does it hide memories from another bot? |
28
+ |---|---|---|
29
+ | `SLM_AGENT_ID` | **Attribution** — who gets credit for a memory in logs and summaries | **No.** It is metadata, never an authenticated principal (verified in `mcp/agent_context.py`'s own docstring). Any bot that can query the same store can read a memory written under a different `agent_id`. |
30
+ | `SLM_DATA_DIR` (profile root) | **Which database file** the daemon opens | **Yes.** Two bots pointed at different `SLM_DATA_DIR` values have fully separate, independent memory stores — nothing is shared unless you explicitly configure sharing. |
31
+ | `scope` (`personal` / `shared` / `global`, see `slm-scope`) | **Visibility inside one store**, between profiles that share that store | Only the way you set it. `personal` (the default) stays within the writing profile; `shared`/`global` are explicit, user-initiated opt-ins. |
32
+
33
+ A memory profile (the namespace `profile_id` and `switch_profile` select) is not
34
+ a fourth kind of isolation between bots. Any local caller that can name a profile
35
+ can read it, and `switch_profile` moves the active profile for every bot on the
36
+ computer. Treat profiles as organisation, not privacy.
37
+
38
+ The practical rule: **`SLM_AGENT_ID` tells you who wrote something; `SLM_DATA_DIR`
39
+ and `scope` decide who can read it.** If two bots on the same Grok Bot computer
40
+ use the same `SLM_DATA_DIR` (the common case — it is a shared filesystem, and
41
+ nothing in Grok Bot's plugin model points different bots at different data
42
+ directories by default), they see each other's `personal`-scope memories too,
43
+ the same way two terminal sessions on one laptop would. Giving two bots
44
+ different `SLM_AGENT_ID` values does not change that — it only changes whose
45
+ name shows up on the memory.
46
+
47
+ If you need one bot's memories genuinely unreachable from another, that bot
48
+ needs its **own `SLM_DATA_DIR`** (or a store where company mode with roles is
49
+ configured — see `slm-governance`), not just its own `SLM_AGENT_ID` or its own
50
+ profile.
51
+
52
+ ---
53
+
54
+ ## Namespacing that actually works
55
+
56
+ Use all three dimensions together, each for what it is good at:
57
+
58
+ 1. **`agent_id`** (`SLM_AGENT_ID` env, or the `agent_id` parameter on
59
+ `remember`/`recall` directly) — so a human or another agent reading
60
+ `get_memory_summary` or the stored facts later can tell which bot said
61
+ what. Set it to something stable and specific: `grok_bot_support`,
62
+ `grok_bot_release_notes`, not a generic `bot`.
63
+ 2. **`SLM_DATA_DIR`** — the real isolation boundary. One store per bot that
64
+ genuinely needs privacy from the others. A `profile_id` inside a shared store
65
+ groups memories but does not hide them.
66
+ 3. **`scope`** (see `slm-scope`) — inside a store two or more bots
67
+ legitimately share, keep writes `personal` by default and only promote to
68
+ `shared`/`global` when a fact is meant for every bot on that store.
69
+
70
+ ```
71
+ remember(
72
+ content="Deploy window for the support bot is Tue/Thu 14:00-16:00 UTC",
73
+ tags="ops,schedule",
74
+ agent_id="grok_bot_support",
75
+ session_id="<sid>",
76
+ )
77
+ ```
78
+
79
+ ```
80
+ recall(
81
+ query="deploy window",
82
+ agent_id="grok_bot_support",
83
+ session_id="<sid>",
84
+ )
85
+ ```
86
+
87
+ Recall is not filtered by `agent_id` automatically — it is attribution on the
88
+ written record. If you need "only what this bot wrote", pass
89
+ `saved_by="grok_bot_support"` to `recall` (or `--saved-by` on `slm recall`),
90
+ which keeps only memories saved by that agent id. It filters; it does not
91
+ protect, because another bot can leave it out.
92
+
93
+ ---
94
+
95
+ ## What never goes into memory, on any host
96
+
97
+ This is not Grok-Bot-specific — it is the baseline for every SLM host — but
98
+ it matters more here because a shared computer means a shared blast radius if
99
+ it is violated:
100
+
101
+ - **Secrets, API keys, tokens, passwords, certificates.** Never pass them to
102
+ `remember`, even "just this once" or "temporarily." If a fact needs to
103
+ reference that a credential exists, store the *fact of its existence and
104
+ where to rotate it*, never the value.
105
+ - **Personal data about identifiable people** that was not already something
106
+ the user explicitly asked to be remembered about themselves (names,
107
+ emails, addresses, health, financial details of third parties).
108
+ - **Anything from Grok Bot's shared filesystem you did not write yourself**
109
+ and were not asked to remember. "Files are visible to every Bot" on that
110
+ computer (Grok Bot's own docs) — a file being readable is not the same as
111
+ having permission to copy its contents into long-term memory that other
112
+ bots and later sessions will see.
113
+ - **Command-line credentials.** Grok Bot's own docs note these are shared
114
+ across bots on the computer; SLM must not become a second, more durable
115
+ copy of them.
116
+
117
+ If you are unsure whether something is a secret, treat it as one and ask the
118
+ user before storing anything derived from it.
119
+
120
+ ---
121
+
122
+ ## Checklist for a new bot on an existing shared host
123
+
124
+ 1. Confirm `SLM_DATA_DIR` — is this bot meant to share the existing store, or
125
+ does it need its own? (`slm status --json` on the computer shows `data.base_dir`
126
+ and `data.db_path`.)
127
+ 2. Set a specific `SLM_AGENT_ID` for this bot before the first `remember`.
128
+ 3. Read `slm-scope` before writing anything with `scope="shared"` or
129
+ `scope="global"` — those are machine-wide, not just cross-bot.
130
+ 4. Read the "never goes into memory" list above once, out loud if you are
131
+ unsure, before the first write on this host.
132
+
133
+ ---
134
+
135
+ ## Related skills
136
+
137
+ - `slm-getting-started-bot` — first-session setup for a headless bot host
138
+ - `slm-scope` — the personal/shared/global visibility model this skill
139
+ namespaces on top of
140
+ - `slm-profile` — memory profiles versus tool sets, and what switching does
141
+ - `slm-governance` — role-based access when a store has multiple human/bot
142
+ members and real access control, not just convention
143
+
144
+ ---
145
+
146
+ *SuperLocalMemory v4.1.23 · Qualixar · AGPL-3.0-or-later*
@@ -0,0 +1,147 @@
1
+ ---
2
+ name: slm-cache
3
+ description: KV cache for repeated reads — call slm_cache_get(key) first; on a miss do the expensive operation then slm_cache_set(key, value, ttl_seconds) to store it; on a hit use the returned value directly; always fail-open (hit:false on any error, never raises); saves tokens when the same file, query result, or tool output is read more than once in a session.
4
+ when_to_use: "cache file, avoid re-reading, repeated read, cache result, cache tool output, save re-read, reuse across session, cache check, cache hit, cache miss"
5
+ allowed-tools: slm_cache_set, slm_cache_get, Bash
6
+ ---
7
+
8
+ # slm-cache — KV Cache for Repeated Reads (Surface B)
9
+
10
+ ## Purpose
11
+
12
+ When the same file, query result, or expensive tool output is needed more than once in a session, fetching it again wastes tokens and time. `slm_cache_set` stores a result under a stable key; `slm_cache_get` retrieves it on subsequent calls. The cache is agent-scoped (automatically namespaced by tenant/agent ID), TTL-bounded, and fail-open.
13
+
14
+ This is an agent-routed cache — it caches results the agent explicitly routes through SLM. It cannot cache Claude conversation turns.
15
+
16
+ ## Tool: slm_cache_set
17
+
18
+ ```
19
+ slm_cache_set(
20
+ key: str, # required — cache key (max 512 chars)
21
+ value: str, # required — value to store (max 1 MB)
22
+ ttl_seconds: int = 86400, # time-to-live in seconds (default 24 h)
23
+ ) -> dict
24
+ ```
25
+
26
+ ### Return dict
27
+
28
+ | Key | Type | Meaning |
29
+ |-----|------|---------|
30
+ | `ok` | bool | `True` on success; `False` on validation error or internal error |
31
+ | `stored` | bool | `True` when the value was written to the cache |
32
+ | `note` | str \| None | Error detail or `None` on success |
33
+
34
+ Keys are SHA-256-hashed internally per agent so they do not collide across agents. The raw key string you supply is the only handle you need. The namespace is the calling agent (`SLM_AGENT_ID`, or the `/mcp/<agent>` path), not the memory profile, so switching profiles does not give you a fresh cache. A caller on another computer gets its own namespace, keyed by its access key, and can never see a local agent's entries.
35
+
36
+ ## Tool: slm_cache_get
37
+
38
+ ```
39
+ slm_cache_get(
40
+ key: str, # required — same key used in slm_cache_set
41
+ ) -> dict
42
+ ```
43
+
44
+ ### Return dict
45
+
46
+ | Key | Type | Meaning |
47
+ |-----|------|---------|
48
+ | `ok` | bool | `True` on clean execution (including miss); `False` on internal error |
49
+ | `hit` | bool | `True` when the key exists and has not expired |
50
+ | `value` | str \| None | The stored value on a hit; `None` on miss |
51
+ | `note` | str \| None | Error detail or `None` |
52
+
53
+ `value` is the string you stored. A miss returns `{"ok": true, "hit": false, "value": null, "note": null}`. `ok: false` means something went wrong internally but the miss behaviour is the same — treat both as a cache miss and proceed with the real fetch.
54
+
55
+ ## Standard Pattern: Cache-Aside
56
+
57
+ Always check the cache first, then fill on miss:
58
+
59
+ ```python
60
+ # 1. Check cache
61
+ cached = await slm_cache_get(key="file:/absolute/path/to/config.json")
62
+
63
+ if cached["hit"]:
64
+ content = cached["value"]
65
+ else:
66
+ # 2. Expensive operation (file read, search, API call)
67
+ content = read_file("/absolute/path/to/config.json")
68
+
69
+ # 3. Store for the rest of the session
70
+ await slm_cache_set(
71
+ key="file:/absolute/path/to/config.json",
72
+ value=content,
73
+ ttl_seconds=3600, # 1 h — adjust to data volatility
74
+ )
75
+
76
+ # 4. Use content
77
+ ```
78
+
79
+ ## Key Naming Convention
80
+
81
+ Use a stable, human-readable prefix so keys are recognisable in stats and won't collide accidentally:
82
+
83
+ | Content type | Suggested prefix | Example |
84
+ |---|---|---|
85
+ | File read | `file:` | `file:/repo/src/config.py` |
86
+ | Search result | `search:` | `search:recall:session_init_context` |
87
+ | Tool output | `tool:` | `tool:build_code_graph:/repo` |
88
+ | External fetch | `url:` | `url:https://api.example.com/v1/data` |
89
+
90
+ Key length cap: 512 characters. Keys longer than that are rejected (`ok: false`).
91
+
92
+ ## When Caching Pays Off
93
+
94
+ **Cache when:**
95
+ - You will read the same file more than once in a session.
96
+ - A search or recall result is reused across multiple reasoning steps.
97
+ - An expensive MCP tool call (graph build, semantic search) produces output that is stable for the session duration.
98
+
99
+ **Do NOT cache:**
100
+ - Volatile data (live API responses that change minute-to-minute, current timestamps, streaming output).
101
+ - Secrets, credentials, tokens, or `ccr_id` values (CCR already handles its own storage).
102
+ - Data that must be fresh for correctness — a stale cache is worse than a cache miss.
103
+ - Intermediate scratchpad text you will discard.
104
+
105
+ ## Fail-Open Guarantee
106
+
107
+ Neither tool raises an exception. On any internal error:
108
+
109
+ - `slm_cache_get` returns `{"ok": false, "hit": false, "value": null, ...}` — treat as a miss and proceed with the real fetch.
110
+ - `slm_cache_set` returns `{"ok": false, "stored": false, ...}` — log the note if useful, but continue; the value is still available in memory this step.
111
+
112
+ Never block a task on a cache failure.
113
+
114
+ ## TTL Guidance
115
+
116
+ | Data type | Suggested TTL |
117
+ |---|---|
118
+ | Static config / generated file | 86400 s (24 h — the default) |
119
+ | Session-specific tool output | 3600 s (1 h) |
120
+ | Rapidly changing API data | Do not cache, or 60–300 s |
121
+
122
+ Set `ttl_seconds` to match how long the data remains valid. After expiry `slm_cache_get` returns a miss automatically.
123
+
124
+ ## Secondary CLI (fallback when MCP is unavailable)
125
+
126
+ Prefer the MCP tools above. If you must use the command line:
127
+
128
+ ```bash
129
+ slm cache status [--json] [--tenant default]
130
+ slm cache clear [--json] [--tenant default]
131
+ slm cache invalidate --tag <tag> [--json] [--tenant default]
132
+ slm cache ttl --set <seconds> [--semantic <seconds>] [--json] [--tenant default]
133
+ slm cache semantic on|off [--json] [--tenant default]
134
+ ```
135
+
136
+ These subcommands control daemon-level cache settings and bulk removal. They do not read or write individual entries — use the MCP tools for that. Entries written by `slm_cache_set` carry the tag `mcp-kv`, so `slm cache invalidate --tag mcp-kv` removes them, and `slm cache clear` deletes every entry for the tenant.
137
+
138
+ ---
139
+
140
+ ## Related skills
141
+
142
+ - `slm-compress` — for large content reduction; cache and compress work together
143
+ - `slm-status` — view `cache_kv_hits`/`cache_kv_misses` counters (daemon-persisted totals) from `slm_optimize_stats`
144
+
145
+ ---
146
+
147
+ SuperLocalMemory v4.1.23 · Qualixar · AGPL-3.0-or-later