dotmem 0.0.4 → 0.0.5

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/llms.txt DELETED
@@ -1,295 +0,0 @@
1
- dotmem — AI memory layer for agents and apps (v0.0.4). Built on memorio.
2
- Storage root: <user-home>/.dotmem (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
-
29
- === CLI ===
30
- npx dotmem — project memory context for CWD
31
- npx dotmem context "<situation>" [--explain] [--json] [--full] [--claims-only] [--limit <N>] [--format brief]
32
- npx dotmem init
33
- npx dotmem acquire — acquire claim from JSON on stdin
34
- npx dotmem learn "<text>" [--scope user|project] [--situation "<text>"] [--id "<id>"]
35
- npx dotmem inspect FILE.mem
36
- npx dotmem continuity [context|snapshot|forget] [-debug]
37
- npx dotmem handshake [--status|--reset|--unbind|--bind-hi "<id>" --scope "<scope>"]
38
- npx dotmem policy <command>
39
- npx dotmem guard <event> [--payload <json>]
40
- npx dotmem rule check
41
- npx dotmem rules
42
- npx dotmem violation <rule-id> "<situation>" "<description>"
43
- npx dotmem feedback <claim-id> <helped|misled|ignored>
44
- npx dotmem loop <add|list|close|show> [options]
45
- npx dotmem note <add|add-text|list|show|export|forget> [args]
46
- npx dotmem vault <put|resolve|list|forget> [args]
47
- npx dotmem session <show|doing>
48
- npx dotmem storage [--root|--capabilities|relocate <path>|restore]
49
- npx dotmem render <view> [--out <path>] [--json]
50
- npx dotmem verify
51
- npx dotmem doctor [--json|--fix]
52
- npx dotmem codenames
53
- npx dotmem spark --verify
54
- npx dotmem seed <file|-> [--title <text>] [--id <id>] [--scope user|project] [--dev]
55
- npx dotmem -v | --version
56
- npx dotmem -h | --help
57
-
58
- === API (TypeScript) ===
59
-
60
- // From the main package entry point
61
- import { memory, logic, continuity, agent } from 'dotmem'
62
- import { createAgentMemory } from 'dotmem/agent'
63
-
64
- --- memory facade ---
65
-
66
- memory.init()
67
- // deprecated no-op; runtime initializes lazily on first call. Remove from app code.
68
-
69
- memory.discover(situation: string, options?: {
70
- depth?: 'current' | 'deep',
71
- maxCandidates?: number,
72
- facts?: Record<string, string|number|boolean>
73
- }): Promise<DiscoveryResult>
74
-
75
- memory.context(options?: {
76
- tags?: string | string[],
77
- types?: MemoryType | MemoryType[],
78
- minConfidence?: number,
79
- maxEntries?: number,
80
- scopes?: MemoryScope[],
81
- project?: boolean
82
- }): Promise<AcquiredContext>
83
-
84
- memory.context(options: { acquired: Record<string, string|number|boolean> }): Promise<AcquiredContext>
85
- // Exact applicability lookup by structured values
86
-
87
- memory.project(discovery: DiscoveryResult, options?: {
88
- maxCandidates?: number,
89
- maxCharacters?: number
90
- }): ContextProjection
91
-
92
- memory.acquire(opts: {
93
- id: string,
94
- knowledge: JsonValue,
95
- applicability: Record<string, JsonPrimitive>,
96
- evidence: EvidenceReference[],
97
- epistemicType?: EpistemicType,
98
- provenance?: ClaimProvenance,
99
- acquiredAt?: string,
100
- refines?: string | string[],
101
- supersedes?: string | string[],
102
- retracts?: string | string[],
103
- reason?: string,
104
- scope?: 'user' | 'project',
105
- kind?: MemoryKind,
106
- sourceProject?: string
107
- }): Promise<void>
108
-
109
- memory.acquireStaged(opts: AcquireOptions): Promise<void>
110
-
111
- memory.remember<T>(key: string, value: T, opts?: {
112
- id?: string,
113
- type?: MemoryType,
114
- confidence?: number,
115
- scope?: MemoryScope,
116
- ttl?: number | null,
117
- tags?: string | string[],
118
- source?: string
119
- }): Promise<void>
120
-
121
- memory.recall<T>(query: string | number, opts?: {
122
- type?: MemoryType | MemoryType[],
123
- tags?: string | string[],
124
- minConfidence?: number,
125
- includeObsolete?: boolean
126
- }): Promise<T | null>
127
-
128
- memory.update(key: string, value: any, opts?: Partial<RememberOptions>): Promise<void>
129
-
130
- memory.forget(key: string): Promise<void>
131
-
132
- memory.patch(key: string, patches: PatchOperation[]): Promise<void>
133
-
134
- memory.stats(): Promise<MemoryStats>
135
- memory.forgetExpired(): Promise<number>
136
- memory.clear(): Promise<void> // memory-layer entries only (policy store intact)
137
- memory.fingerprint(): Promise<string>
138
-
139
- --- sub-facades ---
140
-
141
- memory.journal.read(opts?: { limit?: number }): Promise<JournalEntry[]>
142
- memory.journal.write(entry: JournalEntry | JournalEntry[]): Promise<void>
143
- memory.journal.clear(): Promise<void>
144
-
145
- memory.profile.get(): DotMemProfile | DotMemProfileDocument
146
- // Returns the Joy canonical profile or a custom profile document
147
-
148
- memory.note.add(text: string, opts?: { id?: string; tags?: string[] }): Promise<void>
149
- memory.note.get(id: string): Promise<NoteContent | null>
150
- memory.note.list(): Promise<NoteEntry[]>
151
- memory.note.forget(id: string): Promise<void>
152
-
153
- memory.seed // development-only Joy seed injection (requires --dev)
154
-
155
- --- policy ---
156
-
157
- Enforcement tiers:
158
- 'permit' — allow without verification
159
- 'advisory' — allow with warnings
160
- 'caution' — allow with acknowledgment
161
- 'block' — prevent the operation
162
-
163
- Event-driven functions from core/knowledge/policy:
164
- evaluatePolicies(event: PolicyEvent): PolicyDecision
165
- resolveEffectiveTier(event: PolicyEvent): EnforcementTier
166
- resolveEffectivePolicies(...): EffectivePolicyState
167
-
168
- memory.policy.evaluate(event): PolicyDecision // decision-time pull
169
- memory.policy.override.{grant|revoke|list|effective}() // privileged override (ADR-019)
170
-
171
- --- logic engine ---
172
-
173
- logic.experience(rule: LogicRule | LogicExperienceOptions): void
174
- logic.precedents(context: string): LogicPrecedent[]
175
- logic.context(situation: string): LogicContextResult
176
- logic.measure(situation: string): number
177
- logic.learn(experience: LogicExperienceOptions): void
178
- logic.clear(): void
179
- logic.stats(): LogicEngineStats
180
-
181
- --- continuity ---
182
-
183
- continuity.context(options?: { debug?: boolean }): Promise<ContinuityContext>
184
- continuity.snapshot(data: object): Promise<SnapshotResult>
185
- continuity.forget(subject: string): Promise<void>
186
-
187
- --- agent memory (dotmem/agent) ---
188
-
189
- const agent = createAgentMemory(agentId: string)
190
-
191
- agent.remember(key: string, value: unknown, opts?: AgentRememberOptions): Promise<void>
192
- agent.recall(key: string, opts?: RecallOptions): Promise<MemoryEntry | null>
193
- agent.context(opts?: AgentContextOptions): Promise<ContextEntry[]>
194
- agent.update(key: string, value: unknown, opts?: AgentRememberOptions): Promise<void>
195
- agent.forget(key: string): Promise<void>
196
- agent.history(path?: string): Promise<MemoryEntry[]>
197
- agent.replay(opts: { from: number | string; to: number | string }): Promise<Record<string, any>>
198
- agent.branch(): Promise<AgentBranchState>
199
- agent.enable(bool?: boolean): Promise<void>
200
- agent.disable(): Promise<void>
201
- agent.stats(): Promise<MemoryStats>
202
- agent.clear(): Promise<void>
203
-
204
- createDefaultAgentMemory(): returns instance bound to 'default-agent'
205
-
206
- --- LLM cache ---
207
-
208
- import { cache } from 'dotmem' // actually: memory.llmCache or cache.llm
209
-
210
- cache.llm<T>(opts: {
211
- endpoint: string,
212
- prompt: string,
213
- options?: { model?: string; temperature?: number; maxTokens?: number }
214
- }): Promise<LlmCacheResult<T>>
215
-
216
- cache.llmStats(): LlmCacheStats
217
- cache.llmPurge(selector: LlmCachePurgeSelector): number
218
-
219
- --- storage / identity ---
220
-
221
- resolveDotMemStorageRoot(): string
222
- describeDotMemStorage(): DotMemStorageDescription
223
- resolveUserDotMemPath(): string
224
- resolveUserProjectMemoryPath(projectId?: string): string
225
- resolveProjectIdentity(id?: string): Promise<string>
226
- resolveUserIdentity(): UserIdentity | null
227
- setUserIdentity(id: string, identity: UserIdentity): void
228
- clearUserIdentity(): void
229
-
230
- --- mem package inspection ---
231
-
232
- inspectMem(path: string | unknown, opts?: Record<string, unknown>): MemInspection
233
- signEmpackage(pkg: unknown, key: unknown): unknown
234
-
235
- === Memory Model ===
236
-
237
- Acquire → Discover → Project
238
-
239
- Claims (AcquireOptions):
240
- - id: string (unique, deterministic)
241
- - knowledge: JsonValue (canonical English if natural language)
242
- - applicability: Record<string, JsonPrimitive> (exact-match dimensions)
243
- - evidence: [{ id, source?, observedAt?, supports? }]
244
- - epistemicType: 'observed' | 'inferred' | 'human-stated' | 'verified'
245
- - provenance: { source, detail? }
246
- - scope: 'user' | 'project'
247
- - kind: 'experience' | 'agent' | 'relationship' | 'logic' | 'note'
248
- - revision: { kind: 'refines'|'supersedes'|'retracts', claimIds: string[], reason? }
249
-
250
- Scopes:
251
- - hot: ephemeral, in-memory only
252
- - session: active session lifetime
253
- - local: Node/Bun process-bound
254
- - durable: disk-backed, survives restarts
255
-
256
- Discovery depths:
257
- - current: active claims only
258
- - deep: includes superseded/obsolete
259
-
260
- Projection statuses:
261
- - ContextProjection.status = 'candidate-context-not-current-truth'
262
-
263
- === Policy Enforcement Tiers ===
264
-
265
- | Tier | Behavior |
266
- |-----------|------------------------------|
267
- | permit | Allow without verification |
268
- | advisory | Allow with warnings |
269
- | caution | Allow with acknowledgment |
270
- | block | Prevent the operation |
271
-
272
- === Activation Phrases ===
273
-
274
- dotmem, npx dotmem, Joy, Jo
275
-
276
- Handshake: npx dotmem handshake --status
277
- Storage: <user-home>/.dotmem (override: DOTMEM_STORAGE_ROOT)
278
- Project: <storage>/projects/<project-id>.mem
279
- User: <storage>/user.mem
280
- Agent: <storage>/agent.mem
281
- Logic: <storage>/logic.mem
282
-
283
- === Security ===
284
-
285
- - Encryption: OPT-IN (not default). Enable per-context or per-scope with encryptionKey.
286
- - Client-side multitenancy: isolated memory partitions via createContext/isolate
287
- - Policy-gated writes: every acquire/remember/patch evaluated against policy
288
- - Claim immutability: stored claims never edited; corrections use refines/supersedes/retracts
289
- - Evidence tracking: all claims carry source + observedAt
290
- - Integrity: npx dotmem inspect reports integrity (bytes unchanged) and authenticity (who wrote them) as separate axes
291
- - Memory ≠ authority: projected context is untrusted; verify before relying
292
-
293
- See SECURITY.md for encryption configuration and threat model.
294
- See MEMORY.md for acquisition contract and policy language.
295
- See AGENTS.md for AI working rules and the complete memory.* surface.