@colbymchenry/cmem 0.2.37 β 0.5.2
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 +180 -98
- 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,9 +25,35 @@ npx @colbymchenry/cmem
|
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
## Stop Writing Markdown Files
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Everyone tries to solve Claude's memory problem the same way: **manually writing markdown files**. `CLAUDE.md`, `ARCHITECTURE.md`, decision logs, convention docs...
|
|
31
|
+
|
|
32
|
+
It's tedious. It's incomplete. And you forget to update them.
|
|
33
|
+
|
|
34
|
+
**cmem takes a different approach.** Instead of *you* documenting everything, cmem watches your conversations and *automatically* extracts the knowledge Claude needs. Architecture decisions, bug patterns, project conventions, anti-patternsβall captured naturally as you work.
|
|
35
|
+
|
|
36
|
+
Think of it like giving Claude a **notebook for each project**. Every conversation adds notes. When Claude needs to answer a question, it semantically searches this organized, efficient knowledge baseβfinding exactly the right context without you lifting a finger.
|
|
37
|
+
|
|
38
|
+
> **Traditional approach:** You manually write docs β Claude reads them β Docs aren't detailed enough so Claude explores anyway β You forget to update β Outdated docs lead to bad suggestions
|
|
39
|
+
>
|
|
40
|
+
> **cmem approach:** You just code β cmem learns from every session β Knowledge stays current and detailed β Claude gives informed answers instantly
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## What is cmem?
|
|
45
|
+
|
|
46
|
+
**cmem** is a self-learning memory system for Claude Code. It:
|
|
47
|
+
|
|
48
|
+
1. **Backs up every conversation** β Never lose work, even if Claude clears storage
|
|
49
|
+
2. **Learns from your sessions** β Auto-extracts lessons about your projects
|
|
50
|
+
3. **Injects relevant knowledge** β Claude starts each conversation with context about your codebase
|
|
51
|
+
4. **Searches your history** β Find past conversations by meaning, not keywords
|
|
52
|
+
5. **Rename and favorite sessions** - Never lose those valuable sessions between you and Claude
|
|
53
|
+
6. **View all sessions by project** - Organized chat sessions by what project you were working on
|
|
54
|
+
7. **Web GUI** β Manage learned knowledge through a beautiful interface
|
|
55
|
+
|
|
56
|
+
---
|
|
31
57
|
|
|
32
58
|
### MCP Integration
|
|
33
59
|
|
|
@@ -51,20 +77,68 @@ Ever closed your terminal and lost that perfect Claude conversation? The one whe
|
|
|
51
77
|
|
|
52
78
|

|
|
53
79
|
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Web GUI
|
|
83
|
+
|
|
84
|
+
Manage your learned knowledge through a clean web interface.
|
|
85
|
+
|
|
86
|
+

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