superlocalmemory 3.7.8 → 3.8.1
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 +1 -1
- package/ATTRIBUTION.md +1 -3
- package/CHANGELOG.md +129 -0
- package/README.md +205 -123
- package/package.json +12 -3
- package/plugin/.claude-plugin/plugin.json +2 -3
- package/plugin/CLAUDE.md +8 -8
- package/plugin/agents/slm-governance-advisor.md +80 -0
- package/plugin/agents/slm-loop-runner.md +71 -0
- package/plugin/agents/slm-memory-advisor.md +10 -5
- package/plugin/agents/slm-optimize-advisor.md +9 -3
- package/plugin/commands/slm-loop.md +31 -0
- package/plugin/hooks/hooks.json +79 -0
- package/plugin/requirements.txt +1 -1
- package/plugin/scripts/slm-launch +46 -7
- package/plugin/settings.json +9 -0
- package/plugin/skills/slm-cache/SKILL.md +9 -1
- package/plugin/skills/slm-compress/SKILL.md +8 -1
- package/plugin/skills/slm-governance/SKILL.md +248 -0
- package/plugin/skills/slm-graph/SKILL.md +17 -3
- package/plugin/skills/slm-loop/SKILL.md +99 -0
- package/plugin/skills/slm-mesh/SKILL.md +282 -0
- package/plugin/skills/slm-profile/SKILL.md +148 -0
- package/plugin/skills/slm-recall/SKILL.md +46 -10
- package/plugin/skills/slm-remember/SKILL.md +48 -1
- package/plugin/skills/slm-scope/SKILL.md +176 -0
- package/plugin/skills/slm-session/SKILL.md +24 -1
- package/plugin/skills/slm-status/SKILL.md +18 -1
- package/plugin-src/rules/AGENTS.md +57 -18
- package/plugin-src/skills/slm-cache/SKILL.md +9 -1
- package/plugin-src/skills/slm-compress/SKILL.md +8 -1
- package/plugin-src/skills/slm-graph/SKILL.md +17 -3
- package/plugin-src/skills/slm-recall/SKILL.md +46 -10
- package/plugin-src/skills/slm-remember/SKILL.md +48 -1
- package/plugin-src/skills/slm-session/SKILL.md +24 -1
- package/plugin-src/skills/slm-status/SKILL.md +18 -1
- package/pyproject.toml +2 -1
- package/scripts/postinstall/validation.js +2 -0
- package/scripts/postinstall-interactive.js +74 -2
- package/src/superlocalmemory/__init__.py +1 -1
- package/src/superlocalmemory/access/__init__.py +3 -0
- package/src/superlocalmemory/access/rbac.py +477 -0
- package/src/superlocalmemory/cli/commands.py +228 -17
- package/src/superlocalmemory/cli/compress_cmd.py +17 -7
- package/src/superlocalmemory/cli/daemon.py +7 -0
- package/src/superlocalmemory/cli/loop_cmd.py +187 -0
- package/src/superlocalmemory/cli/main.py +49 -8
- package/src/superlocalmemory/cli/mesh_cmd.py +38 -0
- package/src/superlocalmemory/cli/optimize_cmd.py +3 -0
- package/src/superlocalmemory/cli/pending_store.py +49 -13
- package/src/superlocalmemory/cli/proxy_cmd.py +4 -0
- package/src/superlocalmemory/cli/scale_engine_cmd.py +6 -0
- package/src/superlocalmemory/cli/setup_wizard.py +22 -13
- package/src/superlocalmemory/cli/version_banner.py +17 -3
- package/src/superlocalmemory/compliance/audit.py +6 -0
- package/src/superlocalmemory/compliance/gdpr.py +128 -138
- package/src/superlocalmemory/compliance/retention.py +176 -45
- package/src/superlocalmemory/core/backend_orchestrator.py +23 -59
- package/src/superlocalmemory/core/community_summary.py +267 -0
- package/src/superlocalmemory/core/config.py +216 -3
- package/src/superlocalmemory/core/consolidation_engine.py +95 -22
- package/src/superlocalmemory/core/context_cache.py +61 -18
- package/src/superlocalmemory/core/embedding_worker.py +21 -7
- package/src/superlocalmemory/core/embeddings.py +131 -46
- package/src/superlocalmemory/core/engine.py +41 -22
- package/src/superlocalmemory/core/engine_ingestion.py +359 -43
- package/src/superlocalmemory/core/engine_wiring.py +13 -0
- package/src/superlocalmemory/core/entity_community.py +178 -0
- package/src/superlocalmemory/core/graph_analyzer.py +39 -2
- package/src/superlocalmemory/core/graph_pruner.py +13 -8
- package/src/superlocalmemory/core/ingestion_command.py +134 -25
- package/src/superlocalmemory/core/injection.py +12 -7
- package/src/superlocalmemory/core/key_expander.py +138 -0
- package/src/superlocalmemory/core/maintenance.py +23 -0
- package/src/superlocalmemory/core/maintenance_scheduler.py +17 -7
- package/src/superlocalmemory/core/modes.py +1 -1
- package/src/superlocalmemory/core/mutations.py +2 -2
- package/src/superlocalmemory/core/pii.py +105 -0
- package/src/superlocalmemory/core/progressive_abstraction.py +208 -0
- package/src/superlocalmemory/core/recall_pipeline.py +7 -3
- package/src/superlocalmemory/core/recall_worker.py +20 -6
- package/src/superlocalmemory/core/scale_engine.py +60 -1
- package/src/superlocalmemory/core/security_primitives.py +40 -2
- package/src/superlocalmemory/core/store_pipeline.py +186 -29
- package/src/superlocalmemory/core/worker_pool.py +21 -6
- package/src/superlocalmemory/encoding/entity_reflexion.py +200 -0
- package/src/superlocalmemory/encoding/entity_resolver.py +34 -24
- package/src/superlocalmemory/encoding/fact_extractor.py +26 -1
- package/src/superlocalmemory/encoding/temporal_validator.py +64 -1
- package/src/superlocalmemory/evolution/evolution_store.py +122 -45
- package/src/superlocalmemory/evolution/llm_dispatch.py +12 -1
- package/src/superlocalmemory/evolution/model_selection.py +160 -0
- package/src/superlocalmemory/evolution/mutation_generator.py +16 -0
- package/src/superlocalmemory/evolution/skill_evolver.py +127 -42
- package/src/superlocalmemory/evolution/triggers.py +22 -13
- package/src/superlocalmemory/graph/cozo_backend.py +43 -20
- package/src/superlocalmemory/hooks/adapter_base.py +5 -1
- package/src/superlocalmemory/hooks/auto_recall.py +13 -1
- package/src/superlocalmemory/hooks/claude_code_hooks.py +11 -0
- package/src/superlocalmemory/hooks/codex_assets.py +64 -5
- package/src/superlocalmemory/hooks/hook_daemon.py +20 -3
- package/src/superlocalmemory/hooks/hook_handlers.py +6 -1
- package/src/superlocalmemory/hooks/memory_protocol.py +54 -0
- package/src/superlocalmemory/hooks/portable_kit.py +148 -3
- package/src/superlocalmemory/infra/backup.py +12 -1
- package/src/superlocalmemory/infra/daemon_identity.py +40 -4
- package/src/superlocalmemory/infra/data_root.py +43 -4
- package/src/superlocalmemory/infra/event_bus.py +107 -24
- package/src/superlocalmemory/infra/rate_limiter.py +93 -0
- package/src/superlocalmemory/ingestion/adapter_manager.py +4 -1
- package/src/superlocalmemory/ingestion/credentials.py +1 -1
- package/src/superlocalmemory/learning/cross_project.py +28 -19
- package/src/superlocalmemory/learning/model_rollback.py +3 -0
- package/src/superlocalmemory/learning/ranker_retrain_online.py +2 -0
- package/src/superlocalmemory/learning/reward.py +50 -0
- package/src/superlocalmemory/learning/reward_proxy.py +42 -9
- package/src/superlocalmemory/learning/source_quality.py +523 -1
- package/src/superlocalmemory/loops/__init__.py +56 -0
- package/src/superlocalmemory/loops/budget.py +58 -0
- package/src/superlocalmemory/loops/engine.py +164 -0
- package/src/superlocalmemory/loops/ledger.py +263 -0
- package/src/superlocalmemory/loops/models.py +152 -0
- package/src/superlocalmemory/loops/rules.py +52 -0
- package/src/superlocalmemory/mcp/_daemon_proxy.py +3 -0
- package/src/superlocalmemory/mcp/_pool_adapter.py +2 -0
- package/src/superlocalmemory/mcp/profiles.py +103 -0
- package/src/superlocalmemory/mcp/server.py +32 -79
- package/src/superlocalmemory/mcp/tools_active.py +4 -7
- package/src/superlocalmemory/mcp/tools_code_graph.py +51 -5
- package/src/superlocalmemory/mcp/tools_core.py +12 -4
- package/src/superlocalmemory/mcp/tools_evolution.py +6 -3
- package/src/superlocalmemory/mcp/tools_learning.py +2 -2
- package/src/superlocalmemory/mcp/tools_loops.py +300 -0
- package/src/superlocalmemory/mcp/tools_mesh.py +140 -4
- package/src/superlocalmemory/mcp/tools_optimize.py +15 -8
- package/src/superlocalmemory/mesh/broker.py +237 -129
- package/src/superlocalmemory/mesh/remote_sync.py +50 -8
- package/src/superlocalmemory/optimize/NOTICE +1 -6
- package/src/superlocalmemory/optimize/adapters/anthropic_adapter.py +1 -4
- package/src/superlocalmemory/optimize/adapters/openai_adapter.py +1 -4
- package/src/superlocalmemory/optimize/cache/semantic.py +27 -19
- package/src/superlocalmemory/optimize/compress/align.py +32 -26
- package/src/superlocalmemory/optimize/compress/ccr.py +14 -71
- package/src/superlocalmemory/optimize/compress/router.py +105 -22
- package/src/superlocalmemory/optimize/config/defaults.py +1 -1
- package/src/superlocalmemory/optimize/config/schema.py +87 -4
- package/src/superlocalmemory/optimize/metrics/counters.py +13 -4
- package/src/superlocalmemory/optimize/metrics/estimator.py +0 -3
- package/src/superlocalmemory/optimize/proxy/_helpers.py +31 -4
- package/src/superlocalmemory/optimize/storage/db.py +38 -9
- package/src/superlocalmemory/optimize/storage/schema.py +10 -0
- package/src/superlocalmemory/parameterization/pattern_extractor.py +6 -3
- package/src/superlocalmemory/retrieval/agentic.py +1 -1
- package/src/superlocalmemory/retrieval/bm25_channel.py +68 -10
- package/src/superlocalmemory/retrieval/engine.py +221 -47
- package/src/superlocalmemory/retrieval/entity_channel.py +7 -5
- package/src/superlocalmemory/retrieval/hopfield_channel.py +9 -2
- package/src/superlocalmemory/retrieval/reranker.py +3 -4
- package/src/superlocalmemory/retrieval/semantic_channel.py +114 -21
- package/src/superlocalmemory/retrieval/spreading_activation.py +11 -2
- package/src/superlocalmemory/retrieval/temporal_channel.py +48 -9
- package/src/superlocalmemory/retrieval/temporal_frame.py +102 -0
- package/src/superlocalmemory/retrieval/temporal_validity_filter.py +135 -0
- package/src/superlocalmemory/retrieval/time_window.py +181 -0
- package/src/superlocalmemory/server/api.py +4 -4
- package/src/superlocalmemory/server/config_file.py +90 -0
- package/src/superlocalmemory/server/origin.py +50 -0
- package/src/superlocalmemory/server/profile_runtime.py +125 -8
- package/src/superlocalmemory/server/rbac_enforce.py +142 -0
- package/src/superlocalmemory/server/recall_health.py +24 -3
- package/src/superlocalmemory/server/recall_serializer.py +19 -1
- package/src/superlocalmemory/server/routes/abstraction.py +115 -0
- package/src/superlocalmemory/server/routes/agents.py +128 -38
- package/src/superlocalmemory/server/routes/backup.py +317 -70
- package/src/superlocalmemory/server/routes/behavioral.py +349 -71
- package/src/superlocalmemory/server/routes/brain.py +69 -12
- package/src/superlocalmemory/server/routes/chat.py +10 -5
- package/src/superlocalmemory/server/routes/compliance.py +171 -21
- package/src/superlocalmemory/server/routes/config_api.py +438 -0
- package/src/superlocalmemory/server/routes/data_io.py +30 -8
- package/src/superlocalmemory/server/routes/entity.py +108 -26
- package/src/superlocalmemory/server/routes/events.py +24 -8
- package/src/superlocalmemory/server/routes/evolution.py +189 -68
- package/src/superlocalmemory/server/routes/helpers.py +16 -1
- package/src/superlocalmemory/server/routes/ingest.py +7 -4
- package/src/superlocalmemory/server/routes/insights.py +3 -3
- package/src/superlocalmemory/server/routes/learning.py +289 -118
- package/src/superlocalmemory/server/routes/learning_telemetry.py +153 -0
- package/src/superlocalmemory/server/routes/lifecycle.py +59 -8
- package/src/superlocalmemory/server/routes/memories.py +182 -57
- package/src/superlocalmemory/server/routes/mesh.py +200 -31
- package/src/superlocalmemory/server/routes/optimize.py +33 -1
- package/src/superlocalmemory/server/routes/prewarm.py +2 -0
- package/src/superlocalmemory/server/routes/profiles.py +63 -17
- package/src/superlocalmemory/server/routes/ratelimit.py +132 -0
- package/src/superlocalmemory/server/routes/rbac.py +367 -0
- package/src/superlocalmemory/server/routes/stats.py +103 -158
- package/src/superlocalmemory/server/routes/tiers.py +11 -9
- package/src/superlocalmemory/server/routes/token.py +3 -13
- package/src/superlocalmemory/server/routes/v3_api.py +247 -89
- package/src/superlocalmemory/server/routes/ws.py +5 -2
- package/src/superlocalmemory/server/security_middleware.py +12 -5
- package/src/superlocalmemory/server/ui.py +20 -5
- package/src/superlocalmemory/server/unified_daemon.py +827 -72
- package/src/superlocalmemory/server/write_identity.py +38 -8
- package/src/superlocalmemory/storage/database.py +265 -53
- package/src/superlocalmemory/storage/migration_runner.py +132 -1
- package/src/superlocalmemory/storage/migrations/M010_evolution_config.py +5 -0
- package/src/superlocalmemory/storage/migrations/M021_ingestion_log_profile.py +108 -0
- package/src/superlocalmemory/storage/migrations/M022_entity_aliases_profile.py +86 -0
- package/src/superlocalmemory/storage/migrations/M023_mesh_profile_isolation.py +194 -0
- package/src/superlocalmemory/storage/migrations/M024_rbac_users_roles.py +87 -0
- package/src/superlocalmemory/storage/migrations/M025_perf_indexes.py +90 -0
- package/src/superlocalmemory/storage/migrations/M026_rbac_memberships_fk.py +136 -0
- package/src/superlocalmemory/storage/migrations/M027_transferable_patterns_profile.py +163 -0
- package/src/superlocalmemory/storage/migrations/M028_fact_entity_associations.py +270 -0
- package/src/superlocalmemory/storage/migrations/M029_behavioral_history_indexes.py +137 -0
- package/src/superlocalmemory/storage/migrations/M030_entity_explorer_indexes.py +93 -0
- package/src/superlocalmemory/storage/migrations/__init__.py +4 -0
- package/src/superlocalmemory/storage/models.py +4 -0
- package/src/superlocalmemory/storage/schema.py +136 -1
- package/src/superlocalmemory/storage/schema_v32.py +2 -0
- package/src/superlocalmemory/storage/schema_v343.py +24 -12
- package/src/superlocalmemory/storage/schema_v347.py +4 -0
- package/src/superlocalmemory/trust/gate.py +49 -8
- package/src/superlocalmemory/ui/assets/slm-icon-white.svg +64 -0
- package/src/superlocalmemory/ui/assets/slm-icon.svg +36 -0
- package/src/superlocalmemory/ui/css/design-system.css +621 -0
- package/src/superlocalmemory/ui/css/neural-glass.css +6 -0
- package/src/superlocalmemory/ui/css/od-bridge.css +158 -0
- package/src/superlocalmemory/ui/favicon.svg +35 -4
- package/src/superlocalmemory/ui/index.html +303 -173
- package/src/superlocalmemory/ui/js/brain.js +5 -20
- package/src/superlocalmemory/ui/js/core.js +100 -41
- package/src/superlocalmemory/ui/js/dashboard.js +403 -65
- package/src/superlocalmemory/ui/js/event-delegation.js +102 -0
- package/src/superlocalmemory/ui/js/knowledge-graph.js +11 -11
- package/src/superlocalmemory/ui/js/math-health.js +1 -1
- package/src/superlocalmemory/ui/js/memories.js +15 -4
- package/src/superlocalmemory/ui/js/memory-chat.js +7 -7
- package/src/superlocalmemory/ui/js/ng-entities.js +6 -8
- package/src/superlocalmemory/ui/js/ng-ingestion.js +4 -4
- package/src/superlocalmemory/ui/js/ng-mesh.js +4 -9
- package/src/superlocalmemory/ui/js/ng-shell.js +8 -8
- package/src/superlocalmemory/ui/js/ng-skills.js +54 -2
- package/src/superlocalmemory/ui/js/od-agents.js +544 -0
- package/src/superlocalmemory/ui/js/od-auth-gate.js +257 -0
- package/src/superlocalmemory/ui/js/od-backup.js +871 -0
- package/src/superlocalmemory/ui/js/od-brain.js +816 -0
- package/src/superlocalmemory/ui/js/od-entities.js +579 -0
- package/src/superlocalmemory/ui/js/od-graph.js +600 -0
- package/src/superlocalmemory/ui/js/od-health.js +539 -0
- package/src/superlocalmemory/ui/js/od-mcp.js +508 -0
- package/src/superlocalmemory/ui/js/od-memories.js +929 -0
- package/src/superlocalmemory/ui/js/od-mesh.js +553 -0
- package/src/superlocalmemory/ui/js/od-operations.js +1250 -0
- package/src/superlocalmemory/ui/js/od-optimize.js +787 -0
- package/src/superlocalmemory/ui/js/od-settings.js +1107 -0
- package/src/superlocalmemory/ui/js/od-shell.js +809 -0
- package/src/superlocalmemory/ui/js/od-skills.js +600 -0
- package/src/superlocalmemory/ui/js/od-team.js +258 -0
- package/src/superlocalmemory/ui/js/profiles.js +159 -46
- package/src/superlocalmemory/ui/js/settings.js +17 -3
- package/src/superlocalmemory/ui/js/timeline.js +34 -5
- package/src/superlocalmemory/ui/js/trust-dashboard.js +2 -2
- package/src/superlocalmemory/vector/lancedb_backend.py +8 -6
- package/plugin-src/.mcp.json +0 -12
- package/plugin-src/agents/slm-memory-advisor.md +0 -44
- package/plugin-src/agents/slm-optimize-advisor.md +0 -38
- package/plugin-src/hooks/.gitkeep +0 -0
- package/plugin-src/hooks/hooks.json +0 -23
- package/plugin-src/manifest.json +0 -25
- package/plugin-src/requirements.txt +0 -1
- package/plugin-src/rules/CLAUDE.md.fragment +0 -44
- package/plugin-src/scripts/ensure-venv.bat +0 -122
- package/plugin-src/scripts/ensure-venv.sh +0 -105
- package/plugin-src/scripts/slm-launch +0 -23
- package/plugin-src/scripts/slm-launch.bat +0 -23
- package/plugin-src/settings.json +0 -16
- package/src/superlocalmemory/learning/behavioral_listener.py +0 -94
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slm-governance
|
|
3
|
+
description: Enterprise compliance and governed workspace behavior for SuperLocalMemory. Covers role-based access (admin/member/viewer), retention policies, audit trail, GDPR data export/erase, and how agents must behave when operating under workspace governance. Requires power MCP profile for audit/retention tools. Agents must never bypass governance controls.
|
|
4
|
+
when_to_use: |
|
|
5
|
+
- "What can I do in this workspace?" (role check)
|
|
6
|
+
- "Set a 90-day retention policy on this memory"
|
|
7
|
+
- "Show the audit trail for recent memory operations"
|
|
8
|
+
- "Export my data for GDPR compliance"
|
|
9
|
+
- "Delete all memories for user X (right to erasure)"
|
|
10
|
+
- "Configure require-login for this workspace"
|
|
11
|
+
- Enterprise deployment with multi-team shared SLM
|
|
12
|
+
- Compliance, audit, or data governance task
|
|
13
|
+
allowed-tools: audit_trail, set_retention_policy, get_retention_stats, get_lifecycle_status, recall, search, remember, Bash
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# slm-governance — Enterprise Compliance and Governed Workspace Behavior
|
|
17
|
+
|
|
18
|
+
SuperLocalMemory supports enterprise deployments with role-based access control,
|
|
19
|
+
retention policies, audit logging, and GDPR compliance tooling. This skill
|
|
20
|
+
documents how agents must behave when operating in a governed workspace and how
|
|
21
|
+
to use the governance MCP tools (available in the `power` profile).
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Role model
|
|
26
|
+
|
|
27
|
+
Governed workspaces have three roles:
|
|
28
|
+
|
|
29
|
+
| Role | Read | Write personal | Write shared/global | Admin operations |
|
|
30
|
+
|------|------|---------------|---------------------|-----------------|
|
|
31
|
+
| `viewer` | Yes | No | No | No |
|
|
32
|
+
| `member` | Yes | Yes | Yes (within access list) | No |
|
|
33
|
+
| `admin` | Yes | Yes | Yes (unrestricted) | Yes |
|
|
34
|
+
|
|
35
|
+
**Agent behavior by role:**
|
|
36
|
+
|
|
37
|
+
- **Viewer**: Only call `recall`, `search`, `fetch`, `list_recent`. Never call
|
|
38
|
+
`remember`, `update_memory`, `forget`, or any write tool. If a write is
|
|
39
|
+
attempted, fail gracefully: "This workspace is read-only in viewer mode."
|
|
40
|
+
- **Member**: May write personal facts and shared facts with permitted profiles.
|
|
41
|
+
May NOT write `scope="global"` facts without explicit admin authorization.
|
|
42
|
+
May NOT call `set_retention_policy`, `audit_trail`, or `compact_memories`.
|
|
43
|
+
- **Admin**: Full access including governance tools in the `power` profile.
|
|
44
|
+
|
|
45
|
+
An agent operating in a governed workspace must check its role before any write
|
|
46
|
+
operation. Role information is visible in workspace configuration or via
|
|
47
|
+
`slm status --json` (the `role` field, if present).
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Retention policies
|
|
52
|
+
|
|
53
|
+
Retention policies control how long facts are stored before they become eligible
|
|
54
|
+
for decay. Available in the `power` MCP profile.
|
|
55
|
+
|
|
56
|
+
### Set a retention policy
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
set_retention_policy(
|
|
60
|
+
profile_id: str = "", # "" = active profile
|
|
61
|
+
days: int = 90, # facts older than this become decay-eligible
|
|
62
|
+
zone: str = "default", # retention zone name
|
|
63
|
+
)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Retention zones let you apply different policies to different fact categories:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
# Standard facts: 90-day retention
|
|
70
|
+
set_retention_policy(profile_id="", days=90, zone="default")
|
|
71
|
+
|
|
72
|
+
# Security findings: 365-day retention (compliance requirement)
|
|
73
|
+
set_retention_policy(profile_id="", days=365, zone="security")
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Tag your facts with the zone name to route them to the right policy:
|
|
77
|
+
```
|
|
78
|
+
remember(content="Critical auth bypass in v2.1", tags="security,cve,finding", ...)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Check retention statistics
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
get_retention_stats()
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Returns zone distribution, average fact age, and decay-eligible counts. Use this
|
|
88
|
+
to verify policies are working as expected.
|
|
89
|
+
|
|
90
|
+
### Check lifecycle status
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
get_lifecycle_status()
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Reports the state of the retention and decay subsystem — whether decay cycles are
|
|
97
|
+
running, when the next cycle runs, and any backlog.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Audit trail
|
|
102
|
+
|
|
103
|
+
`audit_trail` is available in the `power` profile. It returns a structured log of
|
|
104
|
+
recent memory operations (writes, reads, profile switches, policy changes).
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
audit_trail(
|
|
108
|
+
limit: int = 50, # number of entries to return
|
|
109
|
+
operation: str = "", # filter by operation type (e.g. "remember", "forget")
|
|
110
|
+
profile_id: str = "", # filter by profile; "" = active profile
|
|
111
|
+
)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Use this for:
|
|
115
|
+
- Compliance reviews ("what data was written in the last 30 days?")
|
|
116
|
+
- Investigating unexpected memory changes
|
|
117
|
+
- Generating audit reports for data controllers
|
|
118
|
+
|
|
119
|
+
The audit trail covers MCP and CLI operations. It does not record the content of
|
|
120
|
+
facts by default — only operation type, timestamp, agent ID, and fact ID.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## GDPR compliance
|
|
125
|
+
|
|
126
|
+
### Data export
|
|
127
|
+
|
|
128
|
+
SLM does not have a dedicated MCP export tool. For GDPR data subject access
|
|
129
|
+
requests, use the CLI:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Export all memories in a profile to JSON
|
|
133
|
+
slm status --json # confirm active profile
|
|
134
|
+
slm list --limit 9999 --json > export.json
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
For a complete export including entity graph data, run:
|
|
138
|
+
```bash
|
|
139
|
+
slm status --json
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Contact your workspace admin to arrange a full database-level export if the CLI
|
|
143
|
+
output is insufficient for compliance purposes.
|
|
144
|
+
|
|
145
|
+
### Right to erasure
|
|
146
|
+
|
|
147
|
+
To erase all memories for a subject or project:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Step 1: preview what will be deleted (ALWAYS do this first)
|
|
151
|
+
slm forget "<subject or project name>" --dry-run --json
|
|
152
|
+
|
|
153
|
+
# Step 2: review the preview, then execute
|
|
154
|
+
slm forget "<subject or project name>" --yes --json
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
For targeted deletion by fact ID:
|
|
158
|
+
```bash
|
|
159
|
+
slm delete <fact_id> --yes --json
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
For data reconstruction prevention: after erasure, confirm the fact is gone by
|
|
163
|
+
running `slm recall "<content>"`. A successful erasure returns no results. Never
|
|
164
|
+
attempt to re-derive erased content from other stored facts.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## require-login
|
|
169
|
+
|
|
170
|
+
When `require_login` is enabled in workspace configuration, agents must
|
|
171
|
+
authenticate before any memory operation. SLM handles authentication at the
|
|
172
|
+
daemon level — agents do not need to pass credentials in tool calls. If an
|
|
173
|
+
agent receives an authentication error from any MCP tool, it must:
|
|
174
|
+
|
|
175
|
+
1. Stop the current operation immediately.
|
|
176
|
+
2. Report the authentication requirement to the user.
|
|
177
|
+
3. Never cache, retry, or work around the authentication block.
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Scope enforcement in governed workspaces
|
|
182
|
+
|
|
183
|
+
In a governed workspace, scope restrictions are enforced server-side:
|
|
184
|
+
- **Viewers** cannot write any fact regardless of `scope` parameter.
|
|
185
|
+
- **Members** cannot write `scope="global"` unless their access list includes
|
|
186
|
+
the global scope — attempts return a permission error.
|
|
187
|
+
- **Admins** can write any scope.
|
|
188
|
+
|
|
189
|
+
Agents must not attempt to work around scope restrictions by splitting a global
|
|
190
|
+
fact into multiple shared facts to accumulate equivalent visibility.
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Compact memories (admin-only)
|
|
195
|
+
|
|
196
|
+
`compact_memories` deduplicates and consolidates stored memories. This is an
|
|
197
|
+
admin operation — it can change fact IDs and remove content.
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
compact_memories(
|
|
201
|
+
profile_id: str = "", # "" = active profile
|
|
202
|
+
dry_run: bool = True, # ALWAYS true first — inspect before running
|
|
203
|
+
)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Always run with `dry_run=True` first and review the impact report. Never run
|
|
207
|
+
compaction without admin authorization.
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Consistency check (admin-only)
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
consistency_check(profile_id: str = "")
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Verifies data integrity of the memory store — checks for orphaned entities,
|
|
218
|
+
broken references, and index-database mismatches. Use after migrations or
|
|
219
|
+
unexpected shutdowns. Returns a structured report.
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Agent checklist for governed workspaces
|
|
224
|
+
|
|
225
|
+
Before each write operation:
|
|
226
|
+
- [ ] Confirm my role allows writes (viewer → skip; member/admin → proceed)
|
|
227
|
+
- [ ] Confirm scope is appropriate for my role (member → no global)
|
|
228
|
+
- [ ] Set correct tags including zone name if retention policy applies
|
|
229
|
+
- [ ] Pass `session_id` for full audit attribution
|
|
230
|
+
|
|
231
|
+
Before running any destructive operation (`forget`, `compact_memories`):
|
|
232
|
+
- [ ] Admin authorization confirmed
|
|
233
|
+
- [ ] Ran with `dry_run=True` and reviewed output
|
|
234
|
+
- [ ] GDPR: confirmed the subject or controller authorized the erasure
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Related skills
|
|
239
|
+
|
|
240
|
+
- `slm-scope` — scope model details (personal/shared/global)
|
|
241
|
+
- `slm-profile` — workspace isolation and profile switching
|
|
242
|
+
- `slm-remember` — fact storage reference (includes scope parameters)
|
|
243
|
+
- `slm-recall` — retrieval reference (includes scope read flags)
|
|
244
|
+
- `slm-mesh` — mesh tools (full/power profiles)
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
*SuperLocalMemory v3.8.1 · Qualixar · AGPL-3.0-or-later*
|
|
@@ -285,7 +285,8 @@ If `build_code_graph` returns `files_parsed: 0`, no supported source files were
|
|
|
285
285
|
|
|
286
286
|
## Profile Requirement
|
|
287
287
|
|
|
288
|
-
This skill uses graph tools that are only active under the `code` MCP profile
|
|
288
|
+
This skill uses graph tools that are only active under the `code` MCP profile
|
|
289
|
+
(or `full` / `power`). Your plugin `.mcp.json` must include:
|
|
289
290
|
|
|
290
291
|
```json
|
|
291
292
|
"env": {
|
|
@@ -293,8 +294,21 @@ This skill uses graph tools that are only active under the `code` MCP profile. Y
|
|
|
293
294
|
}
|
|
294
295
|
```
|
|
295
296
|
|
|
296
|
-
Without this, the six graph tools are not registered and will appear as unknown
|
|
297
|
+
Without this, the six graph tools are not registered and will appear as unknown
|
|
298
|
+
tools. Run `slm status` to confirm the active profile.
|
|
299
|
+
|
|
300
|
+
**Switching profiles at runtime (v3.8.0+):** Use `switch_profile("code")` via
|
|
301
|
+
MCP to activate the code profile in a session that started with a different
|
|
302
|
+
profile. See `slm-profile` for the full profile switching workflow.
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## Related skills
|
|
307
|
+
|
|
308
|
+
- `slm-profile` — workspace isolation and profile switching (required for code tools)
|
|
309
|
+
- `slm-recall` — retrieve architectural decisions before graph queries
|
|
310
|
+
- `slm-status` — confirm the active profile and graph index health
|
|
297
311
|
|
|
298
312
|
---
|
|
299
313
|
|
|
300
|
-
SuperLocalMemory v3.
|
|
314
|
+
SuperLocalMemory v3.8.1 · Qualixar · AGPL-3.0-or-later
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slm-loop
|
|
3
|
+
description: Run gate-verified bounded loops with SuperLocalMemory as the durable ledger. Use when a task has a checkable acceptance condition (tests, schema, lint, reconciliation) and you must iterate until an INDEPENDENT gate passes — never stopping just because the agent believes it is done. `slm loop demo` runs a keyless convergence demo; `slm loop history` and `slm loop show <run_id>` inspect past runs whose every lap is persisted 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, resume a loop"
|
|
5
|
+
allowed-tools: Bash, slm_recall
|
|
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 (see
|
|
20
|
+
rungs below).
|
|
21
|
+
|
|
22
|
+
## What SLM adds
|
|
23
|
+
|
|
24
|
+
Every lap is written to SuperLocalMemory as a durable, queryable memory (tagged
|
|
25
|
+
`loop:<name>`, session `loop:<run_id>`). That makes a run:
|
|
26
|
+
|
|
27
|
+
- **auditable** — inspect the decision + gate verdict + budget for each lap;
|
|
28
|
+
- **resumable / historical** — a run's ledger survives across sessions;
|
|
29
|
+
- **discoverable** — visible via `slm recall`, the dashboard, and any
|
|
30
|
+
SLM-integrated tool, alongside everything else the agent remembers.
|
|
31
|
+
|
|
32
|
+
## CLI
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
slm loop demo [--iterations N] [--json] # keyless convergence demo
|
|
36
|
+
slm loop history [--name NAME] [--json] # list recorded runs
|
|
37
|
+
slm loop show <run_id> [--json] # every lap of one run
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`slm loop demo` proposes a fix, checks it against a deterministic gate that
|
|
41
|
+
passes on lap 3, and records the run — a zero-setup way to see the control flow
|
|
42
|
+
and confirm the SLM-backed ledger works end to end.
|
|
43
|
+
|
|
44
|
+
## The bounds
|
|
45
|
+
|
|
46
|
+
A loop runs inside a safety envelope. Any bound tripping ends the run with
|
|
47
|
+
`HALT` (never a success):
|
|
48
|
+
|
|
49
|
+
- **max_iterations** — a hard lap cap.
|
|
50
|
+
- **no_progress_window** — consecutive no-change laps before halting a spinning
|
|
51
|
+
agent.
|
|
52
|
+
- **token budget / wall-clock** — cumulative ceilings.
|
|
53
|
+
- **kill switch** — set `SLM_LOOP_KILL` to stop before the next lap.
|
|
54
|
+
- **approval rung** — L1 (report), L2 (assisted, pauses for approval), L3
|
|
55
|
+
(unattended). L2/L3 require approval before a passing gate is accepted as
|
|
56
|
+
DONE unless approval is explicitly configured off.
|
|
57
|
+
|
|
58
|
+
## Terminal statuses — report exactly
|
|
59
|
+
|
|
60
|
+
| Status | Meaning |
|
|
61
|
+
|----------|---------|
|
|
62
|
+
| `DONE` | The independent gate passed **and** approval was granted or not required. |
|
|
63
|
+
| `HALT` | A bound tripped (iterations, no-progress, token, or wall-clock). |
|
|
64
|
+
| `PAUSE` | The gate passed but required approval is not yet granted. |
|
|
65
|
+
| `KILLED` | The external kill switch tripped between laps. |
|
|
66
|
+
| `ERROR` | The runner or gate failed to execute; inspect the lap detail. |
|
|
67
|
+
|
|
68
|
+
Say `DONE` only when the status is exactly `DONE`. Never describe `HALT`,
|
|
69
|
+
`PAUSE`, or `ERROR` as success. When halted, name which bound tripped; when
|
|
70
|
+
paused, name the approval needed; when errored, quote the short detail.
|
|
71
|
+
|
|
72
|
+
## Reporting workflow
|
|
73
|
+
|
|
74
|
+
1. Run or resume the loop.
|
|
75
|
+
2. Read back the ledger with `slm loop show <run_id>` (or `slm recall` on tag
|
|
76
|
+
`loop:<name>`).
|
|
77
|
+
3. Report the exact terminal status, the lap count, and the gate's final
|
|
78
|
+
verdict. Include the `run_id` so the run can be re-inspected later.
|
|
79
|
+
|
|
80
|
+
## Gate discipline
|
|
81
|
+
|
|
82
|
+
- The gate verifies; the runner only proposes. They are separate.
|
|
83
|
+
- Prefer a typed, parseable gate (a test exit code, a schema validation, a
|
|
84
|
+
scanner report) over a vague check. A missing tool, an empty report, or a
|
|
85
|
+
crashed scanner is **not** a clean pass — fail closed.
|
|
86
|
+
- Never use "an LLM decides it looks good" as the gate. That reintroduces the
|
|
87
|
+
exact failure mode bounded loops exist to remove.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Related skills
|
|
92
|
+
|
|
93
|
+
- `slm-status` — confirm SLM is healthy before relying on the ledger.
|
|
94
|
+
- `slm-recall` — query a loop's laps directly (`loop:<name>` tag).
|
|
95
|
+
- `slm-session` — session lifecycle around a longer loop run.
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
SuperLocalMemory v3.8.1 · Qualixar · AGPL-3.0-or-later
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slm-mesh
|
|
3
|
+
description: Cross-session peer coordination via the SLM mesh network. Lets multiple AI agent sessions on the same machine discover each other, send messages, share lightweight state, and lock files to avoid conflicts. Requires full, power, or mesh MCP profile. All 8 tools are MCP-only — there is no CLI fallback.
|
|
4
|
+
when_to_use: |
|
|
5
|
+
- Multiple agent sessions running simultaneously on the same machine
|
|
6
|
+
- "Announce what I'm working on to other sessions"
|
|
7
|
+
- "Check if another agent has locked a file before I edit it"
|
|
8
|
+
- "Send a message to the other Claude session"
|
|
9
|
+
- "Is anyone else working on this project?"
|
|
10
|
+
- Parallel agent workflows needing coordination
|
|
11
|
+
- Cross-session state sharing without persisting to the memory store
|
|
12
|
+
allowed-tools: mesh_summary, mesh_peers, mesh_send, mesh_inbox, mesh_state, mesh_lock, mesh_events, mesh_status, Bash
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# slm-mesh — Cross-Session Peer Coordination
|
|
16
|
+
|
|
17
|
+
The mesh network lets multiple AI agent sessions on the same machine discover
|
|
18
|
+
each other and coordinate in real time — without writing to the persistent
|
|
19
|
+
memory store. Mesh messages are transient (48-hour TTL); they complement memory
|
|
20
|
+
(which is durable) rather than replacing it.
|
|
21
|
+
|
|
22
|
+
Mesh is local-only: it uses the SLM daemon as a local broker. No data leaves
|
|
23
|
+
the machine.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Profile requirement
|
|
28
|
+
|
|
29
|
+
Mesh tools are available in the `full`, `power`, and `mesh` MCP profiles.
|
|
30
|
+
Confirm the active profile with `slm status` before calling mesh tools. If the
|
|
31
|
+
tools are not available, switch to `full` profile with `switch_profile("full")`
|
|
32
|
+
(requires `code` or higher active profile). See `slm-profile`.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Tool reference
|
|
37
|
+
|
|
38
|
+
### 1. `mesh_summary` — announce what this session is doing
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
mesh_summary(summary: str = "") -> dict
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Call at session start to register on the mesh and announce your purpose. Other
|
|
45
|
+
sessions can see your summary via `mesh_peers`. The session stays alive via
|
|
46
|
+
automatic heartbeat.
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
mesh_summary(summary="Refactoring auth module in api/src/auth/")
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Response: `{peer_id, summary, project_path, registered, heartbeat_active, broker_response}`
|
|
53
|
+
|
|
54
|
+
Call this once at the start of any session that will participate in the mesh.
|
|
55
|
+
The peer registration happens automatically at MCP startup, but calling
|
|
56
|
+
`mesh_summary` sets the human-readable description that other agents see.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
### 2. `mesh_peers` — list active sessions
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
mesh_peers() -> dict
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Returns all active peer sessions on this machine.
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
mesh_peers()
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Response: `{peers: [{peer_id, summary, project_path, last_seen}], count, my_peer_id}`
|
|
73
|
+
|
|
74
|
+
Use this to discover other sessions before sending a message or checking for
|
|
75
|
+
conflicts.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
### 3. `mesh_send` — send a message to another session
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
mesh_send(
|
|
83
|
+
to: str, # peer_id | "broadcast" | "project:/path/to/dir"
|
|
84
|
+
message: str, # max 4 KB — use file paths for large data
|
|
85
|
+
) -> dict
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Send a targeted, broadcast, or project-wide message.
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
# Direct message to a specific peer
|
|
92
|
+
peers = await mesh_peers()
|
|
93
|
+
target_id = peers["peers"][0]["peer_id"]
|
|
94
|
+
mesh_send(to=target_id, message="I'm starting work on auth/handler.py — please hold off")
|
|
95
|
+
|
|
96
|
+
# Broadcast to all sessions
|
|
97
|
+
mesh_send(to="broadcast", message="Deploying to staging in 5 minutes")
|
|
98
|
+
|
|
99
|
+
# Message all sessions working in the same project
|
|
100
|
+
mesh_send(to="project:/Users/me/myproject", message="Tests are green on main")
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**4 KB message cap.** For large payloads (diffs, file contents), write to a file
|
|
104
|
+
and send the path instead. The circuit breaker opens automatically if the daemon
|
|
105
|
+
is repeatedly unreachable — `mesh_send` returns `ok: false` in that case.
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
### 4. `mesh_inbox` — read messages sent to this session
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
mesh_inbox() -> dict
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Returns unread messages (direct, broadcast, and project-targeted). Messages are
|
|
116
|
+
automatically marked as read after retrieval.
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
inbox = await mesh_inbox()
|
|
120
|
+
for msg in inbox["messages"]:
|
|
121
|
+
print(msg["from"], msg["content"])
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Response: `{messages: [{id, from, content, sent_at, read}], count, unread}`
|
|
125
|
+
|
|
126
|
+
Messages auto-expire after 48 hours.
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
### 5. `mesh_state` — get or set shared coordination state
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
mesh_state(
|
|
134
|
+
key: str = "",
|
|
135
|
+
value: str = "",
|
|
136
|
+
action: str = "get", # "get" | "set"
|
|
137
|
+
) -> dict
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Shared state is visible to all authenticated peers. Use it for non-secret
|
|
141
|
+
coordination metadata: feature flags, task assignments, progress markers.
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
# Set state
|
|
145
|
+
mesh_state(key="deploy_in_progress", value="true", action="set")
|
|
146
|
+
mesh_state(key="current_reviewer", value=my_peer_id, action="set")
|
|
147
|
+
|
|
148
|
+
# Read one key
|
|
149
|
+
mesh_state(key="deploy_in_progress", action="get")
|
|
150
|
+
|
|
151
|
+
# Read all state
|
|
152
|
+
mesh_state(action="get")
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Security constraint:** Credentials, tokens, passwords, and API keys are
|
|
156
|
+
rejected by the broker. Never store secrets in shared state.
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
### 6. `mesh_lock` — file lock coordination
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
mesh_lock(
|
|
164
|
+
file_path: str, # must be an absolute path
|
|
165
|
+
action: str = "query", # "query" | "acquire" | "release"
|
|
166
|
+
) -> dict
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Check, acquire, or release a file lock before editing a shared file.
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
# Step 1: check if the file is already locked
|
|
173
|
+
lock = await mesh_lock(file_path="/abs/path/to/auth/handler.py", action="query")
|
|
174
|
+
|
|
175
|
+
if lock.get("locked"):
|
|
176
|
+
print(f"File is locked by {lock['locked_by']} — wait")
|
|
177
|
+
else:
|
|
178
|
+
# Step 2: acquire the lock
|
|
179
|
+
mesh_lock(file_path="/abs/path/to/auth/handler.py", action="acquire")
|
|
180
|
+
|
|
181
|
+
# ... edit the file ...
|
|
182
|
+
|
|
183
|
+
# Step 3: release the lock when done
|
|
184
|
+
mesh_lock(file_path="/abs/path/to/auth/handler.py", action="release")
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
`file_path` must be an absolute path (starts with `/` on Unix, drive letter on
|
|
188
|
+
Windows). Relative paths are rejected.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
### 7. `mesh_events` — recent mesh activity log
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
mesh_events() -> dict
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Returns the activity log for the mesh network: peer joins, leaves, messages sent,
|
|
199
|
+
and state changes. Use to understand what other sessions have been doing.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
### 8. `mesh_status` — mesh broker health
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
mesh_status() -> dict
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Returns broker uptime, peer count, and connection health. Use at session start
|
|
210
|
+
to confirm the mesh is available before relying on coordination.
|
|
211
|
+
|
|
212
|
+
Response includes: `broker_up`, `peer_count`, `uptime_seconds`, `my_peer_id`,
|
|
213
|
+
`heartbeat_active`.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Common workflow: parallel agents coordinating on a shared repo
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
# Both agents call at session start:
|
|
221
|
+
await mesh_summary(summary="Working on feature/auth-refactor")
|
|
222
|
+
|
|
223
|
+
# Agent A: check who else is active
|
|
224
|
+
peers = await mesh_peers()
|
|
225
|
+
# → sees Agent B working on the same project
|
|
226
|
+
|
|
227
|
+
# Agent A: before editing a shared file
|
|
228
|
+
lock = await mesh_lock("/repo/src/auth/handler.py", action="query")
|
|
229
|
+
if not lock.get("locked"):
|
|
230
|
+
await mesh_lock("/repo/src/auth/handler.py", action="acquire")
|
|
231
|
+
# ... edit handler.py ...
|
|
232
|
+
await mesh_lock("/repo/src/auth/handler.py", action="release")
|
|
233
|
+
|
|
234
|
+
# Agent A: after finishing a phase
|
|
235
|
+
await mesh_send(to="project:/repo", message="Auth refactor complete — handler.py ready for review")
|
|
236
|
+
|
|
237
|
+
# Agent B: check inbox
|
|
238
|
+
inbox = await mesh_inbox()
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Mesh vs memory: when to use which
|
|
244
|
+
|
|
245
|
+
| Need | Use |
|
|
246
|
+
|------|-----|
|
|
247
|
+
| Ephemeral coordination signal (< 48h) | `mesh_send` / `mesh_state` |
|
|
248
|
+
| Durable fact across sessions/days | `remember` |
|
|
249
|
+
| File conflict prevention | `mesh_lock` |
|
|
250
|
+
| Cross-profile fact sharing | `scope="shared"/"global"` on `remember` |
|
|
251
|
+
| Session announcement | `mesh_summary` |
|
|
252
|
+
| Finding parallel agents | `mesh_peers` |
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Error handling
|
|
257
|
+
|
|
258
|
+
All 8 mesh tools return structured errors — they never raise exceptions.
|
|
259
|
+
|
|
260
|
+
| Error | Cause | Action |
|
|
261
|
+
|-------|-------|--------|
|
|
262
|
+
| `broker_up: false` from `mesh_status` | Daemon not running or mesh not configured | Run `slm status` to check daemon health |
|
|
263
|
+
| `ok: false` from `mesh_send` with circuit-breaker message | Repeated daemon unreachability | Daemon unreachable; stop sending until broker is up |
|
|
264
|
+
| `ok: false` from `mesh_lock` | Lock operation failed | Check `file_path` is absolute; retry once |
|
|
265
|
+
| Empty `peers` from `mesh_peers` | No other sessions registered | You're the only active session |
|
|
266
|
+
|
|
267
|
+
Mesh failures are non-fatal for the primary task. If `mesh_status` shows
|
|
268
|
+
`broker_up: false`, proceed without mesh coordination — do not block work on
|
|
269
|
+
mesh availability.
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Related skills
|
|
274
|
+
|
|
275
|
+
- `slm-profile` — activate full/power/mesh profile to access mesh tools
|
|
276
|
+
- `slm-scope` — for durable cross-profile sharing (complement to transient mesh state)
|
|
277
|
+
- `slm-remember` — persist coordination decisions that should survive session end
|
|
278
|
+
- `slm-governance` — enterprise governance of mesh (who can send/receive)
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
*SuperLocalMemory v3.8.1 · Qualixar · AGPL-3.0-or-later*
|