superlocalmemory 4.2.4 → 4.2.6

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 (202) hide show
  1. package/.claude-plugin/marketplace.json +3 -3
  2. package/.cursor-plugin/marketplace.json +29 -0
  3. package/CHANGELOG.md +165 -0
  4. package/README.md +48 -7
  5. package/antigravity-plugin/_GENERATED.md +1 -1
  6. package/antigravity-plugin/agents/slm-governance-advisor.md +1 -1
  7. package/antigravity-plugin/agents/slm-loop-runner.md +1 -1
  8. package/antigravity-plugin/agents/slm-memory-advisor.md +1 -1
  9. package/antigravity-plugin/agents/slm-optimize-advisor.md +1 -1
  10. package/antigravity-plugin/mcp_config.json +1 -2
  11. package/antigravity-plugin/plugin.json +1 -1
  12. package/antigravity-plugin/skills/slm-bot-memory/SKILL.md +1 -1
  13. package/antigravity-plugin/skills/slm-cache/SKILL.md +1 -1
  14. package/antigravity-plugin/skills/slm-compress/SKILL.md +1 -1
  15. package/antigravity-plugin/skills/slm-getting-started-bot/SKILL.md +1 -1
  16. package/antigravity-plugin/skills/slm-governance/SKILL.md +4 -2
  17. package/antigravity-plugin/skills/slm-graph/SKILL.md +7 -13
  18. package/antigravity-plugin/skills/slm-loop/SKILL.md +1 -1
  19. package/antigravity-plugin/skills/slm-media/SKILL.md +1 -1
  20. package/antigravity-plugin/skills/slm-mesh/SKILL.md +1 -1
  21. package/antigravity-plugin/skills/slm-profile/SKILL.md +21 -18
  22. package/antigravity-plugin/skills/slm-recall/SKILL.md +1 -1
  23. package/antigravity-plugin/skills/slm-remember/SKILL.md +1 -1
  24. package/antigravity-plugin/skills/slm-scope/SKILL.md +1 -1
  25. package/antigravity-plugin/skills/slm-session/SKILL.md +1 -1
  26. package/antigravity-plugin/skills/slm-status/SKILL.md +1 -1
  27. package/codex-plugin/.claude-plugin/plugin.json +1 -1
  28. package/codex-plugin/.codex-plugin/plugin.json +7 -3
  29. package/codex-plugin/AGENTS.md +1 -1
  30. package/codex-plugin/README.md +2 -2
  31. package/codex-plugin/_GENERATED.md +2 -1
  32. package/codex-plugin/agents/slm-governance-advisor.md +1 -1
  33. package/codex-plugin/agents/slm-loop-runner.md +1 -1
  34. package/codex-plugin/agents/slm-memory-advisor.md +1 -1
  35. package/codex-plugin/agents/slm-optimize-advisor.md +1 -1
  36. package/codex-plugin/skills/slm-bot-memory/SKILL.md +1 -1
  37. package/codex-plugin/skills/slm-cache/SKILL.md +1 -1
  38. package/codex-plugin/skills/slm-compress/SKILL.md +1 -1
  39. package/codex-plugin/skills/slm-getting-started-bot/SKILL.md +1 -1
  40. package/codex-plugin/skills/slm-governance/SKILL.md +4 -2
  41. package/codex-plugin/skills/slm-graph/SKILL.md +7 -13
  42. package/codex-plugin/skills/slm-loop/SKILL.md +1 -1
  43. package/codex-plugin/skills/slm-media/SKILL.md +1 -1
  44. package/codex-plugin/skills/slm-mesh/SKILL.md +1 -1
  45. package/codex-plugin/skills/slm-profile/SKILL.md +21 -18
  46. package/codex-plugin/skills/slm-recall/SKILL.md +1 -1
  47. package/codex-plugin/skills/slm-remember/SKILL.md +1 -1
  48. package/codex-plugin/skills/slm-scope/SKILL.md +1 -1
  49. package/codex-plugin/skills/slm-session/SKILL.md +1 -1
  50. package/codex-plugin/skills/slm-status/SKILL.md +1 -1
  51. package/copilot-plugin/.github/agents/slm-governance-advisor.agent.md +2 -2
  52. package/copilot-plugin/.github/agents/slm-loop-runner.agent.md +2 -2
  53. package/copilot-plugin/.github/agents/slm-memory-advisor.agent.md +2 -2
  54. package/copilot-plugin/.github/agents/slm-optimize-advisor.agent.md +2 -2
  55. package/copilot-plugin/.github/copilot-instructions.md +4 -4
  56. package/copilot-plugin/.github/prompts/slm-bot-memory.prompt.md +2 -2
  57. package/copilot-plugin/.github/prompts/slm-cache.prompt.md +2 -2
  58. package/copilot-plugin/.github/prompts/slm-compress.prompt.md +2 -2
  59. package/copilot-plugin/.github/prompts/slm-getting-started-bot.prompt.md +2 -2
  60. package/copilot-plugin/.github/prompts/slm-governance.prompt.md +5 -3
  61. package/copilot-plugin/.github/prompts/slm-graph.prompt.md +8 -14
  62. package/copilot-plugin/.github/prompts/slm-loop.prompt.md +2 -2
  63. package/copilot-plugin/.github/prompts/slm-media.prompt.md +2 -2
  64. package/copilot-plugin/.github/prompts/slm-mesh.prompt.md +2 -2
  65. package/copilot-plugin/.github/prompts/slm-profile.prompt.md +22 -19
  66. package/copilot-plugin/.github/prompts/slm-recall.prompt.md +2 -2
  67. package/copilot-plugin/.github/prompts/slm-remember.prompt.md +2 -2
  68. package/copilot-plugin/.github/prompts/slm-scope.prompt.md +2 -2
  69. package/copilot-plugin/.github/prompts/slm-session.prompt.md +2 -2
  70. package/copilot-plugin/.github/prompts/slm-status.prompt.md +2 -2
  71. package/copilot-plugin/.github/prompts/slm-web-access.prompt.md +1 -1
  72. package/copilot-plugin/README.md +2 -2
  73. package/copilot-plugin/_GENERATED.md +3 -3
  74. package/{plugin → cursor-plugin}/.cursor-plugin/plugin.json +3 -3
  75. package/cursor-plugin/LICENSE +24 -0
  76. package/cursor-plugin/assets/logo.svg +36 -0
  77. package/{plugin → cursor-plugin}/cursor-skills/slm-bot-memory/SKILL.md +1 -1
  78. package/cursor-plugin/cursor-skills/slm-cache/SKILL.md +147 -0
  79. package/cursor-plugin/cursor-skills/slm-compress/SKILL.md +150 -0
  80. package/{plugin → cursor-plugin}/cursor-skills/slm-getting-started-bot/SKILL.md +1 -1
  81. package/cursor-plugin/cursor-skills/slm-governance/SKILL.md +279 -0
  82. package/cursor-plugin/cursor-skills/slm-graph/SKILL.md +321 -0
  83. package/cursor-plugin/cursor-skills/slm-loop/SKILL.md +174 -0
  84. package/cursor-plugin/cursor-skills/slm-media/SKILL.md +340 -0
  85. package/cursor-plugin/cursor-skills/slm-mesh/SKILL.md +389 -0
  86. package/cursor-plugin/cursor-skills/slm-profile/SKILL.md +167 -0
  87. package/{plugin → cursor-plugin}/cursor-skills/slm-recall/SKILL.md +1 -1
  88. package/{plugin → cursor-plugin}/cursor-skills/slm-remember/SKILL.md +1 -1
  89. package/{plugin → cursor-plugin}/cursor-skills/slm-scope/SKILL.md +1 -1
  90. package/{plugin → cursor-plugin}/cursor-skills/slm-session/SKILL.md +1 -1
  91. package/cursor-plugin/cursor-skills/slm-status/SKILL.md +231 -0
  92. package/cursor-plugin/cursor-skills/slm-web-access/SKILL.md +179 -0
  93. package/{plugin → cursor-plugin}/mcp.cursor.json +1 -2
  94. package/hermes-plugin/__init__.py +39 -7
  95. package/hermes-plugin/agents/slm-governance-advisor.md +1 -1
  96. package/hermes-plugin/agents/slm-loop-runner.md +1 -1
  97. package/hermes-plugin/agents/slm-memory-advisor.md +1 -1
  98. package/hermes-plugin/agents/slm-optimize-advisor.md +1 -1
  99. package/hermes-plugin/command-inventory.json +2 -2
  100. package/hermes-plugin/plugin.yaml +2 -2
  101. package/hermes-plugin/skills/slm-bot-memory/SKILL.md +1 -1
  102. package/hermes-plugin/skills/slm-cache/SKILL.md +1 -1
  103. package/hermes-plugin/skills/slm-compress/SKILL.md +1 -1
  104. package/hermes-plugin/skills/slm-getting-started-bot/SKILL.md +1 -1
  105. package/hermes-plugin/skills/slm-governance/SKILL.md +4 -2
  106. package/hermes-plugin/skills/slm-graph/SKILL.md +7 -13
  107. package/hermes-plugin/skills/slm-loop/SKILL.md +1 -1
  108. package/hermes-plugin/skills/slm-media/SKILL.md +1 -1
  109. package/hermes-plugin/skills/slm-mesh/SKILL.md +1 -1
  110. package/hermes-plugin/skills/slm-profile/SKILL.md +21 -18
  111. package/hermes-plugin/skills/slm-recall/SKILL.md +1 -1
  112. package/hermes-plugin/skills/slm-remember/SKILL.md +1 -1
  113. package/hermes-plugin/skills/slm-scope/SKILL.md +1 -1
  114. package/hermes-plugin/skills/slm-session/SKILL.md +1 -1
  115. package/hermes-plugin/skills/slm-status/SKILL.md +1 -1
  116. package/ide/configs/copilot-cli-mcp.json +17 -0
  117. package/ide/configs/grok-cli-mcp.toml +11 -0
  118. package/ide/configs/muse-mcp.json +16 -0
  119. package/ide/configs/openclaw-mcp.json +15 -0
  120. package/muse-plugin/.claude-plugin/plugin.json +20 -0
  121. package/muse-plugin/LICENSE +663 -0
  122. package/muse-plugin/README.md +44 -0
  123. package/muse-plugin/_GENERATED.md +3 -0
  124. package/muse-plugin/agents/slm-governance-advisor.md +84 -0
  125. package/muse-plugin/agents/slm-loop-runner.md +82 -0
  126. package/muse-plugin/agents/slm-memory-advisor.md +54 -0
  127. package/muse-plugin/agents/slm-optimize-advisor.md +44 -0
  128. package/muse-plugin/commands/slm-loop.md +33 -0
  129. package/muse-plugin/hooks/hooks.json +102 -0
  130. package/muse-plugin/requirements-cpu-torch.txt +13 -0
  131. package/muse-plugin/requirements.txt +1 -0
  132. package/muse-plugin/scripts/ensure-venv.bat +122 -0
  133. package/muse-plugin/scripts/ensure-venv.sh +169 -0
  134. package/muse-plugin/scripts/slm-launch +207 -0
  135. package/muse-plugin/scripts/slm-launch.bat +32 -0
  136. package/muse-plugin/scripts/slm-resolve.sh +128 -0
  137. package/muse-plugin/scripts/slm-run +76 -0
  138. package/muse-plugin/scripts/torch-cpu-resolve.sh +86 -0
  139. package/muse-plugin/skills/slm-bot-memory/SKILL.md +180 -0
  140. package/muse-plugin/skills/slm-cache/SKILL.md +146 -0
  141. package/muse-plugin/skills/slm-compress/SKILL.md +149 -0
  142. package/muse-plugin/skills/slm-getting-started-bot/SKILL.md +196 -0
  143. package/muse-plugin/skills/slm-governance/SKILL.md +278 -0
  144. package/muse-plugin/skills/slm-graph/SKILL.md +320 -0
  145. package/muse-plugin/skills/slm-loop/SKILL.md +173 -0
  146. package/muse-plugin/skills/slm-media/SKILL.md +339 -0
  147. package/muse-plugin/skills/slm-mesh/SKILL.md +388 -0
  148. package/muse-plugin/skills/slm-profile/SKILL.md +166 -0
  149. package/muse-plugin/skills/slm-recall/SKILL.md +517 -0
  150. package/muse-plugin/skills/slm-remember/SKILL.md +374 -0
  151. package/muse-plugin/skills/slm-scope/SKILL.md +182 -0
  152. package/muse-plugin/skills/slm-session/SKILL.md +290 -0
  153. package/muse-plugin/skills/slm-status/SKILL.md +230 -0
  154. package/muse-plugin/skills/slm-web-access/SKILL.md +178 -0
  155. package/package.json +6 -2
  156. package/plugin/.claude-plugin/plugin.json +4 -2
  157. package/plugin/LICENSE +663 -0
  158. package/plugin/README.md +44 -0
  159. package/plugin/agents/slm-governance-advisor.md +1 -1
  160. package/plugin/agents/slm-loop-runner.md +1 -1
  161. package/plugin/agents/slm-memory-advisor.md +1 -1
  162. package/plugin/agents/slm-optimize-advisor.md +1 -1
  163. package/plugin/hooks/hooks.json +1 -1
  164. package/plugin/requirements.txt +1 -1
  165. package/plugin/skills/slm-bot-memory/SKILL.md +1 -1
  166. package/plugin/skills/slm-cache/SKILL.md +1 -1
  167. package/plugin/skills/slm-compress/SKILL.md +1 -1
  168. package/plugin/skills/slm-getting-started-bot/SKILL.md +1 -1
  169. package/plugin/skills/slm-governance/SKILL.md +4 -2
  170. package/plugin/skills/slm-graph/SKILL.md +7 -13
  171. package/plugin/skills/slm-loop/SKILL.md +1 -1
  172. package/plugin/skills/slm-media/SKILL.md +1 -1
  173. package/plugin/skills/slm-mesh/SKILL.md +1 -1
  174. package/plugin/skills/slm-profile/SKILL.md +21 -18
  175. package/plugin/skills/slm-recall/SKILL.md +1 -1
  176. package/plugin/skills/slm-remember/SKILL.md +1 -1
  177. package/plugin/skills/slm-scope/SKILL.md +1 -1
  178. package/plugin/skills/slm-session/SKILL.md +1 -1
  179. package/plugin/skills/slm-status/SKILL.md +1 -1
  180. package/plugin-src/agents/slm-governance-advisor.md +1 -1
  181. package/plugin-src/agents/slm-loop-runner.md +1 -1
  182. package/plugin-src/agents/slm-memory-advisor.md +1 -1
  183. package/plugin-src/agents/slm-optimize-advisor.md +1 -1
  184. package/plugin-src/rules/AGENTS.md +1 -1
  185. package/plugin-src/rules/CLAUDE.md.fragment +3 -3
  186. package/plugin-src/skills/slm-bot-memory/SKILL.md +1 -1
  187. package/plugin-src/skills/slm-cache/SKILL.md +1 -1
  188. package/plugin-src/skills/slm-compress/SKILL.md +1 -1
  189. package/plugin-src/skills/slm-getting-started-bot/SKILL.md +1 -1
  190. package/plugin-src/skills/slm-governance/SKILL.md +4 -2
  191. package/plugin-src/skills/slm-graph/SKILL.md +7 -13
  192. package/plugin-src/skills/slm-loop/SKILL.md +1 -1
  193. package/plugin-src/skills/slm-media/SKILL.md +1 -1
  194. package/plugin-src/skills/slm-mesh/SKILL.md +1 -1
  195. package/plugin-src/skills/slm-profile/SKILL.md +21 -18
  196. package/plugin-src/skills/slm-recall/SKILL.md +1 -1
  197. package/plugin-src/skills/slm-remember/SKILL.md +1 -1
  198. package/plugin-src/skills/slm-scope/SKILL.md +1 -1
  199. package/plugin-src/skills/slm-session/SKILL.md +1 -1
  200. package/plugin-src/skills/slm-status/SKILL.md +1 -1
  201. package/plugin/CLAUDE.md +0 -56
  202. /package/{plugin/assets/logo.svg → codex-plugin/assets/icon.svg} +0 -0
@@ -0,0 +1,279 @@
1
+ ---
2
+ name: slm-governance
3
+ description: Governed-workspace behavior for SuperLocalMemory. Covers roles (admin/member/viewer) and company mode, who administers a company-mode workspace (a signed-in admin, or `slm team` on the SLM computer), `slm token show` in strict mode, what remote web apps can never see or change, retention and lifecycle settings, the audit trail, GDPR export and erasure, and how agents must behave when operating under workspace governance. The audit and retention tools need the power MCP profile. Agents must never bypass governance controls.
4
+ when_to_use: |
5
+ - "What can I do in this workspace?" (role check)
6
+ - "Move cold memories to archive after 60 days"
7
+ - "Show the audit trail for recent memory operations"
8
+ - "Export my data for GDPR compliance"
9
+ - "Delete all memories about user X (right to erasure)"
10
+ - "Turn on require-login for this workspace", "I'm locked out of company mode", slm team status
11
+ - "The dashboard asks for a key" (slm token show)
12
+ - Enterprise deployment with multi-team shared SLM
13
+ - Compliance, audit, or data governance task
14
+ allowed-tools: audit_trail, set_retention_policy, get_retention_stats, get_lifecycle_status, compact_memories, consistency_check, recall, search, remember, Bash
15
+ ---
16
+
17
+ # slm-governance — Governed Workspace Behavior
18
+
19
+ SuperLocalMemory can run with named users and roles per workspace (company
20
+ mode), keeps a compliance audit trail, applies a retention lifecycle, and ships
21
+ GDPR export and erasure commands. This skill documents how an agent must behave
22
+ in a governed workspace and what the governance tools really do. The MCP audit
23
+ and retention tools are in the `power` tool set, not the default: if they are
24
+ missing, tell the user to run `slm tools set power` and restart this app (see
25
+ `slm-profile`). The `slm gdpr` and `slm team` commands work either way.
26
+
27
+ ---
28
+
29
+ ## Role model
30
+
31
+ By default SLM is single-user: whoever runs it is the owner and nothing asks for
32
+ a login. Company mode adds named users, each with one role per workspace
33
+ (profile). A role in one workspace grants nothing in another.
34
+
35
+ | Role | Read | Write | Share (`shared`/`global` writes) | Delete | Manage users and settings |
36
+ |------|------|-------|-------|--------|-----------------|
37
+ | `viewer` | Yes | No | No | No | No |
38
+ | `member` | Yes | Yes | Yes | No | No |
39
+ | `admin` | Yes | Yes | Yes | Yes | Yes |
40
+
41
+ **Agent behavior by role:**
42
+
43
+ - **Viewer**: Only call `recall`, `search`, `fetch`, `list_recent` and other
44
+ reads. Never call `remember`, `update_memory`, `delete_memory` or any write
45
+ tool. If a write is refused, say so: "This workspace is read-only for my role."
46
+ - **Member**: May write memories, including `scope="shared"` and `scope="global"`
47
+ when the user explicitly asks for them. May not delete memories or change
48
+ users, roles or settings.
49
+ - **Admin**: Everything above plus deletion and user administration.
50
+
51
+ No MCP tool or `slm` command reports your role (only a signed-in dashboard session can ask the daemon, at `GET /api/rbac/whoami`). Do not guess it: attempt
52
+ what the user asked and treat a permission refusal as final. Setting up users,
53
+ roles and "Require login" is done in the dashboard under **Settings → Access**;
54
+ there is no `slm user` or `slm role` command. The only company-mode commands
55
+ are `slm team status` and `slm team policy` (next section).
56
+
57
+ Roles apply to every route that touches data, not only to `remember` and
58
+ `recall`. That includes pictures, documents, connected folders and
59
+ turning features on: reading a file by path, connecting a folder
60
+ (`slm sources add`), turning on pictures and documents and cleaning up with
61
+ `slm media gc --apply` or `slm media repair` need the owner or an admin. SLM's
62
+ own data folder can never be named as a path or a source. With login
63
+ required, every page of data (export, compliance records, profiles, learning
64
+ and trust details) needs a signed-in user; a test walks every route so a new
65
+ one cannot slip through.
66
+
67
+ ---
68
+
69
+ ## Who administers a company-mode workspace
70
+
71
+ While users are enrolled and login is required, the install token or an API
72
+ key alone no longer administers the workspace: any local program can fetch the
73
+ install token, so it would let anyone switch company mode off. Administration
74
+ needs one of these:
75
+
76
+ - **A signed-in admin** (a user with the `admin` role on that workspace),
77
+ through the dashboard.
78
+ - **`slm team` on the SLM computer**, which uses a private capability file that
79
+ only the user running SLM can read, so the owner can never be locked out
80
+ even if every admin is:
81
+
82
+ ```bash
83
+ slm team status # "Require login: on. Users: N." (read-only, safe)
84
+ slm team policy --require-login on # every user signs in
85
+ slm team policy --require-login off # the machine owner is the user again
86
+ ```
87
+
88
+ Run them as the same user that runs SLM, with the daemon running. Otherwise the
89
+ daemon refuses them. Users, roles and sessions are kept when login is turned
90
+ off. Switching the requirement off lowers protection for everyone, so do it
91
+ only when the user asks for it in this conversation; `slm team status` first.
92
+ With no users enrolled yet, the machine owner can still create the first
93
+ administrator.
94
+
95
+ ### Strict mode: `slm token show`
96
+
97
+ With `SLM_REQUIRE_CREDENTIALS=1`, the dashboard is not handed the SLM key; the
98
+ person pastes it into a one-time box. `slm token show` prints that key. It is a
99
+ secret that opens write access: do not run it on your own, never paste it into
100
+ chat, a memory or a log, and tell the user to run it in their own terminal.
101
+ `slm rotate-token` replaces it (then `slm restart`).
102
+
103
+ ### What remote web apps can never do
104
+
105
+ A connected web app (see `slm-web-access`) cannot correct, delete, share or
106
+ switch profile, cannot read another profile, and cannot change, delete, pin or
107
+ replace a memory it is not allowed to see: it is answered as if that memory did
108
+ not exist. It never sees memories that came from a connected folder, and sees
109
+ a picture or page only when its text held no secret or personal data.
110
+
111
+ ---
112
+
113
+ ## require-login
114
+
115
+ When login is required, every operation on memories needs a signed-in user,
116
+ including the connection your assistant uses. SLM handles this at the daemon
117
+ level; agents do not pass credentials in tool calls. If a tool call returns an
118
+ authentication or permission error, you must:
119
+
120
+ 1. Stop the current operation immediately.
121
+ 2. Report the requirement to the user.
122
+ 3. Never cache, retry, or work around the block.
123
+
124
+ In this mode, `include_global=True` and `include_shared=True` on `recall` are
125
+ quietly turned off while the recall policy forbids cross-profile reads (the
126
+ default), so an opt-in recall can come back with only personal facts. Do not try
127
+ to work around it. See `slm-scope`.
128
+
129
+ ---
130
+
131
+ ## Retention and lifecycle
132
+
133
+ Every memory moves through lifecycle states as it goes unused: active, warm, cold,
134
+ archived. Two tools set and inspect that, and a third runs the forgetting cycle.
135
+ They need the `power` tool set.
136
+
137
+ ### Set the thresholds
138
+
139
+ ```
140
+ set_retention_policy(
141
+ cold_after_days: int = 30, # days of inactivity before a memory goes cold
142
+ archive_after_days: int = 90, # days before it is archived
143
+ )
144
+ ```
145
+
146
+ It sets two thresholds and returns them. There is no `profile_id` argument and
147
+ there are no named retention zones or per-tag policies; tagging a memory does not
148
+ route it to a different policy.
149
+
150
+ ### Look at the state
151
+
152
+ ```
153
+ get_retention_stats(profile_id="")
154
+ get_lifecycle_status(limit=50, profile_id="")
155
+ ```
156
+
157
+ `get_retention_stats` reports, from the retention table, the count and average
158
+ retention score per Ebbinghaus zone (`active`, `warm`, `cold`, `archive`,
159
+ `forgotten`) and the totals. `get_lifecycle_status` counts the active, warm, cold
160
+ and archived state of up to `limit` memories and returns up to ten short
161
+ samples of each. Neither says when the next cycle runs.
162
+
163
+ ### Apply it
164
+
165
+ ```
166
+ forget(dry_run=True) # preview the decay cycle for the active profile
167
+ compact_memories(dry_run=True) # preview lifecycle-state transitions
168
+ ```
169
+
170
+ The MCP `forget` tool is not a delete: it recomputes retention scores and moves
171
+ memories between zones. `compact_memories` moves memories whose lifecycle state
172
+ has become due (for example cold to archived); it does not merge duplicates. Both
173
+ default to a dry run. Run the preview first, show it to the user, and only then
174
+ pass `dry_run=False`. Do not run either without the user's say-so.
175
+
176
+ ---
177
+
178
+ ## Audit trail
179
+
180
+ ```
181
+ audit_trail(limit: int = 50)
182
+ ```
183
+
184
+ Returns the newest `limit` rows of the compliance audit for the active profile,
185
+ as `{"success", "entries", "count"}`. Each entry has `audit_id`, `profile_id`,
186
+ `action`, `target_type`, `target_id`, `details` and `timestamp`. There are no
187
+ filter arguments. Entries are compliance actions (store, retrieve, delete, export
188
+ and the like).
189
+
190
+ Use it for compliance reviews, for investigating an unexpected change, and for
191
+ audit reports to a data controller.
192
+
193
+ ---
194
+
195
+ ## GDPR
196
+
197
+ ```bash
198
+ slm gdpr status [--profile P] [--json] # posture: receipts, audit counts, known gaps; read-only
199
+ slm gdpr export --profile P [--output FILE] [--json] # Art. 15/20 access and portability
200
+ slm gdpr erase --profile P --dry-run [--json] # preview an erasure
201
+ slm gdpr erase --profile P --yes [--json] # Art. 17 erasure, IRREVERSIBLE
202
+ slm gdpr verify --receipt-id ID [--profile P] # check an erasure receipt (exit 0 ok, 1 tampered, 2 not found)
203
+ ```
204
+
205
+ `slm gdpr erase` erases a **profile**. It refuses to run without both `--profile`
206
+ and `--yes`, and without them it only previews. It is the only irreversible
207
+ operation here, so confirm the subject, the profile and the authority to erase
208
+ with the user before running it. `slm gdpr status` lists the known gaps (for
209
+ example backups and the code graph) rather than claiming completeness.
210
+
211
+ To remove individual memories rather than a whole profile, use the deletion
212
+ commands from `slm-remember`:
213
+
214
+ ```bash
215
+ slm forget "<subject or project name>" --dry-run --json # ALWAYS first
216
+ slm forget "<subject or project name>" --yes --json
217
+ slm delete <fact_id> --yes --json
218
+ ```
219
+
220
+ Memories that belong to a reviewed correction cannot be deleted this way; the
221
+ refusal names the case. After an erasure, confirm with `slm recall "<content>"`
222
+ that nothing comes back, and never try to re-derive erased content from other
223
+ stored facts.
224
+
225
+ ---
226
+
227
+ ## Scope enforcement in governed workspaces
228
+
229
+ - **Viewers** cannot write anything, whatever the `scope` argument.
230
+ - **Members and admins** can write `shared` and `global` facts; writing either
231
+ scope needs the share permission, which both roles hold.
232
+ - Agents must not split a `global` fact into several `shared` facts, or otherwise
233
+ accumulate visibility the user did not ask for.
234
+
235
+ ---
236
+
237
+ ## Integrity checks
238
+
239
+ ```
240
+ consistency_check(limit: int = 100)
241
+ ```
242
+
243
+ Runs a sheaf-consistency check over up to `limit` memories and returns pairs of
244
+ facts that contradict each other, with a severity (`fact_a`, `fact_b`,
245
+ `severity`, `content_a`), plus `facts_checked`, `facts_errored` and
246
+ `total_contradictions`. If the checker is disabled it says so in `note`. For the
247
+ health of the store itself (orphan rows, erased words left behind, unfinished
248
+ deletes) use `slm db integrity` and `slm db repair`; see `slm-status`.
249
+
250
+ ---
251
+
252
+ ## Agent checklist for governed workspaces
253
+
254
+ Before each write operation:
255
+ - [ ] The user asked for it, and a refusal from the workspace is respected
256
+ - [ ] Scope is `personal` unless the user explicitly asked to share
257
+ - [ ] Pass `session_id` so the write is attributed
258
+
259
+ Before running any destructive or state-changing operation (`forget`,
260
+ `compact_memories`, `slm forget --yes`, `slm gdpr erase --yes`):
261
+ - [ ] The user authorized it in this conversation
262
+ - [ ] Ran the dry run or preview and showed it to the user
263
+ - [ ] GDPR: confirmed the subject or controller authorized the erasure
264
+
265
+ ---
266
+
267
+ ## Related skills
268
+
269
+ - `slm-scope` — scope model details (personal/shared/global)
270
+ - `slm-profile` — memory profiles and tool sets
271
+ - `slm-remember` — fact storage, corrections and deletion
272
+ - `slm-recall` — retrieval reference (includes scope read flags)
273
+ - `slm-mesh` — mesh tools
274
+ - `slm-media` — pictures, documents and folders, and the roles that gate them
275
+ - To use this memory from a web assistant or another computer, see the slm-web-access skill.
276
+
277
+ ---
278
+
279
+ *SuperLocalMemory v4.2.6 · Qualixar · AGPL-3.0-or-later*
@@ -0,0 +1,321 @@
1
+ ---
2
+ name: slm-graph
3
+ description: >
4
+ Index and query a codebase as a structural graph — build the code graph, trace blast radius of a
5
+ change, find callers/callees/inheritors, semantic code search by meaning, assemble PR review
6
+ context, and detect what changed since last index. Use when the user asks how code connects, what
7
+ breaks if X changes, what calls a function, what a class inherits from, how to navigate an
8
+ unfamiliar codebase, or to understand risk before editing.
9
+ when_to_use: |
10
+ - what calls X
11
+ - what breaks if I change Y
12
+ - what does Z inherit from
13
+ - find code that handles authentication
14
+ - impact analysis before editing
15
+ - code navigation in unfamiliar repos
16
+ - blast radius before a PR
17
+ - pre-commit change detection
18
+ allowed-tools: build_code_graph, query_graph, get_blast_radius, semantic_search_code, get_review_context, detect_changes, Bash
19
+ ---
20
+
21
+ # slm-graph — Code Intelligence Skill
22
+
23
+ Index any repo as a code knowledge graph and answer structural questions about it: callers, callees, impact radius, semantic search, and review context. These tools are not in the default tool set: they need `slm tools set code` (or `whole`); see "Tool set requirement" below.
24
+
25
+ **Prerequisite rule:** every tool except `build_code_graph` self-guards — if the graph is not built it returns `{"success": false, "error": "Code graph not built. Run build_code_graph first."}`. Always index first.
26
+
27
+ ---
28
+
29
+ ## Tool Reference
30
+
31
+ ### 1. `build_code_graph` — index a repository
32
+
33
+ ```
34
+ build_code_graph(
35
+ repo_path: str,
36
+ languages: str = "",
37
+ exclude_patterns: str = "",
38
+ ) -> {success, files_parsed, nodes, edges, flows, communities, duration_ms}
39
+ ```
40
+
41
+ Parses all supported source files, extracts functions/classes/imports, builds the call graph, detects execution flows, and identifies code communities. Replaces any previous index for the same repo.
42
+
43
+ - `repo_path` — absolute path to the repository root. Must exist and sit under your home directory; a path outside it is refused with `Invalid repo_path`.
44
+ - `languages` — comma-separated language filter, e.g. `"python,typescript"`. Empty string = index all supported languages.
45
+ - `exclude_patterns` — comma-separated glob patterns to exclude, e.g. `"**/node_modules/**,**/.venv/**"`. Empty = no exclusions.
46
+
47
+ When to (re)build:
48
+ - Before using any other graph tool for the first time on a repo.
49
+ - After significant changes to the codebase (pull, merge, large refactor).
50
+ - When `detect_changes` or `query_graph` returns stale/unexpected results.
51
+ - Rebuild is safe and idempotent — it replaces the previous index atomically per file.
52
+
53
+ ```
54
+ # Index the full repo
55
+ build_code_graph(repo_path="/abs/path/to/myrepo")
56
+
57
+ # Index only Python, skip tests and generated code
58
+ build_code_graph(
59
+ repo_path="/abs/path/to/myrepo",
60
+ languages="python",
61
+ exclude_patterns="**/tests/**,**/generated/**"
62
+ )
63
+ ```
64
+
65
+ ---
66
+
67
+ ### 2. `query_graph` — traverse relationships
68
+
69
+ ```
70
+ query_graph(
71
+ pattern: str,
72
+ target: str = "",
73
+ limit: int = 20,
74
+ ) -> {success, pattern, target, results: [{qualified_name, kind, file_path, name}]}
75
+ ```
76
+
77
+ Query the graph for structural relationships. `pattern` is required and must be one of the eight valid values below. `target` is a qualified name, partial name, or node ID — matched with exact-then-LIKE fallback.
78
+
79
+ Valid patterns:
80
+
81
+ | pattern | returns |
82
+ |---|---|
83
+ | `callers_of` | functions/methods that call `target` |
84
+ | `callees_of` | functions/methods that `target` calls |
85
+ | `imports_of` | modules/symbols that `target` imports |
86
+ | `imported_by` | who imports `target` |
87
+ | `tests_for` | test nodes associated with `target` |
88
+ | `inherits_from` | base classes of `target` |
89
+ | `inherited_by` | subclasses of `target` |
90
+ | `contains` | symbols defined inside `target` (e.g. methods in a class) |
91
+
92
+ ```
93
+ # Who calls the auth handler?
94
+ query_graph(pattern="callers_of", target="authenticate_user")
95
+
96
+ # What does the payment processor import?
97
+ query_graph(pattern="imports_of", target="PaymentProcessor", limit=30)
98
+
99
+ # What classes inherit from BaseModel?
100
+ query_graph(pattern="inherited_by", target="BaseModel")
101
+ ```
102
+
103
+ ---
104
+
105
+ ### 3. `get_blast_radius` — impact analysis
106
+
107
+ ```
108
+ get_blast_radius(
109
+ changed_files: str,
110
+ max_depth: int = 2,
111
+ max_nodes: int = 500,
112
+ ) -> {success, changed_nodes, impacted_nodes, impacted_files, edges, depth_reached, truncated}
113
+ ```
114
+
115
+ Computes the full impact radius for one or more changed files using bidirectional BFS (callers and callees). Returns every node and file reachable within `max_depth` hops. Use this before editing to understand risk surface.
116
+
117
+ - `changed_files` — comma-separated file paths relative to the repo root, e.g. `"src/auth/handler.py,src/auth/models.py"`.
118
+ - `max_depth` — BFS depth. Default 2. Increase to 3–4 for deep call chains; lower to 1 for a quick first-degree check.
119
+ - `max_nodes` — caps the result set. If `truncated=true` in the response, the real blast radius is larger.
120
+
121
+ ```
122
+ # What breaks if I change the auth handler?
123
+ get_blast_radius(changed_files="src/auth/handler.py")
124
+
125
+ # Deeper analysis across two files
126
+ get_blast_radius(
127
+ changed_files="src/payments/gateway.py,src/payments/models.py",
128
+ max_depth=3,
129
+ max_nodes=200
130
+ )
131
+ ```
132
+
133
+ If `truncated` is `true`, narrow the scope with `max_nodes` or reduce `max_depth` to get a reliable result.
134
+
135
+ ---
136
+
137
+ ### 4. `semantic_search_code` — find code by meaning
138
+
139
+ ```
140
+ semantic_search_code(
141
+ query: str,
142
+ kind: str = "",
143
+ limit: int = 20,
144
+ ) -> {success, results: [{qualified_name, kind, file_path, score, line_start, name}]}
145
+ ```
146
+
147
+ Hybrid FTS5 + vector search over all indexed code entities. Use when you know what the code *does* but not what it's *called*.
148
+
149
+ - `query` — natural language description, e.g. `"retry logic for HTTP requests"` or `"parse JWT token from header"`.
150
+ - `kind` — optional filter: `"Function"`, `"Class"`, `"File"`, or `"Test"`. Empty = all kinds. Case-insensitive match in the engine.
151
+ - `limit` — max results. Default 20.
152
+
153
+ Results include a `score` field (higher = more relevant).
154
+
155
+ ```
156
+ # Find where authentication is handled
157
+ semantic_search_code(query="authenticate user from request token")
158
+
159
+ # Find only test functions that cover database writes
160
+ semantic_search_code(query="database write transaction rollback", kind="Test")
161
+
162
+ # Find the rate limiter class
163
+ semantic_search_code(query="rate limiting middleware", kind="Class", limit=5)
164
+ ```
165
+
166
+ ---
167
+
168
+ ### 5. `get_review_context` — assemble PR review context
169
+
170
+ ```
171
+ get_review_context(
172
+ changed_files: str,
173
+ include_source: bool = True,
174
+ ) -> {success, summary, review_items, test_gaps, risk_score}
175
+ ```
176
+
177
+ Produces a token-optimized review package for a set of changed files: a plain-language summary, a ranked list of review items with per-node risk scores, and a list of changed symbols that have no associated test coverage.
178
+
179
+ - `changed_files` — comma-separated file paths relative to the repo root.
180
+ - `include_source` — whether to include source code snippets in the context (default `True`). Set `False` to reduce token usage when you only need the risk analysis.
181
+
182
+ `risk_score` is a float 0–1 on the overall changeset. `review_items[].risk_score` is per-node.
183
+
184
+ ```
185
+ # Get review context for a PR touching two files
186
+ get_review_context(changed_files="src/auth/handler.py,src/auth/utils.py")
187
+
188
+ # Risk summary only, no source snippets
189
+ get_review_context(
190
+ changed_files="src/payments/gateway.py",
191
+ include_source=False
192
+ )
193
+ ```
194
+
195
+ ---
196
+
197
+ ### 6. `detect_changes` — what changed since last index
198
+
199
+ ```
200
+ detect_changes(
201
+ base: str = "HEAD~1",
202
+ ) -> {success, summary, risk_score, changed_functions, test_gaps, review_priorities}
203
+ ```
204
+
205
+ Runs `git diff` against `base`, maps the changed hunks to graph nodes, and returns a risk-scored list of changed functions, test gaps, and review priorities. Requires the repo to be a git repository.
206
+
207
+ - `base` — git ref to diff against. Default `"HEAD~1"` (one commit back). Any valid git ref works: `"main"`, `"v1.4.0"`, a commit SHA, etc.
208
+
209
+ ```
210
+ # What changed in the last commit?
211
+ detect_changes()
212
+
213
+ # What changed since the release branch?
214
+ detect_changes(base="release/1.4")
215
+
216
+ # What changed relative to main?
217
+ detect_changes(base="main")
218
+ ```
219
+
220
+ Returns `error` if the repo root is not a git repository or if git is not available.
221
+
222
+ ---
223
+
224
+ ## Realistic Workflow
225
+
226
+ ### Explore an unfamiliar codebase
227
+
228
+ ```
229
+ # 1. Index it
230
+ build_code_graph(repo_path="/abs/path/to/repo")
231
+
232
+ # 2. Find the entry point by meaning
233
+ semantic_search_code(query="request router entry point", kind="Function")
234
+
235
+ # 3. Trace what it calls
236
+ query_graph(pattern="callees_of", target="handle_request")
237
+
238
+ # 4. See who else calls the same core function
239
+ query_graph(pattern="callers_of", target="authenticate_user")
240
+ ```
241
+
242
+ ### Before editing a function
243
+
244
+ ```
245
+ # 1. Know what you are touching
246
+ semantic_search_code(query="retry HTTP requests with backoff")
247
+
248
+ # 2. Understand blast radius before making the change
249
+ get_blast_radius(changed_files="src/http/client.py")
250
+
251
+ # 3. Check test gaps
252
+ get_review_context(changed_files="src/http/client.py")
253
+ ```
254
+
255
+ ### Pre-commit / PR review
256
+
257
+ ```
258
+ # 1. What changed in this branch vs main?
259
+ detect_changes(base="main")
260
+
261
+ # 2. Full impact analysis for the changed files
262
+ get_blast_radius(changed_files="src/auth/handler.py,src/auth/models.py")
263
+
264
+ # 3. Assemble review context
265
+ get_review_context(changed_files="src/auth/handler.py,src/auth/models.py")
266
+ ```
267
+
268
+ ---
269
+
270
+ ## Error Handling
271
+
272
+ All tools return `{"success": false, "error": "<message>"}` on failure — they never raise.
273
+
274
+ | Error message | Cause | Fix |
275
+ |---|---|---|
276
+ | `Code graph not built. Run build_code_graph first.` | No index exists | Call `build_code_graph(repo_path=...)` first |
277
+ | `Repository path does not exist: <path>` | Bad `repo_path` in build | Pass an absolute path that exists |
278
+ | `Git not available or not a git repository: ...` | `detect_changes` needs git | Only works in git repos with git installed |
279
+ | `Invalid pattern '...'` | Wrong `pattern` in `query_graph` | Use one of the 8 valid pattern strings |
280
+ | `No node found matching '<target>'` | Target not in index. Returned as `success: true` with an empty `results` and this `message`, not as an error | Rebuild or check the qualified name via `semantic_search_code` |
281
+ | `Invalid repo_path: ...` | `repo_path` is outside your home directory | Index a repository under your home directory |
282
+
283
+ If `build_code_graph` returns `files_parsed: 0`, no supported source files were found — check `repo_path` and `exclude_patterns`.
284
+
285
+ ---
286
+
287
+ ## Tool set requirement
288
+
289
+ The six tools above are registered only when the MCP server runs the `code` tool
290
+ set, or with `SLM_MCP_ALL_TOOLS=1` / `SLM_MCP_PROFILE=whole`, or when
291
+ `SLM_MCP_TOOLS` names them. They are **not** in `core`, `full`, `power` or the
292
+ default every app gets, so there the tools do not exist and a call fails as an
293
+ unknown tool. If the user asks for graph work and the tools are missing, tell
294
+ them: "Code-graph tools are off by default. Run `slm tools set code` (graph
295
+ without mesh) or `slm tools set whole` (every tool), then restart this app."
296
+ Let them choose; it changes the tools every connected app sees.
297
+
298
+ `switch_profile` does not change the tool set; it changes the active memory
299
+ profile. See `slm-profile`. The `code` set leaves out the mesh and several
300
+ administration tools, so ask the user before changing their tool set.
301
+
302
+ With `SLM_MCP_ALL_TOOLS=1` more graph tools appear: `update_code_graph` (refresh
303
+ for `changed_files` without a full rebuild), `list_graph_stats`,
304
+ `get_architecture_overview`, `list_communities`, `get_community`, `list_flows`,
305
+ `get_flow`, `get_affected_flows`, `find_large_functions`, `enrich_blast_radius`,
306
+ `refactor_preview`, and the code-to-memory tools `link_memory_to_code`,
307
+ `code_memory_search`, `code_entity_history` and `code_stale_check`. The memory
308
+ links need `"bridge_enabled": true` in `code_graph_config.json` and a rebuild.
309
+ All are host-only: a remote caller cannot use them.
310
+
311
+ ---
312
+
313
+ ## Related skills
314
+
315
+ - `slm-profile` — memory profiles and the tool sets that decide which tools exist
316
+ - `slm-recall` — retrieve architectural decisions before graph queries
317
+ - `slm-status` — confirm the active profile and graph index health
318
+
319
+ ---
320
+
321
+ SuperLocalMemory v4.2.6 · Qualixar · AGPL-3.0-or-later