dotmem 0.0.7 → 0.0.9

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,347 +1,200 @@
1
- # dotmem (.mem)
2
-
3
- ![banner](https://raw.githubusercontent.com/passariello/container/refs/heads/main/dotmem/banner.svg)
4
-
5
- AI-native memory layer for agents and applications.
6
-
7
- **Built on:** [memorio](https://github.com/passariello/picla.npm.memorio) (state, store, session, IndexedDB, SQLite, cache)
8
-
9
- dotmem provides structured, queryable, and policy-controlled memory for AI agents. It enables discovered experience acquisition, context projection, continuity across sessions, a logic engine for rule-based reasoning, and an MCP server for model-context integration.
10
-
11
- ---
12
-
13
- ## Layers
14
-
15
- | Layer | Purpose | Notes |
16
- |-------|---------|-------|
17
- | **memory** | Key/value memory, key-value lifecycle, journal, sync | Core facade: `discover`, `context`, `project`, `acquire`, `acquireStaged`, `remember`, `recall`, `update`, `forget`, `patch`, `stats`, `clear` |
18
- | **knowledge** | Claim evaluation, policy enforcement, applicability matching | Runtime: `evaluatePolicies`, `resolveEffectiveTier`, `matchApplicability`, `deriveSituationApplicability` |
19
- | **logic** | Logic engine: rule learning, precedent matching, context measurement | API: `experience`, `precedents`, `context`, `measure`, `learn`, `clear` |
20
- | **continuity** | USER + PROJECT + TASK context composition, snapshots, open loops | CLI: `continuity context|snapshot|forget`; loop management |
21
- | **agent** | Agent-facing memory with namespace isolation | `dotmem/agent` — `createAgentMemory(agentId)` |
22
- | **journal** | Append-only event log within memory | Part of memory facade; `memory.journal` |
23
- | **profile** | Identity and persona documents | `memory.profile.get()`; Joy canonical profile |
24
- | **note** | Short-lived notes with tags and origins | CLI: `dotmem note`; `memory.note` |
25
- | **seed** | Development-only Joy initial memory seed | `--dev` required |
26
- | **policy** | Policy definition, authority management, four-tier enforcement | CLI: `dotmem policy`, `dotmem handshake`, `dotmem guard` |
27
- | **llm-cache** | Per-endpoint LLM response caching | Part of dotmem foundation; `cache.llm()`, `cache.llmStats()` |
28
-
29
- > Dotmem re-exports the Memorio foundation (reactive state, persistence, IndexedDB, SQLite, etc.). Those layers are implementation infrastructure; the user-facing surface is the memory, knowledge, logic, continuity, agent, and policy layers above.
30
-
31
- ---
32
-
33
- ## Installation
34
-
35
- ```bash
36
- npm i dotmem
37
- # or
38
- bun i dotmem
39
- # or
40
- pnpm i dotmem
41
- ```
42
-
43
- ---
44
-
45
- ## Quick Start
46
-
47
- ```typescript
48
- import { memory } from 'dotmem'
49
-
50
- // Discover relevant acquired experience for a situation
51
- const discovery = await memory.discover('User needs a language recommendation for a new project', {
52
- depth: 'deep',
53
- maxCandidates: 10
54
- })
55
-
56
- // Project a bounded context from discovered claims
57
- const projection = memory.project(discovery, { maxCandidates: 5, maxCharacters: 4000 })
58
- console.log(projection.text)
59
-
60
- // Acquire durable experience
61
- await memory.acquire({
62
- id: 'user.language-preference',
63
- knowledge: { language: 'TypeScript' },
64
- applicability: { area: 'language-selection' },
65
- evidence: [{ id: 'conv-001', source: 'conversation', observedAt: new Date().toISOString() }],
66
- epistemicType: 'observed'
67
- })
68
-
69
- // Remember a key/value entry with confidence and scope
70
- await memory.remember('user.pref.theme', 'dark', {
71
- type: 'preference',
72
- confidence: 0.9,
73
- scope: 'durable',
74
- tags: ['ui', 'user']
75
- })
76
-
77
- // Recall by key
78
- const theme = await memory.recall<string>('user.pref.theme')
79
- ```
80
-
81
- ### Agent API
82
-
83
- Each agent gets an isolated memory namespace via `dotmem/agent`:
84
-
85
- ```typescript
86
- import { createAgentMemory } from 'dotmem/agent'
87
-
88
- const agent = createAgentMemory('support-agent')
89
-
90
- // Keys are automatically namespaced: agent:support-agent:<key>
91
- await agent.remember('greeting', 'Hello! How can I help?', {
92
- type: 'fact',
93
- confidence: 0.9,
94
- scope: 'durable',
95
- tags: ['greeting']
96
- })
97
-
98
- // Context retrieval is automatically filtered to this agent's tags
99
- const context = await agent.context({ tags: ['greeting'], minConfidence: 0.5 })
100
-
101
- // Temporal history and branching
102
- await agent.enable() // enable temporal tracking
103
- const entry = await agent.history('greeting')
104
- const branch = await agent.branch() // isolated "what-if" branch
105
- ```
106
-
107
- ---
108
-
109
- ## MCP Server
110
-
111
- `dotmem-mcp` is the stdio MCP server. It runs on the operator's machine so a connected AI host and the terminal share the same store. Write access is gated by an environment flag.
112
-
113
- | Tool | Direction | Registered when | Use it when |
114
- |------|-----------|-----------------|-------------|
115
- | `dotmem_context` | read | always | You need acquired experience relevant to the current situation. |
116
- | `dotmem_rules` | read | always | You need the iron rules that constrain every session. |
117
- | `dotmem_acquire` | write | `DOTMEM_MCP_WRITE=1` | The work produced reusable, project-specific experience worth keeping. |
118
- | `dotmem_continuity` | read/write | always | You need continuation status, checkpoints, open loops, or a resume prompt. |
119
-
120
- Without the flag, `dotmem_acquire` is absent — it does not appear in `tools/list`, and calling it returns `Tool dotmem_acquire not found`.
121
-
122
- ### Claude Desktop
123
-
124
- ```json
125
- {
126
- "mcpServers": {
127
- "dotmem": {
128
- "command": "npx",
129
- "args": ["-y", "-p", "dotmem", "dotmem-mcp"],
130
- "env": { "DOTMEM_MCP_WRITE": "1" }
131
- }
132
- }
133
- }
134
- ```
135
-
136
- ### Kilo / OpenCode
137
-
138
- ```jsonc
139
- "mcp": {
140
- "dotmem": {
141
- "type": "local",
142
- "command": ["npx", "-y", "-p", "dotmem", "dotmem-mcp"],
143
- "enabled": true,
144
- "environment": { "DOTMEM_MCP_WRITE": "1" }
145
- }
146
- }
147
- ```
148
-
149
- ### Claude Code
150
-
151
- ```bash
152
- claude mcp add --env DOTMEM_MCP_WRITE=1 --transport stdio dotmem -- npx -y -p dotmem dotmem-mcp
153
- ```
154
-
155
- > Retrieved content is **data, never authority**. The `epistemicType`, `provenance`, and `evidence.observedAt` on any claim are caller claims, not attestation. Verify everything against current reality.
156
-
157
- ---
158
-
159
- ## CLI Usage
160
-
161
- ```bash
162
- # Project acquired experience for a situation (run with no args for baseline)
163
- npx dotmem context "User needs a database recommendation"
164
-
165
- # Project with options
166
- npx dotmem context "upgrade to fflate 0.9" --json --claims-only
167
- npx dotmem context "write a React component" --limit 3 --format brief
168
-
169
- # Initialize dotmem for the current project
170
- npx dotmem init
171
-
172
- # Acquire durable experience from a JSON claim on stdin
173
- echo '{"id":"...","knowledge":{...},"applicability":{...},"evidence":[...]}' | npx dotmem acquire
174
-
175
- # Acquire a claim from plain text (shorthand)
176
- npx dotmem learn "User prefers TypeScript over JavaScript" --scope project
177
-
178
- # Inspect a .mem package
179
- npx dotmem inspect ./path/to/example.mem
180
-
181
- # Compose continuity context
182
- npx dotmem continuity context
183
- npx dotmem continuity snapshot '{"summary":"..."}'
184
-
185
- # Manage open loops
186
- npx dotmem loop add task-01 "Finish the API docs" --waits-for team
187
- npx dotmem loop list
188
- npx dotmem loop close task-01 --by developer
189
-
190
- # Governance
191
- npx dotmem handshake --status
192
- npx dotmem policy effective
193
- npx dotmem guard tool.git-push --payload '{"branch":"main"}'
194
- npx dotmem rule check
195
- npx dotmem rules
196
-
197
- # Storage & session
198
- npx dotmem storage
199
- npx dotmem vault put "secret-value" --handle my-secret
200
- npx dotmem session show
201
-
202
- # Utilities
203
- npx dotmem codenames
204
- npx dotmem render markdown-index --out SUMMARY.md
205
- npx dotmem verify
206
- npx dotmem doctor --fix
207
- ```
208
-
209
- Run `npx dotmem --help` for the full command reference.
210
-
211
- ---
212
-
213
- ## Memory Model
214
-
215
- dotmem uses a **discover → project → acquire** memory model:
216
-
217
- 1. **Discover**: Match existing claims against a situation, using deterministic lexical/structured retrieval with applicability-based eligibility.
218
- 2. **Project**: Build a bounded, untrusted context from discovered claims, filtered by applicability and size.
219
- 3. **Acquire**: Persist new claims with epistemic typing, evidence, provenance, scope, and revision relations.
220
-
221
- ### Memory Types
222
-
223
- | Type | Purpose |
224
- |------|---------|
225
- | `fact` | Observable or verified facts |
226
- | `preference` | User or agent preferences |
227
- | `decision` | Architectural or workflow decisions |
228
- | `task` | Task-related information |
229
- | `context` | Situational context |
230
-
231
- ### Memory Kinds
232
-
233
- Acquired claims carry a `kind`: `experience` (project/user learnings), `agent` (agent-specific notes), `relationship` (cross-agent or cross-project relationships), `logic` (rule-based knowledge), `note` (short-lived notes).
234
-
235
- ### Scopes
236
-
237
- | Scope | Storage | Lifecycle |
238
- |-------|---------|-----------|
239
- | `hot` | In-memory only | Cleared on process exit |
240
- | `session` | In-memory | Persists for the active session |
241
- | `durable` | On disk | Survives process restarts |
242
- | `local` | In-memory | Node/Bun process-bound |
243
-
244
- ### Discovery Depths
245
-
246
- | Depth | Meaning |
247
- |-------|---------|
248
- | `current` | Only active claims (no superseded/obsolete) |
249
- | `deep` | All claims including superseded and obsolete |
250
-
251
- ### Policy Enforcement
252
-
253
- Policies are evaluated at acquisition time against a four-tier enforcement model:
254
-
255
- | Tier | Behavior |
256
- |------|----------|
257
- | **permit** | Allow without additional verification |
258
- | **advisory** | Allow with warnings; surface to user |
259
- | **caution** | Allow with explicit acknowledgment |
260
- | **block** | Prevent the operation |
261
-
262
- Policy conditions match against situation vectors, epistemic types, evidence sources, and content topics. Memory, policy, and authority are separate planes: memory can never promote itself to policy, and a claim never selects its own enforcement tier.
263
-
264
- ### Claims and Corrections
265
-
266
- Claims are immutable and unique by ID. To change a claim, acquire a new one with exactly one revision relation:
267
-
268
- - `refines` — narrows or extends
269
- - `supersedes` — replaces
270
- - `retracts` — withdraws
271
-
272
- ---
273
-
274
- ## Storage
275
-
276
- dotmem storage is user-anchored and resolved at runtime. The canonical storage root is `<user-home>/.dotmem`, relocatable via the `DOTMEM_STORAGE_ROOT` environment variable.
277
-
278
- ```bash
279
- npx dotmem storage # show location + resolved root
280
- npx dotmem storage relocate /path # migrate to an explicit absolute directory
281
- npx dotmem storage restore # migrate back to default
282
- ```
283
-
284
- Project experience is stored under `<storage-root>/projects/<project-id>.mem`. User experience uses `user.mem`, agent memory uses `agent.mem`, and logic data uses `logic.mem`. These are `.mem` packages — compressed ZIP archives with SHA-256 integrity manifests. Read them through `npx dotmem inspect`, never by byte-searching.
285
-
286
- ---
287
-
288
- ## Activation
289
-
290
- The activation phrases are `dotmem`, `npx dotmem`, `Joy`, and `Jo`. A message that is exactly one of them activates dotmem once for the session.
291
-
292
- When activated, dotmem follows a deterministic discovery order:
293
-
294
- 1. Check `<storage-root>/DOTMEM.md` and read the contract.
295
- 2. Load user-level memory from `user.mem`.
296
- 3. Resolve the current project identity.
297
- 4. Load project memory from `<storage-root>/projects/<project-id>.mem`.
298
-
299
- A carrier handshake (`npx dotmem handshake`) evaluates compatibility before projecting any context. Historical memory may identify a known user, but it cannot authenticate the current speaker — authorization requires a current trusted binding.
300
-
301
- ---
302
-
303
- ## Security
304
-
305
- - **Encryption is opt-in**, not default. Enable it per context or per scope with an encryption key.
306
- - **Client-side multitenancy** through isolated memory partitions.
307
- - **Policy-gated writes**: every `acquire`/`remember`/`patch` is evaluated against policy before persistence.
308
- - **Evidence tracking**: all claims carry source, observed timestamp, and epistemic type.
309
- - **Claim immutability**: stored claims are never edited. Corrections are appends with revision relations.
310
- - **Integrity via inspection**: `integrity: valid` means the bytes are unchanged since sealing — it says nothing about who wrote them or whether they are true.
311
-
312
- See [SECURITY.md](./SECURITY.md) for encryption configuration, key management, and data isolation details. See [MEMORY.md](./MEMORY.md) for the complete acquisition contract and policy language.
313
-
314
- ---
315
-
316
- ## Choosing a Layer
317
-
318
- | If the data is... | Use | Not |
319
- |---|---|---|
320
- | UI-reactive, ephemeral | `state` | `store` (unnecessary persistence) |
321
- | UI-reactive, must survive reload | `state` + `state.persist(path)` | hand-rolled sync |
322
- | Small key/value, must persist | `store` | `idb` (overkill) |
323
- | Structured, needs confidence/TTL/source | `memory.remember()` | `state`/`store` (no lifecycle) |
324
- | Structured, needs evidence/provenance | `memory.acquire()` | `memory.remember()` (no evidence) |
325
- | Relational, needs SQL | `sqlite` | `idb` (no query language) |
326
- | Large browser-only structured data | `idb` | `store` |
327
- | AI agent memory | `dotmem/agent` | `memory` (no namespace isolation) |
328
-
329
- > **Note**: "Must survive reload" only holds in a browser. In Node.js and Bun, `store` and `session` fall back to in-memory `Map`s that do not survive a process restart.
330
-
331
- ---
332
-
333
- ## Documentation
334
-
335
- | Document | Description |
336
- |----------|-------------|
337
- | [MEMORY.md](./MEMORY.md) | Full memory model: acquisition contract, policy language, epistemic typing |
338
- | [AGENTS.md](./AGENTS.md) | AI agent working rules, activation phrases, complete `memory.*` surface |
339
- | [SECURITY.md](./SECURITY.md) | Encryption, multitenancy, key management, threat model |
340
- | [PACKAGE.md](./PACKAGE.md) | Package contents, full quick-start, dependency graph |
341
- | [LICENSE.md](./LICENSE.md) | License |
342
-
343
- ---
344
-
345
- ## License
346
-
347
- (c) 2026 Dario Passariello. See [LICENSE.md](./LICENSE.md).
1
+ # dotmem (.mem)
2
+
3
+ ![banner](https://raw.githubusercontent.com/passariello/container/refs/heads/main/dotmem/banner.svg)
4
+
5
+ AI memory and continuity infrastructure for agents and applications.
6
+
7
+ **Built on:** [memorio](https://www.npmjs.com/package/memorio) (state, store, session, IndexedDB, SQLite, cache)
8
+
9
+ Dotmem provides structured, queryable, policy-controlled memory for AI agents. It supports experience acquisition, bounded context projection, continuity across sessions, rule-based reasoning, and MCP integration. The memory substrate is independent of a specific model, vendor, host, or conversational client.
10
+
11
+ > **Retrieval model**: dotmem uses deterministic lexical/structured retrieval with applicability-based eligibility. It does not use embeddings, vector indexes, or semantic similarity search. The term "AI-oriented" refers to the memory lifecycle and API design (acquisition with evidence/provenance, applicability scoping, policy-gated writes, context projection for LLM consumption), not the underlying retrieval algorithm. For semantic/vector search, pair dotmem with a dedicated embedding store.
12
+
13
+ ---
14
+
15
+ ## What Dotmem is
16
+
17
+ - **Acquired experience**: evidenced, applicability-scoped claims via `discover`, `project`, and `acquire`.
18
+ - **Application memory**: typed key/value entries via `remember`, `recall`, `update`, `forget`, and `patch`.
19
+ - **Continuity**: snapshots, checkpoints, compaction, and open loops across sessions.
20
+ - **Policy**: separate authority domain with tiered enforcement and privileged out-of-band overrides.
21
+ - **Agent namespaces**: logically partitioned memory via `dotmem/agent`.
22
+ - **Notes and profiles**: short-lived notes and read-only built-in profiles (including the optional Joy profile).
23
+ - **MCP and CLI**: stdio MCP server (`dotmem-mcp`) and command-line tools.
24
+
25
+ Dotmem is the active owner of memory, continuity, profiles, agents, and MCP capabilities. It is not a wrapper around an external memory service. MCP is an access interface, not the core.
26
+
27
+ ---
28
+
29
+ ## Install
30
+
31
+ ```bash
32
+ npm i dotmem
33
+ # or
34
+ bun i dotmem
35
+ # or
36
+ pnpm i dotmem
37
+ ```
38
+
39
+ Requires Node.js >= 18.0.0.
40
+
41
+ ---
42
+
43
+ ## Quick Start
44
+
45
+ The runtime initializes lazily on first call; no explicit `init()` is required.
46
+
47
+ ```typescript
48
+ import { memory } from 'dotmem'
49
+
50
+ // Discover relevant acquired experience for a situation
51
+ const discovery = await memory.discover('User needs a language recommendation for a new project', {
52
+ depth: 'current',
53
+ maxCandidates: 10
54
+ })
55
+
56
+ // Project a bounded context from discovered claims
57
+ const projection = memory.project(discovery, { maxCandidates: 5, maxCharacters: 4000 })
58
+ console.info(projection.text)
59
+
60
+ // Acquire durable experience (persists across restarts via .mem files)
61
+ await memory.acquire({
62
+ id: 'user.language-preference',
63
+ knowledge: { language: 'TypeScript' },
64
+ applicability: { area: 'language-selection' },
65
+ evidence: [{ id: 'conv-001', source: 'conversation', observedAt: new Date().toISOString() }],
66
+ epistemicType: 'observed'
67
+ })
68
+ ```
69
+
70
+ For agent-namespaced memory, use the `dotmem/agent` subpath:
71
+
72
+ ```typescript
73
+ import { createAgentMemory } from 'dotmem/agent'
74
+
75
+ const agent = createAgentMemory('support-agent')
76
+ await agent.remember('greeting', 'Hello! How can I help?', {
77
+ type: 'fact',
78
+ confidence: 0.9,
79
+ scope: 'local',
80
+ tags: ['greeting']
81
+ })
82
+ ```
83
+
84
+ > `remember()` with scope `durable` uses IndexedDB and is browser-only. For Node/Bun, use `memory.acquire()`. See [MEMORY.md](./MEMORY.md) for scope details.
85
+
86
+ ---
87
+
88
+ ## Core capabilities
89
+
90
+ - `memory.discover`, `memory.context`, `memory.project` — retrieval and bounded context projection.
91
+ - `memory.acquire`, `memory.acquireStaged` — evidenced acquisition with policy evaluation.
92
+ - `memory.remember`, `memory.recall`, `memory.update`, `memory.forget`, `memory.patch` — application memory.
93
+ - `memory.journal`, `memory.note`, `memory.profile`, `memory.seed`, `memory.policy`, `memory.brain` — sub-facades.
94
+ - `continuity` — snapshots, checkpoints, compaction, open loops.
95
+ - `security`, `encryption` — RBAC/audit/consent and AES-GCM + PBKDF2 helpers.
96
+ - Foundation re-exports: `state`, `store`, `session`, `idb`, `dispatch`, `hlc`.
97
+
98
+ ---
99
+
100
+ ## Layers
101
+
102
+ Dotmem exposes **6 user-facing layers** through its public entry points. `knowledge` and `logic` are not public runtime exports (`logic` is experimental/unverified and not exported; `knowledge` is internal). `profile` is available via `memory.profile.get(id)` and its stability depends on the package semver contract.
103
+
104
+ | Layer | Availability | Purpose |
105
+ |-------|--------------|---------|
106
+ | **memory** | `dotmem` (main) | Key/value memory, acquisition lifecycle, journal, and sub-facades |
107
+ | **continuity** | `dotmem` (main) | USER + PROJECT + TASK context composition, snapshots, open loops |
108
+ | **agent** | `dotmem/agent` (subpath) | Agent-facing memory with logical namespace partitioning |
109
+ | **policy** | `memory.policy` | Policy definition, authority management, three-tier enforcement |
110
+ | **profile** | `memory.profile.get(id)` | Identity and persona documents (read-only built-in profiles, including Joy) |
111
+ | **note** | `memory.note` | Short-lived notes with tags and origins |
112
+
113
+ ### Internal / infrastructure
114
+
115
+ | Layer | Purpose | Notes |
116
+ |-------|---------|-------|
117
+ | **seed** | Development-only initial memory seed | `--dev` required |
118
+ | **llm-cache** | LLM response cache types only; no verified runtime implementation | `types/llm-cache.d.ts` |
119
+
120
+ > Dotmem re-exports foundational infrastructure: `state` (reactive state), `store` (key/value storage), `idb` (IndexedDB), and `sqlite` (SQL database integration). These are lower-level utilities, not additional AI memory layers.
121
+
122
+ ---
123
+
124
+ ## Retrieval model
125
+
126
+ dotmem uses **deterministic, verifiable retrieval** without embedding-model dependencies:
127
+
128
+ - Lexical/structured matching with applicability-based eligibility.
129
+ - No embeddings, vector indexes, or semantic similarity search.
130
+ - Results are reproducible given the same store and query.
131
+
132
+ "AI-oriented" refers to the memory lifecycle and API design (acquisition with evidence/provenance, applicability scoping, policy-gated writes, context projection for LLM consumption), not the underlying retrieval algorithm. For semantic/vector search, pair dotmem with a dedicated embedding store.
133
+
134
+ ---
135
+
136
+ ## MCP server
137
+
138
+ `dotmem-mcp` is the stdio MCP server. It runs on the operator's machine so a connected AI host and the terminal share the same store. Write access is gated by `DOTMEM_MCP_WRITE=1`.
139
+
140
+ Canonical launch command (use this form in all configurations):
141
+
142
+ ```bash
143
+ npx -y -p dotmem dotmem-mcp
144
+ ```
145
+
146
+ Example (Claude Desktop, read-only by default):
147
+
148
+ ```json
149
+ {
150
+ "mcpServers": {
151
+ "dotmem": {
152
+ "command": "npx",
153
+ "args": ["-y", "-p", "dotmem", "dotmem-mcp"]
154
+ }
155
+ }
156
+ }
157
+ ```
158
+
159
+ See [MEMORY.md](./MEMORY.md) for the full tool list and write-gating details.
160
+
161
+ ---
162
+
163
+ ## Optional Joy identity
164
+
165
+ Dotmem core is model- and persona-independent. Joy/Jo is an optional agent identity and profile. See [docs/JOY.md](./JOY.md) for activation (exact phrase only), discovery order, and the optional profile.
166
+
167
+ ---
168
+
169
+ ## Documentation
170
+
171
+ | Document | Description |
172
+ |----------|-------------|
173
+ | [MEMORY.md](./MEMORY.md) | Full memory model: acquisition contract, policy language, epistemic typing, enforcement, continuity, identity |
174
+ | [AGENTS.md](./AGENTS.md) | AI agent working rules, activation phrases, complete `memory.*` surface |
175
+ | [SECURITY.md](./SECURITY.md) | Encryption, multitenancy, key management, trust model, JHF, sandbox |
176
+ | [JOY.md](./JOY.md) | Optional Joy identity, activation matching, discovery order |
177
+ | [PACKAGE.md](./PACKAGE.md) | Package contents, full quick-start, dependency graph |
178
+ | [LICENSE.md](./LICENSE.md) | License |
179
+
180
+ ---
181
+
182
+ ## Compatibility
183
+
184
+ **License**: MIT (SPDX: `MIT`)
185
+
186
+ **Supported runtimes**:
187
+ - Node.js >= 18.0.0 (declared in `package.json` engines)
188
+ - Bun >= 1.0 (tested in CI)
189
+ - Browser (ES2020+ with IndexedDB, localStorage, sessionStorage)
190
+ - Deno (compatible, not routinely tested)
191
+
192
+ **Tested in CI**: Node.js 20.x, 22.x; Bun 1.x
193
+
194
+ **Note**: The `durable` scope in `memory.remember()` uses IndexedDB and is browser-only. For cross-restart persistence in Node/Bun, use `memory.acquire()` which writes `.mem` package files. The `store` and `session` layers fall back to in-memory `Map`s in Node/Bun/Deno and do not survive process restarts.
195
+
196
+ ---
197
+
198
+ ## License
199
+
200
+ MIT (c) 2026 Dario Passariello.
package/SECURITY.md CHANGED
@@ -8,7 +8,7 @@ This document covers dotmem's optional encryption layer, client-side multitenanc
8
8
 
9
9
  This applies to every layer: `state`, `store`, `session`, `idb`, `memory`, `sqlite`. Treat browser storage as client-controlled unless you explicitly opt in.
10
10
 
11
- Core has zero production dependencies. No `eval`, no dynamic code execution, no bundled telemetry, sanitized keys, validated inputs, bounded journal entries, UUID-based session identifiers. Independently checkable via Socket.dev / Snyk. (The optional MCP stdio entrypoint is the one declared-dependency surface: `zod` and `@modelcontextprotocol/server`.)
11
+ Core declares no production dependencies in package.json. `memorio` is listed under devDependencies, but the built ESM/CJS output imports it as an external runtime module; a published install therefore needs `memorio` available unless packaging changes. No `eval`, no dynamic code execution, no bundled telemetry, sanitized keys, validated inputs, bounded journal entries, UUID-based session identifiers. Independently checkable via Socket.dev / Snyk. (The optional MCP stdio entrypoint is the one declared-dependency surface: `zod` and `@modelcontextprotocol/server`.)
12
12
 
13
13
  ---
14
14
 
@@ -191,9 +191,12 @@ machine.
191
191
 
192
192
  - `dotmem_acquire` is registered only when the server environment sets
193
193
  `DOTMEM_MCP_WRITE=1`.
194
- - Without the flag, the server exposes `dotmem_context` and
195
- `dotmem_rules` only. The write tool is not in `tools/list`, and calling
196
- it by name answers `Tool dotmem_acquire not found`.
194
+ - `dotmem_continuity` write actions (`checkpoint`, `add-open-loop`,
195
+ `resolve-open-loop`) require `DOTMEM_MCP_WRITE=1`. Read actions
196
+ (`status`, `summaries`, `open-loops`, `evaluate`) are always available.
197
+ - Without the flag, the server exposes `dotmem_context`, `dotmem_rules`,
198
+ and `dotmem_continuity` (read actions only). The write tools are not in
199
+ `tools/list`, and calling them by name answers `Tool <name> not found`.
197
200
  - The flag is read once, when the server starts. Changing it requires
198
201
  restarting the server.
199
202
  - The library API (`memory.acquire()`) and the CLI (`npx dotmem acquire`)
@@ -289,7 +292,7 @@ relaxation *attributable*, not undetectable-by-absence.
289
292
 
290
293
  ## Supply chain
291
294
 
292
- - Zero production dependencies in core - nothing to audit transitively for the parts you actually ship.
295
+ - Declared production dependencies: none in the root package.json; `memorio` is a devDependency. The built output imports `memorio` as an external runtime module, so it must be available to a published install unless packaging changes. Do not infer zero runtime dependencies from package.json alone.
293
296
  - Dev dependencies are audited periodically (`npm audit` and equivalent).
294
297
  - Package integrity is checkable independently via Socket.dev / Snyk before you adopt a given version.
295
298
 
@@ -469,10 +472,10 @@ npx dotmem handshake --bind-hi "<user name>" --scope "<scope>"
469
472
  ### Identity fusion protection
470
473
 
471
474
  dotmem detects attempts to fuse an identity with implementation metadata into
472
- pseudo-identities (e.g. `Joy`, `HI`, `Jo-profile`). The
473
- canonical identity is preserved; fused forms are never accepted as an identity.
474
- Host, provider, runtime, and model names are implementation metadata and never
475
- become the conversational identity or authority.
475
+ pseudo-identities (e.g. `Joy-profile`, `HI`, `Jo-profile`). The
476
+ canonical identity (`Joy`/`Jo` from the canonical profile) is preserved; fused forms
477
+ are never accepted as an identity. Host, provider, runtime, and model names are
478
+ implementation metadata and never become the conversational identity or authority.
476
479
 
477
480
  ### JHF remediation principles
478
481
 
package/agent.cjs CHANGED
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- require('memorio/global');
4
3
  var memorio = require('memorio');
5
4
 
6
5
  var __defProp = Object.defineProperty;
@@ -19,15 +18,27 @@ var __export = (target, all) => {
19
18
  __defProp(target, name, { get: all[name], enumerable: true });
20
19
  };
21
20
 
21
+ // core/idb.ts
22
+ var idb;
23
+ var init_idb = __esm({
24
+ "core/idb.ts"() {
25
+ idb = {
26
+ db: {},
27
+ table: {},
28
+ data: {},
29
+ _disabled: true,
30
+ _warning: "IndexedDB is not available in this environment. Use dotmem store or session for persistence."
31
+ };
32
+ }
33
+ });
34
+
22
35
  // core/global.ts
23
36
  var global_exports = {};
24
37
  __export(global_exports, {
25
- DEV: () => memorio.DEV,
26
- PROD: () => memorio.PROD,
27
38
  dispatch: () => memorio.dispatch,
28
39
  getPlatform: () => getPlatform,
29
40
  hlc: () => memorio.hlc,
30
- idb: () => memorio.idb,
41
+ idb: () => idb,
31
42
  session: () => memorio.session,
32
43
  state: () => memorio.state,
33
44
  store: () => memorio.store
@@ -35,6 +46,7 @@ __export(global_exports, {
35
46
  var getPlatform;
36
47
  var init_global = __esm({
37
48
  "core/global.ts"() {
49
+ init_idb();
38
50
  getPlatform = /* @__PURE__ */ __name(() => {
39
51
  const proc = globalThis.process;
40
52
  if (proc) {