superlocalmemory 4.1.21 → 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.
- package/.claude-plugin/marketplace.json +3 -3
- package/CHANGELOG.md +210 -0
- package/README.md +101 -33
- package/antigravity-plugin/_GENERATED.md +33 -0
- package/antigravity-plugin/agents/slm-governance-advisor.md +78 -0
- package/antigravity-plugin/agents/slm-loop-runner.md +82 -0
- package/antigravity-plugin/agents/slm-memory-advisor.md +50 -0
- package/antigravity-plugin/agents/slm-optimize-advisor.md +44 -0
- package/antigravity-plugin/commands/slm-loop.md +33 -0
- package/antigravity-plugin/hooks/hooks.json +59 -0
- package/antigravity-plugin/hooks.json +42 -0
- package/antigravity-plugin/mcp_config.json +14 -0
- package/antigravity-plugin/plugin.json +25 -0
- package/antigravity-plugin/scripts/antigravity_hook_adapter.py +85 -0
- package/antigravity-plugin/skills/slm-bot-memory/SKILL.md +146 -0
- package/antigravity-plugin/skills/slm-cache/SKILL.md +147 -0
- package/antigravity-plugin/skills/slm-compress/SKILL.md +150 -0
- package/antigravity-plugin/skills/slm-getting-started-bot/SKILL.md +146 -0
- package/antigravity-plugin/skills/slm-governance/SKILL.md +221 -0
- package/antigravity-plugin/skills/slm-graph/SKILL.md +327 -0
- package/antigravity-plugin/skills/slm-loop/SKILL.md +153 -0
- package/antigravity-plugin/skills/slm-mesh/SKILL.md +287 -0
- package/antigravity-plugin/skills/slm-profile/SKILL.md +159 -0
- package/antigravity-plugin/skills/slm-recall/SKILL.md +430 -0
- package/antigravity-plugin/skills/slm-remember/SKILL.md +370 -0
- package/antigravity-plugin/skills/slm-scope/SKILL.md +183 -0
- package/antigravity-plugin/skills/slm-session/SKILL.md +291 -0
- package/antigravity-plugin/skills/slm-status/SKILL.md +185 -0
- package/antigravity-plugin/skills/slm-web-access/SKILL.md +91 -0
- package/codex-plugin/.claude-plugin/plugin.json +19 -0
- package/codex-plugin/.codex/config.toml +40 -0
- package/codex-plugin/.codex-plugin/plugin.json +43 -0
- package/codex-plugin/.mcp.json +16 -0
- package/codex-plugin/AGENTS.md +161 -0
- package/codex-plugin/README.md +205 -0
- package/codex-plugin/_GENERATED.md +52 -0
- package/codex-plugin/agents/slm-governance-advisor.md +78 -0
- package/codex-plugin/agents/slm-loop-runner.md +82 -0
- package/codex-plugin/agents/slm-memory-advisor.md +50 -0
- package/codex-plugin/agents/slm-optimize-advisor.md +44 -0
- package/codex-plugin/commands/slm-loop.md +33 -0
- package/codex-plugin/hooks/hooks.json +59 -0
- package/codex-plugin/scripts/ensure-venv.bat +108 -0
- package/codex-plugin/scripts/ensure-venv.sh +100 -0
- package/codex-plugin/scripts/slm-launch +55 -0
- package/codex-plugin/scripts/slm-launch.bat +30 -0
- package/codex-plugin/skills/slm-bot-memory/SKILL.md +146 -0
- package/codex-plugin/skills/slm-cache/SKILL.md +147 -0
- package/codex-plugin/skills/slm-compress/SKILL.md +150 -0
- package/codex-plugin/skills/slm-getting-started-bot/SKILL.md +146 -0
- package/codex-plugin/skills/slm-governance/SKILL.md +221 -0
- package/codex-plugin/skills/slm-graph/SKILL.md +327 -0
- package/codex-plugin/skills/slm-loop/SKILL.md +153 -0
- package/codex-plugin/skills/slm-mesh/SKILL.md +287 -0
- package/codex-plugin/skills/slm-profile/SKILL.md +159 -0
- package/codex-plugin/skills/slm-recall/SKILL.md +430 -0
- package/codex-plugin/skills/slm-remember/SKILL.md +370 -0
- package/codex-plugin/skills/slm-scope/SKILL.md +183 -0
- package/codex-plugin/skills/slm-session/SKILL.md +291 -0
- package/codex-plugin/skills/slm-status/SKILL.md +185 -0
- package/codex-plugin/skills/slm-web-access/SKILL.md +91 -0
- package/copilot-plugin/.github/agents/slm-governance-advisor.agent.md +80 -0
- package/copilot-plugin/.github/agents/slm-loop-runner.agent.md +84 -0
- package/copilot-plugin/.github/agents/slm-memory-advisor.agent.md +52 -0
- package/copilot-plugin/.github/agents/slm-optimize-advisor.agent.md +46 -0
- package/copilot-plugin/.github/copilot-instructions.md +52 -0
- package/copilot-plugin/.github/hooks/slm-hooks.json +44 -0
- package/copilot-plugin/.github/prompts/slm-bot-memory.prompt.md +147 -0
- package/copilot-plugin/.github/prompts/slm-cache.prompt.md +151 -0
- package/copilot-plugin/.github/prompts/slm-compress.prompt.md +154 -0
- package/copilot-plugin/.github/prompts/slm-getting-started-bot.prompt.md +147 -0
- package/copilot-plugin/.github/prompts/slm-governance.prompt.md +224 -0
- package/copilot-plugin/.github/prompts/slm-graph.prompt.md +322 -0
- package/copilot-plugin/.github/prompts/slm-loop.prompt.md +159 -0
- package/copilot-plugin/.github/prompts/slm-mesh.prompt.md +290 -0
- package/copilot-plugin/.github/prompts/slm-profile.prompt.md +155 -0
- package/copilot-plugin/.github/prompts/slm-recall.prompt.md +434 -0
- package/copilot-plugin/.github/prompts/slm-remember.prompt.md +375 -0
- package/copilot-plugin/.github/prompts/slm-scope.prompt.md +183 -0
- package/copilot-plugin/.github/prompts/slm-session.prompt.md +291 -0
- package/copilot-plugin/.github/prompts/slm-status.prompt.md +190 -0
- package/copilot-plugin/.github/prompts/slm-web-access.prompt.md +95 -0
- package/copilot-plugin/.vscode/mcp.json +11 -0
- package/copilot-plugin/README.md +26 -0
- package/copilot-plugin/_GENERATED.md +49 -0
- package/copilot-plugin/scripts/ensure-venv.bat +122 -0
- package/copilot-plugin/scripts/ensure-venv.sh +169 -0
- package/copilot-plugin/scripts/slm-launch +207 -0
- package/copilot-plugin/scripts/slm-launch.bat +32 -0
- package/copilot-plugin/scripts/slm-resolve.sh +128 -0
- package/copilot-plugin/scripts/slm-run +76 -0
- package/copilot-plugin/scripts/torch-cpu-resolve.sh +86 -0
- package/docs/pi-dev-integration.md +0 -2
- package/hermes-plugin/README.md +30 -0
- package/hermes-plugin/_GENERATED.md +3 -0
- package/hermes-plugin/__init__.py +417 -0
- package/hermes-plugin/agents/slm-governance-advisor.md +78 -0
- package/hermes-plugin/agents/slm-loop-runner.md +82 -0
- package/hermes-plugin/agents/slm-memory-advisor.md +50 -0
- package/hermes-plugin/agents/slm-optimize-advisor.md +44 -0
- package/hermes-plugin/command-inventory.json +7 -0
- package/hermes-plugin/plugin.yaml +24 -0
- package/hermes-plugin/remote.py +390 -0
- package/hermes-plugin/skills/slm-bot-memory/SKILL.md +146 -0
- package/hermes-plugin/skills/slm-cache/SKILL.md +147 -0
- package/hermes-plugin/skills/slm-compress/SKILL.md +150 -0
- package/hermes-plugin/skills/slm-getting-started-bot/SKILL.md +146 -0
- package/hermes-plugin/skills/slm-governance/SKILL.md +221 -0
- package/hermes-plugin/skills/slm-graph/SKILL.md +327 -0
- package/hermes-plugin/skills/slm-loop/SKILL.md +153 -0
- package/hermes-plugin/skills/slm-mesh/SKILL.md +287 -0
- package/hermes-plugin/skills/slm-profile/SKILL.md +159 -0
- package/hermes-plugin/skills/slm-recall/SKILL.md +430 -0
- package/hermes-plugin/skills/slm-remember/SKILL.md +370 -0
- package/hermes-plugin/skills/slm-scope/SKILL.md +183 -0
- package/hermes-plugin/skills/slm-session/SKILL.md +291 -0
- package/hermes-plugin/skills/slm-status/SKILL.md +185 -0
- package/hermes-plugin/skills/slm-web-access/SKILL.md +91 -0
- package/package.json +9 -16
- package/plugin/.claude-plugin/plugin.json +2 -2
- package/plugin/.cursor-plugin/plugin.json +24 -0
- package/plugin/CLAUDE.md +14 -12
- package/plugin/agents/slm-governance-advisor.md +14 -16
- package/plugin/agents/slm-loop-runner.md +22 -11
- package/plugin/agents/slm-memory-advisor.md +14 -14
- package/plugin/agents/slm-optimize-advisor.md +5 -5
- package/plugin/assets/logo.svg +36 -0
- package/plugin/commands/slm-loop.md +5 -3
- package/plugin/cursor-skills/slm-bot-memory/SKILL.md +146 -0
- package/plugin/cursor-skills/slm-getting-started-bot/SKILL.md +146 -0
- package/plugin/cursor-skills/slm-recall/SKILL.md +430 -0
- package/plugin/cursor-skills/slm-remember/SKILL.md +370 -0
- package/plugin/cursor-skills/slm-scope/SKILL.md +183 -0
- package/plugin/cursor-skills/slm-session/SKILL.md +291 -0
- package/plugin/hooks/hooks.json +9 -9
- package/plugin/mcp.cursor.json +23 -0
- package/plugin/requirements-cpu-torch.txt +13 -0
- package/plugin/requirements.txt +1 -1
- package/plugin/scripts/ensure-venv.sh +45 -3
- package/plugin/scripts/slm-launch +93 -9
- package/plugin/scripts/torch-cpu-resolve.sh +86 -0
- package/plugin/skills/slm-bot-memory/SKILL.md +146 -0
- package/plugin/skills/slm-cache/SKILL.md +6 -7
- package/plugin/skills/slm-compress/SKILL.md +3 -3
- package/plugin/skills/slm-getting-started-bot/SKILL.md +146 -0
- package/plugin/skills/slm-governance/SKILL.md +126 -153
- package/plugin/skills/slm-graph/SKILL.md +27 -15
- package/plugin/skills/slm-loop/SKILL.md +74 -20
- package/plugin/skills/slm-mesh/SKILL.md +17 -12
- package/plugin/skills/slm-profile/SKILL.md +101 -91
- package/plugin/skills/slm-recall/SKILL.md +151 -54
- package/plugin/skills/slm-remember/SKILL.md +132 -35
- package/plugin/skills/slm-scope/SKILL.md +24 -17
- package/plugin/skills/slm-session/SKILL.md +77 -57
- package/plugin/skills/slm-status/SKILL.md +54 -35
- package/plugin/skills/slm-web-access/SKILL.md +91 -0
- package/plugin-src/agents/slm-governance-advisor.md +78 -0
- package/plugin-src/agents/slm-loop-runner.md +82 -0
- package/plugin-src/agents/slm-memory-advisor.md +14 -14
- package/plugin-src/agents/slm-optimize-advisor.md +5 -5
- package/plugin-src/commands/slm-loop.md +33 -0
- package/plugin-src/rules/AGENTS.md +45 -36
- package/plugin-src/rules/CLAUDE.md.fragment +47 -0
- package/plugin-src/skills/slm-bot-memory/SKILL.md +146 -0
- package/plugin-src/skills/slm-cache/SKILL.md +6 -7
- package/plugin-src/skills/slm-compress/SKILL.md +3 -3
- package/plugin-src/skills/slm-getting-started-bot/SKILL.md +146 -0
- package/plugin-src/skills/slm-governance/SKILL.md +126 -153
- package/plugin-src/skills/slm-graph/SKILL.md +27 -15
- package/plugin-src/skills/slm-loop/SKILL.md +74 -20
- package/plugin-src/skills/slm-mesh/SKILL.md +17 -12
- package/plugin-src/skills/slm-profile/SKILL.md +101 -91
- package/plugin-src/skills/slm-recall/SKILL.md +151 -54
- package/plugin-src/skills/slm-remember/SKILL.md +132 -35
- package/plugin-src/skills/slm-scope/SKILL.md +24 -17
- package/plugin-src/skills/slm-session/SKILL.md +77 -57
- package/plugin-src/skills/slm-status/SKILL.md +54 -35
- package/plugin-src/skills/slm-web-access/SKILL.md +91 -0
- package/scripts/postinstall.js +107 -0
|
@@ -0,0 +1,327 @@
|
|
|
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 only registered in the `code` MCP tool set (or with `SLM_MCP_ALL_TOOLS=1`); 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
|
+
no-profile default that the Claude Code and Codex plugins use, so with those
|
|
293
|
+
settings the tools simply do not exist and a call fails as an unknown tool. The
|
|
294
|
+
tool set is read when the server starts: set it in the host's MCP config and
|
|
295
|
+
restart the host.
|
|
296
|
+
|
|
297
|
+
```json
|
|
298
|
+
"env": {
|
|
299
|
+
"SLM_MCP_PROFILE": "code",
|
|
300
|
+
"SLM_AGENT_ID="antigravity"
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
`switch_profile` does not change the tool set; it changes the active memory
|
|
305
|
+
profile. See `slm-profile`. The `code` set leaves out the mesh and several
|
|
306
|
+
administration tools, so ask the user before changing their tool set.
|
|
307
|
+
|
|
308
|
+
With `SLM_MCP_ALL_TOOLS=1` more graph tools appear: `update_code_graph` (refresh
|
|
309
|
+
for `changed_files` without a full rebuild), `list_graph_stats`,
|
|
310
|
+
`get_architecture_overview`, `list_communities`, `get_community`, `list_flows`,
|
|
311
|
+
`get_flow`, `get_affected_flows`, `find_large_functions`, `enrich_blast_radius`,
|
|
312
|
+
`refactor_preview`, and the code-to-memory tools `link_memory_to_code`,
|
|
313
|
+
`code_memory_search`, `code_entity_history` and `code_stale_check`. The memory
|
|
314
|
+
links need `"bridge_enabled": true` in `code_graph_config.json` and a rebuild.
|
|
315
|
+
All are host-only: a remote caller cannot use them.
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## Related skills
|
|
320
|
+
|
|
321
|
+
- `slm-profile` — memory profiles and the tool sets that decide which tools exist
|
|
322
|
+
- `slm-recall` — retrieve architectural decisions before graph queries
|
|
323
|
+
- `slm-status` — confirm the active profile and graph index health
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
SuperLocalMemory v4.1.23 · Qualixar · AGPL-3.0-or-later
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slm-loop
|
|
3
|
+
description: Gate-verified bounded loops with SuperLocalMemory as the durable ledger. Use when a task has a checkable acceptance condition and you must iterate until an INDEPENDENT gate passes — never stopping because the agent believes it is done. `slm_loop_run` (MCP) waits, under hard bounds, for a recall gate to pass; `slm loop demo` shows the control flow keyless; `slm loop history` and `slm loop show <run_id>` (or `slm_loop_history` / `slm_loop_show`) inspect past runs, whose every lap is stored as queryable SLM memory (tag `loop:<name>`). Terminal statuses are DONE / HALT / PAUSE / KILLED / ERROR — report them exactly, never converting HALT/PAUSE/ERROR into success.
|
|
4
|
+
when_to_use: "run a bounded loop, gate-verified task, iterate until tests pass, verify against an independent gate, don't trust the agent's own done claim, slm loop, convergence loop, loop until green, loop ledger, wait for another agent's result"
|
|
5
|
+
allowed-tools: slm_loop_run, slm_loop_history, slm_loop_show, recall, Bash
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# slm-loop — Bounded, gate-verified agent loops
|
|
9
|
+
|
|
10
|
+
## The one rule
|
|
11
|
+
|
|
12
|
+
A bounded loop is complete **only when an independent gate passes** — not when
|
|
13
|
+
the agent claims it is finished. The agent's own "I'm done" signal is recorded
|
|
14
|
+
for audit and is *never* used to terminate the loop. If you take one thing from
|
|
15
|
+
this skill: **the gate is the authority.**
|
|
16
|
+
|
|
17
|
+
Use a bounded loop whenever the goal has a mechanical, checkable contract: a
|
|
18
|
+
test suite, a JSON schema, a linter, a reconciliation rule, a citation checker,
|
|
19
|
+
a security scan. When the goal is subjective, keep a human approval gate.
|
|
20
|
+
|
|
21
|
+
## What SLM runs, and what you run
|
|
22
|
+
|
|
23
|
+
SLM's loop engine runs the laps, enforces the bounds, calls the gate and writes
|
|
24
|
+
the ledger. It does **not** start your tests or linters: it carries no
|
|
25
|
+
subprocess or sandbox machinery. What each surface gives you:
|
|
26
|
+
|
|
27
|
+
| Surface | What it does |
|
|
28
|
+
|---|---|
|
|
29
|
+
| `slm_loop_run` (MCP) | A *watcher*: each lap is a recall of `gate_query`; the loop ends when a confident match appears, or a bound trips. Use it to wait for a verification or coordination memory another agent will write (for example "build passed"). |
|
|
30
|
+
| `slm loop demo` (CLI) | A keyless convergence demo: a stub proposer, a deterministic gate that passes on lap 3, every lap recorded. Proves the engine and ledger work end to end. |
|
|
31
|
+
| `slm loop history`, `slm loop show` / `slm_loop_history`, `slm_loop_show` | Read the ledger of past runs. |
|
|
32
|
+
| `superlocalmemory.loops.run_bounded_loop` (Python) | The engine itself, for code that supplies its own runner and gate callables. |
|
|
33
|
+
|
|
34
|
+
For a task whose gate is a command (`pytest -q`, a schema validation), you run
|
|
35
|
+
that command yourself each lap with Bash and read its exit code; the discipline
|
|
36
|
+
below still applies, but SLM is not recording those laps. For graph runs with
|
|
37
|
+
receipts, use the separate Bounded Loops product; SLM can take a read-only
|
|
38
|
+
snapshot of its finished runs with `observe_bounded_loop_evidence(workspace)`
|
|
39
|
+
(an absolute path), which records observations only and never changes recall or
|
|
40
|
+
ranking.
|
|
41
|
+
|
|
42
|
+
## What SLM adds
|
|
43
|
+
|
|
44
|
+
Every lap SLM runs is written as a durable, queryable memory (tagged `loop:<name>`,
|
|
45
|
+
session `loop:<run_id>`). That makes a run:
|
|
46
|
+
|
|
47
|
+
- **auditable** — inspect the decision, gate verdict and budget for each lap;
|
|
48
|
+
- **historical** — a run's ledger survives across sessions;
|
|
49
|
+
- **discoverable** — visible via `slm recall`, the dashboard, and any
|
|
50
|
+
SLM-integrated tool, alongside everything else the agent remembers.
|
|
51
|
+
|
|
52
|
+
## MCP: `slm_loop_run`
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
slm_loop_run(
|
|
56
|
+
name: str, # 1–128 chars; also the memory tag
|
|
57
|
+
gate_query: str, # the recall the gate checks each lap (up to 2000 chars)
|
|
58
|
+
gate_min_score: float = 0.0, # minimum top-result score to pass
|
|
59
|
+
max_iterations: int = 20, # hard lap cap, 1–200
|
|
60
|
+
max_wallclock_s: float = 15.0,# hard time cap; 0 disables; never more than 120
|
|
61
|
+
poll_interval_s: float = 1.0, # wait between laps; at least 0.25
|
|
62
|
+
max_tokens: int = 0, # optional token budget; 0 disables
|
|
63
|
+
no_progress_window: int = 0, # halt after N no-change laps; leave 0 for a watcher
|
|
64
|
+
require_support: bool = False,# pass only if the answer check ran and judged it sufficient
|
|
65
|
+
)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The call **blocks** until the gate passes or a bound trips, then returns
|
|
69
|
+
`{ok, status, reason, passed, laps, run_id, ledger: [{lap, decision, passed, detail}]}`.
|
|
70
|
+
The gate recalls at most three memories per lap and ignores the loop's own
|
|
71
|
+
ledger entries, so only a memory written by someone else can satisfy it. A
|
|
72
|
+
recall the answer check judged insufficient never passes, even with a high
|
|
73
|
+
score; with `require_support=True` an unchecked recall (check off, busy,
|
|
74
|
+
loading, out of time) does not pass either. When the answer check is on, each
|
|
75
|
+
lap asks it once about those memories; with the online check that is a request
|
|
76
|
+
to the provider and may be billed. `slm_loop_run` is not available to remote
|
|
77
|
+
callers.
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
slm_loop_history(name, limit=20) # runs recorded under a loop name
|
|
81
|
+
slm_loop_show(run_id, limit=200) # every lap of one run, in order
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## CLI
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
slm loop demo [--iterations N] [--json] # keyless convergence demo
|
|
88
|
+
slm loop history [--name NAME] [--json] # list recorded runs
|
|
89
|
+
slm loop show <run_id> [--json] # every lap of one run
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
There is no `slm loop run`.
|
|
93
|
+
|
|
94
|
+
## The bounds
|
|
95
|
+
|
|
96
|
+
A loop runs inside a safety envelope. Any bound tripping ends the run with
|
|
97
|
+
`HALT` (never a success):
|
|
98
|
+
|
|
99
|
+
- **max_iterations** — a hard lap cap.
|
|
100
|
+
- **no_progress_window** — consecutive no-change laps before halting a spinning
|
|
101
|
+
agent.
|
|
102
|
+
- **token budget / wall-clock** — cumulative ceilings, checked again after each
|
|
103
|
+
lap, so an overshooting lap halts even if its gate would pass.
|
|
104
|
+
- **kill switch** — a non-empty `SLM_LOOP_KILL` in the loop's process
|
|
105
|
+
environment stops it before the next lap, with status `KILLED`.
|
|
106
|
+
- **approval rung** — L1 (report), L2 (assisted, pauses for approval), L3
|
|
107
|
+
(unattended). L2 and L3 require approval before a passing gate is accepted as
|
|
108
|
+
DONE unless approval is explicitly configured off. `slm_loop_run` and the demo
|
|
109
|
+
run at L1, so `PAUSE` arises only from code that sets a higher rung.
|
|
110
|
+
|
|
111
|
+
## Terminal statuses — report exactly
|
|
112
|
+
|
|
113
|
+
| Status | Meaning |
|
|
114
|
+
|----------|---------|
|
|
115
|
+
| `DONE` | The independent gate passed **and** approval was granted or not required. |
|
|
116
|
+
| `HALT` | A bound tripped (iterations, no-progress, token, or wall-clock). |
|
|
117
|
+
| `PAUSE` | The gate passed but required approval is not yet granted. |
|
|
118
|
+
| `KILLED` | The external kill switch tripped between laps. |
|
|
119
|
+
| `ERROR` | The runner or gate failed to execute; inspect the lap detail. |
|
|
120
|
+
|
|
121
|
+
Say `DONE` only when the status is exactly `DONE`. Never describe `HALT`,
|
|
122
|
+
`PAUSE`, or `ERROR` as success. When halted, name which bound tripped; when
|
|
123
|
+
paused, name the approval needed; when errored, quote the short detail.
|
|
124
|
+
|
|
125
|
+
## Reporting workflow
|
|
126
|
+
|
|
127
|
+
1. Run or resume the loop.
|
|
128
|
+
2. Read back the ledger with `slm_loop_show` or `slm loop show <run_id>` (or
|
|
129
|
+
`slm recall` on tag `loop:<name>`).
|
|
130
|
+
3. Report the exact terminal status, the lap count, and the gate's final
|
|
131
|
+
verdict. Include the `run_id` so the run can be re-inspected later.
|
|
132
|
+
|
|
133
|
+
## Gate discipline
|
|
134
|
+
|
|
135
|
+
- The gate verifies; the runner only proposes. They are separate.
|
|
136
|
+
- Prefer a typed, parseable gate (a test exit code, a schema validation, a
|
|
137
|
+
scanner report) over a vague check. A missing tool, an empty report, or a
|
|
138
|
+
crashed scanner is **not** a clean pass — fail closed.
|
|
139
|
+
- Never use "an LLM decides it looks good" as the gate. That reintroduces the
|
|
140
|
+
exact failure mode bounded loops exist to remove.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Related skills
|
|
145
|
+
|
|
146
|
+
- `slm-status` — confirm SLM is healthy before relying on the ledger.
|
|
147
|
+
- `slm-recall` — query a loop's laps directly (`loop:<name>` tag), and the
|
|
148
|
+
answer-check fields the recall gate depends on.
|
|
149
|
+
- `slm-session` — session lifecycle around a longer loop run.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
SuperLocalMemory v4.1.23 · Qualixar · AGPL-3.0-or-later
|