audrey 0.17.0 → 0.21.0

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.
Files changed (208) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +180 -370
  3. package/dist/mcp-server/config.d.ts +44 -0
  4. package/dist/mcp-server/config.d.ts.map +1 -0
  5. package/dist/mcp-server/config.js +210 -0
  6. package/dist/mcp-server/config.js.map +1 -0
  7. package/dist/mcp-server/index.d.ts +181 -0
  8. package/dist/mcp-server/index.d.ts.map +1 -0
  9. package/dist/mcp-server/index.js +1530 -0
  10. package/dist/mcp-server/index.js.map +1 -0
  11. package/dist/src/adaptive.d.ts +7 -0
  12. package/dist/src/adaptive.d.ts.map +1 -0
  13. package/dist/src/adaptive.js +49 -0
  14. package/dist/src/adaptive.js.map +1 -0
  15. package/dist/src/affect.d.ts +19 -0
  16. package/dist/src/affect.d.ts.map +1 -0
  17. package/dist/src/affect.js +72 -0
  18. package/dist/src/affect.js.map +1 -0
  19. package/dist/src/audrey.d.ts +144 -0
  20. package/dist/src/audrey.d.ts.map +1 -0
  21. package/dist/src/audrey.js +576 -0
  22. package/dist/src/audrey.js.map +1 -0
  23. package/dist/src/capsule.d.ts +68 -0
  24. package/dist/src/capsule.d.ts.map +1 -0
  25. package/dist/src/capsule.js +311 -0
  26. package/dist/src/capsule.js.map +1 -0
  27. package/dist/src/causal.d.ts +28 -0
  28. package/dist/src/causal.d.ts.map +1 -0
  29. package/dist/src/causal.js +65 -0
  30. package/dist/src/causal.js.map +1 -0
  31. package/dist/src/confidence.d.ts +12 -0
  32. package/dist/src/confidence.d.ts.map +1 -0
  33. package/dist/src/confidence.js +63 -0
  34. package/dist/src/confidence.js.map +1 -0
  35. package/dist/src/consolidate.d.ts +8 -0
  36. package/dist/src/consolidate.d.ts.map +1 -0
  37. package/dist/src/consolidate.js +218 -0
  38. package/dist/src/consolidate.js.map +1 -0
  39. package/dist/src/context.d.ts +3 -0
  40. package/dist/src/context.d.ts.map +1 -0
  41. package/dist/src/context.js +19 -0
  42. package/dist/src/context.js.map +1 -0
  43. package/dist/src/db.d.ts +12 -0
  44. package/dist/src/db.d.ts.map +1 -0
  45. package/dist/src/db.js +380 -0
  46. package/dist/src/db.js.map +1 -0
  47. package/dist/src/decay.d.ts +7 -0
  48. package/dist/src/decay.d.ts.map +1 -0
  49. package/dist/src/decay.js +68 -0
  50. package/dist/src/decay.js.map +1 -0
  51. package/dist/src/embedding.d.ts +57 -0
  52. package/dist/src/embedding.d.ts.map +1 -0
  53. package/dist/src/embedding.js +254 -0
  54. package/dist/src/embedding.js.map +1 -0
  55. package/dist/src/encode.d.ts +15 -0
  56. package/dist/src/encode.d.ts.map +1 -0
  57. package/dist/src/encode.js +36 -0
  58. package/dist/src/encode.js.map +1 -0
  59. package/dist/src/events.d.ts +69 -0
  60. package/dist/src/events.d.ts.map +1 -0
  61. package/dist/src/events.js +149 -0
  62. package/dist/src/events.js.map +1 -0
  63. package/dist/src/export.d.ts +3 -0
  64. package/dist/src/export.d.ts.map +1 -0
  65. package/dist/src/export.js +46 -0
  66. package/dist/src/export.js.map +1 -0
  67. package/dist/src/forget.d.ts +11 -0
  68. package/dist/src/forget.d.ts.map +1 -0
  69. package/dist/src/forget.js +105 -0
  70. package/dist/src/forget.js.map +1 -0
  71. package/dist/src/fts.d.ts +34 -0
  72. package/dist/src/fts.d.ts.map +1 -0
  73. package/dist/src/fts.js +117 -0
  74. package/dist/src/fts.js.map +1 -0
  75. package/dist/src/hybrid-recall.d.ts +37 -0
  76. package/dist/src/hybrid-recall.d.ts.map +1 -0
  77. package/dist/src/hybrid-recall.js +213 -0
  78. package/dist/src/hybrid-recall.js.map +1 -0
  79. package/dist/src/import.d.ts +4 -0
  80. package/dist/src/import.d.ts.map +1 -0
  81. package/dist/src/import.js +127 -0
  82. package/dist/src/import.js.map +1 -0
  83. package/dist/src/index.d.ts +26 -0
  84. package/dist/src/index.d.ts.map +1 -0
  85. package/{src → dist/src}/index.js +7 -13
  86. package/dist/src/index.js.map +1 -0
  87. package/dist/src/interference.d.ts +13 -0
  88. package/dist/src/interference.d.ts.map +1 -0
  89. package/dist/src/interference.js +45 -0
  90. package/dist/src/interference.js.map +1 -0
  91. package/dist/src/introspect.d.ts +4 -0
  92. package/dist/src/introspect.d.ts.map +1 -0
  93. package/dist/src/introspect.js +40 -0
  94. package/dist/src/introspect.js.map +1 -0
  95. package/dist/src/llm.d.ts +38 -0
  96. package/dist/src/llm.d.ts.map +1 -0
  97. package/dist/src/llm.js +167 -0
  98. package/dist/src/llm.js.map +1 -0
  99. package/dist/src/migrate.d.ts +6 -0
  100. package/dist/src/migrate.d.ts.map +1 -0
  101. package/dist/src/migrate.js +51 -0
  102. package/dist/src/migrate.js.map +1 -0
  103. package/dist/src/preflight.d.ts +51 -0
  104. package/dist/src/preflight.d.ts.map +1 -0
  105. package/dist/src/preflight.js +201 -0
  106. package/dist/src/preflight.js.map +1 -0
  107. package/dist/src/promote.d.ts +40 -0
  108. package/dist/src/promote.d.ts.map +1 -0
  109. package/dist/src/promote.js +200 -0
  110. package/dist/src/promote.js.map +1 -0
  111. package/dist/src/prompts.d.ts +16 -0
  112. package/dist/src/prompts.d.ts.map +1 -0
  113. package/{src → dist/src}/prompts.js +172 -203
  114. package/dist/src/prompts.js.map +1 -0
  115. package/dist/src/recall.d.ts +9 -0
  116. package/dist/src/recall.d.ts.map +1 -0
  117. package/dist/src/recall.js +432 -0
  118. package/dist/src/recall.js.map +1 -0
  119. package/dist/src/redact.d.ts +27 -0
  120. package/dist/src/redact.d.ts.map +1 -0
  121. package/dist/src/redact.js +228 -0
  122. package/dist/src/redact.js.map +1 -0
  123. package/dist/src/reflexes.d.ts +35 -0
  124. package/dist/src/reflexes.d.ts.map +1 -0
  125. package/dist/src/reflexes.js +87 -0
  126. package/dist/src/reflexes.js.map +1 -0
  127. package/dist/src/rollback.d.ts +8 -0
  128. package/dist/src/rollback.d.ts.map +1 -0
  129. package/dist/src/rollback.js +33 -0
  130. package/dist/src/rollback.js.map +1 -0
  131. package/dist/src/routes.d.ts +7 -0
  132. package/dist/src/routes.d.ts.map +1 -0
  133. package/dist/src/routes.js +303 -0
  134. package/dist/src/routes.js.map +1 -0
  135. package/dist/src/rules-compiler.d.ts +20 -0
  136. package/dist/src/rules-compiler.d.ts.map +1 -0
  137. package/dist/src/rules-compiler.js +143 -0
  138. package/dist/src/rules-compiler.js.map +1 -0
  139. package/dist/src/server.d.ts +12 -0
  140. package/dist/src/server.d.ts.map +1 -0
  141. package/dist/src/server.js +22 -0
  142. package/dist/src/server.js.map +1 -0
  143. package/dist/src/tool-trace.d.ts +37 -0
  144. package/dist/src/tool-trace.d.ts.map +1 -0
  145. package/dist/src/tool-trace.js +142 -0
  146. package/dist/src/tool-trace.js.map +1 -0
  147. package/dist/src/types.d.ts +446 -0
  148. package/dist/src/types.d.ts.map +1 -0
  149. package/dist/src/types.js +6 -0
  150. package/dist/src/types.js.map +1 -0
  151. package/dist/src/ulid.d.ts +3 -0
  152. package/dist/src/ulid.d.ts.map +1 -0
  153. package/dist/src/ulid.js +11 -0
  154. package/dist/src/ulid.js.map +1 -0
  155. package/dist/src/utils.d.ts +10 -0
  156. package/dist/src/utils.d.ts.map +1 -0
  157. package/dist/src/utils.js +41 -0
  158. package/dist/src/utils.js.map +1 -0
  159. package/dist/src/validate.d.ts +22 -0
  160. package/dist/src/validate.d.ts.map +1 -0
  161. package/dist/src/validate.js +109 -0
  162. package/dist/src/validate.js.map +1 -0
  163. package/docs/assets/audrey-feature-grid.jpg +0 -0
  164. package/docs/assets/audrey-logo.svg +45 -0
  165. package/docs/assets/audrey-wordmark.png +0 -0
  166. package/docs/audrey-for-dummies.md +670 -0
  167. package/docs/future-of-llm-memory.md +452 -0
  168. package/docs/mcp-hosts.md +206 -0
  169. package/docs/ollama-local-agents.md +128 -0
  170. package/docs/production-readiness.md +37 -5
  171. package/examples/fintech-ops-demo.js +1 -1
  172. package/examples/healthcare-ops-demo.js +1 -1
  173. package/examples/ollama-memory-agent.js +326 -0
  174. package/examples/stripe-demo.js +1 -1
  175. package/package.json +54 -14
  176. package/benchmarks/baselines.js +0 -169
  177. package/benchmarks/cases.js +0 -421
  178. package/benchmarks/reference-results.js +0 -70
  179. package/benchmarks/report.js +0 -255
  180. package/benchmarks/run.js +0 -514
  181. package/mcp-server/config.js +0 -133
  182. package/mcp-server/index.js +0 -1265
  183. package/mcp-server/serve.js +0 -482
  184. package/src/adaptive.js +0 -53
  185. package/src/affect.js +0 -64
  186. package/src/audrey.js +0 -642
  187. package/src/causal.js +0 -95
  188. package/src/confidence.js +0 -120
  189. package/src/consolidate.js +0 -281
  190. package/src/context.js +0 -15
  191. package/src/db.js +0 -391
  192. package/src/decay.js +0 -84
  193. package/src/embedding.js +0 -260
  194. package/src/encode.js +0 -69
  195. package/src/export.js +0 -67
  196. package/src/forget.js +0 -111
  197. package/src/fts.js +0 -134
  198. package/src/import.js +0 -273
  199. package/src/interference.js +0 -51
  200. package/src/introspect.js +0 -48
  201. package/src/llm.js +0 -249
  202. package/src/migrate.js +0 -58
  203. package/src/recall.js +0 -573
  204. package/src/rollback.js +0 -42
  205. package/src/ulid.js +0 -18
  206. package/src/utils.js +0 -63
  207. package/src/validate.js +0 -172
  208. package/types/index.d.ts +0 -434
package/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ ## 0.21.0 - Release Diagnostics and Host Setup
4
+
5
+ - Added `npx audrey doctor` for first-contact diagnostics, JSON automation, provider checks, MCP entrypoint validation, memory-store health, and host config generation.
6
+ - Added `npx audrey install --host <host> --dry-run` so Codex, Claude Code, Claude Desktop, Cursor, Windsurf, VS Code, JetBrains, and generic MCP hosts can preview setup without accidental config writes.
7
+ - Updated docs around the recommended first run: `doctor`, `demo`, safe host install preview, then host-specific verification.
8
+ - Kept Claude Code's direct installer intact while making the default release story host-neutral.
9
+ - Refreshed lockfile transitive packages through the npm resolver; vulnerability audit remains clean.
10
+
11
+ ## 0.20.0 - Memory Reflexes
12
+
13
+ - Added Memory Preflight and Memory Reflexes so agents can check memory before acting and turn repeated failures into trigger-response guidance.
14
+ - Added Ollama/local-agent guidance and runnable local-agent example.
15
+ - Expanded host-neutral MCP docs and Audrey for Dummies onboarding.
package/README.md CHANGED
@@ -1,474 +1,284 @@
1
- # Audrey
1
+ <div align="center">
2
+ <img src="docs/assets/audrey-wordmark.png" alt="Audrey wordmark" width="760">
2
3
 
3
- [![CI](https://github.com/Evilander/Audrey/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Evilander/Audrey/actions/workflows/ci.yml)
4
- [![npm version](https://img.shields.io/npm/v/audrey.svg)](https://www.npmjs.com/package/audrey)
5
- [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
4
+ <p><strong>The local-first memory control plane for AI agents.</strong></p>
6
5
 
7
- Persistent memory for Claude Code and AI agents. Two commands, every session remembers.
6
+ <p>
7
+ Give Codex, Claude Code, Claude Desktop, Cursor, Windsurf, VS Code, JetBrains, Ollama-backed agents,
8
+ and custom agent services one durable memory layer they can check before they act.
9
+ </p>
8
10
 
9
- ```bash
10
- npx audrey install # 13 MCP memory tools
11
- npx audrey hooks install # automatic memory in every session
12
- ```
13
-
14
- That's it. Claude Code now wakes up knowing what happened yesterday, recalls relevant context per-prompt, and consolidates learnings when the session ends. No cloud, no config files, no infrastructure — one SQLite file.
15
-
16
- Audrey also works as a standalone SDK, MCP server, and REST API for any AI agent framework.
17
-
18
- > **On `/dream`** — Anthropic recently shipped `/dream` for Claude Code memory maintenance. Audrey predates it and goes further: episodic-to-semantic consolidation, contradiction detection, confidence decay, emotional affect, causal reasoning, and source reliability weighting. `/dream` is a maintenance pass. Audrey is a cognitive memory architecture.
19
-
20
- ## Why Audrey
21
-
22
- Most AI memory tools are storage wrappers. They save facts, retrieve facts, and keep everything forever. That leaves real production problems unsolved:
11
+ <p>
12
+ <a href="https://github.com/Evilander/Audrey/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/Evilander/Audrey/actions/workflows/ci.yml/badge.svg?branch=master"></a>
13
+ <a href="https://www.npmjs.com/package/audrey"><img alt="npm version" src="https://img.shields.io/npm/v/audrey.svg"></a>
14
+ <a href="LICENSE"><img alt="MIT license" src="https://img.shields.io/badge/license-MIT-blue.svg"></a>
15
+ </p>
16
+ </div>
23
17
 
24
- - Old information stays weighted like new information.
25
- - Raw events never become reusable operating knowledge.
26
- - Conflicting facts quietly coexist.
27
- - Model-generated mistakes can get reinforced into false "truth."
18
+ ## Why Audrey Exists
28
19
 
29
- Audrey models memory as a working system instead of a filing cabinet.
20
+ Agents forget the exact mistakes they made yesterday. They repeat broken commands, lose project-specific rules, miss contradictions, and treat every new session like a cold start.
30
21
 
31
- | Brain Structure | Audrey Component | What It Does |
32
- |---|---|---|
33
- | Hippocampus | Episodic Memory | Fast capture of raw events and observations |
34
- | Neocortex | Semantic Memory | Consolidated principles and patterns |
35
- | Cerebellum | Procedural Memory | Learned workflows and conditional behaviors |
36
- | Sleep Replay | Dream Cycle | Consolidates episodes into principles and applies decay |
37
- | Prefrontal Cortex | Validation Engine | Truth-checking and contradiction detection |
38
- | Amygdala | Affect System | Emotional encoding, arousal-salience coupling, and mood-congruent recall |
39
-
40
- ## What You Get
41
-
42
- - Local SQLite-backed memory with `sqlite-vec`
43
- - MCP server for Claude Code with 13 memory tools
44
- - **Claude Code hooks integration** — automatic memory in every session (`npx audrey hooks install`)
45
- - JavaScript SDK for direct application use
46
- - **Git-friendly versioning** via JSON snapshots (`npx audrey snapshot` / `restore`)
47
- - **REST API server** - any language, any framework (`npx audrey serve`)
48
- - Health checks via `npx audrey status --json`
49
- - Benchmark harness with retrieval and lifecycle-operation tracks via `npm run bench:memory`
50
- - Regression gate for benchmark quality via `npm run bench:memory:check`
51
- - Optional local embeddings and optional hosted LLM providers
52
- - Strongest production fit today in financial services ops and healthcare ops
53
-
54
- ## Install
55
-
56
- ### MCP Server for Claude Code
57
-
58
- ```bash
59
- npx audrey install # Register 13 MCP memory tools
60
- npx audrey hooks install # Wire automatic memory into session lifecycle
61
- ```
22
+ Audrey turns those hard-won lessons into a local memory runtime:
62
23
 
63
- Audrey auto-detects providers from your environment:
24
+ - `memory_recall` finds durable context by semantic similarity.
25
+ - `memory_preflight` checks prior failures, risks, rules, and relevant procedures before an action.
26
+ - `memory_reflexes` converts remembered evidence into trigger-response guidance agents can follow.
27
+ - `memory_dream` consolidates episodes into principles and applies decay.
28
+ - `audrey doctor` tells a human or CI system whether the runtime is actually ready.
64
29
 
65
- - `GOOGLE_API_KEY` or `GEMINI_API_KEY` -> Gemini embeddings (3072d)
66
- - no embedding key -> local embeddings (384d, MiniLM, offline-capable)
67
- - `AUDREY_EMBEDDING_PROVIDER=openai` -> explicit OpenAI embeddings (1536d)
68
- - `ANTHROPIC_API_KEY` -> LLM-powered consolidation, contradiction detection, and reflection
30
+ It is not a hosted vector database, a notes app, or a Claude-only plugin. Audrey is a SQLite-backed continuity layer that can sit under any local or sidecar agent loop.
69
31
 
70
- Quick checks:
32
+ <div align="center">
33
+ <img src="docs/assets/audrey-feature-grid.jpg" alt="Audrey feature marks: memory continuity, archive signal, recall loop, layered evidence, local node, and remembering before acting" width="760">
34
+ </div>
71
35
 
72
- ```bash
73
- npx audrey status
74
- npx audrey status --json
75
- npx audrey status --json --fail-on-unhealthy
76
- ```
36
+ ## Quick Start
77
37
 
78
- ### SDK
38
+ Requires Node.js 20+.
79
39
 
80
40
  ```bash
81
- npm install audrey
41
+ npx audrey doctor
42
+ npx audrey demo
82
43
  ```
83
44
 
84
- Zero external infrastructure. One SQLite file.
85
-
86
- ## Quick Start
87
-
88
- ```js
89
- import { Audrey } from 'audrey';
90
-
91
- const brain = new Audrey({
92
- dataDir: './agent-memory',
93
- agent: 'support-agent',
94
- embedding: { provider: 'local', dimensions: 384 },
95
- });
96
-
97
- await brain.encode({
98
- content: 'Stripe API returned 429 above 100 req/s',
99
- source: 'direct-observation',
100
- tags: ['stripe', 'rate-limit'],
101
- context: { task: 'debugging', domain: 'payments' },
102
- affect: { valence: -0.4, arousal: 0.7, label: 'frustration' },
103
- });
104
-
105
- const memories = await brain.recall('stripe rate limits', {
106
- limit: 5,
107
- context: { task: 'debugging', domain: 'payments' },
108
- });
45
+ `doctor` verifies Node, the MCP entrypoint, provider selection, memory-store health, and host config generation. `demo` runs a no-key, no-host, no-network proof: it creates temporary memories, records a redacted failed tool trace, generates a Memory Capsule, proves recall, prints Memory Reflexes, and deletes the demo store.
109
46
 
110
- const dream = await brain.dream();
111
- const briefing = await brain.greeting({ context: 'debugging stripe' });
47
+ Expected first-run shape:
112
48
 
113
- await brain.waitForIdle();
114
- brain.close();
49
+ ```text
50
+ Audrey Doctor v0.21.0
51
+ Store health: not initialized
52
+ Verdict: ready
115
53
  ```
116
54
 
117
- ## MCP Tools
55
+ After the first real memory write, `doctor` should report the store as healthy.
118
56
 
119
- Every Claude Code session gets these tools after `npx audrey install`:
57
+ ## Install Into Agent Hosts
120
58
 
121
- - `memory_encode`
122
- - `memory_recall`
123
- - `memory_consolidate`
124
- - `memory_dream`
125
- - `memory_introspect`
126
- - `memory_resolve_truth`
127
- - `memory_export`
128
- - `memory_import`
129
- - `memory_forget`
130
- - `memory_decay`
131
- - `memory_status`
132
- - `memory_reflect`
133
- - `memory_greeting`
134
-
135
- ## CLI
59
+ Preview host setup without editing config files:
136
60
 
137
61
  ```bash
138
- # Setup
139
- npx audrey install # Register MCP server with Claude Code
140
- npx audrey uninstall # Remove MCP server registration
141
- npx audrey hooks install # Wire Audrey into Claude Code hooks (automatic memory)
142
- npx audrey hooks uninstall # Remove Audrey hooks
143
-
144
- # Health and monitoring
145
- npx audrey status # Human-readable health report
146
- npx audrey status --json # Machine-readable health output
147
- npx audrey status --json --fail-on-unhealthy # CI gate
148
-
149
- # Session lifecycle (used by hooks automatically)
150
- npx audrey greeting # Load identity, principles, mood
151
- npx audrey greeting "auth" # With context-aware recall
152
- npx audrey recall "query" # Semantic memory search (returns hook-compatible JSON)
153
- npx audrey reflect # Consolidate learnings from stdin conversation + dream
154
-
155
- # Maintenance
156
- npx audrey dream # Full consolidation + decay cycle
157
- npx audrey reembed # Re-embed all memories after provider/dimension change
158
-
159
- # Versioning
160
- npx audrey snapshot # Export memories to timestamped JSON file
161
- npx audrey snapshot backup.json # Export to specific file
162
- npx audrey restore backup.json # Restore from snapshot (re-embeds with current provider)
163
- npx audrey restore backup.json --force # Overwrite existing memories
164
-
165
- # REST API server
166
- npx audrey serve # Start HTTP server on port 3487
167
- npx audrey serve 8080 # Custom port
62
+ npx audrey install --host codex --dry-run
63
+ npx audrey install --host claude-code --dry-run
64
+ npx audrey install --host generic --dry-run
168
65
  ```
169
66
 
170
- ## Hooks Integration
171
-
172
- Audrey integrates directly into Claude Code's hook lifecycle for automatic, zero-config memory in every session:
67
+ Generate raw config blocks:
173
68
 
174
69
  ```bash
175
- npx audrey hooks install
70
+ npx audrey mcp-config codex
71
+ npx audrey mcp-config generic
72
+ npx audrey mcp-config vscode
176
73
  ```
177
74
 
178
- This configures four hooks in `~/.claude/settings.json`:
179
-
180
- | Hook Event | Command | What Happens |
181
- |---|---|---|
182
- | **SessionStart** | `npx audrey greeting` | Loads identity, learned principles, current mood, and recent memories |
183
- | **UserPromptSubmit** | `npx audrey recall` | Semantic search on every prompt — injects relevant memories as context |
184
- | **Stop** | `npx audrey reflect` | Extracts lasting learnings from the conversation, then runs a dream cycle |
185
- | **PostCompact** | `npx audrey greeting` | Re-injects critical memories after context window compaction |
186
-
187
- With hooks installed, Claude Code sessions automatically wake up with context, recall relevant memories per-prompt, and consolidate learnings when the session ends. No manual tool calls needed.
188
-
189
- ## REST API Server
190
-
191
- Turn Audrey into an HTTP service that any language or framework can use:
75
+ Claude Code can be registered directly:
192
76
 
193
77
  ```bash
194
- npx audrey serve # Start on port 3487
195
- npx audrey serve 8080 # Custom port
196
- AUDREY_API_KEY=secret npx audrey serve # With Bearer token auth
78
+ npx audrey install
79
+ claude mcp list
197
80
  ```
198
81
 
199
- Endpoints:
82
+ All local MCP paths default to local embeddings and one shared SQLite-backed memory directory. Use `AUDREY_DATA_DIR` to isolate projects, tenants, or host identities.
200
83
 
201
- | Method | Path | Description |
202
- |--------|------|-------------|
203
- | `GET` | `/health` | Liveness probe |
204
- | `GET` | `/status` | Memory stats (introspect) |
205
- | `POST` | `/encode` | Store a memory (`{ content, source, tags?, context?, affect? }`) |
206
- | `POST` | `/recall` | Semantic search (`{ query, limit?, context? }`) |
207
- | `POST` | `/dream` | Full consolidation + decay cycle |
208
- | `POST` | `/consolidate` | Run consolidation only |
209
- | `POST` | `/forget` | Forget by `{ id }` or `{ query }` |
210
- | `POST` | `/snapshot` | Export all memories as JSON |
211
- | `POST` | `/restore` | Wipe and reimport from snapshot |
84
+ ## Use With Ollama And Local Agents
212
85
 
213
- Example from any language:
86
+ Ollama runs models; Audrey supplies memory. Start Audrey as a local REST sidecar and expose its routes as tools in your agent loop:
214
87
 
215
88
  ```bash
216
- # Store a memory
217
- curl -X POST http://localhost:3487/encode \
218
- -H "Content-Type: application/json" \
219
- -d '{"content": "The deploy failed due to OOM", "source": "direct-observation"}'
220
-
221
- # Search memories
222
- curl -X POST http://localhost:3487/recall \
223
- -H "Content-Type: application/json" \
224
- -d '{"query": "deploy failures", "limit": 5}'
89
+ AUDREY_AGENT=ollama-local-agent npx audrey serve
90
+ curl http://localhost:7437/health
91
+ curl http://localhost:7437/v1/status
225
92
  ```
226
93
 
227
- ## Versioning
228
-
229
- Audrey stores memories in SQLite with WAL mode, which isn't git-friendly. Instead, use JSON snapshots:
94
+ Runnable example:
230
95
 
231
96
  ```bash
232
- # Save a checkpoint
233
- npx audrey snapshot
234
-
235
- # Commit it
236
- git add audrey-snapshot-*.json && git commit -m "memory checkpoint"
237
-
238
- # Restore on another machine or after a reset
239
- npx audrey restore audrey-snapshot-2026-03-24_15-30-00.json
97
+ AUDREY_AGENT=ollama-local-agent npx audrey serve
98
+ OLLAMA_MODEL=qwen3 node examples/ollama-memory-agent.js "What should you remember about Audrey?"
240
99
  ```
241
100
 
242
- Snapshots are human-readable, diffable, and provider-agnostic. Embeddings are re-generated on import, so you can switch providers (e.g., local to Gemini) and restore seamlessly.
243
-
244
- ## Production Fit
245
-
246
- Audrey is strongest today in workflows where memory must stay local, reviewable, and durable:
247
-
248
- - **Financial services operations**: payments ops, fraud and dispute workflows, KYC/KYB review, internal policy assistants
249
- - **Healthcare operations**: care coordination, prior-auth workflows, intake and referral routing, internal staff knowledge assistants
250
-
251
- Audrey is a memory layer, not a compliance boundary. For regulated environments, pair it with application-level access control, encryption, retention, audit logging, and data-minimization rules.
252
-
253
- Production guide: [docs/production-readiness.md](docs/production-readiness.md)
254
-
255
- Industry demos:
256
-
257
- - [examples/fintech-ops-demo.js](examples/fintech-ops-demo.js)
258
- - [examples/healthcare-ops-demo.js](examples/healthcare-ops-demo.js)
101
+ Core sidecar tools:
259
102
 
260
- ## Core Concepts
103
+ | Agent Need | REST Route |
104
+ |---|---|
105
+ | Check memory before acting | `POST /v1/preflight` |
106
+ | Get reflex rules for an action | `POST /v1/reflexes` |
107
+ | Store a useful observation | `POST /v1/encode` |
108
+ | Recall relevant context | `POST /v1/recall` |
109
+ | Get a turn-sized memory packet | `POST /v1/capsule` |
110
+ | Check health | `GET /v1/status` |
261
111
 
262
- ### Memory Types
112
+ ## What Ships
263
113
 
264
- - **Episodic**: raw events and observations
265
- - **Semantic**: consolidated principles
266
- - **Procedural**: reusable workflows and actions
267
- - **Causal**: relationships that explain why something happened
114
+ | Surface | Status |
115
+ |---|---|
116
+ | MCP stdio server | 19 tools, resources, and prompt templates |
117
+ | CLI | `doctor`, `demo`, `install`, `mcp-config`, `status`, `dream`, `reembed`, `observe-tool`, `promote` |
118
+ | REST API | Hono server with `/health`, `/openapi.json`, `/docs`, and `/v1/*` routes |
119
+ | JavaScript SDK | Direct TypeScript/Node import from `audrey` |
120
+ | Python client | `pip install audrey-memory`, calls the REST sidecar |
121
+ | Storage | Local SQLite plus `sqlite-vec`, no hosted database required |
122
+ | Deployment | npm package, Docker, Compose, host-specific MCP config generation |
123
+ | Safety loop | preflight warnings, reflexes, redacted tool traces, contradiction handling |
268
124
 
269
- ### Confidence
125
+ ## Memory Model
270
126
 
271
- Audrey scores memories using source reliability, evidence agreement, recency decay, and retrieval reinforcement. That helps keep direct observations above guesses and keeps stale or weakly supported knowledge from dominating recall.
127
+ Audrey is built around the parts of memory that matter for agents:
272
128
 
273
- ### Dream Cycle
129
+ - Episodic memory: specific observations, tool results, preferences, and session facts.
130
+ - Semantic memory: consolidated principles extracted from repeated evidence.
131
+ - Procedural memory: remembered ways to act, avoid, retry, or verify.
132
+ - Affect and salience: emotional weight and importance influence recall.
133
+ - Interference and decay: stale, conflicting, or low-confidence memories lose authority over time.
134
+ - Contradiction handling: competing claims are tracked instead of silently overwritten.
135
+ - Tool-trace learning: failed commands and risky actions become future preflight warnings.
274
136
 
275
- `brain.dream()` runs the full maintenance path:
137
+ The product bet is simple: the next generation of useful agents will not just retrieve facts. They will remember what happened, decide whether a memory is still trustworthy, and use that memory before touching tools.
276
138
 
277
- 1. Consolidate related episodes into principles.
278
- 2. Apply decay so low-value memories lose weight over time.
279
- 3. Report memory health and current stats.
139
+ ## Use Audrey From Code
280
140
 
281
- ### Contradiction Handling
282
-
283
- When evidence conflicts, Audrey tracks the contradiction instead of silently picking a winner. Resolutions can stay open, be marked resolved, or become context-dependent.
284
-
285
- ## Configuration
141
+ ### JavaScript
286
142
 
287
143
  ```js
144
+ import { Audrey } from 'audrey';
145
+
288
146
  const brain = new Audrey({
289
147
  dataDir: './audrey-data',
290
- agent: 'my-agent',
291
- embedding: {
292
- provider: 'local', // mock | local | gemini | openai
293
- dimensions: 384,
294
- device: 'gpu',
295
- },
296
- llm: {
297
- provider: 'anthropic', // mock | anthropic | openai
298
- apiKey: process.env.ANTHROPIC_API_KEY,
299
- },
300
- consolidation: {
301
- minEpisodes: 3,
302
- },
303
- context: {
304
- enabled: true,
305
- weight: 0.3,
306
- },
307
- affect: {
308
- enabled: true,
309
- weight: 0.2,
310
- },
311
- decay: {
312
- dormantThreshold: 0.1,
313
- },
148
+ agent: 'support-agent',
149
+ embedding: { provider: 'local', dimensions: 384 },
314
150
  });
315
- ```
316
151
 
317
- ## Operations
318
-
319
- Recommended production workflow:
320
-
321
- ```bash
322
- # Health checks
323
- npx audrey status
324
- npx audrey status --json --fail-on-unhealthy
325
-
326
- # Scheduled maintenance
327
- npx audrey dream
328
-
329
- # Repair vector/index drift after provider or dimension changes
330
- npx audrey reembed
152
+ await brain.encode({
153
+ content: 'Stripe returns HTTP 429 above 100 req/s',
154
+ source: 'direct-observation',
155
+ tags: ['stripe', 'rate-limit'],
156
+ });
331
157
 
332
- # Version control your memories
333
- npx audrey snapshot
334
- npx audrey restore <file> --force
158
+ const memories = await brain.recall('stripe rate limit');
335
159
 
336
- # Run the benchmark harness
337
- npm run bench:memory
338
-
339
- # Fail CI if Audrey drops below benchmark guardrails
340
- npm run bench:memory:check
160
+ await brain.waitForIdle();
161
+ brain.close();
341
162
  ```
342
163
 
343
- ## Benchmarking
344
-
345
- Audrey now ships with a memory benchmark harness built for three purposes:
346
-
347
- - measure Audrey against naive local baselines on LongMemEval-style memory abilities plus privacy and abstention checks
348
- - measure Audrey on lifecycle operations that other memory systems usually hand-wave: update, overwrite, delete, merge, and abstain
349
- - keep Audrey grounded against published LoCoMo results from leading memory systems
350
-
351
- Run it with:
164
+ ### Python
352
165
 
353
166
  ```bash
354
- npm run bench:memory
167
+ pip install audrey-memory
355
168
  ```
356
169
 
357
- Artifacts land in `benchmarks/output/` as JSON, SVG charts, and an HTML report.
170
+ ```python
171
+ from audrey_memory import Audrey
358
172
 
359
- For CI and release gates:
360
-
361
- ```bash
362
- npm run bench:memory:check
173
+ brain = Audrey(base_url="http://127.0.0.1:7437", agent="support-agent")
174
+ memory_id = brain.encode("Stripe returns HTTP 429 above 100 req/s", source="direct-observation")
175
+ results = brain.recall("stripe rate limit", limit=5)
176
+ brain.close()
363
177
  ```
364
178
 
365
- That command fails if Audrey drops below its minimum local score, local pass rate, or required margin over the strongest naive baseline.
179
+ ## Production Readiness
180
+
181
+ Audrey is close to a 1.0-ready local memory runtime, but production depends on how it is embedded. Treat it like stateful infrastructure.
366
182
 
367
- For track-specific runs:
183
+ Release gates used for this package:
368
184
 
369
185
  ```bash
370
- npm run bench:memory:retrieval
371
- npm run bench:memory:operations
186
+ npm run build
187
+ npm run typecheck
188
+ npm run bench:memory:check
189
+ npm pack --dry-run
190
+ npx audrey doctor
191
+ npx audrey demo
372
192
  ```
373
193
 
374
- For committed GitHub-friendly charts:
194
+ Recommended runtime checks:
375
195
 
376
196
  ```bash
377
- npm run bench:memory:readme-assets
197
+ npx audrey doctor --json
198
+ npx audrey status --json --fail-on-unhealthy
199
+ npx audrey install --host codex --dry-run
378
200
  ```
379
201
 
380
- ### README Snapshot
381
-
382
- Local Audrey-vs-baseline results:
383
-
384
- ![Audrey local memory benchmark](docs/assets/benchmarks/local-benchmark.svg)
385
-
386
- Lifecycle operations benchmark:
202
+ Production controls you still own:
387
203
 
388
- ![Audrey memory operations benchmark](docs/assets/benchmarks/operations-benchmark.svg)
204
+ - Set one `AUDREY_DATA_DIR` per tenant, environment, or isolation boundary.
205
+ - Pin `AUDREY_EMBEDDING_PROVIDER` and `AUDREY_LLM_PROVIDER` explicitly.
206
+ - Back up the SQLite data directory before provider or dimension changes.
207
+ - Keep API keys and raw credentials out of encoded memory content.
208
+ - Use `AUDREY_API_KEY` if the REST sidecar is reachable beyond the local process boundary.
209
+ - Run `npx audrey dream` on a schedule so consolidation and decay stay current.
210
+ - Add application-level encryption, retention, access control, and audit logging for regulated environments.
389
211
 
390
- Published comparison anchors from current LLM memory systems:
212
+ Read the full guide: [docs/production-readiness.md](docs/production-readiness.md).
391
213
 
392
- ![Published LLM memory benchmark comparison](docs/assets/benchmarks/published-memory-standards.svg)
214
+ ## Benchmarks
393
215
 
394
- **Current deterministic CI snapshot** (`node benchmarks/run.js --provider mock --dimensions 64`):
216
+ Audrey ships with a benchmark harness and release gate:
395
217
 
396
- | Local track | Audrey | Best Baseline |
397
- |---|---|---|
398
- | Combined local benchmark | **100.0%** | 41.7% |
399
- | Retrieval capabilities | **100.0%** | 56.3% |
400
- | Memory operations | **100.0%** | 25.0% |
401
-
402
- Retrieval-family breakdown:
403
-
404
- | Category | Audrey | Vector Only | Best Baseline |
405
- |---|---|---|---|
406
- | Information Extraction | 100% | 100% | 100% |
407
- | Knowledge Updates | 100% | 50% | 50% |
408
- | Multi-Session Reasoning | 100% | 100% | 100% |
409
- | Temporal Reasoning | 100% | 100% | 100% |
410
- | Abstention | 100% | 50% | 50% |
411
- | Conflict Resolution | 100% | 50% | 50% |
412
- | Procedural Learning | 100% | 0% | 0% |
413
- | Privacy | 100% | 0% | 0% |
218
+ ```bash
219
+ npm run bench:memory
220
+ npm run bench:memory:check
221
+ ```
414
222
 
415
- Operation-family breakdown:
223
+ Current repo snapshot:
416
224
 
417
- | Operation | Audrey | Vector Only | Best Baseline |
418
- |---|---|---|---|
419
- | Update / Overwrite | 100% | 50% | 50% |
420
- | Delete + Abstain | 100% | 0% | 50% |
421
- | Semantic Merge | 100% | 0% | 0% |
422
- | Procedural Merge | 100% | 0% | 0% |
225
+ ![Audrey local benchmark](docs/assets/benchmarks/local-benchmark.svg)
423
226
 
424
- Published comparison anchors from the field (different benchmarks and conditions - included for field context, not direct comparison):
227
+ The benchmark suite covers retrieval behavior, overwrite behavior, delete/abstain behavior, and semantic/procedural merge behavior. For methodology and comparison anchors, see [docs/benchmarking.md](docs/benchmarking.md).
425
228
 
426
- | System | Benchmark | Score | What it represents |
427
- |---|---|---|---|
428
- | **Audrey** | Internal retrieval + operations benchmark | **100.0%** | Update, overwrite, delete, merge, abstention, consolidation, privacy |
429
- | MIRIX | Published LoCoMo | 85.4% | Typed multimodal memory |
430
- | Letta Filesystem | Published LoCoMo | 74.0% | Context-engineering |
431
- | Mem0 Graph Memory | Published LoCoMo | 68.5% | Graph memory |
432
- | Mem0 | Published LoCoMo | 66.9% | Production baseline |
229
+ ## Command Reference
433
230
 
434
- Primary comparison sources:
231
+ ```bash
232
+ # First contact
233
+ npx audrey doctor
234
+ npx audrey demo
235
+
236
+ # MCP setup
237
+ npx audrey install --host codex --dry-run
238
+ npx audrey mcp-config codex
239
+ npx audrey mcp-config generic
240
+ npx audrey install
241
+ npx audrey uninstall
242
+
243
+ # Health and maintenance
244
+ npx audrey status
245
+ npx audrey status --json --fail-on-unhealthy
246
+ npx audrey dream
247
+ npx audrey reembed
435
248
 
436
- - [MIRIX paper](https://arxiv.org/abs/2507.07957)
437
- - [Mem0 paper](https://arxiv.org/abs/2504.19413)
438
- - [Letta benchmark write-up](https://www.letta.com/blog/benchmarking-ai-agent-memory)
439
- - [LongMemEval paper](https://arxiv.org/abs/2410.10813)
249
+ # Tool-trace learning
250
+ npx audrey observe-tool --event PostToolUse --tool Bash --outcome failed
251
+ npx audrey promote --dry-run
440
252
 
441
- Benchmark guide: [docs/benchmarking.md](docs/benchmarking.md)
253
+ # REST sidecar
254
+ npx audrey serve
255
+ docker compose up -d --build
256
+ ```
442
257
 
443
- ## Repository
258
+ ## Documentation
444
259
 
445
- - Contributing guide: [CONTRIBUTING.md](CONTRIBUTING.md)
446
- - Security policy: [SECURITY.md](SECURITY.md)
447
- - CI workflow: [.github/workflows/ci.yml](.github/workflows/ci.yml)
448
- - Benchmarking guide: [docs/benchmarking.md](docs/benchmarking.md)
260
+ - [Audrey for Dummies](docs/audrey-for-dummies.md)
261
+ - [MCP host guide](docs/mcp-hosts.md)
262
+ - [Ollama and local agents](docs/ollama-local-agents.md)
263
+ - [Production readiness](docs/production-readiness.md)
264
+ - [Future of LLM memory](docs/future-of-llm-memory.md)
265
+ - [Benchmarking](docs/benchmarking.md)
266
+ - [Security policy](SECURITY.md)
449
267
 
450
268
  ## Development
451
269
 
452
270
  ```bash
453
271
  npm ci
272
+ npm run build
273
+ npm run typecheck
454
274
  npm test
455
- npm run pack:check
456
- npm run bench:memory
457
- npm run bench:memory:retrieval
458
- npm run bench:memory:operations
459
275
  npm run bench:memory:check
460
- npm run bench:memory:readme-assets
276
+ npm run pack:check
277
+ python -m unittest discover -s python/tests -v
278
+ python -m build --no-isolation python
461
279
  ```
462
280
 
463
- Current validated baseline:
464
-
465
- - `npm test`
466
- - `npm run pack:check`
467
- - `npm run bench:memory`
468
- - `npm run bench:memory:retrieval`
469
- - `npm run bench:memory:operations`
470
- - `npm run bench:memory:check`
471
- - `npm run bench:memory:readme-assets`
281
+ On some locked-down Windows hosts, Vitest/Vite can fail before tests start with `spawn EPERM`. That is an environment process-spawn blocker, not an Audrey runtime failure. Use build, typecheck, benchmark, pack dry-run, direct `dist/` smokes, and GitHub Actions as the release evidence path.
472
282
 
473
283
  ## License
474
284