claude-mneme 2.9.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/plugin.json +17 -0
- package/CLAUDE.md +98 -0
- package/CONFIG_REFERENCE.md +495 -0
- package/README.md +40 -0
- package/commands/entity.md +64 -0
- package/commands/forget.md +69 -0
- package/commands/remember.md +60 -0
- package/commands/status.md +90 -0
- package/commands/summarize.md +69 -0
- package/hooks/hooks.json +123 -0
- package/package.json +12 -0
- package/scripts/mem-add.mjs +59 -0
- package/scripts/mem-entity.mjs +143 -0
- package/scripts/mem-forget.mjs +245 -0
- package/scripts/mem-status.mjs +319 -0
- package/scripts/mem-summarize.mjs +338 -0
- package/scripts/post-compact.mjs +132 -0
- package/scripts/post-tool-use.mjs +353 -0
- package/scripts/pre-compact.mjs +491 -0
- package/scripts/session-start.mjs +283 -0
- package/scripts/session-stop.mjs +31 -0
- package/scripts/stop-capture.mjs +294 -0
- package/scripts/subagent-stop.mjs +203 -0
- package/scripts/summarize.mjs +428 -0
- package/scripts/sync.mjs +609 -0
- package/scripts/user-prompt-submit.mjs +77 -0
- package/scripts/utils.mjs +2142 -0
- package/scripts/utils.test.mjs +1465 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "claude-mneme",
|
|
3
|
+
"version": "2.8.0",
|
|
4
|
+
"description": "Persistent memory system for Claude Code - remembers context across sessions",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Edin Mujkanovic"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": "https://github.com/edimuj/claude-mneme",
|
|
10
|
+
"keywords": [
|
|
11
|
+
"memory",
|
|
12
|
+
"context",
|
|
13
|
+
"persistence",
|
|
14
|
+
"mneme",
|
|
15
|
+
"claude-code"
|
|
16
|
+
]
|
|
17
|
+
}
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Claude Mneme
|
|
2
|
+
|
|
3
|
+
> **Note:** This file is gitignored — do not `git add` it.
|
|
4
|
+
|
|
5
|
+
Persistent memory system for Claude Code - remembers context across sessions.
|
|
6
|
+
|
|
7
|
+
## How It Works
|
|
8
|
+
|
|
9
|
+
1. **SessionStart**: Injects memory context (summary + handoff + git changes + recent entries) into session
|
|
10
|
+
2. **UserPromptSubmit**: Captures user prompts to understand intent and context
|
|
11
|
+
3. **PostToolUse**: Captures task progress (TaskCreate, TaskUpdate, TodoWrite) and git commits
|
|
12
|
+
4. **SubagentStop**: Captures summaries from specialized agents when they complete
|
|
13
|
+
5. **PreCompact**: Extracts context and forces summarization before conversation compaction
|
|
14
|
+
6. **PostCompact**: Injects extracted context back after compaction (via SessionStart "compact" matcher)
|
|
15
|
+
7. **Stop**: Captures assistant response, writes session handoff, flushes pending entries
|
|
16
|
+
|
|
17
|
+
## What Gets Captured
|
|
18
|
+
|
|
19
|
+
| Type | Source | Example |
|
|
20
|
+
|------------|-----------------------------------|----------------------------------------|
|
|
21
|
+
| `prompt` | UserPromptSubmit | User requests and questions |
|
|
22
|
+
| `task` | TaskCreate, TaskUpdate, TodoWrite | Current work focus and progress |
|
|
23
|
+
| `commit` | Bash (git commit) | Git commit messages |
|
|
24
|
+
| `agent` | SubagentStop | Specialized agent completion summaries |
|
|
25
|
+
| `response` | Stop | Assistant's summarized response |
|
|
26
|
+
|
|
27
|
+
## Automatic Filtering
|
|
28
|
+
|
|
29
|
+
- Very short prompts (<20 chars), confirmations, slash commands
|
|
30
|
+
- Duplicate task updates
|
|
31
|
+
- Responses summarized per `responseSummarization` mode (default: none, just length cap)
|
|
32
|
+
- Completed current-state items are hidden after 3 days (configurable: `currentState.staleAfterDays`)
|
|
33
|
+
|
|
34
|
+
## Commands
|
|
35
|
+
|
|
36
|
+
- `/remember <text>` — Save to persistent memory (types: preference, project, fact, note, lesson)
|
|
37
|
+
- `/forget [text]` — Remove remembered items (AI-assisted matching, or list all)
|
|
38
|
+
- `/entity [name]` — Look up what Mneme knows about a file, function, or entity
|
|
39
|
+
- `/status` — Health check (config, claude binary, errors, sync)
|
|
40
|
+
- `/summarize [--dry-run]` — Force immediate summarization of the activity log
|
|
41
|
+
|
|
42
|
+
## Lessons Learned
|
|
43
|
+
|
|
44
|
+
Use `/remember` with the `lesson` type to record anti-patterns and failed approaches:
|
|
45
|
+
```
|
|
46
|
+
/remember don't use git reset --hard in this repo, it wipes untracked test fixtures
|
|
47
|
+
/remember tried Redis caching but serialization overhead made it slower than in-memory
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Lessons are injected as a dedicated high-visibility section at session start, before other context. Abandoned tasks also capture their description for post-mortem context.
|
|
51
|
+
|
|
52
|
+
## Session Handoff
|
|
53
|
+
|
|
54
|
+
At session end, a `handoff.json` is written with:
|
|
55
|
+
- **workingOn**: Last meaningful user prompt
|
|
56
|
+
- **lastDone**: Summary of the last response (mode-dependent)
|
|
57
|
+
- **openItems**: TODO/next-step items from the last response
|
|
58
|
+
|
|
59
|
+
At next session start, this appears as a "Last Session" section (if <48h old). Configurable: `contextInjection.sections.lastSession.enabled`.
|
|
60
|
+
|
|
61
|
+
## Memory Storage
|
|
62
|
+
|
|
63
|
+
| File | Purpose |
|
|
64
|
+
|------|---------|
|
|
65
|
+
| `log.jsonl` | Activity log (auto-summarized at 50 entries) |
|
|
66
|
+
| `log.pending.jsonl` | Buffered entries (flushed periodically) |
|
|
67
|
+
| `summary.json` | Structured summary (JSON) |
|
|
68
|
+
| `summary.md` | Markdown summary (generated from JSON) |
|
|
69
|
+
| `remembered.json` | Persistent /remember entries |
|
|
70
|
+
| `handoff.json` | Session handoff for next session pickup |
|
|
71
|
+
| `entities.json` | Extracted entity index (files, functions, errors, packages) |
|
|
72
|
+
| `extracted-context.json` | Context extracted at PreCompact |
|
|
73
|
+
| `.last-session` | Timestamp for git changes tracking |
|
|
74
|
+
| `.cache.json` | Parsed data cache |
|
|
75
|
+
|
|
76
|
+
Config: `~/.claude-mneme/config.json`
|
|
77
|
+
Storage: `~/.claude-mneme/projects/<project>/`
|
|
78
|
+
|
|
79
|
+
## Error Logging
|
|
80
|
+
|
|
81
|
+
Errors logged to `~/.claude-mneme/errors.log` (rotated, last 100). Warning shown at session start if errors in last 24h.
|
|
82
|
+
|
|
83
|
+
## Configuration
|
|
84
|
+
|
|
85
|
+
Basic settings in `~/.claude-mneme/config.json`:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"maxLogEntriesBeforeSummarize": 50,
|
|
90
|
+
"keepRecentEntries": 10,
|
|
91
|
+
"maxResponseLength": 1000,
|
|
92
|
+
"responseSummarization": "none",
|
|
93
|
+
"maxSummarySentences": 6,
|
|
94
|
+
"model": "haiku"
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
See `CONFIG_REFERENCE.md` for full configuration options (relevance scoring, entity extraction, deduplication, outcome tracking, caching, sync server, compaction hooks, context injection).
|
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
# Claude Mneme — Configuration Reference
|
|
2
|
+
|
|
3
|
+
Full configuration options for `~/.claude-mneme/config.json`. See the [README](../README.md) for an overview of the plugin.
|
|
4
|
+
|
|
5
|
+
## Structured Summary Format
|
|
6
|
+
|
|
7
|
+
The summary is stored as JSON for efficient incremental updates:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"projectContext": "What this project is",
|
|
12
|
+
"keyDecisions": [
|
|
13
|
+
{
|
|
14
|
+
"date": "2025-02-04",
|
|
15
|
+
"decision": "...",
|
|
16
|
+
"reason": "..."
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"currentState": [
|
|
20
|
+
{
|
|
21
|
+
"topic": "Feature",
|
|
22
|
+
"status": "Implemented",
|
|
23
|
+
"updatedAt": "2025-02-04T15:00:00Z"
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"recentWork": [
|
|
27
|
+
{
|
|
28
|
+
"date": "2025-02-04",
|
|
29
|
+
"summary": "What was done"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"lastUpdated": "2025-02-04T15:00:00Z"
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Migrating Existing Summaries
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
node "${CLAUDE_PLUGIN_ROOT}/scripts/summarize.mjs" . --migrate
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Migration also happens automatically on the next summarization cycle.
|
|
43
|
+
|
|
44
|
+
## Response Summarization
|
|
45
|
+
|
|
46
|
+
Controls how assistant responses are processed before storing in the activity log.
|
|
47
|
+
|
|
48
|
+
### Modes
|
|
49
|
+
|
|
50
|
+
| Mode | Description |
|
|
51
|
+
|---------------|------------------------------------------------------------------|
|
|
52
|
+
| `"none"` | **Default.** No summarization — just truncate at `maxResponseLength`. Preserves reasoning and trade-off discussions. |
|
|
53
|
+
| `"extractive"`| Sentence scoring using action words, reasoning words, and entity references. Keeps top N sentences. |
|
|
54
|
+
| `"llm"` | *(Reserved)* LLM-based structured summarization for highest quality. |
|
|
55
|
+
|
|
56
|
+
### Configuration
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"responseSummarization": "none",
|
|
61
|
+
"maxResponseLength": 1000,
|
|
62
|
+
"maxSummarySentences": 6,
|
|
63
|
+
"reasoningWords": ["because", "instead", "decided", "can't", "avoid", "prefer", "constraint"]
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
| Option | Default | Description |
|
|
68
|
+
|--------------------------|----------------|---------------------------------------------------------|
|
|
69
|
+
| `responseSummarization` | `"none"` | Summarization mode: `"none"`, `"extractive"`, `"llm"` |
|
|
70
|
+
| `maxResponseLength` | `1000` | Hard cap on stored response length (all modes) |
|
|
71
|
+
| `maxSummarySentences` | `6` | Max sentences kept in extractive mode |
|
|
72
|
+
| `actionWords` | *(see source)* | Words scored in extractive mode (action/completion) |
|
|
73
|
+
| `reasoningWords` | *(see source)* | Words scored in extractive mode (decisions/trade-offs) |
|
|
74
|
+
|
|
75
|
+
**Migration:** If your config has the legacy `summarizeResponses: true`, it maps to `"extractive"`. `false` maps to `"none"`.
|
|
76
|
+
|
|
77
|
+
## Compaction Hooks
|
|
78
|
+
|
|
79
|
+
The plugin captures context before compaction and restores it afterward.
|
|
80
|
+
|
|
81
|
+
### PreCompact → PostCompact Flow
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
1. PreCompact fires (before compaction)
|
|
85
|
+
├── Flush pending log entries
|
|
86
|
+
├── Extract context (decisions, files, errors, todos, key points)
|
|
87
|
+
├── Save to extracted-context.json
|
|
88
|
+
└── Force summarization
|
|
89
|
+
|
|
90
|
+
2. Claude Code compacts conversation
|
|
91
|
+
|
|
92
|
+
3. PostCompact fires (SessionStart with "compact" matcher)
|
|
93
|
+
└── Inject extracted context back into conversation
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### PreCompact Configuration
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"preCompact": {
|
|
101
|
+
"enabled": true,
|
|
102
|
+
"triggers": ["auto", "manual"],
|
|
103
|
+
"flushPending": true,
|
|
104
|
+
"forceSummarize": true,
|
|
105
|
+
"extractContext": true,
|
|
106
|
+
"saveSnapshot": false,
|
|
107
|
+
"extraction": {
|
|
108
|
+
"enabled": true,
|
|
109
|
+
"maxItems": 10,
|
|
110
|
+
"categories": {
|
|
111
|
+
"decisions": true,
|
|
112
|
+
"files": true,
|
|
113
|
+
"errors": true,
|
|
114
|
+
"todos": true,
|
|
115
|
+
"keyPoints": true
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
| Option | Default | Description |
|
|
123
|
+
|---------------------------|----------------------|-----------------------------------------------|
|
|
124
|
+
| `enabled` | `true` | Enable/disable the PreCompact hook entirely |
|
|
125
|
+
| `triggers` | `["auto", "manual"]` | Which triggers to respond to |
|
|
126
|
+
| `flushPending` | `true` | Flush pending log entries before processing |
|
|
127
|
+
| `forceSummarize` | `true` | Force immediate summarization |
|
|
128
|
+
| `extractContext` | `true` | Extract context from transcript |
|
|
129
|
+
| `saveSnapshot` | `false` | Save full transcript to snapshots/ directory |
|
|
130
|
+
| `extraction.maxItems` | `10` | Max items per extraction category |
|
|
131
|
+
| `extraction.categories.*` | `true` | Enable/disable specific extraction categories |
|
|
132
|
+
|
|
133
|
+
**Extraction categories:** `decisions`, `files`, `errors`, `todos`, `keyPoints` (AI-extracted via Haiku)
|
|
134
|
+
|
|
135
|
+
### PostCompact Configuration
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"postCompact": {
|
|
140
|
+
"enabled": true,
|
|
141
|
+
"maxAgeMinutes": 5,
|
|
142
|
+
"maxFiles": 10,
|
|
143
|
+
"categories": {
|
|
144
|
+
"keyPoints": true,
|
|
145
|
+
"decisions": true,
|
|
146
|
+
"files": true,
|
|
147
|
+
"errors": true,
|
|
148
|
+
"todos": true
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
| Option | Default | Description |
|
|
155
|
+
|-----------------|---------|-----------------------------------------------------|
|
|
156
|
+
| `enabled` | `true` | Enable/disable context injection after compaction |
|
|
157
|
+
| `maxAgeMinutes` | `5` | Only inject if extraction happened within this time |
|
|
158
|
+
| `maxFiles` | `10` | Maximum file paths to include in injection |
|
|
159
|
+
| `categories.*` | `true` | Enable/disable specific categories in injection |
|
|
160
|
+
|
|
161
|
+
## Relevance-Based Injection
|
|
162
|
+
|
|
163
|
+
Scores entries by relevance instead of pure recency.
|
|
164
|
+
|
|
165
|
+
**Scoring factors:**
|
|
166
|
+
|
|
167
|
+
1. **Recency** (40%) - Exponential decay based on entry age
|
|
168
|
+
2. **File relevance** (35%) - Entries mentioning files in current project score higher
|
|
169
|
+
3. **Type priority** (25%) - commits > tasks > agents > prompts > responses
|
|
170
|
+
|
|
171
|
+
### Configuration
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"relevanceScoring": {
|
|
176
|
+
"enabled": true,
|
|
177
|
+
"maxEntries": 10,
|
|
178
|
+
"weights": {
|
|
179
|
+
"recency": 0.4,
|
|
180
|
+
"fileRelevance": 0.35,
|
|
181
|
+
"typePriority": 0.25
|
|
182
|
+
},
|
|
183
|
+
"typePriorities": {
|
|
184
|
+
"commit": 1.0,
|
|
185
|
+
"task": 0.9,
|
|
186
|
+
"agent": 0.8,
|
|
187
|
+
"prompt": 0.5,
|
|
188
|
+
"response": 0.3,
|
|
189
|
+
"compact": 0.4
|
|
190
|
+
},
|
|
191
|
+
"recencyHalfLifeHours": 24
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
| Option | Default | Description |
|
|
197
|
+
|------------------------|---------|--------------------------------------------------|
|
|
198
|
+
| `enabled` | `true` | Enable/disable relevance scoring |
|
|
199
|
+
| `maxEntries` | `10` | Max entries to inject after scoring |
|
|
200
|
+
| `weights.*` | varies | Weight for each scoring factor (should sum to 1) |
|
|
201
|
+
| `typePriorities.*` | varies | Priority score (0-1) for each entry type |
|
|
202
|
+
| `recencyHalfLifeHours` | `24` | Hours until recency score drops to 50% |
|
|
203
|
+
|
|
204
|
+
## Entity Extraction
|
|
205
|
+
|
|
206
|
+
Extracts and indexes key entities from log entries for smarter context and relevance scoring.
|
|
207
|
+
|
|
208
|
+
### What Gets Extracted
|
|
209
|
+
|
|
210
|
+
| Category | Examples | Pattern |
|
|
211
|
+
|-------------|--------------------------------|----------------------------|
|
|
212
|
+
| `files` | `src/auth.ts`, `utils.mjs` | File paths with extensions |
|
|
213
|
+
| `functions` | `handleLogin`, `fetchUser` | Function/method names |
|
|
214
|
+
| `errors` | `TypeError: Cannot read...` | Error messages and types |
|
|
215
|
+
| `packages` | `express`, `@anthropic-ai/sdk` | npm/pip package names |
|
|
216
|
+
|
|
217
|
+
### Configuration
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"entityExtraction": {
|
|
222
|
+
"enabled": true,
|
|
223
|
+
"maxContextsPerEntity": 5,
|
|
224
|
+
"maxAgeDays": 30,
|
|
225
|
+
"categories": {
|
|
226
|
+
"files": true,
|
|
227
|
+
"functions": true,
|
|
228
|
+
"errors": true,
|
|
229
|
+
"packages": true
|
|
230
|
+
},
|
|
231
|
+
"fileExtensions": ["js", "ts", "jsx", "tsx", "mjs", "py", "go", "rs", "java", "..."],
|
|
232
|
+
"minEntityLength": 2,
|
|
233
|
+
"useInRelevanceScoring": true
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
| Option | Default | Description |
|
|
239
|
+
|-------------------------|---------|-------------------------------------------|
|
|
240
|
+
| `enabled` | `true` | Enable/disable entity extraction |
|
|
241
|
+
| `maxContextsPerEntity` | `5` | Max recent contexts to keep per entity |
|
|
242
|
+
| `maxAgeDays` | `30` | Prune entities not seen in N days (0=off) |
|
|
243
|
+
| `categories.*` | `true` | Enable/disable specific entity categories |
|
|
244
|
+
| `fileExtensions` | [...] | Only index files with these extensions |
|
|
245
|
+
| `minEntityLength` | `2` | Minimum entity name length to index |
|
|
246
|
+
| `useInRelevanceScoring` | `true` | Use entity "hotness" in relevance scoring |
|
|
247
|
+
|
|
248
|
+
### Storage
|
|
249
|
+
|
|
250
|
+
Entities stored in `~/.claude-mneme/projects/<project>/entities.json`:
|
|
251
|
+
|
|
252
|
+
```json
|
|
253
|
+
{
|
|
254
|
+
"files": {
|
|
255
|
+
"src/auth.ts": {
|
|
256
|
+
"mentions": 12,
|
|
257
|
+
"lastSeen": "2025-02-04T15:00:00Z",
|
|
258
|
+
"contexts": [{ "ts": "...", "type": "commit", "summary": "Added JWT validation" }]
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Hierarchical Context Injection
|
|
265
|
+
|
|
266
|
+
Context is injected at session start with priority-based ordering:
|
|
267
|
+
|
|
268
|
+
| Priority | Sections | Behavior |
|
|
269
|
+
|------------|-----------------------------------------------------------------------|-----------------------------|
|
|
270
|
+
| **TOP** | Last Session (handoff) | If <48h old |
|
|
271
|
+
| **HIGH** | Project Context, Key Decisions, Current State, Remembered | Always injected |
|
|
272
|
+
| **MEDIUM** | Recent Work, Git Changes, Active Entities | Injected if relevant/recent |
|
|
273
|
+
| **LOW** | Recent Activity (log entries) | Limited to last 3-4 entries |
|
|
274
|
+
|
|
275
|
+
### Configuration
|
|
276
|
+
|
|
277
|
+
```json
|
|
278
|
+
{
|
|
279
|
+
"contextInjection": {
|
|
280
|
+
"enabled": true,
|
|
281
|
+
"sections": {
|
|
282
|
+
"lastSession": {
|
|
283
|
+
"enabled": true
|
|
284
|
+
},
|
|
285
|
+
"projectContext": {
|
|
286
|
+
"enabled": true,
|
|
287
|
+
"priority": "high"
|
|
288
|
+
},
|
|
289
|
+
"keyDecisions": {
|
|
290
|
+
"enabled": true,
|
|
291
|
+
"priority": "high",
|
|
292
|
+
"maxItems": 10
|
|
293
|
+
},
|
|
294
|
+
"currentState": {
|
|
295
|
+
"enabled": true,
|
|
296
|
+
"priority": "high",
|
|
297
|
+
"maxItems": 10,
|
|
298
|
+
"staleAfterDays": 3
|
|
299
|
+
},
|
|
300
|
+
"remembered": {
|
|
301
|
+
"enabled": true,
|
|
302
|
+
"priority": "high"
|
|
303
|
+
},
|
|
304
|
+
"recentWork": {
|
|
305
|
+
"enabled": true,
|
|
306
|
+
"priority": "medium",
|
|
307
|
+
"maxItems": 5,
|
|
308
|
+
"maxAgeDays": 7
|
|
309
|
+
},
|
|
310
|
+
"gitChanges": {
|
|
311
|
+
"enabled": true,
|
|
312
|
+
"priority": "medium"
|
|
313
|
+
},
|
|
314
|
+
"activeEntities": {
|
|
315
|
+
"enabled": true,
|
|
316
|
+
"priority": "medium",
|
|
317
|
+
"maxFiles": 5,
|
|
318
|
+
"maxFunctions": 5
|
|
319
|
+
},
|
|
320
|
+
"recentEntries": {
|
|
321
|
+
"enabled": true,
|
|
322
|
+
"priority": "low",
|
|
323
|
+
"maxItems": 4
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
"budgetMode": "adaptive"
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
| Option | Default | Description |
|
|
332
|
+
|-----------------------------------|------------|-------------------------------------------------------|
|
|
333
|
+
| `sections.lastSession.enabled` | `true` | Show handoff from previous session |
|
|
334
|
+
| `sections.currentState.staleAfterDays` | `3` | Hide completed items after N days (0=disabled) |
|
|
335
|
+
| `sections.*.enabled` | `true` | Enable/disable specific section |
|
|
336
|
+
| `sections.*.maxItems` | varies | Max items to show in section |
|
|
337
|
+
| `sections.recentWork.maxAgeDays` | `7` | Only show work from last N days |
|
|
338
|
+
| `sections.recentEntries.maxItems` | `4` | Reduced from 10 to minimize noise |
|
|
339
|
+
| `budgetMode` | `adaptive` | Future: auto-adjust based on context window |
|
|
340
|
+
|
|
341
|
+
## Semantic Deduplication
|
|
342
|
+
|
|
343
|
+
Groups related entries by timestamp proximity and keeps only the highest-signal entry.
|
|
344
|
+
|
|
345
|
+
### Signal Priority (highest to lowest)
|
|
346
|
+
|
|
347
|
+
| Type | Priority | Rationale |
|
|
348
|
+
|------------|----------|---------------------------|
|
|
349
|
+
| `commit` | 100 | Represents completed work |
|
|
350
|
+
| `task` | 80 | Shows what was worked on |
|
|
351
|
+
| `agent` | 70 | Agent's summary of work |
|
|
352
|
+
| `prompt` | 40 | The original request |
|
|
353
|
+
| `response` | 30 | Assistant's response |
|
|
354
|
+
| `compact` | 20 | Compaction marker |
|
|
355
|
+
|
|
356
|
+
### Configuration
|
|
357
|
+
|
|
358
|
+
```json
|
|
359
|
+
{
|
|
360
|
+
"deduplication": {
|
|
361
|
+
"enabled": true,
|
|
362
|
+
"timeWindowMinutes": 5,
|
|
363
|
+
"typePriority": {
|
|
364
|
+
"commit": 100,
|
|
365
|
+
"task": 80,
|
|
366
|
+
"agent": 70,
|
|
367
|
+
"prompt": 40,
|
|
368
|
+
"response": 30,
|
|
369
|
+
"compact": 20
|
|
370
|
+
},
|
|
371
|
+
"mergeContext": true
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
| Option | Default | Description |
|
|
377
|
+
|---------------------|---------|----------------------------------|
|
|
378
|
+
| `enabled` | `true` | Enable/disable deduplication |
|
|
379
|
+
| `timeWindowMinutes` | `5` | Group entries within this window |
|
|
380
|
+
| `typePriority.*` | varies | Priority score per entry type |
|
|
381
|
+
| `mergeContext` | `true` | Show note about merged entries |
|
|
382
|
+
|
|
383
|
+
## Outcome Tracking
|
|
384
|
+
|
|
385
|
+
Tasks tracked through full lifecycle: pending → in_progress → completed/abandoned.
|
|
386
|
+
|
|
387
|
+
### How It Affects Scoring
|
|
388
|
+
|
|
389
|
+
| Outcome | Multiplier | Rationale |
|
|
390
|
+
|---------------|------------|----------------------------------------------------------------|
|
|
391
|
+
| `completed` | 1.0 | Completed work is highest signal |
|
|
392
|
+
| `in_progress` | 0.7 | Work in progress is medium signal |
|
|
393
|
+
| `abandoned` | 0.3 | Abandoned work is low signal (might indicate what *not* to do) |
|
|
394
|
+
|
|
395
|
+
### Configuration
|
|
396
|
+
|
|
397
|
+
```json
|
|
398
|
+
{
|
|
399
|
+
"outcomeTracking": {
|
|
400
|
+
"enabled": true,
|
|
401
|
+
"outcomePriority": {
|
|
402
|
+
"completed": 1.0,
|
|
403
|
+
"in_progress": 0.7,
|
|
404
|
+
"abandoned": 0.3
|
|
405
|
+
},
|
|
406
|
+
"trackDuration": true
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
## File Caching
|
|
412
|
+
|
|
413
|
+
Caches parsed data to `.cache.json` to avoid redundant file reads.
|
|
414
|
+
|
|
415
|
+
### Configuration
|
|
416
|
+
|
|
417
|
+
```json
|
|
418
|
+
{
|
|
419
|
+
"caching": {
|
|
420
|
+
"enabled": true,
|
|
421
|
+
"maxAgeSeconds": 60
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
Cache is automatically invalidated when data files are written.
|
|
427
|
+
|
|
428
|
+
## Sync Server (Optional)
|
|
429
|
+
|
|
430
|
+
Sync memory across machines using a self-hosted server.
|
|
431
|
+
|
|
432
|
+
### Quick Start
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
node server/mneme-server.mjs
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
### Configuration
|
|
439
|
+
|
|
440
|
+
```json
|
|
441
|
+
{
|
|
442
|
+
"sync": {
|
|
443
|
+
"enabled": false,
|
|
444
|
+
"serverUrl": null,
|
|
445
|
+
"apiKey": null,
|
|
446
|
+
"projectId": null,
|
|
447
|
+
"timeoutMs": 10000,
|
|
448
|
+
"retries": 3
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
| Option | Default | Description |
|
|
454
|
+
|-------------|---------|------------------------------------------------|
|
|
455
|
+
| `enabled` | `false` | Enable sync (local-only by default) |
|
|
456
|
+
| `serverUrl` | `null` | Server URL (e.g., "http://192.168.1.100:3847") |
|
|
457
|
+
| `apiKey` | `null` | API key if server requires auth |
|
|
458
|
+
| `projectId` | `null` | Override auto-detected project name |
|
|
459
|
+
| `timeoutMs` | `10000` | Request timeout in milliseconds |
|
|
460
|
+
| `retries` | `3` | Number of retries on failure |
|
|
461
|
+
|
|
462
|
+
### How It Works
|
|
463
|
+
|
|
464
|
+
1. **Session Start**: Pull files from server, acquire lock, start heartbeat
|
|
465
|
+
2. **During Session**: Heartbeat keeps lock alive (every 5 min)
|
|
466
|
+
3. **Session End**: Push changes, release lock
|
|
467
|
+
|
|
468
|
+
### Files Synced
|
|
469
|
+
|
|
470
|
+
`log.jsonl`, `summary.json`, `summary.md`, `remembered.json`, `entities.json`
|
|
471
|
+
|
|
472
|
+
### Files NOT Synced
|
|
473
|
+
|
|
474
|
+
`log.pending.jsonl`, `.cache.json`, `.last-session`, `active-tasks.json`, `handoff.json`
|
|
475
|
+
|
|
476
|
+
### Lock Behavior
|
|
477
|
+
|
|
478
|
+
- Locks auto-expire after 30 minutes (configurable)
|
|
479
|
+
- Heartbeat extends lock every 5 minutes during active session
|
|
480
|
+
- If locked by another machine, falls back to local-only mode
|
|
481
|
+
|
|
482
|
+
See `server/README.md` for server setup and deployment options.
|
|
483
|
+
|
|
484
|
+
## Concurrent Sessions
|
|
485
|
+
|
|
486
|
+
File locking prevents data corruption across concurrent sessions:
|
|
487
|
+
|
|
488
|
+
- **Log entries**: Write-locked during flush and summarization truncation
|
|
489
|
+
- **Remembered items**: `/remember` and `/forget` use file locks
|
|
490
|
+
- **Task tracking**: Session start prunes stale tasks (>24h); create/update are locked
|
|
491
|
+
|
|
492
|
+
**Known limitations:**
|
|
493
|
+
- Task tracking may show cross-session entries
|
|
494
|
+
- All sessions' activity goes into the same log (may produce blended summaries)
|
|
495
|
+
- For best results, use one session per project
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="../assets/claude-mneme-mascot-128.png" alt="Claude Mneme Mascot" width="128">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# Claude Mneme — Plugin
|
|
6
|
+
|
|
7
|
+
Persistent memory for Claude Code. Automatically captures your coding sessions and injects relevant context into new ones so Claude picks up where you left off.
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Install from marketplace
|
|
13
|
+
claude plugin marketplace add edimuj/claude-mneme
|
|
14
|
+
claude plugin install claude-mneme
|
|
15
|
+
|
|
16
|
+
# Or install directly from GitHub
|
|
17
|
+
claude plugin add --from https://github.com/edimuj/claude-mneme/tree/main/plugin
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## What It Does
|
|
21
|
+
|
|
22
|
+
- Captures prompts, tasks, commits, and responses automatically
|
|
23
|
+
- Summarizes old entries with Haiku when the log grows
|
|
24
|
+
- Injects relevant context at session start (decisions, state, recent work)
|
|
25
|
+
- Tracks files, functions, and errors for smarter context selection
|
|
26
|
+
- Optional sync server for multi-machine memory
|
|
27
|
+
|
|
28
|
+
## Commands
|
|
29
|
+
|
|
30
|
+
| Command | Description |
|
|
31
|
+
|---------|-------------|
|
|
32
|
+
| `/remember` | Save something to memory |
|
|
33
|
+
| `/forget` | Remove remembered items |
|
|
34
|
+
| `/summarize` | Force immediate summarization |
|
|
35
|
+
| `/status` | Health check and diagnostics |
|
|
36
|
+
| `/entity` | Look up what Mneme knows about a file or function |
|
|
37
|
+
|
|
38
|
+
## Full Documentation
|
|
39
|
+
|
|
40
|
+
See the [main README](../README.md) for installation options, configuration, architecture details, and sync server setup.
|