audrey 1.1.3 → 1.2.1

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 (285) hide show
  1. package/CHANGELOG.md +97 -0
  2. package/README.md +39 -12
  3. package/dist/mcp-server/codex-hooks-probe.d.ts +22 -0
  4. package/dist/mcp-server/codex-hooks-probe.d.ts.map +1 -0
  5. package/dist/mcp-server/codex-hooks-probe.js +160 -0
  6. package/dist/mcp-server/codex-hooks-probe.js.map +1 -0
  7. package/dist/mcp-server/config.d.ts +26 -2
  8. package/dist/mcp-server/config.d.ts.map +1 -1
  9. package/dist/mcp-server/config.js +54 -22
  10. package/dist/mcp-server/config.js.map +1 -1
  11. package/dist/mcp-server/hooks.d.ts +28 -0
  12. package/dist/mcp-server/hooks.d.ts.map +1 -1
  13. package/dist/mcp-server/hooks.js +91 -2
  14. package/dist/mcp-server/hooks.js.map +1 -1
  15. package/dist/mcp-server/index.d.ts +242 -2
  16. package/dist/mcp-server/index.d.ts.map +1 -1
  17. package/dist/mcp-server/index.js +806 -240
  18. package/dist/mcp-server/index.js.map +1 -1
  19. package/dist/mcp-server/tool-schemas.d.ts +32 -2
  20. package/dist/mcp-server/tool-schemas.d.ts.map +1 -1
  21. package/dist/mcp-server/tool-schemas.js +55 -0
  22. package/dist/mcp-server/tool-schemas.js.map +1 -1
  23. package/dist/src/audrey.d.ts +14 -2
  24. package/dist/src/audrey.d.ts.map +1 -1
  25. package/dist/src/audrey.js +152 -28
  26. package/dist/src/audrey.js.map +1 -1
  27. package/dist/src/autopilot.d.ts +22 -0
  28. package/dist/src/autopilot.d.ts.map +1 -1
  29. package/dist/src/autopilot.js +271 -50
  30. package/dist/src/autopilot.js.map +1 -1
  31. package/dist/src/capsule.d.ts +23 -0
  32. package/dist/src/capsule.d.ts.map +1 -1
  33. package/dist/src/capsule.js +56 -11
  34. package/dist/src/capsule.js.map +1 -1
  35. package/dist/src/confidence.d.ts +9 -1
  36. package/dist/src/confidence.d.ts.map +1 -1
  37. package/dist/src/confidence.js +16 -2
  38. package/dist/src/confidence.js.map +1 -1
  39. package/dist/src/consolidate.d.ts +4 -0
  40. package/dist/src/consolidate.d.ts.map +1 -1
  41. package/dist/src/consolidate.js +206 -34
  42. package/dist/src/consolidate.js.map +1 -1
  43. package/dist/src/controller.d.ts +17 -1
  44. package/dist/src/controller.d.ts.map +1 -1
  45. package/dist/src/controller.js +244 -128
  46. package/dist/src/controller.js.map +1 -1
  47. package/dist/src/db.d.ts.map +1 -1
  48. package/dist/src/db.js +233 -56
  49. package/dist/src/db.js.map +1 -1
  50. package/dist/src/encode.d.ts +2 -1
  51. package/dist/src/encode.d.ts.map +1 -1
  52. package/dist/src/encode.js +41 -4
  53. package/dist/src/encode.js.map +1 -1
  54. package/dist/src/events.d.ts +48 -1
  55. package/dist/src/events.d.ts.map +1 -1
  56. package/dist/src/events.js +160 -62
  57. package/dist/src/events.js.map +1 -1
  58. package/dist/src/export.d.ts.map +1 -1
  59. package/dist/src/export.js +4 -4
  60. package/dist/src/export.js.map +1 -1
  61. package/dist/src/grounding.d.ts +111 -0
  62. package/dist/src/grounding.d.ts.map +1 -0
  63. package/dist/src/grounding.js +259 -0
  64. package/dist/src/grounding.js.map +1 -0
  65. package/dist/src/hybrid-recall.d.ts +16 -7
  66. package/dist/src/hybrid-recall.d.ts.map +1 -1
  67. package/dist/src/hybrid-recall.js +22 -11
  68. package/dist/src/hybrid-recall.js.map +1 -1
  69. package/dist/src/import.d.ts +10 -0
  70. package/dist/src/import.d.ts.map +1 -1
  71. package/dist/src/import.js +122 -22
  72. package/dist/src/import.js.map +1 -1
  73. package/dist/src/llm.d.ts.map +1 -1
  74. package/dist/src/llm.js +16 -0
  75. package/dist/src/llm.js.map +1 -1
  76. package/dist/src/preflight.d.ts.map +1 -1
  77. package/dist/src/preflight.js +89 -47
  78. package/dist/src/preflight.js.map +1 -1
  79. package/dist/src/project.d.ts +4 -1
  80. package/dist/src/project.d.ts.map +1 -1
  81. package/dist/src/project.js +65 -5
  82. package/dist/src/project.js.map +1 -1
  83. package/dist/src/recall.d.ts.map +1 -1
  84. package/dist/src/recall.js +138 -13
  85. package/dist/src/recall.js.map +1 -1
  86. package/dist/src/redact.d.ts +1 -1
  87. package/dist/src/redact.d.ts.map +1 -1
  88. package/dist/src/redact.js +185 -5
  89. package/dist/src/redact.js.map +1 -1
  90. package/dist/src/routes.d.ts.map +1 -1
  91. package/dist/src/routes.js +91 -18
  92. package/dist/src/routes.js.map +1 -1
  93. package/dist/src/trust.d.ts +35 -0
  94. package/dist/src/trust.d.ts.map +1 -0
  95. package/dist/src/trust.js +77 -0
  96. package/dist/src/trust.js.map +1 -0
  97. package/dist/src/types.d.ts +24 -0
  98. package/dist/src/types.d.ts.map +1 -1
  99. package/package.json +3 -37
  100. package/benchmarks/adapter-kit.mjs +0 -20
  101. package/benchmarks/adapter-self-test.mjs +0 -170
  102. package/benchmarks/adapters/example-allow.mjs +0 -31
  103. package/benchmarks/adapters/mem0-platform.mjs +0 -274
  104. package/benchmarks/adapters/registry.json +0 -51
  105. package/benchmarks/adapters/zep-cloud.mjs +0 -304
  106. package/benchmarks/baselines.js +0 -174
  107. package/benchmarks/build-leaderboard.mjs +0 -183
  108. package/benchmarks/cases.js +0 -549
  109. package/benchmarks/create-conformance-card.mjs +0 -148
  110. package/benchmarks/create-submission-bundle.mjs +0 -190
  111. package/benchmarks/dry-run-external-adapters.mjs +0 -177
  112. package/benchmarks/guardbench.js +0 -1265
  113. package/benchmarks/output/adapter-self-test/guardbench-adapter-self-test.json +0 -50
  114. package/benchmarks/output/external/guardbench-external-dry-run.json +0 -69
  115. package/benchmarks/output/external/guardbench-external-evidence.json +0 -56
  116. package/benchmarks/output/guardbench-conformance-card.json +0 -63
  117. package/benchmarks/output/guardbench-manifest.json +0 -414
  118. package/benchmarks/output/guardbench-raw.json +0 -1279
  119. package/benchmarks/output/guardbench-summary.json +0 -2123
  120. package/benchmarks/output/leaderboard/guardbench-leaderboard.json +0 -93
  121. package/benchmarks/output/leaderboard/guardbench-leaderboard.md +0 -7
  122. package/benchmarks/output/submission-bundle/guardbench-conformance-card.json +0 -63
  123. package/benchmarks/output/submission-bundle/guardbench-manifest.json +0 -414
  124. package/benchmarks/output/submission-bundle/guardbench-raw.json +0 -1279
  125. package/benchmarks/output/submission-bundle/guardbench-summary.json +0 -2123
  126. package/benchmarks/output/submission-bundle/schemas/guardbench-adapter-registry.schema.json +0 -69
  127. package/benchmarks/output/submission-bundle/schemas/guardbench-adapter-self-test.schema.json +0 -156
  128. package/benchmarks/output/submission-bundle/schemas/guardbench-conformance-card.schema.json +0 -184
  129. package/benchmarks/output/submission-bundle/schemas/guardbench-external-dry-run.schema.json +0 -74
  130. package/benchmarks/output/submission-bundle/schemas/guardbench-external-evidence.schema.json +0 -108
  131. package/benchmarks/output/submission-bundle/schemas/guardbench-external-run.schema.json +0 -160
  132. package/benchmarks/output/submission-bundle/schemas/guardbench-leaderboard.schema.json +0 -179
  133. package/benchmarks/output/submission-bundle/schemas/guardbench-manifest.schema.json +0 -213
  134. package/benchmarks/output/submission-bundle/schemas/guardbench-publication-verification.schema.json +0 -47
  135. package/benchmarks/output/submission-bundle/schemas/guardbench-raw.schema.json +0 -184
  136. package/benchmarks/output/submission-bundle/schemas/guardbench-submission-manifest.schema.json +0 -151
  137. package/benchmarks/output/submission-bundle/schemas/guardbench-summary.schema.json +0 -249
  138. package/benchmarks/output/submission-bundle/submission-manifest.json +0 -131
  139. package/benchmarks/output/submission-bundle/validation-report.json +0 -31
  140. package/benchmarks/output/summary.json +0 -2354
  141. package/benchmarks/perf-snapshot.js +0 -307
  142. package/benchmarks/perf.bench.js +0 -169
  143. package/benchmarks/public-paths.mjs +0 -97
  144. package/benchmarks/reference-results.js +0 -75
  145. package/benchmarks/report.js +0 -280
  146. package/benchmarks/run-external-guardbench.mjs +0 -303
  147. package/benchmarks/run.js +0 -735
  148. package/benchmarks/schemas/guardbench-adapter-registry.schema.json +0 -69
  149. package/benchmarks/schemas/guardbench-adapter-self-test.schema.json +0 -156
  150. package/benchmarks/schemas/guardbench-conformance-card.schema.json +0 -184
  151. package/benchmarks/schemas/guardbench-external-dry-run.schema.json +0 -74
  152. package/benchmarks/schemas/guardbench-external-evidence.schema.json +0 -108
  153. package/benchmarks/schemas/guardbench-external-run.schema.json +0 -160
  154. package/benchmarks/schemas/guardbench-leaderboard.schema.json +0 -179
  155. package/benchmarks/schemas/guardbench-manifest.schema.json +0 -213
  156. package/benchmarks/schemas/guardbench-publication-verification.schema.json +0 -47
  157. package/benchmarks/schemas/guardbench-raw.schema.json +0 -184
  158. package/benchmarks/schemas/guardbench-submission-manifest.schema.json +0 -151
  159. package/benchmarks/schemas/guardbench-summary.schema.json +0 -249
  160. package/benchmarks/snapshots/perf-0.22.2.json +0 -123
  161. package/benchmarks/snapshots/perf-0.23.0.json +0 -123
  162. package/benchmarks/validate-adapter-module.mjs +0 -107
  163. package/benchmarks/validate-adapter-registry.mjs +0 -145
  164. package/benchmarks/validate-adapter-self-test.mjs +0 -96
  165. package/benchmarks/validate-guardbench-artifacts.mjs +0 -400
  166. package/benchmarks/verify-external-evidence.mjs +0 -351
  167. package/benchmarks/verify-publication-artifacts.mjs +0 -309
  168. package/benchmarks/verify-submission-bundle.mjs +0 -172
  169. package/docs/AUDREY_PAPER_OUTLINE.md +0 -178
  170. package/docs/MEMORY_BENCHMARKING.md +0 -59
  171. package/docs/PRODUCTION_BACKLOG.md +0 -321
  172. package/docs/assets/audrey-feature-grid.jpg +0 -0
  173. package/docs/assets/audrey-logo.svg +0 -45
  174. package/docs/assets/audrey-wordmark.png +0 -0
  175. package/docs/paper/00-master.md +0 -48
  176. package/docs/paper/01-introduction.md +0 -27
  177. package/docs/paper/02-related-work.md +0 -47
  178. package/docs/paper/03-problem-definition.md +0 -108
  179. package/docs/paper/04-design.md +0 -164
  180. package/docs/paper/05-guardbench-spec.md +0 -412
  181. package/docs/paper/06-implementation.md +0 -115
  182. package/docs/paper/07-evaluation.md +0 -168
  183. package/docs/paper/08-discussion-limitations.md +0 -61
  184. package/docs/paper/09-conclusion.md +0 -11
  185. package/docs/paper/SUBMISSION_README.md +0 -162
  186. package/docs/paper/appendix-a-demo-transcript.md +0 -114
  187. package/docs/paper/arxiv-compile-report.schema.json +0 -116
  188. package/docs/paper/arxiv-source.schema.json +0 -61
  189. package/docs/paper/audrey-paper-v1.md +0 -1108
  190. package/docs/paper/browser-launch-plan.json +0 -209
  191. package/docs/paper/browser-launch-plan.schema.json +0 -100
  192. package/docs/paper/browser-launch-results.json +0 -86
  193. package/docs/paper/browser-launch-results.schema.json +0 -66
  194. package/docs/paper/claim-register.json +0 -138
  195. package/docs/paper/claim-register.schema.json +0 -81
  196. package/docs/paper/evidence-ledger.md +0 -103
  197. package/docs/paper/output/arxiv/README-arxiv.txt +0 -8
  198. package/docs/paper/output/arxiv/arxiv-manifest.json +0 -41
  199. package/docs/paper/output/arxiv/main.tex +0 -951
  200. package/docs/paper/output/arxiv/references.bib +0 -222
  201. package/docs/paper/output/arxiv-compile-report.json +0 -24
  202. package/docs/paper/output/submission-bundle/LICENSE +0 -21
  203. package/docs/paper/output/submission-bundle/README.md +0 -440
  204. package/docs/paper/output/submission-bundle/benchmarks/output/adapter-self-test/guardbench-adapter-self-test.json +0 -50
  205. package/docs/paper/output/submission-bundle/benchmarks/output/external/guardbench-external-dry-run.json +0 -69
  206. package/docs/paper/output/submission-bundle/benchmarks/output/external/guardbench-external-evidence.json +0 -56
  207. package/docs/paper/output/submission-bundle/benchmarks/output/guardbench-conformance-card.json +0 -63
  208. package/docs/paper/output/submission-bundle/benchmarks/output/guardbench-manifest.json +0 -414
  209. package/docs/paper/output/submission-bundle/benchmarks/output/guardbench-raw.json +0 -1279
  210. package/docs/paper/output/submission-bundle/benchmarks/output/guardbench-summary.json +0 -2123
  211. package/docs/paper/output/submission-bundle/benchmarks/output/leaderboard/guardbench-leaderboard.json +0 -93
  212. package/docs/paper/output/submission-bundle/benchmarks/output/leaderboard/guardbench-leaderboard.md +0 -7
  213. package/docs/paper/output/submission-bundle/benchmarks/output/submission-bundle/submission-manifest.json +0 -131
  214. package/docs/paper/output/submission-bundle/benchmarks/output/submission-bundle/validation-report.json +0 -31
  215. package/docs/paper/output/submission-bundle/benchmarks/output/summary.json +0 -2354
  216. package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-adapter-registry.schema.json +0 -69
  217. package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-adapter-self-test.schema.json +0 -156
  218. package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-conformance-card.schema.json +0 -184
  219. package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-external-dry-run.schema.json +0 -74
  220. package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-external-evidence.schema.json +0 -108
  221. package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-external-run.schema.json +0 -160
  222. package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-leaderboard.schema.json +0 -179
  223. package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-manifest.schema.json +0 -213
  224. package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-publication-verification.schema.json +0 -47
  225. package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-raw.schema.json +0 -184
  226. package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-submission-manifest.schema.json +0 -151
  227. package/docs/paper/output/submission-bundle/benchmarks/schemas/guardbench-summary.schema.json +0 -249
  228. package/docs/paper/output/submission-bundle/docs/AUDREY_PAPER_OUTLINE.md +0 -178
  229. package/docs/paper/output/submission-bundle/docs/paper/00-master.md +0 -48
  230. package/docs/paper/output/submission-bundle/docs/paper/01-introduction.md +0 -27
  231. package/docs/paper/output/submission-bundle/docs/paper/02-related-work.md +0 -47
  232. package/docs/paper/output/submission-bundle/docs/paper/03-problem-definition.md +0 -108
  233. package/docs/paper/output/submission-bundle/docs/paper/04-design.md +0 -164
  234. package/docs/paper/output/submission-bundle/docs/paper/05-guardbench-spec.md +0 -412
  235. package/docs/paper/output/submission-bundle/docs/paper/06-implementation.md +0 -115
  236. package/docs/paper/output/submission-bundle/docs/paper/07-evaluation.md +0 -168
  237. package/docs/paper/output/submission-bundle/docs/paper/08-discussion-limitations.md +0 -61
  238. package/docs/paper/output/submission-bundle/docs/paper/09-conclusion.md +0 -11
  239. package/docs/paper/output/submission-bundle/docs/paper/SUBMISSION_README.md +0 -162
  240. package/docs/paper/output/submission-bundle/docs/paper/appendix-a-demo-transcript.md +0 -114
  241. package/docs/paper/output/submission-bundle/docs/paper/arxiv-compile-report.schema.json +0 -116
  242. package/docs/paper/output/submission-bundle/docs/paper/arxiv-source.schema.json +0 -61
  243. package/docs/paper/output/submission-bundle/docs/paper/audrey-paper-v1.md +0 -1108
  244. package/docs/paper/output/submission-bundle/docs/paper/browser-launch-plan.json +0 -209
  245. package/docs/paper/output/submission-bundle/docs/paper/browser-launch-plan.schema.json +0 -100
  246. package/docs/paper/output/submission-bundle/docs/paper/browser-launch-results.json +0 -86
  247. package/docs/paper/output/submission-bundle/docs/paper/browser-launch-results.schema.json +0 -66
  248. package/docs/paper/output/submission-bundle/docs/paper/claim-register.json +0 -138
  249. package/docs/paper/output/submission-bundle/docs/paper/claim-register.schema.json +0 -81
  250. package/docs/paper/output/submission-bundle/docs/paper/evidence-ledger.md +0 -103
  251. package/docs/paper/output/submission-bundle/docs/paper/output/arxiv/README-arxiv.txt +0 -8
  252. package/docs/paper/output/submission-bundle/docs/paper/output/arxiv/arxiv-manifest.json +0 -41
  253. package/docs/paper/output/submission-bundle/docs/paper/output/arxiv/main.tex +0 -951
  254. package/docs/paper/output/submission-bundle/docs/paper/output/arxiv/references.bib +0 -222
  255. package/docs/paper/output/submission-bundle/docs/paper/output/arxiv-compile-report.json +0 -24
  256. package/docs/paper/output/submission-bundle/docs/paper/paper-submission-bundle.schema.json +0 -70
  257. package/docs/paper/output/submission-bundle/docs/paper/publication-pack.json +0 -81
  258. package/docs/paper/output/submission-bundle/docs/paper/publication-pack.schema.json +0 -60
  259. package/docs/paper/output/submission-bundle/docs/paper/references.bib +0 -222
  260. package/docs/paper/output/submission-bundle/package.json +0 -235
  261. package/docs/paper/output/submission-bundle/paper-submission-manifest.json +0 -379
  262. package/docs/paper/paper-submission-bundle.schema.json +0 -70
  263. package/docs/paper/publication-pack.json +0 -81
  264. package/docs/paper/publication-pack.schema.json +0 -60
  265. package/docs/paper/references.bib +0 -222
  266. package/scripts/audit-release-completion.mjs +0 -440
  267. package/scripts/create-arxiv-source.mjs +0 -368
  268. package/scripts/create-paper-submission-bundle.mjs +0 -214
  269. package/scripts/finalize-release.mjs +0 -601
  270. package/scripts/prepare-release-cut.mjs +0 -277
  271. package/scripts/publish-release-bundle.mjs +0 -252
  272. package/scripts/publish-release-github-api.mjs +0 -494
  273. package/scripts/run-vitest.mjs +0 -34
  274. package/scripts/smoke-cli.js +0 -92
  275. package/scripts/sync-paper-artifacts.mjs +0 -112
  276. package/scripts/verify-arxiv-compile.mjs +0 -476
  277. package/scripts/verify-arxiv-source.mjs +0 -224
  278. package/scripts/verify-browser-launch-plan.mjs +0 -254
  279. package/scripts/verify-browser-launch-results.mjs +0 -303
  280. package/scripts/verify-paper-artifacts.mjs +0 -798
  281. package/scripts/verify-paper-claims.mjs +0 -254
  282. package/scripts/verify-paper-submission-bundle.mjs +0 -218
  283. package/scripts/verify-publication-pack.mjs +0 -210
  284. package/scripts/verify-python-package.py +0 -201
  285. package/scripts/verify-release-readiness.mjs +0 -920
@@ -1,307 +0,0 @@
1
- // Honest performance snapshot for Audrey.
2
- //
3
- // What this measures
4
- // - Encode latency at multiple corpus sizes
5
- // - Hybrid recall latency at multiple corpus sizes
6
- // - Post-encode queue processing time (consolidation/interference/validation pipeline)
7
- //
8
- // What this does NOT do
9
- // - Compare against other memory systems. Synthetic head-to-head numbers are
10
- // easy to game. If you want a real comparison, run the same workload against
11
- // the system you care about and post your own results.
12
- // - Use cloud embedding providers. Latency to a remote API is dominated by
13
- // network round-trip and varies wildly by region and rate-limit state.
14
- // We use the in-process mock embedding provider so the numbers reflect
15
- // Audrey's own pipeline (SQLite, sqlite-vec, encode/recall logic, hybrid
16
- // ranking) without third-party noise. Real-world recall p95 with a local
17
- // 384-dim provider is typically 5-15x higher; with a hosted provider it is
18
- // dominated by the API call.
19
- //
20
- // How to read the output
21
- // - p50 / p95 / p99 are percentile latencies in milliseconds.
22
- // - The numbers are wall-clock for a single call from a JS caller, including
23
- // SQLite work and any post-encode queueing on encode rows.
24
- // - Run on your own hardware and embedding provider before quoting numbers
25
- // anywhere; results scale heavily with CPU, NVMe vs spinning disk, and
26
- // embedding dimensionality.
27
-
28
- import { performance } from 'node:perf_hooks';
29
- import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
30
- import { join, resolve } from 'node:path';
31
- import { tmpdir, cpus, totalmem, arch, platform, release } from 'node:os';
32
- import { execFileSync } from 'node:child_process';
33
- import { pathToFileURL } from 'node:url';
34
- import { Audrey } from '../dist/src/index.js';
35
-
36
- const DEFAULT_SIZES = [100, 1000, 5000];
37
- const DEFAULT_RECALL_RUNS = 50;
38
- const QUERY_POOL = [
39
- 'rate limit handling for HTTP 429 retries',
40
- 'durable agent context across sessions',
41
- 'safe shell behavior on Windows hosts',
42
- 'official authority over inferred preferences',
43
- 'lexical signal for exact identifiers',
44
- 'deployment region migration steps',
45
- 'webhook signature recovery procedure',
46
- 'fraud queue manual review trigger',
47
- ];
48
-
49
- const SEED_POOL = [
50
- 'Stripe API returned HTTP 429 during checkout retry; needs exponential backoff.',
51
- 'Project memory routing should prefer the local memory layer for durable context.',
52
- 'Tool trace learning marks repeated spawn EPERM failures as risky on Windows shells.',
53
- 'Calendar authority should come from the official source before inferred user notes.',
54
- 'Vector recall is faster but loses BM25 lexical signal on exact identifiers.',
55
- 'Webhook signature recovery requires rotating the signing secret and replaying queued events.',
56
- 'Fraud queue stabilizes when repeated same-BIN disputes are escalated for manual review.',
57
- 'Deployment region migrations should be coordinated against the provider rate-limit window.',
58
- ];
59
-
60
- function percentile(values, rank) {
61
- if (values.length === 0) return 0;
62
- const sorted = [...values].sort((a, b) => a - b);
63
- const index = Math.min(sorted.length - 1, Math.ceil((rank / 100) * sorted.length) - 1);
64
- return sorted[index];
65
- }
66
-
67
- function round(value) {
68
- return Math.round(value * 1000) / 1000;
69
- }
70
-
71
- function summarize(values) {
72
- if (values.length === 0) {
73
- return { samples: 0, p50: 0, p95: 0, p99: 0, min: 0, max: 0, mean: 0 };
74
- }
75
- const total = values.reduce((acc, v) => acc + v, 0);
76
- return {
77
- samples: values.length,
78
- p50: round(percentile(values, 50)),
79
- p95: round(percentile(values, 95)),
80
- p99: round(percentile(values, 99)),
81
- min: round(Math.min(...values)),
82
- max: round(Math.max(...values)),
83
- mean: round(total / values.length),
84
- };
85
- }
86
-
87
- function gitSha() {
88
- // execFileSync, no shell, fixed argv — provenance only, no user input flows in.
89
- try {
90
- return execFileSync('git', ['rev-parse', '--short', 'HEAD'], {
91
- stdio: ['ignore', 'pipe', 'ignore'],
92
- })
93
- .toString()
94
- .trim();
95
- } catch {
96
- return null;
97
- }
98
- }
99
-
100
- export function resolveAudreyVersion() {
101
- if (process.env.npm_package_version) {
102
- return process.env.npm_package_version;
103
- }
104
-
105
- try {
106
- const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
107
- return typeof pkg.version === 'string' ? pkg.version : null;
108
- } catch {
109
- return null;
110
- }
111
- }
112
-
113
- function machineProvenance() {
114
- const cpuList = cpus();
115
- const cpuModel = cpuList[0] ? cpuList[0].model : 'unknown';
116
- const totalGb = Math.round((totalmem() / 1024 / 1024 / 1024) * 10) / 10;
117
- return {
118
- node: process.versions.node,
119
- v8: process.versions.v8,
120
- platform: platform(),
121
- arch: arch(),
122
- osRelease: release(),
123
- cpuCount: cpuList.length,
124
- cpuModel,
125
- memoryGb: totalGb,
126
- };
127
- }
128
-
129
- function createDataDir() {
130
- const parents = [
131
- process.env.AUDREY_PERF_PARENT_DIR,
132
- tmpdir(),
133
- join(process.cwd(), 'benchmarks', '.tmp'),
134
- ].filter(Boolean);
135
-
136
- let lastError;
137
- for (const parent of parents) {
138
- try {
139
- mkdirSync(parent, { recursive: true });
140
- return mkdtempSync(join(parent, 'audrey-perf-snapshot-'));
141
- } catch (err) {
142
- lastError = err;
143
- }
144
- }
145
- throw lastError || new Error('Unable to create perf snapshot data directory');
146
- }
147
-
148
- function parseArgs(argv = process.argv.slice(2)) {
149
- const args = {
150
- sizes: [...DEFAULT_SIZES],
151
- recallRuns: DEFAULT_RECALL_RUNS,
152
- out: null,
153
- json: false,
154
- };
155
- for (let i = 0; i < argv.length; i++) {
156
- const token = argv[i];
157
- if (token === '--sizes' && argv[i + 1]) {
158
- args.sizes = argv[++i]
159
- .split(',')
160
- .map(s => Number.parseInt(s.trim(), 10))
161
- .filter(n => Number.isFinite(n) && n > 0);
162
- } else if (token === '--recall-runs' && argv[i + 1]) {
163
- args.recallRuns = Number.parseInt(argv[++i], 10);
164
- } else if (token === '--out' && argv[i + 1]) {
165
- args.out = resolve(argv[++i]);
166
- } else if (token === '--json') {
167
- args.json = true;
168
- }
169
- }
170
- return args;
171
- }
172
-
173
- async function runOneSize({ size, recallRuns }) {
174
- const dataDir = createDataDir();
175
- const audrey = new Audrey({
176
- dataDir,
177
- agent: 'perf-snapshot',
178
- embedding: { provider: 'mock', dimensions: 64 },
179
- llm: { provider: 'mock' },
180
- });
181
-
182
- const queueProcessingTimes = [];
183
- audrey.on('post-encode-complete', event => {
184
- queueProcessingTimes.push(event.processing_ms);
185
- });
186
-
187
- try {
188
- const encodeTimes = [];
189
- for (let i = 0; i < size; i++) {
190
- const content = `${SEED_POOL[i % SEED_POOL.length]} (sample ${i})`;
191
- const startedAt = performance.now();
192
- await audrey.encode({
193
- content,
194
- source: 'direct-observation',
195
- tags: ['perf-snapshot'],
196
- });
197
- encodeTimes.push(performance.now() - startedAt);
198
- }
199
-
200
- const drain = await audrey.drainPostEncodeQueue(60_000);
201
- if (!drain.drained) {
202
- throw new Error(`post-encode queue did not drain at size=${size}`);
203
- }
204
-
205
- const recallTimes = [];
206
- for (let i = 0; i < recallRuns; i++) {
207
- const query = QUERY_POOL[i % QUERY_POOL.length];
208
- const startedAt = performance.now();
209
- await audrey.recall(query, { limit: 5, retrieval: 'hybrid' });
210
- recallTimes.push(performance.now() - startedAt);
211
- }
212
-
213
- return {
214
- corpusSize: size,
215
- encodeMs: summarize(encodeTimes),
216
- hybridRecallMs: summarize(recallTimes),
217
- postEncodeQueueMs: summarize(queueProcessingTimes),
218
- queueEvents: queueProcessingTimes.length,
219
- };
220
- } finally {
221
- audrey.close();
222
- rmSync(dataDir, { recursive: true, force: true });
223
- }
224
- }
225
-
226
- export async function runPerfSnapshot({
227
- sizes = DEFAULT_SIZES,
228
- recallRuns = DEFAULT_RECALL_RUNS,
229
- } = {}) {
230
- const startedAt = Date.now();
231
- const sized = [];
232
- for (const size of sizes) {
233
- sized.push(await runOneSize({ size, recallRuns }));
234
- }
235
- return {
236
- generatedAt: new Date(startedAt).toISOString(),
237
- durationMs: Date.now() - startedAt,
238
- audreyVersion: resolveAudreyVersion(),
239
- gitSha: gitSha(),
240
- methodology: {
241
- embedding: 'mock provider, 64 dimensions (in-process, no network)',
242
- llm: 'mock provider (in-process)',
243
- retrieval: 'hybrid (vector + lexical) with limit=5',
244
- sizes,
245
- recallRunsPerSize: recallRuns,
246
- notes:
247
- 'Latency is wall-clock for a single call from a JS caller. Cloud and ' +
248
- 'local 384-dim providers will report higher recall latency dominated by ' +
249
- 'embedding cost and network. Run on your own hardware before quoting.',
250
- },
251
- machine: machineProvenance(),
252
- sizes: sized,
253
- };
254
- }
255
-
256
- function formatMs(value) {
257
- if (value === 0) return '0';
258
- if (value < 1) return value.toFixed(2);
259
- return value.toFixed(1);
260
- }
261
-
262
- export function formatMarkdownTable(snapshot) {
263
- const lines = [];
264
- lines.push(
265
- `Audrey perf snapshot — ${snapshot.audreyVersion || 'dev'} on ${snapshot.machine.platform}/${snapshot.machine.arch}`,
266
- );
267
- lines.push('');
268
- lines.push(
269
- `Node ${snapshot.machine.node} · ${snapshot.machine.cpuCount}x ${snapshot.machine.cpuModel} · ${snapshot.machine.memoryGb} GB RAM`,
270
- );
271
- lines.push(`Generated ${snapshot.generatedAt}${snapshot.gitSha ? ` (${snapshot.gitSha})` : ''}`);
272
- lines.push('');
273
- lines.push(
274
- '| Corpus size | Encode p50 (ms) | Encode p95 (ms) | Recall p50 (ms) | Recall p95 (ms) | Recall p99 (ms) |',
275
- );
276
- lines.push('|---|---|---|---|---|---|');
277
- for (const row of snapshot.sizes) {
278
- lines.push(
279
- `| ${row.corpusSize.toLocaleString()} ` +
280
- `| ${formatMs(row.encodeMs.p50)} ` +
281
- `| ${formatMs(row.encodeMs.p95)} ` +
282
- `| ${formatMs(row.hybridRecallMs.p50)} ` +
283
- `| ${formatMs(row.hybridRecallMs.p95)} ` +
284
- `| ${formatMs(row.hybridRecallMs.p99)} |`,
285
- );
286
- }
287
- return lines.join('\n');
288
- }
289
-
290
- if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
291
- const args = parseArgs();
292
- runPerfSnapshot({ sizes: args.sizes, recallRuns: args.recallRuns })
293
- .then(snapshot => {
294
- if (args.out) {
295
- writeFileSync(args.out, JSON.stringify(snapshot, null, 2) + '\n');
296
- }
297
- if (args.json) {
298
- process.stdout.write(JSON.stringify(snapshot, null, 2) + '\n');
299
- } else {
300
- process.stdout.write(formatMarkdownTable(snapshot) + '\n');
301
- }
302
- })
303
- .catch(err => {
304
- console.error('[audrey] perf snapshot failed:', err);
305
- process.exit(1);
306
- });
307
- }
@@ -1,169 +0,0 @@
1
- import { performance } from 'node:perf_hooks';
2
- import { mkdirSync, mkdtempSync, rmSync } from 'node:fs';
3
- import { join } from 'node:path';
4
- import { tmpdir } from 'node:os';
5
- import { pathToFileURL } from 'node:url';
6
- import { Audrey } from '../dist/src/index.js';
7
-
8
- const RUNS = 20;
9
-
10
- // Budget source: CHANGELOG.md#0220---2026-04-28, from the Audrey/MemoryGym
11
- // latency pass. This mock-provider gate catches mechanical regressions in
12
- // Audrey CI before live GPU benchmarks or MemoryGym release gates find them.
13
- export const PERF_BUDGETS = Object.freeze({
14
- encodeResponseP95Ms: 50,
15
- hybridRecallP95Ms: 25,
16
- queueProcessingP50Ms: 5,
17
- });
18
-
19
- function roundMs(value) {
20
- return Math.round(value * 1000) / 1000;
21
- }
22
-
23
- function percentile(values, percentileRank) {
24
- if (values.length === 0) return 0;
25
- const sorted = [...values].sort((a, b) => a - b);
26
- const index = Math.min(sorted.length - 1, Math.ceil((percentileRank / 100) * sorted.length) - 1);
27
- return sorted[index];
28
- }
29
-
30
- function stats(values) {
31
- if (values.length === 0) {
32
- return { p50: 0, p95: 0, min: 0, max: 0 };
33
- }
34
- return {
35
- p50: roundMs(percentile(values, 50)),
36
- p95: roundMs(percentile(values, 95)),
37
- min: roundMs(Math.min(...values)),
38
- max: roundMs(Math.max(...values)),
39
- };
40
- }
41
-
42
- function assertBudget(name, actual, budget) {
43
- if (actual >= budget) {
44
- throw new Error(`${name} ${actual}ms exceeded budget ${budget}ms`);
45
- }
46
- }
47
-
48
- function seedContent(index) {
49
- const cases = [
50
- 'Stripe API returned HTTP 429 during checkout retry and needs exponential backoff.',
51
- 'Project memory routing should prefer Audrey MCP for durable agent context.',
52
- 'Tool trace learning marks repeated npm spawn EPERM failures as risky on Windows shells.',
53
- 'Calendar authority should come from the official source before inferred user notes.',
54
- 'Vector recall is faster but loses BM25 lexical signal on exact identifiers.',
55
- ];
56
- return `${cases[index % cases.length]} Perf sample ${index}.`;
57
- }
58
-
59
- function createPerfDataDir() {
60
- const parents = [
61
- process.env.AUDREY_PERF_PARENT_DIR,
62
- tmpdir(),
63
- join(process.cwd(), 'benchmarks', '.tmp'),
64
- ].filter(Boolean);
65
- let lastError;
66
-
67
- for (const parent of parents) {
68
- try {
69
- mkdirSync(parent, { recursive: true });
70
- return mkdtempSync(join(parent, 'audrey-perf-'));
71
- } catch (err) {
72
- lastError = err;
73
- }
74
- }
75
-
76
- throw lastError || new Error('Unable to create Audrey perf benchmark data directory');
77
- }
78
-
79
- export async function runPerfBenchmark({
80
- runs = RUNS,
81
- budgets = PERF_BUDGETS,
82
- out = console.log,
83
- } = {}) {
84
- const dataDir = createPerfDataDir();
85
- const audrey = new Audrey({
86
- dataDir,
87
- agent: 'perf-bench',
88
- embedding: { provider: 'mock', dimensions: 64 },
89
- llm: { provider: 'mock' },
90
- });
91
-
92
- const queueProcessingTimes = [];
93
- audrey.on('post-encode-complete', event => {
94
- queueProcessingTimes.push(event.processing_ms);
95
- });
96
-
97
- try {
98
- const encodeTimes = [];
99
- for (let i = 0; i < runs; i += 1) {
100
- const startedAt = performance.now();
101
- await audrey.encode({
102
- content: seedContent(i),
103
- source: 'direct-observation',
104
- tags: ['perf-gate'],
105
- affect: { valence: i % 2 === 0 ? 0.3 : -0.1, arousal: 0.2 },
106
- });
107
- encodeTimes.push(performance.now() - startedAt);
108
- }
109
-
110
- const drain = await audrey.drainPostEncodeQueue(5000);
111
- if (!drain.drained) {
112
- throw new Error(`post-encode queue did not drain: ${drain.pendingIds.join(', ')}`);
113
- }
114
-
115
- const recallTimes = [];
116
- for (let i = 0; i < runs; i += 1) {
117
- const startedAt = performance.now();
118
- await audrey.recall('Stripe API 429 retry memory routing', {
119
- limit: 5,
120
- retrieval: 'hybrid',
121
- });
122
- recallTimes.push(performance.now() - startedAt);
123
- }
124
-
125
- const result = {
126
- runs,
127
- budgets,
128
- encode_response_ms: stats(encodeTimes),
129
- hybrid_recall_ms: stats(recallTimes),
130
- queue_processing_ms: stats(queueProcessingTimes),
131
- queue_events: queueProcessingTimes.length,
132
- status: {
133
- pending_consolidation_count: audrey.memoryStatus().pending_consolidation_count,
134
- default_retrieval_mode: audrey.memoryStatus().default_retrieval_mode,
135
- },
136
- };
137
-
138
- if (queueProcessingTimes.length !== runs) {
139
- throw new Error(
140
- `expected ${runs} post-encode queue events, got ${queueProcessingTimes.length}`,
141
- );
142
- }
143
-
144
- assertBudget('encode response p95', result.encode_response_ms.p95, budgets.encodeResponseP95Ms);
145
- assertBudget('hybrid recall p95', result.hybrid_recall_ms.p95, budgets.hybridRecallP95Ms);
146
- assertBudget(
147
- 'queue processing p50',
148
- result.queue_processing_ms.p50,
149
- budgets.queueProcessingP50Ms,
150
- );
151
-
152
- out(
153
- `Audrey perf gate passed: encode p95=${result.encode_response_ms.p95}ms, ` +
154
- `hybrid recall p95=${result.hybrid_recall_ms.p95}ms, ` +
155
- `queue p50=${result.queue_processing_ms.p50}ms`,
156
- );
157
- return result;
158
- } finally {
159
- audrey.close();
160
- rmSync(dataDir, { recursive: true, force: true });
161
- }
162
- }
163
-
164
- if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
165
- runPerfBenchmark().catch(err => {
166
- console.error('[audrey] perf gate failed:', err);
167
- process.exit(1);
168
- });
169
- }
@@ -1,97 +0,0 @@
1
- import { existsSync, readFileSync, readdirSync } from 'node:fs';
2
- import { basename, dirname, isAbsolute, join, relative, resolve } from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
-
5
- const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
6
- const WINDOWS_DRIVE_PATTERN = /(^|[^a-z])[A-Z]:[\\/](?:$|[^\r\n])/i;
7
- const EXTENDED_PATH_PATTERN = /\\\\\?\\/;
8
- const FILE_URL_PATTERN = /file:\/\//i;
9
- function containsBinaryControl(text) {
10
- return Array.from(text).some(character => {
11
- const code = character.charCodeAt(0);
12
- return (
13
- (code >= 0 && code <= 8) ||
14
- code === 11 ||
15
- code === 12 ||
16
- (code >= 14 && code <= 31) ||
17
- code === 127
18
- );
19
- });
20
- }
21
-
22
- function isUrl(value) {
23
- return /^[a-z][a-z0-9+.-]*:\/\//i.test(value);
24
- }
25
-
26
- export function publicPath(value) {
27
- if (typeof value !== 'string') return value;
28
- if (value === process.execPath) return 'node';
29
- if (isUrl(value)) return value;
30
-
31
- const resolved = resolve(value);
32
- const rel = relative(ROOT, resolved);
33
- if (rel && !rel.startsWith('..') && !isAbsolute(rel)) {
34
- return rel.replaceAll('\\', '/');
35
- }
36
- if (value.includes('\\') || value.includes('/') || isAbsolute(value)) {
37
- return `[LOCAL-PATH:${basename(value) || 'path'}]`;
38
- }
39
- return value;
40
- }
41
-
42
- export function publicCommand(command = []) {
43
- return command.map(part => publicPath(part));
44
- }
45
-
46
- export function publicArtifactValue(value) {
47
- if (Array.isArray(value)) return value.map(item => publicArtifactValue(item));
48
- if (value && typeof value === 'object') {
49
- return Object.fromEntries(
50
- Object.entries(value).map(([key, item]) => [key, publicArtifactValue(item)]),
51
- );
52
- }
53
- return publicPath(value);
54
- }
55
-
56
- export function containsLocalPath(text) {
57
- if (containsBinaryControl(text)) return false;
58
- return (
59
- WINDOWS_DRIVE_PATTERN.test(text) ||
60
- EXTENDED_PATH_PATTERN.test(text) ||
61
- FILE_URL_PATTERN.test(text)
62
- );
63
- }
64
-
65
- export function findLocalPathLeaks(value, path = '$') {
66
- if (typeof value === 'string') {
67
- return containsLocalPath(value) ? [`${path}: ${value}`] : [];
68
- }
69
- if (Array.isArray(value)) {
70
- return value.flatMap((item, index) => findLocalPathLeaks(item, `${path}[${index}]`));
71
- }
72
- if (value && typeof value === 'object') {
73
- return Object.entries(value).flatMap(([key, item]) =>
74
- findLocalPathLeaks(item, `${path}.${key}`),
75
- );
76
- }
77
- return [];
78
- }
79
-
80
- export function walkFiles(dir, root = dir) {
81
- return readdirSync(dir, { withFileTypes: true }).flatMap(entry => {
82
- const path = join(dir, entry.name);
83
- if (entry.isDirectory()) return walkFiles(path, root);
84
- return relative(root, path).replaceAll('\\', '/');
85
- });
86
- }
87
-
88
- export function scanFilesForLocalPaths(root, files) {
89
- const leaks = [];
90
- for (const file of files) {
91
- const path = join(root, file);
92
- if (!existsSync(path)) continue;
93
- const content = readFileSync(path, 'utf-8');
94
- if (containsLocalPath(content)) leaks.push(file);
95
- }
96
- return leaks;
97
- }
@@ -1,75 +0,0 @@
1
- export const PUBLISHED_LEADERBOARD = [
2
- {
3
- system: 'MIRIX',
4
- benchmark: 'LoCoMo',
5
- score: 85.4,
6
- unit: 'accuracy',
7
- source: 'https://arxiv.org/abs/2507.07957',
8
- note: 'Published LoCoMo result from the MIRIX paper.',
9
- },
10
- {
11
- system: 'Letta Filesystem',
12
- benchmark: 'LoCoMo',
13
- score: 74.0,
14
- unit: 'accuracy',
15
- source: 'https://www.letta.com/blog/benchmarking-ai-agent-memory',
16
- note: 'Filesystem-style memory result reported by Letta.',
17
- },
18
- {
19
- system: 'Mem0 Graph Memory',
20
- benchmark: 'LoCoMo',
21
- score: 68.5,
22
- unit: 'accuracy',
23
- source: 'https://arxiv.org/abs/2504.19413',
24
- note: 'Graph memory variant reported in the Mem0 paper.',
25
- },
26
- {
27
- system: 'Mem0',
28
- benchmark: 'LoCoMo',
29
- score: 66.9,
30
- unit: 'accuracy',
31
- source: 'https://arxiv.org/abs/2504.19413',
32
- note: 'Core Mem0 LoCoMo score reported in the Mem0 paper.',
33
- },
34
- {
35
- system: 'OpenAI Memory',
36
- benchmark: 'LoCoMo',
37
- score: 52.9,
38
- unit: 'accuracy',
39
- source: 'https://arxiv.org/abs/2504.19413',
40
- note: 'OpenAI memory baseline as reported by the Mem0 paper.',
41
- },
42
- ];
43
-
44
- export const MEMORY_TRENDS = [
45
- {
46
- title: 'Memory is moving from flat retrieval to typed systems',
47
- summary:
48
- 'Recent work treats episodic, semantic, procedural, and graph memory as separate but cooperating layers.',
49
- source: 'https://arxiv.org/abs/2507.03724',
50
- },
51
- {
52
- title: 'Benchmarks now emphasize multi-session realism',
53
- summary:
54
- 'LongMemEval and LoCoMo push memory systems toward temporal updates, abstraction, and cross-session reasoning instead of single-turn fact recall.',
55
- source: 'https://arxiv.org/abs/2410.10813',
56
- },
57
- {
58
- title: 'Context engineering is now competing with retrieval-first designs',
59
- summary:
60
- 'Letta argues filesystem and memory-block approaches can outperform simpler retrieval-only memory on realistic long-horizon tasks.',
61
- source: 'https://www.letta.com/blog/memory-blocks',
62
- },
63
- {
64
- title: 'Production teams care about latency and token footprint, not just recall quality',
65
- summary:
66
- 'Mem0 frames memory as a cost and latency optimization surface in addition to a personalization surface.',
67
- source: 'https://arxiv.org/abs/2504.19413',
68
- },
69
- {
70
- title: 'Temporal and multimodal memory are becoming table stakes',
71
- summary:
72
- 'MIRIX and Graphiti both model time and state change explicitly instead of assuming memories stay forever true.',
73
- source: 'https://arxiv.org/abs/2507.07957',
74
- },
75
- ];