clawmem 0.2.0 → 0.2.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.
package/AGENTS.md CHANGED
@@ -634,9 +634,20 @@ Symptom: embed --force with new model produces 3 docs stuck as "Unembedded" but
634
634
  → Fix: Delete partial content_vectors + vectors_vec for the stuck hashes, then re-run embed (no --force).
635
635
  The vec0 DELETE try-catch prevents cascading failures during the re-embed.
636
636
 
637
+ Symptom: reindex --force after v0.2.0 upgrade shows no entity extraction
638
+ → `reindex --force` treats existing docs as updates (isNew=false). The A-MEM pipeline
639
+ skips entity extraction, link generation, and evolution for updates to avoid churn.
640
+ → Fix: Use `clawmem reindex --enrich` instead. The `--enrich` flag forces the full
641
+ enrichment pipeline (entity extraction + links + evolution) on all documents.
642
+ → `--force` alone only refreshes A-MEM notes (keywords, tags, context). `--enrich`
643
+ is needed after major upgrades that add new enrichment stages.
644
+
637
645
  Symptom: CLI reindex/update falls back to node-llama-cpp Vulkan (not GPU server)
638
646
  → GPU env vars only in systemd drop-in, not in wrapper script. CLI invocations missed them.
639
647
  → Fixed 2026-02-12: bin/clawmem wrapper exports CLAWMEM_EMBED_URL/LLM_URL/RERANK_URL defaults.
648
+ → Always run ClawMem via the `bin/clawmem` wrapper, not `bun run src/clawmem.ts` directly.
649
+ The wrapper sets CLAWMEM_EMBED_URL/LLM_URL/RERANK_URL defaults. Scripts or inline bun
650
+ commands that bypass the wrapper will fall back to in-process node-llama-cpp (slow, CPU).
640
651
 
641
652
  Symptom: "UserPromptSubmit hook error" on context-surfacing hook (intermittent)
642
653
  → SQLite contention between the watcher and the hook. The watcher processes filesystem events
package/CLAUDE.md CHANGED
@@ -634,9 +634,20 @@ Symptom: embed --force with new model produces 3 docs stuck as "Unembedded" but
634
634
  → Fix: Delete partial content_vectors + vectors_vec for the stuck hashes, then re-run embed (no --force).
635
635
  The vec0 DELETE try-catch prevents cascading failures during the re-embed.
636
636
 
637
+ Symptom: reindex --force after v0.2.0 upgrade shows no entity extraction
638
+ → `reindex --force` treats existing docs as updates (isNew=false). The A-MEM pipeline
639
+ skips entity extraction, link generation, and evolution for updates to avoid churn.
640
+ → Fix: Use `clawmem reindex --enrich` instead. The `--enrich` flag forces the full
641
+ enrichment pipeline (entity extraction + links + evolution) on all documents.
642
+ → `--force` alone only refreshes A-MEM notes (keywords, tags, context). `--enrich`
643
+ is needed after major upgrades that add new enrichment stages.
644
+
637
645
  Symptom: CLI reindex/update falls back to node-llama-cpp Vulkan (not GPU server)
638
646
  → GPU env vars only in systemd drop-in, not in wrapper script. CLI invocations missed them.
639
647
  → Fixed 2026-02-12: bin/clawmem wrapper exports CLAWMEM_EMBED_URL/LLM_URL/RERANK_URL defaults.
648
+ → Always run ClawMem via the `bin/clawmem` wrapper, not `bun run src/clawmem.ts` directly.
649
+ The wrapper sets CLAWMEM_EMBED_URL/LLM_URL/RERANK_URL defaults. Scripts or inline bun
650
+ commands that bypass the wrapper will fall back to in-process node-llama-cpp (slow, CPU).
640
651
 
641
652
  Symptom: "UserPromptSubmit hook error" on context-surfacing hook (intermittent)
642
653
  → SQLite contention between the watcher and the hook. The watcher processes filesystem events
package/README.md CHANGED
@@ -149,6 +149,25 @@ clawmem update --embed
149
149
  clawmem doctor
150
150
  ```
151
151
 
152
+ ### Upgrading
153
+
154
+ ```bash
155
+ bun update -g clawmem # or: npm update -g clawmem
156
+ ```
157
+
158
+ Database schema migrates automatically on next startup (new tables and columns are added via `CREATE IF NOT EXISTS` / `ALTER TABLE ADD COLUMN`).
159
+
160
+ After **major version updates** (e.g. 0.1.x → 0.2.0) that add new enrichment pipelines, run a full enrichment pass to backfill existing documents:
161
+
162
+ ```bash
163
+ clawmem reindex --enrich # Full enrichment: entity extraction + links + evolution for all docs
164
+ clawmem embed # Re-embed if upgrading embedding models (not needed for most updates)
165
+ ```
166
+
167
+ `--enrich` forces the complete A-MEM pipeline (entity extraction, link generation, memory evolution) on all documents, not just new ones. Without it, reindex only refreshes metadata for existing docs.
168
+
169
+ Routine patch updates (e.g. 0.2.0 → 0.2.1) do not require reindexing.
170
+
152
171
  ### Integration
153
172
 
154
173
  #### Claude Code
package/SKILL.md CHANGED
@@ -272,7 +272,7 @@ Once escalated, route by query type:
272
272
  | `beads_sync` | Sync Beads issues from Dolt backend into memory. |
273
273
  | `index_stats` | Doc counts, embedding coverage, content type distribution. |
274
274
  | `status` | Quick index health. |
275
- | `reindex` | Force re-index (BM25 only, does NOT embed). |
275
+ | `reindex` | Force re-index (BM25 only, does NOT embed). Use `--enrich` after major upgrades to backfill entity extraction + links on existing docs. |
276
276
  | `memory_evolution_status` | Track how a doc's A-MEM metadata evolved over time. |
277
277
  | `timeline` | Temporal neighborhood around a document — what was modified before/after. Progressive disclosure: search → timeline → get. Supports same-collection scoping and session correlation. |
278
278
  | `list_vaults` | Show configured vault names and paths. Empty in single-vault mode. |
@@ -660,6 +660,14 @@ echo "user query" | clawmem surface --context --stdin
660
660
  echo "session-id" | clawmem surface --bootstrap --stdin
661
661
  ```
662
662
 
663
+ ### Enrichment Commands
664
+
665
+ ```bash
666
+ clawmem reindex --enrich # Full A-MEM pipeline on ALL docs (entity extraction,
667
+ # link generation, memory evolution). Use after major upgrades.
668
+ # Without --enrich, reindex only refreshes metadata for changed docs.
669
+ ```
670
+
663
671
  ### Analysis Commands
664
672
 
665
673
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clawmem",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "On-device context engine and memory for AI agents. Claude Code and OpenClaw. Hooks + MCP server + hybrid RAG search.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/clawmem.ts CHANGED
@@ -1269,6 +1269,7 @@ async function cmdWatch() {
1269
1269
 
1270
1270
  async function cmdReindex(args: string[]) {
1271
1271
  const force = args.includes("--force") || args.includes("-f");
1272
+ const enrich = args.includes("--enrich");
1272
1273
  const collections = collectionsList();
1273
1274
 
1274
1275
  if (collections.length === 0) {
@@ -1283,9 +1284,13 @@ async function cmdReindex(args: string[]) {
1283
1284
  console.log(`${c.yellow}Force reindex: deactivated all documents${c.reset}`);
1284
1285
  }
1285
1286
 
1287
+ if (enrich) {
1288
+ console.log(`${c.cyan}Full enrichment: entity extraction + links + evolution for all documents${c.reset}`);
1289
+ }
1290
+
1286
1291
  for (const col of collections) {
1287
1292
  console.log(`Indexing ${c.bold}${col.name}${c.reset} (${col.path})...`);
1288
- const stats = await indexCollection(s, col.name, col.path, col.pattern);
1293
+ const stats = await indexCollection(s, col.name, col.path, col.pattern, { forceEnrich: enrich });
1289
1294
  console.log(` +${stats.added} added, ~${stats.updated} updated, =${stats.unchanged} unchanged, -${stats.removed} removed`);
1290
1295
  }
1291
1296
  }
@@ -2202,7 +2207,7 @@ ${c.bold}Setup:${c.reset}
2202
2207
  ${c.bold}Indexing:${c.reset}
2203
2208
  clawmem update [--pull] [--embed] Re-scan collections (--embed auto-embeds)
2204
2209
  clawmem embed [-f] Generate fragment embeddings
2205
- clawmem reindex [--force] Full re-index
2210
+ clawmem reindex [--force] [--enrich] Full re-index (--enrich: run entity extraction + links on all docs)
2206
2211
  clawmem watch File watcher daemon
2207
2212
  clawmem status Show index status
2208
2213
 
package/src/indexer.ts CHANGED
@@ -166,7 +166,8 @@ export async function indexCollection(
166
166
  store: Store,
167
167
  collectionName: string,
168
168
  collectionPath: string,
169
- pattern: string = "**/*.md"
169
+ pattern: string = "**/*.md",
170
+ options?: { forceEnrich?: boolean }
170
171
  ): Promise<IndexStats> {
171
172
  const stats: IndexStats = { added: 0, updated: 0, unchanged: 0, removed: 0 };
172
173
  const activePaths = new Set<string>();
@@ -223,6 +224,10 @@ export async function indexCollection(
223
224
 
224
225
  if (existingRow?.content_hash === contentHash) {
225
226
  stats.unchanged++;
227
+ if (options?.forceEnrich) {
228
+ // --enrich: queue unchanged docs for full enrichment (entity extraction, links)
229
+ enrichQueue.push({ docId: existing.id, isNew: true });
230
+ }
226
231
  continue;
227
232
  }
228
233
 
@@ -319,8 +324,9 @@ export async function indexCollection(
319
324
  }
320
325
 
321
326
  // A-MEM enrichment runs after successful commit (LLM calls should not block transaction)
327
+ // forceEnrich overrides isNew to true — triggers full pipeline (entity extraction, links, evolution)
322
328
  for (const { docId, isNew } of enrichQueue) {
323
- await store.postIndexEnrich(llm, docId, isNew);
329
+ await store.postIndexEnrich(llm, docId, options?.forceEnrich ? true : isNew);
324
330
  }
325
331
 
326
332
  return stats;