superlocalmemory 2.6.0 → 2.6.5
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 +122 -1806
- package/README.md +142 -410
- package/docs/ACCESSIBILITY.md +291 -0
- package/docs/FRAMEWORK-INTEGRATIONS.md +300 -0
- package/package.json +1 -1
- package/src/learning/__init__.py +201 -0
- package/src/learning/adaptive_ranker.py +826 -0
- package/src/learning/cross_project_aggregator.py +866 -0
- package/src/learning/engagement_tracker.py +638 -0
- package/src/learning/feature_extractor.py +461 -0
- package/src/learning/feedback_collector.py +690 -0
- package/src/learning/learning_db.py +842 -0
- package/src/learning/project_context_manager.py +582 -0
- package/src/learning/source_quality_scorer.py +685 -0
- package/src/learning/workflow_pattern_miner.py +665 -0
- package/ui/index.html +346 -13
- package/ui/js/clusters.js +90 -1
- package/ui/js/graph-core.js +445 -0
- package/ui/js/graph-cytoscape-monolithic-backup.js +1168 -0
- package/ui/js/graph-cytoscape.js +1168 -0
- package/ui/js/graph-d3-backup.js +32 -0
- package/ui/js/graph-filters.js +220 -0
- package/ui/js/graph-interactions.js +354 -0
- package/ui/js/graph-ui.js +214 -0
- package/ui/js/memories.js +52 -0
- package/ui/js/modal.js +104 -1
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# Accessibility Features - SuperLocalMemory V2.6.5
|
|
2
|
+
|
|
3
|
+
**Last Updated:** February 16, 2026
|
|
4
|
+
**Author:** Varun Pratap Bhardwaj
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
SuperLocalMemory V2.6.5 includes comprehensive keyboard navigation and screen reader support for the interactive knowledge graph, making it fully accessible to users with disabilities.
|
|
11
|
+
|
|
12
|
+
## Keyboard Navigation
|
|
13
|
+
|
|
14
|
+
### Graph Container Focus
|
|
15
|
+
|
|
16
|
+
The graph container (`#graph-container`) is focusable via keyboard:
|
|
17
|
+
|
|
18
|
+
- **Focus method:** Click graph OR press `Tab` from controls above
|
|
19
|
+
- **Visual indicator:** Browser native focus outline + first node highlighted with blue border
|
|
20
|
+
- **ARIA role:** `role="application"` signals custom keyboard handling
|
|
21
|
+
|
|
22
|
+
### Node Navigation
|
|
23
|
+
|
|
24
|
+
| Key | Action |
|
|
25
|
+
|-----|--------|
|
|
26
|
+
| **Tab** | Move to next node (cycles through all nodes) |
|
|
27
|
+
| **Shift+Tab** | Move to previous node |
|
|
28
|
+
| **→** (Right Arrow) | Move to nearest node on the right |
|
|
29
|
+
| **←** (Left Arrow) | Move to nearest node on the left |
|
|
30
|
+
| **↓** (Down Arrow) | Move to nearest node below |
|
|
31
|
+
| **↑** (Up Arrow) | Move to nearest node above |
|
|
32
|
+
| **Home** | Jump to first node |
|
|
33
|
+
| **End** | Jump to last node |
|
|
34
|
+
|
|
35
|
+
**Arrow Key Algorithm:**
|
|
36
|
+
- Finds nodes in specified direction (based on X/Y coordinates)
|
|
37
|
+
- Prioritizes nodes closer to current position
|
|
38
|
+
- Combines Euclidean distance with directional score
|
|
39
|
+
- Ensures no "stuck" states (always finds a valid next node)
|
|
40
|
+
|
|
41
|
+
### Actions
|
|
42
|
+
|
|
43
|
+
| Key | Action |
|
|
44
|
+
|-----|--------|
|
|
45
|
+
| **Enter** or **Space** | Open modal for focused node |
|
|
46
|
+
| **Escape** | Clear active filter OR blur graph (if no filter) |
|
|
47
|
+
|
|
48
|
+
### Visual Focus Indicator
|
|
49
|
+
|
|
50
|
+
Focused nodes have the CSS class `.keyboard-focused` with:
|
|
51
|
+
|
|
52
|
+
```css
|
|
53
|
+
border-width: 5px;
|
|
54
|
+
border-color: #0066ff;
|
|
55
|
+
border-style: solid;
|
|
56
|
+
box-shadow: 0 0 15px #0066ff;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The graph smoothly animates to center the focused node in the viewport.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Screen Reader Support
|
|
64
|
+
|
|
65
|
+
### ARIA Attributes
|
|
66
|
+
|
|
67
|
+
#### Graph Container
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<div id="graph-container"
|
|
71
|
+
role="application"
|
|
72
|
+
aria-label="Interactive knowledge graph - use Tab to navigate nodes, Enter to view details, Arrow keys to move between adjacent nodes, Escape to clear filters"
|
|
73
|
+
aria-describedby="graph-stats">
|
|
74
|
+
</div>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- **`role="application"`** - Signals custom keyboard handling
|
|
78
|
+
- **`aria-label`** - Provides usage instructions
|
|
79
|
+
- **`aria-describedby`** - Links to graph statistics (node/edge count)
|
|
80
|
+
|
|
81
|
+
#### Status Regions
|
|
82
|
+
|
|
83
|
+
```html
|
|
84
|
+
<div id="graph-status-full" role="status" aria-live="polite">
|
|
85
|
+
Showing all memories
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
<div id="graph-status-filtered" role="status" aria-live="polite">
|
|
89
|
+
Viewing Cluster X (Y memories)
|
|
90
|
+
</div>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
- **`role="status"`** - Semantic status information
|
|
94
|
+
- **`aria-live="polite"`** - Announces changes when user is idle
|
|
95
|
+
|
|
96
|
+
#### Hidden Status Region
|
|
97
|
+
|
|
98
|
+
An off-screen status region announces keyboard navigation events:
|
|
99
|
+
|
|
100
|
+
```html
|
|
101
|
+
<div id="graph-sr-status"
|
|
102
|
+
role="status"
|
|
103
|
+
aria-live="polite"
|
|
104
|
+
aria-atomic="true"
|
|
105
|
+
style="position:absolute; left:-10000px; width:1px; height:1px; overflow:hidden;">
|
|
106
|
+
</div>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
This element is invisible but screen readers announce its content changes.
|
|
110
|
+
|
|
111
|
+
#### Buttons
|
|
112
|
+
|
|
113
|
+
All interactive buttons have `aria-label` attributes:
|
|
114
|
+
|
|
115
|
+
```html
|
|
116
|
+
<button aria-label="Refresh graph data">...</button>
|
|
117
|
+
<button aria-label="Clear filter and show all memories">...</button>
|
|
118
|
+
<button aria-label="Toggle dark mode">...</button>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### Dropdowns
|
|
122
|
+
|
|
123
|
+
Form controls have proper labels:
|
|
124
|
+
|
|
125
|
+
```html
|
|
126
|
+
<label for="graph-layout-selector">Layout Algorithm:</label>
|
|
127
|
+
<select id="graph-layout-selector" aria-label="Select graph layout algorithm">
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Screen Reader Announcements
|
|
131
|
+
|
|
132
|
+
The `updateScreenReaderStatus()` function announces:
|
|
133
|
+
|
|
134
|
+
1. **Graph load:** "Graph loaded with X memories and Y connections"
|
|
135
|
+
2. **Node navigation:** "Memory 123: SuperLocalMemory Project, Cluster 2, Importance 8 out of 10"
|
|
136
|
+
3. **Filter cleared:** "Filters cleared, showing all memories"
|
|
137
|
+
|
|
138
|
+
These announcements are sent to the hidden `#graph-sr-status` region.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Modal Focus Management
|
|
143
|
+
|
|
144
|
+
### Opening Modal
|
|
145
|
+
|
|
146
|
+
When `openMemoryModal()` is called:
|
|
147
|
+
|
|
148
|
+
1. **Store last focused element:** `window.lastFocusedElement = document.activeElement`
|
|
149
|
+
2. **Bootstrap modal shown event:** Focus moves to first button in modal
|
|
150
|
+
3. **Tab order:** Close button → Modal content → Action buttons → Footer buttons
|
|
151
|
+
|
|
152
|
+
### Closing Modal
|
|
153
|
+
|
|
154
|
+
When modal closes (via Bootstrap `hidden.bs.modal` event):
|
|
155
|
+
|
|
156
|
+
1. **Restore focus:** `window.lastFocusedElement.focus()`
|
|
157
|
+
2. **Clear stored element:** `window.lastFocusedElement = null`
|
|
158
|
+
3. **User can continue:** Keyboard navigation resumes from same node
|
|
159
|
+
|
|
160
|
+
This ensures users don't lose their place in the graph when opening/closing modals.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Skip Links
|
|
165
|
+
|
|
166
|
+
A skip link is provided for keyboard users:
|
|
167
|
+
|
|
168
|
+
```html
|
|
169
|
+
<a href="#memories-pane" class="visually-hidden-focusable">Skip to Memories list</a>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
This link is invisible until focused (via Tab), allowing users to bypass the graph and jump directly to the Memories tab.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Testing with Screen Readers
|
|
177
|
+
|
|
178
|
+
### macOS VoiceOver
|
|
179
|
+
|
|
180
|
+
1. **Enable:** Press `Cmd+F5`
|
|
181
|
+
2. **Navigate:** `Control+Option+Arrow keys`
|
|
182
|
+
3. **Read current element:** `Control+Option+A`
|
|
183
|
+
4. **Test focus:** Tab through graph → Verify announcements
|
|
184
|
+
|
|
185
|
+
### Windows NVDA
|
|
186
|
+
|
|
187
|
+
1. **Install:** Download from [nvaccess.org](https://www.nvaccess.org/)
|
|
188
|
+
2. **Start:** `Control+Alt+N`
|
|
189
|
+
3. **Navigate:** Arrow keys
|
|
190
|
+
4. **Browse mode:** Press `Insert+Space` to toggle
|
|
191
|
+
|
|
192
|
+
### Windows JAWS
|
|
193
|
+
|
|
194
|
+
1. **Commercial software:** Most widely used screen reader
|
|
195
|
+
2. **Navigate:** Arrow keys + Tab
|
|
196
|
+
3. **Read mode:** Virtual cursor navigation
|
|
197
|
+
|
|
198
|
+
### Linux Orca
|
|
199
|
+
|
|
200
|
+
1. **Enable:** `Alt+F2`, type "orca"
|
|
201
|
+
2. **Configure:** `orca --setup`
|
|
202
|
+
3. **Navigate:** Arrow keys
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Compliance
|
|
207
|
+
|
|
208
|
+
### WCAG 2.1 AA Compliance
|
|
209
|
+
|
|
210
|
+
| Criterion | Status | Implementation |
|
|
211
|
+
|-----------|--------|----------------|
|
|
212
|
+
| **1.3.1 Info and Relationships** | ✅ Pass | Semantic HTML, ARIA roles |
|
|
213
|
+
| **2.1.1 Keyboard** | ✅ Pass | Full keyboard navigation |
|
|
214
|
+
| **2.1.2 No Keyboard Trap** | ✅ Pass | Escape key blurs graph |
|
|
215
|
+
| **2.4.3 Focus Order** | ✅ Pass | Logical tab order |
|
|
216
|
+
| **2.4.7 Focus Visible** | ✅ Pass | Blue outline on focused nodes |
|
|
217
|
+
| **3.2.1 On Focus** | ✅ Pass | No unexpected context changes |
|
|
218
|
+
| **4.1.2 Name, Role, Value** | ✅ Pass | ARIA labels on all controls |
|
|
219
|
+
| **4.1.3 Status Messages** | ✅ Pass | aria-live regions |
|
|
220
|
+
|
|
221
|
+
### Section 508 Compliance
|
|
222
|
+
|
|
223
|
+
- ✅ **(a) Keyboard access** - All graph functions accessible via keyboard
|
|
224
|
+
- ✅ **(c) Color contrast** - Blue focus indicator meets 4.5:1 contrast ratio
|
|
225
|
+
- ✅ **(d) Screen reader compatible** - ARIA labels and live regions
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Developer Notes
|
|
230
|
+
|
|
231
|
+
### Code Location
|
|
232
|
+
|
|
233
|
+
- **Keyboard navigation:** `/ui/js/graph-cytoscape.js` (lines 950-1150)
|
|
234
|
+
- **Modal focus management:** `/ui/js/modal.js` (lines 10-18, 142-160)
|
|
235
|
+
- **ARIA attributes:** `/ui/index.html` (graph-pane section)
|
|
236
|
+
|
|
237
|
+
### Key Functions
|
|
238
|
+
|
|
239
|
+
| Function | Purpose |
|
|
240
|
+
|----------|---------|
|
|
241
|
+
| `setupKeyboardNavigation()` | Attaches keyboard event handlers to graph container |
|
|
242
|
+
| `focusNodeAtIndex(index)` | Highlights node and centers viewport |
|
|
243
|
+
| `moveToAdjacentNode(direction, currentNode)` | Finds nearest node in specified direction |
|
|
244
|
+
| `announceNode(node)` | Sends node info to screen reader |
|
|
245
|
+
| `updateScreenReaderStatus(message)` | Updates hidden status region |
|
|
246
|
+
|
|
247
|
+
### Global State Variables
|
|
248
|
+
|
|
249
|
+
```javascript
|
|
250
|
+
var focusedNodeIndex = 0; // Currently focused node index
|
|
251
|
+
var keyboardNavigationEnabled = false; // Is keyboard nav active?
|
|
252
|
+
var lastFocusedElement = null; // For modal focus return
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Cytoscape.js Style Class
|
|
256
|
+
|
|
257
|
+
```javascript
|
|
258
|
+
{
|
|
259
|
+
selector: 'node.keyboard-focused',
|
|
260
|
+
style: {
|
|
261
|
+
'border-width': 5,
|
|
262
|
+
'border-color': '#0066ff',
|
|
263
|
+
'border-style': 'solid',
|
|
264
|
+
'box-shadow': '0 0 15px #0066ff'
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Future Enhancements (v2.7+)
|
|
272
|
+
|
|
273
|
+
1. **Voice commands:** Integrate Web Speech API for voice navigation
|
|
274
|
+
2. **Braille support:** Test with refreshable Braille displays
|
|
275
|
+
3. **High contrast mode:** Additional theme for low vision users
|
|
276
|
+
4. **Keyboard shortcuts help:** Press `?` to show keyboard shortcuts overlay
|
|
277
|
+
5. **Focus trapping in modal:** Prevent Tab from leaving modal when open
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## Feedback
|
|
282
|
+
|
|
283
|
+
If you encounter accessibility issues, please report them:
|
|
284
|
+
|
|
285
|
+
- **GitHub Issues:** https://github.com/varun369/SuperLocalMemoryV2/issues
|
|
286
|
+
- **Label:** Use `accessibility` tag
|
|
287
|
+
- **Include:** Browser, screen reader (if applicable), and steps to reproduce
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
**Copyright © 2026 Varun Pratap Bhardwaj - MIT License**
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
# Framework Integrations
|
|
2
|
+
|
|
3
|
+
SuperLocalMemory V2 integrates with popular AI frameworks as a memory backend — 100% local, zero cloud dependencies.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## LangChain Integration
|
|
8
|
+
|
|
9
|
+
Use SuperLocalMemory as a chat message history store in LangChain applications.
|
|
10
|
+
|
|
11
|
+
### Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install langchain-superlocalmemory
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Basic Usage
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from langchain_superlocalmemory import SuperLocalMemoryChatMessageHistory
|
|
21
|
+
from langchain_core.runnables.history import RunnableWithMessageHistory
|
|
22
|
+
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
|
23
|
+
from langchain_openai import ChatOpenAI
|
|
24
|
+
|
|
25
|
+
# Create chat history with session-based memory
|
|
26
|
+
history = SuperLocalMemoryChatMessageHistory(session_id="my-session")
|
|
27
|
+
|
|
28
|
+
# Build a conversational chain
|
|
29
|
+
prompt = ChatPromptTemplate.from_messages([
|
|
30
|
+
("system", "You are a helpful assistant."),
|
|
31
|
+
MessagesPlaceholder(variable_name="history"),
|
|
32
|
+
("human", "{input}"),
|
|
33
|
+
])
|
|
34
|
+
|
|
35
|
+
chain = prompt | ChatOpenAI()
|
|
36
|
+
|
|
37
|
+
# Wrap with message history
|
|
38
|
+
chain_with_history = RunnableWithMessageHistory(
|
|
39
|
+
chain,
|
|
40
|
+
lambda session_id: SuperLocalMemoryChatMessageHistory(session_id=session_id),
|
|
41
|
+
input_messages_key="input",
|
|
42
|
+
history_messages_key="history",
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
# Use the chain
|
|
46
|
+
response = chain_with_history.invoke(
|
|
47
|
+
{"input": "What is AI?"},
|
|
48
|
+
config={"configurable": {"session_id": "my-session"}}
|
|
49
|
+
)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Advanced Features
|
|
53
|
+
|
|
54
|
+
**Session Isolation:**
|
|
55
|
+
```python
|
|
56
|
+
# Different sessions have isolated message histories
|
|
57
|
+
history_user1 = SuperLocalMemoryChatMessageHistory(session_id="user-1")
|
|
58
|
+
history_user2 = SuperLocalMemoryChatMessageHistory(session_id="user-2")
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Profile Support:**
|
|
62
|
+
```python
|
|
63
|
+
# Use different memory profiles for different contexts
|
|
64
|
+
history_work = SuperLocalMemoryChatMessageHistory(
|
|
65
|
+
session_id="work-chat",
|
|
66
|
+
profile="work"
|
|
67
|
+
)
|
|
68
|
+
history_personal = SuperLocalMemoryChatMessageHistory(
|
|
69
|
+
session_id="personal-chat",
|
|
70
|
+
profile="personal"
|
|
71
|
+
)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Message Filtering:**
|
|
75
|
+
```python
|
|
76
|
+
# Retrieve messages with limits
|
|
77
|
+
recent_messages = history.get_messages(limit=10)
|
|
78
|
+
|
|
79
|
+
# Clear session history
|
|
80
|
+
history.clear()
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Storage Details
|
|
84
|
+
|
|
85
|
+
- Messages persist in `~/.claude-memory/memory.db`
|
|
86
|
+
- Each message stored as a memory with tags: `langchain`, `chat`, `session:<session_id>`
|
|
87
|
+
- Supports all LangChain message types (HumanMessage, AIMessage, SystemMessage)
|
|
88
|
+
- Automatic timestamp and metadata tracking
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## LlamaIndex Integration
|
|
93
|
+
|
|
94
|
+
Use SuperLocalMemory as a chat store for LlamaIndex's memory system.
|
|
95
|
+
|
|
96
|
+
### Installation
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
pip install llama-index-storage-chat-store-superlocalmemory
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Basic Usage
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
from llama_index.storage.chat_store.superlocalmemory import SuperLocalMemoryChatStore
|
|
106
|
+
from llama_index.core.memory import ChatMemoryBuffer
|
|
107
|
+
from llama_index.core.chat_engine import SimpleChatEngine
|
|
108
|
+
from llama_index.llms.openai import OpenAI
|
|
109
|
+
|
|
110
|
+
# Create chat store
|
|
111
|
+
chat_store = SuperLocalMemoryChatStore()
|
|
112
|
+
|
|
113
|
+
# Create memory with chat store
|
|
114
|
+
memory = ChatMemoryBuffer.from_defaults(
|
|
115
|
+
chat_store=chat_store,
|
|
116
|
+
chat_store_key="user-1"
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
# Use with a chat engine
|
|
120
|
+
llm = OpenAI(model="gpt-4")
|
|
121
|
+
chat_engine = SimpleChatEngine.from_defaults(
|
|
122
|
+
llm=llm,
|
|
123
|
+
memory=memory
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
# Chat
|
|
127
|
+
response = chat_engine.chat("What is machine learning?")
|
|
128
|
+
print(response)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Advanced Features
|
|
132
|
+
|
|
133
|
+
**Multiple Users:**
|
|
134
|
+
```python
|
|
135
|
+
# Separate memory for each user
|
|
136
|
+
memory_user1 = ChatMemoryBuffer.from_defaults(
|
|
137
|
+
chat_store=chat_store,
|
|
138
|
+
chat_store_key="user-1"
|
|
139
|
+
)
|
|
140
|
+
memory_user2 = ChatMemoryBuffer.from_defaults(
|
|
141
|
+
chat_store=chat_store,
|
|
142
|
+
chat_store_key="user-2"
|
|
143
|
+
)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
**Profile Support:**
|
|
147
|
+
```python
|
|
148
|
+
# Use different profiles for different contexts
|
|
149
|
+
chat_store_work = SuperLocalMemoryChatStore(profile="work")
|
|
150
|
+
chat_store_personal = SuperLocalMemoryChatStore(profile="personal")
|
|
151
|
+
|
|
152
|
+
memory_work = ChatMemoryBuffer.from_defaults(
|
|
153
|
+
chat_store=chat_store_work,
|
|
154
|
+
chat_store_key="project-x"
|
|
155
|
+
)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Message Management:**
|
|
159
|
+
```python
|
|
160
|
+
# Get messages for a specific chat
|
|
161
|
+
messages = chat_store.get_messages("user-1")
|
|
162
|
+
|
|
163
|
+
# Set messages
|
|
164
|
+
from llama_index.core.base.llms.types import ChatMessage
|
|
165
|
+
chat_store.set_messages(
|
|
166
|
+
"user-1",
|
|
167
|
+
[ChatMessage(role="user", content="Hello")]
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
# Delete messages
|
|
171
|
+
chat_store.delete_messages("user-1")
|
|
172
|
+
|
|
173
|
+
# List all chat keys
|
|
174
|
+
all_chats = chat_store.get_keys()
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Storage Details
|
|
178
|
+
|
|
179
|
+
- Messages persist in `~/.claude-memory/memory.db`
|
|
180
|
+
- Each message stored as a memory with tags: `llamaindex`, `chat`, `key:<chat_store_key>`
|
|
181
|
+
- Supports all LlamaIndex ChatMessage roles (user, assistant, system)
|
|
182
|
+
- Automatic timestamp tracking
|
|
183
|
+
- Full profile isolation support
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Why Use SuperLocalMemory with Frameworks?
|
|
188
|
+
|
|
189
|
+
| Benefit | Description |
|
|
190
|
+
|---------|-------------|
|
|
191
|
+
| **100% Local** | No cloud dependencies, all data stays on your machine |
|
|
192
|
+
| **Zero Configuration** | Works with default settings, no API keys needed |
|
|
193
|
+
| **Cross-Framework** | Same local database used by all frameworks and tools |
|
|
194
|
+
| **Profile Isolation** | Separate memories for work, personal, clients |
|
|
195
|
+
| **Persistent** | Memories survive across sessions and reboots |
|
|
196
|
+
| **Free Forever** | No usage limits, no subscriptions |
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Common Patterns
|
|
201
|
+
|
|
202
|
+
### Multi-Context Applications
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
# LangChain for customer support
|
|
206
|
+
support_history = SuperLocalMemoryChatMessageHistory(
|
|
207
|
+
session_id="customer-123",
|
|
208
|
+
profile="customer-support"
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
# LlamaIndex for internal documentation
|
|
212
|
+
docs_store = SuperLocalMemoryChatStore(profile="internal-docs")
|
|
213
|
+
docs_memory = ChatMemoryBuffer.from_defaults(
|
|
214
|
+
chat_store=docs_store,
|
|
215
|
+
chat_store_key="team-wiki"
|
|
216
|
+
)
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Session Management
|
|
220
|
+
|
|
221
|
+
```python
|
|
222
|
+
# Create sessions with metadata
|
|
223
|
+
from langchain_core.messages import HumanMessage, AIMessage
|
|
224
|
+
|
|
225
|
+
history = SuperLocalMemoryChatMessageHistory(session_id="session-123")
|
|
226
|
+
history.add_user_message("What is Python?")
|
|
227
|
+
history.add_ai_message("Python is a high-level programming language...")
|
|
228
|
+
|
|
229
|
+
# Later, retrieve full conversation
|
|
230
|
+
messages = history.get_messages()
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Memory Cleanup
|
|
234
|
+
|
|
235
|
+
```python
|
|
236
|
+
# LangChain: Clear specific session
|
|
237
|
+
history.clear()
|
|
238
|
+
|
|
239
|
+
# LlamaIndex: Delete specific chat
|
|
240
|
+
chat_store.delete_messages("user-1")
|
|
241
|
+
|
|
242
|
+
# CLI: Reset entire profile
|
|
243
|
+
# superlocalmemoryv2:reset soft --profile customer-support
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Troubleshooting
|
|
249
|
+
|
|
250
|
+
### Import Errors
|
|
251
|
+
|
|
252
|
+
If you get import errors, ensure packages are installed:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# For LangChain
|
|
256
|
+
pip install langchain-superlocalmemory langchain-core
|
|
257
|
+
|
|
258
|
+
# For LlamaIndex
|
|
259
|
+
pip install llama-index-storage-chat-store-superlocalmemory llama-index-core
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Database Locked
|
|
263
|
+
|
|
264
|
+
If you see "database is locked" errors:
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
# Check if SuperLocalMemory is running correctly
|
|
268
|
+
superlocalmemoryv2:status
|
|
269
|
+
|
|
270
|
+
# Restart any MCP servers
|
|
271
|
+
# (Close and reopen Cursor/Windsurf)
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Profile Not Found
|
|
275
|
+
|
|
276
|
+
If a profile doesn't exist:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# List available profiles
|
|
280
|
+
superlocalmemoryv2:profile list
|
|
281
|
+
|
|
282
|
+
# Create the profile
|
|
283
|
+
superlocalmemoryv2:profile create work
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Learn More
|
|
289
|
+
|
|
290
|
+
- **[LangChain Wiki Guide](https://github.com/varun369/SuperLocalMemoryV2/wiki/LangChain-Integration)** — Full integration tutorial
|
|
291
|
+
- **[LlamaIndex Wiki Guide](https://github.com/varun369/SuperLocalMemoryV2/wiki/LlamaIndex-Integration)** — Complete setup guide
|
|
292
|
+
- **[API Reference](API-REFERENCE.md)** — Python API documentation
|
|
293
|
+
- **[Profiles Guide](PROFILES-GUIDE.md)** — Multi-context management
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
<p align="center">
|
|
298
|
+
<strong>Built by <a href="https://github.com/varun369">Varun Pratap Bhardwaj</a></strong><br/>
|
|
299
|
+
MIT License • <a href="https://superlocalmemory.com">superlocalmemory.com</a>
|
|
300
|
+
</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "superlocalmemory",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.5",
|
|
4
4
|
"description": "Your AI Finally Remembers You - Local-first intelligent memory system for AI assistants. Works with Claude, Cursor, Windsurf, VS Code/Copilot, Codex, and 17+ AI tools. 100% local, zero cloud dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-memory",
|