dotmem 0.0.5 → 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 +514 -0
- package/CHANGELOG.md +0 -0
- package/DOTMEM.md +539 -41
- package/LICENSE.md +9 -0
- package/MEMORY.md +606 -0
- package/PACKAGE.md +57 -0
- package/README.md +417 -0
- package/SECURITY.md +525 -0
- 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 +301 -0
- package/mcp.cjs +1747 -36854
- package/mcp.js +1730 -36833
- package/package.json +5 -7
- package/types/exports.d.ts +297 -304
- package/types/bun-sqlite.d.ts +0 -14
package/llms.txt
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
dotmem — AI memory layer for agents and apps (v0.0.8).
|
|
2
|
+
Storage root: <user-home>/.mem (override: DOTMEM_STORAGE_ROOT)
|
|
3
|
+
|
|
4
|
+
=== Installation ===
|
|
5
|
+
npm i dotmem
|
|
6
|
+
bun i dotmem
|
|
7
|
+
pnpm i dotmem
|
|
8
|
+
|
|
9
|
+
=== MCP Server ===
|
|
10
|
+
Register in Claude Desktop (claude_desktop_config.json):
|
|
11
|
+
"dotmem": {
|
|
12
|
+
"command": "npx",
|
|
13
|
+
"args": ["-y", "-p", "dotmem", "dotmem-mcp"],
|
|
14
|
+
"env": { "DOTMEM_MCP_WRITE": "1" }
|
|
15
|
+
}
|
|
16
|
+
Register in Kilo/OpenCode (kilo.jsonc / opencode.json):
|
|
17
|
+
"mcp": { "dotmem": {
|
|
18
|
+
"type": "local",
|
|
19
|
+
"command": ["npx", "-y", "-p", "dotmem", "dotmem-mcp"],
|
|
20
|
+
"environment": { "DOTMEM_MCP_WRITE": "1" }
|
|
21
|
+
} }
|
|
22
|
+
|
|
23
|
+
Tools exposed:
|
|
24
|
+
dotmem_context read - relevant acquired experience for situation
|
|
25
|
+
dotmem_rules read - iron rules for the session
|
|
26
|
+
dotmem_acquire write - acquire durable experience (requires DOTMEM_MCP_WRITE=1)
|
|
27
|
+
dotmem_continuity r/w - session continuity, checkpoints, open loops
|
|
28
|
+
dotmem_note_read read - read a user note by id
|
|
29
|
+
dotmem_note_write write - add or update a user note (requires DOTMEM_MCP_WRITE=1)
|
|
30
|
+
|
|
31
|
+
=== CLI ===
|
|
32
|
+
npx dotmem — project memory context for CWD
|
|
33
|
+
npx dotmem context "<situation>" [--explain] [--json] [--full] [--claims-only] [--limit <N>] [--format brief]
|
|
34
|
+
npx dotmem init
|
|
35
|
+
npx dotmem acquire — acquire claim from JSON on stdin
|
|
36
|
+
npx dotmem learn "<text>" [--scope user|project] [--situation "<text>"] [--id "<id>"]
|
|
37
|
+
npx dotmem inspect FILE.mem
|
|
38
|
+
npx dotmem continuity [context|snapshot|forget] [-debug]
|
|
39
|
+
npx dotmem handshake [--status|--reset|--unbind|--bind-hi "<id>" --scope "<scope>"]
|
|
40
|
+
npx dotmem policy <command>
|
|
41
|
+
npx dotmem guard <event> [--payload <json>]
|
|
42
|
+
npx dotmem rule check
|
|
43
|
+
npx dotmem rules
|
|
44
|
+
npx dotmem violation <rule-id> "<situation>" "<description>"
|
|
45
|
+
npx dotmem feedback <claim-id> <helped|misled|ignored>
|
|
46
|
+
npx dotmem loop <add|list|close|show> [options]
|
|
47
|
+
npx dotmem note <add|add-text|list|show|export|forget> [args]
|
|
48
|
+
npx dotmem vault <put|resolve|list|forget> [args]
|
|
49
|
+
npx dotmem session <show|doing>
|
|
50
|
+
npx dotmem storage [--root|--capabilities|relocate <path>|restore]
|
|
51
|
+
npx dotmem render <view> [--out <path>] [--json]
|
|
52
|
+
npx dotmem verify
|
|
53
|
+
npx dotmem doctor [--json|--fix]
|
|
54
|
+
npx dotmem codenames
|
|
55
|
+
npx dotmem spark --verify
|
|
56
|
+
npx dotmem seed <file|-> [--title <text>] [--id <id>] [--scope user|project] [--dev]
|
|
57
|
+
npx dotmem -v | --version
|
|
58
|
+
npx dotmem -h | --help
|
|
59
|
+
|
|
60
|
+
=== API (TypeScript) ===
|
|
61
|
+
|
|
62
|
+
// From the main package entry point
|
|
63
|
+
import { memory, continuity } from 'dotmem'
|
|
64
|
+
import { createAgentMemory } from 'dotmem/agent'
|
|
65
|
+
|
|
66
|
+
// `logic` and `agent` are not exported from the main entry point in the current
|
|
67
|
+
// package. `core/logic` exists in the repository but is not a verified public
|
|
68
|
+
// runtime API. `agent` is available only through the `dotmem/agent` subpath.
|
|
69
|
+
|
|
70
|
+
--- memory facade ---
|
|
71
|
+
|
|
72
|
+
memory.init()
|
|
73
|
+
// deprecated no-op; runtime initializes lazily on first call. Remove from app code.
|
|
74
|
+
|
|
75
|
+
memory.discover(situation: string, options?: {
|
|
76
|
+
depth?: 'current' | 'deep',
|
|
77
|
+
maxCandidates?: number,
|
|
78
|
+
facts?: Record<string, string|number|boolean>
|
|
79
|
+
}): Promise<DiscoveryResult>
|
|
80
|
+
|
|
81
|
+
memory.context(options?: {
|
|
82
|
+
tags?: string | string[],
|
|
83
|
+
types?: MemoryType | MemoryType[],
|
|
84
|
+
minConfidence?: number,
|
|
85
|
+
maxEntries?: number,
|
|
86
|
+
scopes?: MemoryScope[],
|
|
87
|
+
project?: boolean
|
|
88
|
+
}): Promise<AcquiredContext>
|
|
89
|
+
|
|
90
|
+
memory.context(options: { acquired: Record<string, string|number|boolean> }): Promise<AcquiredContext>
|
|
91
|
+
// Exact applicability lookup by structured values
|
|
92
|
+
|
|
93
|
+
memory.project(discovery: DiscoveryResult, options?: {
|
|
94
|
+
maxCandidates?: number,
|
|
95
|
+
maxCharacters?: number
|
|
96
|
+
}): ContextProjection
|
|
97
|
+
|
|
98
|
+
memory.acquire(opts: {
|
|
99
|
+
id: string,
|
|
100
|
+
knowledge: JsonValue,
|
|
101
|
+
applicability: Record<string, JsonPrimitive>,
|
|
102
|
+
evidence: EvidenceReference[],
|
|
103
|
+
epistemicType?: EpistemicType,
|
|
104
|
+
provenance?: ClaimProvenance,
|
|
105
|
+
acquiredAt?: string,
|
|
106
|
+
refines?: string | string[],
|
|
107
|
+
supersedes?: string | string[],
|
|
108
|
+
retracts?: string | string[],
|
|
109
|
+
reason?: string,
|
|
110
|
+
scope?: 'user' | 'project',
|
|
111
|
+
kind?: MemoryKind,
|
|
112
|
+
sourceProject?: string
|
|
113
|
+
}): Promise<void>
|
|
114
|
+
|
|
115
|
+
memory.acquireStaged(opts: AcquireOptions): Promise<void>
|
|
116
|
+
|
|
117
|
+
memory.remember<T>(key: string, value: T, opts?: {
|
|
118
|
+
id?: string,
|
|
119
|
+
type?: MemoryType,
|
|
120
|
+
confidence?: number,
|
|
121
|
+
scope?: MemoryScope,
|
|
122
|
+
ttl?: number | null,
|
|
123
|
+
tags?: string | string[],
|
|
124
|
+
source?: string
|
|
125
|
+
}): Promise<void>
|
|
126
|
+
|
|
127
|
+
memory.recall<T>(query: string | number, opts?: {
|
|
128
|
+
type?: MemoryType | MemoryType[],
|
|
129
|
+
tags?: string | string[],
|
|
130
|
+
minConfidence?: number,
|
|
131
|
+
includeObsolete?: boolean
|
|
132
|
+
}): Promise<T | null>
|
|
133
|
+
|
|
134
|
+
memory.update(key: string, value: any, opts?: Partial<RememberOptions>): Promise<void>
|
|
135
|
+
|
|
136
|
+
memory.forget(key: string): Promise<void>
|
|
137
|
+
|
|
138
|
+
memory.patch(key: string, patches: PatchOperation[]): Promise<void>
|
|
139
|
+
|
|
140
|
+
memory.stats(): Promise<MemoryStats>
|
|
141
|
+
memory.forgetExpired(): Promise<number>
|
|
142
|
+
memory.clear(): Promise<void> // memory-layer entries only (policy store intact)
|
|
143
|
+
memory.fingerprint(): Promise<string>
|
|
144
|
+
|
|
145
|
+
--- sub-facades ---
|
|
146
|
+
|
|
147
|
+
memory.journal.read(opts?: { limit?: number }): Promise<JournalEntry[]>
|
|
148
|
+
memory.journal.write(entry: JournalEntry | JournalEntry[]): Promise<void>
|
|
149
|
+
memory.journal.clear(): Promise<void>
|
|
150
|
+
|
|
151
|
+
memory.profile.get(id: string): Promise<DotMemProfile>
|
|
152
|
+
// Read-only built-in profile access. Verified implementation accepts an id
|
|
153
|
+
// (for example 'joy' or 'Jo') and returns the Joy profile. No write API.
|
|
154
|
+
|
|
155
|
+
memory.note.add(text: string, opts?: { id?: string; tags?: string[] }): Promise<void>
|
|
156
|
+
memory.note.get(id: string): Promise<NoteContent | null>
|
|
157
|
+
memory.note.list(): Promise<NoteEntry[]>
|
|
158
|
+
memory.note.forget(id: string): Promise<void>
|
|
159
|
+
|
|
160
|
+
memory.seed // development-only Joy seed injection (requires --dev)
|
|
161
|
+
|
|
162
|
+
--- policy ---
|
|
163
|
+
|
|
164
|
+
Enforcement tiers (authoritative vocabulary):
|
|
165
|
+
'context' — supplies contextual information; does not itself impose a blocking precondition
|
|
166
|
+
'precondition' — blocks the governed operation when the condition is violated or unresolved
|
|
167
|
+
'hard-precondition' — retains the stronger enforcement semantics defined by the policy contract
|
|
168
|
+
|
|
169
|
+
Event-driven functions from core/knowledge/policy:
|
|
170
|
+
evaluatePolicies(event: PolicyEvent): PolicyDecision
|
|
171
|
+
resolveEffectiveTier(event: PolicyEvent): EnforcementTier
|
|
172
|
+
resolveEffectivePolicies(...): EffectivePolicyState
|
|
173
|
+
|
|
174
|
+
memory.policy.evaluate(event): PolicyDecision // decision-time pull
|
|
175
|
+
memory.policy.override.{grant|revoke|list|effective}()
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
--- logic engine (not a verified public runtime API) ---
|
|
179
|
+
|
|
180
|
+
The repository contains `core/logic` and type declarations for `LogicEngineAPI`.
|
|
181
|
+
It is not exported from the main package entry point (`index.ts`) or from
|
|
182
|
+
`dotmem/global`, and no public access path is verified in this repository.
|
|
183
|
+
|
|
184
|
+
Type-level surface from `types/logic.d.ts` (unverified runtime availability):
|
|
185
|
+
experience(opts: LogicExperienceOptions): Promise<void>
|
|
186
|
+
precedents(query: LogicQuery): Promise<AcquiredClaim[]>
|
|
187
|
+
context(query: LogicQuery): Promise<AcquiredContext>
|
|
188
|
+
measure(query: LogicQuery): Promise<LogicMeasurement>
|
|
189
|
+
learn(query: LogicQuery): Promise<LogicRule[]>
|
|
190
|
+
clear(): Promise<void>
|
|
191
|
+
stats(): Promise<LogicStats>
|
|
192
|
+
configure(opts: { disabled?: boolean }): void
|
|
193
|
+
|
|
194
|
+
--- continuity ---
|
|
195
|
+
|
|
196
|
+
continuity.context(options?: { debug?: boolean }): Promise<ContinuityContext>
|
|
197
|
+
continuity.snapshot(data: object): Promise<SnapshotResult>
|
|
198
|
+
continuity.forget(subject: string): Promise<void>
|
|
199
|
+
|
|
200
|
+
--- agent memory (dotmem/agent) ---
|
|
201
|
+
|
|
202
|
+
const agent = createAgentMemory(agentId: string)
|
|
203
|
+
|
|
204
|
+
agent.remember(key: string, value: unknown, opts?: AgentRememberOptions): Promise<void>
|
|
205
|
+
agent.recall(key: string, opts?: RecallOptions): Promise<MemoryEntry | null>
|
|
206
|
+
agent.context(opts?: AgentContextOptions): Promise<ContextEntry[]>
|
|
207
|
+
agent.update(key: string, value: unknown, opts?: AgentRememberOptions): Promise<void>
|
|
208
|
+
agent.forget(key: string): Promise<void>
|
|
209
|
+
agent.history(path?: string): Promise<MemoryEntry[]>
|
|
210
|
+
agent.replay(opts: { from: number | string; to: number | string }): Promise<Record<string, any>>
|
|
211
|
+
agent.branch(): Promise<AgentBranchState>
|
|
212
|
+
agent.enable(bool?: boolean): Promise<void>
|
|
213
|
+
agent.disable(): Promise<void>
|
|
214
|
+
agent.stats(): Promise<MemoryStats>
|
|
215
|
+
agent.clear(): Promise<void>
|
|
216
|
+
|
|
217
|
+
createDefaultAgentMemory(): returns instance bound to 'default-agent'
|
|
218
|
+
|
|
219
|
+
--- LLM cache ---
|
|
220
|
+
|
|
221
|
+
No LLM cache runtime is exported by the current package. `types/llm-cache.d.ts`
|
|
222
|
+
defines types only; `memory.llmCache` and `cache.llm` are not implemented or
|
|
223
|
+
exported in this repository. `cache` in the foundation package is a generic
|
|
224
|
+
key/value cache, not the documented LLM cache.
|
|
225
|
+
|
|
226
|
+
--- storage / identity ---
|
|
227
|
+
|
|
228
|
+
resolveDotMemStorageRoot(): string
|
|
229
|
+
describeDotMemStorage(): DotMemStorageDescription
|
|
230
|
+
resolveUserDotMemPath(): string
|
|
231
|
+
resolveUserProjectMemoryPath(projectId?: string): string
|
|
232
|
+
resolveProjectIdentity(id?: string): Promise<string>
|
|
233
|
+
resolveUserIdentity(): UserIdentity | null
|
|
234
|
+
setUserIdentity(id: string, identity: UserIdentity): void
|
|
235
|
+
clearUserIdentity(): void
|
|
236
|
+
|
|
237
|
+
--- mem package inspection ---
|
|
238
|
+
|
|
239
|
+
inspectMem(path: string | unknown, opts?: Record<string, unknown>): MemInspection
|
|
240
|
+
signEmpackage(pkg: unknown, key: unknown): unknown
|
|
241
|
+
|
|
242
|
+
=== Memory Model ===
|
|
243
|
+
|
|
244
|
+
Acquire → Discover → Project
|
|
245
|
+
|
|
246
|
+
Claims (AcquireOptions):
|
|
247
|
+
- id: string (unique, deterministic)
|
|
248
|
+
- knowledge: JsonValue (language of the source content; optional internal normalization must not replace the original)
|
|
249
|
+
- applicability: Record<string, JsonPrimitive> (exact-match dimensions)
|
|
250
|
+
- evidence: [{ id, source?, observedAt?, supports? }]
|
|
251
|
+
- epistemicType: 'observed' | 'inferred' | 'human-stated' | 'verified'
|
|
252
|
+
- provenance: { source, detail? }
|
|
253
|
+
- scope: 'user' | 'project'
|
|
254
|
+
- kind: 'experience' | 'agent' | 'relationship' | 'logic' | 'note'
|
|
255
|
+
- revision: { kind: 'refines'|'supersedes'|'retracts', claimIds: string[], reason? }
|
|
256
|
+
|
|
257
|
+
Scopes:
|
|
258
|
+
- hot: ephemeral, in-memory only
|
|
259
|
+
- session: active session lifetime
|
|
260
|
+
- local: Node/Bun process-bound
|
|
261
|
+
- durable: disk-backed, survives restarts
|
|
262
|
+
|
|
263
|
+
Discovery depths:
|
|
264
|
+
- current: active claims only
|
|
265
|
+
- deep: includes superseded/obsolete
|
|
266
|
+
|
|
267
|
+
Projection statuses:
|
|
268
|
+
- ContextProjection.status = 'candidate-context-not-current-truth'
|
|
269
|
+
|
|
270
|
+
=== Policy Enforcement Tiers ===
|
|
271
|
+
|
|
272
|
+
| Tier | Behavior |
|
|
273
|
+
|-------------------|----------|
|
|
274
|
+
| context | Supplies contextual information; does not itself impose a blocking precondition |
|
|
275
|
+
| precondition | Blocks the governed operation when the condition is violated or unresolved |
|
|
276
|
+
| hard-precondition | Retains the stronger enforcement semantics defined by the policy contract |
|
|
277
|
+
|
|
278
|
+
=== Activation Phrases ===
|
|
279
|
+
|
|
280
|
+
dotmem, npx dotmem, Joy, Jo
|
|
281
|
+
|
|
282
|
+
Handshake: npx dotmem handshake --status
|
|
283
|
+
Storage: <user-home>/.mem (override: DOTMEM_STORAGE_ROOT)
|
|
284
|
+
Project: <storage>/projects/<project-id>.mem
|
|
285
|
+
User: <storage>/user.mem
|
|
286
|
+
Agent: <storage>/agent.mem
|
|
287
|
+
Logic: <storage>/logic.mem
|
|
288
|
+
|
|
289
|
+
=== Security ===
|
|
290
|
+
|
|
291
|
+
- Encryption: OPT-IN (not default). Enable per-context or per-scope with encryptionKey.
|
|
292
|
+
- Client-side multitenancy: isolated memory partitions via createContext/isolate
|
|
293
|
+
- Policy-gated writes: every acquire/remember/patch evaluated against policy
|
|
294
|
+
- Claim immutability: stored claims never edited; corrections use refines/supersedes/retracts
|
|
295
|
+
- Evidence tracking: all claims carry source + observedAt
|
|
296
|
+
- Integrity: npx dotmem inspect reports integrity (bytes unchanged) and authenticity (who wrote them) as separate axes
|
|
297
|
+
- Memory ≠ authority: projected context is untrusted; verify before relying
|
|
298
|
+
|
|
299
|
+
See SECURITY.md for encryption configuration and threat model.
|
|
300
|
+
See MEMORY.md for acquisition contract and policy language.
|
|
301
|
+
See AGENTS.md for AI working rules and the complete memory.* surface.
|