superlocalmemory 3.4.19 → 3.4.22
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/CHANGELOG.md +24 -0
- package/README.md +42 -34
- package/bin/slm +11 -0
- package/bin/slm.bat +12 -0
- package/package.json +4 -3
- package/pyproject.toml +4 -3
- package/scripts/build-slm-hook.ps1 +40 -0
- package/scripts/build-slm-hook.sh +45 -0
- package/scripts/build_entry.py +452 -0
- package/scripts/ci/stage5b_gate.sh +50 -0
- package/scripts/postinstall/validation.js +187 -0
- package/scripts/postinstall-interactive.js +756 -0
- package/scripts/postinstall_binary.js +287 -0
- package/scripts/release_manifest.py +273 -0
- package/scripts/slm-hook.spec +56 -0
- package/skills/slm-build-graph/SKILL.md +423 -0
- package/skills/slm-list-recent/SKILL.md +348 -0
- package/skills/slm-recall/SKILL.md +343 -0
- package/skills/slm-remember/SKILL.md +194 -0
- package/skills/slm-show-patterns/SKILL.md +224 -0
- package/skills/slm-status/SKILL.md +363 -0
- package/skills/slm-switch-profile/SKILL.md +442 -0
- package/src/superlocalmemory/cli/commands.py +254 -79
- package/src/superlocalmemory/cli/context_commands.py +192 -0
- package/src/superlocalmemory/cli/daemon.py +15 -1
- package/src/superlocalmemory/cli/db_migrate.py +80 -0
- package/src/superlocalmemory/cli/escape_hatch.py +220 -0
- package/src/superlocalmemory/cli/main.py +72 -1
- package/src/superlocalmemory/core/context_cache.py +397 -0
- package/src/superlocalmemory/core/engine.py +38 -2
- package/src/superlocalmemory/core/engine_wiring.py +1 -1
- package/src/superlocalmemory/core/ram_lock.py +111 -0
- package/src/superlocalmemory/core/recall_pipeline.py +433 -3
- package/src/superlocalmemory/core/recall_worker.py +8 -3
- package/src/superlocalmemory/core/security_primitives.py +635 -0
- package/src/superlocalmemory/core/shadow_router.py +319 -0
- package/src/superlocalmemory/core/slm_disabled.py +87 -0
- package/src/superlocalmemory/core/slmignore.py +125 -0
- package/src/superlocalmemory/core/topic_signature.py +143 -0
- package/src/superlocalmemory/core/worker_pool.py +14 -3
- package/src/superlocalmemory/encoding/cognitive_consolidator.py +2 -2
- package/src/superlocalmemory/evolution/budget.py +321 -0
- package/src/superlocalmemory/evolution/llm_dispatch.py +508 -0
- package/src/superlocalmemory/evolution/skill_evolver.py +144 -94
- package/src/superlocalmemory/hooks/_outcome_common.py +506 -0
- package/src/superlocalmemory/hooks/adapter_base.py +317 -0
- package/src/superlocalmemory/hooks/antigravity_adapter.py +192 -0
- package/src/superlocalmemory/hooks/claude_code_hooks.py +33 -1
- package/src/superlocalmemory/hooks/context_payload.py +312 -0
- package/src/superlocalmemory/hooks/copilot_adapter.py +154 -0
- package/src/superlocalmemory/hooks/cross_platform_connector.py +90 -0
- package/src/superlocalmemory/hooks/cursor_adapter.py +195 -0
- package/src/superlocalmemory/hooks/hook_handlers.py +109 -8
- package/src/superlocalmemory/hooks/ide_connector.py +25 -2
- package/src/superlocalmemory/hooks/post_tool_async_hook.py +165 -0
- package/src/superlocalmemory/hooks/post_tool_outcome_hook.py +223 -0
- package/src/superlocalmemory/hooks/prewarm_auth.py +170 -0
- package/src/superlocalmemory/hooks/session_registry.py +186 -0
- package/src/superlocalmemory/hooks/stop_outcome_hook.py +134 -0
- package/src/superlocalmemory/hooks/sync_loop.py +114 -0
- package/src/superlocalmemory/hooks/user_prompt_hook.py +128 -0
- package/src/superlocalmemory/hooks/user_prompt_rehash_hook.py +202 -0
- package/src/superlocalmemory/infra/backup.py +3 -3
- package/src/superlocalmemory/infra/cloud_backup.py +2 -2
- package/src/superlocalmemory/infra/event_bus.py +2 -2
- package/src/superlocalmemory/infra/webhook_dispatcher.py +3 -3
- package/src/superlocalmemory/learning/arm_catalog.py +99 -0
- package/src/superlocalmemory/learning/bandit.py +526 -0
- package/src/superlocalmemory/learning/bandit_cache.py +133 -0
- package/src/superlocalmemory/learning/behavioral.py +53 -1
- package/src/superlocalmemory/learning/consolidation_cycle.py +381 -0
- package/src/superlocalmemory/learning/consolidation_worker.py +188 -520
- package/src/superlocalmemory/learning/database.py +256 -0
- package/src/superlocalmemory/learning/dedup_hnsw.py +413 -0
- package/src/superlocalmemory/learning/ensemble.py +300 -0
- package/src/superlocalmemory/learning/fact_outcome_joins.py +207 -0
- package/src/superlocalmemory/learning/forgetting_scheduler.py +55 -0
- package/src/superlocalmemory/learning/hnsw_dedup.py +69 -0
- package/src/superlocalmemory/learning/labeler.py +87 -0
- package/src/superlocalmemory/learning/legacy_migration.py +277 -0
- package/src/superlocalmemory/learning/memory_merge.py +160 -0
- package/src/superlocalmemory/learning/model_cache.py +269 -0
- package/src/superlocalmemory/learning/model_rollback.py +278 -0
- package/src/superlocalmemory/learning/outcome_queue.py +284 -0
- package/src/superlocalmemory/learning/pattern_miner.py +415 -0
- package/src/superlocalmemory/learning/pattern_miner_constants.py +47 -0
- package/src/superlocalmemory/learning/ranker.py +225 -81
- package/src/superlocalmemory/learning/ranker_common.py +163 -0
- package/src/superlocalmemory/learning/ranker_retrain_legacy.py +202 -0
- package/src/superlocalmemory/learning/ranker_retrain_online.py +411 -0
- package/src/superlocalmemory/learning/reward.py +777 -0
- package/src/superlocalmemory/learning/reward_archive.py +210 -0
- package/src/superlocalmemory/learning/reward_boost.py +201 -0
- package/src/superlocalmemory/learning/reward_proxy.py +326 -0
- package/src/superlocalmemory/learning/shadow_test.py +524 -0
- package/src/superlocalmemory/learning/signal_worker.py +270 -0
- package/src/superlocalmemory/learning/signals.py +314 -0
- package/src/superlocalmemory/learning/trigram_index.py +547 -0
- package/src/superlocalmemory/mcp/server.py +5 -5
- package/src/superlocalmemory/mcp/tools_context.py +183 -0
- package/src/superlocalmemory/mcp/tools_core.py +92 -27
- package/src/superlocalmemory/parameterization/soft_prompt_generator.py +13 -0
- package/src/superlocalmemory/retrieval/engine.py +52 -0
- package/src/superlocalmemory/server/api.py +2 -2
- package/src/superlocalmemory/server/bandit_loops.py +140 -0
- package/src/superlocalmemory/server/middleware/__init__.py +11 -0
- package/src/superlocalmemory/server/middleware/security_headers.py +144 -0
- package/src/superlocalmemory/server/routes/backup.py +36 -13
- package/src/superlocalmemory/server/routes/behavioral.py +50 -19
- package/src/superlocalmemory/server/routes/brain.py +1234 -0
- package/src/superlocalmemory/server/routes/data_io.py +4 -4
- package/src/superlocalmemory/server/routes/events.py +2 -2
- package/src/superlocalmemory/server/routes/helpers.py +1 -1
- package/src/superlocalmemory/server/routes/learning.py +192 -7
- package/src/superlocalmemory/server/routes/memories.py +189 -1
- package/src/superlocalmemory/server/routes/prewarm.py +171 -0
- package/src/superlocalmemory/server/routes/profiles.py +3 -3
- package/src/superlocalmemory/server/routes/token.py +88 -0
- package/src/superlocalmemory/server/routes/ws.py +5 -5
- package/src/superlocalmemory/server/security_middleware.py +13 -7
- package/src/superlocalmemory/server/ui.py +2 -2
- package/src/superlocalmemory/server/unified_daemon.py +335 -3
- package/src/superlocalmemory/skills/slm-build-graph/SKILL.md +423 -0
- package/src/superlocalmemory/skills/slm-list-recent/SKILL.md +348 -0
- package/src/superlocalmemory/skills/slm-recall/SKILL.md +343 -0
- package/src/superlocalmemory/skills/slm-remember/SKILL.md +194 -0
- package/src/superlocalmemory/skills/slm-show-patterns/SKILL.md +224 -0
- package/src/superlocalmemory/skills/slm-status/SKILL.md +363 -0
- package/src/superlocalmemory/skills/slm-switch-profile/SKILL.md +442 -0
- package/src/superlocalmemory/storage/migration_runner.py +545 -0
- package/src/superlocalmemory/storage/migrations/M001_add_signal_features_columns.py +67 -0
- package/src/superlocalmemory/storage/migrations/M002_model_state_history.py +132 -0
- package/src/superlocalmemory/storage/migrations/M003_migration_log.py +38 -0
- package/src/superlocalmemory/storage/migrations/M004_cross_platform_sync_log.py +46 -0
- package/src/superlocalmemory/storage/migrations/M005_bandit_tables.py +75 -0
- package/src/superlocalmemory/storage/migrations/M006_action_outcomes_reward.py +75 -0
- package/src/superlocalmemory/storage/migrations/M007_pending_outcomes.py +63 -0
- package/src/superlocalmemory/storage/migrations/M009_model_lineage.py +54 -0
- package/src/superlocalmemory/storage/migrations/M010_evolution_config.py +75 -0
- package/src/superlocalmemory/storage/migrations/M011_archive_and_merge.py +87 -0
- package/src/superlocalmemory/storage/migrations/M012_shadow_observations.py +72 -0
- package/src/superlocalmemory/storage/migrations/M013_bi_temporal_columns.py +55 -0
- package/src/superlocalmemory/storage/migrations/__init__.py +81 -0
- package/src/superlocalmemory/storage/models.py +4 -0
- package/src/superlocalmemory/ui/css/brain.css +409 -0
- package/src/superlocalmemory/ui/css/legacy-dashboard.css +645 -0
- package/src/superlocalmemory/ui/index.html +459 -1345
- package/src/superlocalmemory/ui/js/brain.js +1321 -0
- package/src/superlocalmemory/ui/js/clusters.js +123 -4
- package/src/superlocalmemory/ui/js/init.js +48 -39
- package/src/superlocalmemory/ui/js/memories.js +88 -2
- package/src/superlocalmemory/ui/js/modal.js +71 -1
- package/src/superlocalmemory/ui/js/ng-shell.js +101 -88
- package/src/superlocalmemory/ui/js/trust-dashboard.js +168 -25
- package/src/superlocalmemory/ui/vendor/bootstrap-icons/bootstrap-icons.css +2018 -0
- package/src/superlocalmemory/ui/vendor/bootstrap-icons/fonts/bootstrap-icons.woff +0 -0
- package/src/superlocalmemory/ui/vendor/bootstrap-icons/fonts/bootstrap-icons.woff2 +0 -0
- package/src/superlocalmemory/ui/vendor/bootstrap.bundle.min.js +7 -0
- package/src/superlocalmemory/ui/vendor/bootstrap.min.css +6 -0
- package/src/superlocalmemory/ui/vendor/d3.v7.min.js +2 -0
- package/src/superlocalmemory/ui/vendor/graphology-library.min.js +2 -0
- package/src/superlocalmemory/ui/vendor/graphology.umd.min.js +2 -0
- package/src/superlocalmemory/ui/vendor/inter-ui/inter-variable.min.css +8 -0
- package/src/superlocalmemory/ui/vendor/inter-ui/variable/InterVariable-Italic.woff2 +0 -0
- package/src/superlocalmemory/ui/vendor/inter-ui/variable/InterVariable.woff2 +0 -0
- package/src/superlocalmemory/ui/vendor/sigma.min.js +1 -0
- package/src/superlocalmemory/ui/js/behavioral.js +0 -447
- package/src/superlocalmemory/ui/js/graph-core.js +0 -447
- package/src/superlocalmemory/ui/js/graph-interactions.js +0 -351
- package/src/superlocalmemory/ui/js/learning.js +0 -435
- package/src/superlocalmemory/ui/js/patterns.js +0 -93
- package/src/superlocalmemory.egg-info/PKG-INFO +0 -647
- package/src/superlocalmemory.egg-info/SOURCES.txt +0 -335
- package/src/superlocalmemory.egg-info/dependency_links.txt +0 -1
- package/src/superlocalmemory.egg-info/entry_points.txt +0 -2
- package/src/superlocalmemory.egg-info/requires.txt +0 -58
- package/src/superlocalmemory.egg-info/top_level.txt +0 -1
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slm-remember
|
|
3
|
+
description: Save content to SuperLocalMemory with intelligent indexing and knowledge graph integration. Use when the user wants to remember information, save context, store coding decisions, or persist knowledge for future sessions. Automatically indexes, graphs, and learns patterns.
|
|
4
|
+
version: "3.4.22"
|
|
5
|
+
license: AGPL-3.0-or-later
|
|
6
|
+
compatibility: "Requires SuperLocalMemory V2 installed at ~/.claude-memory/"
|
|
7
|
+
attribution:
|
|
8
|
+
creator: Varun Pratap Bhardwaj
|
|
9
|
+
role: Solution Architect & Original Creator
|
|
10
|
+
project: SuperLocalMemory V2
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# SuperLocalMemory: Remember
|
|
14
|
+
|
|
15
|
+
Save content to your local memory system with automatic indexing, knowledge graph integration, and pattern learning.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
slm remember "<content>" [--tags tag1,tag2] [--project name] [--importance 1-10]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Examples
|
|
24
|
+
|
|
25
|
+
### Example 1: Basic Memory
|
|
26
|
+
```bash
|
|
27
|
+
slm remember "We use FastAPI for REST APIs"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**What happens:**
|
|
31
|
+
- Content saved to SQLite database
|
|
32
|
+
- TF-IDF vectors generated for semantic search
|
|
33
|
+
- Entities extracted and added to knowledge graph
|
|
34
|
+
- Pattern learning analyzes for coding preferences
|
|
35
|
+
- Memory ID returned (e.g., 42)
|
|
36
|
+
|
|
37
|
+
### Example 2: With Tags
|
|
38
|
+
```bash
|
|
39
|
+
slm remember "JWT tokens expire after 24 hours" --tags security,auth,jwt
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Tags help with:**
|
|
43
|
+
- Organization
|
|
44
|
+
- Filtering
|
|
45
|
+
- Related memory discovery
|
|
46
|
+
|
|
47
|
+
### Example 3: With Project
|
|
48
|
+
```bash
|
|
49
|
+
slm remember "Database uses PostgreSQL 15 with UUID primary keys" --project myapp --tags database,postgresql
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Project isolation:**
|
|
53
|
+
- Separate memories per project
|
|
54
|
+
- Switch profiles with `slm switch-profile`
|
|
55
|
+
- No context bleeding
|
|
56
|
+
|
|
57
|
+
### Example 4: Important Memory
|
|
58
|
+
```bash
|
|
59
|
+
slm remember "CRITICAL: Production deploy requires approval from @lead" --importance 10 --tags deployment,production
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Importance (1-10):**
|
|
63
|
+
- 1-3: Low priority (notes, ideas)
|
|
64
|
+
- 4-6: Normal (coding patterns, decisions)
|
|
65
|
+
- 7-9: High priority (critical info, warnings)
|
|
66
|
+
- 10: Critical (blockers, security issues)
|
|
67
|
+
|
|
68
|
+
## Arguments
|
|
69
|
+
|
|
70
|
+
| Argument | Type | Required | Default | Description |
|
|
71
|
+
|----------|------|----------|---------|-------------|
|
|
72
|
+
| `<content>` | string | Yes | - | The text to remember |
|
|
73
|
+
| `--tags` | string | No | None | Comma-separated tags |
|
|
74
|
+
| `--project` | string | No | "default" | Project name |
|
|
75
|
+
| `--importance` | integer | No | 5 | Priority level (1-10) |
|
|
76
|
+
|
|
77
|
+
## Output
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
Memory added with ID: 42
|
|
81
|
+
|
|
82
|
+
✅ Memory saved successfully
|
|
83
|
+
|
|
84
|
+
Next steps:
|
|
85
|
+
• Use `slm recall <query>` to search this memory
|
|
86
|
+
• Use `slm list` to see recent memories
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## What Happens Behind the Scenes
|
|
90
|
+
|
|
91
|
+
1. **Content Storage:** Saved to SQLite (`~/.claude-memory/memory.db`)
|
|
92
|
+
2. **Semantic Indexing:** TF-IDF vectors generated for similarity search
|
|
93
|
+
3. **Knowledge Graph:** Entities extracted and nodes/edges created
|
|
94
|
+
4. **Pattern Learning:** Analyzes content for coding preferences (frameworks, style, testing)
|
|
95
|
+
5. **Full-Text Index:** FTS5 index updated for fast keyword search
|
|
96
|
+
6. **Timestamp:** Created timestamp recorded
|
|
97
|
+
|
|
98
|
+
## Advanced Usage
|
|
99
|
+
|
|
100
|
+
### Natural Language (in AI chat)
|
|
101
|
+
|
|
102
|
+
Most AI assistants will automatically invoke this skill when you say:
|
|
103
|
+
- "Remember that..."
|
|
104
|
+
- "Save this for later..."
|
|
105
|
+
- "I want to store..."
|
|
106
|
+
- "Keep track of..."
|
|
107
|
+
|
|
108
|
+
**Example in Cursor/Claude:**
|
|
109
|
+
```
|
|
110
|
+
You: "Remember that we decided to use React hooks over class components"
|
|
111
|
+
AI: [Automatically invokes slm-remember skill]
|
|
112
|
+
✓ Memory saved
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Bulk Import
|
|
116
|
+
|
|
117
|
+
Save multiple memories from a file:
|
|
118
|
+
```bash
|
|
119
|
+
# From text file (one memory per line)
|
|
120
|
+
while IFS= read -r line; do
|
|
121
|
+
slm remember "$line" --project bulk-import
|
|
122
|
+
done < memories.txt
|
|
123
|
+
|
|
124
|
+
# From CSV (content,tags,project)
|
|
125
|
+
while IFS=',' read -r content tags project; do
|
|
126
|
+
slm remember "$content" --tags "$tags" --project "$project"
|
|
127
|
+
done < memories.csv
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Integration with Git Hooks
|
|
131
|
+
|
|
132
|
+
**Pre-commit hook** (save commit messages):
|
|
133
|
+
```bash
|
|
134
|
+
#!/bin/bash
|
|
135
|
+
# .git/hooks/post-commit
|
|
136
|
+
|
|
137
|
+
commit_msg=$(git log -1 --pretty=%B)
|
|
138
|
+
commit_hash=$(git log -1 --pretty=%H)
|
|
139
|
+
|
|
140
|
+
slm remember "Commit: $commit_msg (${commit_hash:0:7})" \
|
|
141
|
+
--tags git,commit \
|
|
142
|
+
--project "$(basename $(git rev-parse --show-toplevel))"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Error Handling
|
|
146
|
+
|
|
147
|
+
| Error | Cause | Solution |
|
|
148
|
+
|-------|-------|----------|
|
|
149
|
+
| "Database locked" | Another process accessing DB | Wait or `killall python3` |
|
|
150
|
+
| "Content cannot be empty" | Empty string passed | Provide content |
|
|
151
|
+
| "Invalid importance" | Value not 1-10 | Use number between 1-10 |
|
|
152
|
+
| "Database not found" | SuperLocalMemory not installed | Run `./install.sh` |
|
|
153
|
+
|
|
154
|
+
## Notes
|
|
155
|
+
|
|
156
|
+
- **100% local:** Nothing leaves your machine
|
|
157
|
+
- **Cross-tool sync:** All AI tools access same database (Cursor, ChatGPT, Claude, etc.)
|
|
158
|
+
- **Unlimited:** No memory limits, no quotas
|
|
159
|
+
- **Privacy:** Your data stays on your computer
|
|
160
|
+
- **Profiles:** Use `slm switch-profile` for profile isolation
|
|
161
|
+
|
|
162
|
+
## Related Commands
|
|
163
|
+
|
|
164
|
+
- `slm recall "<query>"` - Search memories semantically
|
|
165
|
+
- `slm list` - List recent memories
|
|
166
|
+
- `slm status` - Check system health
|
|
167
|
+
- `slm build-graph` - Rebuild knowledge graph
|
|
168
|
+
- `slm switch-profile <name>` - Switch memory profile
|
|
169
|
+
|
|
170
|
+
## Technical Details
|
|
171
|
+
|
|
172
|
+
**Database Schema:**
|
|
173
|
+
- Table: `memories`
|
|
174
|
+
- Fields: id, content, tags, project_name, importance, created_at, etc.
|
|
175
|
+
- Indexes: Full-text search (FTS5), TF-IDF vectors, timestamps
|
|
176
|
+
|
|
177
|
+
**Performance:**
|
|
178
|
+
- Add memory: ~50ms
|
|
179
|
+
- With knowledge graph: ~300ms
|
|
180
|
+
- Large content (10KB): ~1s
|
|
181
|
+
|
|
182
|
+
**Limits:**
|
|
183
|
+
- Max content size: 1MB
|
|
184
|
+
- Max tags: 50 per memory
|
|
185
|
+
- Max project name: 64 characters
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
**Created by:** [Varun Pratap Bhardwaj](https://github.com/varun369) (Solution Architect)
|
|
190
|
+
**Project:** SuperLocalMemory V2
|
|
191
|
+
**License:** MIT (see [LICENSE](../../LICENSE))
|
|
192
|
+
**Repository:** https://github.com/varun369/SuperLocalMemoryV2
|
|
193
|
+
|
|
194
|
+
*Open source doesn't mean removing credit. Attribution must be preserved per MIT License terms.*
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slm-show-patterns
|
|
3
|
+
description: Show what SuperLocalMemory has learned about your preferences, workflow patterns, and project context. Use when the user asks "what have you learned about me?" or wants to see their coding identity patterns. Shows tech preferences, workflow sequences, and engagement health.
|
|
4
|
+
version: "2.7.0"
|
|
5
|
+
license: AGPL-3.0-or-later
|
|
6
|
+
compatibility: "Requires SuperLocalMemory V2.7+ with learning features"
|
|
7
|
+
attribution:
|
|
8
|
+
creator: Varun Pratap Bhardwaj
|
|
9
|
+
role: Solution Architect & Original Creator
|
|
10
|
+
project: SuperLocalMemory V2
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# SuperLocalMemory: Show Patterns
|
|
14
|
+
|
|
15
|
+
Show what SuperLocalMemory has learned about your preferences, workflow, and coding identity.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
slm patterns list [threshold]
|
|
21
|
+
slm learning status
|
|
22
|
+
slm engagement
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Example Output
|
|
26
|
+
|
|
27
|
+
### Learned Patterns
|
|
28
|
+
```bash
|
|
29
|
+
$ slm patterns list 0.5
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**Output:**
|
|
33
|
+
```
|
|
34
|
+
Learned Patterns (confidence >= 0.5)
|
|
35
|
+
=====================================
|
|
36
|
+
|
|
37
|
+
TECH PREFERENCES (cross-project):
|
|
38
|
+
#1 preferred_framework: React confidence: 0.92 (seen in 3 profiles)
|
|
39
|
+
#2 preferred_language: Python confidence: 0.88 (seen in 2 profiles)
|
|
40
|
+
#3 preferred_backend: FastAPI confidence: 0.85 (seen in 2 profiles)
|
|
41
|
+
#4 testing_style: pytest confidence: 0.78 (seen in 1 profile)
|
|
42
|
+
#5 preferred_db: PostgreSQL confidence: 0.71 (seen in 2 profiles)
|
|
43
|
+
|
|
44
|
+
WORKFLOW PATTERNS:
|
|
45
|
+
#6 morning_sequence: recall -> code -> remember frequency: 34
|
|
46
|
+
#7 debug_sequence: recall -> recall -> remember frequency: 18
|
|
47
|
+
#8 review_sequence: list -> recall -> remember frequency: 12
|
|
48
|
+
|
|
49
|
+
PROJECT CONTEXT:
|
|
50
|
+
#9 active_project: SuperLocalMemoryV2 last_seen: 2 hours ago
|
|
51
|
+
#10 active_project: client-dashboard last_seen: 1 day ago
|
|
52
|
+
|
|
53
|
+
Total: 10 patterns (7 high confidence)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Learning Status
|
|
57
|
+
```bash
|
|
58
|
+
$ slm learning status
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Output:**
|
|
62
|
+
```
|
|
63
|
+
SuperLocalMemory v2.7 -- Learning System Status
|
|
64
|
+
==================================================
|
|
65
|
+
LightGBM: installed (4.5.0)
|
|
66
|
+
SciPy: installed (1.14.1)
|
|
67
|
+
ML Ranking: available
|
|
68
|
+
Full Learning: available
|
|
69
|
+
|
|
70
|
+
Feedback signals: 247
|
|
71
|
+
Unique queries: 89
|
|
72
|
+
Patterns learned: 34 (12 high confidence)
|
|
73
|
+
Workflow patterns: 8
|
|
74
|
+
Sources tracked: 4
|
|
75
|
+
Models trained: 2
|
|
76
|
+
Learning DB size: 128 KB
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Engagement Metrics
|
|
80
|
+
```bash
|
|
81
|
+
$ slm engagement
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Output:**
|
|
85
|
+
```
|
|
86
|
+
SuperLocalMemory -- Engagement Health
|
|
87
|
+
======================================
|
|
88
|
+
Status: HEALTHY
|
|
89
|
+
|
|
90
|
+
This Week:
|
|
91
|
+
Memories saved: 12
|
|
92
|
+
Recalls performed: 28
|
|
93
|
+
Memories marked useful: 8
|
|
94
|
+
Feedback ratio: 28.6%
|
|
95
|
+
|
|
96
|
+
Trends:
|
|
97
|
+
Recall frequency: increasing (up 15% from last week)
|
|
98
|
+
Save frequency: stable
|
|
99
|
+
Useful feedback: increasing (up 40% from last week)
|
|
100
|
+
|
|
101
|
+
Streaks:
|
|
102
|
+
Current daily streak: 5 days
|
|
103
|
+
Longest streak: 14 days
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## What the Patterns Mean
|
|
107
|
+
|
|
108
|
+
### Tech Preferences
|
|
109
|
+
Cross-project patterns that transfer between profiles. These represent your coding identity -- which frameworks, languages, and tools you consistently choose.
|
|
110
|
+
|
|
111
|
+
**How they are learned:**
|
|
112
|
+
- Extracted from memory content (mentions of frameworks, tools)
|
|
113
|
+
- Weighted by recency and frequency
|
|
114
|
+
- Confidence increases when the same preference appears across multiple profiles
|
|
115
|
+
|
|
116
|
+
**How they help:**
|
|
117
|
+
- When you `recall`, results matching your preferred stack rank higher
|
|
118
|
+
- Your AI tools can reference these to tailor suggestions
|
|
119
|
+
|
|
120
|
+
### Workflow Patterns
|
|
121
|
+
Sequences of actions you repeat. The system learns your work rhythm.
|
|
122
|
+
|
|
123
|
+
**Examples:**
|
|
124
|
+
- `recall -> code -> remember` = "Research, build, document" workflow
|
|
125
|
+
- `recall -> recall -> remember` = "Deep investigation" workflow
|
|
126
|
+
|
|
127
|
+
**How they help:**
|
|
128
|
+
- System predicts what you will need next
|
|
129
|
+
- Can pre-load relevant context based on your current workflow stage
|
|
130
|
+
|
|
131
|
+
### Engagement Health
|
|
132
|
+
Overall system usage metrics (fully local, zero telemetry).
|
|
133
|
+
|
|
134
|
+
**Healthy indicators:**
|
|
135
|
+
- Regular daily usage (streaks)
|
|
136
|
+
- Balanced save/recall ratio
|
|
137
|
+
- Increasing useful feedback
|
|
138
|
+
|
|
139
|
+
**Warning signs:**
|
|
140
|
+
- No recalls for 7+ days = stale memories
|
|
141
|
+
- No saves for 7+ days = not capturing knowledge
|
|
142
|
+
- Zero feedback = system cannot learn your preferences
|
|
143
|
+
|
|
144
|
+
## Correcting Patterns
|
|
145
|
+
|
|
146
|
+
If the system learned something wrong, correct it:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# See all patterns
|
|
150
|
+
slm patterns list
|
|
151
|
+
|
|
152
|
+
# Correct pattern #3 from "FastAPI" to "Django"
|
|
153
|
+
slm patterns correct 3 Django
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The correction increases confidence to 1.0 and records the change history.
|
|
157
|
+
|
|
158
|
+
## Options
|
|
159
|
+
|
|
160
|
+
| Command | Description | Use Case |
|
|
161
|
+
|---------|-------------|----------|
|
|
162
|
+
| `slm patterns list` | All patterns (no threshold) | See everything learned |
|
|
163
|
+
| `slm patterns list 0.7` | High confidence only | See reliable patterns |
|
|
164
|
+
| `slm patterns correct <id> <value>` | Fix a wrong pattern | Override incorrect learning |
|
|
165
|
+
| `slm learning status` | System health | Check deps and stats |
|
|
166
|
+
| `slm learning retrain` | Force model retrain | After bulk feedback |
|
|
167
|
+
| `slm learning reset` | Delete all learning data | Fresh start (memories preserved) |
|
|
168
|
+
| `slm engagement` | Usage metrics | Track your engagement health |
|
|
169
|
+
|
|
170
|
+
## Use Cases
|
|
171
|
+
|
|
172
|
+
### 1. "What Have You Learned About Me?"
|
|
173
|
+
```bash
|
|
174
|
+
slm patterns list
|
|
175
|
+
# Shows all preferences, workflows, and project context
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### 2. Pre-Session Context Loading
|
|
179
|
+
```bash
|
|
180
|
+
slm patterns context
|
|
181
|
+
# Returns structured context for AI tools to consume
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### 3. Onboarding a New AI Tool
|
|
185
|
+
```bash
|
|
186
|
+
slm learning status
|
|
187
|
+
# Verify learning is active, then use your existing memories
|
|
188
|
+
# New tool benefits from all previously learned patterns
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### 4. Weekly Review
|
|
192
|
+
```bash
|
|
193
|
+
slm engagement
|
|
194
|
+
# Check if you are using your memory system effectively
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Requirements
|
|
198
|
+
|
|
199
|
+
- SuperLocalMemory V2.7+
|
|
200
|
+
- Optional: `lightgbm` and `scipy` for ML-powered ranking
|
|
201
|
+
- Works without optional deps (uses rule-based ranking as fallback)
|
|
202
|
+
|
|
203
|
+
## Notes
|
|
204
|
+
|
|
205
|
+
- **Privacy:** All learning is local. Zero telemetry, zero cloud calls.
|
|
206
|
+
- **Separate storage:** Learning data lives in `learning.db`, separate from `memory.db`.
|
|
207
|
+
- **Non-destructive:** `slm learning reset` only deletes learning data, never memories.
|
|
208
|
+
- **Graceful degradation:** If learning deps are missing, core features work normally.
|
|
209
|
+
|
|
210
|
+
## Related Commands
|
|
211
|
+
|
|
212
|
+
- `slm recall` - Search memories (results ranked by learned patterns)
|
|
213
|
+
- `slm useful <id>` - Mark memory as useful (feedback for learning)
|
|
214
|
+
- `slm status` - Overall system status
|
|
215
|
+
- `slm patterns update` - Re-learn patterns from existing memories
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
**Created by:** [Varun Pratap Bhardwaj](https://github.com/varun369) (Solution Architect)
|
|
220
|
+
**Project:** SuperLocalMemory V2
|
|
221
|
+
**License:** MIT (see [LICENSE](../../LICENSE))
|
|
222
|
+
**Repository:** https://github.com/varun369/SuperLocalMemoryV2
|
|
223
|
+
|
|
224
|
+
*Open source doesn't mean removing credit. Attribution must be preserved per MIT License terms.*
|