@colbymchenry/cmem 0.2.37 β 0.5.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/.mcp.json +11 -0
- package/README.md +157 -111
- package/commands/cmem.md +8 -0
- package/dist/cli.js +1866 -373
- package/dist/cli.js.map +1 -1
- package/dist/hooks/consult.js +1002 -0
- package/dist/hooks/consult.js.map +1 -0
- package/dist/hooks/sync.js +804 -0
- package/dist/hooks/sync.js.map +1 -0
- package/dist/hooks/synthesize.js +1329 -0
- package/dist/hooks/synthesize.js.map +1 -0
- package/dist/mcp/server.js +1850 -0
- package/dist/mcp/server.js.map +1 -0
- package/hooks/hooks.json +38 -0
- package/package.json +14 -7
- package/skills/memory-search/SKILL.md +12 -0
- package/scripts/postinstall.js +0 -46
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cmem",
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Self-learning memory for Claude Code. Never lose a conversation.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Colby McHenry",
|
|
7
|
+
"url": "https://github.com/colbymchenry"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/colbymchenry/cmem",
|
|
10
|
+
"repository": "https://github.com/colbymchenry/cmem",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"keywords": ["memory", "learning", "sessions", "knowledge"],
|
|
13
|
+
"commands": "../commands/",
|
|
14
|
+
"skills": "../skills/",
|
|
15
|
+
"hooks": "../hooks/hooks.json",
|
|
16
|
+
"mcpServers": "../.mcp.json"
|
|
17
|
+
}
|
package/.mcp.json
ADDED
package/README.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
# π§ cmem
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Self-Learning Memory for Claude Code
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**Never lose a conversation. Claude learns from every session.**
|
|
8
8
|
|
|
9
|
-
**Semantic search β’
|
|
9
|
+
**Semantic search β’ Auto-synthesis β’ Knowledge injection β’ Web GUI β’ 100% local**
|
|
10
10
|
|
|
11
11
|
[](https://opensource.org/licenses/MIT)
|
|
12
12
|
[](https://nodejs.org/)
|
|
@@ -25,46 +25,84 @@ npx @colbymchenry/cmem
|
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
## What is cmem?
|
|
29
29
|
|
|
30
|
-
**cmem**
|
|
30
|
+
**cmem** is a self-learning memory system for Claude Code. It:
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
1. **Backs up every conversation** β Never lose work, even if Claude clears storage
|
|
33
|
+
2. **Learns from your sessions** β Auto-extracts lessons about your projects
|
|
34
|
+
3. **Injects relevant knowledge** β Claude starts each conversation with context about your codebase
|
|
35
|
+
4. **Searches your history** β Find past conversations by meaning, not keywords
|
|
36
|
+
5. **Web GUI** β Manage learned knowledge through a beautiful interface
|
|
33
37
|
|
|
34
|
-
|
|
35
|
-
>
|
|
36
|
-
|
|
38
|
+
```
|
|
39
|
+
User asks question β cmem finds relevant lessons β Injects as <project_knowledge>
|
|
40
|
+
β
|
|
41
|
+
Claude answers with full context
|
|
42
|
+
β
|
|
43
|
+
Session ends β Synthesis engine extracts new lessons β Knowledge grows
|
|
44
|
+
```
|
|
37
45
|
|
|
38
|
-
|
|
46
|
+
## Web GUI
|
|
39
47
|
|
|
40
|
-
|
|
48
|
+
Manage your learned knowledge through a clean web interface.
|
|
49
|
+
|
|
50
|
+

|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
cmem gui
|
|
54
|
+
```
|
|
41
55
|
|
|
42
|
-
|
|
56
|
+
**Features:**
|
|
57
|
+
- Browse all lessons by project and category
|
|
58
|
+
- Edit, archive, or delete lessons
|
|
59
|
+
- View confidence scores and usage stats
|
|
60
|
+
- Create lessons manually
|
|
61
|
+
- Filter by category (architecture, bugs, conventions, etc.)
|
|
43
62
|
|
|
44
|
-
|
|
45
|
-
>
|
|
46
|
-
> Browse, search, filter, rename, and restore any conversation with the interactive TUI.
|
|
63
|
+
## Features
|
|
47
64
|
|
|
48
|
-
|
|
65
|
+
### π Self-Learning Knowledge Base
|
|
49
66
|
|
|
50
|
-
|
|
67
|
+
cmem automatically extracts reusable lessons from your conversations:
|
|
68
|
+
- **Architecture decisions** and their rationale
|
|
69
|
+
- **Anti-patterns** β what NOT to do and why
|
|
70
|
+
- **Bug patterns** β common issues and root causes
|
|
71
|
+
- **Project conventions** β code style, naming, organization
|
|
72
|
+
- **Dependency knowledge** β library quirks, version issues
|
|
73
|
+
- **Domain knowledge** β business logic, requirements
|
|
51
74
|
|
|
52
|
-
|
|
75
|
+
<img width="848" height="348" alt="PNG image" src="https://github.com/user-attachments/assets/f3abd9b0-0efa-4da8-a668-cb8d7532b24c" />
|
|
53
76
|
|
|
77
|
+
These lessons are automatically surfaced when relevant to your current task
|
|
54
78
|
|
|
55
|
-
|
|
79
|
+
### π Semantic Search
|
|
56
80
|
|
|
57
|
-
|
|
81
|
+
Find conversations by meaning, not keywords. "That React hooks discussion" or "the database migration plan" just works.
|
|
58
82
|
|
|
59
|
-
|
|
83
|
+
### π€ Claude Remembers
|
|
60
84
|
|
|
61
|
-
|
|
85
|
+
Via MCP integration, Claude can search your past conversations and learned knowledge:
|
|
86
|
+
- "What did we decide about auth last week?"
|
|
87
|
+
- "How do we handle errors in this project?"
|
|
88
|
+
- "What's the convention for API endpoints?"
|
|
62
89
|
|
|
63
|
-
|
|
90
|
+
### πΎ Automatic Backup
|
|
64
91
|
|
|
65
|
-
|
|
92
|
+
Every conversation is backed up to `~/.cmem/backups/`. Even if Claude Code clears its storage, cmem restores your sessions instantly.
|
|
66
93
|
|
|
67
|
-
|
|
94
|
+
### πͺ Hook-Based Integration
|
|
95
|
+
|
|
96
|
+
cmem integrates with Claude Code via hooks (no background daemon):
|
|
97
|
+
- **UserPromptSubmit** β Injects relevant lessons before Claude responds
|
|
98
|
+
- **Stop/PreCompact** β Syncs and backs up sessions automatically
|
|
99
|
+
|
|
100
|
+
### π¦ 100% Local & Private
|
|
101
|
+
|
|
102
|
+
Everything runs on your machine:
|
|
103
|
+
- SQLite database with vector embeddings
|
|
104
|
+
- Local AI embeddings (nomic-embed-text-v1.5)
|
|
105
|
+
- No cloud services, no API keys required
|
|
68
106
|
|
|
69
107
|
## Quick Start
|
|
70
108
|
|
|
@@ -75,16 +113,16 @@ npx @colbymchenry/cmem
|
|
|
75
113
|
The setup wizard will:
|
|
76
114
|
1. Install `cmem` globally
|
|
77
115
|
2. Download the embedding model (~130MB, one-time)
|
|
78
|
-
3.
|
|
79
|
-
4.
|
|
116
|
+
3. Configure MCP server in Claude Code
|
|
117
|
+
4. Set up hooks for automatic sync and learning
|
|
118
|
+
5. Clean up any old daemon from previous versions
|
|
80
119
|
|
|
81
|
-
|
|
120
|
+
**Upgrading?** Just run the same command β it handles everything automatically.
|
|
82
121
|
|
|
83
122
|
## Requirements
|
|
84
123
|
|
|
85
124
|
- **Node.js 18+**
|
|
86
|
-
|
|
87
|
-
No other dependencies. The AI embedding model downloads automatically on first use and runs entirely in Node.js.
|
|
125
|
+
- **Claude Code CLI** (for synthesis features)
|
|
88
126
|
|
|
89
127
|
## Usage
|
|
90
128
|
|
|
@@ -92,78 +130,68 @@ No other dependencies. The AI embedding model downloads automatically on first u
|
|
|
92
130
|
cmem # Browse sessions in beautiful TUI
|
|
93
131
|
cmem --local # Browse sessions from current folder only
|
|
94
132
|
cmem search "query" # Semantic search across all conversations
|
|
95
|
-
cmem
|
|
133
|
+
cmem synthesize # Extract lessons from queued sessions
|
|
134
|
+
cmem gui # Launch web-based lesson management UI
|
|
96
135
|
cmem stats # See what's stored
|
|
97
136
|
```
|
|
98
137
|
|
|
99
|
-
##
|
|
138
|
+
## MCP Tools
|
|
100
139
|
|
|
101
|
-
|
|
102
|
-
Claude Code sessions β cmem watch daemon β SQLite + Vector DB
|
|
103
|
-
β
|
|
104
|
-
Claude Code β MCP Server β Semantic Search
|
|
105
|
-
```
|
|
140
|
+
Claude Code gains these abilities:
|
|
106
141
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
142
|
+
| Tool | Description |
|
|
143
|
+
|------|-------------|
|
|
144
|
+
| `search_and_summarize` | AI-synthesized answers from past sessions |
|
|
145
|
+
| `search_sessions` | Find sessions by semantic similarity |
|
|
146
|
+
| `search_lessons` | Find learned knowledge for current project |
|
|
147
|
+
| `save_lesson` | Manually save important knowledge |
|
|
148
|
+
| `validate_lesson` | Mark a lesson as helpful (boosts confidence) |
|
|
149
|
+
| `reject_lesson` | Mark a lesson as wrong (reduces confidence) |
|
|
150
|
+
| `list_lessons` | Browse all lessons for a project |
|
|
151
|
+
| `list_sessions` | Browse recent sessions |
|
|
152
|
+
| `get_session` | Retrieve full conversation history |
|
|
111
153
|
|
|
112
|
-
|
|
154
|
+
## How It Works
|
|
113
155
|
|
|
114
|
-
|
|
156
|
+
### Knowledge Injection (Hooks)
|
|
115
157
|
|
|
116
|
-
|
|
117
|
-
- **Without daemon**: Run `cmem watch` manually, or sessions sync when you open the TUI
|
|
158
|
+
When you send a prompt to Claude:
|
|
118
159
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
```
|
|
160
|
+
1. **UserPromptSubmit hook** triggers
|
|
161
|
+
2. cmem searches for relevant lessons
|
|
162
|
+
3. Matching lessons are injected as `<project_knowledge>`
|
|
163
|
+
4. Claude sees this context before responding
|
|
124
164
|
|
|
125
|
-
|
|
165
|
+
### Session Sync (Hooks)
|
|
126
166
|
|
|
127
|
-
|
|
167
|
+
When a session ends or compacts:
|
|
128
168
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
| `list_sessions` | Browse recent sessions |
|
|
134
|
-
| `get_session` | Retrieve full conversation history |
|
|
135
|
-
| `get_session_context` | Get context to continue a past conversation |
|
|
169
|
+
1. **Stop/PreCompact hook** triggers
|
|
170
|
+
2. cmem parses and indexes the session
|
|
171
|
+
3. Session is backed up to `~/.cmem/backups/`
|
|
172
|
+
4. Session is queued for lesson extraction
|
|
136
173
|
|
|
137
|
-
###
|
|
174
|
+
### Lesson Synthesis
|
|
138
175
|
|
|
176
|
+
Sessions in the queue are processed by the synthesis engine:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
cmem synthesize # Process pending sessions
|
|
180
|
+
cmem synthesize -s # Show queue status
|
|
139
181
|
```
|
|
140
|
-
Main Claude Session cmem MCP Server
|
|
141
|
-
β β
|
|
142
|
-
β "What did we decide about auth?" β
|
|
143
|
-
βββββββββββββββββββββββββββββββββββββββββββββΊβ
|
|
144
|
-
β β
|
|
145
|
-
β ββββββββββ΄βββββββββ
|
|
146
|
-
β β 1. Vector search β
|
|
147
|
-
β β 2. Find sessions β
|
|
148
|
-
β β 3. Read content β
|
|
149
|
-
β ββββββββββ¬βββββββββ
|
|
150
|
-
β β
|
|
151
|
-
β ββββββββββ΄βββββββββ
|
|
152
|
-
β β Spawn Claude CLI β
|
|
153
|
-
β β (sub-agent) β
|
|
154
|
-
β β β
|
|
155
|
-
β β Reads sessions, β
|
|
156
|
-
β β synthesizes β
|
|
157
|
-
β β answer β
|
|
158
|
-
β ββββββββββ¬βββββββββ
|
|
159
|
-
β β
|
|
160
|
-
β "Based on your Jan 15 session, you β
|
|
161
|
-
β decided to use JWT with refresh..." β
|
|
162
|
-
ββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
163
|
-
β β
|
|
164
|
-
```
|
|
165
182
|
|
|
166
|
-
|
|
183
|
+
The synthesis engine uses Claude (via CLI) to analyze sessions and extract reusable lessons.
|
|
184
|
+
|
|
185
|
+
## Lesson Confidence System
|
|
186
|
+
|
|
187
|
+
Each lesson has a confidence score (0-100%):
|
|
188
|
+
|
|
189
|
+
- **Synthesized lessons** start at 30-70% based on evidence
|
|
190
|
+
- **Manual lessons** start at 60%
|
|
191
|
+
- **Validation** boosts confidence by 10%
|
|
192
|
+
- **Rejection** reduces confidence by 20%
|
|
193
|
+
- **Very low confidence** lessons are auto-archived
|
|
194
|
+
- **Unused lessons** decay over time
|
|
167
195
|
|
|
168
196
|
## Commands
|
|
169
197
|
|
|
@@ -175,28 +203,12 @@ This keeps your main context cleanβonly the concise summary comes back, not th
|
|
|
175
203
|
| `cmem search <query>` | Semantic search |
|
|
176
204
|
| `cmem list` | List all sessions |
|
|
177
205
|
| `cmem restore <id>` | Output session context |
|
|
178
|
-
| `cmem
|
|
179
|
-
| `cmem
|
|
180
|
-
| `cmem
|
|
206
|
+
| `cmem synthesize` | Extract lessons from queue |
|
|
207
|
+
| `cmem synthesize -s` | Show synthesis queue status |
|
|
208
|
+
| `cmem gui` | Launch web-based lesson management UI |
|
|
181
209
|
| `cmem stats` | Storage statistics |
|
|
182
210
|
| `cmem mcp` | Start MCP server |
|
|
183
211
|
|
|
184
|
-
## TUI Views
|
|
185
|
-
|
|
186
|
-
### Global Tab
|
|
187
|
-
All your sessions in one place, smart-sorted into three tiers:
|
|
188
|
-
1. **Starred sessions** β Your favorites, sorted by message count
|
|
189
|
-
2. **Named sessions** β Custom-named conversations, sorted by message count
|
|
190
|
-
3. **Everything else** β Sorted by message count
|
|
191
|
-
|
|
192
|
-
Press `s` to star/unstar a session.
|
|
193
|
-
|
|
194
|
-
### Projects Tab
|
|
195
|
-
Browse sessions organized by project folder.
|
|
196
|
-
- Press `Enter` to drill into a project's sessions
|
|
197
|
-
- Press `s` to enter **sort mode** β use `β/β` to reorder, `Enter` to confirm
|
|
198
|
-
- Custom project order is persisted
|
|
199
|
-
|
|
200
212
|
## TUI Keyboard Shortcuts
|
|
201
213
|
|
|
202
214
|
| Key | Action |
|
|
@@ -215,18 +227,52 @@ Browse sessions organized by project folder.
|
|
|
215
227
|
## Data Storage
|
|
216
228
|
|
|
217
229
|
All data is stored locally in `~/.cmem/`:
|
|
218
|
-
- `sessions.db` β SQLite database with vector embeddings
|
|
219
|
-
- `models/` β Downloaded embedding model (~130MB)
|
|
220
|
-
- `backups/` β Full copies of all conversation JSONLs (auto-restored if Claude deletes them)
|
|
221
230
|
|
|
222
|
-
|
|
231
|
+
```
|
|
232
|
+
~/.cmem/
|
|
233
|
+
βββ sessions.db # SQLite database (sessions, lessons, embeddings)
|
|
234
|
+
βββ models/ # Downloaded embedding model (~130MB)
|
|
235
|
+
βββ backups/ # Full copies of all conversation JSONLs
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Plugin Architecture
|
|
239
|
+
|
|
240
|
+
cmem is designed as a Claude Code plugin:
|
|
241
|
+
|
|
242
|
+
```
|
|
243
|
+
.claude-plugin/
|
|
244
|
+
βββ plugin.json # Plugin manifest
|
|
245
|
+
commands/
|
|
246
|
+
βββ cmem.md # /cmem slash command
|
|
247
|
+
skills/
|
|
248
|
+
βββ memory-search/
|
|
249
|
+
βββ SKILL.md # Memory search skill
|
|
250
|
+
hooks/
|
|
251
|
+
βββ hooks.json # UserPromptSubmit, Stop, PreCompact hooks
|
|
252
|
+
.mcp.json # MCP server configuration
|
|
253
|
+
```
|
|
223
254
|
|
|
224
255
|
## Tech Stack
|
|
225
256
|
|
|
226
257
|
- **SQLite** + **sqlite-vec** β Embedded vector database
|
|
227
|
-
- **transformers.js** + **nomic-embed-text-v1.5** β Local AI embeddings
|
|
258
|
+
- **transformers.js** + **nomic-embed-text-v1.5** β Local AI embeddings
|
|
228
259
|
- **ink** β Beautiful terminal UI (React for CLI)
|
|
260
|
+
- **React** + **Vite** + **Tailwind** β Web GUI
|
|
229
261
|
- **MCP** β Model Context Protocol for Claude integration
|
|
262
|
+
- **Claude Code Hooks** β Event-driven integration (no daemon)
|
|
263
|
+
|
|
264
|
+
## Upgrading from Previous Versions
|
|
265
|
+
|
|
266
|
+
If you're upgrading from a version that used the background daemon:
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
npx @colbymchenry/cmem
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
The setup wizard will:
|
|
273
|
+
- Automatically stop and remove the old daemon
|
|
274
|
+
- Configure the new hook-based system
|
|
275
|
+
- Your existing sessions and data are preserved
|
|
230
276
|
|
|
231
277
|
## License
|
|
232
278
|
|
|
@@ -235,6 +281,6 @@ MIT
|
|
|
235
281
|
---
|
|
236
282
|
|
|
237
283
|
<p align="center">
|
|
238
|
-
<b>Stop losing your best conversations.</b><br>
|
|
284
|
+
<b>Stop losing your best conversations. Start learning from them.</b><br>
|
|
239
285
|
<code>npx @colbymchenry/cmem</code>
|
|
240
286
|
</p>
|
package/commands/cmem.md
ADDED