superlocalmemory 2.6.5 → 2.7.0

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.
@@ -0,0 +1,233 @@
1
+ #!/bin/bash
2
+ # ============================================================================
3
+ # SuperLocalMemory V2.7 — Quick Verification Script
4
+ # Copyright (c) 2026 Varun Pratap Bhardwaj
5
+ # Licensed under MIT License
6
+ # Repository: https://github.com/varun369/SuperLocalMemoryV2
7
+ #
8
+ # Run this after installation to verify everything works:
9
+ # bash scripts/verify-v27.sh
10
+ # ============================================================================
11
+
12
+ INSTALL_DIR="${HOME}/.claude-memory"
13
+ PASS=0
14
+ WARN=0
15
+ FAIL=0
16
+
17
+ echo ""
18
+ echo "SuperLocalMemory v2.7 Verification"
19
+ echo "==================================="
20
+ echo ""
21
+
22
+ # ── Check 1: Installation directory ──────────────────────────────────────────
23
+ if [ -d "$INSTALL_DIR" ]; then
24
+ echo "[PASS] Installation directory exists: $INSTALL_DIR"
25
+ PASS=$((PASS + 1))
26
+ else
27
+ echo "[FAIL] Installation directory missing. Run install.sh first."
28
+ FAIL=$((FAIL + 1))
29
+ echo ""
30
+ echo "==================================="
31
+ echo "Result: FAIL — SuperLocalMemory is not installed."
32
+ echo "Run: bash install.sh"
33
+ exit 1
34
+ fi
35
+
36
+ # ── Check 2: Core modules ────────────────────────────────────────────────────
37
+ echo ""
38
+ echo "Core Modules:"
39
+ for mod in memory_store_v2.py graph_engine.py pattern_learner.py mcp_server.py tree_manager.py; do
40
+ if [ -f "$INSTALL_DIR/$mod" ]; then
41
+ echo " [PASS] $mod"
42
+ PASS=$((PASS + 1))
43
+ else
44
+ echo " [FAIL] Missing: $mod"
45
+ FAIL=$((FAIL + 1))
46
+ fi
47
+ done
48
+
49
+ # ── Check 3: v2.5 modules ────────────────────────────────────────────────────
50
+ echo ""
51
+ echo "Event System (v2.5):"
52
+ for mod in event_bus.py subscription_manager.py webhook_dispatcher.py agent_registry.py provenance_tracker.py trust_scorer.py db_connection_manager.py; do
53
+ if [ -f "$INSTALL_DIR/$mod" ]; then
54
+ echo " [PASS] $mod"
55
+ PASS=$((PASS + 1))
56
+ else
57
+ echo " [WARN] Missing: $mod (v2.5 feature)"
58
+ WARN=$((WARN + 1))
59
+ fi
60
+ done
61
+
62
+ # ── Check 4: Learning modules (v2.7) ─────────────────────────────────────────
63
+ echo ""
64
+ echo "Learning System (v2.7):"
65
+ if [ -d "$INSTALL_DIR/learning" ]; then
66
+ echo " [PASS] learning/ directory exists"
67
+ PASS=$((PASS + 1))
68
+
69
+ for mod in __init__.py learning_db.py adaptive_ranker.py feedback_collector.py \
70
+ engagement_tracker.py cross_project_aggregator.py project_context_manager.py \
71
+ workflow_pattern_miner.py source_quality_scorer.py synthetic_bootstrap.py \
72
+ feature_extractor.py; do
73
+ if [ -f "$INSTALL_DIR/learning/$mod" ]; then
74
+ echo " [PASS] learning/$mod"
75
+ PASS=$((PASS + 1))
76
+ else
77
+ echo " [WARN] Missing: learning/$mod"
78
+ WARN=$((WARN + 1))
79
+ fi
80
+ done
81
+ else
82
+ echo " [FAIL] learning/ directory missing (v2.7 not fully installed)"
83
+ FAIL=$((FAIL + 1))
84
+ fi
85
+
86
+ # ── Check 5: Learning dependencies ───────────────────────────────────────────
87
+ echo ""
88
+ echo "Learning Dependencies:"
89
+ python3 -c "import lightgbm; print(f' [PASS] LightGBM {lightgbm.__version__}')" 2>/dev/null || {
90
+ echo " [INFO] LightGBM not installed (optional — rule-based ranking will be used)"
91
+ WARN=$((WARN + 1))
92
+ }
93
+ python3 -c "import scipy; print(f' [PASS] SciPy {scipy.__version__}')" 2>/dev/null || {
94
+ echo " [INFO] SciPy not installed (optional — install for full learning features)"
95
+ WARN=$((WARN + 1))
96
+ }
97
+
98
+ # ── Check 6: Core dependencies ───────────────────────────────────────────────
99
+ echo ""
100
+ echo "Core Dependencies:"
101
+ python3 -c "import sklearn; print(f' [PASS] scikit-learn {sklearn.__version__}')" 2>/dev/null || {
102
+ echo " [WARN] scikit-learn not installed (needed for knowledge graph)"
103
+ WARN=$((WARN + 1))
104
+ }
105
+ python3 -c "import numpy; print(f' [PASS] numpy {numpy.__version__}')" 2>/dev/null || {
106
+ echo " [WARN] numpy not installed"
107
+ WARN=$((WARN + 1))
108
+ }
109
+ python3 -c "import igraph; print(f' [PASS] python-igraph {igraph.__version__}')" 2>/dev/null || {
110
+ echo " [WARN] python-igraph not installed (needed for graph clustering)"
111
+ WARN=$((WARN + 1))
112
+ }
113
+
114
+ # ── Check 7: Database ────────────────────────────────────────────────────────
115
+ echo ""
116
+ echo "Databases:"
117
+ if [ -f "$INSTALL_DIR/memory.db" ]; then
118
+ MEMORY_COUNT=$(sqlite3 "$INSTALL_DIR/memory.db" "SELECT COUNT(*) FROM memories;" 2>/dev/null || echo "0")
119
+ DB_SIZE=$(du -h "$INSTALL_DIR/memory.db" 2>/dev/null | cut -f1)
120
+ echo " [PASS] memory.db exists ($MEMORY_COUNT memories, $DB_SIZE)"
121
+ PASS=$((PASS + 1))
122
+ else
123
+ echo " [INFO] memory.db not yet created (will auto-create on first use)"
124
+ fi
125
+
126
+ if [ -f "$INSTALL_DIR/learning.db" ]; then
127
+ FEEDBACK_COUNT=$(sqlite3 "$INSTALL_DIR/learning.db" "SELECT COUNT(*) FROM ranking_feedback;" 2>/dev/null || echo "0")
128
+ echo " [PASS] learning.db exists ($FEEDBACK_COUNT feedback signals)"
129
+ PASS=$((PASS + 1))
130
+ else
131
+ echo " [INFO] learning.db not yet created (will auto-create on first recall)"
132
+ fi
133
+
134
+ # ── Check 8: CLI ──────────────────────────────────────────────────────────────
135
+ echo ""
136
+ echo "CLI:"
137
+ if command -v slm &> /dev/null; then
138
+ echo " [PASS] slm command available in PATH"
139
+ PASS=$((PASS + 1))
140
+ else
141
+ if [ -f "$INSTALL_DIR/bin/slm" ]; then
142
+ echo " [WARN] slm exists at $INSTALL_DIR/bin/slm but not in PATH"
143
+ echo " Add to PATH: export PATH=\"\$HOME/.claude-memory/bin:\$PATH\""
144
+ WARN=$((WARN + 1))
145
+ else
146
+ echo " [FAIL] slm command not found"
147
+ FAIL=$((FAIL + 1))
148
+ fi
149
+ fi
150
+
151
+ # ── Check 9: MCP server ──────────────────────────────────────────────────────
152
+ echo ""
153
+ echo "MCP Server:"
154
+ if [ -f "$INSTALL_DIR/mcp_server.py" ]; then
155
+ echo " [PASS] mcp_server.py installed"
156
+ PASS=$((PASS + 1))
157
+ else
158
+ echo " [FAIL] mcp_server.py missing"
159
+ FAIL=$((FAIL + 1))
160
+ fi
161
+
162
+ if python3 -c "from mcp.server.fastmcp import FastMCP" 2>/dev/null; then
163
+ echo " [PASS] MCP SDK installed"
164
+ PASS=$((PASS + 1))
165
+ else
166
+ echo " [WARN] MCP SDK not installed (install: pip3 install mcp)"
167
+ WARN=$((WARN + 1))
168
+ fi
169
+
170
+ # ── Check 10: Import chain verification ───────────────────────────────────────
171
+ echo ""
172
+ echo "Import Chain:"
173
+ IMPORT_RESULT=$(python3 -c "
174
+ import sys
175
+ sys.path.insert(0, '$INSTALL_DIR')
176
+ try:
177
+ from learning import get_learning_db, get_status, FULL_LEARNING_AVAILABLE, ML_RANKING_AVAILABLE
178
+ status = get_status()
179
+ ml = 'yes' if status['ml_ranking_available'] else 'no'
180
+ full = 'yes' if status['learning_available'] else 'no'
181
+ print(f'OK ml_ranking={ml} full_learning={full}')
182
+ except ImportError as e:
183
+ print(f'IMPORT_ERROR {e}')
184
+ except Exception as e:
185
+ print(f'ERROR {e}')
186
+ " 2>&1)
187
+
188
+ if [[ "$IMPORT_RESULT" == OK* ]]; then
189
+ echo " [PASS] Learning system imports successfully"
190
+ echo " $IMPORT_RESULT"
191
+ PASS=$((PASS + 1))
192
+ elif [[ "$IMPORT_RESULT" == IMPORT_ERROR* ]]; then
193
+ echo " [WARN] Learning import failed: ${IMPORT_RESULT#IMPORT_ERROR }"
194
+ echo " This may be normal if learning modules are not yet installed."
195
+ WARN=$((WARN + 1))
196
+ else
197
+ echo " [WARN] Learning check: $IMPORT_RESULT"
198
+ WARN=$((WARN + 1))
199
+ fi
200
+
201
+ # ── Summary ───────────────────────────────────────────────────────────────────
202
+ echo ""
203
+ echo "==================================="
204
+ echo "Verification Summary"
205
+ echo " Passed: $PASS"
206
+ echo " Warnings: $WARN"
207
+ echo " Failed: $FAIL"
208
+ echo "==================================="
209
+ echo ""
210
+
211
+ if [ $FAIL -eq 0 ]; then
212
+ echo "Status: READY"
213
+ echo ""
214
+ echo "Quick start:"
215
+ echo " slm remember \"My first memory\""
216
+ echo " slm recall \"first\""
217
+ echo " slm status"
218
+ echo ""
219
+ if [ $WARN -gt 0 ]; then
220
+ echo "Some optional features may not be available."
221
+ echo "Install missing dependencies to enable them:"
222
+ echo " pip3 install lightgbm scipy # Learning system"
223
+ echo " pip3 install scikit-learn igraph # Knowledge graph"
224
+ echo ""
225
+ fi
226
+ else
227
+ echo "Status: INCOMPLETE"
228
+ echo ""
229
+ echo "Fix the failed checks above, then re-run:"
230
+ echo " bash scripts/verify-v27.sh"
231
+ echo ""
232
+ exit 1
233
+ fi
@@ -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: MIT
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 with attribution requirements (see [ATTRIBUTION.md](../../ATTRIBUTION.md))
222
+ **Repository:** https://github.com/varun369/SuperLocalMemoryV2
223
+
224
+ *Open source doesn't mean removing credit. Attribution must be preserved per MIT License terms.*