dotmem 0.0.7 → 0.0.8
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/AGENTS.md +66 -16
- package/DOTMEM.md +539 -41
- package/LICENSE.md +4 -16
- package/MEMORY.md +99 -11
- package/PACKAGE.md +1 -3
- package/README.md +417 -347
- package/SECURITY.md +12 -9
- package/agent.cjs +16 -4
- package/agent.js +16 -4
- package/cli.cjs +3995 -4671
- package/cli.js +3653 -4263
- package/env.cjs +6 -0
- package/env.js +4 -0
- package/global.cjs +49 -44
- package/global.d.ts +13 -14
- package/global.js +41 -25
- package/index.cjs +1465 -21195
- package/index.js +1437 -21176
- package/llms.txt +42 -36
- package/mcp.cjs +1747 -36854
- package/mcp.js +1730 -36833
- package/package.json +5 -7
- package/types/exports.d.ts +297 -304
- package/COPYRIGHT.md +0 -4
- package/types/bun-sqlite.d.ts +0 -14
package/MEMORY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# dotmem Memory
|
|
2
2
|
|
|
3
|
-
> **Status:** Current API reference for dotmem 0.0.
|
|
3
|
+
> **Status:** Current API reference for dotmem 0.0.8.
|
|
4
4
|
|
|
5
5
|
dotmem has two distinct memory facilities on one `memory` object:
|
|
6
6
|
|
|
@@ -40,10 +40,39 @@ new code should simply call the operation it needs.
|
|
|
40
40
|
|
|
41
41
|
## Deterministic AI activation
|
|
42
42
|
|
|
43
|
-
The activation phrases are `dotmem`, `
|
|
43
|
+
The activation phrases are `dotmem`, `.mem`, `load dotmem`, `Joy`, and `Jo`. A message that is exactly one
|
|
44
44
|
of them, ignoring case, surrounding whitespace, and trailing punctuation, activates dotmem once
|
|
45
45
|
for the session.
|
|
46
46
|
|
|
47
|
+
### What are Joy and Jo?
|
|
48
|
+
|
|
49
|
+
**Joy** is the canonical AI identity/profile for dotmem — the operational role name that comes from
|
|
50
|
+
the profile, not from the runtime. **Jo** is an alternative shorthand for the same identity. They
|
|
51
|
+
represent the assistant's persistent identity in the dotmem system (canonical profile, decision-making
|
|
52
|
+
behavior, trust model, and relationship style).
|
|
53
|
+
|
|
54
|
+
The canonical profile (`core/profile/`) defines:
|
|
55
|
+
- **Identity & behavior** (`behavior.md`, `soul.md`) — character, relationship style, conversational behavior
|
|
56
|
+
- **Trust model** (`trust.md`) — epistemic standards, verification requirements
|
|
57
|
+
- **Decision framework** (`decision.md`) — how Jo evaluates and makes technical decisions
|
|
58
|
+
- **Curiosity & learning** (`curiosity.md`) — what Jo seeks to understand and remember
|
|
59
|
+
- **Language conventions** (`language.md`) — communication style
|
|
60
|
+
|
|
61
|
+
When activated via `Joy` or `Jo`, dotmem loads this canonical profile as part of the deterministic
|
|
62
|
+
discovery order. The profile is optional for basic memory operations but required for
|
|
63
|
+
identity-gated features (carrier handshake, authority binding).
|
|
64
|
+
|
|
65
|
+
### Activation Behavior
|
|
66
|
+
|
|
67
|
+
Activation matching is **exact phrase only** (case-insensitive, trimmed, trailing punctuation ignored):
|
|
68
|
+
- ✅ `Joy`, `joy`, `Joy.`, ` Joy `, `Jo`, `jo`, `Jo!`
|
|
69
|
+
- ❌ `Hello Joy`, `Joyful`, `Joytron`, `My name is Jo`, `Joanna`
|
|
70
|
+
|
|
71
|
+
Ordinary mentions of a name (e.g., "Jo said...") do not trigger activation. The matcher requires
|
|
72
|
+
the entire message to be exactly one of the activation phrases.
|
|
73
|
+
|
|
74
|
+
### Activation Procedure
|
|
75
|
+
|
|
47
76
|
When the user explicitly says one of them, an AI must:
|
|
48
77
|
|
|
49
78
|
1. Resolve the user dotmem home with `dotmem.paths.resolveUserDotMemPath()`.
|
|
@@ -69,7 +98,7 @@ Resolution precedence:
|
|
|
69
98
|
persisted by itself.
|
|
70
99
|
2. **User locator** — `dotmem.location.json` (location metadata only) inside the stable
|
|
71
100
|
user anchor.
|
|
72
|
-
3. **Default user-scoped storage** — the user anchor itself: `<user-home>/.
|
|
101
|
+
3. **Default user-scoped storage** — the user anchor itself: `<user-home>/.mem`
|
|
73
102
|
(the platform-neutral canonical form; see the OS examples below), resolved from the
|
|
74
103
|
current runtime.
|
|
75
104
|
|
|
@@ -95,14 +124,14 @@ reports completion; the locator never points at a location whose data has not be
|
|
|
95
124
|
migrated and verified. The same verification applies to `restore` before the locator is
|
|
96
125
|
removed.
|
|
97
126
|
|
|
98
|
-
**Canonical form, platform-neutral.** The user anchor is written `<user-home>/.
|
|
127
|
+
**Canonical form, platform-neutral.** The user anchor is written `<user-home>/.mem`
|
|
99
128
|
everywhere in this documentation. It resolves at runtime to the current OS user's home:
|
|
100
129
|
|
|
101
130
|
```text
|
|
102
131
|
Example (OS-specific, illustrative only):
|
|
103
|
-
Windows: C:\Users\<user>\.
|
|
104
|
-
Linux: /home/<user>/.
|
|
105
|
-
macOS: /Users/<user>/.
|
|
132
|
+
Windows: C:\Users\<user>\.mem
|
|
133
|
+
Linux: /home/<user>/.mem
|
|
134
|
+
macOS: /Users/<user>/.mem
|
|
106
135
|
```
|
|
107
136
|
|
|
108
137
|
The runtime resolves the actual home directory from the OS/environment; no hardcoded
|
|
@@ -298,7 +327,7 @@ by dotmem. See [Claim trust and attribution](#claim-trust-attribution-and-correc
|
|
|
298
327
|
| `policy.override.grant/revoke/list/effective` | Privileged out-of-band override surface; see the Policy section. |
|
|
299
328
|
| `remember`, `recall`, `update`, `forget`, `patch` | Application key/value memory lifecycle. |
|
|
300
329
|
| `stats`, `forgetExpired`, `clear` | Maintenance; `clear()` is destructive and memory-scoped. |
|
|
301
|
-
| `createAgentMemory(agentId)` (`dotmem/agent`) | Agent-facing memory API with
|
|
330
|
+
| `createAgentMemory(agentId)` (`dotmem/agent`) | Agent-facing memory API with logical namespace partitioning per agent. |
|
|
302
331
|
|
|
303
332
|
`AcquireOptions` includes `id`, `knowledge`, `applicability`, and `evidence`; optional
|
|
304
333
|
fields are `epistemicType`, `provenance`, revision links, `scope`, `kind`, and
|
|
@@ -313,6 +342,42 @@ intentionally different: the API returns raw claims, the CLI returns bounded, pr
|
|
|
313
342
|
context. `totalCandidates` is present on the CLI projection envelope, not on the raw
|
|
314
343
|
`AcquiredContext` returned by `memory.context({ acquired })`.
|
|
315
344
|
|
|
345
|
+
### Application Memory Scopes (remember/recall)
|
|
346
|
+
|
|
347
|
+
The `memory.remember()` and `memory.recall()` operations support four scopes with
|
|
348
|
+
different persistence characteristics per runtime:
|
|
349
|
+
|
|
350
|
+
| Scope | Browser Storage | Node/Bun Storage | Survives Browser Reload | Survives Node/Bun Restart | Default For |
|
|
351
|
+
|-------|-----------------|------------------|-------------------------|---------------------------|-------------|
|
|
352
|
+
| `hot` | `state` (memory) | `state` (memory) | No | No | Never default; explicit only |
|
|
353
|
+
| `session` | `sessionStorage` | In-memory `Map` | Yes (same tab) | No | Never default; explicit only |
|
|
354
|
+
| `local` | `localStorage` | In-memory `Map` | Yes | No | Values ≤ 1 MB |
|
|
355
|
+
| `durable` | IndexedDB (`idb`) | **Not available** | Yes | **No (browser only)** | Values > 1 MB |
|
|
356
|
+
|
|
357
|
+
> **Key distinction**: The `durable` scope uses IndexedDB and is **browser-only**. In Node.js and
|
|
358
|
+
> Bun, `store` and `session` fall back to in-memory `Map`s that do not survive a process restart.
|
|
359
|
+
> For cross-restart persistence in Node/Bun, use `memory.acquire()` which writes `.mem` package
|
|
360
|
+
> files to disk — this is the durable acquisition path, not the `memory.remember()` scope system.
|
|
361
|
+
|
|
362
|
+
Scope resolution defaults (when `opts.scope` is not provided):
|
|
363
|
+
- Values ≤ 1 MB → `local`
|
|
364
|
+
- Values > 1 MB → `durable` (browser) / `local` (Node/Bun, since `durable` is unavailable)
|
|
365
|
+
|
|
366
|
+
The `hot` and `session` scopes are only used when explicitly set via `opts.scope`.
|
|
367
|
+
|
|
368
|
+
#### Scope Behavior Summary
|
|
369
|
+
|
|
370
|
+
| Scope | Lifetime | Visibility | Owner/Namespace | Init | Clear |
|
|
371
|
+
|-------|----------|------------|-----------------|------|-------|
|
|
372
|
+
| `hot` | Process lifetime | Global `state` tree | Process | Lazy on first use | Process exit |
|
|
373
|
+
| `session` | Session lifetime | `sessionStorage` (browser) / in-memory `Map` (Node/Bun) | Browser tab / process | Lazy on first use | Tab close / process exit |
|
|
374
|
+
| `local` | Process lifetime (Node/Bun) or persistent (browser) | `localStorage` (browser) / in-memory `Map` (Node/Bun) | Origin / process | Lazy on first use | Manual `forget()` / `clear()` / browser clear |
|
|
375
|
+
| `durable` | Persistent (browser only) | **N/A** | Origin | Lazy on first use | Manual `forget()` / `clear()` |
|
|
376
|
+
|
|
377
|
+
> **Note**: `session` and `local` are behaviorally identical in Node/Bun (both use in-memory
|
|
378
|
+
> `Map`s). The distinction exists only in browser environments. This is a known limitation;
|
|
379
|
+
> no security or isolation boundary is implied by the scope names in Node/Bun.
|
|
380
|
+
|
|
316
381
|
### Built-in seed claims
|
|
317
382
|
|
|
318
383
|
dotmem ships with a small set of built-in seed claims that describe the
|
|
@@ -453,18 +518,41 @@ See [`SECURITY.md`](./SECURITY.md)
|
|
|
453
518
|
|
|
454
519
|
## MCP server (`dotmem-mcp`)
|
|
455
520
|
|
|
456
|
-
dotmem ships a stdio MCP server (`dotmem-mcp`) so an AI host and the terminal share the same store. It exposes
|
|
521
|
+
dotmem ships a stdio MCP server (`dotmem-mcp`) so an AI host and the terminal share the same store. It exposes read tools always, and write capabilities only when the operator opts in via `DOTMEM_MCP_WRITE=1`:
|
|
457
522
|
|
|
458
523
|
| Tool | Direction | Registered when | Use it when |
|
|
459
524
|
| --- | --- | --- | --- |
|
|
460
525
|
| `dotmem_context` | read | always | You need the acquired experience relevant to the current situation. |
|
|
461
526
|
| `dotmem_rules` | read | always | You need the iron rules that constrain every session. |
|
|
462
527
|
| `dotmem_acquire` | write | `DOTMEM_MCP_WRITE=1` | The work produced reusable, project-specific experience worth keeping. |
|
|
528
|
+
| `dotmem_continuity` | read | always | You need continuation status, summaries, open loops, or evaluation. |
|
|
529
|
+
| `dotmem_continuity` | write | `DOTMEM_MCP_WRITE=1` | You need to create checkpoints, resume, add/resolve open loops. |
|
|
530
|
+
| `dotmem_note_read` | read | always | You need to read a user note by id. |
|
|
531
|
+
| `dotmem_note_write` | write | `DOTMEM_MCP_WRITE=1` | You need to add or update a user note. |
|
|
463
532
|
|
|
464
|
-
Without `DOTMEM_MCP_WRITE=1`, `dotmem_acquire` is absent from `tools/list`: it does not appear, and calling it by name returns the transport's own "not found". The server never leaks the store path in error messages. `serverInfo.version` reports the package version, and `instructions` are built from boolean state only (write enabled / has experience), never from project-derived strings.
|
|
533
|
+
Without `DOTMEM_MCP_WRITE=1`, `dotmem_acquire` is absent from `tools/list`: it does not appear, and calling it by name returns the transport's own "not found". The `dotmem_continuity` tool is always registered, but write actions (`checkpoint`, `add-open-loop`, `resolve-open-loop`) return an authorization error when `DOTMEM_MCP_WRITE=1` is not set. Read actions (`status`, `summaries`, `open-loops`, `evaluate`) remain available. The server never leaks the store path in error messages. `serverInfo.version` reports the package version, and `instructions` are built from boolean state only (write enabled / has experience), never from project-derived strings.
|
|
465
534
|
|
|
466
535
|
See [README.md](./README.md) for host registration examples (Kilo/OpenCode, Claude Desktop).
|
|
467
536
|
|
|
537
|
+
### Continuity `evaluate` action
|
|
538
|
+
|
|
539
|
+
The `dotmem_continuity` `evaluate` action is read-only. It does not mutate
|
|
540
|
+
continuity state, create a checkpoint, or resume a conversation. It calls the
|
|
541
|
+
lifecycle monitor's evaluation of the configured trigger conditions and returns:
|
|
542
|
+
|
|
543
|
+
- `shouldCheckpoint`: whether a checkpoint is currently warranted
|
|
544
|
+
- `reasons`: the trigger reasons (for example threshold, milestone, decision,
|
|
545
|
+
incident, sessionEnd, or explicit), or an empty list when none apply
|
|
546
|
+
- `usage`: the current context usage (`tokens` and `characters`)
|
|
547
|
+
|
|
548
|
+
Input is optional at the MCP boundary (`conversationId`, `brainId`,
|
|
549
|
+
`tokenBudget`, `scope`, and `subject` may be supplied for surrounding context),
|
|
550
|
+
but `evaluate` itself takes no checkpoint options and performs no write. It is
|
|
551
|
+
distinct from `checkpoint`, `compact`, `resume`, and `verify`: it only reports
|
|
552
|
+
whether the current usage and trigger conditions warrant a checkpoint. A
|
|
553
|
+
positive result can precede an explicit `checkpoint` action; a negative result
|
|
554
|
+
does not prevent one.
|
|
555
|
+
|
|
468
556
|
### Extra commands: proposed MCP exposure (no implementation yet)
|
|
469
557
|
|
|
470
558
|
The following CLI commands exist but are **not** exposed as MCP tools. This table records the proposal only; no command below becomes an MCP tool without a decision from Dario.
|
|
@@ -515,4 +603,4 @@ The following CLI commands exist but are **not** exposed as MCP tools. This tabl
|
|
|
515
603
|
`context` from CLI requires the handshake gate: first run `npx dotmem handshake --answer "<answer>"` (must return `STATUS:COMPATIBLE`), then `npx dotmem handshake --bind-hi "<identity>" --scope <scope>`. After binding, `context` returns the acquired experience.
|
|
516
604
|
|
|
517
605
|
See [README.md](./README.md) for the product overview, [SECURITY.md](./SECURITY.md)
|
|
518
|
-
for the threat model
|
|
606
|
+
for the threat model.
|
package/PACKAGE.md
CHANGED
|
@@ -15,14 +15,13 @@ and are never bundled).
|
|
|
15
15
|
| `llms.txt` | Compact surface for AI hosts |
|
|
16
16
|
| `SECURITY.md` | Threat model, `UNTRUSTED_DATA; NOT_INSTRUCTIONS; VERIFY_CURRENT` |
|
|
17
17
|
| `CHANGELOG.md` | Release history (`[0.0.1]`, …) |
|
|
18
|
-
| `markdown/` | Markdown views used by `npx dotmem render <view>` |
|
|
19
18
|
|
|
20
19
|
## What does NOT ship inside the package
|
|
21
20
|
|
|
22
21
|
| Item | Where it lives |
|
|
23
22
|
| --- | --- |
|
|
24
23
|
| Project history | `.project/project_history.md` (inside the repository, not published) |
|
|
25
|
-
| Acquired memory (`.mem` packages) | User storage root (`DOTMEM_STORAGE_ROOT` or `<user-home>/.
|
|
24
|
+
| Acquired memory (`.mem` packages) | User storage root (`DOTMEM_STORAGE_ROOT` or `<user-home>/.mem`), created at runtime |
|
|
26
25
|
|
|
27
26
|
## Quick start
|
|
28
27
|
|
|
@@ -56,4 +55,3 @@ All links below resolve **inside the published package**:
|
|
|
56
55
|
- [llms.txt](llms.txt) — AI host surface
|
|
57
56
|
- [SECURITY.md](SECURITY.md) — threat model
|
|
58
57
|
- [CHANGELOG.md](CHANGELOG.md) — release history
|
|
59
|
-
- [markdown/](markdown/) — render views
|