sessionmem 1.2.0 → 1.4.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 (41) hide show
  1. package/.github/sessionmem-logo.svg +57 -0
  2. package/CHANGELOG.md +84 -0
  3. package/CONTRIBUTING.md +130 -0
  4. package/README.md +153 -82
  5. package/SECURITY.md +33 -0
  6. package/dist/cli/commands/dedupe.js +89 -22
  7. package/dist/cli/commands/import.js +15 -44
  8. package/dist/cli/commands/ingestHook.js +107 -18
  9. package/dist/cli/commands/install.js +3 -3
  10. package/dist/cli/commands/list.js +3 -0
  11. package/dist/cli/commands/run.js +10 -12
  12. package/dist/cli/commands/savings.js +3 -1
  13. package/dist/cli/commands/search.js +8 -4
  14. package/dist/cli/commands/stats.js +7 -0
  15. package/dist/cli/commands/uninstall.js +2 -1
  16. package/dist/cli/context.js +8 -6
  17. package/dist/cli/index.js +8 -17
  18. package/dist/cli/projectId.js +48 -2
  19. package/dist/core/api/contracts.js +6 -1
  20. package/dist/core/api/memoryCoreService.js +17 -3
  21. package/dist/core/config/policyConfig.js +5 -1
  22. package/dist/core/injection/tokenBudget.js +10 -2
  23. package/dist/core/retrieve/retrieveMemories.js +1 -1
  24. package/dist/core/schema/runMigrations.js +9 -5
  25. package/dist/core/storage/db.js +31 -9
  26. package/dist/core/storage/memoryRepo.js +1 -1
  27. package/dist/core/storage/memorySearchRepo.js +36 -14
  28. package/dist/core/storage/sessionEventsRepo.js +21 -0
  29. package/dist/core/summarize/cloudSummarizer.js +3 -8
  30. package/dist/core/summarize/redaction.js +70 -10
  31. package/dist/core/summarize/summaryShape.js +50 -20
  32. package/docs/architecture.md +53 -0
  33. package/docs/benchmark.md +50 -0
  34. package/docs/cloud-summarization.md +57 -0
  35. package/docs/migration.md +42 -0
  36. package/docs/privacy-and-retention.md +139 -0
  37. package/docs/team-mode.md +117 -0
  38. package/docs/troubleshooting.md +78 -0
  39. package/docs/typescript-upgrade.md +48 -0
  40. package/package.json +26 -13
  41. package/dist/core/session.js +0 -4
@@ -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,84 @@
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.4.0] - 2026-10-16
9
+
10
+ ### Added
11
+
12
+ - A `SECURITY.md` policy covering supported releases, private vulnerability
13
+ reporting through GitHub security advisories, and response expectations. ([#31])
14
+ - Bug report and pull request templates, with private security reporting guidance. ([#40])
15
+ - Documentation of the TypeScript 7 toolchain blocker and criteria for revisiting
16
+ the upgrade. ([#33])
17
+ - Package homepage and issue tracker metadata, and bundled documentation,
18
+ changelog, contribution and security policies, and the README logo in the npm
19
+ package. ([#34], [#40])
20
+
21
+ ### Changed
22
+
23
+ - Aligned supported Node.js versions to `^20.19.0 || >=22.13.0`, using Commander
24
+ 14.0.3 to retain Node 20 compatibility. Deferred better-sqlite3 13 and Vitest 5,
25
+ and temporarily ignored TypeScript 7+ updates until the toolchain supports them. ([#33], [#34])
26
+ - Updated compatible runtime and development dependencies, including the Anthropic
27
+ and MCP SDKs, better-sqlite3, Zod, ESLint, typescript-eslint, globals, and SQLite
28
+ types; upgraded the setup-node action. ([#22], [#23], [#24], [#28], [#34])
29
+ - Clarified installation, adapter selection, Claude Code lifecycle hooks versus
30
+ other MCP hosts, local database checks, command limits, import behavior,
31
+ environment overrides, cloud fallback, and migration guidance in the README,
32
+ CLI help, and linked documentation. The development MCP template now runs the
33
+ local build, and the `llms.txt` example includes the required `run` argument. ([#34], [#40])
34
+
35
+ ### Fixed
36
+
37
+ - Database path overrides now create only the selected database's parent
38
+ directories, without creating `~/.sessionmem`. Server logs stay beside that
39
+ database, and in-memory databases do not create log directories. ([#40])
40
+ - Null and other invalid import records are skipped with warnings instead of
41
+ crashing; imports preserve provenance and original record indices. UTF-8 BOM
42
+ and CRLF files are accepted, and invalid UTF-8 is rejected. Null or non-object
43
+ policy configuration safely falls back to defaults. ([#40])
44
+ - Token caps now account for truncation markers and enforce actual token counts,
45
+ including large-session summaries and cloud summarization output. ([#40])
46
+ - Concurrent SQLite WAL initialization retries within a bounded five-second wait;
47
+ migration checks and writes are serialized, and failed database initialization
48
+ closes its handle. ([#40])
49
+ - Malformed numeric search limits and deduplication thresholds are rejected.
50
+ Search consistently defaults to 10 results, and memory lists warn when the
51
+ 200-record limit truncates their output. ([#40])
52
+ - CLI install, uninstall, and default-export tests use temporary home directories;
53
+ project-root fixtures no longer depend on whether the temporary directory is
54
+ inside another repository. ([#30])
55
+ - The mirrored package manifest and Docker install pin stay synchronized with
56
+ release versions and runtime dependency metadata. ([#34])
57
+ - The release workflow installs dependencies, builds, and tests before upgrading
58
+ npm for trusted publishing, preserving better-sqlite3's native install step.
59
+ ([62765a7])
60
+
61
+ ### Security
62
+
63
+ - Refreshed vulnerable transitive dependencies, including `proxy-addr` 2.0.8 and
64
+ `fast-uri` 3.1.8, with MCP SDK 1.32.1, removing the reported critical and moderate
65
+ advisories without suppressing findings. ([#27], [#29])
66
+ - Pinned every GitHub Action in CI, release, and security workflows to a verified
67
+ full commit SHA. Replaced the retired Semgrep action with CLI 1.181.0 so scanner
68
+ errors and findings fail the job; added scanner dependency updates and
69
+ Dependabot cooldowns. ([#32])
70
+
71
+ [1.4.0]: https://github.com/catfish-1234/sessionmem/compare/a73f503123b1d33c35407ce66403f281ba3451ac...679b8954f0b49f197985c40da47f181c00060cd9
72
+ [#22]: https://github.com/catfish-1234/sessionmem/pull/22
73
+ [#23]: https://github.com/catfish-1234/sessionmem/pull/23
74
+ [#24]: https://github.com/catfish-1234/sessionmem/pull/24
75
+ [#27]: https://github.com/catfish-1234/sessionmem/pull/27
76
+ [#28]: https://github.com/catfish-1234/sessionmem/pull/28
77
+ [#29]: https://github.com/catfish-1234/sessionmem/pull/29
78
+ [#30]: https://github.com/catfish-1234/sessionmem/pull/30
79
+ [#31]: https://github.com/catfish-1234/sessionmem/pull/31
80
+ [#32]: https://github.com/catfish-1234/sessionmem/pull/32
81
+ [#33]: https://github.com/catfish-1234/sessionmem/pull/33
82
+ [#34]: https://github.com/catfish-1234/sessionmem/pull/34
83
+ [#40]: https://github.com/catfish-1234/sessionmem/pull/40
84
+ [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).