dotmem 0.3.0 → 0.3.2

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 CHANGED
@@ -1,427 +1,364 @@
1
- # Dotmem (.mem)
1
+ # Dotmem
2
2
 
3
3
  ![Dotmem banner](https://raw.githubusercontent.com/passariello/container/refs/heads/main/dotmem/banner.svg)
4
4
 
5
- **Memory. Identity. Continuity.**
5
+ [![npm](https://img.shields.io/npm/v/dotmem)](https://www.npmjs.com/package/dotmem)
6
+ [![license](https://img.shields.io/npm/l/dotmem)](#license-and-disclaimer)
7
+ [![node](https://img.shields.io/node/v/dotmem)](#quick-start)
6
8
 
7
- Dotmem is an independent, local-first memory runtime for AI agents and applications. It preserves experience, context, provenance, and continuity across sessions, models, providers, and machines.
9
+ **A verifiable, local project memory for AI coding assistants.** Architecture decisions, debugging history, unfinished work and technical discussions survive sessions, models and editors.
8
10
 
9
- AI provides intelligence. Dotmem provides continuity.
11
+ Dotmem is a local-first memory and context engine for AI-powered code editors. Start a new chat, switch editors, restart your machine, or come back weeks later: your assistant can recover project architecture, technical decisions, previous discussions, debugging history, and unfinished work.
10
12
 
11
- - Evidence-based, auditable memory.
12
- - Deterministic lexical and structured retrieval.
13
- - Bounded context projection.
14
- - Policy-governed acquisition and writes.
15
- - No embeddings, vector database, or model dependency.
13
+ Type `dotmem` in your AI development chat to retrieve the relevant knowledge and keep working, without rebuilding the whole project context by hand.
16
14
 
17
- Your memory should remain under your control, independent of the model or provider you use.
15
+ **You decide what is remembered, where it lives and what gets projected into context, so you can focus on building.**
18
16
 
19
17
  ## Contents
20
18
 
21
- - [Choose your path](#choose-your-path)
22
- - [Quick start for developers](#quick-start-for-developers)
23
- - [Connect an AI host](#connect-an-ai-host)
24
- - [Core concepts](#core-concepts)
25
- - [Progressive context loading](#progressive-context-loading)
26
- - [Storage and inspection](#storage-and-inspection)
27
- - [MCP integration](#mcp-integration)
28
- - [Security and limitations](#security-and-limitations)
29
- - [Build profiles](#build-profiles)
30
- - [Compatibility](#compatibility)
31
- - [Documentation](#documentation)
32
- - [License](#license)
19
+ - [The problem](#the-problem)
20
+ - [Why Dotmem](#why-dotmem)
21
+ - [Using `dotmem` in chat](#using-dotmem-in-chat)
22
+ - [Quick start](#quick-start)
23
+ - [Memory across sessions](#memory-across-sessions)
24
+ - [Token efficiency and progressive context](#token-efficiency-and-progressive-context)
25
+ - [How it works and the trust model](#how-it-works-and-the-trust-model)
26
+ - [What's inside](#whats-inside)
27
+ - [Supported editors](#supported-editors)
28
+ - [CLI and MCP reference](#cli-and-mcp-reference)
29
+ - [Storage, privacy and security](#storage-privacy-and-security)
30
+ - [For developers: use it from code](#for-developers-use-it-from-code)
31
+ - [Roadmap and contributing](#roadmap-and-contributing)
32
+ - [License and disclaimer](#license-and-disclaimer)
33
33
 
34
34
  ---
35
35
 
36
- ## Choose your path
36
+ ## The problem
37
37
 
38
- | If you want to... | Start here |
39
- |---|---|
40
- | Use Dotmem from your own application | [Quick start for developers](#quick-start-for-developers) |
41
- | Connect a VS Code or other AI host to local Dotmem memory | [Connect an AI host](#connect-an-ai-host) |
42
- | Understand trust, retrieval, and context limits | [Core concepts](#core-concepts) |
38
+ AI coding assistants are powerful, but development conversations have a continuity problem.
43
39
 
44
- Dotmem can be used without the Joy assistant profile. Jo/Joy is an optional assistant profile, not an entry point or a requirement of the memory runtime.
40
+ While you build an application, a conversation accumulates architecture decisions, conventions, implementation details, bugs and their fixes, investigations, unfinished tasks and technical constraints. When the conversation gets too long, a new session starts, or the context is compacted, that knowledge can disappear. You then spend time and tokens explaining again what was already discussed.
45
41
 
46
- ## Quick start for developers
42
+ Dotmem gives the assistant access to persistent, structured development memory instead.
47
43
 
48
- ### Requirements
44
+ ## Why Dotmem
49
45
 
50
- - Node.js >= 20, or Bun >= 1.0.
51
- - An application that can use the Dotmem package.
46
+ | Instead of | Where it falls short | With Dotmem |
47
+ |---|---|---|
48
+ | Static rule files (`AGENTS.md`, editor rules) | Grow without bound, no history, loaded in full every time | Bounded, progressive context (L0-L3) built from stored claims |
49
+ | Editor-built-in memory | Tied to one editor or account | Editor-independent: it follows the project through MCP |
50
+ | Chat history and automatic compaction | Lost on new sessions or editors; summaries drift | Checkpoints and open loops that survive sessions and editors |
51
+ | Plain notes | Unstructured, no provenance, hard to retrieve selectively | Structured claims with evidence, scope and a trust basis |
52
+ | A vector database | Needs an embedding model; results are not reproducible | Deterministic, local retrieval, with no embedding model (but no semantic matching) |
52
53
 
53
- ### Install
54
+ **Trade-offs.** Dotmem needs the MCP server and one rule line in your editor to work reliably, and retrieval is keyword-based: synonyms and paraphrases are not guaranteed to match. In return it is **local-first** (no cloud, no telemetry), **editor-independent** and **correctable**: claims are immutable, and changes are new claims that refine, supersede or retract.
54
55
 
55
- ```bash
56
- npm install dotmem
57
- ```
56
+ ## Using `dotmem` in chat
58
57
 
59
- With Bun:
58
+ You talk to your assistant as usual and use `dotmem` when you want it to consult or update the project memory:
60
59
 
61
- ```bash
62
- bun add dotmem
60
+ ```text
61
+ dotmem what is the architecture of this app?
62
+ dotmem why did we choose SQLite for the storage layer?
63
+ dotmem resume the login refactor
64
+ dotmem what bugs did we fix in the auth flow?
65
+ dotmem remember: no JSX, we use React.createElement
66
+ dotmem save a checkpoint, I'm stopping for today
63
67
  ```
64
68
 
65
- `dotmem` is sufficient for the memory API shown here. `memorio` is an optional companion package; add it only if your application or integration directly uses Memorio's state and persistence APIs:
66
-
67
- ```bash
68
- npm install memorio
69
- ```
69
+ > **Saving requires write mode.** The last two examples write to your memory store. Dotmem is read-only by default, so they only work after you enable `DOTMEM_MCP_WRITE=1` ([Quick start, step 3](#3-allow-saving-optional)). Reading examples work out of the box.
70
70
 
71
- ### Your first memory
71
+ Typical uses:
72
72
 
73
- The example stores a language preference and then retrieves it using a matching term. Dotmem retrieval is lexical and structured, so this avoids relying on synonym or semantic matching.
73
+ - Recover the architecture of the current application.
74
+ - Recall earlier discussions about a component.
75
+ - Retrieve technical decisions and their rationale.
76
+ - Resume unfinished implementation work.
77
+ - Recall debugging sessions and solutions.
78
+ - Check project conventions, open issues and pending tasks.
74
79
 
75
- ```typescript
76
- import { memory } from 'dotmem'
80
+ Illustrative session (output shortened):
77
81
 
78
- await memory.acquire({
79
- id: 'user.language-preference',
80
- knowledge: { language: 'TypeScript' },
81
- applicability: { area: 'language-selection' },
82
- evidence: [{
83
- id: 'example-001',
84
- source: 'application',
85
- observedAt: new Date().toISOString()
86
- }],
87
- epistemicType: 'observed'
88
- })
89
-
90
- const discovery = await memory.discover(
91
- 'TypeScript',
92
- { depth: 'current', maxCandidates: 10 }
93
- )
94
-
95
- const projection = memory.project(discovery, {
96
- maxCandidates: 8,
97
- maxCharacters: 4000
98
- })
99
-
100
- console.log(projection.text)
82
+ ```text
83
+ you: dotmem why did we choose SQLite for the storage layer?
84
+ assistant: [calls dotmem_context] According to the stored decision, SQLite was
85
+ chosen for zero-config local storage. Trust basis: evidenced.
86
+ Related open loop: migrate the legacy JSON store.
101
87
  ```
102
88
 
103
- This is a lexical example, not a demonstration of semantic search. A successful matching discovery is projected into `projection.text`; the exact text depends on the claim's eligibility and the runtime's projection rules.
89
+ The assistant remains responsible for reasoning and writing code. Dotmem supplies the persistent knowledge that lets it work with better context.
104
90
 
105
- The runtime initializes lazily on first use. No explicit `init()` is required.
91
+ > `dotmem` in a message is an instruction to the assistant, not a built-in command. It works once the Dotmem MCP server is registered **and** the one-line rule from [Quick start, step 1](#1-register-the-mcp-server-and-add-the-rule) is in place. Without that rule the assistant may sometimes ignore the prefix. Dotmem does not install or configure anything by itself.
106
92
 
107
- In Node.js and Bun, `memory.acquire()` persists durable experience as `.mem` files. An empty store, an ineligible claim, or a query with no lexical/structured match can produce an empty discovery.
93
+ ## Quick start
108
94
 
109
- ### Which API should I use?
95
+ You need Node.js 22.5 or newer (or Bun 1.0 or newer).
110
96
 
111
- | Purpose | API |
112
- |---|---|
113
- | Acquire durable knowledge | `memory.acquire()` |
114
- | Review before acquisition | `memory.acquireStaged()` |
115
- | Retrieve relevant experience | `memory.discover()` |
116
- | Build bounded context | `memory.project()` |
117
- | Key/value memory | `remember()` / `recall()` |
118
- | Agent-specific memory | `createAgentMemory()` |
119
- | Short-lived notes | `memory.note` |
120
- | Session continuity | `continuity` |
121
- | Write authorization | `memory.policy` |
122
-
123
- **Persistence note:** On Node.js and Bun, use `memory.acquire()` for durable claims. Key/value persistence depends on the selected scope and runtime. See [MEMORY.md](./MEMORY.md).
97
+ ### 1. Register the MCP server and add the rule
124
98
 
125
- ---
126
-
127
- ## Connect an AI host
128
-
129
- Dotmem can provide local memory and continuity to a compatible AI agent host, including a VS Code extension that supports MCP.
130
-
131
- ### 1. Install Dotmem
99
+ **a) Pick a version.** Pinning keeps your setup reproducible and avoids running unreviewed updates:
132
100
 
133
101
  ```bash
134
- npm install -g dotmem
102
+ npm view dotmem version
135
103
  ```
136
104
 
137
- Memorio is optional. Install it separately only when your application or integration uses its APIs.
138
-
139
- ### 2. Configure the MCP server in your host
140
-
141
- Global installation does **not** automatically register an MCP server. The host must be configured to launch `dotmem-mcp`. Start with read-only access; write tools should be enabled only when deliberately needed. Follow the [MCP integration](#mcp-integration) instructions and use the configuration format supported by your AI host.
142
-
143
- ### 3. Start a conversation
105
+ Use that number in place of `<version>` below.
144
106
 
145
- Once the MCP server is configured, check your host's MCP tool list and verify that `dotmem_context` appears among the available Dotmem tools. Invoke it once and confirm that the host receives a response. This is the basic integration check.
107
+ **b) Add Dotmem to your editor's MCP configuration.**
146
108
 
147
- If the optional Joy assistant profile is installed and selected, `Hi Jo!` can be used to address that assistant profile. The phrase is not required to activate Dotmem and does not configure MCP.
109
+ macOS / Linux:
148
110
 
149
- The word `dotmem` can be used as a conversational instruction, but it is not a substitute for installing or configuring the MCP server.
150
-
151
- ### Requirements
152
-
153
- - Node.js >= 20.
154
- - VS Code or another compatible AI agent host.
155
- - MCP support enabled in that host.
156
- - `dotmem-mcp` registered in the host configuration.
157
- - Local Dotmem storage accessible to the machine running the MCP server.
158
-
159
- ---
111
+ ```json
112
+ {
113
+ "mcpServers": {
114
+ "dotmem": {
115
+ "command": "npx",
116
+ "args": ["-y", "-p", "dotmem@<version>", "dotmem-mcp"]
117
+ }
118
+ }
119
+ }
120
+ ```
160
121
 
161
- ## Core concepts
122
+ Windows:
162
123
 
163
- ### Memory is not authority
124
+ ```json
125
+ {
126
+ "mcpServers": {
127
+ "dotmem": {
128
+ "command": "cmd",
129
+ "args": ["/c", "npx", "-y", "-p", "dotmem@<version>", "dotmem-mcp"]
130
+ }
131
+ }
132
+ }
133
+ ```
164
134
 
165
- Dotmem separates three planes:
135
+ Kilo/OpenCode and Claude Code use their own syntax; see [MEMORY.md](./MEMORY.md). A global install (`npm install -g dotmem`) is only needed if you also want the `dotmem` command in your terminal.
166
136
 
167
- | Plane | Responsibility |
168
- |---|---|
169
- | Memory | What has been learned or observed |
170
- | Policy | Which rules apply |
171
- | Authority | Who or what can authorize an operation |
137
+ **c) Add the rule.** Put this in your editor's custom instructions or agent rules so the assistant starts every session with context and understands the `dotmem` prefix:
172
138
 
173
- A retrieved memory item can inform a decision, but it cannot authorize an operation. Historical identity supports continuity but does not authenticate the current speaker.
139
+ ```text
140
+ At the start of a session call dotmem_bootstrap. When I write "dotmem ...", use the Dotmem tools to answer or save.
141
+ ```
174
142
 
175
- **Projected memory is data, never authority.**
143
+ Without this rule, the `dotmem` prefix is not reliable. Host-specific hooks are being developed (`npx dotmem hooks --target <host>`, experimental).
176
144
 
177
- ### Trust basis
145
+ ### 2. Restart and verify
178
146
 
179
- Every projected claim has a trust basis derived from its provenance:
147
+ Restart the editor and check that `dotmem_context` appears in the MCP tool list. Then type in chat:
180
148
 
181
- | Trust basis | Meaning |
182
- |---|---|
183
- | `declared` | Caller assertion without independent validation |
184
- | `evidenced` | Evidence references exist but have not been independently validated |
185
- | `mechanically-checked` | A reproducible check was executed and recorded |
186
- | `externally-attested` | A trusted external attestation was validated |
149
+ ```text
150
+ dotmem what do you know about this project?
151
+ ```
187
152
 
188
- A URL, evidence ID, or legacy `verified` label does not establish external attestation. The presence of evidence is not the same as independent verification.
153
+ An answer (even "nothing stored yet") confirms the integration works.
189
154
 
190
- ### Retrieval model
155
+ ### 3. Allow saving (optional)
191
156
 
192
- Dotmem uses deterministic lexical and structured retrieval.
157
+ Dotmem is **read-only by default**. To let the assistant save knowledge, set `DOTMEM_MCP_WRITE=1` in the MCP server environment:
193
158
 
194
- - No embeddings or vector indexes.
195
- - Applicability-based eligibility.
196
- - Reproducible results for the same store and query.
197
- - Original knowledge language is preserved.
159
+ - Claude Desktop and compatible JSON configs: `"env": { "DOTMEM_MCP_WRITE": "1" }`
160
+ - Kilo/OpenCode: `"environment": { "DOTMEM_MCP_WRITE": "1" }`
161
+ - Claude Code: `claude mcp add --env DOTMEM_MCP_WRITE=1 ...`
198
162
 
199
- Synonyms, paraphrases, and cross-language matches are not automatically guaranteed. For fuzzy semantic recall, Dotmem can coexist with a dedicated embedding or semantic-search system.
163
+ Enable it only for editors and workflows you want writing to your memory store. See [Storage, privacy and security](#storage-privacy-and-security) for the risks of enabling write mode.
200
164
 
201
- ### Design principles
165
+ ### Troubleshooting
202
166
 
203
- 1. **User-owned memory.** No provider owns or locks it in.
204
- 2. **Provider independence.** Models and hosts do not define identity or continuity.
205
- 3. **Memory is not authority.** Retrieval never turns a claim into policy.
206
- 4. **Identity survives the carrier.** Runtime metadata cannot redefine canonical identity.
207
- 5. **Provenance matters.** Labels are not proof.
208
- 6. **Memory stays correctable.** Revision, supersession, and retraction are explicit.
209
- 7. **Honest boundaries.** Dotmem states what it knows and what it cannot enforce.
167
+ | Problem | Try |
168
+ |---|---|
169
+ | Tools don't appear | Restart the editor; check the JSON; on Windows use the `cmd /c` form. |
170
+ | Install or startup fails with a module error | Check `node -v`: Node.js 22.5 or newer is required (or Bun 1.0+). |
171
+ | Editor can't find `npx` | GUI apps may not inherit your shell `PATH`; use the full path to `npx`. |
172
+ | "Nothing stored" | Normal on first use, or your words don't match the stored note. |
173
+ | Nothing gets saved | Write mode is off (step 3). |
174
+ | The assistant ignores `dotmem ...` | The rule from step 1c is missing or not loaded by your editor. |
175
+ | Terminal and chat see different memory | Set the same `DOTMEM_STORAGE_ROOT` for both. |
210
176
 
211
177
  ---
212
178
 
213
- ## Progressive context loading
214
-
215
- Dotmem can progressively load context according to the session's configured loading profile and progress.
179
+ ## Memory across sessions
216
180
 
217
- | Level | Purpose | Projection limit |
218
- |---|---|---:|
219
- | L0 | Minimal startup | 0 claims |
220
- | L1 | Initial context | 5 candidates / 900 characters |
221
- | L2 | Expanded context | 12 candidates / 3,000 characters |
222
- | L3 | Deep context | 20 candidates / 6,000 characters |
181
+ Stop working, come back later, open a new conversation and continue the same application. The assistant can retrieve what the project is, what has been implemented, which decisions were made, which problems remain and what comes next.
223
182
 
224
- ### Loading profiles
183
+ Continuity is not a separate engine. It is built on the same discover, project and acquire model described in [How it works](#how-it-works-and-the-trust-model): events and checkpoints are stored as acquired claims, and resuming reads them back as bounded context. On top of that, the continuity layer follows this cycle:
225
184
 
226
- The profile determines the maximum automatic loading level:
185
+ `capture -> checkpoint -> compact -> resume -> verify`
227
186
 
228
- - **SHORT**: maximum L1.
229
- - **MEDIUM**: maximum L2.
230
- - **LONG**: can progress to L3 from turn 6 onward.
187
+ It keeps checkpoints, summaries and open loops. It restores what was captured: it is a working summary to verify, not a perfect replay of past conversations.
231
188
 
232
- The profile (SHORT, MEDIUM, or LONG) is supplied to Dotmem's session-loading policy; it is not inferred from the user's wording or from the contents of a query. A *turn* is a conversation turn counted by the session metrics used by Dotmem. The LONG profile does not mean that every session immediately loads L3; the session must reach the configured progression threshold.
189
+ ## Token efficiency and progressive context
233
190
 
234
- The mechanism that selects the profile is host/integration-specific. Configure it in the component that supplies session metrics to Dotmem.
191
+ Dotmem does not load everything into every conversation. It keeps initial context compact and expands only when the task needs it.
235
192
 
236
- After a summary restart, automatic progression returns to L1.
237
-
238
- The complete projection remains available explicitly through `--full`. L3 is bounded and is not equivalent to a complete memory dump.
193
+ | Level | Purpose | Limit |
194
+ |---|---|---|
195
+ | L0 | Startup with rules only | 0 claims |
196
+ | L1 | Initial context | 5 claims / 900 characters |
197
+ | L2 | Expanded context | 12 claims / 3,000 characters |
198
+ | L3 | Deep context | 20 claims / 6,000 characters |
239
199
 
240
- ### Useful CLI commands
200
+ The session profile sets the maximum level: SHORT up to L1, MEDIUM up to L2, LONG up to L3 from turn 6. The profile is supplied by the host or integration, not inferred from your wording.
241
201
 
242
- ```bash
243
- npx dotmem
244
- npx dotmem --level 1
245
- npx dotmem --level 2
246
- npx dotmem --level 3
247
- npx dotmem --summary-restart
248
- npx dotmem --full
249
- ```
202
+ <!-- TODO: state the level applied when the host supplies no profile (or say that there is no default). -->
250
203
 
251
- ---
204
+ After a summary restart, progression returns to L1. `--full` returns the complete projection on request.
252
205
 
253
- ## Storage and inspection
206
+ Each response is bounded in size. Dotmem cannot control how often a model decides to call a tool.
254
207
 
255
- ### Location
208
+ **Savings should be measured, not claimed.** Run `npx dotmem stats --tokens` to see the real footprint of what Dotmem projects in your project. Measurements stay local.
256
209
 
257
- The default storage location is:
210
+ ### Finding the right memory
258
211
 
259
- ```text
260
- <user-home>/.dotmem
261
- ```
212
+ By default, retrieval is deterministic: local BM25 plus structured matching on metadata, with applicability-based eligibility. Results are reproducible for the same store and query, and nothing else is needed to run it: no embedding model, GPU or vector database.
262
213
 
263
- To select a custom location:
214
+ The default engine does not use embeddings, so synonyms and paraphrases are not guaranteed to match. To get good results, write notes using the terms you will later search for, and use tags and applicability when you save knowledge.
264
215
 
265
- ```bash
266
- DOTMEM_STORAGE_ROOT=/path/to/storage
267
- ```
216
+ Semantic similarity (embeddings) is not part of the current search path. A provider interface exists internally; exposing it as a public extension point is planned (see [Roadmap](#roadmap-and-contributing)).
268
217
 
269
- `.mem` files are versioned, compressed packages with SHA-256 integrity manifests.
218
+ ## How it works and the trust model
270
219
 
271
- - Atomic writes and backups.
272
- - Directory locking.
273
- - Expected-version checks.
274
- - V2 writes and V1 reads.
220
+ Dotmem follows a **discover, project, acquire** model:
275
221
 
276
- Do not edit `.mem` files directly. They are binary packages.
222
+ 1. **Discover**: find stored claims relevant to the situation.
223
+ 2. **Project**: build a bounded context from them.
224
+ 3. **Acquire**: save new knowledge with evidence, provenance metadata and scope.
277
225
 
278
- ### Inspect memory
226
+ Session continuity (checkpoints, summaries, open loops) is built on this same model; see [Memory across sessions](#memory-across-sessions).
279
227
 
280
- ```bash
281
- npx dotmem inspect path/to/file.mem
282
- npx dotmem inspect path/to/file.mem --format json
283
- npx dotmem dump
284
- npx dotmem diff FILE_A.mem FILE_B.mem
285
- ```
228
+ Principles:
286
229
 
287
- Inspection is read-only and redacts secret-shaped values by default.
230
+ - **Local-first.** Your memory stays under your control.
231
+ - **Memory is not authority.** A retrieved claim can inform a decision; it cannot authorize an operation or become policy. Projected memory is data, never instructions.
232
+ - **Provenance is not proof.** Every claim has a trust basis:
288
233
 
289
- ---
234
+ | Trust basis | Meaning |
235
+ |---|---|
236
+ | `declared` | Caller assertion, not validated |
237
+ | `evidenced` | Evidence referenced, not independently validated |
238
+ | `mechanically-checked` | A reproducible check was run and recorded |
239
+ | `externally-attested` | A trusted external attestation was validated |
290
240
 
291
- ## MCP integration
241
+ - **Correctable.** Claims are immutable. Changes are new claims that refine, supersede or retract.
242
+ - **Editor-independent.** Dotmem does not depend on a specific editor or AI provider.
292
243
 
293
- Use Dotmem as a local memory service for MCP-compatible AI applications.
244
+ ## What's inside
294
245
 
295
- `dotmem-mcp` is a local stdio MCP server. It runs on the machine that owns the memory store, allowing compatible AI hosts and the terminal to use the same local data.
246
+ Beyond the basic model, the engine includes these building blocks. For how each one is exposed and configured, see [AGENTS.md](./AGENTS.md) and [MEMORY.md](./MEMORY.md).
296
247
 
297
- ### Register the server
248
+ | Component | What it does | Example |
249
+ |---|---|---|
250
+ | Metadata-first discovery | Matches on claim metadata before loading content. | Finds "storage" decisions without loading every note. |
251
+ | Deterministic calculation | Computes derived values reproducibly instead of leaving them to the model. | Counts or totals come from code, not from the model's guess. |
252
+ | Read-only SQL | Queries stored data without being able to modify it. | Ask "how many open loops per area?" safely. |
253
+ | Epistemic state machine | Tracks the state of each claim and how it changes when evidence changes. | A claim becomes stale when its evidence is superseded. |
254
+ | SSOT | Keeps a single source of truth for each piece of knowledge. | One canonical claim for "which database we use". |
255
+ | Continuous attention | Monitors registered sources and reassesses affected claims. | Flags a claim when a watched file changes. |
256
+ | Privacy gate | Controls what is allowed into the projected context. | Secret-shaped values never reach the prompt. |
298
257
 
299
- For a quick trial, use the current published package. This unpinned configuration can resolve a different package version on a later launch, so its behavior may change between runs:
258
+ Python is optional and is not required for normal use.
300
259
 
301
- ```json
302
- {
303
- "mcpServers": {
304
- "dotmem": {
305
- "command": "npx",
306
- "args": ["-y", "-p", "dotmem", "dotmem-mcp"]
307
- }
308
- }
309
- }
310
- ```
260
+ ## Supported editors
311
261
 
312
- For repeatable deployments, check the current published version with:
262
+ Dotmem works through MCP. Configuration is documented for **VS Code with MCP-capable AI extensions, Kilo/OpenCode, Claude Code and Claude Desktop**. Any other MCP-compatible AI editor or assistant should work with the generic configuration above.
313
263
 
314
- ```bash
315
- npm view dotmem version
316
- ```
264
+ ## CLI and MCP reference
317
265
 
318
- Then replace `dotmem` in the configuration with `dotmem@<version>` using the exact version returned by the command.
319
-
320
- Restart the AI host and verify that the Dotmem tools are available.
321
-
322
- ### Available tools
266
+ ### MCP tools
323
267
 
324
268
  | Tool | Access | Purpose |
325
269
  |---|---|---|
326
- | `dotmem_context` | Read | Retrieve relevant context |
327
- | `dotmem_rules` | Read | Retrieve operating rules |
328
- | `dotmem_bootstrap` | Read | Unified context and rules bootstrap |
270
+ | `dotmem_bootstrap` | Read | Load context and rules in one call |
271
+ | `dotmem_context` | Read | Retrieve claims relevant to a situation |
272
+ | `dotmem_rules` | Read | Retrieve the operating rules |
329
273
  | `dotmem_inspect` | Read | Inspect memory packages and stores |
330
- | `dotmem_acquire` | Write | Acquire durable experience |
331
- | `dotmem_verify` | Write | Execute supported verification probes |
332
- | `dotmem_continuity` | Read / conditional write | Manage checkpoints and open loops |
274
+ | `dotmem_continuity` | Read / conditional write | Status, summaries, open loops; checkpoints need write access |
275
+ | `dotmem_search` | Read | Local BM25 search over claims and archives |
276
+ | `dotmem_archive` | Read / conditional write | File-backed `.arch.mem` archive operations |
277
+ | `dotmem_acquire` | Write | Save durable knowledge |
278
+ | `dotmem_verify` | Write | Run supported verification probes |
333
279
 
334
- ### Read-only by default
280
+ Write tools are registered only with `DOTMEM_MCP_WRITE=1`.
335
281
 
336
- Write tools are registered only when explicitly enabled. The default configuration above does not set the write flag.
337
-
338
- To enable write tools, set this environment variable in the MCP server process:
282
+ ### CLI
339
283
 
340
284
  ```bash
341
- DOTMEM_MCP_WRITE=1
285
+ npx dotmem # project context (L1 by default)
286
+ npx dotmem --level 2 # expanded context (1, 2 or 3)
287
+ npx dotmem --full # complete projection
288
+ npx dotmem inspect FILE.mem # read-only inspection
289
+ npx dotmem dump
290
+ npx dotmem diff FILE_A.mem FILE_B.mem
291
+ npx dotmem stats --tokens # measure token footprint
342
292
  ```
343
293
 
344
- Only enable it for hosts and workflows that are intended to write to the local memory store.
345
-
346
- ### Host configuration
294
+ Other commands are experimental and may change (for example `hooks`, `snapshot`, `sync`, `probe`). Run `npx dotmem <command> --help` for the current list.
347
295
 
348
- The generic stdio configuration above is the reference shape. Host-specific configuration syntax, Windows launch details, and write-enabled variants are maintained in [MEMORY.md](./MEMORY.md), so this README does not duplicate instructions that can drift between clients.
296
+ A separate binary, `dotmem-burst-stats`, is a local usage-statistics helper.
349
297
 
350
- ### Deployment notes
298
+ ## Storage, privacy and security
351
299
 
352
- - The MCP server must run on the machine that owns the memory store.
353
- - The CLI and MCP server must resolve the same storage root when they are expected to share memory.
354
- - Hosted AI environments do not automatically share your local filesystem.
355
- - GUI clients may not inherit your shell's `PATH`; use an explicit executable path or a suitable launcher when necessary.
356
- - MCP stdio is a local process integration; it is not a publicly hosted remote endpoint.
300
+ Default location (change with `DOTMEM_STORAGE_ROOT=/path/to/folder`):
357
301
 
358
- See [AGENTS.md](./AGENTS.md) for agent integration rules and [MEMORY.md](./MEMORY.md) for the complete memory and MCP reference.
359
-
360
- ---
302
+ ```text
303
+ <user-home>/.dotmem
304
+ ```
361
305
 
362
- ## Security and limitations
306
+ `.mem` files are compressed packages with SHA-256 integrity manifests, atomic writes, backups and directory locking. Do not edit them by hand; use `npx dotmem inspect`. Inspection is read-only and redacts secret-shaped values by default.
363
307
 
364
- Dotmem is designed to preserve user control and make its boundaries explicit.
308
+ - `.mem` files are **not encrypted at rest**. SHA-256 is an integrity check, not access control.
309
+ - **Never save** API keys, passwords, tokens, `.env` contents or private customer data.
310
+ - Dotmem is not a secrets manager, an encrypted backup or an authorization system.
311
+ - Dotmem governs what is projected into context, not how the model behaves.
312
+ - No conversation text or project content is sent anywhere for telemetry.
365
313
 
366
- - `.mem` files and vault data are **not encrypted at rest**.
367
- - SHA-256 integrity is not encryption or access control.
368
- - Filesystem permissions are enforced by the operating system.
369
- - Retrieval is lexical and structured, not semantic.
370
- - Dotmem governs context projection, not downstream model behavior.
371
- - Shared storage coordination is not a distributed transaction system.
372
- - No formal uptime or scalability SLA is provided.
314
+ **Write mode and prompt injection.** Projected memory is treated as data, but a model can still be influenced by what it reads. If write mode is on, a note saved from untrusted content (a web page, a third-party file, a pasted message) may later be retrieved and steer the assistant. Keep write mode off unless you need it, review what gets saved with `npx dotmem inspect`, and prefer claims with evidence over `declared` ones when it matters.
373
315
 
374
- Do not use Dotmem as a replacement for an encrypted backup solution, secrets manager, or database authorization system.
316
+ **Supply chain.** Pin the package version in your MCP configuration (see [Quick start, step 1](#1-register-the-mcp-server-and-add-the-rule)) so an editor restart never runs a version you have not reviewed.
375
317
 
376
318
  See [SECURITY.md](./SECURITY.md).
377
319
 
378
- ---
320
+ ## For developers: use it from code
379
321
 
380
- ## Build profiles
381
-
382
- Dotmem core is independent of assistant identity and branding.
322
+ ```bash
323
+ npm install dotmem # or: bun add dotmem
324
+ ```
383
325
 
384
- The product owner selects the assistant profile at build time. Profiles are embedded in the build artifact and cannot be changed by end users at runtime.
326
+ ```typescript
327
+ import { memory } from 'dotmem'
385
328
 
386
- The default build uses the Joy profile. Joy is a selectable profile, not a mandatory identity of the Dotmem runtime.
329
+ await memory.acquire({
330
+ id: 'user.language-preference',
331
+ knowledge: { language: 'TypeScript' },
332
+ applicability: { area: 'language-selection' },
333
+ evidence: [{ id: 'example-001', source: 'application', observedAt: new Date().toISOString() }],
334
+ epistemicType: 'observed'
335
+ })
387
336
 
388
- See [AI.md](./context/templates/AI.md).
337
+ const discovery = await memory.discover('TypeScript', { depth: 'current', maxCandidates: 10 })
338
+ const projection = memory.project(discovery, { maxCandidates: 8, maxCharacters: 4000 })
389
339
 
390
- ---
340
+ console.info(projection.text)
341
+ ```
391
342
 
392
- ## Compatibility
343
+ The runtime initializes lazily. On Node.js and Bun, `memory.acquire()` persists claims as `.mem` files. An empty store or a query with no match yields an empty discovery. Full API, policies and persistence details: [MEMORY.md](./MEMORY.md) and [AGENTS.md](./AGENTS.md).
393
344
 
394
345
  | Runtime | Status |
395
346
  |---|---|
396
- | Node.js >= 20 | Supported and tested |
347
+ | Node.js >= 22.5 | Supported and tested |
397
348
  | Bun >= 1.0 | Supported and tested |
398
349
  | Browser | ES2020+ with browser storage APIs |
399
350
  | Deno | Compatible, not routinely tested |
400
351
 
401
- Persistence behavior differs by runtime. See [MEMORY.md](./MEMORY.md).
402
-
403
- ## Documentation
404
-
405
- | Document | Description |
406
- |---|---|
407
- | [MEMORY.md](./MEMORY.md) | Memory model, acquisition, policy, continuity and MCP |
408
- | [AGENTS.md](./AGENTS.md) | Agent integration and operating rules |
409
- | [SECURITY.md](./SECURITY.md) | Security and trust model |
410
- | [AI.md](./context/templates/AI.md) | Assistant profiles and operating contract |
411
- | [PACKAGE.md](./PACKAGE.md) | Package contents and dependency details |
412
-
413
- ## Project direction
414
-
415
- Dotmem is developed as independent memory and continuity infrastructure.
352
+ ## Roadmap and contributing
416
353
 
417
- Its direction includes reliable cross-session continuity, portable memory, stronger evidence and verification workflows, transparent memory inspection, efficient context projection, and durable lifecycle management.
354
+ Direction, in priority order: retrieval quality and relevance, compact and progressive context, seamless interaction from chat, automatic session initialization, persistent project continuity, measured token savings, reliable project and user memory, more editor integrations. These are objectives, not a statement that every capability already exists. Planned (not yet available): end-to-end evidence lineage tracking; public semantic provider extension point.
418
355
 
419
- These objectives do not imply that every capability is already implemented.
356
+ Issues and contributions are welcome; see [CHANGELOG.md](./CHANGELOG.md) for release history.
420
357
 
421
- ## License
358
+ ## License and disclaimer
422
359
 
423
- MIT - Copyright (c) 2026 Dario Passariello.
360
+ MIT - Copyright (c) 2026 Dario Passariello. SPDX-License-Identifier: `MIT`
424
361
 
425
- SPDX-License-Identifier: `MIT`
362
+ **Outputs of AI systems using Dotmem can be wrong or incomplete.** Verify critical information independently, and do not store sensitive or confidential data in unencrypted memory.
426
363
 
427
- Disclaimer: THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. Outputs of AI systems using Dotmem can be wrong or incomplete. Verify critical information independently, and do not store sensitive or confidential data in unencrypted memory.
364
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.