claude_memory 0.7.0 → 0.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bfbba4c01acb3ad07b9114c6781ee7b6dbb197007ff61c72d7fa8b2ec164643e
4
- data.tar.gz: 41df94bae4dc18bd00321ebca1fc80145faa6b180bb3ec00ff3d72a8cf091041
3
+ metadata.gz: 00a7e67707543e2a5266200eab3a276a5b70d25a41ebbc8a5eab8767c44952a8
4
+ data.tar.gz: 261f86e807d5638739a7462872ae9f5472451afd7aea5496c1cf785b54a76dc6
5
5
  SHA512:
6
- metadata.gz: f9e8278553ef1ba3c6d490304c9118c519612d5c6cd61230e94dc0dccca40ef653118e7c364e35ba2e58b2fb66d6b7fea39455f12723df6ddf8a8a9d55bc4d71
7
- data.tar.gz: db870500e372150fbb6133ce43396aa57c2338e9aa392939219c4e2435d8bcaaac0724f858f387c97c3c9187a7b1409268b7246d91ad6018324935089daa149e
6
+ metadata.gz: 79ffe3d19420ae16dd26e2083a45c3725be43fd955bf707e3a1e157e04d790821cd5d199b8c67ea713c354c82314a931af1883d260a430119f2eb72213d8cc16
7
+ data.tar.gz: 864fffbf37c36d63a3a72e19f56ce7f288c26b7d6b546e55338ea0fb61fc963fb99704be28124e33fbb49d5098c3997409ecdac13735fd9cd52253b545346f4b
Binary file
Binary file
Binary file
@@ -46,7 +46,9 @@
46
46
  "Bash(claude-memory recall:*)",
47
47
  "Bash(claude-memory stats:*)",
48
48
  "Bash(claude-memory search:*)",
49
- "Bash(bundle exec:*)"
49
+ "Bash(bundle exec:*)",
50
+ "Skill(improve)",
51
+ "Skill(improve:*)"
50
52
  ]
51
53
  },
52
54
  "enableAllProjectMcpServers": true
@@ -7,7 +7,7 @@
7
7
  "plugins": [
8
8
  {
9
9
  "name": "claude-memory",
10
- "version": "0.7.0",
10
+ "version": "0.7.1",
11
11
  "source": "./",
12
12
  "description": "Long-term self-managed memory for Claude Code with fact extraction, truth maintenance, and provenance tracking",
13
13
  "repository": "https://github.com/codenamev/claude_memory"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-memory",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Long-term self-managed memory for Claude Code with fact extraction, truth maintenance, and provenance tracking",
5
5
  "author": {
6
6
  "name": "Valentino Stoll",
@@ -16,7 +16,6 @@
16
16
  "args": []
17
17
  }
18
18
  },
19
- "hooks": "./hooks/hooks.json",
20
19
  "skills": "./skills/",
21
20
  "commands": "./commands/",
22
21
  "outputStyles": "./output-styles/"
data/CHANGELOG.md CHANGED
@@ -4,6 +4,31 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.7.1] - 2026-03-17
8
+
9
+ ### Added
10
+
11
+ **Three-Level Sweep Escalation**
12
+ - `Maintenance` class with light/standard/deep sweep levels for progressive database maintenance
13
+ - Exposed sweep escalation via `memory.sweep_now` MCP tool with configurable level
14
+ - Tool escalation workflow added to MCP QueryGuide documentation
15
+
16
+ **Embedding Deduplication**
17
+ - Content-addressed deduplication for embeddings using SHA256 hashing
18
+ - Deduplication before vector scoring in fallback path to prevent duplicate results
19
+
20
+ **MCP Enhancements**
21
+ - Structured error classification for MCP tools via `ErrorClassifier` module
22
+ - Dynamic knowledge summary in MCP server instructions via `InstructionsBuilder`
23
+
24
+ ### Fixed
25
+
26
+ - **Plugin hook loading error**: Removed explicit `hooks` reference from `plugin.json` manifest — Claude Code auto-loads `hooks/hooks.json` from the plugin root, so declaring it caused "Duplicate hooks file detected" errors on plugin install
27
+
28
+ ### Internal
29
+ - Influence study: lossless-claw v0.3.0 DAG-based lossless context management
30
+ - Marked 7 improvements as implemented (#10, #11, #14, #15, #16, #19, #20)
31
+
7
32
  ## [0.7.0] - 2026-03-12
8
33
 
9
34
  ### Added
data/CLAUDE.md CHANGED
@@ -24,13 +24,15 @@ bin/setup # Install dependencies
24
24
 
25
25
  ### Testing
26
26
  ```bash
27
- bundle exec rspec # Run all tests
27
+ bundle exec rspec # Run unit/integration tests (~76s)
28
28
  bundle exec rspec spec/claude_memory/cli_spec.rb # Run single test file
29
29
  bundle exec rspec spec/claude_memory/cli_spec.rb:42 # Run specific test by line number
30
30
  bundle exec rake spec # Alternative test command
31
31
  bundle exec rake # Run tests + Standard linter (default task)
32
32
  ```
33
33
 
34
+ **Note:** Benchmarks and evals are excluded from the default `rspec` run via `.rspec`. See the [Evals](#evals) and [Benchmarks](#benchmarks-devmembench) sections for running those separately.
35
+
34
36
  ### Linting
35
37
  ```bash
36
38
  bundle exec rake standard # Run Standard Ruby linter
data/README.md CHANGED
@@ -257,7 +257,7 @@ The benchmark dataset draws from real CLAUDE.md patterns and is designed specifi
257
257
 
258
258
  - **Language:** Ruby 3.2+
259
259
  - **Storage:** SQLite3 (no external services)
260
- - **Testing:** 1435 examples, 100% core coverage
260
+ - **Testing:** 1477 examples (1375 unit/integration + 102 benchmarks/evals), 100% core coverage
261
261
  - **Code Style:** Standard Ruby
262
262
 
263
263
  ```bash
data/docs/improvements.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Improvements to Consider
2
2
 
3
- *Updated: 2026-03-10 - Re-studied QMD (v2.0.1, up from v1.1.5). New findings: SDK-first architecture, dedicated Maintenance class, dynamic MCP instructions enhancement, embedded skill distribution, REST API endpoint. Other 5 repos unchanged since 2026-03-09.*
3
+ *Updated: 2026-03-16 - Implemented 4 features: Dynamic MCP Instructions (#11), Structured Error Classification (#16), Content-Addressed Dedup for Embeddings (#19), Dedup Before Vector Scoring (#20). Studied lossless-claw (v0.3.0). Other 6 repos unchanged since 2026-03-10.*
4
4
  *Sources:*
5
5
  - *[thedotmack/claude-mem](https://github.com/thedotmack/claude-mem) - Memory compression system (v10.5.5, studied 2026-03-09)*
6
6
  - *[obra/episodic-memory](https://github.com/obra/episodic-memory) - Semantic conversation search (v1.0.15, studied 2026-03-09)*
@@ -8,6 +8,7 @@
8
8
  - *[supermemoryai/claude-supermemory](https://github.com/supermemoryai/claude-supermemory) - Cloud-backed persistent memory (v2.0.1, studied 2026-03-09)*
9
9
  - *[tobi/qmd](https://github.com/tobi/qmd) - On-device hybrid search engine (v2.0.1, studied 2026-03-10)*
10
10
  - *[MadBomber/kbs](https://github.com/MadBomber/kbs) - Knowledge-Based System with RETE inference (v0.2.1, studied 2026-03-09 — no changes)*
11
+ - *[martian-engineering/lossless-claw](https://github.com/martian-engineering/lossless-claw) - DAG-based lossless context management (v0.3.0, studied 2026-03-16)*
11
12
 
12
13
  This document contains only unimplemented improvements. Completed items are removed.
13
14
 
@@ -69,25 +70,13 @@ Source: episodic-memory study (2026-03-09)
69
70
 
70
71
  Added `SELF_CONTEXT_MARKER` constant (`claude-memory-self`) to ClaudeMemory module. Added to ingester EXCLUSION_TAGS. Transcripts containing `<claude-memory-self>` are skipped entirely, preventing meta-conversation pollution.
71
72
 
72
- ### 10. Dedicated Maintenance Class
73
+ ### ~~10. Dedicated Maintenance Class~~ ✅ Implemented 2026-03-16
73
74
 
74
- Source: QMD v2.0.1 study (2026-03-10)
75
-
76
- - **Value**: Clean separation of maintenance operations from main store with return counts. QMD's `Maintenance` class wraps 6 cleanup operations (vacuum, orphaned content/vectors, LLM cache, inactive docs, clear embeddings)
77
- - **Implementation**: Extract `Sweep` module operations into a `Maintenance` class. Methods: `vacuum`, `cleanup_orphaned_vectors`, `cleanup_expired_facts`, `cleanup_superseded_facts`, `compact`. Return affected counts for reporting
78
- - **Evidence**: QMD `src/maintenance.ts:1-54` — constructor takes internal store, each method returns affected count
79
- - **Effort**: 1 day
80
- - **Recommendation**: ADOPT
75
+ Extracted `Sweep::Maintenance` class from Sweeper with 8 individual operations, each returning affected counts: `expire_proposed_facts`, `expire_disputed_facts`, `prune_orphaned_provenance`, `prune_old_content`, `backfill_vec_index`, `cleanup_vec_expired`, `checkpoint_wal`, `vacuum`. Sweeper now delegates to Maintenance internally.
81
76
 
82
- ### 11. Dynamic MCP Instructions Enhancement
83
-
84
- Source: QMD v2.0.1 study (2026-03-10)
77
+ ### ~~11. Dynamic MCP Instructions Enhancement~~ ✅ Implemented 2026-03-16
85
78
 
86
- - **Value**: QMD v2.0 builds rich MCP server instructions with collection stats, document counts, capability gaps, search examples, and retrieval workflow tips. Our MCP server has a static query guide prompt but no dynamic instructions
87
- - **Implementation**: Add `build_instructions` to MCP server that generates dynamic instructions with: fact counts (global/project), active conflict count, recent decision count, convention count, database health, and usage tips
88
- - **Evidence**: QMD `src/mcp/server.ts:92-152` — `buildInstructions()` with collections, counts, gaps, examples, tips
89
- - **Effort**: 1 day
90
- - **Recommendation**: ADOPT
79
+ Enhanced InstructionsBuilder with knowledge summary (decision/convention/entity counts by predicate pattern), vec availability detection, and dynamic usage tips that adapt based on available capabilities. Semantic search guidance included when sqlite-vec is loaded.
91
80
 
92
81
  ### 12. Embedded Skill Distribution ⭐
93
82
 
@@ -99,17 +88,29 @@ Source: QMD v2.0.1 study (2026-03-10)
99
88
  - **Effort**: 1-2 days
100
89
  - **Recommendation**: ADOPT
101
90
 
102
- ### 13. Structured Error Classification
91
+ ### 13. Depth-Aware Prompt Templates for Distiller ⭐
103
92
 
104
- Source: claude-supermemory v2.0.1 study (2026-03-09)
93
+ Source: lossless-claw v0.3.0 study (2026-03-16)
105
94
 
106
- - **Value**: Clean error handling in MCP server and hooks benign errors silent, retryable logged, fatal with clear messages
107
- - **Implementation**: Three-tier classification: benign (empty results, first use), retryable (rate limits, server errors), fatal (auth failures, schema corruption)
108
- - **Evidence**: supermemory `src/lib/error-helpers.js:1-72` — error classification with user-friendly messages
109
- - **Effort**: 1 day
95
+ - **Value**: Graduated extraction prompts based on context depthfresh conversations get detailed extraction, well-established facts get consolidation prompts. Parallels lossless-claw's leaf/d1/d2/d3+ prompt hierarchy
96
+ - **Implementation**: Create prompt templates for distiller stages: initial extraction (detailed), re-extraction (consolidation), contradiction resolution (focused). Use depth/freshness to select template
97
+ - **Evidence**: `tui/prompts/leaf.tmpl`, `tui/prompts/condensed-d1.tmpl`, `condensed-d2.tmpl`, `condensed-d3.tmpl`four distinct prompt templates with increasing abstraction
98
+ - **Effort**: 1-2 days (when building real distiller)
110
99
  - **Recommendation**: ADOPT
111
100
 
112
- ### 14. Entity Context Extraction Prompts
101
+ ### ~~14. Three-Level Escalation for Sweep/Maintenance~~ ✅ Implemented 2026-03-16
102
+
103
+ Added `run_with_escalation!` to Sweeper: normal (standard TTLs) → aggressive (halved TTLs) → fallback (force-expire oldest 10 proposed/disputed). Stats include `:escalation_level`. MCP `memory.sweep_now` gains `escalate: true` parameter. TextSummary shows escalation level in output.
104
+
105
+ ### ~~15. Tool Escalation Workflow in MCP Instructions~~ ✅ Implemented 2026-03-16
106
+
107
+ Restructured QueryGuide with 4-tier escalation hierarchy (Fast Lookup → Broad Search → Targeted Deep Dive → Relationship Exploration). Each tool annotated with cost estimates (tokens per call). Added "Recommended Workflow" section. InstructionsBuilder usage hint updated with escalation guidance.
108
+
109
+ ### ~~16. Structured Error Classification~~ ✅ Implemented 2026-03-16
110
+
111
+ Added `MCP::ErrorClassifier` with three-tier classification: benign (empty results, first use — no alarm), retryable (DB locked, I/O errors — retry flag), fatal (disk full, corruption — recommendations). MCP tools use classified errors with severity, retry hints, and actionable recommendations.
112
+
113
+ ### 17. Entity Context Extraction Prompts
113
114
 
114
115
  Source: claude-supermemory v2.0.1 study (2026-03-09)
115
116
 
@@ -123,7 +124,7 @@ Source: claude-supermemory v2.0.1 study (2026-03-09)
123
124
 
124
125
  ## Medium Priority
125
126
 
126
- ### 15. Shell Completion for CLI
127
+ ### 18. Shell Completion for CLI
127
128
 
128
129
  Source: grepai study (2026-03-09)
129
130
 
@@ -133,27 +134,15 @@ Source: grepai study (2026-03-09)
133
134
  - **Effort**: 1-2 days
134
135
  - **Recommendation**: CONSIDER
135
136
 
136
- ### 16. Content-Addressed Deduplication for Embeddings
137
+ ### ~~19. Content-Addressed Deduplication for Embeddings~~ ✅ Implemented 2026-03-16
137
138
 
138
- Source: grepai study (2026-03-09)
139
+ IndexCommand builds text→embedding cache from already-embedded facts before indexing. Identical fact texts reuse cached vectors, skipping generation. Cache hits tracked and reported (e.g., "Cache hits: 3/10 (30% dedup)").
139
140
 
140
- - **Value**: Skip re-embedding unchanged content using existing `text_hash` in `content_items`
141
- - **Implementation**: Check `text_hash` before computing embeddings; reuse cached vectors for identical content
142
- - **Evidence**: grepai `store/store.go:105-109` — EmbeddingCache interface
143
- - **Effort**: 1 day
144
- - **Recommendation**: CONSIDER — quick win, infrastructure already exists
141
+ ### ~~20. Deduplication Before Vector Scoring~~ Implemented 2026-03-16
145
142
 
146
- ### 17. Deduplication Before Vector Scoring
147
-
148
- Source: QMD v1.1.5 study (2026-03-09)
149
-
150
- - **Value**: Free performance win — deduplicate fact texts before computing cosine similarity, map scores back
151
- - **Implementation**: In `VectorIndex#search`, group facts by text, score unique texts only, fan out results
152
- - **Evidence**: QMD `llm.ts:1098-1109` — reranker deduplication (identical chunks scored once, fanned out)
153
- - **Effort**: 1 day
154
- - **Recommendation**: CONSIDER
143
+ In Ruby fallback path (`search_by_vector_fallback`), facts are grouped by `embedding_json` before cosine similarity computation. Unique embeddings scored once, results fanned out to all matching fact_ids. Native sqlite-vec path unaffected (handles own dedup).
155
144
 
156
- ### 18. Incremental Indexing with File Watching
145
+ ### 21. Incremental Indexing with File Watching
157
146
 
158
147
  Source: grepai study (reinforced 2026-03-02)
159
148
 
@@ -163,7 +152,7 @@ Source: grepai study (reinforced 2026-03-02)
163
152
  - **Effort**: 2-3 days
164
153
  - **Trade-off**: Background process ~10MB memory overhead
165
154
 
166
- ### 19. Document Chunking for Long Transcripts
155
+ ### 22. Document Chunking for Long Transcripts
167
156
 
168
157
  Source: QMD study (updated 2026-03-02)
169
158
 
@@ -181,7 +170,7 @@ Source: QMD study (updated 2026-03-02)
181
170
 
182
171
  ## Low Priority / Defer
183
172
 
184
- ### 20. REST API Endpoint
173
+ ### 23. REST API Endpoint
185
174
 
186
175
  Source: QMD v2.0.1 study (2026-03-10)
187
176
 
@@ -192,7 +181,7 @@ Source: QMD v2.0.1 study (2026-03-10)
192
181
  - **Trade-off**: Requires WEBrick or similar Ruby HTTP server dependency
193
182
  - **Recommendation**: CONSIDER — Useful for CI/scripting, but MCP covers primary use case
194
183
 
195
- ### 21. Signal-Based Ingestion Filtering
184
+ ### 24. Signal-Based Ingestion Filtering
196
185
 
197
186
  Source: claude-supermemory study (2026-03-02)
198
187
 
@@ -203,7 +192,7 @@ Source: claude-supermemory study (2026-03-02)
203
192
  - **Trade-off**: May miss important but subtly-expressed facts. Our distiller already extracts structured facts, which inherently filters noise.
204
193
  - **Recommendation**: DEFER — Distiller handles this naturally
205
194
 
206
- ### 22. HTTP MCP Transport
195
+ ### 25. HTTP MCP Transport
207
196
 
208
197
  Source: QMD study (2026-03-02)
209
198
 
@@ -261,6 +250,13 @@ Added `claude-memory export` command. Dumps facts with entities and provenance t
261
250
  - **SDK-First Architecture Refactor** — QMD v2.0 refactored to SDK-first with `QMDStore` interface consumed by CLI and MCP. Our gem + MCP architecture is already well-structured; major refactor for marginal gain
262
251
  - **Write-Through YAML Config** — QMD v2.0 writes collection mutations to both SQLite and YAML. We don't use YAML config; dual-database is our config model
263
252
  - **Multi-Session HTTP Transport** — QMD v2.0 supports concurrent MCP sessions via session map. Our MCP server is lightweight enough for stdio; no model loading latency to amortize
253
+ - **DAG-Based Conversation Compaction** — lossless-claw compresses conversations into a summary hierarchy; we distill structured facts. Fundamentally different paradigms that are complementary, not competing
254
+ - **LLM-Heavy Compaction Pipeline** — Every compaction in lossless-claw requires LLM summarization calls. Our no-LLM retrieval path is a significant cost and latency advantage
255
+ - **Go TUI for Debugging** — Adding a second language for an interactive debugging tool is over-engineering. CLI commands are sufficient (lossless-claw)
256
+ - **Per-Conversation Scoping** — lossless-claw scopes knowledge per-conversation only. Our dual-database (global/project) is more useful for knowledge spanning conversations
257
+ - **Sub-Agent Delegation for Deep Recall** — lossless-claw spawns sub-agents for DAG traversal. Adds latency and complexity; our direct MCP tool responses are simpler and faster
258
+ - **Message Parts Polymorphism** — lossless-claw's 10-column message_parts for tool calls, reasoning, patches. We don't store raw messages, so irrelevant
259
+ - **OpenClaw ContextEngine Interface** — Tight framework coupling. Our MCP + hooks approach is more portable
264
260
 
265
261
  ---
266
262
 
@@ -288,6 +284,7 @@ Added `claude-memory export` command. Dumps facts with entities and provenance t
288
284
  - [claude-supermemory GitHub](https://github.com/supermemoryai/claude-supermemory) - Cloud-backed memory (v2.0.1)
289
285
  - [QMD GitHub](https://github.com/tobi/qmd) - On-device hybrid search engine (v2.0.1)
290
286
  - [KBS GitHub](https://github.com/MadBomber/kbs) - Knowledge-Based System with RETE inference (v0.2.1)
287
+ - [lossless-claw GitHub](https://github.com/martian-engineering/lossless-claw) - DAG-based lossless context management (v0.3.0)
291
288
 
292
289
  Influence documents:
293
290
  - [docs/influence/qmd.md](influence/qmd.md) - Updated 2026-03-10
@@ -296,7 +293,8 @@ Influence documents:
296
293
  - [docs/influence/grepai.md](influence/grepai.md) - Updated 2026-03-09
297
294
  - [docs/influence/claude-supermemory.md](influence/claude-supermemory.md) - Updated 2026-03-09
298
295
  - [docs/influence/kbs.md](influence/kbs.md) - Updated 2026-03-09 (no changes)
296
+ - [docs/influence/lossless-claw.md](influence/lossless-claw.md) - Updated 2026-03-16
299
297
 
300
298
  ---
301
299
 
302
- *Last updated: 2026-03-10 - Re-studied QMD (v2.0.1). Added 3 new high-priority items: Dedicated Maintenance Class (#10), Dynamic MCP Instructions Enhancement (#11), Embedded Skill Distribution (#12). Added 1 medium-priority item: REST API Endpoint (#20). Previously: Implemented 4 features: MCP Tool Annotations (#4), MCP Stdout Protection (#6), Worktree-Aware Git Root (#7), Self-Excluding Conversations (#9). Re-studied all 6 influencer repos. Previous: Claude Code Plugin Distribution Format, sqlite-vec, Database Compact, Fact Export, Background Processing, MCP Discovery Tools.*
300
+ *Last updated: 2026-03-16 - Implemented 7 features total: Dynamic MCP Instructions (#11), Structured Error Classification (#16), Content-Addressed Dedup (#19), Dedup Before Vector Scoring (#20), Dedicated Maintenance Class (#10), Three-Level Escalation (#14), Tool Escalation Workflow (#15). Studied lossless-claw (v0.3.0), added Depth-Aware Prompt Templates (#13). Previously: Re-studied QMD (v2.0.1). Implemented: MCP Tool Annotations, MCP Stdout Protection, Worktree-Aware Git Root, Self-Excluding Conversations, Plugin Distribution, sqlite-vec, Database Compact, Fact Export, Background Processing, MCP Discovery Tools.*