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.
- package/.claude-plugin/marketplace.json +3 -3
- package/.cursor-plugin/marketplace.json +29 -0
- package/CHANGELOG.md +165 -0
- package/README.md +48 -7
- package/antigravity-plugin/_GENERATED.md +1 -1
- package/antigravity-plugin/agents/slm-governance-advisor.md +1 -1
- package/antigravity-plugin/agents/slm-loop-runner.md +1 -1
- package/antigravity-plugin/agents/slm-memory-advisor.md +1 -1
- package/antigravity-plugin/agents/slm-optimize-advisor.md +1 -1
- package/antigravity-plugin/mcp_config.json +1 -2
- package/antigravity-plugin/plugin.json +1 -1
- package/antigravity-plugin/skills/slm-bot-memory/SKILL.md +1 -1
- package/antigravity-plugin/skills/slm-cache/SKILL.md +1 -1
- package/antigravity-plugin/skills/slm-compress/SKILL.md +1 -1
- package/antigravity-plugin/skills/slm-getting-started-bot/SKILL.md +1 -1
- package/antigravity-plugin/skills/slm-governance/SKILL.md +4 -2
- package/antigravity-plugin/skills/slm-graph/SKILL.md +7 -13
- package/antigravity-plugin/skills/slm-loop/SKILL.md +1 -1
- package/antigravity-plugin/skills/slm-media/SKILL.md +1 -1
- package/antigravity-plugin/skills/slm-mesh/SKILL.md +1 -1
- package/antigravity-plugin/skills/slm-profile/SKILL.md +21 -18
- package/antigravity-plugin/skills/slm-recall/SKILL.md +1 -1
- package/antigravity-plugin/skills/slm-remember/SKILL.md +1 -1
- package/antigravity-plugin/skills/slm-scope/SKILL.md +1 -1
- package/antigravity-plugin/skills/slm-session/SKILL.md +1 -1
- package/antigravity-plugin/skills/slm-status/SKILL.md +1 -1
- package/codex-plugin/.claude-plugin/plugin.json +1 -1
- package/codex-plugin/.codex-plugin/plugin.json +7 -3
- package/codex-plugin/AGENTS.md +1 -1
- package/codex-plugin/README.md +2 -2
- package/codex-plugin/_GENERATED.md +2 -1
- package/codex-plugin/agents/slm-governance-advisor.md +1 -1
- package/codex-plugin/agents/slm-loop-runner.md +1 -1
- package/codex-plugin/agents/slm-memory-advisor.md +1 -1
- package/codex-plugin/agents/slm-optimize-advisor.md +1 -1
- package/codex-plugin/skills/slm-bot-memory/SKILL.md +1 -1
- package/codex-plugin/skills/slm-cache/SKILL.md +1 -1
- package/codex-plugin/skills/slm-compress/SKILL.md +1 -1
- package/codex-plugin/skills/slm-getting-started-bot/SKILL.md +1 -1
- package/codex-plugin/skills/slm-governance/SKILL.md +4 -2
- package/codex-plugin/skills/slm-graph/SKILL.md +7 -13
- package/codex-plugin/skills/slm-loop/SKILL.md +1 -1
- package/codex-plugin/skills/slm-media/SKILL.md +1 -1
- package/codex-plugin/skills/slm-mesh/SKILL.md +1 -1
- package/codex-plugin/skills/slm-profile/SKILL.md +21 -18
- package/codex-plugin/skills/slm-recall/SKILL.md +1 -1
- package/codex-plugin/skills/slm-remember/SKILL.md +1 -1
- package/codex-plugin/skills/slm-scope/SKILL.md +1 -1
- package/codex-plugin/skills/slm-session/SKILL.md +1 -1
- package/codex-plugin/skills/slm-status/SKILL.md +1 -1
- package/copilot-plugin/.github/agents/slm-governance-advisor.agent.md +2 -2
- package/copilot-plugin/.github/agents/slm-loop-runner.agent.md +2 -2
- package/copilot-plugin/.github/agents/slm-memory-advisor.agent.md +2 -2
- package/copilot-plugin/.github/agents/slm-optimize-advisor.agent.md +2 -2
- package/copilot-plugin/.github/copilot-instructions.md +4 -4
- package/copilot-plugin/.github/prompts/slm-bot-memory.prompt.md +2 -2
- package/copilot-plugin/.github/prompts/slm-cache.prompt.md +2 -2
- package/copilot-plugin/.github/prompts/slm-compress.prompt.md +2 -2
- package/copilot-plugin/.github/prompts/slm-getting-started-bot.prompt.md +2 -2
- package/copilot-plugin/.github/prompts/slm-governance.prompt.md +5 -3
- package/copilot-plugin/.github/prompts/slm-graph.prompt.md +8 -14
- package/copilot-plugin/.github/prompts/slm-loop.prompt.md +2 -2
- package/copilot-plugin/.github/prompts/slm-media.prompt.md +2 -2
- package/copilot-plugin/.github/prompts/slm-mesh.prompt.md +2 -2
- package/copilot-plugin/.github/prompts/slm-profile.prompt.md +22 -19
- package/copilot-plugin/.github/prompts/slm-recall.prompt.md +2 -2
- package/copilot-plugin/.github/prompts/slm-remember.prompt.md +2 -2
- package/copilot-plugin/.github/prompts/slm-scope.prompt.md +2 -2
- package/copilot-plugin/.github/prompts/slm-session.prompt.md +2 -2
- package/copilot-plugin/.github/prompts/slm-status.prompt.md +2 -2
- package/copilot-plugin/.github/prompts/slm-web-access.prompt.md +1 -1
- package/copilot-plugin/README.md +2 -2
- package/copilot-plugin/_GENERATED.md +3 -3
- package/{plugin → cursor-plugin}/.cursor-plugin/plugin.json +3 -3
- package/cursor-plugin/LICENSE +24 -0
- package/cursor-plugin/assets/logo.svg +36 -0
- package/{plugin → cursor-plugin}/cursor-skills/slm-bot-memory/SKILL.md +1 -1
- package/cursor-plugin/cursor-skills/slm-cache/SKILL.md +147 -0
- package/cursor-plugin/cursor-skills/slm-compress/SKILL.md +150 -0
- package/{plugin → cursor-plugin}/cursor-skills/slm-getting-started-bot/SKILL.md +1 -1
- package/cursor-plugin/cursor-skills/slm-governance/SKILL.md +279 -0
- package/cursor-plugin/cursor-skills/slm-graph/SKILL.md +321 -0
- package/cursor-plugin/cursor-skills/slm-loop/SKILL.md +174 -0
- package/cursor-plugin/cursor-skills/slm-media/SKILL.md +340 -0
- package/cursor-plugin/cursor-skills/slm-mesh/SKILL.md +389 -0
- package/cursor-plugin/cursor-skills/slm-profile/SKILL.md +167 -0
- package/{plugin → cursor-plugin}/cursor-skills/slm-recall/SKILL.md +1 -1
- package/{plugin → cursor-plugin}/cursor-skills/slm-remember/SKILL.md +1 -1
- package/{plugin → cursor-plugin}/cursor-skills/slm-scope/SKILL.md +1 -1
- package/{plugin → cursor-plugin}/cursor-skills/slm-session/SKILL.md +1 -1
- package/cursor-plugin/cursor-skills/slm-status/SKILL.md +231 -0
- package/cursor-plugin/cursor-skills/slm-web-access/SKILL.md +179 -0
- package/{plugin → cursor-plugin}/mcp.cursor.json +1 -2
- package/hermes-plugin/__init__.py +39 -7
- package/hermes-plugin/agents/slm-governance-advisor.md +1 -1
- package/hermes-plugin/agents/slm-loop-runner.md +1 -1
- package/hermes-plugin/agents/slm-memory-advisor.md +1 -1
- package/hermes-plugin/agents/slm-optimize-advisor.md +1 -1
- package/hermes-plugin/command-inventory.json +2 -2
- package/hermes-plugin/plugin.yaml +2 -2
- package/hermes-plugin/skills/slm-bot-memory/SKILL.md +1 -1
- package/hermes-plugin/skills/slm-cache/SKILL.md +1 -1
- package/hermes-plugin/skills/slm-compress/SKILL.md +1 -1
- package/hermes-plugin/skills/slm-getting-started-bot/SKILL.md +1 -1
- package/hermes-plugin/skills/slm-governance/SKILL.md +4 -2
- package/hermes-plugin/skills/slm-graph/SKILL.md +7 -13
- package/hermes-plugin/skills/slm-loop/SKILL.md +1 -1
- package/hermes-plugin/skills/slm-media/SKILL.md +1 -1
- package/hermes-plugin/skills/slm-mesh/SKILL.md +1 -1
- package/hermes-plugin/skills/slm-profile/SKILL.md +21 -18
- package/hermes-plugin/skills/slm-recall/SKILL.md +1 -1
- package/hermes-plugin/skills/slm-remember/SKILL.md +1 -1
- package/hermes-plugin/skills/slm-scope/SKILL.md +1 -1
- package/hermes-plugin/skills/slm-session/SKILL.md +1 -1
- package/hermes-plugin/skills/slm-status/SKILL.md +1 -1
- package/ide/configs/copilot-cli-mcp.json +17 -0
- package/ide/configs/grok-cli-mcp.toml +11 -0
- package/ide/configs/muse-mcp.json +16 -0
- package/ide/configs/openclaw-mcp.json +15 -0
- package/muse-plugin/.claude-plugin/plugin.json +20 -0
- package/muse-plugin/LICENSE +663 -0
- package/muse-plugin/README.md +44 -0
- package/muse-plugin/_GENERATED.md +3 -0
- package/muse-plugin/agents/slm-governance-advisor.md +84 -0
- package/muse-plugin/agents/slm-loop-runner.md +82 -0
- package/muse-plugin/agents/slm-memory-advisor.md +54 -0
- package/muse-plugin/agents/slm-optimize-advisor.md +44 -0
- package/muse-plugin/commands/slm-loop.md +33 -0
- package/muse-plugin/hooks/hooks.json +102 -0
- package/muse-plugin/requirements-cpu-torch.txt +13 -0
- package/muse-plugin/requirements.txt +1 -0
- package/muse-plugin/scripts/ensure-venv.bat +122 -0
- package/muse-plugin/scripts/ensure-venv.sh +169 -0
- package/muse-plugin/scripts/slm-launch +207 -0
- package/muse-plugin/scripts/slm-launch.bat +32 -0
- package/muse-plugin/scripts/slm-resolve.sh +128 -0
- package/muse-plugin/scripts/slm-run +76 -0
- package/muse-plugin/scripts/torch-cpu-resolve.sh +86 -0
- package/muse-plugin/skills/slm-bot-memory/SKILL.md +180 -0
- package/muse-plugin/skills/slm-cache/SKILL.md +146 -0
- package/muse-plugin/skills/slm-compress/SKILL.md +149 -0
- package/muse-plugin/skills/slm-getting-started-bot/SKILL.md +196 -0
- package/muse-plugin/skills/slm-governance/SKILL.md +278 -0
- package/muse-plugin/skills/slm-graph/SKILL.md +320 -0
- package/muse-plugin/skills/slm-loop/SKILL.md +173 -0
- package/muse-plugin/skills/slm-media/SKILL.md +339 -0
- package/muse-plugin/skills/slm-mesh/SKILL.md +388 -0
- package/muse-plugin/skills/slm-profile/SKILL.md +166 -0
- package/muse-plugin/skills/slm-recall/SKILL.md +517 -0
- package/muse-plugin/skills/slm-remember/SKILL.md +374 -0
- package/muse-plugin/skills/slm-scope/SKILL.md +182 -0
- package/muse-plugin/skills/slm-session/SKILL.md +290 -0
- package/muse-plugin/skills/slm-status/SKILL.md +230 -0
- package/muse-plugin/skills/slm-web-access/SKILL.md +178 -0
- package/package.json +6 -2
- package/plugin/.claude-plugin/plugin.json +4 -2
- package/plugin/LICENSE +663 -0
- package/plugin/README.md +44 -0
- package/plugin/agents/slm-governance-advisor.md +1 -1
- package/plugin/agents/slm-loop-runner.md +1 -1
- package/plugin/agents/slm-memory-advisor.md +1 -1
- package/plugin/agents/slm-optimize-advisor.md +1 -1
- package/plugin/hooks/hooks.json +1 -1
- package/plugin/requirements.txt +1 -1
- package/plugin/skills/slm-bot-memory/SKILL.md +1 -1
- package/plugin/skills/slm-cache/SKILL.md +1 -1
- package/plugin/skills/slm-compress/SKILL.md +1 -1
- package/plugin/skills/slm-getting-started-bot/SKILL.md +1 -1
- package/plugin/skills/slm-governance/SKILL.md +4 -2
- package/plugin/skills/slm-graph/SKILL.md +7 -13
- package/plugin/skills/slm-loop/SKILL.md +1 -1
- package/plugin/skills/slm-media/SKILL.md +1 -1
- package/plugin/skills/slm-mesh/SKILL.md +1 -1
- package/plugin/skills/slm-profile/SKILL.md +21 -18
- package/plugin/skills/slm-recall/SKILL.md +1 -1
- package/plugin/skills/slm-remember/SKILL.md +1 -1
- package/plugin/skills/slm-scope/SKILL.md +1 -1
- package/plugin/skills/slm-session/SKILL.md +1 -1
- package/plugin/skills/slm-status/SKILL.md +1 -1
- package/plugin-src/agents/slm-governance-advisor.md +1 -1
- package/plugin-src/agents/slm-loop-runner.md +1 -1
- package/plugin-src/agents/slm-memory-advisor.md +1 -1
- package/plugin-src/agents/slm-optimize-advisor.md +1 -1
- package/plugin-src/rules/AGENTS.md +1 -1
- package/plugin-src/rules/CLAUDE.md.fragment +3 -3
- package/plugin-src/skills/slm-bot-memory/SKILL.md +1 -1
- package/plugin-src/skills/slm-cache/SKILL.md +1 -1
- package/plugin-src/skills/slm-compress/SKILL.md +1 -1
- package/plugin-src/skills/slm-getting-started-bot/SKILL.md +1 -1
- package/plugin-src/skills/slm-governance/SKILL.md +4 -2
- package/plugin-src/skills/slm-graph/SKILL.md +7 -13
- package/plugin-src/skills/slm-loop/SKILL.md +1 -1
- package/plugin-src/skills/slm-media/SKILL.md +1 -1
- package/plugin-src/skills/slm-mesh/SKILL.md +1 -1
- package/plugin-src/skills/slm-profile/SKILL.md +21 -18
- package/plugin-src/skills/slm-recall/SKILL.md +1 -1
- package/plugin-src/skills/slm-remember/SKILL.md +1 -1
- package/plugin-src/skills/slm-scope/SKILL.md +1 -1
- package/plugin-src/skills/slm-session/SKILL.md +1 -1
- package/plugin-src/skills/slm-status/SKILL.md +1 -1
- package/plugin/CLAUDE.md +0 -56
- /package/{plugin/assets/logo.svg → codex-plugin/assets/icon.svg} +0 -0
|
@@ -0,0 +1,174 @@
|
|
|
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 an independently executed check registered by the operator 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, report_outcome, get_soft_prompts, skill_health, skill_lineage, evolve_skill, observe_bounded_loop_evidence, 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* for a registered check. DONE needs `gate_contract={"job_id": ...}`: a job the operator registered with `superlocalmemory.loops.receipt_jobs.register_job` and executed with `run_registered_check`. Each lap's recall of `gate_query` only locates context; a matching memory alone never passes. Without a registered job the run ends HALT ("operator-registered job_id required"), which is the correct, honest outcome. |
|
|
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
|
+
gate_contract: dict | None = None, # {"job_id": <operator registration>}; required for DONE
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The call **blocks** until the gate passes or a bound trips, then returns
|
|
70
|
+
`{ok, status, reason, passed, laps, run_id, ledger: [{lap, decision, passed, detail}]}`.
|
|
71
|
+
The gate recalls at most three memories per lap and ignores the loop's own
|
|
72
|
+
ledger entries, so only a memory written by someone else can satisfy it. A
|
|
73
|
+
recall the answer check judged insufficient never passes, even with a high
|
|
74
|
+
score; with `require_support=True` an unchecked recall (check off, busy,
|
|
75
|
+
loading, out of time) does not pass either. When the answer check is on, each
|
|
76
|
+
lap asks it once about those memories; with the online check that is a request
|
|
77
|
+
to the provider and may be billed. `slm_loop_run` is not available to remote
|
|
78
|
+
callers.
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
slm_loop_history(name, limit=20) # runs recorded under a loop name
|
|
82
|
+
slm_loop_show(run_id, limit=200) # every lap of one run, in order
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## CLI
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
slm loop demo [--iterations N] [--json] # keyless convergence demo
|
|
89
|
+
slm loop history [--name NAME] [--json] # list recorded runs
|
|
90
|
+
slm loop show <run_id> [--json] # every lap of one run
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
There is no `slm loop run`.
|
|
94
|
+
|
|
95
|
+
## The bounds
|
|
96
|
+
|
|
97
|
+
A loop runs inside a safety envelope. Any bound tripping ends the run with
|
|
98
|
+
`HALT` (never a success):
|
|
99
|
+
|
|
100
|
+
- **max_iterations** — a hard lap cap.
|
|
101
|
+
- **no_progress_window** — consecutive no-change laps before halting a spinning
|
|
102
|
+
agent.
|
|
103
|
+
- **token budget / wall-clock** — cumulative ceilings, checked again after each
|
|
104
|
+
lap, so an overshooting lap halts even if its gate would pass.
|
|
105
|
+
- **kill switch** — a non-empty `SLM_LOOP_KILL` in the loop's process
|
|
106
|
+
environment stops it before the next lap, with status `KILLED`.
|
|
107
|
+
- **approval rung** — L1 (report), L2 (assisted, pauses for approval), L3
|
|
108
|
+
(unattended). L2 and L3 require approval before a passing gate is accepted as
|
|
109
|
+
DONE unless approval is explicitly configured off. `slm_loop_run` and the demo
|
|
110
|
+
run at L1, so `PAUSE` arises only from code that sets a higher rung.
|
|
111
|
+
|
|
112
|
+
## Terminal statuses — report exactly
|
|
113
|
+
|
|
114
|
+
| Status | Meaning |
|
|
115
|
+
|----------|---------|
|
|
116
|
+
| `DONE` | The independent gate passed **and** approval was granted or not required. |
|
|
117
|
+
| `HALT` | A bound tripped (iterations, no-progress, token, or wall-clock). |
|
|
118
|
+
| `PAUSE` | The gate passed but required approval is not yet granted. |
|
|
119
|
+
| `KILLED` | The external kill switch tripped between laps. |
|
|
120
|
+
| `ERROR` | The runner or gate failed to execute; inspect the lap detail. |
|
|
121
|
+
|
|
122
|
+
Say `DONE` only when the status is exactly `DONE`. Never describe `HALT`,
|
|
123
|
+
`PAUSE`, or `ERROR` as success. When halted, name which bound tripped; when
|
|
124
|
+
paused, name the approval needed; when errored, quote the short detail.
|
|
125
|
+
|
|
126
|
+
## Reporting workflow
|
|
127
|
+
|
|
128
|
+
1. Run or resume the loop.
|
|
129
|
+
2. Read back the ledger with `slm_loop_show` or `slm loop show <run_id>` (or
|
|
130
|
+
`slm recall` on tag `loop:<name>`).
|
|
131
|
+
3. Report the exact terminal status, the lap count, and the gate's final
|
|
132
|
+
verdict. Include the `run_id` so the run can be re-inspected later.
|
|
133
|
+
|
|
134
|
+
## Gate discipline
|
|
135
|
+
|
|
136
|
+
- The gate verifies; the runner only proposes. They are separate.
|
|
137
|
+
- Prefer a typed, parseable gate (a test exit code, a schema validation, a
|
|
138
|
+
scanner report) over a vague check. A missing tool, an empty report, or a
|
|
139
|
+
crashed scanner is **not** a clean pass — fail closed.
|
|
140
|
+
- Never use "an LLM decides it looks good" as the gate. That reintroduces the
|
|
141
|
+
exact failure mode bounded loops exist to remove.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## The learning brain around loops
|
|
146
|
+
|
|
147
|
+
Loops are one half; SLM also learns from what happened, and none of it can quietly
|
|
148
|
+
make recall worse.
|
|
149
|
+
|
|
150
|
+
- **Outcomes.** Pass a recall's `query_id` to `report_outcome` when the memories
|
|
151
|
+
helped or misled; the local ranker learns from that. A new ranker is promoted
|
|
152
|
+
only on a statistically valid win and rolled back automatically if it slips.
|
|
153
|
+
- **Soft prompts.** `get_soft_prompts(profile_id)` returns the patterns SLM learned
|
|
154
|
+
for this workspace.
|
|
155
|
+
- **Skill evolution** (off by default, it makes model calls). `skill_health` and
|
|
156
|
+
`skill_lineage` are read-only; `evolve_skill` runs one evolution for the active
|
|
157
|
+
workspace and needs `slm config set evolution.enabled true`. A candidate is
|
|
158
|
+
verified blind and approved before it replaces a skill.
|
|
159
|
+
- **Bounded Loops evidence.** With Bounded Loops installed
|
|
160
|
+
(github.com/qualixar/bounded-loops), `observe_bounded_loop_evidence(workspace)`
|
|
161
|
+
imports its run evidence read-only, so laps and gates join the same memory.
|
|
162
|
+
|
|
163
|
+
Guides: `docs/skill-evolution.md`, `docs/bounded-loops-bridge.md`.
|
|
164
|
+
|
|
165
|
+
## Related skills
|
|
166
|
+
|
|
167
|
+
- `slm-status` — confirm SLM is healthy before relying on the ledger.
|
|
168
|
+
- `slm-recall` — query a loop's laps directly (`loop:<name>` tag), and the
|
|
169
|
+
answer-check fields the recall gate depends on.
|
|
170
|
+
- `slm-session` — session lifecycle around a longer loop run.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
SuperLocalMemory v4.2.6 · Qualixar · AGPL-3.0-or-later
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slm-media
|
|
3
|
+
description: Save pictures and PDFs in SuperLocalMemory and find them again by describing them. Covers when to save a picture or document, remember_media, remember_document, get_media, media_status and media_upload_link, how recall returns pictures and PDF pages, the limits, what stays private, turning the feature on with `slm media` (16 GB of memory needed), connecting folders with `slm sources`, and how web apps add files through one-time upload links. Off by default.
|
|
4
|
+
when_to_use: |
|
|
5
|
+
- "Save this screenshot / photo / PDF"
|
|
6
|
+
- "Find the picture where ..." or "which page of the PDF says ..."
|
|
7
|
+
- "Add this document to my memory"
|
|
8
|
+
- A web app (ChatGPT, Claude on the web, Grok Bot, Muse, Composio) cannot send a file itself
|
|
9
|
+
- remember_media, remember_document, get_media, media_status or media_upload_link is missing from the tool list
|
|
10
|
+
- "Turn on pictures and documents", slm media status, slm media repair
|
|
11
|
+
- "Connect my Obsidian vault / notes folder" (slm sources)
|
|
12
|
+
allowed-tools: remember_media, remember_document, get_media, media_status, media_upload_link, recall, Bash
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# slm-media — Pictures, PDFs and Folders
|
|
16
|
+
|
|
17
|
+
SuperLocalMemory can keep a picture or a PDF as a memory and find it later by
|
|
18
|
+
describing what it shows or what it says. A picture model runs on this
|
|
19
|
+
computer (EmbeddingGemma 2). OCR reads the text inside pictures. Each PDF
|
|
20
|
+
page is indexed by its picture and by its text. No generative model looks at
|
|
21
|
+
the files, so SLM cannot describe a picture to you: it finds it, and you look
|
|
22
|
+
at the thumbnail it returns.
|
|
23
|
+
|
|
24
|
+
This feature is **off by default**. Pictures live in their own database
|
|
25
|
+
(`media.db`); turning it on does not change any existing memory or embedding.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## When to save a picture or a PDF
|
|
30
|
+
|
|
31
|
+
Save one when the user asks, or when the file is itself the thing worth
|
|
32
|
+
finding again: a screenshot of an error they will meet again, a diagram of a
|
|
33
|
+
design decision, a receipt, a scanned page, a PDF spec. Do not save a file
|
|
34
|
+
just because it was shown in the conversation.
|
|
35
|
+
|
|
36
|
+
Add words with `content`. The picture is found by what it shows, by the text
|
|
37
|
+
read inside it, and by the words you add, so a short sentence about why it
|
|
38
|
+
matters ("Staging dashboard after the Postgres 17 move") helps recall.
|
|
39
|
+
|
|
40
|
+
Never save a picture or PDF that shows a password, key, token, card number,
|
|
41
|
+
government id or private data about a third party. The text read from a file
|
|
42
|
+
is scanned like any saved text, but a screenshot of a secret should not be
|
|
43
|
+
saved at all. Ask the user first if you are unsure.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Are the tools there?
|
|
48
|
+
|
|
49
|
+
The five tools below are listed only while pictures and documents are on, and
|
|
50
|
+
only in the `full`, `power` and `whole` MCP tool sets. They are not in `core`
|
|
51
|
+
or `code`. The tool set is fixed when the MCP server starts, so after the
|
|
52
|
+
feature is turned on, restart the MCP session (`slm restart` starts the
|
|
53
|
+
picture worker too). Do not guess: run
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
slm media status
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
It says whether the feature is off, set up, still setting up, or failed
|
|
60
|
+
(`slm doctor` explains a failure). The same status is in the dashboard under
|
|
61
|
+
**Documents & Images**.
|
|
62
|
+
|
|
63
|
+
### Turning it on (ask the user first)
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
slm media enable # shows the download size and a disk check, then asks; --yes skips the question
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Turning it on downloads about 1.5 GB of models and tools, and needs a
|
|
70
|
+
computer with 16 GB of memory (the check passes from 15 GiB). On a smaller
|
|
71
|
+
computer `enable` refuses with the reason and exits with code 4; text memory
|
|
72
|
+
keeps working. Never turn it on, or pass `--yes`, without the user saying
|
|
73
|
+
yes in this conversation. Never set `SLM_MEDIA_ALLOW_LOW_RAM=1` yourself: it
|
|
74
|
+
removes the memory check and the owner must decide that.
|
|
75
|
+
|
|
76
|
+
Supported: macOS on Apple Silicon, Windows x64, Linux x86_64 and Linux ARM64
|
|
77
|
+
(aarch64), Python 3.12 to 3.14. Not supported: Intel Macs and Windows on ARM.
|
|
78
|
+
|
|
79
|
+
Other commands:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
slm media status # what is on and how set-up is going
|
|
83
|
+
slm media disable # off again; memories are kept (--remove-files also deletes the downloaded models)
|
|
84
|
+
slm media gc # report picture records without a memory and files without a record; removes nothing
|
|
85
|
+
slm media gc --apply # remove them (owner or admin); never touches SLM's databases
|
|
86
|
+
slm media repair --dry-run # count pictures that cannot be found by what they show yet
|
|
87
|
+
slm media repair # re-embed them (owner or admin); run again if it says pictures are left
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
All take `--json`. Run `slm media repair` when a save says a picture "can't be
|
|
91
|
+
found by what it shows yet", or after the picture model changed.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Tool reference
|
|
96
|
+
|
|
97
|
+
### `remember_media` — save a picture
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
remember_media(
|
|
101
|
+
path: str = "", download_url: str = "", base64: str = "", file = None, # give exactly one
|
|
102
|
+
content: str = "", tags: str = "", profile_id: str = "",
|
|
103
|
+
idempotency_key: str = "", scope: str = "", shared_with: str = "",
|
|
104
|
+
) -> dict
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Give exactly one of `path` (a file on this computer), `download_url` (an
|
|
108
|
+
https link), `base64`, or `file` (a picture attached in a ChatGPT chat;
|
|
109
|
+
ChatGPT fills it in, never write it by hand). Two or none is refused
|
|
110
|
+
(`invalid_request`). `scope` (personal, project, shared, global) and
|
|
111
|
+
`shared_with` (comma-separated profile ids) work as in `remember`: leave them
|
|
112
|
+
unset unless the user asked to share. Formats: PNG, JPEG, GIF (first frame)
|
|
113
|
+
and WebP.
|
|
114
|
+
|
|
115
|
+
Returns `success`, `status`, and on success a `media_id` and a `resource`,
|
|
116
|
+
`slm://media/<media_id>`. Report what the tool returned; do not say "saved"
|
|
117
|
+
unless `success` is true.
|
|
118
|
+
|
|
119
|
+
### `remember_document` — save a PDF
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
remember_document(
|
|
123
|
+
path: str = "", base64: str = "", download_url: str = "", file = None, # give exactly one
|
|
124
|
+
file_name: str = "", content: str = "", tags: str = "", profile_id: str = "",
|
|
125
|
+
idempotency_key: str = "", scope: str = "", shared_with: str = "",
|
|
126
|
+
) -> dict
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Same sources and rules as `remember_media`, for a PDF. The work continues in
|
|
130
|
+
the background; the answer has a `job_id` (and `document_id`). Follow it with
|
|
131
|
+
`media_status`. Each page is indexed by its picture and its text layer.
|
|
132
|
+
|
|
133
|
+
### `media_status` — follow a document
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
media_status(job_id: str, profile_id: str = "") -> dict
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
`job_id` is the 32-character hex id from `remember_document`. Poll sparingly
|
|
140
|
+
(every few seconds at most) and stop when the job is finished or failed. A PDF that cannot
|
|
141
|
+
be finished (password-protected, over 500 pages, a page that takes too long)
|
|
142
|
+
is marked not finished with the reason in plain words. Pages read before it
|
|
143
|
+
stopped stay in memory. The dashboard has a **Try again** button, or drop the
|
|
144
|
+
same file again.
|
|
145
|
+
|
|
146
|
+
### `get_media` — look at a saved picture
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
get_media(media_id: str, variant: str = "thumb", profile_id: str = "") -> image
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Returns the thumbnail (WebP) as an image, never as text. Only `thumb`
|
|
153
|
+
exists. A thumbnail is at most 32 KB.
|
|
154
|
+
|
|
155
|
+
### `media_upload_link` — for web apps only
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
media_upload_link(kind: str = "image", note: str = "", profile_id: str = "") -> dict
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
`kind` is `image` or `document`; `note` is the words to save with the file.
|
|
162
|
+
Only an app on another computer can call it (an app on this computer gets
|
|
163
|
+
`not_for_local` and passes a `path` instead). It returns `url`, `expires_at`
|
|
164
|
+
and `max_mb`. Tell the person to open the link in any browser, pick the file
|
|
165
|
+
and press Save. The link works once, expires in 10 minutes, belongs to the app
|
|
166
|
+
that asked for it, and must not be shared. You cannot see the upload: do not
|
|
167
|
+
say the file was saved until the person tells you it was.
|
|
168
|
+
|
|
169
|
+
### Errors you will see
|
|
170
|
+
|
|
171
|
+
A refused call returns `success: false`, `status: "refused"`, a `code` and a
|
|
172
|
+
plain `error`; `retryable: true` means try again later.
|
|
173
|
+
|
|
174
|
+
| `code` | Meaning | What to do |
|
|
175
|
+
|---|---|---|
|
|
176
|
+
| `invalid_request` | Not exactly one source, a bad job id, or a `file` object without `download_url` and `file_id` | Fix the call |
|
|
177
|
+
| `not_for_remote` | This app has not been given pictures and documents | Ask the owner to allow it (see below) |
|
|
178
|
+
| `path_not_for_remote` | A web app tried to name a file on the owner's computer | Send a link or data, or use `media_upload_link` |
|
|
179
|
+
| `too_large_for_remote` | A web app pasted more than 512 KB | Use `media_upload_link` |
|
|
180
|
+
| `not_allowed`, `refused` | The daemon refused (role, size, type, a link host not on the allowed list) | Read `error`; do not retry the same call |
|
|
181
|
+
| `DAEMON_UNAVAILABLE` | SLM is not running | `slm status`, then `slm restart`; retry once |
|
|
182
|
+
| `error` | Unexpected failure, `retryable: true` | Retry once |
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## How recall returns pictures and pages
|
|
187
|
+
|
|
188
|
+
A normal `recall` searches pictures and pages beside text memories. A result
|
|
189
|
+
that came from a picture or a PDF page has a `media` block:
|
|
190
|
+
|
|
191
|
+
```json
|
|
192
|
+
{
|
|
193
|
+
"media": {
|
|
194
|
+
"media_id": "<32 hex>",
|
|
195
|
+
"kind": "image",
|
|
196
|
+
"thumbnail_uri": "slm://media/<media_id>/thumb",
|
|
197
|
+
"page": null,
|
|
198
|
+
"document_id": null,
|
|
199
|
+
"citation": ""
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
For a PDF page, `kind` is `page`, `page` is the page number, `document_id`
|
|
205
|
+
names the document and `citation` reads `page 12`. When you call `recall` from
|
|
206
|
+
an app on this computer, up to three thumbnails follow the JSON as image
|
|
207
|
+
blocks; the thumbnails are never inside `structuredContent`. Use `get_media`
|
|
208
|
+
for any other result.
|
|
209
|
+
|
|
210
|
+
Rules for reading them:
|
|
211
|
+
|
|
212
|
+
- A score ranks results; it is not a probability that the picture shows what
|
|
213
|
+
was asked. Look at the thumbnail before you say it does.
|
|
214
|
+
- If `abstained` is `true`, say you do not have a picture or page that answers
|
|
215
|
+
the question. See `slm-recall`.
|
|
216
|
+
- When you quote a PDF, give the page (`citation`) so the person can check it.
|
|
217
|
+
- A picture with no readable text is found by what it shows only. It no
|
|
218
|
+
longer comes back for a question about pictures that were never saved.
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Limits
|
|
223
|
+
|
|
224
|
+
| What | Limit |
|
|
225
|
+
|---|---|
|
|
226
|
+
| One picture | 25 MB from a file, the dashboard or an upload link; 8 MB as pasted `base64` from an app on this computer; 512 KB when a web app pastes it |
|
|
227
|
+
| One PDF | 100 MB (change with `SLM_DOC_MAX_MB`); 25 MB pasted from an app on this computer; 512 KB when a web app pastes it |
|
|
228
|
+
| PDF pages | 500. A longer PDF is refused as a whole, not cut short |
|
|
229
|
+
| Text kept from a picture | The first 8,000 characters |
|
|
230
|
+
| Pictures and PDFs per profile | 2 GB |
|
|
231
|
+
| Upload links | 3 open at a time per connected app, 20 uploads per app per day |
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Privacy: what stays and what leaves
|
|
236
|
+
|
|
237
|
+
- The models run on this computer. Pictures and PDFs are stored on this
|
|
238
|
+
computer in `media.db` and its picture folder. Location data (GPS) in a
|
|
239
|
+
photo is never read.
|
|
240
|
+
- Erasing a memory erases its picture. Removing a PDF hides all its pages.
|
|
241
|
+
- Reading a file by `path` needs the owner or an admin in a company
|
|
242
|
+
workspace. SLM's own data folder can never be named as a path or a source.
|
|
243
|
+
- A web app sees a picture or page only when it holds the pictures and
|
|
244
|
+
documents permission and the text read from that file held no secret or
|
|
245
|
+
personal data. Folders connected with `slm sources` are never shown to web
|
|
246
|
+
apps. A web app cannot change, delete, pin or replace a memory it is not
|
|
247
|
+
allowed to see: it is answered as if that memory did not exist.
|
|
248
|
+
- Pictures saved before picture search arrived are re-checked in the background and become
|
|
249
|
+
visible to web apps once their text is clean. They stay fully searchable on
|
|
250
|
+
this computer.
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Web apps: two yeses, then an upload link
|
|
255
|
+
|
|
256
|
+
A web app (ChatGPT, Claude on the web, Grok Bot, Muse, Composio) can use
|
|
257
|
+
these tools only when all of these are true. This is why a call may be
|
|
258
|
+
refused with `not_for_remote` or `not_allowed`.
|
|
259
|
+
|
|
260
|
+
1. The approval page ticked **Allow images and documents** (and, for saving,
|
|
261
|
+
**Allow saving memories**).
|
|
262
|
+
2. The **Web access** row in the dashboard's **Connected apps** has the switch
|
|
263
|
+
**Let these apps save and read pictures and documents** on, or
|
|
264
|
+
`slm remote keys allow web-<connection id> media` was run on the SLM
|
|
265
|
+
computer (find the key with `slm remote keys list`).
|
|
266
|
+
3. The key is a write key.
|
|
267
|
+
|
|
268
|
+
The owner does these steps; an agent cannot. Turning pictures off for the
|
|
269
|
+
connection also ends any upload link not yet used.
|
|
270
|
+
|
|
271
|
+
How a web app adds a file:
|
|
272
|
+
|
|
273
|
+
- **ChatGPT with an attachment.** Pass the attachment as `file` to
|
|
274
|
+
`remember_media` or `remember_document`. The computer downloads it only from
|
|
275
|
+
ChatGPT's own file hosts plus hosts the owner lists in `SLM_MEDIA_URL_HOSTS`.
|
|
276
|
+
If a save is refused with "That host is not on the allowed list", the owner
|
|
277
|
+
must add the host. Never type a link into `download_url` yourself and expect
|
|
278
|
+
it to work: links a model writes need the owner's list.
|
|
279
|
+
- **Anything else, or ChatGPT on a phone.** Call `media_upload_link`, show the
|
|
280
|
+
link, and wait for the person to say they saved the file.
|
|
281
|
+
|
|
282
|
+
A web app saves to its key's own profile only, cannot name a path, and cannot
|
|
283
|
+
pass a file the owner's list does not allow. More: `docs/remote-access/hosts.md`
|
|
284
|
+
and `docs/pictures-and-documents.md`.
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Folders and Obsidian vaults
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
slm sources add ~/Notes --kind obsidian # or --kind folder; shows what would be read, then asks
|
|
292
|
+
slm sources list
|
|
293
|
+
slm sources report <id> # what was skipped, held back or failed
|
|
294
|
+
slm sources rescan <id>
|
|
295
|
+
slm sources remove <id> [--purge] # --purge also erases the memories the folder gave
|
|
296
|
+
slm sources forget-empty <id> # for a folder you emptied on purpose
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
A source is read-only: SLM mirrors Markdown, text, canvas files, PDFs and
|
|
300
|
+
PNG, JPEG and WebP images into memory and never writes to the folder. Files
|
|
301
|
+
that look like they hold a secret are held back and listed in `report`. PDFs
|
|
302
|
+
and pictures inside a folder are read only while pictures and documents are
|
|
303
|
+
on; files skipped earlier are read on the next scan once they are. Connecting
|
|
304
|
+
a folder needs the owner or an admin. `add` asks before it connects and
|
|
305
|
+
`remove --purge` needs the typed word `erase`; without a terminal both need
|
|
306
|
+
`--yes`, so do not pass `--yes` unless the user said yes to that folder. In
|
|
307
|
+
the dashboard, **Choose folder** opens the computer's own folder picker.
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Upgrade memory engine (preview)
|
|
312
|
+
|
|
313
|
+
With pictures and documents on, `slm embedder upgrade` (or the card in
|
|
314
|
+
Settings) re-reads existing memories with the same on-device model that reads
|
|
315
|
+
pictures, so text and pictures share one search space. It runs in the
|
|
316
|
+
background, recall keeps working, the previous engine's data stays until the
|
|
317
|
+
owner frees it (`slm embedder forget-previous`), and `slm embedder rollback`
|
|
318
|
+
goes back. If it cannot run, the command prints the reason.
|
|
319
|
+
|
|
320
|
+
It is not available for text yet: recall's answer check is not calibrated for
|
|
321
|
+
EmbeddingGemma 2 (the best fit so far answered questions that have no answer),
|
|
322
|
+
so the command refuses with that reason. Do not offer it, and never pass `--force` for the user.
|
|
323
|
+
If `slm doctor` reports "Answer check fit" as a warning, the user's text already
|
|
324
|
+
moved in an earlier version: tell them `slm embedder rollback` goes back in
|
|
325
|
+
minutes (previous vectors are kept) and let them decide.
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## Related skills
|
|
330
|
+
|
|
331
|
+
- `slm-recall` — reading results and the answer check
|
|
332
|
+
- `slm-remember` — text memories; use it for facts, this skill for files
|
|
333
|
+
- `slm-web-access` — connecting web apps and the permissions above
|
|
334
|
+
- `slm-mesh` — bots can pass `media:<id>` references in messages
|
|
335
|
+
- `slm-governance` — roles that gate path reads and folders
|
|
336
|
+
- `slm-status` — `slm media status` and `slm doctor`
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
*SuperLocalMemory v4.2.6 · Qualixar · AGPL-3.0-or-later*
|