@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.
@@ -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,46 +25,84 @@ 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
+ ## What is cmem?
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
+ **cmem** is a self-learning memory system for Claude Code. It:
31
31
 
32
- ### MCP Integration
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
- > **Using CMEM MCP to fetch conversational data about previous chat sessions**
35
- >
36
- > Claude can search through your conversation history and synthesize answersβ€”all without cluttering your main session context.
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
- ![Query All Conversational History](https://github.com/user-attachments/assets/03accdee-7d3b-4d60-8b30-548e4a3a8101)
46
+ ## Web GUI
39
47
 
40
- ---
48
+ Manage your learned knowledge through a clean web interface.
49
+
50
+ ![GUI](https://github.com/user-attachments/assets/70f0d89b-6e1e-4f3e-bada-185197d226e8)
51
+
52
+ ```bash
53
+ cmem gui
54
+ ```
41
55
 
42
- ### Session Navigation
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
- > **Easily navigate between previous chat sessions and pick back up right where you left off**
45
- >
46
- > Browse, search, filter, rename, and restore any conversation with the interactive TUI.
63
+ ## Features
47
64
 
48
- ![Filter by Folder : Rename : Resume Sessions](https://github.com/user-attachments/assets/d0c8eb76-2d82-4740-81b7-4d8f88fad84f)
65
+ ### πŸ“š Self-Learning Knowledge Base
49
66
 
50
- #### Open all previous chat sessions in current directory
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
- ![Open all sessions in current directory](https://github.com/user-attachments/assets/3783343c-815c-47ba-a6da-fb96cb25ee1b)
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
- ## Why cmem?
79
+ ### πŸ” Semantic Search
56
80
 
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.
81
+ Find conversations by meaning, not keywords. "That React hooks discussion" or "the database migration plan" just works.
58
82
 
59
- πŸ” **Semantic Search** β€” Find conversations by meaning, not keywords. "That React hooks discussion" or "the database migration plan" just works.
83
+ ### πŸ€– Claude Remembers
60
84
 
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.
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
- πŸ”„ **Automatic Sync** β€” A background daemon watches your Claude Code sessions and keeps everything indexed in real-time.
90
+ ### πŸ’Ύ Automatic Backup
64
91
 
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.
92
+ Every conversation is backed up to `~/.cmem/backups/`. Even if Claude Code clears its storage, cmem restores your sessions instantly.
66
93
 
67
- πŸ“¦ **100% Local & Private** β€” Everything runs on your machine. No cloud services, no API keys, no external servers. Just SQLite + local AI embeddings.
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. Optionally set up auto-sync on login (macOS)
79
- 4. Configure MCP server in `~/.claude.json` + permissions in `~/.claude/settings.json`
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
- That's it. Your conversations are now being remembered.
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 watch # Start the sync daemon
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
- ## How It Works
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
- 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
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
- ### Background Daemon
154
+ ## How It Works
113
155
 
114
- The `cmem watch` daemon runs in the background and automatically syncs your Claude Code sessions:
156
+ ### Knowledge Injection (Hooks)
115
157
 
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
158
+ When you send a prompt to Claude:
118
159
 
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
- ```
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
- ## MCP Tools
165
+ ### Session Sync (Hooks)
126
166
 
127
- Once configured, Claude Code gains these abilities:
167
+ When a session ends or compacts:
128
168
 
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 |
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
- ### How `search_and_summarize` Works
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
- 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.
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 watch` | Start sync daemon |
179
- | `cmem install` | Auto-start daemon on login (macOS) |
180
- | `cmem uninstall` | Remove auto-start |
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
- Claude Code sessions are read from `~/.claude/`.
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 (768 dimensions, runs in Node.js)
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>
@@ -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