somtum 1.3.2 → 1.3.4
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/README.md +116 -109
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -67,24 +67,40 @@ At the end of each Claude Code session, Somtum reads the session transcript and
|
|
|
67
67
|
|
|
68
68
|
### Memory lifecycle
|
|
69
69
|
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
70
|
+
```
|
|
71
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
72
|
+
│ Claude Code Session │
|
|
73
|
+
│ │
|
|
74
|
+
│ you code · debug · review · make decisions │
|
|
75
|
+
└──────────────────────────────┬──────────────────────────────┘
|
|
76
|
+
│ SessionEnd fires automatically
|
|
77
|
+
▼
|
|
78
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
79
|
+
│ Capture Pipeline │
|
|
80
|
+
│ │
|
|
81
|
+
│ session transcript ──► Haiku extracts observations │
|
|
82
|
+
│ │
|
|
83
|
+
│ decisions · bug fixes · learnings · commands │
|
|
84
|
+
└──────────────────────────────┬──────────────────────────────┘
|
|
85
|
+
│ persisted locally
|
|
86
|
+
▼
|
|
87
|
+
┌─────────────────────────┐
|
|
88
|
+
│ ~/.somtum/projects/ │
|
|
89
|
+
│ <project-hash>/ │
|
|
90
|
+
│ │
|
|
91
|
+
│ db.sqlite │
|
|
92
|
+
│ index.md │
|
|
93
|
+
│ memories/YYYY-MM/ │
|
|
94
|
+
└────────────┬────────────┘
|
|
95
|
+
│ next session
|
|
96
|
+
▼
|
|
97
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
98
|
+
│ Query Pipeline │
|
|
99
|
+
│ │
|
|
100
|
+
│ user prompt ──► BM25 / embeddings / hybrid ──► top-k hits │
|
|
101
|
+
│ │
|
|
102
|
+
│ injected into Claude Code context automatically │
|
|
103
|
+
└─────────────────────────────────────────────────────────────┘
|
|
88
104
|
```
|
|
89
105
|
|
|
90
106
|
### What gets captured — a concrete example
|
|
@@ -153,12 +169,12 @@ Next session, when you ask "why are we using pnpm?" or touch `src/auth/refresh.t
|
|
|
153
169
|
|
|
154
170
|
### Retrieval strategies
|
|
155
171
|
|
|
156
|
-
| Strategy
|
|
157
|
-
|
|
158
|
-
| **`bm25`**
|
|
159
|
-
| **`embeddings`** | Semantic similarity using a 30 MB local model (bge-small-en-v1.5, runs fully in-process) | "What did we decide about auth?" style queries | ~5 ms at 10k memories
|
|
160
|
-
| **`index`**
|
|
161
|
-
| **`hybrid`**
|
|
172
|
+
| Strategy | How it works | Best for | Cost |
|
|
173
|
+
| ---------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------- | -------------------------------- |
|
|
174
|
+
| **`bm25`** | Keyword search over title + body + tags (SQLite FTS5 — no external dependencies) | Exact terms, offline setups | Near-zero |
|
|
175
|
+
| **`embeddings`** | Semantic similarity using a 30 MB local model (bge-small-en-v1.5, runs fully in-process) | "What did we decide about auth?" style queries | ~5 ms at 10k memories |
|
|
176
|
+
| **`index`** | Sends a compact memory catalog to Haiku; the model picks relevant IDs | Paraphrased or fuzzy queries | 1 Haiku API call |
|
|
177
|
+
| **`hybrid`** | BM25 + embeddings results merged and re-ranked by Haiku | General case (best recall) | BM25 + embeddings + 1 Haiku call |
|
|
162
178
|
|
|
163
179
|
**Default is `bm25`** — works offline, no setup. Enable `hybrid` once you have embeddings downloaded.
|
|
164
180
|
|
|
@@ -175,21 +191,12 @@ Next session, when you ask "why are we using pnpm?" or touch `src/auth/refresh.t
|
|
|
175
191
|
## Install
|
|
176
192
|
|
|
177
193
|
```bash
|
|
178
|
-
# npm (recommended)
|
|
179
194
|
npm install -g somtum
|
|
180
|
-
|
|
181
|
-
# yarn
|
|
182
|
-
yarn global add somtum
|
|
183
|
-
|
|
184
|
-
# pnpm
|
|
185
|
-
pnpm add -g somtum
|
|
186
195
|
```
|
|
187
196
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
npm install somtum
|
|
192
|
-
```
|
|
197
|
+
> **pnpm users:** `pnpm add -g somtum` works if you have run `pnpm setup` first (sets `PNPM_HOME`). If you haven't, use npm above.
|
|
198
|
+
>
|
|
199
|
+
> **yarn users:** `yarn global add` is not supported in Yarn v2+ (Berry). Use npm above.
|
|
193
200
|
|
|
194
201
|
### From source
|
|
195
202
|
|
|
@@ -345,10 +352,10 @@ The dashboard has four views:
|
|
|
345
352
|
- **Analytics** — kind breakdown, cache hit rate, retrieval strategy usage, top-referenced files.
|
|
346
353
|
- **Forget button** — soft-delete any memory directly from the browser.
|
|
347
354
|
|
|
348
|
-
| Flag
|
|
349
|
-
|
|
350
|
-
| `--port <n>` | 3000
|
|
351
|
-
| `--no-open`
|
|
355
|
+
| Flag | Default | Description |
|
|
356
|
+
| ------------ | ------- | ---------------------------------------- |
|
|
357
|
+
| `--port <n>` | 3000 | Listen on a custom port |
|
|
358
|
+
| `--no-open` | — | Start server without opening the browser |
|
|
352
359
|
|
|
353
360
|
Press `Ctrl-C` to stop.
|
|
354
361
|
|
|
@@ -358,67 +365,67 @@ Press `Ctrl-C` to stop.
|
|
|
358
365
|
|
|
359
366
|
### Setup
|
|
360
367
|
|
|
361
|
-
| Command
|
|
362
|
-
|
|
363
|
-
| `somtum init`
|
|
364
|
-
| `somtum init --cache`
|
|
365
|
-
| `somtum init --file-gating` | Also install the PreToolUse file-gating hook
|
|
366
|
-
| `somtum init --all`
|
|
367
|
-
| `somtum init --force`
|
|
368
|
-
| `somtum doctor`
|
|
368
|
+
| Command | Description |
|
|
369
|
+
| --------------------------- | ------------------------------------------------------------ |
|
|
370
|
+
| `somtum init` | Install the SessionEnd capture hook |
|
|
371
|
+
| `somtum init --cache` | Also install the UserPromptSubmit cache hook |
|
|
372
|
+
| `somtum init --file-gating` | Also install the PreToolUse file-gating hook |
|
|
373
|
+
| `somtum init --all` | Install all hooks + MCP server |
|
|
374
|
+
| `somtum init --force` | Reinstall even if hooks already present |
|
|
375
|
+
| `somtum doctor` | Check DB health, migrations, hooks, API key, breakeven ratio |
|
|
369
376
|
|
|
370
377
|
### Memory
|
|
371
378
|
|
|
372
|
-
| Command
|
|
373
|
-
|
|
374
|
-
| `somtum search <query>`
|
|
375
|
-
| `somtum search <query> --strategy hybrid` | Force a specific retrieval strategy
|
|
376
|
-
| `somtum search <query> -k 16`
|
|
377
|
-
| `somtum show <id>`
|
|
378
|
-
| `somtum remember`
|
|
379
|
-
| `somtum forget <id>`
|
|
380
|
-
| `somtum edit <id>`
|
|
381
|
-
| `somtum rebuild`
|
|
382
|
-
| `somtum reindex`
|
|
379
|
+
| Command | Description |
|
|
380
|
+
| ----------------------------------------- | ------------------------------------------------------------------ |
|
|
381
|
+
| `somtum search <query>` | Search observations (default: `bm25` strategy) |
|
|
382
|
+
| `somtum search <query> --strategy hybrid` | Force a specific retrieval strategy |
|
|
383
|
+
| `somtum search <query> -k 16` | Return more results |
|
|
384
|
+
| `somtum show <id>` | Print the full body of an observation |
|
|
385
|
+
| `somtum remember` | Manually store an observation |
|
|
386
|
+
| `somtum forget <id>` | Soft-delete an observation |
|
|
387
|
+
| `somtum edit <id>` | Open an observation body in `$EDITOR` |
|
|
388
|
+
| `somtum rebuild` | Regenerate `index.md` from all observations |
|
|
389
|
+
| `somtum reindex` | Recompute embeddings (after enabling embeddings or changing model) |
|
|
383
390
|
|
|
384
391
|
### Stats & Visibility
|
|
385
392
|
|
|
386
|
-
| Command
|
|
387
|
-
|
|
388
|
-
| `somtum stats`
|
|
389
|
-
| `somtum stats --json`
|
|
390
|
-
| `somtum serve`
|
|
391
|
-
| `somtum serve --port <n>` | Use a custom port (default 3000)
|
|
392
|
-
| `somtum serve --no-open`
|
|
393
|
+
| Command | Description |
|
|
394
|
+
| ------------------------- | ------------------------------------------------- |
|
|
395
|
+
| `somtum stats` | Tokens saved, cache hit rate, retrieval breakdown |
|
|
396
|
+
| `somtum stats --json` | Machine-readable JSON output |
|
|
397
|
+
| `somtum serve` | Open the visual dashboard in the browser |
|
|
398
|
+
| `somtum serve --port <n>` | Use a custom port (default 3000) |
|
|
399
|
+
| `somtum serve --no-open` | Start server without opening the browser |
|
|
393
400
|
|
|
394
401
|
### Data Management
|
|
395
402
|
|
|
396
|
-
| Command
|
|
397
|
-
|
|
398
|
-
| `somtum export`
|
|
399
|
-
| `somtum export --format jsonl --output obs.jsonl` | Export as JSONL file
|
|
400
|
-
| `somtum export --format markdown`
|
|
401
|
-
| `somtum export --include-deleted`
|
|
402
|
-
| `somtum import <file>`
|
|
403
|
-
| `somtum purge --older-than 30d`
|
|
404
|
-
| `somtum purge --older-than 30d --dry-run`
|
|
403
|
+
| Command | Description |
|
|
404
|
+
| ------------------------------------------------- | --------------------------------------------------- |
|
|
405
|
+
| `somtum export` | Export observations to stdout as JSON |
|
|
406
|
+
| `somtum export --format jsonl --output obs.jsonl` | Export as JSONL file |
|
|
407
|
+
| `somtum export --format markdown` | Export as readable Markdown |
|
|
408
|
+
| `somtum export --include-deleted` | Include soft-deleted entries |
|
|
409
|
+
| `somtum import <file>` | Import observations from JSON or JSONL |
|
|
410
|
+
| `somtum purge --older-than 30d` | Hard-delete soft-deleted entries older than 30 days |
|
|
411
|
+
| `somtum purge --older-than 30d --dry-run` | Preview without deleting |
|
|
405
412
|
|
|
406
413
|
### Configuration
|
|
407
414
|
|
|
408
|
-
| Command
|
|
409
|
-
|
|
410
|
-
| `somtum config get`
|
|
411
|
-
| `somtum config get retrieval.strategy`
|
|
412
|
-
| `somtum config set retrieval.strategy hybrid`
|
|
413
|
-
| `somtum config set retrieval.embeddings.enabled true --global` | Write to `~/.somtum/config.json`
|
|
415
|
+
| Command | Description |
|
|
416
|
+
| -------------------------------------------------------------- | --------------------------------- |
|
|
417
|
+
| `somtum config get` | Print the full resolved config |
|
|
418
|
+
| `somtum config get retrieval.strategy` | Read a single key (dot-separated) |
|
|
419
|
+
| `somtum config set retrieval.strategy hybrid` | Write to `.somtum/config.json` |
|
|
420
|
+
| `somtum config set retrieval.embeddings.enabled true --global` | Write to `~/.somtum/config.json` |
|
|
414
421
|
|
|
415
422
|
### Sync
|
|
416
423
|
|
|
417
|
-
| Command
|
|
418
|
-
|
|
424
|
+
| Command | Description |
|
|
425
|
+
| -------------------- | ----------------------------------------- |
|
|
419
426
|
| `somtum sync status` | Compare local vs remote observation count |
|
|
420
|
-
| `somtum sync push`
|
|
421
|
-
| `somtum sync pull`
|
|
427
|
+
| `somtum sync push` | Export and scp observations to remote |
|
|
428
|
+
| `somtum sync pull` | scp from remote and merge into local DB |
|
|
422
429
|
|
|
423
430
|
Set your remote: `somtum config set sync.remote "user@host:/path/.somtum/projects/<id>"`
|
|
424
431
|
|
|
@@ -430,14 +437,14 @@ Somtum uses hostname-aware syncing — merging observations from multiple machin
|
|
|
430
437
|
|
|
431
438
|
When you run `somtum init --all`, Somtum registers an MCP server that Claude can call autonomously during a session:
|
|
432
439
|
|
|
433
|
-
| Tool
|
|
434
|
-
|
|
435
|
-
| `recall`
|
|
436
|
-
| `get`
|
|
437
|
-
| `remember`
|
|
438
|
-
| `cache_lookup` | Checks the prompt cache directly
|
|
439
|
-
| `forget`
|
|
440
|
-
| `stats`
|
|
440
|
+
| Tool | What Claude does with it |
|
|
441
|
+
| -------------- | ------------------------------------------------------ |
|
|
442
|
+
| `recall` | Searches memories when unsure about a project detail |
|
|
443
|
+
| `get` | Retrieves the full body of specific observations by ID |
|
|
444
|
+
| `remember` | Stores an observation manually from within a session |
|
|
445
|
+
| `cache_lookup` | Checks the prompt cache directly |
|
|
446
|
+
| `forget` | Soft-deletes an observation |
|
|
447
|
+
| `stats` | Reports tokens saved, cache hit rate, and corpus size |
|
|
441
448
|
|
|
442
449
|
Every MCP response includes a `tokens` field so Claude can account for retrieval cost.
|
|
443
450
|
|
|
@@ -496,14 +503,14 @@ somtum config set extraction.max_observations_per_session 5
|
|
|
496
503
|
"extraction": {
|
|
497
504
|
"model": "claude-haiku-4-5-20251001",
|
|
498
505
|
"trigger": ["SessionEnd", "PreCompact"],
|
|
499
|
-
"max_observations_per_session": 10
|
|
506
|
+
"max_observations_per_session": 10,
|
|
500
507
|
},
|
|
501
508
|
"cache": {
|
|
502
509
|
"enabled": true,
|
|
503
510
|
"fuzzy_match": true,
|
|
504
511
|
"fuzzy_threshold": 0.92, // raise to 0.95 once you have signal
|
|
505
512
|
"max_entries": 10000,
|
|
506
|
-
"ttl_days": 90
|
|
513
|
+
"ttl_days": 90,
|
|
507
514
|
},
|
|
508
515
|
"retrieval": {
|
|
509
516
|
"strategy": "bm25", // bm25 | embeddings | index | hybrid
|
|
@@ -512,17 +519,17 @@ somtum config set extraction.max_observations_per_session 5
|
|
|
512
519
|
"bm25": { "enabled": true },
|
|
513
520
|
"embeddings": {
|
|
514
521
|
"enabled": false, // set true to download the 30 MB ONNX model
|
|
515
|
-
"model": "Xenova/bge-small-en-v1.5"
|
|
522
|
+
"model": "Xenova/bge-small-en-v1.5",
|
|
516
523
|
},
|
|
517
524
|
"index": {
|
|
518
525
|
"enabled": false, // set true to use Haiku as the retriever
|
|
519
|
-
"model": "claude-haiku-4-5-20251001"
|
|
520
|
-
}
|
|
526
|
+
"model": "claude-haiku-4-5-20251001",
|
|
527
|
+
},
|
|
521
528
|
},
|
|
522
529
|
"file_gating": {
|
|
523
530
|
"enabled": false, // set true to intercept large file reads
|
|
524
531
|
"min_file_size_tokens": 500,
|
|
525
|
-
"exclude_globs": ["**/*.env", "**/secrets/**"]
|
|
532
|
+
"exclude_globs": ["**/*.env", "**/secrets/**"],
|
|
526
533
|
},
|
|
527
534
|
"privacy": {
|
|
528
535
|
"telemetry": false,
|
|
@@ -531,14 +538,14 @@ somtum config set extraction.max_observations_per_session 5
|
|
|
531
538
|
"bearer\\s+[A-Za-z0-9_\\-.]+",
|
|
532
539
|
"sk-[A-Za-z0-9_\\-]{20,}",
|
|
533
540
|
"xox[baprs]-[A-Za-z0-9-]{10,}",
|
|
534
|
-
"AKIA[0-9A-Z]{16}"
|
|
535
|
-
]
|
|
541
|
+
"AKIA[0-9A-Z]{16}",
|
|
542
|
+
],
|
|
536
543
|
},
|
|
537
544
|
"sync": {
|
|
538
545
|
"enabled": false,
|
|
539
546
|
"backend": "ssh",
|
|
540
|
-
"remote": null // e.g. "user@host:/home/user/.somtum/projects/<id>"
|
|
541
|
-
}
|
|
547
|
+
"remote": null, // e.g. "user@host:/home/user/.somtum/projects/<id>"
|
|
548
|
+
},
|
|
542
549
|
}
|
|
543
550
|
```
|
|
544
551
|
|
|
@@ -564,12 +571,12 @@ The breakeven ratio (`tokens_saved / tokens_spent`) measures whether extraction
|
|
|
564
571
|
|
|
565
572
|
## Performance
|
|
566
573
|
|
|
567
|
-
| Scenario
|
|
568
|
-
|
|
569
|
-
| `UserPromptSubmit` hook at 1k memories
|
|
570
|
-
| `UserPromptSubmit` hook at 10k memories | 300 ms
|
|
571
|
-
| Exact cache hash lookup
|
|
572
|
-
| `SessionEnd` hook (extract + embed)
|
|
574
|
+
| Scenario | p95 budget | Actual (benchmark) |
|
|
575
|
+
| --------------------------------------- | ------------- | ------------------------ |
|
|
576
|
+
| `UserPromptSubmit` hook at 1k memories | 150 ms | < 2 ms (BM25 k=8) |
|
|
577
|
+
| `UserPromptSubmit` hook at 10k memories | 300 ms | < 30 ms (BM25 k=8) |
|
|
578
|
+
| Exact cache hash lookup | — | < 0.1 ms |
|
|
579
|
+
| `SessionEnd` hook (extract + embed) | 90 s hard cap | Exits cleanly on timeout |
|
|
573
580
|
|
|
574
581
|
Run benchmarks yourself:
|
|
575
582
|
|