sessionmem 1.3.0 → 1.5.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 (68) hide show
  1. package/.github/sessionmem-logo.svg +57 -0
  2. package/CHANGELOG.md +128 -0
  3. package/CONTRIBUTING.md +130 -0
  4. package/README.md +292 -108
  5. package/SECURITY.md +33 -0
  6. package/dist/adapters/diagnostics.js +109 -0
  7. package/dist/adapters/generic.js +6 -2
  8. package/dist/adapters/global/antigravity.js +4 -1
  9. package/dist/adapters/global/claudeCode.js +19 -4
  10. package/dist/adapters/global/codex.js +7 -6
  11. package/dist/adapters/global/qcoder.js +4 -1
  12. package/dist/adapters/ide/cline.js +3 -0
  13. package/dist/adapters/ide/cursor.js +3 -0
  14. package/dist/adapters/ide/installer.js +17 -5
  15. package/dist/adapters/ide/windsurf.js +3 -0
  16. package/dist/adapters/installedHosts.js +51 -0
  17. package/dist/cli/commands/dedupe.js +1 -1
  18. package/dist/cli/commands/doctor.js +146 -0
  19. package/dist/cli/commands/entities.js +27 -0
  20. package/dist/cli/commands/history.js +23 -0
  21. package/dist/cli/commands/import.js +15 -44
  22. package/dist/cli/commands/ingestHook.js +4 -78
  23. package/dist/cli/commands/install.js +37 -59
  24. package/dist/cli/commands/list.js +3 -0
  25. package/dist/cli/commands/run.js +10 -12
  26. package/dist/cli/commands/scan.js +16 -0
  27. package/dist/cli/commands/search.js +9 -4
  28. package/dist/cli/commands/team.js +7 -3
  29. package/dist/cli/commands/ui.js +67 -0
  30. package/dist/cli/commands/uninstall.js +2 -1
  31. package/dist/cli/commands/watch.js +48 -0
  32. package/dist/cli/context.js +8 -6
  33. package/dist/cli/index.js +48 -7
  34. package/dist/cli/projectId.js +1 -2
  35. package/dist/cli/transcriptSweep.js +182 -0
  36. package/dist/core/api/contracts.js +1 -0
  37. package/dist/core/api/memoryCoreService.js +8 -0
  38. package/dist/core/api/sessionLifecycleService.js +13 -1
  39. package/dist/core/capture/toolEvent.js +82 -0
  40. package/dist/core/config/policyConfig.js +5 -1
  41. package/dist/core/extract/factClaims.js +97 -0
  42. package/dist/core/extract/knowledge.js +127 -0
  43. package/dist/core/injection/tokenBudget.js +10 -2
  44. package/dist/core/retrieve/retrieveMemories.js +20 -4
  45. package/dist/core/schema/migrations/012_transcript_checkpoints.sql +4 -0
  46. package/dist/core/schema/migrations/013_fts_porter.sql +32 -0
  47. package/dist/core/schema/migrations/014_memory_entities.sql +19 -0
  48. package/dist/core/schema/migrations/015_memory_supersessions.sql +41 -0
  49. package/dist/core/schema/runMigrations.js +55 -5
  50. package/dist/core/storage/db.js +31 -9
  51. package/dist/core/storage/knowledgeRepo.js +67 -0
  52. package/dist/core/storage/memoryRepo.js +45 -12
  53. package/dist/core/storage/memorySearchRepo.js +30 -20
  54. package/dist/core/storage/supersessionRepo.js +101 -0
  55. package/dist/core/summarize/cloudSummarizer.js +3 -8
  56. package/dist/core/summarize/summaryShape.js +1 -1
  57. package/dist/ui/assets.js +181 -0
  58. package/dist/ui/server.js +147 -0
  59. package/docs/REGISTRY_LISTING.md +88 -0
  60. package/docs/architecture.md +77 -0
  61. package/docs/benchmark.md +122 -0
  62. package/docs/cloud-summarization.md +57 -0
  63. package/docs/migration.md +44 -0
  64. package/docs/privacy-and-retention.md +139 -0
  65. package/docs/team-mode.md +117 -0
  66. package/docs/troubleshooting.md +126 -0
  67. package/docs/typescript-upgrade.md +48 -0
  68. package/package.json +25 -13
@@ -0,0 +1,57 @@
1
+ <svg width="680" height="310" viewBox="0 0 680 310" xmlns="http://www.w3.org/2000/svg" role="img">
2
+ <title>sessionmem</title>
3
+ <desc>Catfish mascot for sessionmem -- stylized catfish with teal eye and memory circuit dots on barbels</desc>
4
+
5
+ <!-- Tail upper fork -->
6
+ <path d="M 248,145 C 225,125 198,106 172,88 C 190,102 214,126 248,145" fill="#0f172a"/>
7
+ <!-- Tail lower fork -->
8
+ <path d="M 248,145 C 225,165 198,184 172,202 C 190,189 214,166 248,145" fill="#0f172a"/>
9
+ <!-- Tail fill -->
10
+ <path d="M 248,145 L 190,108 L 190,182 Z" fill="#0f172a"/>
11
+
12
+ <!-- Main body -->
13
+ <ellipse cx="380" cy="145" rx="138" ry="82" fill="#0f172a"/>
14
+
15
+ <!-- Belly highlight -->
16
+ <ellipse cx="386" cy="172" rx="104" ry="46" fill="#1a3454"/>
17
+
18
+ <!-- Dorsal fin -->
19
+ <path d="M 338,63 C 358,28 402,22 418,63" fill="#152840"/>
20
+
21
+ <!-- Pectoral fin -->
22
+ <path d="M 430,222 C 450,248 468,252 454,234 C 445,220 430,222 430,222" fill="#152840"/>
23
+
24
+ <!-- Lateral line -->
25
+ <path d="M 265,138 Q 340,130 420,132 Q 462,132 495,140" stroke="#1e3a5f" stroke-width="1.5" fill="none"/>
26
+
27
+ <!-- Eye glow -->
28
+ <circle cx="470" cy="116" r="30" fill="#0d9488" opacity="0.18"/>
29
+ <!-- Eye -->
30
+ <circle cx="470" cy="116" r="22" fill="#0d9488"/>
31
+ <!-- Pupil -->
32
+ <circle cx="470" cy="116" r="11" fill="#081120"/>
33
+ <!-- Eye shine -->
34
+ <circle cx="477" cy="109" r="5" fill="#ccfbf1"/>
35
+
36
+ <!-- Barbels from mouth -->
37
+ <path d="M 518,131 C 540,120 558,110 566,97" stroke="#3d5270" stroke-width="2.8" fill="none" stroke-linecap="round"/>
38
+ <path d="M 518,142 C 546,142 565,143 578,145" stroke="#3d5270" stroke-width="2.8" fill="none" stroke-linecap="round"/>
39
+ <path d="M 518,153 C 538,167 552,183 555,198" stroke="#3d5270" stroke-width="2.8" fill="none" stroke-linecap="round"/>
40
+
41
+ <!-- Memory circuit dots at barbel tips -->
42
+ <circle cx="566" cy="97" r="7" fill="#2dd4bf"/>
43
+ <circle cx="578" cy="145" r="7" fill="#2dd4bf"/>
44
+ <circle cx="555" cy="198" r="7" fill="#2dd4bf"/>
45
+
46
+ <!-- Floating memory dots -->
47
+ <circle cx="608" cy="90" r="5" fill="#2dd4bf" opacity="0.6"/>
48
+ <circle cx="632" cy="75" r="3.5" fill="#2dd4bf" opacity="0.42"/>
49
+ <circle cx="626" cy="118" r="4.5" fill="#2dd4bf" opacity="0.5"/>
50
+ <circle cx="651" cy="100" r="3" fill="#2dd4bf" opacity="0.3"/>
51
+
52
+ <!-- Wordmark -->
53
+ <text x="340" y="278" text-anchor="middle"
54
+ font-family="'Courier New', Courier, monospace"
55
+ font-size="42" font-weight="500" letter-spacing="-1"
56
+ fill="#0d9488">sessionmem</text>
57
+ </svg>
package/CHANGELOG.md ADDED
@@ -0,0 +1,128 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.5.0] - 2026-10-18
9
+
10
+ ### Added
11
+
12
+ - `sessionmem scan` to import existing Claude Code transcripts into memory, and
13
+ `sessionmem watch` to capture new and updated sessions continuously. Both are
14
+ idempotent across reruns and restarts and work fully offline. ([#45])
15
+ - Automatic host detection during `sessionmem install`, and a `sessionmem doctor`
16
+ command that checks the store, hooks, adapter wiring, and recall with fix
17
+ hints for each failure. ([#46])
18
+ - Deterministic entity and relation extraction during capture and scan, a
19
+ `sessionmem entities` command, and entity overlap as a recall ranking
20
+ signal. ([#48])
21
+ - Deterministic supersession handling: memories that replace an earlier fact are
22
+ linked with history, and recall prefers current facts while replaced ones stay
23
+ retrievable explicitly. ([#49])
24
+ - `sessionmem ui`, a local read-only web viewer for memories, entities,
25
+ relations, and supersession history, served on localhost with no external
26
+ services. ([#50])
27
+ - COMPARISON.md, a cited comparison with claude-mem, Mem0, and Zep, plus a draft
28
+ MCP registry listing. ([#51])
29
+ - A reproducible offline LoCoMo evaluation: committed corpus with provenance and
30
+ checksums, and a runner reporting hit rate, precision, recall, and latency
31
+ with all network access blocked. ([#44])
32
+
33
+ ### Changed
34
+
35
+ - Retrieval now ranks with SQLite FTS5 BM25 and Porter stemming over memory
36
+ content and summaries. Measured on the committed LoCoMo evaluation, top-5 hit
37
+ rate improved from 1.44% to 61.95%, and to 63.92% with entity overlap. ([#47], [#48])
38
+ - The release workflow skips the npm publish when the version already exists on
39
+ the registry and creates the GitHub release with notes from this
40
+ changelog. ([#43])
41
+
42
+ ## [1.4.0] - 2026-10-16
43
+
44
+ ### Added
45
+
46
+ - A `SECURITY.md` policy covering supported releases, private vulnerability
47
+ reporting through GitHub security advisories, and response expectations. ([#31])
48
+ - Bug report and pull request templates, with private security reporting guidance. ([#40])
49
+ - Documentation of the TypeScript 7 toolchain blocker and criteria for revisiting
50
+ the upgrade. ([#33])
51
+ - Package homepage and issue tracker metadata, and bundled documentation,
52
+ changelog, contribution and security policies, and the README logo in the npm
53
+ package. ([#34], [#40])
54
+
55
+ ### Changed
56
+
57
+ - Aligned supported Node.js versions to `^20.19.0 || >=22.13.0`, using Commander
58
+ 14.0.3 to retain Node 20 compatibility. Deferred better-sqlite3 13 and Vitest 5,
59
+ and temporarily ignored TypeScript 7+ updates until the toolchain supports them. ([#33], [#34])
60
+ - Updated compatible runtime and development dependencies, including the Anthropic
61
+ and MCP SDKs, better-sqlite3, Zod, ESLint, typescript-eslint, globals, and SQLite
62
+ types; upgraded the setup-node action. ([#22], [#23], [#24], [#28], [#34])
63
+ - Clarified installation, adapter selection, Claude Code lifecycle hooks versus
64
+ other MCP hosts, local database checks, command limits, import behavior,
65
+ environment overrides, cloud fallback, and migration guidance in the README,
66
+ CLI help, and linked documentation. The development MCP template now runs the
67
+ local build, and the `llms.txt` example includes the required `run` argument. ([#34], [#40])
68
+
69
+ ### Fixed
70
+
71
+ - Database path overrides now create only the selected database's parent
72
+ directories, without creating `~/.sessionmem`. Server logs stay beside that
73
+ database, and in-memory databases do not create log directories. ([#40])
74
+ - Null and other invalid import records are skipped with warnings instead of
75
+ crashing; imports preserve provenance and original record indices. UTF-8 BOM
76
+ and CRLF files are accepted, and invalid UTF-8 is rejected. Null or non-object
77
+ policy configuration safely falls back to defaults. ([#40])
78
+ - Token caps now account for truncation markers and enforce actual token counts,
79
+ including large-session summaries and cloud summarization output. ([#40])
80
+ - Concurrent SQLite WAL initialization retries within a bounded five-second wait;
81
+ migration checks and writes are serialized, and failed database initialization
82
+ closes its handle. ([#40])
83
+ - Malformed numeric search limits and deduplication thresholds are rejected.
84
+ Search consistently defaults to 10 results, and memory lists warn when the
85
+ 200-record limit truncates their output. ([#40])
86
+ - CLI install, uninstall, and default-export tests use temporary home directories;
87
+ project-root fixtures no longer depend on whether the temporary directory is
88
+ inside another repository. ([#30])
89
+ - The mirrored package manifest and Docker install pin stay synchronized with
90
+ release versions and runtime dependency metadata. ([#34])
91
+ - The release workflow installs dependencies, builds, and tests before upgrading
92
+ npm for trusted publishing, preserving better-sqlite3's native install step.
93
+ ([62765a7])
94
+
95
+ ### Security
96
+
97
+ - Refreshed vulnerable transitive dependencies, including `proxy-addr` 2.0.8 and
98
+ `fast-uri` 3.1.8, with MCP SDK 1.32.1, removing the reported critical and moderate
99
+ advisories without suppressing findings. ([#27], [#29])
100
+ - Pinned every GitHub Action in CI, release, and security workflows to a verified
101
+ full commit SHA. Replaced the retired Semgrep action with CLI 1.181.0 so scanner
102
+ errors and findings fail the job; added scanner dependency updates and
103
+ Dependabot cooldowns. ([#32])
104
+
105
+ [1.5.0]: https://github.com/catfish-1234/sessionmem/compare/679b8954f0b49f197985c40da47f181c00060cd9...v1.5.0
106
+ [#43]: https://github.com/catfish-1234/sessionmem/pull/43
107
+ [#44]: https://github.com/catfish-1234/sessionmem/pull/44
108
+ [#45]: https://github.com/catfish-1234/sessionmem/pull/45
109
+ [#46]: https://github.com/catfish-1234/sessionmem/pull/46
110
+ [#47]: https://github.com/catfish-1234/sessionmem/pull/47
111
+ [#48]: https://github.com/catfish-1234/sessionmem/pull/48
112
+ [#49]: https://github.com/catfish-1234/sessionmem/pull/49
113
+ [#50]: https://github.com/catfish-1234/sessionmem/pull/50
114
+ [#51]: https://github.com/catfish-1234/sessionmem/pull/51
115
+ [1.4.0]: https://github.com/catfish-1234/sessionmem/compare/a73f503123b1d33c35407ce66403f281ba3451ac...679b8954f0b49f197985c40da47f181c00060cd9
116
+ [#22]: https://github.com/catfish-1234/sessionmem/pull/22
117
+ [#23]: https://github.com/catfish-1234/sessionmem/pull/23
118
+ [#24]: https://github.com/catfish-1234/sessionmem/pull/24
119
+ [#27]: https://github.com/catfish-1234/sessionmem/pull/27
120
+ [#28]: https://github.com/catfish-1234/sessionmem/pull/28
121
+ [#29]: https://github.com/catfish-1234/sessionmem/pull/29
122
+ [#30]: https://github.com/catfish-1234/sessionmem/pull/30
123
+ [#31]: https://github.com/catfish-1234/sessionmem/pull/31
124
+ [#32]: https://github.com/catfish-1234/sessionmem/pull/32
125
+ [#33]: https://github.com/catfish-1234/sessionmem/pull/33
126
+ [#34]: https://github.com/catfish-1234/sessionmem/pull/34
127
+ [#40]: https://github.com/catfish-1234/sessionmem/pull/40
128
+ [62765a7]: https://github.com/catfish-1234/sessionmem/commit/62765a7
@@ -0,0 +1,130 @@
1
+ # Contributing to sessionmem
2
+
3
+ To work on sessionmem, clone the repository, install dependencies, and build it using the commands below.
4
+
5
+ ## Getting started
6
+
7
+ ```bash
8
+ git clone https://github.com/catfish-1234/sessionmem.git
9
+ cd sessionmem
10
+ npm ci
11
+ npm run build
12
+ ```
13
+
14
+ ### MCP config for local development
15
+
16
+ Copy `.mcp.json.example` to `.mcp.json` and replace its example path with the
17
+ absolute path to this checkout’s `dist/cli/index.js`. Rebuild after source changes.
18
+ `sessionmem install` registers the executable on PATH, which may be a different
19
+ installed version. The `.mcp.json` file is gitignored because it contains machine-specific paths.
20
+
21
+ ## Development workflow
22
+
23
+ Use Node 20.19+ or 22.13+ (Node 22 LTS recommended). Commander stays on 14
24
+ because 15 requires Node 22.12+, while this project still tests Node 20.
25
+ Likewise, better-sqlite3 13 and Vitest 5 require Node 22; those major upgrades
26
+ are deferred until the Node support policy changes. Compatible dependency
27
+ updates remain enabled.
28
+
29
+ ### Build
30
+
31
+ ```bash
32
+ npm run build # compile TypeScript + copy migrations
33
+ ```
34
+
35
+ ### Test
36
+
37
+ ```bash
38
+ npm test # run all tests (Vitest)
39
+ npm run test:schema # run schema/migration tests only
40
+ ```
41
+
42
+ ### Lint and typecheck
43
+
44
+ ```bash
45
+ npm run lint # ESLint
46
+ npm run typecheck # tsc --noEmit
47
+ ```
48
+
49
+ See [TypeScript 7 upgrade status](docs/typescript-upgrade.md) for the current
50
+ upstream tooling blocker and the criteria for removing the temporary Dependabot ignore.
51
+
52
+ ### Benchmarks
53
+
54
+ ```bash
55
+ npm run build # benchmarks import from dist/
56
+ npm run benchmark # regenerates docs/benchmark.md
57
+ ```
58
+
59
+ All four checks (build, test, lint, typecheck) run in CI on Node 20 and 22 for
60
+ Ubuntu and macOS, and Node 22 for Windows. CI also installs the npm tarball and
61
+ checks the installed CLI. Run `npm pack --dry-run` to review published files;
62
+ only compiled runtime files, migrations, and user documentation belong there.
63
+
64
+ ## Project structure
65
+
66
+ ```
67
+ src/
68
+ core/ # Memory engine: storage, retrieval, ranking, summarization
69
+ adapters/ # MCP adapter layer (translates between MCP protocol and core)
70
+ cli/ # CLI commands (sessionmem install, search, etc.)
71
+ tests/ # Vitest test suite
72
+ scripts/ # Build helpers and benchmark runner
73
+ docs/ # Architecture, benchmarks, and feature docs
74
+ ```
75
+
76
+ ## Code conventions
77
+
78
+ - **TypeScript**: strict mode, ES2022 target, NodeNext module resolution.
79
+ - **Unused vars**: prefix with underscore (`_unused`) to satisfy the lint rule.
80
+ - **Explicit `any` in tests**: permitted in `tests/`; source code keeps the lint rule.
81
+ - **Comments**: only when the "why" isn't obvious. No doc-block boilerplate.
82
+
83
+ ## Pre-commit hooks
84
+
85
+ A [gitleaks](https://github.com/gitleaks/gitleaks) pre-commit hook runs automatically to prevent accidental secret commits. Install it with:
86
+
87
+ ```bash
88
+ pip install pre-commit
89
+ pre-commit install
90
+ ```
91
+
92
+ ## Submitting changes
93
+
94
+ 1. **Fork and branch**: create a feature branch from `main`.
95
+ 2. **Keep PRs focused**: one feature or fix per PR.
96
+ 3. **All checks must pass**: build, test, lint, and typecheck.
97
+ 4. **Write tests** for new functionality or bug fixes.
98
+ 5. **Update docs** if your change affects user-facing behavior or CLI commands.
99
+
100
+ ### Commit messages
101
+
102
+ Use clear, descriptive commit messages. [Conventional Commits](https://www.conventionalcommits.org/) style is preferred:
103
+
104
+ ```
105
+ feat: add memory export filtering by date range
106
+ fix: handle empty project ID in search query
107
+ docs: clarify team mode trust model
108
+ chore: bump better-sqlite3 to v12.5
109
+ ```
110
+
111
+ ## Reporting bugs
112
+
113
+ Open an issue with:
114
+
115
+ - What you expected to happen
116
+ - What actually happened
117
+ - Steps to reproduce
118
+ - Node version, OS, and which MCP host you're using (Claude Code, Cursor, etc.)
119
+
120
+ ## Feature requests
121
+
122
+ Open an issue describing the use case. Explain the problem you're trying to solve, not just the solution you have in mind.
123
+
124
+ ## Security
125
+
126
+ If you find a security vulnerability, **do not open a public issue**. Use [GitHub private vulnerability reporting](https://github.com/catfish-1234/sessionmem/security/advisories/new). See the [security policy](SECURITY.md) for supported versions and response expectations, and the [security workflow](https://github.com/catfish-1234/sessionmem/blob/main/.github/workflows/security.yml) for automated scanning.
127
+
128
+ ## License
129
+
130
+ By contributing, you agree that your contributions will be licensed under the [MIT License](LICENSE).