claude-memory-agent 2.0.1 → 2.1.0

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.
Files changed (34) hide show
  1. package/README.md +206 -206
  2. package/agent_card.py +186 -0
  3. package/bin/cli.js +317 -185
  4. package/bin/postinstall.js +270 -270
  5. package/dashboard.html +4232 -2689
  6. package/hooks/__pycache__/grounding-hook.cpython-312.pyc +0 -0
  7. package/hooks/__pycache__/session_end.cpython-312.pyc +0 -0
  8. package/hooks/grounding-hook.py +422 -348
  9. package/hooks/session_end.py +293 -192
  10. package/hooks/session_start.py +227 -227
  11. package/install.py +919 -902
  12. package/main.py +4496 -2859
  13. package/package.json +47 -47
  14. package/services/__init__.py +50 -50
  15. package/services/__pycache__/__init__.cpython-312.pyc +0 -0
  16. package/services/__pycache__/curator.cpython-312.pyc +0 -0
  17. package/services/__pycache__/database.cpython-312.pyc +0 -0
  18. package/services/curator.py +1606 -0
  19. package/services/database.py +3637 -2485
  20. package/skills/__init__.py +21 -1
  21. package/skills/__pycache__/__init__.cpython-312.pyc +0 -0
  22. package/skills/__pycache__/confidence_tracker.cpython-312.pyc +0 -0
  23. package/skills/__pycache__/context.cpython-312.pyc +0 -0
  24. package/skills/__pycache__/curator.cpython-312.pyc +0 -0
  25. package/skills/__pycache__/search.cpython-312.pyc +0 -0
  26. package/skills/__pycache__/session_review.cpython-312.pyc +0 -0
  27. package/skills/__pycache__/store.cpython-312.pyc +0 -0
  28. package/skills/confidence_tracker.py +441 -0
  29. package/skills/context.py +675 -0
  30. package/skills/curator.py +348 -0
  31. package/skills/search.py +369 -213
  32. package/skills/session_review.py +418 -0
  33. package/skills/store.py +377 -179
  34. package/update_system.py +829 -817
package/README.md CHANGED
@@ -1,206 +1,206 @@
1
- # Claude Memory Agent
2
-
3
- A persistent semantic memory system for Claude Code sessions. Stores memories, tracks decisions, and provides anti-hallucination grounding context.
4
-
5
- ## Features
6
-
7
- - **Semantic Memory Storage** - Store and retrieve memories using natural language
8
- - **Session Timeline** - Track decisions, actions, and observations
9
- - **Anti-Hallucination** - Grounding context injection to prevent contradictions
10
- - **Pattern Learning** - Store and reuse successful solution patterns
11
- - **Dashboard** - Web UI for browsing and managing memories
12
- - **Claude Code Integration** - Hooks for automatic session tracking
13
-
14
- ## Quick Start
15
-
16
- ### 1. Prerequisites (Install These First!)
17
-
18
- | Requirement | Download | Why Needed |
19
- |-------------|----------|------------|
20
- | **Python 3.9+** | https://python.org | Runs the agent |
21
- | **Ollama** | https://ollama.ai/download | Provides embeddings |
22
- | **Node.js 16+** | https://nodejs.org | For npm install |
23
-
24
- **After installing Ollama, run these commands:**
25
-
26
- ```bash
27
- # Download the embedding model (required!)
28
- ollama pull nomic-embed-text
29
-
30
- # Start Ollama (runs in background)
31
- ollama serve
32
- ```
33
-
34
- ### 2. Installation
35
-
36
- #### Option A: Install via npm (Recommended)
37
-
38
- ```bash
39
- # Install globally
40
- npm install -g claude-memory-agent
41
-
42
- # Run the setup wizard
43
- claude-memory-agent install
44
-
45
- # Start the agent
46
- claude-memory-agent start
47
- ```
48
-
49
- #### Option B: Install via npx (No global install)
50
-
51
- ```bash
52
- # Run directly without installing
53
- npx claude-memory-agent install
54
- npx claude-memory-agent start
55
- ```
56
-
57
- #### Option C: Clone from GitHub
58
-
59
- ```bash
60
- # Clone the repository
61
- git clone https://github.com/yourusername/claude-memory-agent.git
62
- cd claude-memory-agent
63
-
64
- # Run the installation wizard
65
- python install.py
66
- ```
67
-
68
- The installer will:
69
- - Install Python dependencies
70
- - Create `.env` configuration file
71
- - Configure Claude Code MCP settings
72
- - Set up session tracking hooks
73
- - Create platform-specific startup scripts
74
-
75
- ### 3. Start the Agent
76
-
77
- **Windows:**
78
- ```bash
79
- # Option 1: Double-click start-memory-agent.vbs
80
- # Option 2: Use CLI
81
- memory-agent start
82
- ```
83
-
84
- **Mac/Linux:**
85
- ```bash
86
- ./start-memory-agent.sh
87
- # or
88
- python memory-agent start
89
- ```
90
-
91
- ### 4. Open Dashboard
92
-
93
- ```bash
94
- memory-agent dashboard
95
- # or open http://localhost:8102/dashboard
96
- ```
97
-
98
- ## CLI Commands
99
-
100
- ### If installed via npm:
101
-
102
- ```bash
103
- claude-memory-agent install # Run setup wizard
104
- claude-memory-agent start # Start agent in background
105
- claude-memory-agent stop # Stop running agent
106
- claude-memory-agent status # Check if agent is running
107
- claude-memory-agent dashboard # Open web dashboard
108
- claude-memory-agent logs # View recent log output
109
- ```
110
-
111
- ### If cloned from GitHub:
112
-
113
- ```bash
114
- python memory-agent start # Start agent in background
115
- python memory-agent stop # Stop running agent
116
- python memory-agent status # Check if agent is running
117
- python memory-agent dashboard # Open web dashboard
118
- python memory-agent logs # View recent log output
119
- python memory-agent install # Re-run installation wizard
120
- ```
121
-
122
- ## Configuration
123
-
124
- Configuration is stored in `.env` (created during installation):
125
-
126
- ```bash
127
- # Server
128
- PORT=8102
129
- HOST=0.0.0.0
130
- MEMORY_AGENT_URL=http://localhost:8102
131
-
132
- # Ollama / Embeddings
133
- OLLAMA_HOST=http://localhost:11434
134
- EMBEDDING_MODEL=nomic-embed-text
135
-
136
- # Database
137
- DATABASE_PATH=./memories.db
138
- USE_VECTOR_INDEX=true
139
-
140
- # Logging
141
- LOG_LEVEL=INFO
142
- ```
143
-
144
- See `.env.example` for all available options.
145
-
146
- ## MCP Tools
147
-
148
- The agent provides these tools to Claude Code:
149
-
150
- | Tool | Description |
151
- |------|-------------|
152
- | `memory_store` | Store a memory with semantic embedding |
153
- | `memory_search` | Search memories by natural language |
154
- | `memory_context` | Load session context and relevant memories |
155
- | `memory_search_patterns` | Find reusable solution patterns |
156
- | `memory_store_pattern` | Save a successful solution pattern |
157
- | `memory_get_project` | Get project-specific information |
158
- | `memory_store_project` | Store project configuration |
159
- | `memory_stats` | Get memory system statistics |
160
- | `memory_dashboard` | Open the web dashboard |
161
-
162
- ## Project Structure
163
-
164
- ```
165
- claude-memory-agent/
166
- ├── main.py # FastAPI server
167
- ├── config.py # Centralized configuration
168
- ├── install.py # Installation wizard
169
- ├── memory-agent # CLI tool
170
- ├── services/ # Core services
171
- │ ├── database.py # SQLite with connection pooling
172
- │ ├── embeddings.py # Ollama integration
173
- │ ├── vector_index.py # FAISS similarity search
174
- │ └── websocket.py # Real-time updates
175
- ├── skills/ # A2A skill implementations
176
- ├── hooks/ # Claude Code hooks
177
- ├── .env.example # Configuration template
178
- └── .gitignore # Excludes user-specific files
179
- ```
180
-
181
- ## Uninstall
182
-
183
- ```bash
184
- python install.py --uninstall
185
- ```
186
-
187
- This removes Claude Code integration but preserves your data.
188
-
189
- ## Troubleshooting
190
-
191
- **Agent won't start:**
192
- - Check if Ollama is running: `ollama serve`
193
- - Check if port is in use: `netstat -an | grep 8102`
194
- - Check logs: `memory-agent logs`
195
-
196
- **No embeddings:**
197
- - Pull the model: `ollama pull nomic-embed-text`
198
- - Check Ollama host in `.env`
199
-
200
- **Hooks not working:**
201
- - Restart Claude Code after installation
202
- - Check `~/.claude/hooks.json` configuration
203
-
204
- ## License
205
-
206
- MIT
1
+ # Claude Memory Agent
2
+
3
+ A persistent semantic memory system for Claude Code sessions. Stores memories, tracks decisions, and provides anti-hallucination grounding context.
4
+
5
+ ## Features
6
+
7
+ - **Semantic Memory Storage** - Store and retrieve memories using natural language
8
+ - **Session Timeline** - Track decisions, actions, and observations
9
+ - **Anti-Hallucination** - Grounding context injection to prevent contradictions
10
+ - **Pattern Learning** - Store and reuse successful solution patterns
11
+ - **Dashboard** - Web UI for browsing and managing memories
12
+ - **Claude Code Integration** - Hooks for automatic session tracking
13
+
14
+ ## Quick Start
15
+
16
+ ### 1. Prerequisites (Install These First!)
17
+
18
+ | Requirement | Download | Why Needed |
19
+ |-------------|----------|------------|
20
+ | **Python 3.9+** | https://python.org | Runs the agent |
21
+ | **Ollama** | https://ollama.ai/download | Provides embeddings |
22
+ | **Node.js 16+** | https://nodejs.org | For npm install |
23
+
24
+ **After installing Ollama, run these commands:**
25
+
26
+ ```bash
27
+ # Download the embedding model (required!)
28
+ ollama pull nomic-embed-text
29
+
30
+ # Start Ollama (runs in background)
31
+ ollama serve
32
+ ```
33
+
34
+ ### 2. Installation
35
+
36
+ #### Option A: Install via npm (Recommended)
37
+
38
+ ```bash
39
+ # Install globally
40
+ npm install -g claude-memory-agent
41
+
42
+ # Run the setup wizard
43
+ claude-memory-agent install
44
+
45
+ # Start the agent
46
+ claude-memory-agent start
47
+ ```
48
+
49
+ #### Option B: Install via npx (No global install)
50
+
51
+ ```bash
52
+ # Run directly without installing
53
+ npx claude-memory-agent install
54
+ npx claude-memory-agent start
55
+ ```
56
+
57
+ #### Option C: Clone from GitHub
58
+
59
+ ```bash
60
+ # Clone the repository
61
+ git clone https://github.com/yourusername/claude-memory-agent.git
62
+ cd claude-memory-agent
63
+
64
+ # Run the installation wizard
65
+ python install.py
66
+ ```
67
+
68
+ The installer will:
69
+ - Install Python dependencies
70
+ - Create `.env` configuration file
71
+ - Configure Claude Code MCP settings
72
+ - Set up session tracking hooks
73
+ - Create platform-specific startup scripts
74
+
75
+ ### 3. Start the Agent
76
+
77
+ **Windows:**
78
+ ```bash
79
+ # Option 1: Double-click start-memory-agent.vbs
80
+ # Option 2: Use CLI
81
+ memory-agent start
82
+ ```
83
+
84
+ **Mac/Linux:**
85
+ ```bash
86
+ ./start-memory-agent.sh
87
+ # or
88
+ python memory-agent start
89
+ ```
90
+
91
+ ### 4. Open Dashboard
92
+
93
+ ```bash
94
+ memory-agent dashboard
95
+ # or open http://localhost:8102/dashboard
96
+ ```
97
+
98
+ ## CLI Commands
99
+
100
+ ### If installed via npm:
101
+
102
+ ```bash
103
+ claude-memory-agent install # Run setup wizard
104
+ claude-memory-agent start # Start agent in background
105
+ claude-memory-agent stop # Stop running agent
106
+ claude-memory-agent status # Check if agent is running
107
+ claude-memory-agent dashboard # Open web dashboard
108
+ claude-memory-agent logs # View recent log output
109
+ ```
110
+
111
+ ### If cloned from GitHub:
112
+
113
+ ```bash
114
+ python memory-agent start # Start agent in background
115
+ python memory-agent stop # Stop running agent
116
+ python memory-agent status # Check if agent is running
117
+ python memory-agent dashboard # Open web dashboard
118
+ python memory-agent logs # View recent log output
119
+ python memory-agent install # Re-run installation wizard
120
+ ```
121
+
122
+ ## Configuration
123
+
124
+ Configuration is stored in `.env` (created during installation):
125
+
126
+ ```bash
127
+ # Server
128
+ PORT=8102
129
+ HOST=0.0.0.0
130
+ MEMORY_AGENT_URL=http://localhost:8102
131
+
132
+ # Ollama / Embeddings
133
+ OLLAMA_HOST=http://localhost:11434
134
+ EMBEDDING_MODEL=nomic-embed-text
135
+
136
+ # Database
137
+ DATABASE_PATH=./memories.db
138
+ USE_VECTOR_INDEX=true
139
+
140
+ # Logging
141
+ LOG_LEVEL=INFO
142
+ ```
143
+
144
+ See `.env.example` for all available options.
145
+
146
+ ## MCP Tools
147
+
148
+ The agent provides these tools to Claude Code:
149
+
150
+ | Tool | Description |
151
+ |------|-------------|
152
+ | `memory_store` | Store a memory with semantic embedding |
153
+ | `memory_search` | Search memories by natural language |
154
+ | `memory_context` | Load session context and relevant memories |
155
+ | `memory_search_patterns` | Find reusable solution patterns |
156
+ | `memory_store_pattern` | Save a successful solution pattern |
157
+ | `memory_get_project` | Get project-specific information |
158
+ | `memory_store_project` | Store project configuration |
159
+ | `memory_stats` | Get memory system statistics |
160
+ | `memory_dashboard` | Open the web dashboard |
161
+
162
+ ## Project Structure
163
+
164
+ ```
165
+ claude-memory-agent/
166
+ ├── main.py # FastAPI server
167
+ ├── config.py # Centralized configuration
168
+ ├── install.py # Installation wizard
169
+ ├── memory-agent # CLI tool
170
+ ├── services/ # Core services
171
+ │ ├── database.py # SQLite with connection pooling
172
+ │ ├── embeddings.py # Ollama integration
173
+ │ ├── vector_index.py # FAISS similarity search
174
+ │ └── websocket.py # Real-time updates
175
+ ├── skills/ # A2A skill implementations
176
+ ├── hooks/ # Claude Code hooks
177
+ ├── .env.example # Configuration template
178
+ └── .gitignore # Excludes user-specific files
179
+ ```
180
+
181
+ ## Uninstall
182
+
183
+ ```bash
184
+ python install.py --uninstall
185
+ ```
186
+
187
+ This removes Claude Code integration but preserves your data.
188
+
189
+ ## Troubleshooting
190
+
191
+ **Agent won't start:**
192
+ - Check if Ollama is running: `ollama serve`
193
+ - Check if port is in use: `netstat -an | grep 8102`
194
+ - Check logs: `memory-agent logs`
195
+
196
+ **No embeddings:**
197
+ - Pull the model: `ollama pull nomic-embed-text`
198
+ - Check Ollama host in `.env`
199
+
200
+ **Hooks not working:**
201
+ - Restart Claude Code after installation
202
+ - Check `~/.claude/hooks.json` configuration
203
+
204
+ ## License
205
+
206
+ MIT
package/agent_card.py CHANGED
@@ -248,6 +248,69 @@ AGENT_CARD = {
248
248
  "outputModes": ["text"]
249
249
  },
250
250
  # ============================================================
251
+ # SELF-CORRECTING CONFIDENCE SKILLS
252
+ # ============================================================
253
+ {
254
+ "id": "memory_worked",
255
+ "name": "Report Memory Worked",
256
+ "description": "Report that a memory's solution worked. Increases confidence by 0.15 and resets failure count. Use this when a retrieved solution successfully solved the problem.",
257
+ "tags": ["confidence", "feedback", "learning"],
258
+ "examples": [
259
+ "That solution from memory 42 worked perfectly",
260
+ "Report success for the HVP import fix"
261
+ ],
262
+ "inputModes": ["text"],
263
+ "outputModes": ["text"]
264
+ },
265
+ {
266
+ "id": "memory_failed",
267
+ "name": "Report Memory Failed",
268
+ "description": "Report that a memory's solution failed. Decreases confidence by 0.2. After 3 consecutive failures, memory is marked as unreliable and excluded from search.",
269
+ "tags": ["confidence", "feedback", "learning"],
270
+ "examples": [
271
+ "That solution from memory 42 didn't work",
272
+ "Report failure for the caching fix"
273
+ ],
274
+ "inputModes": ["text"],
275
+ "outputModes": ["text"]
276
+ },
277
+ {
278
+ "id": "get_reliability_stats",
279
+ "name": "Get Reliability Stats",
280
+ "description": "Get detailed reliability statistics for a memory including confidence, times worked/failed, success rate, and outcome history.",
281
+ "tags": ["confidence", "stats", "reliability"],
282
+ "examples": [
283
+ "What's the reliability of memory 42?",
284
+ "Show confidence stats for this solution"
285
+ ],
286
+ "inputModes": ["text"],
287
+ "outputModes": ["text"]
288
+ },
289
+ {
290
+ "id": "get_unreliable_memories",
291
+ "name": "Get Unreliable Memories",
292
+ "description": "Get all memories marked as unreliable (failure_count >= 3). These are excluded from search by default.",
293
+ "tags": ["confidence", "list", "unreliable"],
294
+ "examples": [
295
+ "Show unreliable memories",
296
+ "List failed solutions"
297
+ ],
298
+ "inputModes": ["text"],
299
+ "outputModes": ["text"]
300
+ },
301
+ {
302
+ "id": "reset_memory_reliability",
303
+ "name": "Reset Memory Reliability",
304
+ "description": "Reset a memory's reliability stats (admin function). Useful when a memory has been fixed or updated and should be given a fresh chance.",
305
+ "tags": ["confidence", "admin", "reset"],
306
+ "examples": [
307
+ "Give memory 42 a fresh start",
308
+ "Reset reliability for the fixed solution"
309
+ ],
310
+ "inputModes": ["text"],
311
+ "outputModes": ["text"]
312
+ },
313
+ # ============================================================
251
314
  # CLAUDE.MD MANAGEMENT SKILLS
252
315
  # ============================================================
253
316
  {
@@ -507,6 +570,129 @@ AGENT_CARD = {
507
570
  ],
508
571
  "inputModes": ["text"],
509
572
  "outputModes": ["text"]
573
+ },
574
+ # ============================================================
575
+ # CURATOR AGENT SKILLS (Graph Exploration & Maintenance)
576
+ # ============================================================
577
+ {
578
+ "id": "curator_explore",
579
+ "name": "Curator: Explore Graph",
580
+ "description": "Explore the memory graph from a starting node using BFS or DFS traversal. Returns connected nodes, edges, clusters, and insights about the subgraph.",
581
+ "tags": ["curator", "graph", "exploration"],
582
+ "examples": [
583
+ "Explore the graph from memory 42",
584
+ "Show connected memories 3 levels deep"
585
+ ],
586
+ "inputModes": ["text"],
587
+ "outputModes": ["text"]
588
+ },
589
+ {
590
+ "id": "curator_find_duplicates",
591
+ "name": "Curator: Find Duplicates",
592
+ "description": "Find semantically similar (duplicate) memories using embedding similarity. Returns duplicate clusters with merge recommendations.",
593
+ "tags": ["curator", "duplicates", "cleanup"],
594
+ "examples": [
595
+ "Find duplicate memories",
596
+ "Show potential duplicates above 0.9 similarity"
597
+ ],
598
+ "inputModes": ["text"],
599
+ "outputModes": ["text"]
600
+ },
601
+ {
602
+ "id": "curator_suggest_links",
603
+ "name": "Curator: Suggest Links",
604
+ "description": "Suggest missing relationships between memories based on semantic similarity. Returns potential links with confidence scores and relationship types.",
605
+ "tags": ["curator", "links", "relationships"],
606
+ "examples": [
607
+ "Suggest links for memory 42",
608
+ "Find potential relationships in this project"
609
+ ],
610
+ "inputModes": ["text"],
611
+ "outputModes": ["text"]
612
+ },
613
+ {
614
+ "id": "curator_merge",
615
+ "name": "Curator: Merge Memories",
616
+ "description": "Merge duplicate memories into one. Transfers all relationships to the kept memory and archives the removed ones.",
617
+ "tags": ["curator", "merge", "cleanup"],
618
+ "examples": [
619
+ "Merge memory 43 into 42",
620
+ "Combine duplicate memories"
621
+ ],
622
+ "inputModes": ["text"],
623
+ "outputModes": ["text"]
624
+ },
625
+ {
626
+ "id": "curator_get_summary",
627
+ "name": "Curator: Get Context Summary",
628
+ "description": "Generate a curated context summary for a query. Returns relevant memories organized by type with graph context and pending reviews.",
629
+ "tags": ["curator", "context", "summary"],
630
+ "examples": [
631
+ "Get curated context about authentication",
632
+ "Summarize what we know about the API"
633
+ ],
634
+ "inputModes": ["text"],
635
+ "outputModes": ["text"]
636
+ },
637
+ {
638
+ "id": "curator_run_maintenance",
639
+ "name": "Curator: Run Maintenance",
640
+ "description": "Run curator maintenance tasks: dedup (find duplicates), orphans (find unconnected), links (suggest relationships), decay (reduce unused memory confidence), quality (score all memories).",
641
+ "tags": ["curator", "maintenance", "cleanup"],
642
+ "examples": [
643
+ "Run curator maintenance",
644
+ "Run dedup and orphan detection"
645
+ ],
646
+ "inputModes": ["text"],
647
+ "outputModes": ["text"]
648
+ },
649
+ {
650
+ "id": "curator_get_report",
651
+ "name": "Curator: Get Report",
652
+ "description": "Get the latest curator maintenance report with findings, actions taken, and recommendations.",
653
+ "tags": ["curator", "report", "status"],
654
+ "examples": [
655
+ "Show latest curator report",
656
+ "What did the curator find?"
657
+ ],
658
+ "inputModes": ["text"],
659
+ "outputModes": ["text"]
660
+ },
661
+ {
662
+ "id": "curator_get_status",
663
+ "name": "Curator: Get Status",
664
+ "description": "Get current curator agent status including total memories, relationships, orphan count, and connection ratio.",
665
+ "tags": ["curator", "status", "stats"],
666
+ "examples": [
667
+ "Show curator status",
668
+ "How is the memory graph doing?"
669
+ ],
670
+ "inputModes": ["text"],
671
+ "outputModes": ["text"]
672
+ },
673
+ {
674
+ "id": "curator_score_quality",
675
+ "name": "Curator: Score Quality",
676
+ "description": "Calculate quality scores for memories based on importance, confidence, usage, decay, and connections. Identifies high-quality and needs-attention memories.",
677
+ "tags": ["curator", "quality", "scoring"],
678
+ "examples": [
679
+ "Score memory quality for this project",
680
+ "Which memories need attention?"
681
+ ],
682
+ "inputModes": ["text"],
683
+ "outputModes": ["text"]
684
+ },
685
+ {
686
+ "id": "curator_find_orphans",
687
+ "name": "Curator: Find Orphans",
688
+ "description": "Find memories with no relationships (orphans). These may need linking or archiving.",
689
+ "tags": ["curator", "orphans", "cleanup"],
690
+ "examples": [
691
+ "Find orphan memories",
692
+ "Show unconnected memories"
693
+ ],
694
+ "inputModes": ["text"],
695
+ "outputModes": ["text"]
510
696
  }
511
697
  ]
512
698
  }