@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.
@@ -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
@@ -0,0 +1,11 @@
1
+ {
2
+ "mcpServers": {
3
+ "cmem": {
4
+ "command": "node",
5
+ "args": ["dist/mcp/server.js"],
6
+ "env": {
7
+ "CMEM_DATA_DIR": "~/.cmem"
8
+ }
9
+ }
10
+ }
11
+ }
package/README.md CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  # 🧠 cmem
4
4
 
5
- ### Your Claude Code Conversations, Remembered Forever
5
+ ### Self-Learning Memory for Claude Code
6
6
 
7
- **Don't just explore your code or foldersβ€”explore your conversations, or pick up where you left off.**
7
+ **Never lose a conversation. Claude learns from every session.**
8
8
 
9
- **Semantic search β€’ Organize by project β€’ Favorite conversations β€’ 100% local**
9
+ **Semantic search β€’ Auto-synthesis β€’ Knowledge injection β€’ Web GUI β€’ 100% local**
10
10
 
11
11
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
12
12
  [![Node.js](https://img.shields.io/badge/Node.js-18+-green.svg)](https://nodejs.org/)
@@ -25,9 +25,35 @@ npx @colbymchenry/cmem
25
25
 
26
26
  ---
27
27
 
28
- Ever closed your terminal and lost that perfect Claude conversation? The one where you finally figured out that tricky bug, or designed that elegant architecture?
28
+ ## Stop Writing Markdown Files
29
29
 
30
- **cmem** gives Claude Code a long-term memory. Every conversation is automatically saved, indexed, and searchableβ€”so you (and Claude) can pick up right where you left off.
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
  ![Open all sessions in current directory](https://github.com/user-attachments/assets/3783343c-815c-47ba-a6da-fb96cb25ee1b)
53
79
 
80
+ ---
81
+
82
+ ## Web GUI
83
+
84
+ Manage your learned knowledge through a clean web interface.
85
+
86
+ ![GUI](https://github.com/user-attachments/assets/70f0d89b-6e1e-4f3e-bada-185197d226e8)
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
- ## Why cmem?
117
+ Find conversations by meaning, not keywords. "That React hooks discussion" or "the database migration plan" just works.
56
118
 
57
- 🧠 **Sub-Agent Summarization** β€” When Claude needs context from past sessions, cmem spawns a separate Claude instance to read and synthesizeβ€”keeping your main conversation context clean. Just like Explore agents, but for your conversation history.
119
+ ### πŸ€– Claude Remembers
58
120
 
59
- πŸ” **Semantic Search** β€” Find conversations by meaning, not keywords. "That React hooks discussion" or "the database migration plan" just works.
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
- πŸ€– **Claude Can Remember** β€” Via MCP integration, Claude can search your past conversations. "What did we decide about auth last week?" Finally, context that persists.
126
+ ### πŸ’Ύ Automatic Backup
62
127
 
63
- πŸ”„ **Automatic Sync** β€” A background daemon watches your Claude Code sessions and keeps everything indexed in real-time.
128
+ Every conversation is backed up to `~/.cmem/backups/`. Even if Claude Code clears its storage, cmem restores your sessions instantly.
64
129
 
65
- πŸ’Ύ **Never Lost** β€” Every conversation is automatically backed up. Even if Claude Code clears its storage, cmem restores your sessions instantly when you resume them.
130
+ ### πŸͺ Hook-Based Integration
66
131
 
67
- πŸ“¦ **100% Local & Private** β€” Everything runs on your machine. No cloud services, no API keys, no external servers. Just SQLite + local AI embeddings.
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. Optionally set up auto-sync on login (macOS)
79
- 4. Configure MCP server in `~/.claude.json` + permissions in `~/.claude/settings.json`
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
- That's it. Your conversations are now being remembered.
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 watch # Start the sync daemon
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
- ## How It Works
174
+ ## MCP Tools
100
175
 
101
- ```
102
- Claude Code sessions β†’ cmem watch daemon β†’ SQLite + Vector DB
103
- ↓
104
- Claude Code ← MCP Server ← Semantic Search
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
- 1. **Watch**: The daemon monitors `~/.claude/` for new/changed sessions
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
- ### Background Daemon
192
+ ### Knowledge Injection (Hooks)
113
193
 
114
- The `cmem watch` daemon runs in the background and automatically syncs your Claude Code sessions:
194
+ When you send a prompt to Claude:
115
195
 
116
- - **With daemon installed**: Sessions sync automatically whenever you use Claude Code
117
- - **Without daemon**: Run `cmem watch` manually, or sessions sync when you open the TUI
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
- On macOS, you can install the daemon to start automatically on login:
120
- ```bash
121
- cmem install # Enable auto-start
122
- cmem uninstall # Disable auto-start
123
- ```
201
+ ### Session Sync (Hooks)
124
202
 
125
- ## MCP Tools
203
+ When a session ends or compacts:
126
204
 
127
- Once configured, Claude Code gains these abilities:
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
- | Tool | What it does |
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
- ### How `search_and_summarize` Works
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
- This keeps your main context cleanβ€”only the concise summary comes back, not the raw session content. Uses Haiku by default for speed, configurable to Sonnet or Opus.
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 watch` | Start sync daemon |
179
- | `cmem install` | Auto-start daemon on login (macOS) |
180
- | `cmem uninstall` | Remove auto-start |
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
- Claude Code sessions are read from `~/.claude/`.
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 (768 dimensions, runs in Node.js)
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>
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: Browse and manage Claude Code memory
3
+ disable-model-invocation: true
4
+ ---
5
+
6
+ Launch the CMEM terminal interface to browse sessions and manage learned knowledge.
7
+
8
+ Execute: !node ${CLAUDE_PLUGIN_ROOT}/dist/cli.js $ARGUMENTS