claude-memory-hub 0.5.2 → 0.8.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.
- package/CHANGELOG.md +211 -4
- package/README.md +76 -24
- package/dist/cli.js +640 -27
- package/dist/hooks/post-compact.js +1047 -41
- package/dist/hooks/post-tool-use.js +1050 -41
- package/dist/hooks/pre-compact.js +1047 -41
- package/dist/hooks/session-end.js +1151 -42
- package/dist/hooks/user-prompt-submit.js +903 -40
- package/dist/index.js +1375 -585
- package/package.json +14 -7
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,212 @@ Format follows [Keep a Changelog](https://keepachangelog.com/).
|
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
+
## [0.8.0] - 2026-04-02
|
|
9
|
+
|
|
10
|
+
Major release: test infrastructure, architectural fixes, hook performance, data portability.
|
|
11
|
+
|
|
12
|
+
### Phase 1 — Unit Tests (0% → 91 tests)
|
|
13
|
+
|
|
14
|
+
- **bun:test infrastructure** — 10 test files, 91 tests, 161 assertions, 225ms runtime
|
|
15
|
+
- **In-memory SQLite** — all tests use `:memory:` databases for isolation, zero filesystem side effects
|
|
16
|
+
- **Test coverage modules:** schema, session-store, long-term-store, entity-extractor, observation-extractor, vector-search, working-memory, injection-validator, compact-interceptor, health-monitor
|
|
17
|
+
- **Test helpers** — `createTestDb()`, `seedSession()`, `seedEntity()`, `seedSummary()`, `mockPostToolUseHook()` in `tests/setup.ts`
|
|
18
|
+
|
|
19
|
+
### Phase 4 — L1 WorkingMemory Redesign
|
|
20
|
+
|
|
21
|
+
- **Read-through cache** — `WorkingMemory` rewritten from dead in-process Map to read-through cache over `SessionStore`. First call loads entities from SQLite, subsequent calls serve from cache (<1ms)
|
|
22
|
+
- **Previous behavior:** `workingMemory.summarize()` always returned `""` because hook scripts (short-lived) wrote to L2 directly, MCP server never populated L1
|
|
23
|
+
- **New behavior:** MCP server's `memory_session_notes` tool returns real data via L1 cache
|
|
24
|
+
- **API changes:** removed `add()` method (no callers), added `refresh()` and `invalidate()`. Constructor accepts `SessionStore` for DI
|
|
25
|
+
- **Cache TTL:** 5 minutes, invalidated on session end
|
|
26
|
+
|
|
27
|
+
### Phase 5 — Hook Performance (Batch Queue)
|
|
28
|
+
|
|
29
|
+
- **Batch queue** — `src/capture/batch-queue.ts` implements write-through batching for PostToolUse. Events appended to `~/.claude-memory-hub/batch/queue.jsonl` (~3ms) instead of direct DB write (~75ms)
|
|
30
|
+
- **Opportunistic flush** — each hook invocation tries to flush batch to DB if lock available
|
|
31
|
+
- **File-based lock** — PID-based with 30s staleness check, prevents dead lock accumulation
|
|
32
|
+
- **Fallback** — if batch dir unavailable or enqueue fails, falls back to direct write
|
|
33
|
+
- **Env var:** `CLAUDE_MEMORY_HUB_BATCH=auto|enabled|disabled`
|
|
34
|
+
|
|
35
|
+
### Phase 6 — Export/Import CLI
|
|
36
|
+
|
|
37
|
+
- **`bunx claude-memory-hub export`** — JSONL streaming export to stdout. Options: `--since TIMESTAMP`, `--table TABLE`
|
|
38
|
+
- **`bunx claude-memory-hub import`** — JSONL import from stdin with UPSERT semantics. Option: `--dry-run`
|
|
39
|
+
- **`bunx claude-memory-hub cleanup`** — remove old data beyond retention period. Option: `--days N` (default 90)
|
|
40
|
+
- **BLOB handling** — embedding vectors encoded as `{"$base64": true, "encoded": "..."}` for JSON portability
|
|
41
|
+
- **Schema version header** — first JSONL line declares `__schema_version` for compatibility validation
|
|
42
|
+
- **Idempotent import** — sessions (ON CONFLICT id), summaries (ON CONFLICT session_id), embeddings (ON CONFLICT doc_type+doc_id)
|
|
43
|
+
|
|
44
|
+
### Bug Fixes
|
|
45
|
+
|
|
46
|
+
- **Observation regex trailing `\b`** — patterns ending with `:` (decision:, TODO:, performance:) had trailing `\b` that failed to match because `:` followed by space = no word boundary. Removed trailing `\b` from colon-ending patterns
|
|
47
|
+
|
|
48
|
+
### New/Modified Files
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
NEW:
|
|
52
|
+
tests/setup.ts — test infrastructure
|
|
53
|
+
tests/unit/*.test.ts — 10 test files (91 tests)
|
|
54
|
+
src/capture/batch-queue.ts — write-through batch queue
|
|
55
|
+
src/export/exporter.ts — JSONL streaming export
|
|
56
|
+
src/export/importer.ts — JSONL streaming import
|
|
57
|
+
|
|
58
|
+
MODIFIED:
|
|
59
|
+
src/memory/working-memory.ts — read-through cache over SessionStore
|
|
60
|
+
src/hooks-entry/post-tool-use.ts — batch queue fast path
|
|
61
|
+
src/capture/observation-extractor.ts — regex trailing \b fix
|
|
62
|
+
src/cli/main.ts — export, import, cleanup commands
|
|
63
|
+
package.json — test scripts, version 0.8.0
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### New CLI Commands
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
bunx claude-memory-hub export [--since T] [--table T] # JSONL export to stdout
|
|
70
|
+
bunx claude-memory-hub import [--dry-run] # JSONL import from stdin
|
|
71
|
+
bunx claude-memory-hub cleanup [--days N] # Remove old data
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### New Environment Variables
|
|
75
|
+
|
|
76
|
+
| Variable | Default | Description |
|
|
77
|
+
|----------|---------|-------------|
|
|
78
|
+
| `CLAUDE_MEMORY_HUB_BATCH` | `auto` | Batch mode: auto, enabled, disabled |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## [0.7.0] - 2026-04-01
|
|
83
|
+
|
|
84
|
+
Hardening release: honest resource analysis, search scaling, improved observation capture, DB auto-cleanup, summarizer reliability.
|
|
85
|
+
|
|
86
|
+
### Correctness & Honesty
|
|
87
|
+
|
|
88
|
+
- **Smart Resource Loader rewritten** — v0.4-v0.6 claimed "~24K tokens saved per session" but Claude Code has NO external API to filter resource loading (confirmed by reading Claude Code source). `formatContextAdvice()` now provides **honest, actionable advice**: shows frequently-used resources and overhead awareness instead of misleading "deferred for token efficiency" language
|
|
89
|
+
- **Project CLAUDE.md name validation** — `scanClaudeMd()` now validates relative paths against `SAFE_COMMAND_NAME_RE` before registering, preventing invalid resource names in registry
|
|
90
|
+
|
|
91
|
+
### Semantic Search Scaling
|
|
92
|
+
|
|
93
|
+
- **Pre-filter by doc_type** — `semanticSearch()` accepts `docType` option to filter at SQL level, reducing memory usage for targeted queries
|
|
94
|
+
- **Max candidates cap** — new `maxCandidates` option (default 2000) with `ORDER BY created_at DESC` prevents OOM on large datasets (>5000 embeddings)
|
|
95
|
+
- **Configurable threshold** — similarity threshold now configurable via `SemanticSearchOptions` (default 0.2), was hard-coded
|
|
96
|
+
- **Batch embedding reindex** — `reindexAllEmbeddings()` uses `embedBatch()` with chunk size 16 instead of processing 1-by-1. Tries batch API first, falls back to sequential
|
|
97
|
+
|
|
98
|
+
### Embedding Model
|
|
99
|
+
|
|
100
|
+
- **True batch processing** — `embedBatch()` processes in configurable chunks (default 8), attempts native `@huggingface/transformers` batch call first, falls back to individual if unsupported
|
|
101
|
+
|
|
102
|
+
### Observation Extraction
|
|
103
|
+
|
|
104
|
+
- **8 new patterns** — expanded from 6 to 14 heuristics:
|
|
105
|
+
- Tool output: DEPRECATED, SECURITY, VULNERABILITY (importance 4), "discovered", "root cause", "switched to" (3), HACK, WORKAROUND, "bottleneck", "OOM" (2)
|
|
106
|
+
- User prompts: "MUST" (4), "don't", "never", "avoid" (3), "prefer", "always use", "convention is" (2)
|
|
107
|
+
- **Increased value capture** — max observation length 300 → 500 characters for richer context
|
|
108
|
+
|
|
109
|
+
### Health Monitoring & Auto-Cleanup
|
|
110
|
+
|
|
111
|
+
- **Embeddings size check** — new `checkEmbeddingsSize()` health check, warns when >5000 embeddings
|
|
112
|
+
- **Disk check includes WAL** — total disk size now sums `memory.db` + `-wal` + `-shm` files. Tiered thresholds: 200MB warn, 500MB error
|
|
113
|
+
- **`cleanupOldData()`** — transaction-safe cleanup with configurable retention (default 90 days). Deletes: sessions, entities, notes, summaries, embeddings, resource_usage, old health checks. Runs WAL checkpoint after large deletions
|
|
114
|
+
|
|
115
|
+
### LLM Summarizer Reliability
|
|
116
|
+
|
|
117
|
+
- **Retry logic** — `tryCliSummary()` now retries once (2 attempts total) with 1s pause between attempts before falling back to rule-based
|
|
118
|
+
- **CLI availability TTL** — `isClaudeCliAvailable()` cache expires after 5 minutes when `false`, allowing recovery if `claude` CLI becomes available mid-session (was cached forever)
|
|
119
|
+
|
|
120
|
+
### Modified Files
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
src/context/smart-resource-loader.ts — honest advice, no misleading claims
|
|
124
|
+
src/context/resource-registry.ts — CLAUDE.md name validation
|
|
125
|
+
src/search/semantic-search.ts — pre-filter, maxCandidates, batch reindex
|
|
126
|
+
src/search/embedding-model.ts — true batch processing with chunking
|
|
127
|
+
src/capture/observation-extractor.ts — 8 new patterns, 500-char cap
|
|
128
|
+
src/health/monitor.ts — embeddings check, WAL disk, auto-cleanup
|
|
129
|
+
src/summarizer/cli-summarizer.ts — retry logic, CLI TTL recovery
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## [0.6.0] - 2026-04-01
|
|
135
|
+
|
|
136
|
+
Major release: semantic search, resource intelligence, observation capture, CLAUDE.md tracking, LLM summarization.
|
|
137
|
+
|
|
138
|
+
### Phase 1 — ResourceRegistry + Entity Coverage
|
|
139
|
+
|
|
140
|
+
- **ResourceRegistry** — unified scanner for ALL `.claude` locations: skills (58), agents (36), commands (65), workflows (10), CLAUDE.md. Parses agent frontmatter `name:` for correct resolution (e.g., `ios-developer` → `~/.claude/agent_mobile/ios/AGENT.md`). 3-level token estimation: listing (~50-200), full (200-8000), total (all files on disk)
|
|
141
|
+
- **OverheadReport** — `memory_context_budget` MCP tool now shows: fixed token overhead breakdown, unused skill/agent detection, potential savings recommendations
|
|
142
|
+
- **InjectionValidator** — sanitizes context before `UserPromptSubmit` injection. Strips HTML comments, caps at 4500 chars, filters dead resource recommendations via `filterAliveRecommendations()`
|
|
143
|
+
- **Agent/Skill entities** — `Agent` and `Skill` tool calls now produce `entity_type="decision"` entities (importance 3/2), visible in summarization and compact scoring
|
|
144
|
+
- **Expanded resource types** — `resource_usage` table tracks 8 types: skill, agent, command, workflow, claude_md, memory, mcp_tool, hook (was 5)
|
|
145
|
+
- **Real token costs** — `SmartResourceLoader` uses ResourceRegistry for actual file-size-based estimates instead of hardcoded 500 fallback
|
|
146
|
+
|
|
147
|
+
### Phase 2 — Schema v3 + Observations + CLAUDE.md Tracking
|
|
148
|
+
|
|
149
|
+
- **Schema migration v3** — entities table rebuilt with `observation` type in CHECK constraint + new `claude_md_registry` table
|
|
150
|
+
- **Observation extractor** — heuristic-based free-form capture from tool output and user prompts. Keywords: IMPORTANT/CRITICAL (importance 4), decision:/NOTE: (3), TODO:/FIXME: (2). Max 1 observation per tool call, capped at 300 chars
|
|
151
|
+
- **CLAUDE.md tracker** — walks from `cwd` to root, finds all CLAUDE.md files, extracts `## sections` + 200-char previews, content-hash change detection (only re-parses on change), injects rule summary into context
|
|
152
|
+
- **Session summarizer** includes top 5 observations in L3 summaries
|
|
153
|
+
- **Vector search** reindexes observation entities alongside decisions and errors
|
|
154
|
+
|
|
155
|
+
### Phase 3 — LLM Summarization Pipeline
|
|
156
|
+
|
|
157
|
+
- **3-tier fallback** — Tier 1: PostCompact summary (free, already existed). Tier 2: `claude -p ... --print` subprocess with 30s timeout. Tier 3: Rule-based (always available)
|
|
158
|
+
- **Hook recursion guard** — `CLAUDE_MEMORY_HUB_SKIP_HOOKS=1` env var set on CLI subprocess, checked by all 5 hook entry scripts. Prevents infinite loop when CLI summarizer triggers hooks
|
|
159
|
+
- **Configurable** — `CLAUDE_MEMORY_HUB_LLM=auto|cli-only|rule-based` env var. `CLAUDE_MEMORY_HUB_LLM_TIMEOUT_MS` for custom timeout
|
|
160
|
+
|
|
161
|
+
### Phase 4 — Semantic Search
|
|
162
|
+
|
|
163
|
+
- **Embedding model** — `@huggingface/transformers` with `all-MiniLM-L6-v2` (384-dim, 90MB cached, 9ms warm inference). Lazy-loaded: only imports when first embedding requested. Graceful degradation if package not installed
|
|
164
|
+
- **Pure JS cosine similarity** — no native sqlite-vec binary needed. Fast enough for <1000 docs. Embeddings stored as BLOBs in new `embeddings` table (schema v4)
|
|
165
|
+
- **Hybrid search** — `searchIndex()` now merges FTS5 BM25 + TF-IDF + semantic cosine similarity. Deduplicates by id+type, keeps highest score
|
|
166
|
+
- **Auto-indexing** — session-end hook generates embedding for new summaries automatically
|
|
167
|
+
- **Opt-in** — `CLAUDE_MEMORY_HUB_EMBEDDINGS=auto|disabled` env var. `@huggingface/transformers` is `optionalDependencies` — install failure doesn't break anything
|
|
168
|
+
|
|
169
|
+
### New Environment Variables
|
|
170
|
+
|
|
171
|
+
| Variable | Default | Description |
|
|
172
|
+
|----------|---------|-------------|
|
|
173
|
+
| `CLAUDE_MEMORY_HUB_LLM` | `auto` | Summarization mode: auto, cli-only, rule-based |
|
|
174
|
+
| `CLAUDE_MEMORY_HUB_LLM_TIMEOUT_MS` | `30000` | CLI summarizer timeout in ms |
|
|
175
|
+
| `CLAUDE_MEMORY_HUB_EMBEDDINGS` | `auto` | Embedding mode: auto, disabled |
|
|
176
|
+
| `CLAUDE_MEMORY_HUB_SKIP_HOOKS` | — | Set to `1` to suppress hooks (internal use) |
|
|
177
|
+
|
|
178
|
+
### New/Modified Files
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
NEW:
|
|
182
|
+
src/context/resource-registry.ts — unified resource scanner
|
|
183
|
+
src/context/injection-validator.ts — context sanitization
|
|
184
|
+
src/capture/observation-extractor.ts — free-form observation capture
|
|
185
|
+
src/context/claude-md-tracker.ts — CLAUDE.md scanning + tracking
|
|
186
|
+
src/summarizer/cli-summarizer.ts — Tier 2 CLI summarization
|
|
187
|
+
src/search/embedding-model.ts — lazy @huggingface/transformers
|
|
188
|
+
src/search/semantic-search.ts — cosine similarity search
|
|
189
|
+
|
|
190
|
+
MODIFIED:
|
|
191
|
+
src/db/schema.ts — migrations v3 + v4
|
|
192
|
+
src/types/index.ts — EntityType += observation
|
|
193
|
+
src/capture/entity-extractor.ts — Agent/Skill + observation extraction
|
|
194
|
+
src/capture/hook-handler.ts — registry + validator + CLAUDE.md + observations
|
|
195
|
+
src/context/smart-resource-loader.ts — uses ResourceRegistry
|
|
196
|
+
src/context/resource-tracker.ts — 8 resource types
|
|
197
|
+
src/mcp/tool-handlers.ts — overhead report in context_budget
|
|
198
|
+
src/summarizer/session-summarizer.ts — 3-tier pipeline
|
|
199
|
+
src/search/search-workflow.ts — hybrid FTS5+TF-IDF+semantic
|
|
200
|
+
src/search/vector-search.ts — reindex includes observations+embeddings
|
|
201
|
+
src/db/session-store.ts — getSessionObservations()
|
|
202
|
+
src/hooks-entry/*.ts — SKIP_HOOKS recursion guard
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Dependencies
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
KEPT: @modelcontextprotocol/sdk
|
|
209
|
+
ADDED: @huggingface/transformers (optional — semantic search)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
8
214
|
## [0.5.2] - 2026-04-01
|
|
9
215
|
|
|
10
216
|
### Fixed
|
|
@@ -111,10 +317,11 @@ Every Claude Code session loads ALL skills, agents, rules, and memory files into
|
|
|
111
317
|
|
|
112
318
|
### Impact
|
|
113
319
|
```
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
320
|
+
Tracks resource usage across sessions
|
|
321
|
+
Identifies unused skills/agents with token cost estimates
|
|
322
|
+
Provides recommendations for manual cleanup
|
|
323
|
+
NOTE: Claude Code loads ALL resources regardless — this is
|
|
324
|
+
an analysis tool, not a filter. See v0.7.0 for details.
|
|
118
325
|
```
|
|
119
326
|
|
|
120
327
|
### Files
|
package/README.md
CHANGED
|
@@ -31,22 +31,28 @@ Long session: Claude auto-compacts at 200K tokens
|
|
|
31
31
|
|
|
32
32
|
Every session: ALL skills + agents + rules loaded
|
|
33
33
|
→ 23-51K tokens consumed before you type anything
|
|
34
|
-
→
|
|
34
|
+
→ No external tool can prevent this (Claude Code limitation)
|
|
35
|
+
→ But you CAN identify and remove unused resources
|
|
35
36
|
|
|
36
37
|
Search: Keyword-only, no semantic ranking
|
|
37
38
|
→ Irrelevant results, wasted tokens on full records
|
|
38
39
|
```
|
|
39
40
|
|
|
40
|
-
**Four problems.
|
|
41
|
+
**Four problems. memory-hub solves three directly and provides analysis for the fourth.**
|
|
41
42
|
|
|
42
43
|
| Problem | Claude Code built-in | claude-mem | memory-hub |
|
|
43
44
|
|---------|:-------------------:|:----------:|:----------:|
|
|
44
45
|
| Cross-session memory | -- | Yes | **Yes** |
|
|
45
46
|
| Influence what compact preserves | -- | -- | **Yes** |
|
|
46
47
|
| Save compact output | -- | -- | **Yes** |
|
|
47
|
-
| Token
|
|
48
|
-
|
|
|
48
|
+
| Token overhead analysis | -- | -- | **Yes** |
|
|
49
|
+
| Semantic search (embeddings) | -- | Chroma (external) | **Yes (offline)** |
|
|
50
|
+
| Hybrid search (FTS5 + TF-IDF + semantic) | -- | Partial | **Yes** |
|
|
49
51
|
| 3-layer progressive search | -- | Yes | **Yes** |
|
|
52
|
+
| Resource overhead analysis | -- | -- | **Yes** |
|
|
53
|
+
| CLAUDE.md rule tracking | -- | -- | **Yes** |
|
|
54
|
+
| Free-form observation capture | -- | Yes | **Yes** |
|
|
55
|
+
| LLM summarization (3-tier) | -- | Yes (API) | **Yes (free)** |
|
|
50
56
|
| Browser UI | -- | Yes | **Yes** |
|
|
51
57
|
| Health monitoring | -- | -- | **Yes** |
|
|
52
58
|
| Migrate from claude-mem | N/A | N/A | **Yes** |
|
|
@@ -107,27 +113,27 @@ Session N+1 → UserPromptSubmit hook fires
|
|
|
107
113
|
→ Claude starts with history, not from zero
|
|
108
114
|
```
|
|
109
115
|
|
|
110
|
-
### Layer 4 —
|
|
116
|
+
### Layer 4 — Resource Intelligence & Overhead Analysis
|
|
111
117
|
|
|
112
118
|
```
|
|
113
|
-
|
|
119
|
+
ResourceRegistry scans your setup:
|
|
120
|
+
58 skills, 36 agents, 65 commands, 10 workflows, CLAUDE.md chain
|
|
114
121
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
└──────────────────┘ └──────────────────┘
|
|
122
|
+
ResourceTracker records actual usage per session:
|
|
123
|
+
"skill:mobile-development used 4/5 recent sessions"
|
|
124
|
+
"agent:veo3-prompt-expert used 0/5 recent sessions"
|
|
125
|
+
|
|
126
|
+
OverheadReport identifies waste:
|
|
127
|
+
"42/58 skills never used → ~1500 listing tokens overhead"
|
|
128
|
+
"CLAUDE.md chain is 8200 tokens → consider consolidating"
|
|
129
|
+
|
|
130
|
+
UserPromptSubmit injects priority hints:
|
|
131
|
+
"Frequently-used: skill:debugging, agent:planner, agent:tester"
|
|
126
132
|
```
|
|
127
133
|
|
|
128
|
-
memory-hub
|
|
134
|
+
> **Transparency note:** Claude Code loads ALL resources into its system prompt — no external tool can prevent this. memory-hub provides **analysis and prioritization**, not filtering. To actually reduce token overhead, remove or relocate unused skills/agents based on the overhead report.
|
|
129
135
|
|
|
130
|
-
### Layer 5 — 3-Layer Progressive Search (new in v0.5)
|
|
136
|
+
### Layer 5 — 3-Layer Progressive Search + Semantic (new in v0.5/v0.6)
|
|
131
137
|
|
|
132
138
|
```
|
|
133
139
|
Traditional search: query → ALL full records → 5000+ tokens wasted
|
|
@@ -140,7 +146,35 @@ memory-hub search: query → Layer 1 (index) → ~50 tokens/result
|
|
|
140
146
|
Token savings: ~80-90% vs. full context
|
|
141
147
|
```
|
|
142
148
|
|
|
143
|
-
Hybrid ranking: FTS5 BM25
|
|
149
|
+
Hybrid ranking: FTS5 BM25 (keyword) + TF-IDF (term frequency) + **semantic cosine similarity** (384-dim embeddings, v0.6). "debugging tips" now matches "error fixing" even without shared keywords.
|
|
150
|
+
|
|
151
|
+
### Layer 6 — Resource Intelligence (new in v0.6)
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
ResourceRegistry scans ALL .claude locations:
|
|
155
|
+
~/.claude/skills/ 58 skills → listing + full + total tokens
|
|
156
|
+
~/.claude/agents/ 36 agents → frontmatter name: resolution
|
|
157
|
+
~/.claude/agent_mobile/ ios-developer → agent_mobile/ios/AGENT.md
|
|
158
|
+
~/.claude/commands/ 65 commands → relative path naming
|
|
159
|
+
~/.claude/workflows/ 10 workflows
|
|
160
|
+
~/.claude/CLAUDE.md + project CLAUDE.md chain
|
|
161
|
+
|
|
162
|
+
OverheadReport:
|
|
163
|
+
"56/64 skills unused in last 10 sessions → ~1033 listing tokens wasted"
|
|
164
|
+
"CLAUDE.md chain is 3222 tokens"
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Layer 7 — Observation Capture (new in v0.6)
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
Tool output contains "IMPORTANT: always pool DB connections"
|
|
171
|
+
→ observation entity (importance=4) saved to L2
|
|
172
|
+
→ included in session summary
|
|
173
|
+
→ searchable across sessions
|
|
174
|
+
|
|
175
|
+
User prompt contains "remember that we use TypeScript strict"
|
|
176
|
+
→ observation entity (importance=3) saved to L2
|
|
177
|
+
```
|
|
144
178
|
|
|
145
179
|
---
|
|
146
180
|
|
|
@@ -195,6 +229,9 @@ Hybrid ranking: FTS5 BM25 for keyword matches + TF-IDF cosine similarity for sem
|
|
|
195
229
|
│ resource_usage │
|
|
196
230
|
│ fts_memories │
|
|
197
231
|
│ tfidf_index │
|
|
232
|
+
│ embeddings │
|
|
233
|
+
│ claude_md_ │
|
|
234
|
+
│ registry │
|
|
198
235
|
│ health_checks │
|
|
199
236
|
└────────────────────┘
|
|
200
237
|
```
|
|
@@ -269,6 +306,9 @@ bunx claude-memory-hub migrate # Import data from claude-mem
|
|
|
269
306
|
bunx claude-memory-hub viewer # Open browser UI at localhost:37888
|
|
270
307
|
bunx claude-memory-hub health # Run health diagnostics
|
|
271
308
|
bunx claude-memory-hub reindex # Rebuild TF-IDF search index
|
|
309
|
+
bunx claude-memory-hub export # Export data as JSONL to stdout
|
|
310
|
+
bunx claude-memory-hub import # Import JSONL from stdin
|
|
311
|
+
bunx claude-memory-hub cleanup # Remove old data (default: 90 days)
|
|
272
312
|
```
|
|
273
313
|
|
|
274
314
|
### Requirements
|
|
@@ -361,6 +401,9 @@ Migration is idempotent — safe to run multiple times with zero duplicates.
|
|
|
361
401
|
| **v0.3.0** | Removed API key requirement, 1-command install |
|
|
362
402
|
| **v0.4.0** | Smart resource loading, token budget optimization |
|
|
363
403
|
| **v0.5.0** | Production hardening, hybrid search, 3-layer progressive search, browser UI, health monitoring, claude-mem migration |
|
|
404
|
+
| **v0.6.0** | ResourceRegistry (170 resources), semantic search (384-dim embeddings), observation capture, CLAUDE.md tracking, 3-tier LLM summarization, overhead analysis |
|
|
405
|
+
| **v0.7.0** | Honest resource analysis, semantic search scaling, batch embeddings, 14 observation patterns, DB auto-cleanup, summarizer retry |
|
|
406
|
+
| **v0.8.0** | 91 unit tests (was 0%), L1 WorkingMemory read-through cache, PostToolUse batch queue (75ms→3ms), JSONL export/import CLI, data cleanup command |
|
|
364
407
|
|
|
365
408
|
See [CHANGELOG.md](CHANGELOG.md) for full details.
|
|
366
409
|
|
|
@@ -369,13 +412,22 @@ See [CHANGELOG.md](CHANGELOG.md) for full details.
|
|
|
369
412
|
## Dependencies
|
|
370
413
|
|
|
371
414
|
```
|
|
372
|
-
@modelcontextprotocol/sdk
|
|
373
|
-
bun:sqlite
|
|
415
|
+
@modelcontextprotocol/sdk MCP stdio server (required)
|
|
416
|
+
bun:sqlite Built-in, zero install
|
|
417
|
+
@huggingface/transformers Semantic search embeddings (optional)
|
|
374
418
|
```
|
|
375
419
|
|
|
376
|
-
|
|
420
|
+
**Two npm packages + one optional.** No Python. No Chroma. No HTTP server. No API key. No Docker.
|
|
421
|
+
|
|
422
|
+
### Environment Variables
|
|
377
423
|
|
|
378
|
-
|
|
424
|
+
| Variable | Default | Description |
|
|
425
|
+
|----------|---------|-------------|
|
|
426
|
+
| `CLAUDE_MEMORY_HUB_LLM` | `auto` | Summarization: auto, cli-only, rule-based |
|
|
427
|
+
| `CLAUDE_MEMORY_HUB_LLM_TIMEOUT_MS` | `30000` | CLI summarizer timeout |
|
|
428
|
+
| `CLAUDE_MEMORY_HUB_EMBEDDINGS` | `auto` | Embeddings: auto, disabled |
|
|
429
|
+
| `CLAUDE_MEMORY_HUB_BATCH` | `auto` | PostToolUse batching: auto, enabled, disabled |
|
|
430
|
+
| `CMH_LOG_LEVEL` | `info` | Log level: debug, info, warn, error |
|
|
379
431
|
|
|
380
432
|
---
|
|
381
433
|
|