@agentmemory/agentmemory 0.9.30 → 0.9.31

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 (331) hide show
  1. package/.env.example +39 -33
  2. package/AGENTS.md +8 -8
  3. package/README.md +173 -558
  4. package/dist/.env.example +39 -33
  5. package/dist/cli.d.mts.map +1 -1
  6. package/dist/cli.mjs +1741 -966
  7. package/dist/cli.mjs.map +1 -1
  8. package/dist/compression-recovery-CnhLQC6N.mjs +5912 -0
  9. package/dist/compression-recovery-CnhLQC6N.mjs.map +1 -0
  10. package/dist/{connect-B4_ca6BD.mjs → connect-BSLIAMpw.mjs} +874 -267
  11. package/dist/connect-BSLIAMpw.mjs.map +1 -0
  12. package/dist/hooks/_capture.d.mts +5 -2
  13. package/dist/hooks/_capture.d.mts.map +1 -1
  14. package/dist/hooks/_capture.mjs +55 -19
  15. package/dist/hooks/_capture.mjs.map +1 -1
  16. package/dist/hooks/notification.mjs +20 -6
  17. package/dist/hooks/notification.mjs.map +1 -1
  18. package/dist/hooks/post-commit.mjs +25 -5
  19. package/dist/hooks/post-commit.mjs.map +1 -1
  20. package/dist/hooks/post-tool-failure.mjs +12 -4
  21. package/dist/hooks/post-tool-failure.mjs.map +1 -1
  22. package/dist/hooks/post-tool-use.mjs +12 -4
  23. package/dist/hooks/post-tool-use.mjs.map +1 -1
  24. package/dist/hooks/pre-compact.mjs +37 -10
  25. package/dist/hooks/pre-compact.mjs.map +1 -1
  26. package/dist/hooks/pre-tool-use.mjs +25 -5
  27. package/dist/hooks/pre-tool-use.mjs.map +1 -1
  28. package/dist/hooks/prompt-submit.mjs +12 -4
  29. package/dist/hooks/prompt-submit.mjs.map +1 -1
  30. package/dist/hooks/session-end.mjs +47 -16
  31. package/dist/hooks/session-end.mjs.map +1 -1
  32. package/dist/hooks/session-start.mjs +37 -10
  33. package/dist/hooks/session-start.mjs.map +1 -1
  34. package/dist/hooks/stop.mjs +74 -72
  35. package/dist/hooks/stop.mjs.map +1 -1
  36. package/dist/hooks/subagent-start.mjs +13 -5
  37. package/dist/hooks/subagent-start.mjs.map +1 -1
  38. package/dist/hooks/subagent-stop.mjs +18 -6
  39. package/dist/hooks/subagent-stop.mjs.map +1 -1
  40. package/dist/hooks/task-completed.mjs +13 -5
  41. package/dist/hooks/task-completed.mjs.map +1 -1
  42. package/dist/{image-refs-T_urbwHM.mjs → image-refs-Cyta4Lf9.mjs} +2 -2
  43. package/dist/{image-refs-T_urbwHM.mjs.map → image-refs-Cyta4Lf9.mjs.map} +1 -1
  44. package/dist/index.mjs +8539 -4203
  45. package/dist/index.mjs.map +1 -1
  46. package/dist/integrations/dsh.d.mts +55 -0
  47. package/dist/integrations/dsh.d.mts.map +1 -0
  48. package/dist/integrations/dsh.mjs +1145 -0
  49. package/dist/integrations/dsh.mjs.map +1 -0
  50. package/dist/{keyed-mutex-DchXsyfP.mjs → keyed-mutex-DCUh7PG-.mjs} +58 -9
  51. package/dist/keyed-mutex-DCUh7PG-.mjs.map +1 -0
  52. package/dist/{secret-store-BnY3A50C.mjs → secret-store-D9GwO0xp.mjs} +535 -434
  53. package/dist/secret-store-D9GwO0xp.mjs.map +1 -0
  54. package/dist/session-arguments-zxsbbd8y.mjs +113 -0
  55. package/dist/session-arguments-zxsbbd8y.mjs.map +1 -0
  56. package/dist/{src-Jsq9LCeH.mjs → src-DaMtDzt_.mjs} +4087 -3788
  57. package/dist/src-DaMtDzt_.mjs.map +1 -0
  58. package/dist/{standalone-DKCdrf1d.mjs → standalone-BlqshyZ5.mjs} +213 -56
  59. package/dist/standalone-BlqshyZ5.mjs.map +1 -0
  60. package/dist/standalone.d.mts +1 -1
  61. package/dist/standalone.d.mts.map +1 -1
  62. package/dist/standalone.mjs +626 -73
  63. package/dist/standalone.mjs.map +1 -1
  64. package/dist/viewer/index.html +288 -140
  65. package/integrations/hermes/README.md +84 -0
  66. package/integrations/hermes/__init__.py +669 -0
  67. package/integrations/hermes/plugin.yaml +27 -0
  68. package/integrations/omp/LICENSE +190 -0
  69. package/integrations/omp/README.md +76 -0
  70. package/integrations/omp/capture.ts +1 -0
  71. package/integrations/omp/dist/index.mjs +1450 -0
  72. package/integrations/omp/index.ts +488 -0
  73. package/integrations/omp/package.json +13 -0
  74. package/integrations/omp/security.ts +67 -0
  75. package/integrations/omp/skills/agentmemory-agents/REFERENCE.md +32 -0
  76. package/integrations/omp/skills/agentmemory-agents/SKILL.md +48 -0
  77. package/integrations/omp/skills/agentmemory-agents/TROUBLESHOOTING.md +70 -0
  78. package/integrations/omp/skills/agentmemory-architecture/SKILL.md +33 -0
  79. package/integrations/omp/skills/agentmemory-architecture/TROUBLESHOOTING.md +70 -0
  80. package/integrations/omp/skills/agentmemory-config/REFERENCE.md +90 -0
  81. package/integrations/omp/skills/agentmemory-config/SKILL.md +78 -0
  82. package/integrations/omp/skills/agentmemory-config/TROUBLESHOOTING.md +70 -0
  83. package/integrations/omp/skills/agentmemory-hooks/REFERENCE.md +20 -0
  84. package/integrations/omp/skills/agentmemory-hooks/SKILL.md +49 -0
  85. package/integrations/omp/skills/agentmemory-hooks/TROUBLESHOOTING.md +70 -0
  86. package/integrations/omp/skills/agentmemory-mcp-tools/REFERENCE.md +66 -0
  87. package/integrations/omp/skills/agentmemory-mcp-tools/SKILL.md +42 -0
  88. package/integrations/omp/skills/agentmemory-mcp-tools/TROUBLESHOOTING.md +70 -0
  89. package/integrations/omp/skills/agentmemory-rest-api/REFERENCE.md +158 -0
  90. package/integrations/omp/skills/agentmemory-rest-api/SKILL.md +49 -0
  91. package/integrations/omp/skills/agentmemory-rest-api/TROUBLESHOOTING.md +70 -0
  92. package/integrations/omp/skills/commit-context/EXAMPLES.md +71 -0
  93. package/integrations/omp/skills/commit-context/SKILL.md +64 -0
  94. package/integrations/omp/skills/commit-context/TROUBLESHOOTING.md +70 -0
  95. package/integrations/omp/skills/commit-history/EXAMPLES.md +71 -0
  96. package/integrations/omp/skills/commit-history/SKILL.md +62 -0
  97. package/integrations/omp/skills/commit-history/TROUBLESHOOTING.md +70 -0
  98. package/integrations/omp/skills/forget/EXAMPLES.md +40 -0
  99. package/integrations/omp/skills/forget/SKILL.md +73 -0
  100. package/integrations/omp/skills/forget/TROUBLESHOOTING.md +70 -0
  101. package/integrations/omp/skills/handoff/EXAMPLES.md +57 -0
  102. package/integrations/omp/skills/handoff/SKILL.md +75 -0
  103. package/integrations/omp/skills/handoff/TROUBLESHOOTING.md +70 -0
  104. package/integrations/omp/skills/lesson/SKILL.md +64 -0
  105. package/integrations/omp/skills/lesson/TROUBLESHOOTING.md +70 -0
  106. package/integrations/omp/skills/memory-discipline/SKILL.md +65 -0
  107. package/integrations/omp/skills/memory-discipline/TROUBLESHOOTING.md +70 -0
  108. package/integrations/omp/skills/recall/EXAMPLES.md +74 -0
  109. package/integrations/omp/skills/recall/SKILL.md +74 -0
  110. package/integrations/omp/skills/recall/TROUBLESHOOTING.md +70 -0
  111. package/integrations/omp/skills/recap/EXAMPLES.md +62 -0
  112. package/integrations/omp/skills/recap/SKILL.md +68 -0
  113. package/integrations/omp/skills/recap/TROUBLESHOOTING.md +70 -0
  114. package/integrations/omp/skills/remember/EXAMPLES.md +67 -0
  115. package/integrations/omp/skills/remember/SKILL.md +66 -0
  116. package/integrations/omp/skills/remember/TROUBLESHOOTING.md +70 -0
  117. package/integrations/omp/skills/session-history/EXAMPLES.md +59 -0
  118. package/integrations/omp/skills/session-history/SKILL.md +67 -0
  119. package/integrations/omp/skills/session-history/TROUBLESHOOTING.md +70 -0
  120. package/integrations/omp/skills/write-agentmemory-skill/SKILL.md +41 -0
  121. package/integrations/omp/skills/write-agentmemory-skill/TROUBLESHOOTING.md +70 -0
  122. package/integrations/openclaw/LICENSE +190 -0
  123. package/integrations/openclaw/README.md +88 -0
  124. package/integrations/openclaw/openclaw.plugin.json +71 -0
  125. package/integrations/openclaw/package.json +38 -0
  126. package/integrations/openclaw/plugin.mjs +425 -0
  127. package/integrations/openclaw/plugin.yaml +26 -0
  128. package/integrations/openclaw/skills/agentmemory-agents/REFERENCE.md +32 -0
  129. package/integrations/openclaw/skills/agentmemory-agents/SKILL.md +48 -0
  130. package/integrations/openclaw/skills/agentmemory-agents/TROUBLESHOOTING.md +70 -0
  131. package/integrations/openclaw/skills/agentmemory-architecture/SKILL.md +33 -0
  132. package/integrations/openclaw/skills/agentmemory-architecture/TROUBLESHOOTING.md +70 -0
  133. package/integrations/openclaw/skills/agentmemory-config/REFERENCE.md +90 -0
  134. package/integrations/openclaw/skills/agentmemory-config/SKILL.md +78 -0
  135. package/integrations/openclaw/skills/agentmemory-config/TROUBLESHOOTING.md +70 -0
  136. package/integrations/openclaw/skills/agentmemory-hooks/REFERENCE.md +20 -0
  137. package/integrations/openclaw/skills/agentmemory-hooks/SKILL.md +49 -0
  138. package/integrations/openclaw/skills/agentmemory-hooks/TROUBLESHOOTING.md +70 -0
  139. package/integrations/openclaw/skills/agentmemory-mcp-tools/REFERENCE.md +66 -0
  140. package/integrations/openclaw/skills/agentmemory-mcp-tools/SKILL.md +42 -0
  141. package/integrations/openclaw/skills/agentmemory-mcp-tools/TROUBLESHOOTING.md +70 -0
  142. package/integrations/openclaw/skills/agentmemory-rest-api/REFERENCE.md +158 -0
  143. package/integrations/openclaw/skills/agentmemory-rest-api/SKILL.md +49 -0
  144. package/integrations/openclaw/skills/agentmemory-rest-api/TROUBLESHOOTING.md +70 -0
  145. package/integrations/openclaw/skills/commit-context/EXAMPLES.md +71 -0
  146. package/integrations/openclaw/skills/commit-context/SKILL.md +64 -0
  147. package/integrations/openclaw/skills/commit-context/TROUBLESHOOTING.md +70 -0
  148. package/integrations/openclaw/skills/commit-history/EXAMPLES.md +71 -0
  149. package/integrations/openclaw/skills/commit-history/SKILL.md +62 -0
  150. package/integrations/openclaw/skills/commit-history/TROUBLESHOOTING.md +70 -0
  151. package/integrations/openclaw/skills/forget/EXAMPLES.md +40 -0
  152. package/integrations/openclaw/skills/forget/SKILL.md +73 -0
  153. package/integrations/openclaw/skills/forget/TROUBLESHOOTING.md +70 -0
  154. package/integrations/openclaw/skills/handoff/EXAMPLES.md +57 -0
  155. package/integrations/openclaw/skills/handoff/SKILL.md +75 -0
  156. package/integrations/openclaw/skills/handoff/TROUBLESHOOTING.md +70 -0
  157. package/integrations/openclaw/skills/lesson/SKILL.md +64 -0
  158. package/integrations/openclaw/skills/lesson/TROUBLESHOOTING.md +70 -0
  159. package/integrations/openclaw/skills/memory-discipline/SKILL.md +65 -0
  160. package/integrations/openclaw/skills/memory-discipline/TROUBLESHOOTING.md +70 -0
  161. package/integrations/openclaw/skills/recall/EXAMPLES.md +74 -0
  162. package/integrations/openclaw/skills/recall/SKILL.md +74 -0
  163. package/integrations/openclaw/skills/recall/TROUBLESHOOTING.md +70 -0
  164. package/integrations/openclaw/skills/recap/EXAMPLES.md +62 -0
  165. package/integrations/openclaw/skills/recap/SKILL.md +68 -0
  166. package/integrations/openclaw/skills/recap/TROUBLESHOOTING.md +70 -0
  167. package/integrations/openclaw/skills/remember/EXAMPLES.md +67 -0
  168. package/integrations/openclaw/skills/remember/SKILL.md +66 -0
  169. package/integrations/openclaw/skills/remember/TROUBLESHOOTING.md +70 -0
  170. package/integrations/openclaw/skills/session-history/EXAMPLES.md +59 -0
  171. package/integrations/openclaw/skills/session-history/SKILL.md +67 -0
  172. package/integrations/openclaw/skills/session-history/TROUBLESHOOTING.md +70 -0
  173. package/integrations/openclaw/skills/write-agentmemory-skill/SKILL.md +41 -0
  174. package/integrations/openclaw/skills/write-agentmemory-skill/TROUBLESHOOTING.md +70 -0
  175. package/integrations/pi/LICENSE +190 -0
  176. package/integrations/pi/README.md +45 -51
  177. package/integrations/pi/dist/index.mjs +1379 -0
  178. package/integrations/pi/index.ts +138 -171
  179. package/integrations/pi/package.json +16 -6
  180. package/integrations/pi/security.ts +6 -26
  181. package/integrations/pi/skills/agentmemory-agents/REFERENCE.md +32 -0
  182. package/integrations/pi/skills/agentmemory-agents/SKILL.md +48 -0
  183. package/integrations/pi/skills/agentmemory-agents/TROUBLESHOOTING.md +70 -0
  184. package/integrations/pi/skills/agentmemory-architecture/SKILL.md +33 -0
  185. package/integrations/pi/skills/agentmemory-architecture/TROUBLESHOOTING.md +70 -0
  186. package/integrations/pi/skills/agentmemory-config/REFERENCE.md +90 -0
  187. package/integrations/pi/skills/agentmemory-config/SKILL.md +78 -0
  188. package/integrations/pi/skills/agentmemory-config/TROUBLESHOOTING.md +70 -0
  189. package/integrations/pi/skills/agentmemory-hooks/REFERENCE.md +20 -0
  190. package/integrations/pi/skills/agentmemory-hooks/SKILL.md +49 -0
  191. package/integrations/pi/skills/agentmemory-hooks/TROUBLESHOOTING.md +70 -0
  192. package/integrations/pi/skills/agentmemory-mcp-tools/REFERENCE.md +66 -0
  193. package/integrations/pi/skills/agentmemory-mcp-tools/SKILL.md +42 -0
  194. package/integrations/pi/skills/agentmemory-mcp-tools/TROUBLESHOOTING.md +70 -0
  195. package/integrations/pi/skills/agentmemory-rest-api/REFERENCE.md +158 -0
  196. package/integrations/pi/skills/agentmemory-rest-api/SKILL.md +49 -0
  197. package/integrations/pi/skills/agentmemory-rest-api/TROUBLESHOOTING.md +70 -0
  198. package/integrations/pi/skills/commit-context/EXAMPLES.md +71 -0
  199. package/integrations/pi/skills/commit-context/SKILL.md +64 -0
  200. package/integrations/pi/skills/commit-context/TROUBLESHOOTING.md +70 -0
  201. package/integrations/pi/skills/commit-history/EXAMPLES.md +71 -0
  202. package/integrations/pi/skills/commit-history/SKILL.md +62 -0
  203. package/integrations/pi/skills/commit-history/TROUBLESHOOTING.md +70 -0
  204. package/integrations/pi/skills/forget/EXAMPLES.md +40 -0
  205. package/integrations/pi/skills/forget/SKILL.md +73 -0
  206. package/integrations/pi/skills/forget/TROUBLESHOOTING.md +70 -0
  207. package/integrations/pi/skills/handoff/EXAMPLES.md +57 -0
  208. package/integrations/pi/skills/handoff/SKILL.md +75 -0
  209. package/integrations/pi/skills/handoff/TROUBLESHOOTING.md +70 -0
  210. package/integrations/pi/skills/lesson/SKILL.md +64 -0
  211. package/integrations/pi/skills/lesson/TROUBLESHOOTING.md +70 -0
  212. package/integrations/pi/skills/memory-discipline/SKILL.md +65 -0
  213. package/integrations/pi/skills/memory-discipline/TROUBLESHOOTING.md +70 -0
  214. package/integrations/pi/skills/recall/EXAMPLES.md +74 -0
  215. package/integrations/pi/skills/recall/SKILL.md +74 -0
  216. package/integrations/pi/skills/recall/TROUBLESHOOTING.md +70 -0
  217. package/integrations/pi/skills/recap/EXAMPLES.md +62 -0
  218. package/integrations/pi/skills/recap/SKILL.md +68 -0
  219. package/integrations/pi/skills/recap/TROUBLESHOOTING.md +70 -0
  220. package/integrations/pi/skills/remember/EXAMPLES.md +67 -0
  221. package/integrations/pi/skills/remember/SKILL.md +66 -0
  222. package/integrations/pi/skills/remember/TROUBLESHOOTING.md +70 -0
  223. package/integrations/pi/skills/session-history/EXAMPLES.md +59 -0
  224. package/integrations/pi/skills/session-history/SKILL.md +67 -0
  225. package/integrations/pi/skills/session-history/TROUBLESHOOTING.md +70 -0
  226. package/integrations/pi/skills/write-agentmemory-skill/SKILL.md +41 -0
  227. package/integrations/pi/skills/write-agentmemory-skill/TROUBLESHOOTING.md +70 -0
  228. package/package.json +32 -11
  229. package/plugin/.claude-plugin/plugin.json +1 -1
  230. package/plugin/.codex-plugin/plugin.json +4 -3
  231. package/plugin/.devin-plugin/plugin.json +5 -3
  232. package/plugin/cursor/hooks.json +23 -8
  233. package/plugin/hooks.json +67 -0
  234. package/plugin/opencode/README.md +1 -1
  235. package/plugin/opencode/agentmemory-capture.ts +25 -11
  236. package/plugin/opencode/plugin.json +1 -1
  237. package/plugin/plugin.json +1 -1
  238. package/plugin/scripts/_capture.d.mts +5 -2
  239. package/plugin/scripts/_capture.d.mts.map +1 -1
  240. package/plugin/scripts/_capture.mjs +55 -19
  241. package/plugin/scripts/_capture.mjs.map +1 -1
  242. package/plugin/scripts/cursor/run-detached.d.mts +1 -0
  243. package/plugin/scripts/cursor/run-detached.mjs +786 -0
  244. package/plugin/scripts/cursor/run-detached.mjs.map +1 -0
  245. package/plugin/scripts/cursor/run-hook.d.mts +1 -0
  246. package/plugin/scripts/cursor/run-hook.mjs +704 -0
  247. package/plugin/scripts/cursor/run-hook.mjs.map +1 -0
  248. package/plugin/scripts/notification.mjs +20 -6
  249. package/plugin/scripts/notification.mjs.map +1 -1
  250. package/plugin/scripts/plugin-bridge.mjs +37 -6
  251. package/plugin/scripts/post-commit.mjs +25 -5
  252. package/plugin/scripts/post-commit.mjs.map +1 -1
  253. package/plugin/scripts/post-tool-failure.mjs +12 -4
  254. package/plugin/scripts/post-tool-failure.mjs.map +1 -1
  255. package/plugin/scripts/post-tool-use.mjs +12 -4
  256. package/plugin/scripts/post-tool-use.mjs.map +1 -1
  257. package/plugin/scripts/pre-compact.mjs +37 -10
  258. package/plugin/scripts/pre-compact.mjs.map +1 -1
  259. package/plugin/scripts/pre-tool-use.mjs +25 -5
  260. package/plugin/scripts/pre-tool-use.mjs.map +1 -1
  261. package/plugin/scripts/prompt-submit.mjs +12 -4
  262. package/plugin/scripts/prompt-submit.mjs.map +1 -1
  263. package/plugin/scripts/session-end.mjs +47 -16
  264. package/plugin/scripts/session-end.mjs.map +1 -1
  265. package/plugin/scripts/session-start.mjs +37 -10
  266. package/plugin/scripts/session-start.mjs.map +1 -1
  267. package/plugin/scripts/stop.mjs +74 -72
  268. package/plugin/scripts/stop.mjs.map +1 -1
  269. package/plugin/scripts/subagent-start.mjs +13 -5
  270. package/plugin/scripts/subagent-start.mjs.map +1 -1
  271. package/plugin/scripts/subagent-stop.mjs +18 -6
  272. package/plugin/scripts/subagent-stop.mjs.map +1 -1
  273. package/plugin/scripts/task-completed.mjs +13 -5
  274. package/plugin/scripts/task-completed.mjs.map +1 -1
  275. package/plugin/skills/_shared/TROUBLESHOOTING.md +21 -7
  276. package/plugin/skills/agentmemory-agents/REFERENCE.md +7 -6
  277. package/plugin/skills/agentmemory-agents/SKILL.md +19 -5
  278. package/plugin/skills/agentmemory-agents/TROUBLESHOOTING.md +70 -0
  279. package/plugin/skills/agentmemory-architecture/SKILL.md +4 -4
  280. package/plugin/skills/agentmemory-architecture/TROUBLESHOOTING.md +70 -0
  281. package/plugin/skills/agentmemory-config/REFERENCE.md +12 -15
  282. package/plugin/skills/agentmemory-config/SKILL.md +7 -3
  283. package/plugin/skills/agentmemory-config/TROUBLESHOOTING.md +70 -0
  284. package/plugin/skills/agentmemory-hooks/SKILL.md +15 -5
  285. package/plugin/skills/agentmemory-hooks/TROUBLESHOOTING.md +70 -0
  286. package/plugin/skills/agentmemory-mcp-tools/REFERENCE.md +4 -4
  287. package/plugin/skills/agentmemory-mcp-tools/SKILL.md +6 -3
  288. package/plugin/skills/agentmemory-mcp-tools/TROUBLESHOOTING.md +70 -0
  289. package/plugin/skills/agentmemory-rest-api/REFERENCE.md +9 -1
  290. package/plugin/skills/agentmemory-rest-api/SKILL.md +12 -6
  291. package/plugin/skills/agentmemory-rest-api/TROUBLESHOOTING.md +70 -0
  292. package/plugin/skills/commit-context/SKILL.md +1 -1
  293. package/plugin/skills/commit-context/TROUBLESHOOTING.md +70 -0
  294. package/plugin/skills/commit-history/SKILL.md +1 -1
  295. package/plugin/skills/commit-history/TROUBLESHOOTING.md +70 -0
  296. package/plugin/skills/forget/EXAMPLES.md +19 -54
  297. package/plugin/skills/forget/SKILL.md +16 -12
  298. package/plugin/skills/forget/TROUBLESHOOTING.md +70 -0
  299. package/plugin/skills/handoff/EXAMPLES.md +5 -4
  300. package/plugin/skills/handoff/SKILL.md +10 -5
  301. package/plugin/skills/handoff/TROUBLESHOOTING.md +70 -0
  302. package/plugin/skills/lesson/SKILL.md +1 -1
  303. package/plugin/skills/lesson/TROUBLESHOOTING.md +70 -0
  304. package/plugin/skills/memory-discipline/SKILL.md +1 -1
  305. package/plugin/skills/memory-discipline/TROUBLESHOOTING.md +70 -0
  306. package/plugin/skills/recall/SKILL.md +18 -7
  307. package/plugin/skills/recall/TROUBLESHOOTING.md +70 -0
  308. package/plugin/skills/recap/EXAMPLES.md +5 -3
  309. package/plugin/skills/recap/SKILL.md +11 -6
  310. package/plugin/skills/recap/TROUBLESHOOTING.md +70 -0
  311. package/plugin/skills/remember/EXAMPLES.md +3 -3
  312. package/plugin/skills/remember/SKILL.md +1 -1
  313. package/plugin/skills/remember/TROUBLESHOOTING.md +70 -0
  314. package/plugin/skills/session-history/EXAMPLES.md +2 -2
  315. package/plugin/skills/session-history/SKILL.md +10 -4
  316. package/plugin/skills/session-history/TROUBLESHOOTING.md +70 -0
  317. package/plugin/skills/write-agentmemory-skill/SKILL.md +2 -1
  318. package/plugin/skills/write-agentmemory-skill/TROUBLESHOOTING.md +70 -0
  319. package/dist/connect-B4_ca6BD.mjs.map +0 -1
  320. package/dist/docker-compose.yml +0 -73
  321. package/dist/iii-config.docker.yaml +0 -53
  322. package/dist/iii-config.yaml +0 -63
  323. package/dist/keyed-mutex-DchXsyfP.mjs.map +0 -1
  324. package/dist/secret-store-BnY3A50C.mjs.map +0 -1
  325. package/dist/src-Jsq9LCeH.mjs.map +0 -1
  326. package/dist/standalone-DKCdrf1d.mjs.map +0 -1
  327. package/dist/status-IRz7ta8-.mjs +0 -2344
  328. package/dist/status-IRz7ta8-.mjs.map +0 -1
  329. package/docker-compose.yml +0 -73
  330. package/iii-config.docker.yaml +0 -53
  331. package/iii-config.yaml +0 -63
package/README.md CHANGED
@@ -4,10 +4,9 @@
4
4
 
5
5
  <p align="center">
6
6
  <strong>
7
- Your coding agent remembers everything. No more re-explaining.
8
- Built on <a href="https://github.com/iii-hq/iii">iii engine</a>
7
+ Persistent memory across coding sessions and agents.
9
8
  </strong><br/>
10
- Persistent memory for Claude Code, GitHub Copilot CLI, Cursor, Gemini CLI, Codex CLI, Hermes, OpenClaw, pi, OpenCode, and any MCP client.
9
+ Persistent memory for Claude Code, GitHub Copilot CLI, Cursor, Gemini CLI, Codex CLI, Hermes, OpenClaw, pi, Oh My Pi, OpenCode, DeepSeek Harness, and any MCP client.
11
10
  </p>
12
11
 
13
12
  <p align="center">
@@ -63,6 +62,7 @@
63
62
  <a href="https://github.com/rohitg00/agentmemory/actions"><img src="https://img.shields.io/github/actions/workflow/status/rohitg00/agentmemory/ci.yml?label=tests&style=for-the-badge&logo=github" alt="CI" /></a>
64
63
  <a href="https://github.com/rohitg00/agentmemory/blob/main/LICENSE"><img src="https://img.shields.io/github/license/rohitg00/agentmemory?color=blue&style=for-the-badge" alt="License" /></a>
65
64
  <a href="https://github.com/rohitg00/agentmemory/stargazers"><img src="https://img.shields.io/github/stars/rohitg00/agentmemory?style=for-the-badge&color=yellow&logo=github" alt="Stars" /></a>
65
+ <a href="https://skills.sh/rohitg00/agentmemory"><img src="https://skills.sh/b/rohitg00/agentmemory?style=for-the-badge" alt="skills.sh installs" /></a>
66
66
  </p>
67
67
 
68
68
  <p align="center">
@@ -71,7 +71,7 @@
71
71
  <picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-tools.svg"><img src="assets/tags/stat-tools.svg" alt="54 MCP tools" height="38" /></picture>
72
72
  <picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-hooks.svg"><img src="assets/tags/stat-hooks.svg" alt="12 auto hooks" height="38" /></picture>
73
73
  <picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-deps.svg"><img src="assets/tags/stat-deps.svg" alt="0 external DBs" height="38" /></picture>
74
- <picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-tests.svg"><img src="assets/tags/stat-tests.svg" alt="2,500+ tests passing" height="38" /></picture>
74
+ <picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/stat-tests.svg"><img src="assets/tags/stat-tests.svg" alt="4,000+ tests passing" height="38" /></picture>
75
75
  </p>
76
76
 
77
77
  <p align="center">
@@ -87,32 +87,38 @@
87
87
  <a href="#how-it-works">How It Works</a> &bull;
88
88
  <a href="#mcp-server">MCP</a> &bull;
89
89
  <a href="#real-time-viewer">Viewer</a> &bull;
90
- <a href="#powered-by-iii">Powered by iii</a> &bull;
91
90
  <a href="#configuration">Config</a> &bull;
92
91
  <a href="#api">API</a>
93
92
  </p>
94
93
 
95
94
  ---
96
95
 
96
+ AgentMemory captures coding sessions, makes decisions and fixes searchable, and lets your agents recall them later. Keep one memory store across tools, inspect what was saved, and choose how much context reaches the model.
97
+
98
+ - **Capture:** native hooks and plugins record supported session events, with secret scrubbing and offline replay.
99
+ - **Recall:** keyword search works without an API key; local or remote embeddings add semantic search.
100
+ - **Continue:** retrieve project history, lessons and session handoffs from another agent.
101
+ - **Inspect:** browse, edit, export and forget memories in the live viewer.
102
+
97
103
  ## Install
98
104
 
99
105
  Requirements:
100
106
 
101
107
  - Node.js 20 or newer with npm and npx (`node -v`, `npm -v`, and `npx -v`).
102
- - macOS/Linux automatic iii-engine installation also needs `curl`, a POSIX `sh`, and `tar`. Minimal images such as `node:20-slim` may not include them.
103
- - Native Windows requires the pinned iii-engine v0.22.1 `iii.exe` to be installed manually. WSL2 or Docker Desktop are the other supported paths.
108
+ - macOS/Linux also need `curl`, a POSIX `sh`, and `tar` for automatic runtime setup.
109
+ - Windows users can use WSL2 or follow the [native Windows setup](#windows).
104
110
 
105
- Canonical fresh-install command:
111
+ Start setup:
106
112
 
107
113
  ```bash
108
114
  npx -y @agentmemory/agentmemory@latest
109
115
  ```
110
116
 
111
- The first run is an interactive setup: pick the agents to wire (Claude Code, Cursor, Codex, Gemini CLI, OpenCode, ...), pick an LLM provider or stay keyless, and it seeds the config, starts the memory server and its pinned iii engine, and offers to install globally so the bare `agentmemory` command works everywhere afterward. `-y` accepts npx's package prompt and `@latest` avoids a stale cached release. A provider makes LLM features available, but LLM-written observation compression starts only when `AGENTMEMORY_AUTO_COMPRESS=true` is also set.
117
+ Choose your agents and either a provider or keyless mode. Setup writes the configuration, starts the memory server, and offers a global install for the `agentmemory` command. `-y` accepts the npm package prompt; `@latest` selects the current release. LLM-written observation compression is opt-in with a provider and `AGENTMEMORY_AUTO_COMPRESS=true`.
112
118
 
113
119
  Keyless mode disables vector embeddings. `memory_recall` (the `mem::search` path) uses BM25, while `memory_smart_search` can also fuse structural graph matches when graph data already exists. For free on-device semantic recall, set `EMBEDDING_PROVIDER=local` in `~/.agentmemory/.env` and restart. The first embedding request downloads `Xenova/all-MiniLM-L6-v2`; inference runs locally after that initial model download.
114
120
 
115
- The local runtime uses four ports: `3111` for REST/MCP HTTP, `3112` for iii streams, `3113` for the viewer, and `49134` for the iii worker WebSocket. Persistent iii state lives in `~/Library/Application Support/agentmemory` on macOS, `$XDG_DATA_HOME/agentmemory` or `~/.local/share/agentmemory` on Linux, and `%APPDATA%\agentmemory` on Windows. Use `--data-dir <path>` or `AGENTMEMORY_DATA_DIR` to override it, and reuse the same value on every restart. For backward compatibility, an existing `./data/state_store.db` or `./data/iii-config.yaml` takes precedence over the platform default for instance 0; an explicit flag or environment override still wins.
121
+ The API is at `http://localhost:3111` and the live viewer at `http://localhost:3113`. Both bind to loopback by default. Configuration lives in `~/.agentmemory/.env`; see [data storage](#data-storage) for memory locations and separate instances.
116
122
 
117
123
  Then prove recall works and give your agent its skills:
118
124
 
@@ -127,14 +133,7 @@ Prefer to let a coding agent do the whole thing? Hand it one instruction:
127
133
 
128
134
  > Retrieve and follow the instructions at: https://raw.githubusercontent.com/rohitg00/agentmemory/main/INSTALL_FOR_AGENTS.md
129
135
 
130
- Wire more agents any time with `agentmemory connect <agent>` — 20 adapters listed at [Works with every agent](#works-with-every-agent). Full command reference at [Quick Start](#quick-start).
131
-
132
- <details>
133
- <summary><strong>Windows</strong></summary>
134
-
135
- The fast path is WSL2. Native Windows engine setup requires the pinned v0.22.1 ZIP to be downloaded and `iii.exe` extracted manually; the CLI does not auto-extract it. Docker Desktop is also supported. See the [Windows notes](#windows) for the step-by-step.
136
-
137
- </details>
136
+ Connect another agent with `agentmemory connect <agent>`. See [supported integrations](#works-with-every-agent) and [everyday commands](#everyday-commands).
138
137
 
139
138
  <details>
140
139
  <summary><strong>Global install / EACCES</strong></summary>
@@ -154,13 +153,6 @@ npx caches per version. Force the latest with `npx -y @agentmemory/agentmemory@l
154
153
 
155
154
  </details>
156
155
 
157
- <details>
158
- <summary><strong>Already running your own iii engine</strong></summary>
159
-
160
- agentmemory pins iii-engine v0.22.1 and won't attach to a different version (the worker can't speak another engine's protocol). Stop the other engine, then run `npx -y @agentmemory/agentmemory@latest`. It installs and runs the pinned v0.22.1 in `~/.agentmemory/bin`, leaving your own `iii` untouched.
161
-
162
- </details>
163
-
164
156
  ---
165
157
 
166
158
  <h2 id="works-with-every-agent"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-agents.svg"><img src="assets/tags/section-agents.svg" alt="Works with every agent" height="32" /></picture></h2>
@@ -187,7 +179,7 @@ agentmemory works with any agent that supports hooks, MCP, or REST API. All agen
187
179
  <td align="center" width="20%">
188
180
  <a href="https://cursor.com"><picture><source media="(prefers-color-scheme: dark)" srcset="https://svgl.app/library/cursor_dark.svg"><img src="https://svgl.app/library/cursor_light.svg" alt="Cursor" width="48" height="48" /></picture></a><br/>
189
181
  <strong>Cursor</strong><br/>
190
- <sub>native plugin + 7 hooks + MCP</sub>
182
+ <sub>native plugin + lifecycle hooks + MCP</sub>
191
183
  </td>
192
184
  <td align="center" width="20%">
193
185
  <a href="plugin/opencode/"><img src="https://raw.githubusercontent.com/rohitg00/agentmemory/main/website/public/opencode.png" alt="OpenCode" width="48" height="48" /></a><br/>
@@ -214,7 +206,7 @@ agentmemory works with any agent that supports hooks, MCP, or REST API. All agen
214
206
  <td align="center" width="20%">
215
207
  <a href="integrations/pi/"><img src="assets/agents/pi.svg" alt="pi" width="48" height="48" /></a><br/>
216
208
  <strong>pi</strong><br/>
217
- <sub>native plugin + MCP</sub>
209
+ <sub>native recall + capture + skills</sub>
218
210
  </td>
219
211
  <td align="center" width="20%">
220
212
  <a href="https://github.com/tinyhumansai/openhuman"><img src="https://github.com/tinyhumansai.png?size=120" alt="OpenHuman" width="48" height="48" /></a><br/>
@@ -280,7 +272,7 @@ agentmemory works with any agent that supports hooks, MCP, or REST API. All agen
280
272
  <td align="center" width="20%">
281
273
  <a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://svgl.app/library/deepseek.svg" alt="DeepSeek Harness" width="48" height="48" /></a><br/>
282
274
  <strong>DeepSeek Harness</strong><br/>
283
- <sub>MCP server</sub>
275
+ <sub>native capture + MCP</sub>
284
276
  </td>
285
277
  <td align="center" width="20%">
286
278
  <a href="https://github.com/RooCodeInc/Roo-Code"><img src="https://github.com/RooCodeInc.png?size=120" alt="Roo Code" width="48" height="48" /></a><br/>
@@ -303,6 +295,12 @@ agentmemory works with any agent that supports hooks, MCP, or REST API. All agen
303
295
  <sub>REST API</sub>
304
296
  </td>
305
297
  </tr>
298
+ <tr>
299
+ <td align="center" colspan="5">
300
+ <a href="integrations/omp/"><strong>Oh My Pi</strong></a><br/>
301
+ <sub>native recall + capture + skills + optional MCP</sub>
302
+ </td>
303
+ </tr>
306
304
  </table>
307
305
 
308
306
  <p align="center">
@@ -311,22 +309,24 @@ agentmemory works with any agent that supports hooks, MCP, or REST API. All agen
311
309
 
312
310
  ---
313
311
 
314
- You explain the same architecture every session. You re-discover the same bugs. You re-teach the same preferences. Built-in memory (CLAUDE.md, .cursorrules) caps out at 200 lines and goes stale. agentmemory fixes this. It silently captures what your agent does, compresses it into searchable memory, and injects the right context when the next session starts. One command. Works across agents.
312
+ ### Data storage
315
313
 
316
- **What changes:** Session 1 you set up JWT auth. Session 2 you ask for rate limiting. The agent already knows your auth uses jose middleware in `src/middleware/auth.ts`, your tests cover token validation, and you chose jose over jsonwebtoken for Edge compatibility, with no re-explaining and no copy-pasting.
314
+ Memories stay outside your repository by default:
317
315
 
318
- ```bash
319
- npx -y @agentmemory/agentmemory@latest
320
- ```
316
+ | Platform | Data directory |
317
+ |---|---|
318
+ | macOS | `~/Library/Application Support/agentmemory` |
319
+ | Linux | `$XDG_DATA_HOME/agentmemory` or `~/.local/share/agentmemory` |
320
+ | Windows | `%APPDATA%\agentmemory` |
321
321
 
322
- By default, agentmemory stores iii-engine state outside the repository you start it from: `~/Library/Application Support/agentmemory` on macOS, `$XDG_DATA_HOME/agentmemory` or `~/.local/share/agentmemory` on Linux, and `%APPDATA%\agentmemory` on Windows. An existing legacy `./data/state_store.db` or `./data/iii-config.yaml` is reused for instance 0 before that platform default. To choose a location explicitly, pass `--data-dir <path>` or set `AGENTMEMORY_DATA_DIR`; either explicit setting takes precedence over legacy discovery:
322
+ An existing `./data/state_store.db` is reused for instance 0. Choose another directory with `--data-dir <path>` or `AGENTMEMORY_DATA_DIR`. Keep the same directory when restarting or upgrading.
323
323
 
324
324
  ```bash
325
- npx -y @agentmemory/agentmemory@latest --data-dir ~/.agentmemory-projects/main
326
- AGENTMEMORY_DATA_DIR=~/.agentmemory-projects/main npx -y @agentmemory/agentmemory@latest
325
+ agentmemory --data-dir ~/.agentmemory-projects/main
326
+ agentmemory --instance 1
327
327
  ```
328
328
 
329
- Native and Docker launches use this same resolved host directory; Docker bind-mounts it at `/data`. `--instance 1` appends `instance-1` to the resolved directory and selects the separate default port quartet `3211/3212/3213/49234`.
329
+ `--instance 1` uses an `instance-1` subdirectory, API port `3211` and viewer port `3213`. See [storage and backups](docs/reliability/state-storage.md) for Redis and backend migration.
330
330
 
331
331
  Latest release notes: [CHANGELOG.md](CHANGELOG.md).
332
332
 
@@ -476,7 +476,7 @@ Latest release notes: [CHANGELOG.md](CHANGELOG.md).
476
476
  </tr>
477
477
  <tr>
478
478
  <td><strong>External deps</strong></td>
479
- <td>None (SQLite + iii-engine)</td>
479
+ <td>No separate database service required</td>
480
480
  <td>Qdrant / pgvector</td>
481
481
  <td>Postgres + vector DB</td>
482
482
  <td>Multiple</td>
@@ -550,14 +550,12 @@ Latest release notes: [CHANGELOG.md](CHANGELOG.md).
550
550
  | Zep / Graphiti | 30K | Temporal knowledge graph; strongest published temporal-query results (LongMemEval 63.8%), but graph builds asynchronously so fresh facts can lag |
551
551
  | Cognee | 30K | Document-to-knowledge-graph ingestion, Python-only, built for structured entity extraction rather than session capture |
552
552
 
553
- None of these auto-capture from coding-agent hooks, ship a local-first viewer, or run keyless — the combination agentmemory is built around.
553
+ AgentMemory combines coding-agent capture, searchable project history and a local viewer, with keyless operation available from the first run.
554
554
 
555
555
  ---
556
556
 
557
557
  <h2 id="quick-start"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-quickstart.svg"><img src="assets/tags/section-quickstart.svg" alt="Quick Start" height="32" /></picture></h2>
558
558
 
559
- Compatibility: this release targets `iii-sdk` 0.22.1 and pins iii-engine v0.22.1.
560
-
561
559
  ### Try it in 30 seconds
562
560
 
563
561
  ```bash
@@ -574,7 +572,7 @@ Open `http://localhost:3113` to watch the memory build live.
574
572
 
575
573
  ### Validate a fresh install and restart persistence
576
574
 
577
- With the server running, validate REST, health, the viewer, and the iii-backed runtime status:
575
+ With the server running, check health, the viewer and status:
578
576
 
579
577
  ```bash
580
578
  curl -fsS http://localhost:3111/agentmemory/livez
@@ -583,14 +581,20 @@ curl -fsS -o /dev/null http://localhost:3113/
583
581
  npx -y @agentmemory/agentmemory@latest status
584
582
  ```
585
583
 
586
- The startup ready panel accounts for all four ports: REST/MCP HTTP on 3111, iii streams on 3112, the viewer on 3113, and the iii worker WebSocket on 49134. `status` confirms agentmemory health and the active provider/embedding mode. Save a probe and confirm it is searchable:
584
+ `status` reports server health, provider and embedding mode, capture delivery, and recovery state. Save a probe and confirm it is searchable. Protected REST requests require the daemon secret. If you configured `AGENTMEMORY_SECRET`, use that value in this terminal; otherwise load the generated local secret:
585
+
586
+ ```bash
587
+ read -r AGENTMEMORY_SECRET < "$HOME/.agentmemory/secret"
588
+ ```
587
589
 
588
590
  ```bash
589
591
  curl -fsS -X POST http://localhost:3111/agentmemory/remember \
592
+ -H "Authorization: Bearer $AGENTMEMORY_SECRET" \
590
593
  -H 'Content-Type: application/json' \
591
594
  -d '{"content":"agentmemory restart persistence probe","concepts":["install-check"]}'
592
595
 
593
596
  curl -fsS -X POST http://localhost:3111/agentmemory/smart-search \
597
+ -H "Authorization: Bearer $AGENTMEMORY_SECRET" \
594
598
  -H 'Content-Type: application/json' \
595
599
  -d '{"query":"restart persistence probe","limit":5}'
596
600
  ```
@@ -604,7 +608,10 @@ Install and setup live in [Install](#install) above (the first run walks you thr
604
608
  ```bash
605
609
  agentmemory # start the server
606
610
  agentmemory stop # stop it cleanly
607
- agentmemory connect <agent> # wire another agent
611
+ agentmemory status # health, providers and recovery state
612
+ agentmemory capture # inspect capture inbox and offline spool
613
+ agentmemory capture --drain # replay queued observations
614
+ agentmemory connect <agent> # connect another agent
608
615
  agentmemory doctor # interactive diagnostics + fix prompts
609
616
  agentmemory remove # uninstall everything we created
610
617
  ```
@@ -623,7 +630,7 @@ npx -y @agentmemory/agentmemory@latest import-jsonl
623
630
  npx -y @agentmemory/agentmemory@latest import-jsonl ~/.claude/projects/-my-project/abc123.jsonl
624
631
  ```
625
632
 
626
- Imported sessions show up in the Replay picker alongside native ones. Under the hood each entry routes through the `mem::replay::load`, `mem::replay::sessions`, and `mem::replay::import-jsonl` iii functions, with no side-channel servers. Each imported transcript is indexed for search, stamped with origin channel `import`, and mined for a session crystal and lessons.
633
+ Imported sessions appear alongside native sessions in Replay. Transcripts are indexed for search and marked with origin channel `import`; session processing can also produce crystals and lessons.
627
634
 
628
635
  > **Heads-up if you rely on `import-jsonl` as your primary capture path:** Claude Code's `cleanupPeriodDays` (in `~/.claude/settings.json`, default **30**) auto-deletes JSONL transcripts older than that window from `~/.claude/projects/`. If you install agentmemory fresh on a months-old Claude Code history, anything older than 30 days is already gone before the first import. Either run `import-jsonl` on a cron, raise `cleanupPeriodDays` to something higher, or wire the auto-capture hooks (the default plugin install path) so each turn lands in agentmemory while the session is live and the JSONL cleanup stops mattering.
629
636
 
@@ -635,14 +642,12 @@ Use the maintenance command when you intentionally want to update your local run
635
642
  npx -y @agentmemory/agentmemory@latest upgrade
636
643
  ```
637
644
 
638
- Warning: this command mutates the current workspace/runtime. It can update JavaScript dependencies and pull the pinned `iiidev/iii:0.22.1` Docker image. It never installs an unpinned or newer iii engine.
639
-
640
- Implementation details live in `src/cli.ts` (see `runUpgrade` around the `src/cli.ts:544-595` region).
645
+ This updates the local runtime and may update JavaScript dependencies in the current workspace. Back up your data and read the [upgrade guide](docs/upgrades/iii-0.25.md) before updating an existing installation.
641
646
 
642
647
  ### Claude Code (one block, paste it)
643
648
 
644
649
  ```text
645
- Install agentmemory: run `npx -y @agentmemory/agentmemory@latest` in a separate terminal to start the memory server and its pinned iii engine. Then run `/plugin marketplace add rohitg00/agentmemory` and `/plugin install agentmemory` — the plugin registers all 12 hooks, 17 skills, AND auto-wires the `@agentmemory/mcp` stdio server via its `.mcp.json`, so you get 54 MCP tools (memory_smart_search, memory_save, memory_sessions, memory_governance_delete, etc.) without any extra config step. Verify with `curl http://localhost:3111/agentmemory/health`. The real-time viewer is at http://localhost:3113. Keyless mode disables vectors: `memory_recall` uses BM25, and `memory_smart_search` can also use existing structural graph data. Set `EMBEDDING_PROVIDER=local` in `~/.agentmemory/.env` and restart to opt into on-device semantic recall.
650
+ Install agentmemory: run `npx -y @agentmemory/agentmemory@latest` in a separate terminal to start the memory server. Then run `/plugin marketplace add rohitg00/agentmemory` and `/plugin install agentmemory` — the plugin registers all 12 hooks, 17 skills, AND auto-wires the `@agentmemory/mcp` stdio server via its `.mcp.json`, so you get 54 MCP tools (memory_smart_search, memory_save, memory_sessions, memory_governance_delete, etc.) without any extra config step. Verify with `curl http://localhost:3111/agentmemory/health`. The real-time viewer is at http://localhost:3113. Keyless mode disables vectors: `memory_recall` uses BM25, and `memory_smart_search` can also use existing structural graph data. Set `EMBEDDING_PROVIDER=local` in `~/.agentmemory/.env` and restart to opt into on-device semantic recall.
646
651
  ```
647
652
 
648
653
  #### Claude Code without the plugin install (MCP-standalone path)
@@ -703,6 +708,33 @@ copilot plugin install rohitg00/agentmemory:plugin
703
708
 
704
709
  `agentmemory connect copilot-cli` merges `mcpServers.agentmemory` into `~/.copilot/mcp-config.json` (or `$COPILOT_HOME/mcp-config.json` when `COPILOT_HOME` is set) and preserves existing servers. On native Windows this is the only automated `connect` adapter; configure every other native Windows agent manually. WSL `connect` is supported only when the target agent is installed in that same WSL environment. Copilot picks up the MCP server on next launch or after `/mcp`. Install the plugin as well when you want the full hook/skill experience.
705
710
 
711
+ ### Cursor
712
+
713
+ ```bash
714
+ # MCP wiring
715
+ agentmemory connect cursor
716
+ ```
717
+
718
+ Then add the native hooks: **Settings → Plugins → Add marketplace** → select an agentmemory checkout (the directory containing `.cursor-plugin/plugin.json`), enable the **agentmemory** plugin, and reload the window.
719
+
720
+ The plugin provides lifecycle capture, workspace-aware project attribution, skills and MCP. Enable either the plugin hooks or manual hooks in `~/.cursor/hooks.json` to avoid duplicate capture.
721
+
722
+ Full guide: [`integrations/cursor/`](integrations/cursor/)
723
+
724
+ ### Pi, Oh My Pi and DeepSeek Harness
725
+
726
+ ```bash
727
+ agentmemory connect pi --with-mcp
728
+ agentmemory connect omp --with-mcp
729
+ agentmemory connect dsh --with-hooks
730
+ ```
731
+
732
+ Choose the command for your host. Pi and OMP install native recall/capture, offline replay and 17 skills; `--with-mcp` adds the full toolset. Run `/reload` in Pi or restart OMP, then check `/agentmemory-status`. DSH installs MCP and the bundled capture plugin; restart DSH after connecting.
733
+
734
+ Pi also supports an installable `@agentmemory/pi` package. See the [Pi package guide](integrations/pi/) for local installation and npm availability. Use one installation method per host.
735
+
736
+ Guides: [Pi](integrations/pi/), [Oh My Pi](integrations/omp/), [DSH](docs/dsh.md).
737
+
706
738
  <details>
707
739
  <summary><b>OpenClaw (paste this prompt)</b></summary>
708
740
 
@@ -765,8 +797,8 @@ npx skills add rohitg00/agentmemory -y -a '*' # install to every installed age
765
797
 
766
798
  This is **complementary** to `agentmemory connect <agent>`:
767
799
 
768
- - `agentmemory connect <agent>` writes the MCP server config so the tools are available.
769
- - `npx skills add rohitg00/agentmemory` installs the skills so the agent knows when to call them.
800
+ - `agentmemory connect <agent>` normally writes the MCP server config. Hermes, OpenClaw, Pi and Oh My Pi install their native integration and bundled skills by default; MCP is opt-in with `--with-mcp`.
801
+ - `npx skills add rohitg00/agentmemory` installs skills for agents without native bundled skills. Skip this step for Hermes, OpenClaw, Pi and Oh My Pi; their native connectors already install the skills.
770
802
 
771
803
  For the few agents the skills CLI doesn't cover yet (Zed v1.3.x and below), drop the 17 SKILL.md files under the agent's native skill directory yourself; the same format works everywhere.
772
804
 
@@ -790,10 +822,10 @@ The agentmemory entry is the **same MCP server block** across every host that us
790
822
  | Agent | Config file | Notes |
791
823
  |---|---|---|
792
824
  | **Cursor (MCP only)** | `~/.cursor/mcp.json` | Merge into `mcpServers`, or `agentmemory connect cursor`. One-click deeplink also available on the website. |
793
- | **Cursor (full plugin)** | `.cursor-plugin/` | Cursor Marketplace listing (submission in review) or Cursor Settings → Plugins → local checkout. Registers 7 auto-capture hooks (sessionStart, beforeSubmitPrompt, preToolUse, postToolUse, postToolUseFailure, stop, sessionEnd) + 17 skills + the MCP server, with `AGENTMEMORY_URL` / `AGENTMEMORY_SECRET` managed in Cursor's plugin dashboard. Works in the Cursor IDE and `cursor-agent` CLI; CLI print-mode prompts are backfilled from the session transcript at session end. |
825
+ | **Cursor (full plugin)** | `.cursor-plugin/` | Cursor Marketplace listing or Settings → Plugins → local checkout. Registers lifecycle hooks via a thin adapter that delegates to the canonical `plugin/scripts/*.mjs`, plus skills and MCP. The adapter resolves the workspace Cursor does not reliably report. See [Cursor](#cursor). Works in the Cursor IDE and `cursor-agent` CLI. |
794
826
  | **Claude Desktop** | `claude_desktop_config.json` (Application Support) | Merge into `mcpServers`. Restart Claude Desktop after editing. |
795
827
  | **Cline / Roo Code / Kilo Code** | Cline MCP settings (Settings UI → MCP Servers → Edit) | Same `mcpServers` block. |
796
- | **Devin CLI (MCP + hooks)** | `~/.config/devin/config.json` | `agentmemory connect devin` merges the MCP entry; `--with-hooks` adds six native auto-capture hooks (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop, SessionEnd) with Devin'"'"'s lowercase tool matchers. Verify with `devin mcp list` and `/hooks` inside devin. |
828
+ | **Devin CLI (MCP + hooks)** | `~/.config/devin/config.json` | `agentmemory connect devin` merges the MCP entry; `--with-hooks` adds six native auto-capture hooks (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop, SessionEnd) with Devin's lowercase tool matchers. Verify with `devin mcp list` and `/hooks` inside devin. |
797
829
  | **Devin CLI (full plugin)** | `plugin/.devin-plugin/` | `devin plugins install ./plugin` from a checkout registers all 17 skills as `/agentmemory:<skill>` slash commands plus the MCP server. Devin plugin hooks cannot fire `SessionStart`/`SessionEnd`, so pair it with `connect devin --with-hooks` for full session capture. |
798
830
  | **Devin (cloud)** | Settings → Connections → MCP servers | Add a custom MCP (STDIO): command `npx`, args `-y @agentmemory/mcp@latest`, env `AGENTMEMORY_URL` pointing at a network-reachable agentmemory deployment plus `AGENTMEMORY_SECRET` (cloud sessions cannot reach localhost — see [`deploy/`](deploy/)). Store the secret in Devin Secrets, then use "Test listing tools" to verify all 54 tools appear. |
799
831
  | **Gemini CLI** | `~/.gemini/settings.json` | `gemini mcp add agentmemory npx -y @agentmemory/mcp --scope user` (auto-merges). |
@@ -804,47 +836,30 @@ The agentmemory entry is the **same MCP server block** across every host that us
804
836
  | **Codex CLI (full plugin)** | Codex plugin marketplace | `codex plugin marketplace add rohitg00/agentmemory` then `codex plugin add agentmemory@agentmemory`. Registers MCP + 6 lifecycle hooks + 17 skills. Trust hooks and verify capture in your host; see [Codex setup and validation](docs/plugins/codex-local.md). |
805
837
  | **OpenCode (MCP only)** | `opencode.json` | Different shape: top-level `mcp` key, command as array: `{"mcp": {"agentmemory": {"type": "local", "command": ["npx", "-y", "@agentmemory/mcp"], "enabled": true}}}`. |
806
838
  | **OpenCode (full plugin)** | `plugin/opencode/` | 22 auto-capture hooks covering session lifecycle, messages, tools, errors. Project attribution is per-session, so one OpenCode process spanning several repositories files each session under its own project. Two slash commands (`/recall`, `/remember`). Copy `plugin/opencode/` into your OpenCode workspace and add the plugin entry to `opencode.json`. See [`plugin/opencode/README.md`](plugin/opencode/README.md) for the full hook table + gap analysis. |
807
- | **pi** | `~/.pi/agent/extensions/agentmemory` | `agentmemory connect pi` installs the bundled extension into pi's auto-discovery directory (recall on agent start, capture on agent end, `memory_search` / `memory_save` / `memory_health` tools, `/agentmemory-status`). `/reload` in a running pi picks it up. [`integrations/pi`](integrations/pi/) is also a pi package (`pi install ./integrations/pi` from a checkout). |
808
- | **Hermes Agent** | `~/.hermes/config.yaml` | `cp -r integrations/hermes ~/.hermes/plugins/agentmemory` + `memory.provider: agentmemory` gives the 6-hook memory provider (prefetch, turn capture, session end, pre-compress, MEMORY.md mirroring, system prompt block). Validate with `hermes plugins doctor` and `hermes memory status`. See [`integrations/hermes`](integrations/hermes/). |
839
+ | **pi** | Active Pi agent directory, default `~/.pi/agent` | `agentmemory connect pi --with-mcp` installs native recall/capture, offline replay, 17 skills and the full MCP toolset. Or build `integrations/pi` and use `pi install ./integrations/pi`; after npm publication, `pi install npm:@agentmemory/pi`. Use one method and run `/reload`. See [setup and migration](integrations/pi/). |
840
+ | **Oh My Pi (OMP)** | Active OMP agent directory, default `~/.omp/agent/config.yml` | `agentmemory connect omp --with-mcp` installs native recall/capture, offline replay, 17 skills and the full MCP toolset. Restart OMP and run `/agentmemory-status`. See [setup, profiles and commands](integrations/omp/). |
841
+ | **Hermes Agent** | `$HERMES_HOME/config.yaml`, default `~/.hermes/config.yaml` | `agentmemory connect hermes` installs the native provider and skills. Configure its scoped credentials with `hermes memory setup`. Add `--with-mcp` for the wider tool surface. See [setup and scope](integrations/hermes/). |
809
842
  | **Qwen Code** | `~/.qwen/settings.json` | `agentmemory connect qwen` writes the standard `mcpServers` block. Hook payload is field-compatible with Claude Code, so the existing 12-hook scripts work without modification; wire them via the `hooks` section in the same `settings.json`. |
810
843
  | **Antigravity IDE / 2.0** | `~/.gemini/config/mcp_config.json` | `agentmemory connect antigravity --with-hooks` installs MCP and capture hooks in the shared customization directory. See [Antigravity setup and limits](docs/plugins/antigravity.md). |
811
844
  | **Antigravity CLI** (`agy`) | `~/.gemini/config/mcp_config.json` | `agentmemory connect antigravity-cli --with-hooks` uses the same MCP and hook configuration as current IDE versions. Existing installations should refresh with `--force`; see the [upgrade notes](docs/plugins/antigravity.md). |
812
845
  | **Kiro** | `~/.kiro/settings/mcp.json` | `agentmemory connect kiro` writes the user-level config. Workspace overrides go in `.kiro/settings/mcp.json` next to your code. |
813
846
  | **Warp** | `~/.warp/.mcp.json` | `agentmemory connect warp` writes the standard `mcpServers` block. Warp also auto-discovers skills from `.claude/skills/`; once the Claude Code plugin is installed the 8 agentmemory skills (`remember`, `recall`, `recap`, `handoff`, `forget`, `commit-context`, `commit-history`, `session-history`) appear natively in Warp's slash-command palette. |
814
847
  | **Cline (CLI)** | `~/.cline/mcp.json` | `agentmemory connect cline` writes the standard `mcpServers` block. VS Code extension users: paste the same block via Cline Settings → MCP Servers → Edit JSON. |
815
- | **Continue.dev** | `~/.continue/config.yaml` (preferred) or `config.json` (legacy) | `agentmemory connect continue` creates `config.yaml` from scratch when neither exists, or modifies existing `config.json`. **If you already have `config.yaml`** the adapter prints the exact block to paste under `mcpServers:`; it won't silently rewrite your yaml because preserving comments and anchors safely needs a YAML parser the package doesn't ship. Continue uses array form (not object) for `mcpServers`. |
848
+ | **Continue.dev** | `~/.continue/config.yaml` (preferred) or `config.json` (legacy) | `agentmemory connect continue` creates `config.yaml` from scratch when neither exists, or modifies existing `config.json`. **If you already have `config.yaml`** the adapter prints the exact block to paste under `mcpServers:`; it won't silently rewrite your yaml so your existing comments and anchors are preserved. Continue uses array form (not object) for `mcpServers`. |
816
849
  | **Zed** | `~/.config/zed/settings.json` | `agentmemory connect zed` writes under `context_servers` (Zed's key, NOT `mcpServers`). Remote MCP servers can be wired via `{"url": "..."}` instead. |
817
850
  | **Droid (Factory.ai)** | `~/.factory/mcp.json` | `agentmemory connect droid` writes the standard `mcpServers` block. Project-scoped overrides go in `<repo>/.factory/mcp.json`. Pass `--with-hooks` for native auto-capture. |
818
- | **DeepSeek Harness** | `$DSH_HOME/cordis.patch.yml` | `agentmemory connect dsh` appends an `@deepseek-ai/dsh-mcp-client` row to the home-level patch layer every Harness profile loads; tools register as `mcp__agentmemory__*`. Pass `--with-hooks` to also wire auto-capture: the bundled Claude Code hook scripts run through Harness's first-party `@deepseek-ai/dsh-hooks-claude-code` bridge (SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, Stop) via a manifest written to `$DSH_HOME/agentmemory.hooks.json`. Defaults to `~/.dsh` when `DSH_HOME` is unset. |
851
+ | **DeepSeek Harness** | `$DSH_HOME/cordis.patch.yml` | `agentmemory connect dsh` enables MCP tools. Add `--with-hooks` to load the native capture plugin bundled with AgentMemory. No separate plugin package is needed. [DSH](docs/dsh.md). |
819
852
  | **Goose** | Goose MCP settings UI | Same `mcpServers` block; use `goose configure` → Add Extension → MCP. Direct YAML edit at `~/.config/goose/config.yaml` is supported but the schema uses `extensions:` + `cmd` (not `mcpServers:` + `command`). |
820
- | **Aider** | n/a | Talk to the REST API directly: `curl -X POST http://localhost:3111/agentmemory/smart-search -d '{"query": "auth"}'`. |
821
- | **Any agent (32+)** | n/a | `npx skillkit install agentmemory` auto-detects the host and merges. |
853
+ | **Aider** | n/a | Use the [authenticated REST examples](#validate-a-fresh-install-and-restart-persistence) to save and search memory from scripts. |
854
+ | **Supported agents** | Skills only | `npx skills add rohitg00/agentmemory`; choose the skills and agents to install to. |
822
855
 
823
856
  **Sandboxed MCP clients** (Flatpak / Snap / restrictive containers) that can't reach the host's `localhost`: also set `"AGENTMEMORY_FORCE_PROXY": "1"` in the `env` block, and point `AGENTMEMORY_URL` at a route the sandbox can actually reach (e.g. your LAN IP).
824
857
 
825
- ### Programmatic access (Python / Rust / Node)
826
-
827
- agentmemory registers its core operations as iii functions (`mem::remember`, `mem::observe`, `mem::context`, `mem::smart-search`, `mem::forget`). Any language with an iii SDK can call them directly over `ws://localhost:49134`, with no separate REST client per language.
828
-
829
- ```bash
830
- pip install iii-sdk # Python
831
- cargo add iii-sdk # Rust
832
- npm install iii-sdk # Node
833
- ```
834
-
835
- ```python
836
- from iii import register_worker
837
-
838
- iii = register_worker("ws://localhost:49134")
839
- iii.connect()
858
+ ### Programmatic access
840
859
 
841
- iii.trigger({
842
- "function_id": "mem::smart-search",
843
- "payload": {"project": "demo", "query": "how do tokens refresh"},
844
- })
845
- ```
860
+ Use the [REST API](#api) from any language or the [MCP tools](#mcp-server) from an agent. REST requests use JSON and bearer authentication; see the [save and search example](#validate-a-fresh-install-and-restart-persistence).
846
861
 
847
- Worked example: [`examples/python/`](examples/python/) (quickstart + observation/recall flow). REST on `:3111` remains available for hosts without an iii runtime.
862
+ For direct runtime integration, see the [Python examples](examples/python/).
848
863
 
849
864
  ### From source
850
865
 
@@ -853,91 +868,33 @@ git clone https://github.com/rohitg00/agentmemory.git && cd agentmemory
853
868
  npm install && npm run build && npm start
854
869
  ```
855
870
 
856
- This starts agentmemory with a local `iii-engine` if the pinned binary is already installed, or uses Docker Compose when selected. REST, streams, and the viewer bind to `127.0.0.1` by default. The automatic macOS/Linux binary path requires `curl`, a POSIX `sh`, and `tar`.
857
-
858
- Install `iii-engine` manually. **agentmemory currently pins `iii-engine` to `v0.22.1`**, the same release as its `iii-sdk` dependency; the worker speaks that engine's wire protocol, and 0.20.0 reorganized the SDK surface, so the two move together in agentmemory releases. Override with `AGENTMEMORY_III_VERSION=<version>` if you run your own engine and know it matches.
859
-
860
- - **macOS arm64:** `mkdir -p ~/.local/bin && curl -fsSLo iii.tar.gz https://github.com/iii-hq/iii/releases/download/iii/v0.22.1/iii-aarch64-apple-darwin.tar.gz && echo "2b309019b909a896cae874dc947e2cdf877b4f3c51dd026b79850af858517fa4 iii.tar.gz" | shasum -a 256 -c - && tar -xzf iii.tar.gz -C ~/.local/bin && chmod +x ~/.local/bin/iii`
861
- - **macOS x64:** swap `aarch64-apple-darwin` for `x86_64-apple-darwin`
862
- - **Linux x64:** swap for `x86_64-unknown-linux-gnu`
863
- - **Linux arm64:** swap for `aarch64-unknown-linux-gnu`
864
- - **Windows:** download `iii-x86_64-pc-windows-msvc.zip` from [iii-hq/iii releases v0.22.1](https://github.com/iii-hq/iii/releases/tag/iii%2Fv0.22.1) and extract `iii.exe` to `%USERPROFILE%\.agentmemory\bin\iii.exe`
865
-
866
- Every archive has a matching `.sha256` file on the release page; when you swap the platform, use that file's hash in the check above (on Windows: `Get-FileHash`). The automatic installer in `npx @agentmemory/agentmemory` pins these hashes and refuses an archive that does not match.
867
-
868
- Or use Docker (the bundled `docker-compose.yml` pulls `iiidev/iii:0.22.1`). Full docs: [iii.dev/docs](https://iii.dev/docs).
871
+ `npm start` launches the same local server as the installed CLI. Dependencies for automatic setup are listed under [Install](#install); the API and viewer bind to `127.0.0.1`.
869
872
 
870
873
  ### Windows
871
874
 
872
- agentmemory runs on Windows 10/11, but the Node.js package alone isn't enough; you also need the pinned iii-engine v0.22.1 runtime as a background process. The CLI does not auto-extract the Windows ZIP, so native Windows users must install `iii.exe` manually, use WSL2, or choose Docker Desktop.
873
-
874
- Native Windows automated MCP wiring supports only `agentmemory connect copilot-cli`. For Claude Code, Codex, Cursor, and every other native Windows agent, copy the manual MCP block from [Other agents](#other-agents) into that agent's Windows config. Running `connect` in WSL is appropriate only when the target agent is also installed in the same WSL environment; it does not edit a Windows-host agent's configuration.
875
+ agentmemory runs on Windows 10/11. WSL2 follows the Linux path and can install the pinned engine automatically. Native Windows requires the pinned iii-engine v0.25.0 binary installed manually; download the matching archive from the [iii v0.25.0 release page](https://github.com/iii-hq/iii/releases/tag/iii%2Fv0.25.0), verify its checksum, and place `iii.exe` on `PATH` (for example `%USERPROFILE%\.local\bin\iii.exe`). The CLI does not extract the Windows ZIP automatically.
875
876
 
876
- **Option A: prebuilt Windows binary (recommended)**
877
-
878
- ```powershell
879
- # 1. Open https://github.com/iii-hq/iii/releases/tag/iii%2Fv0.22.1 in your browser
880
- # (agentmemory pins the engine to the same release as its iii-sdk;
881
- # v0.22.1 is the current pair)
882
- # 2. Download iii-x86_64-pc-windows-msvc.zip
883
- # (or iii-aarch64-pc-windows-msvc.zip if you're on an ARM machine)
884
- # 3. Extract iii.exe to agentmemory's private engine directory:
885
- New-Item -ItemType Directory -Force "$HOME\.agentmemory\bin"
886
- # Copy iii.exe to $HOME\.agentmemory\bin\iii.exe
887
- # 4. Verify:
888
- & "$HOME\.agentmemory\bin\iii.exe" --version
889
- # Should print: 0.22.1
890
-
891
- # 5. Then run agentmemory as usual:
892
- npx -y @agentmemory/agentmemory@latest
893
- ```
877
+ Native Windows automated MCP wiring supports only `agentmemory connect copilot-cli`. For other native Windows agents, use the manual MCP block from [Other agents](#other-agents). Run `connect` inside WSL only when the target agent is installed in that same WSL environment.
894
878
 
895
- **Option B: Docker Desktop**
896
-
897
- ```powershell
898
- # 1. Install Docker Desktop for Windows
899
- # 2. Start Docker Desktop and make sure the engine is running
900
- # 3. Select Docker explicitly and run agentmemory:
901
- $env:AGENTMEMORY_USE_DOCKER = "1"
902
- npx -y @agentmemory/agentmemory@latest
903
- ```
904
-
905
- **Option C: standalone MCP only (no engine).** If you only need the MCP tools for your agent and don't need the REST API, viewer, or cron jobs, skip the engine entirely:
879
+ **Standalone MCP only (no engine).** If you only need MCP tools and do not need the REST API, viewer, or runtime services:
906
880
 
907
881
  ```powershell
908
882
  npx -y @agentmemory/agentmemory@latest mcp
909
- # or via the shim package:
883
+ # or
910
884
  npx -y @agentmemory/mcp
911
885
  ```
912
886
 
913
- **Diagnostics for Windows:** if `npx -y @agentmemory/agentmemory@latest` fails, re-run it with `--verbose` to see the actual engine stderr. Common failure modes:
914
-
915
- | Symptom | Fix |
916
- |---|---|
917
- | `The engine process started but the REST API never responded.` | Confirm all four derived ports are free, verify the pinned `iii.exe` stayed alive, then re-run with `--verbose` and inspect the captured engine stderr |
918
- | `Could not start iii-engine` | Neither `iii.exe` nor Docker is installed. See Option A or B above |
919
- | Port conflict | `netstat -ano \| findstr :3111` to see what's bound, then kill it or use `--port <N>` |
920
- | Docker fallback skipped even though Docker is installed | Make sure Docker Desktop is actually running (system tray icon) |
921
-
922
- > Note: the iii **engine** is a prebuilt binary, not a cargo crate, so don't try to `cargo install` it. (The iii **SDKs** are published on crates.io, npm, and PyPI, but agentmemory doesn't need them.) Supported engine install methods are all pinned to v0.22.1: the prebuilt binary above, agentmemory's macOS/Linux auto-install path (`curl`, POSIX `sh`, and `tar` required), and the Docker image `iiidev/iii:0.22.1`. A bare upstream `install.sh | sh` installs the latest engine, which agentmemory does not support. Use `npx -y @agentmemory/agentmemory@latest`; on macOS/Linux it fetches the pinned engine into `~/.agentmemory/bin`.
887
+ **Diagnostics:** Run `agentmemory doctor` or restart with `--verbose`. Use `--port <N>` or `--instance <N>` if the default ports are occupied. See the [upgrade guide](docs/upgrades/iii-0.25.md) for runtime compatibility and recovery.
923
888
 
924
889
  ---
925
890
 
926
891
  <h2 id="deploy">Deploy</h2>
927
892
 
928
- One-click templates for managed hosts. Each one ships a self-contained
929
- Dockerfile that pulls `@agentmemory/agentmemory` from npm and copies
930
- the iii engine binary in from the official `iiidev/iii` Docker Hub
931
- image; no pre-built agentmemory image required. Persistent storage
932
- mounts at `/data`; the first-boot entrypoint overwrites the
933
- npm-bundled iii config (which binds `127.0.0.1`) with a deploy-tuned
934
- one that binds `0.0.0.0` and uses absolute `/data` paths, generates
935
- the HMAC secret, then drops privileges from `root` to `node` via
936
- `gosu` before exec'ing the agentmemory CLI.
893
+ Self-host with Docker Compose or the platform templates below. Persistent memory and credentials live on the `/data` volume. Back up and reuse that volume when upgrading. See the [deployment guide](deploy/README.md) for authentication, network access, backups and migration.
937
894
 
938
895
  <p>
939
- <a href="https://fly.io/launch?repo=https://github.com/rohitg00/agentmemory&path=deploy/fly"><img src="https://img.shields.io/badge/Deploy%20to-fly.io-8b5cf6?style=for-the-badge&logo=fly.io&logoColor=white" alt="Deploy to fly.io" /></a>
940
- <a href="https://railway.com/new/template?template=https%3A%2F%2Fgithub.com%2Frohitg00%2Fagentmemory&rootDirectory=deploy%2Frailway"><img src="https://img.shields.io/badge/Deploy%20to-Railway-0B0D0E?style=for-the-badge&logo=railway&logoColor=white" alt="Deploy to Railway" /></a>
896
+ <a href="https://fly.io/launch?repo=https://github.com/rohitg00/agentmemory"><img src="https://img.shields.io/badge/Deploy%20to-fly.io-8b5cf6?style=for-the-badge&logo=fly.io&logoColor=white" alt="Deploy to fly.io" /></a>
897
+ <a href="https://railway.com/new/template?template=https%3A%2F%2Fgithub.com%2Frohitg00%2Fagentmemory"><img src="https://img.shields.io/badge/Deploy%20to-Railway-0B0D0E?style=for-the-badge&logo=railway&logoColor=white" alt="Deploy to Railway" /></a>
941
898
  </p>
942
899
 
943
900
  Render's one-click deploy button requires `render.yaml` at the repository root, which we deliberately keep clean. Use the Render Blueprint flow documented in [`deploy/render/`](./deploy/render/README.md) to point at the in-repo blueprint manually.
@@ -955,28 +912,26 @@ cost floors) live in [`deploy/`](./deploy/README.md):
955
912
  own VPS via [Coolify](https://coolify.io/self-hosted); same Docker
956
913
  Compose stack, you own the host and the data.
957
914
 
958
- Only port `3111` is published. The viewer on `3113` stays bound to
959
- loopback inside the container; every template's README documents the
960
- SSH-tunnel pattern for reaching it.
915
+ REST uses port `3111`; the viewer uses `3113`. Keep both private or protect them with authentication and TLS. Platform-specific exposure settings and [legacy Docker migration](deploy/README.md#migrating-from-the-legacy-cli-docker-mode) are covered in the deployment guide.
961
916
 
962
917
  ---
963
918
 
964
919
  <h2 id="why-agentmemory"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-why.svg"><img src="assets/tags/section-why.svg" alt="Why agentmemory" height="32" /></picture></h2>
965
920
 
966
- Every coding agent forgets everything when the session ends, and each new session starts with you re-explaining your stack. agentmemory runs in the background and removes that step.
921
+ Project knowledge gets scattered across chats and instruction files. AgentMemory makes past decisions, fixes and lessons searchable from the agent you are using now.
967
922
 
968
923
  ```text
969
924
  Session 1: "Add auth to the API"
970
925
  Agent writes code, runs tests, fixes bugs
971
- agentmemory silently captures every tool use
972
- Session ends -> observations compressed into structured memory
926
+ Connected hooks capture supported tool events
927
+ Observations become searchable project history
973
928
 
974
929
  Session 2: "Now add rate limiting"
975
- Agent already knows:
930
+ Agent recalls:
976
931
  - Auth uses JWT middleware in src/middleware/auth.ts
977
932
  - Tests in test/auth.test.ts cover token validation
978
933
  - You chose jose over jsonwebtoken for Edge compatibility
979
- Zero re-explaining. Starts working immediately.
934
+ Continues with the earlier decisions in context.
980
935
  ```
981
936
 
982
937
  ### vs built-in agent memory
@@ -985,7 +940,7 @@ Every AI coding agent ships with built-in memory: Claude Code has `MEMORY.md`, C
985
940
 
986
941
  | | Built-in (CLAUDE.md) | agentmemory |
987
942
  |---|---|---|
988
- | Scale | 200-line cap | Unlimited |
943
+ | Upkeep | Manually curated instructions | Indexed session history and memories |
989
944
  | Search | Loads everything into context | BM25 + vector + graph (top-K only) |
990
945
  | Token cost | 22K+ at 240 observations | ~1,900 tokens (92% less) |
991
946
  | Cross-agent | Per-agent files | MCP + REST (any agent) |
@@ -1011,13 +966,13 @@ PostToolUse hook fires
1011
966
  Stop / SessionEnd hook fires
1012
967
  -> Summarize session
1013
968
  -> Knowledge graph extraction (if GRAPH_EXTRACTION_ENABLED=true)
1014
- -> Slot reflection (if SLOT_REFLECT_ENABLED=true)
969
+ -> Slot reflection (if AGENTMEMORY_SLOTS=true and AGENTMEMORY_REFLECT=true)
1015
970
 
1016
971
  SessionStart hook fires
1017
972
  -> Load project profile (top concepts, files, patterns)
1018
973
  -> Hybrid search (BM25 + vector + graph)
1019
974
  -> Token budget (default: 2000 tokens)
1020
- -> Inject into conversation
975
+ -> Inject context when enabled by the integration
1021
976
  ```
1022
977
 
1023
978
  ### 4-Tier Memory Consolidation
@@ -1035,6 +990,8 @@ Memories decay over time (Ebbinghaus curve). Frequently accessed memories streng
1035
990
 
1036
991
  ### What Gets Captured
1037
992
 
993
+ The table below describes the Claude Code hook surface. Other integrations capture the events their host provides; see the individual setup guides. Automatic context injection through the shared hooks is opt-in with `AGENTMEMORY_INJECT_CONTEXT=true`.
994
+
1038
995
  | Hook | Captures |
1039
996
  |------|----------|
1040
997
  | `SessionStart` | Project path, session ID |
@@ -1044,14 +1001,14 @@ Memories decay over time (Ebbinghaus curve). Frequently accessed memories streng
1044
1001
  | `PostToolUseFailure` | Error context |
1045
1002
  | `PreCompact` | Re-injects memory before compaction |
1046
1003
  | `SubagentStart/Stop` | Sub-agent lifecycle |
1047
- | `Stop` | End-of-session summary |
1004
+ | `Stop` | Assistant's final reply of each turn (privacy-filtered) |
1048
1005
  | `SessionEnd` | Session complete marker |
1049
1006
 
1050
1007
  ### Key Capabilities
1051
1008
 
1052
1009
  | Capability | Description |
1053
1010
  |---|---|
1054
- | **Automatic capture** | Every tool use recorded via hooks, no manual effort |
1011
+ | **Automatic capture** | Supported session and tool events recorded by native integrations |
1055
1012
  | **Semantic search** | BM25 + vector + knowledge graph with RRF fusion |
1056
1013
  | **Memory evolution** | Versioning, supersession, relationship graphs |
1057
1014
  | **Recall hygiene** | Superseded memory versions leave the search indexes; the version chain in KV keeps full history |
@@ -1061,12 +1018,16 @@ Memories decay over time (Ebbinghaus curve). Frequently accessed memories streng
1061
1018
  | **Auto-forgetting** | TTL expiry, contradiction detection, importance eviction |
1062
1019
  | **Privacy first** | API keys, secrets, `<private>` tags stripped before storage |
1063
1020
  | **Self-healing** | Circuit breaker, provider fallback chain, health monitoring |
1064
- | **Claude bridge** | Bi-directional sync with MEMORY.md |
1021
+ | **Claude bridge** | Read MEMORY.md and export project memories without replacing existing files |
1065
1022
  | **Knowledge graph** | Entity extraction + BFS traversal |
1066
1023
  | **Team memory** | Namespaced shared + private across team members |
1067
1024
  | **Citation provenance** | Trace any memory back to source observations |
1068
1025
  | **Git snapshots** | Version, rollback, and diff memory state |
1069
1026
 
1027
+ The Claude bridge is opt-in: set `CLAUDE_MEMORY_BRIDGE=true` and `CLAUDE_PROJECT_PATH` to your project directory, then restart agentmemory. `memory_claude_bridge_sync` exports only the latest memories scoped to that project, excluding unscoped memories. The read direction continues to read existing `MEMORY.md` content.
1028
+
1029
+ Export creates `MEMORY.md` only when it is absent. Existing files are preserved, including previous generated exports and edits made by you or Claude Code. Identical content returns `changed: false`; different content returns an error. To regenerate deliberately, move the existing file to a backup location (or remove it if no longer needed), then run the tool again. See the bridge settings in [`.env.example`](.env.example).
1030
+
1070
1031
  ---
1071
1032
 
1072
1033
  <h2 id="search"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-search.svg"><img src="assets/tags/section-search.svg" alt="Search" height="32" /></picture></h2>
@@ -1112,7 +1073,7 @@ The normal npm install includes the optional `@huggingface/transformers` runtime
1112
1073
 
1113
1074
  54 tools, 6 resources, 3 prompts, and 17 skills.
1114
1075
 
1115
- > **MCP shim vs full server:** the published `@agentmemory/mcp` package is a thin shim. It exposes the full 54-tool surface **only when it can reach a running agentmemory server** via `AGENTMEMORY_URL` (proxy mode). With no server reachable, the shim falls back to a 7-tool local set (`memory_save`, `memory_recall`, `memory_smart_search`, `memory_sessions`, `memory_export`, `memory_audit`, `memory_governance_delete`). The `AGENTMEMORY_TOOLS=core|all` env var is a *server-side* flag; setting it in the shim's `env` block has no effect. If you see only 7 tools in Cursor / OpenCode / Gemini CLI, start `npx -y @agentmemory/agentmemory@latest` (or the Docker stack) and set `AGENTMEMORY_URL=http://localhost:3111`.
1076
+ > **MCP shim vs full server:** the published `@agentmemory/mcp` package is a thin shim. It exposes the full 54-tool surface **only when it can reach a running agentmemory server** via `AGENTMEMORY_URL` (proxy mode). With no server reachable, the shim falls back to a 7-tool local set (`memory_save`, `memory_recall`, `memory_smart_search`, `memory_sessions`, `memory_export`, `memory_audit`, `memory_governance_delete`). The `AGENTMEMORY_TOOLS=core|all` env var is a *server-side* flag; setting it in the shim's `env` block has no effect. If you see only 7 tools in Cursor / OpenCode / Gemini CLI, start `npx -y @agentmemory/agentmemory@latest` (or connect to a self-hosted server) and set `AGENTMEMORY_URL=http://localhost:3111`.
1116
1077
 
1117
1078
  ### 54 Tools
1118
1079
 
@@ -1133,7 +1094,7 @@ Three tool surfaces, smallest to largest: `AGENTMEMORY_TOOLS=core` trims visibil
1133
1094
  | `memory_vision_search` | Search image observations |
1134
1095
  | `memory_timeline` | Chronological observations |
1135
1096
  | `memory_profile` | Project profile (concepts, files, patterns) |
1136
- | `memory_export` | Export all memory data |
1097
+ | `memory_export` | Export memory data, in pages or selected collections on a large store |
1137
1098
  | `memory_relations` | Query relationship graph |
1138
1099
  | `memory_commit_lookup` | Sessions behind a git commit |
1139
1100
  | `memory_commits` | Commits recorded for a session |
@@ -1150,7 +1111,7 @@ Three tool surfaces, smallest to largest: `AGENTMEMORY_TOOLS=core` trims visibil
1150
1111
  | `memory_relations` | Query relationship graph |
1151
1112
  | `memory_graph_query` | Knowledge graph traversal |
1152
1113
  | `memory_consolidate` | Run 4-tier consolidation |
1153
- | `memory_claude_bridge_sync` | Sync with MEMORY.md |
1114
+ | `memory_claude_bridge_sync` | Read MEMORY.md or create a project export, preserving existing files |
1154
1115
  | `memory_team_share` | Share with team members |
1155
1116
  | `memory_team_feed` | Recent shared items |
1156
1117
  | `memory_audit` | Audit trail of operations |
@@ -1252,7 +1213,7 @@ cp plugin/opencode/commands/*.md ~/.config/opencode/commands/
1252
1213
 
1253
1214
  <h2 id="real-time-viewer"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-viewer.svg"><img src="assets/tags/section-viewer.svg" alt="Real-Time Viewer" height="32" /></picture></h2>
1254
1215
 
1255
- Auto-starts on port `3113`. The viewer loads one snapshot when it connects (`GET /agentmemory/viewer/snapshot`) and then applies live stream events: new memories, lessons, observations, audit entries, graph changes and health updates appear without polling or page reloads. The only other requests are the actions you click, "load more" pages and searches. When the stream drops, the viewer shows how old its numbers are, reconnects with backoff and resyncs from one snapshot.
1216
+ Auto-starts on port `3113`. The viewer loads one snapshot when it connects (`GET /agentmemory/viewer/snapshot`) and then applies live events over SSE at `/agentmemory/viewer/events` on the REST worker: new memories, lessons, observations, audit entries, graph changes and health updates appear without polling or page reloads. The only other requests are the actions you click, "load more" pages and searches. When the stream drops, the viewer shows how old its numbers are, reconnects with backoff and resyncs from one snapshot.
1256
1217
 
1257
1218
  - **12 tabs in four groups** with live counts, deep links (`#memories/<id>`, `#sessions/<id>?obs=<id>`, `#graph/<id>`, `#health/consolidation`), keyboard shortcuts and a mobile menu.
1258
1219
  - **Memories:** server-side search, filters by project, agent and type, a detail panel with the version chain and a word diff, provenance links, copy buttons for the id, the MCP call and a curl command, edit (a new version), forget with confirmation, bulk forget and JSON export.
@@ -1265,188 +1226,7 @@ Auto-starts on port `3113`. The viewer loads one snapshot when it connects (`GET
1265
1226
  open http://localhost:3113
1266
1227
  ```
1267
1228
 
1268
- The viewer server binds to `127.0.0.1` by default and attaches the server secret when it forwards requests to the REST API, so it needs no setup. The REST-served `/agentmemory/viewer` endpoint follows the normal bearer-token rules and redirects browsers without a token to the viewer port. CSP headers use a per-response script nonce and disable inline handler attributes (`script-src-attr 'none'`).
1269
-
1270
- ---
1271
-
1272
- <h2 id="iii-console"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-viewer.svg"><img src="assets/tags/section-viewer.svg" alt="iii Console" height="32" /></picture></h2>
1273
-
1274
- The viewer at `:3113` shows what your agent **remembered**. The [iii console](https://iii.dev/docs/console) shows what your agent **did**: every memory op as an OpenTelemetry trace, every KV entry editable, every function invocable, every stream tappable. Two windows on the same memory: one product-shaped, one engine-shaped.
1275
-
1276
- Watch a `memory_smart_search` fire and see the BM25 scan → embedding lookup → RRF fusion → reranker as a waterfall. Edit a stuck consolidation timer in the KV browser. Replay a `PostToolUse` hook with a tweaked payload. Pin the WebSocket stream and watch observations land live.
1277
-
1278
- agentmemory ships this for free because every function call and trigger fires through iii; nothing custom, nothing to instrument.
1279
-
1280
- <p align="center">
1281
- <img src="assets/iii-console/workers.png" alt="iii console Workers page: connected workers including agentmemory instances with live function counts and runtime metadata" width="720" />
1282
- <br/>
1283
- <em>Workers page: every connected worker, including agentmemory itself, with PID, function count, runtime, and last-seen.</em>
1284
- </p>
1285
-
1286
- **Already installed.** The console ships with the pinned `iii` engine (0.22+); nothing separate to install. The first launch downloads the console binary next to the engine.
1287
-
1288
- **Launch alongside agentmemory:**
1289
-
1290
- ```bash
1291
- agentmemory console
1292
- ```
1293
-
1294
- This runs the pinned engine's `iii console` against the ports agentmemory resolved (REST, streams, bridge) and serves it one port above the viewer, `http://localhost:3114` by default. `--console-port N` picks another port; `--port` and `--instance` select the agentmemory instance the same way they do for `stop`; any other flag is passed through, for example `--enable-flow` for the experimental architecture-graph page.
1295
-
1296
- The same thing by hand, useful when `agentmemory` is not on PATH:
1297
-
1298
- ```bash
1299
- ~/.agentmemory/bin/iii console --port 3114 \
1300
- --engine-port 3111 \
1301
- --ws-port 3112 \
1302
- --bridge-port 49134
1303
- ```
1304
-
1305
- **What you can do from the console:**
1306
-
1307
- | Page | Use it to |
1308
- |------|-----------|
1309
- | **Workers** | See every connected worker and its live metrics, including the agentmemory worker itself. |
1310
- | **Functions** | Invoke any of agentmemory's functions directly with a JSON payload; handy for testing `memory.recall`, `memory.consolidate`, `graph.query` without wiring a client. |
1311
- | **Triggers** | Replay HTTP, cron, event, and state triggers: fire the consolidation cron manually, retry an HTTP route, emit a state change. |
1312
- | **States** | KV browser with full CRUD over sessions, memory slots, lifecycle timers, and the embeddings index; edit values in place. |
1313
- | **Streams** | Live WebSocket monitor for memory writes, hook events, and observation updates as they flow through iii streams. |
1314
- | **Queues** | Durable queue topics + dead-letter management. Replay or drop failed embedding / compression jobs. |
1315
- | **Traces** | OpenTelemetry waterfall / flame / service-breakdown views. Filter by `trace_id` to see exactly which functions, DB calls, and embedding requests a single `memory.search` produced. |
1316
- | **Logs** | Structured OTEL logs filtered and correlated to trace/span IDs. |
1317
- | **Config** | Runtime configuration: see exactly which workers, providers, and ports your engine is running with. |
1318
- | **Flow** | (Optional, `--enable-flow`) Interactive architecture graph of every worker, trigger, and stream. |
1319
-
1320
- <p align="center">
1321
- <img src="assets/iii-console/traces-waterfall.png" alt="iii console trace waterfall view showing per-span duration" width="720" />
1322
- <br/>
1323
- <em>Traces: waterfall / flame / service breakdown for every memory operation.</em>
1324
- </p>
1325
-
1326
- **Traces are already on:**
1327
-
1328
- `iii-config.yaml` ships with the `iii-observability` worker enabled (`exporter: memory`, `sampling_ratio: 0.1`, metrics + logs). No extra config needed; the moment agentmemory starts, every memory operation emits a structured log the console can read, and one in ten of them (`sampling_ratio: 0.1`) also emits a trace span.
1329
-
1330
- If you want to export to Jaeger/Honeycomb/Grafana Tempo instead, change `exporter: memory` to `exporter: otlp` and set the collector endpoint per iii's observability docs.
1331
-
1332
- > **Heads-up:** no auth is enforced on the console itself; keep it bound to `127.0.0.1` (the default) and never expose it publicly.
1333
-
1334
- ---
1335
-
1336
- <h2 id="powered-by-iii"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-architecture.svg"><img src="assets/tags/section-architecture.svg" alt="Powered by iii" height="32" /></picture></h2>
1337
-
1338
- agentmemory is **already a running [iii](https://iii.dev) instance**. Three primitives (worker, function, trigger) compose the runtime; KV state, streams, and OTEL traces come from iii-state, iii-stream, and iii-observability workers that ship with iii. You didn't install Postgres, Redis, Express, pm2, or Prometheus, because iii replaces them.
1339
-
1340
- That means one more command extends agentmemory with an entire new capability.
1341
-
1342
- ### Extend agentmemory with more workers
1343
-
1344
- The builtins agentmemory needs are already in `iii-config.yaml` and boot with it: `iii-state` (KV), `iii-queue` (durable retries for the event subscribers), `iii-pubsub`, `iii-cron`, `iii-stream`, and `iii-observability` (OTEL traces, metrics and logs on every function). Anything else from the [iii worker registry](https://workers.iii.dev) plugs into the same engine: copy `iii-config.yaml` to `~/.agentmemory/iii-config.yaml` (the CLI prefers that file over the bundled one and still renders ports and data paths into it), add the entry, install the worker runtime once with `~/.agentmemory/bin/iii update worker`, and restart agentmemory.
1345
-
1346
- ```yaml
1347
- workers:
1348
- # ...the bundled entries...
1349
- - name: database # SQL-backed state adapter when you outgrow the KV defaults
1350
- - name: iii-sandbox # run code that came out of memory_recall inside a throwaway VM
1351
- - name: mcp # extra MCP servers next to agentmemory's, same engine
1352
- ```
1353
-
1354
- | Worker | What you get on top of agentmemory |
1355
- |---|---|
1356
- | [`database`](https://workers.iii.dev/workers/database) | SQL-backed state adapter when you outgrow the in-memory KV defaults |
1357
- | [`iii-sandbox`](https://workers.iii.dev/workers/iii-sandbox) | Code that came out of `memory_recall` runs inside a throwaway VM, not your shell |
1358
- | [`mcp`](https://workers.iii.dev/workers/mcp) | Stand up extra MCP servers next to agentmemory's, share the same engine |
1359
-
1360
- On engine 0.22.x keep the `iii-` prefixed names for the builtins above; the unprefixed `http`, `state`, `queue`, `pubsub` and `cron` entries are the standalone registry workers agentmemory moves to with the 0.23 migration.
1361
-
1362
- Full registry: [workers.iii.dev](https://workers.iii.dev). Every worker there composes through the same primitives agentmemory uses, and the agentmemory you already have is one of them.
1363
-
1364
- ### Engine config and bind address
1365
-
1366
- `agentmemory start` reads the engine config from the first file that exists: `AGENTMEMORY_III_CONFIG`, `./iii-config.yaml` in the current directory, `~/.agentmemory/iii-config.yaml`, then the bundled `iii-config.yaml`. On every start it renders that file (data paths, ports, state backend) into `~/.agentmemory/data/iii-config.runtime.yaml` and launches the engine with the rendered copy, so edit the source file, not the rendered one. The `host:` values of the source file are kept as written.
1367
-
1368
- The bundled `iii-config.yaml` binds `127.0.0.1` on purpose, and that default also applies inside a container. A CLI started in a container listens on the container's loopback, so published ports reach nothing. To serve a containerized CLI through published ports, set `AGENTMEMORY_III_CONFIG` to a config that binds `0.0.0.0`. The packaged `iii-config.docker.yaml` is one: it binds `iii-http`, `iii-stream` and the engine port to `0.0.0.0` and stores state under `/data`, so mount a writable volume there. Keep `AGENTMEMORY_SECRET` set, and publish only the ports you need, on `127.0.0.1` or behind a proxy you trust.
1369
-
1370
- This repo's `docker-compose.yml` does not go through the CLI's config lookup: it mounts `iii-config.docker.yaml` at `/app/config.yaml`, and the `iii-engine` container starts with `--config /app/config.yaml`. The one-click [deploy templates](deploy/) write their own `0.0.0.0` config in their entrypoints.
1371
-
1372
- ### Storage backend: file (default) vs redis
1373
-
1374
- `iii-state` and `iii-stream` default to iii-engine's bundled file-based KV store: one JSON file per scope, held in the engine process's memory and rewritten to disk on a timer. That's the right default for a single-user local install; a shared daemon with several concurrent writers gets real per-key writes from Redis instead, at the cost of a network round trip per operation (every `state::*` call still serializes on one Redis connection, so this trades the file store's lock for a socket, not for parallelism).
1375
-
1376
- Set `AGENTMEMORY_STATE_BACKEND=redis` (plus `AGENTMEMORY_REDIS_URL`) to switch both workers to iii-engine's built-in `redis` adapter, which stores each key as a Redis hash field (`HSET`) instead of rewriting a whole scope on every write:
1377
-
1378
- ```env
1379
- # ~/.agentmemory/.env
1380
- AGENTMEMORY_STATE_BACKEND=redis
1381
- AGENTMEMORY_REDIS_URL=redis://localhost:6379
1382
- ```
1383
-
1384
- `AGENTMEMORY_STATE_BACKEND` defaults to `file`; leaving it unset keeps today's behavior unchanged, and an unrecognized value (anything other than `file` or `redis`) is a startup error rather than a silent fallback. `/agentmemory/status` and the viewer's Health page (the State store row) report which backend is active and whether it answers, never the URL.
1385
-
1386
- **Plain `redis://` only.** The pinned engine (0.22.1) builds its Redis client without TLS support, so a `rediss://` URL (most managed Redis offerings, such as Upstash, Redis Cloud, and ElastiCache with in-transit encryption, default to TLS-only) fails to connect. The connection is unencrypted, so the Redis password and every stored memory cross the wire in clear text: point at a local Redis or one on a private network you trust. For any other Redis, run an encrypted tunnel (stunnel, SSH, or a VPN) on the agentmemory host, so the plain `redis://` hop stays on that host and the tunnel's upstream connection is encrypted and authenticated. If a Redis password contains a single quote, percent-encode it (`%27`); the engine expands the URL into its YAML config before parsing it.
1387
-
1388
- **One Redis server per `--instance`.** The engine's Redis key prefixes (`state:<scope>`, `stream:<name>:<group>`) are fixed, so two agentmemory instances (`--instance 1`, `--instance 2`, ...) pointed at the same database overwrite each other's data. A separate database index (`redis://localhost:6379/1`) keeps the stored data apart, but the engine relays live viewer events over one Redis pub/sub channel (`stream::events`), and Redis pub/sub ignores the database index, so each instance's viewer would still show the other's live events. Give each instance its own Redis server (or port) when you run more than one.
1389
-
1390
- **What stays the same, and what differs.** Every agentmemory feature works on Redis: sessions, observations, memories (remember, supersede, evolve, forget), search and the index buckets, lessons, the graph, the audit log and its monthly scopes, export and import, governance deletes, consolidation status, the viewer snapshot and its live stream, and the health monitor. The engine stores each scope as one Redis hash (`HSET`/`HGET`/`HGETALL`) and fires the same state triggers as the file store. Three engine differences are handled inside agentmemory:
1391
-
1392
- - Redis returns a scope's records in no fixed order. agentmemory sorts them oldest first (by the creation time in the record id, then its timestamp) so lists, paging and export chunks come back in the same order as on the file store.
1393
- - The engine applies partial updates on Redis in a Lua script that turns empty arrays into empty objects. agentmemory applies those updates itself (read, change, write under a per-key lock) on Redis, so fields like `tags: []` stay arrays.
1394
- - The legacy audit log check reads the old scope from Redis instead of looking for the file store's file on disk.
1395
-
1396
- One difference needs you: **after Redis restarts, the engine stops relaying live events** to the viewer until agentmemory restarts. Data is still saved and read normally. The health monitor sends a test event through Redis every 30 seconds; when it does not come back, `/agentmemory/status` and the viewer's Health page show "Live updates are not reaching the viewer" with the fix: restart agentmemory. If Redis is down, the status report shows "The state store is not answering" and how to check it (`redis-cli -u "$AGENTMEMORY_REDIS_URL" ping`). Listing a very large scope reads the whole hash in one `HGETALL`, the same cost as the file store holding it in memory.
1397
-
1398
- **Recommended Redis settings.** The default `save 3600 1 300 100 60 10000` snapshot policy can lose minutes of writes on a crash, worse than the file store's 5s flush window. Set `appendonly yes` for anything you'd mind losing. Set `maxmemory-policy noeviction`; `allkeys-lru` or similar silently drops memories once Redis hits its memory limit.
1399
-
1400
- A native (non-Docker) start, and every one-click [deploy template](deploy/) (they overwrite the bundled `iii-config.yaml` and start natively), read `AGENTMEMORY_STATE_BACKEND`/`AGENTMEMORY_REDIS_URL` and render them into the launched `iii-config`. The URL itself is never written to that rendered file, only a `${AGENTMEMORY_REDIS_URL}` reference that the engine process expands from its own environment at boot. Only this repo's own Docker Compose path (`AGENTMEMORY_USE_DOCKER=1`, or resuming an engine already started that way) mounts `iii-config.docker.yaml` read-only and never renders; `agentmemory start` warns when it detects that combination. Switch that file by hand, following the same `name: redis` / `config: redis_url: ...` shape shown in the [iii-state](https://workers.iii.dev/workers/iii-state) and [iii-stream](https://workers.iii.dev/workers/iii-stream) worker docs, and point `redis_url` at a Redis reachable from the container. `docker-compose.yml` passes `AGENTMEMORY_REDIS_URL` into the engine container, so `redis_url: '${AGENTMEMORY_REDIS_URL}'` works there and keeps the URL out of the mounted file.
1401
-
1402
- The rendered config keeps the URL out of `~/.agentmemory/data/iii-config.runtime.yaml`, but the engine's own configuration worker still persists the *expanded* value to `~/.agentmemory/config/iii-state.yaml` and `iii-stream.yaml` once it boots (iii-engine's `${VAR}` expansion happens before that worker stores its seed, and it stores the resolved value, not the reference). Treat that directory as holding a credential: `chmod 700 ~/.agentmemory` on any shared host, and prefer a Redis ACL user scoped to what agentmemory needs over the database's admin credentials.
1403
-
1404
- **Migration is not automatic.** Switching `AGENTMEMORY_STATE_BACKEND` starts from an empty store on either side; nothing copies existing data from file to Redis or back. Export from the backend you're leaving and import into the one you're moving to. This runs identically under bash and zsh (including `bash -u`). An array like `AUTH=(${AGENTMEMORY_SECRET:+-H "Authorization: Bearer $AGENTMEMORY_SECRET"})` does not: zsh keeps the header as one malformed word where bash splits it into two, so both requests 401 whenever `AGENTMEMORY_SECRET` is set:
1405
-
1406
- ```bash
1407
- # 0. Use the generated secret when none is exported:
1408
- AGENTMEMORY_SECRET="${AGENTMEMORY_SECRET:-$(cat ~/.agentmemory/secret 2>/dev/null)}"
1409
-
1410
- # 1. On the old backend, while agentmemory is still running on it:
1411
- if [ -n "${AGENTMEMORY_SECRET:-}" ]; then
1412
- curl -fsS -H "Authorization: Bearer $AGENTMEMORY_SECRET" http://localhost:3111/agentmemory/export > backup.json
1413
- else
1414
- curl -fsS http://localhost:3111/agentmemory/export > backup.json
1415
- fi
1416
-
1417
- # 2. Confirm backup.json is a usable export before switching backends:
1418
- jq -e '.version and .exportedAt' backup.json > /dev/null || {
1419
- echo "backup.json is not a valid export; do not switch backends" >&2
1420
- exit 1
1421
- }
1422
-
1423
- # 3. Switch AGENTMEMORY_STATE_BACKEND (and AGENTMEMORY_REDIS_URL if needed),
1424
- # restart agentmemory against the new backend, then:
1425
- if [ -n "${AGENTMEMORY_SECRET:-}" ]; then
1426
- jq -n --slurpfile d backup.json '{exportData: $d[0], strategy: "merge"}' | \
1427
- curl -fsS -H "Authorization: Bearer $AGENTMEMORY_SECRET" -X POST http://localhost:3111/agentmemory/import \
1428
- -H 'Content-Type: application/json' -d @-
1429
- else
1430
- jq -n --slurpfile d backup.json '{exportData: $d[0], strategy: "merge"}' | \
1431
- curl -fsS -X POST http://localhost:3111/agentmemory/import \
1432
- -H 'Content-Type: application/json' -d @-
1433
- fi
1434
- ```
1435
-
1436
- `/agentmemory/export` also accepts `?maxSessions=` and `?offset=` for chunking a large corpus across several calls; `strategy` on import is `merge` (default-safe), `replace`, or `skip`.
1437
-
1438
- ### What iii replaces
1439
-
1440
- | Traditional stack | agentmemory uses |
1441
- |---|---|
1442
- | Express.js / Fastify | iii HTTP Triggers |
1443
- | SQLite / Postgres + pgvector | iii KV State + in-memory vector index |
1444
- | SSE / Socket.io | iii Streams (WebSocket) |
1445
- | pm2 / systemd | iii engine worker supervision |
1446
- | Prometheus / Grafana | iii OTEL + health monitor |
1447
- | Custom plugin systems | `iii worker add <name>` |
1448
-
1449
- **219 source files · ~52,000 LOC · 2,500+ tests · 311 functions · 60 KV scopes**, all on three primitives. No `agentmemory plugin install`. The plugin system is iii itself.
1229
+ The viewer server binds to `127.0.0.1` by default and attaches the server secret when it forwards requests to the REST API. On a non-loopback bind, the HTML shell remains public but every proxy request requires the bearer; the viewer prompts for it and stores it in session storage. Configure explicit host/origin allowlists and TLS before exposing a viewer. The REST-served `/agentmemory/viewer` endpoint follows the normal bearer-token rules and redirects browsers without a token to the viewer port. CSP headers use a per-response script nonce and disable inline handler attributes (`script-src-attr 'none'`).
1450
1230
 
1451
1231
  ---
1452
1232
 
@@ -1516,24 +1296,9 @@ Local embeddings ship as an optional dependency but are not enabled by default.
1516
1296
 
1517
1297
  ### Cost-aware model selection
1518
1298
 
1519
- When LLM-written background compression is enabled with both a provider and `AGENTMEMORY_AUTO_COMPRESS=true`, it runs on every observation, so model choice meaningfully changes monthly spend. Captured workload data: 635 requests / 888K tokens / 35 hours of active use, run against three OpenRouter models at 2026-05-23 pricing.
1520
-
1521
- | Tier | Model | Input / 1M | Output / 1M | Cost for the captured 35h | Notes |
1522
- |------|-------|------------|-------------|---------------------------|-------|
1523
- | Recommended | `deepseek/deepseek-v4-flash-0731` | $0.07 | $0.14 | ~$0.07 (est.) | Latest DeepSeek; cheapest recommended pick for compression workloads. |
1524
- | Recommended | `deepseek/deepseek-v4-pro` | $0.435 | $0.87 | ~$0.46 | Solid compression + summarization quality at ~10× lower cost than Sonnet. |
1525
- | Recommended | `qwen/qwen3-coder` | $0.45 | $1.80 | ~$0.55 | Strong code reasoning if your sessions are heavily code-shaped. |
1526
- | Premium | `anthropic/claude-sonnet-5` | $3.00 | $15.00 | ~$5.02 (est.) | Same list price as the measured Sonnet 4.6 run; $2/$10 intro pricing through 2026-08-31. |
1527
- | Premium | `openai/gpt-5.6-sol` | $5.00 | $30.00 | ~$9 (est.) | Flagship tier; expensive for always-on background work. |
1528
- | Avoid | `anthropic/claude-opus-5` | $5.00 | $25.00 | ~$8.40 (est.) | Flagship-class model; overspend for compression. |
1529
-
1530
- Measured rows come from the captured run; (est.) rows scale the same token mix by each model's list price.
1531
-
1532
- agentmemory prints a runtime warning when `OPENROUTER_MODEL` matches a premium-tier pattern. Set `AGENTMEMORY_SUPPRESS_COST_WARNING=1` to silence once you've made an informed choice.
1299
+ Start keyless for capture and keyword recall. Enable `EMBEDDING_PROVIDER=local` for on-device semantic search after the initial model download. LLM-written compression requires a provider and `AGENTMEMORY_AUTO_COMPRESS=true`; it can make a request for each captured observation, so check your provider's current pricing before enabling it.
1533
1300
 
1534
- Quality vs cost tradeoff for memory work: compression is a summarization task with relatively loose quality bars (the agent re-reads the summary, not the user). DeepSeek V4 Flash / V4 Pro / Qwen3-Coder land within rounding error of Sonnet on this task while costing 10-70× less. Save the premium-tier models for queries you read directly.
1535
-
1536
- Sources: [OpenRouter pricing for Claude Sonnet 5](https://openrouter.ai/anthropic/claude-sonnet-5), [DeepSeek V4 Flash](https://openrouter.ai/deepseek/deepseek-v4-flash-0731), [DeepSeek pricing notes](https://api-docs.deepseek.com/quick_start/pricing/).
1301
+ The viewer and `agentmemory status` show the active providers. Local OpenAI-compatible servers work with the same configuration shape as hosted providers.
1537
1302
 
1538
1303
  ### Multi-agent memory (`AGENT_ID` + `AGENTMEMORY_AGENT_SCOPE`)
1539
1304
 
@@ -1563,39 +1328,24 @@ When `AGENT_ID` is unset, memory remains unscoped (legacy behavior, no tags, no
1563
1328
 
1564
1329
  ### Ports
1565
1330
 
1566
- agentmemory + iii-engine bind four ports by default. If a restart fails with `port in use`, this table tells you which process to look for.
1567
-
1568
- | Port | Process | Purpose | Env override |
1569
- |------|---------|---------|--------------|
1570
- | `3111` | agentmemory | REST API + MCP HTTP + `/agentmemory/health` + `/agentmemory/livez` | `III_REST_PORT` |
1571
- | `3112` | iii-engine | Internal streams worker (consumed by agentmemory + viewer) | `III_STREAM_PORT` (preferred) or legacy `III_STREAMS_PORT` |
1572
- | `3113` | agentmemory | Real-time viewer (`http://localhost:3113`) | `III_VIEWER_PORT` or `AGENTMEMORY_VIEWER_URL` for the reported URL |
1573
- | `49134` | iii-engine | WebSocket; workers register here, OTel telemetry flows over it | `III_ENGINE_PORT` or `III_ENGINE_URL` |
1331
+ The API and viewer bind to loopback by default.
1574
1332
 
1575
- `--port <N>` changes the REST anchor and derives streams `N+1`, viewer `N+2`, and engine WebSocket `N+46023` only where the corresponding explicit port or URL above is unset. It does not create an isolated lifecycle namespace. Use `--instance 1` for a second daemon; it uses anchor 3211, defaults to `3211/3212/3213/49234`, and receives a separate `instance-1` data and lifecycle directory. Instances 1 through 50 follow the same pattern.
1333
+ | Port | Purpose | Env override |
1334
+ |---|---|---|
1335
+ | `3111` | REST API, MCP HTTP and live viewer events | `III_REST_PORT` |
1336
+ | `3113` | Viewer UI | `III_VIEWER_PORT` |
1576
1337
 
1577
- The pinned engine starts with `--no-update-check` (no update or security-advisory lookups against GitHub at boot) and with iii's anonymous usage telemetry off: agentmemory sets `III_TELEMETRY_ENABLED=false` for the engine it spawns unless you export the variable yourself, and the bundled compose file does the same.
1338
+ `--port <N>` sets the REST port and defaults the viewer to `N+2`. Use `--instance N` for a separate runtime. Internal runtime listeners must remain private; see the [deployment guide](deploy/README.md) before exposing the service remotely.
1578
1339
 
1579
- Stale-process cleanup when ports stay bound after a crashed run:
1340
+ ### Storage backend: file (default) vs Redis
1580
1341
 
1581
- ```bash
1582
- # macOS / Linux — find whatever is on each port and kill it
1583
- lsof -i :3111,3112,3113,49134
1584
- pkill -f agentmemory || true
1585
- pkill -f 'iii ' || true
1586
-
1587
- # Windows
1588
- netstat -ano | findstr ":3111 :3112 :3113 :49134"
1589
- taskkill /F /PID <pid>
1590
- ```
1591
-
1592
- `agentmemory stop` reaps both the worker and the engine pidfile cleanly on graceful native shutdown. In Docker mode it flushes the native worker, stops the exact validated engine container, and preserves both the container and its `/data` mount for a lossless restart; the next start validates and resumes that same container. Docker-backed uninstall requires `agentmemory remove --keep-data`: it removes shared agentmemory-managed files while preserving the validated container, its data mount, and the lifecycle record needed to recover them. Destructive Docker data deletion is intentionally left to the operator after a backup. The CLI also refuses to adopt or signal Docker or VM port holders (Docker backend, vpnkit, colima) as the native engine unless `--force` is passed. The manual cleanup above is only for the post-crash case where neither pidfile is left behind.
1342
+ The default file store needs no separate database service. Redis is optional with `AGENTMEMORY_STATE_BACKEND=redis` and `AGENTMEMORY_REDIS_URL`. Changing backends does not copy existing memories. Follow the [storage and backup guide](docs/reliability/state-storage.md) for persistence settings, Redis limitations and authenticated export/import.
1593
1343
 
1594
1344
  ### Config File
1595
1345
 
1596
- Put agentmemory runtime configuration in `~/.agentmemory/.env` instead of exporting variables in every shell. If the viewer shows a setup hint like `export ANTHROPIC_API_KEY=...`, copy it into this file as `ANTHROPIC_API_KEY=...` without the `export` prefix, then restart agentmemory.
1346
+ Put agentmemory runtime configuration in `~/.agentmemory/.env` instead of exporting variables in every shell. If the viewer shows a setup hint like `export ANTHROPIC_API_KEY=...`, copy it into this file as `ANTHROPIC_API_KEY=...` without the `export` prefix, then restart agentmemory. Set `AGENTMEMORY_ENV_FILE` to use another env-file path.
1597
1347
 
1598
- Process environment variables still work and take precedence over values in the file.
1348
+ Process environment variables take precedence over values in the file. Restart the server after changing its configuration.
1599
1349
 
1600
1350
  On Windows, the same file lives at `%USERPROFILE%\.agentmemory\.env`:
1601
1351
 
@@ -1622,179 +1372,39 @@ GRAPH_EXTRACTION_ENABLED=true
1622
1372
 
1623
1373
  ### Environment Variables
1624
1374
 
1625
- Create `~/.agentmemory/.env`:
1375
+ Common options for `~/.agentmemory/.env`:
1626
1376
 
1627
1377
  ```env
1628
- # LLM provider (pick one — default is the no-op provider: no LLM calls)
1629
- # ANTHROPIC_API_KEY=sk-ant-...
1630
- # ANTHROPIC_BASE_URL=... # Optional: Anthropic-compatible proxy / Azure
1631
- # GEMINI_API_KEY=...
1632
- # OPENROUTER_API_KEY=...
1633
- # MINIMAX_API_KEY=...
1634
- # OPENAI_API_KEY=*** # NOTE: this same key auto-activates BOTH the
1635
- # # OpenAI LLM provider (here) AND the OpenAI
1636
- # # embedding provider (further below). Set
1637
- # # OPENAI_API_KEY_FOR_LLM=false to scope it
1638
- # # to embeddings only.
1639
- # OPENAI_BASE_URL=https://api.openai.com # Optional: override for Azure / vLLM / LM Studio / proxies
1640
- # # Azure: https://<resource>.openai.azure.com/openai/deployments/<deployment>
1641
- # # Auto-detected from `.openai.azure.com` hostname; uses
1642
- # # api-key header + api-version query param.
1643
- # OPENAI_API_VERSION=2024-08-01-preview # Optional: Azure api-version query param
1644
- # OPENAI_MODEL=gpt-5.6-luna # Optional: default model
1645
- # OPENAI_TIMEOUT_MS=60000 # Optional: OpenAI-scoped alias for the outbound fetch
1646
- # # timeout. Takes precedence over AGENTMEMORY_LLM_TIMEOUT_MS
1647
- # # for back-compat with v0.9.17. New configs should
1648
- # # prefer the global AGENTMEMORY_LLM_TIMEOUT_MS below.
1649
- # OPENAI_REASONING_EFFORT=none # Optional: "low" | "medium" | "high" | "none"
1650
- # # Honored only by OpenAI's reasoning models (o1, o3,
1651
- # # gpt-*-reasoning) and providers that mirror that
1652
- # # schema (Ollama Cloud thinking models). Standard
1653
- # # chat models reject this field with 400. Set to
1654
- # # "none" for thinking models that return reasoning
1655
- # # but no content.
1656
- # OPENAI_API_KEY_FOR_LLM=false # Optional: set to false to skip OpenAI auto-detection
1657
- # # for LLM (useful if you only want OpenAI for embeddings)
1658
- # Opt-in Claude-subscription fallback (spawns @anthropic-ai/claude-agent-sdk);
1659
- # leave OFF unless you understand the Stop-hook recursion risk:
1660
- # AGENTMEMORY_ALLOW_AGENT_SDK=true
1661
-
1662
- # Embedding provider (BM25-only when unset; local is an explicit opt-in)
1663
- # EMBEDDING_PROVIDER=local
1664
- # VOYAGE_API_KEY=...
1665
- # OPENAI_API_KEY=sk-...
1666
- # OPENAI_BASE_URL=https://api.openai.com # Override for Azure / vLLM / LM Studio / proxies
1667
- # OPENAI_EMBEDDING_MODEL=text-embedding-3-small
1668
- # OPENAI_EMBEDDING_DIMENSIONS=1536 # Required when the model is not in the known-models table
1669
- # OPENAI_EMBEDDING_BASE_URL=https://... # Embeddings only; falls back to OPENAI_BASE_URL
1670
- # OPENAI_EMBEDDING_API_KEY=sk-... # Embeddings only; wins over OPENAI_API_KEY when set
1671
-
1672
- # Outbound LLM / embedding timeout
1673
- # AGENTMEMORY_LLM_TIMEOUT_MS=60000 # Default: 60 000 ms (60 s). Applies to every
1674
- # raw-fetch provider (Gemini, OpenRouter, MiniMax,
1675
- # OpenAI LLM, OpenAI/Cohere/Voyage/OpenRouter
1676
- # embedding). For the OpenAI LLM path, the
1677
- # OpenAI-scoped OPENAI_TIMEOUT_MS alias (above)
1678
- # takes precedence when set, for back-compat
1679
- # with v0.9.17.
1680
- # Increase for slow networks or large batch calls;
1681
- # decrease to fail-fast on rate-limit holds.
1682
-
1683
- # Search tuning
1684
- # BM25_WEIGHT=0.4
1685
- # VECTOR_WEIGHT=0.6
1686
- # TOKEN_BUDGET=2000
1687
-
1688
- # Auth (generated into ~/.agentmemory/secret on first start when unset)
1689
- # AGENTMEMORY_SECRET=your-secret
1690
- # VIEWER_ALLOWED_ORIGINS=https://memory.example.com
1691
- # AGENTMEMORY_IMPORT_ROOT=~/projects
1692
-
1693
- # Ports (defaults: 3111 API, 3113 viewer)
1694
- # III_REST_PORT=3111
1695
-
1696
- # Engine usage telemetry (iii). Off unless you set it; true opts in.
1697
- # III_TELEMETRY_ENABLED=false
1698
-
1699
- # Features
1700
- # AGENTMEMORY_AUTO_COMPRESS=false # OFF by default. Requires an LLM
1701
- # provider as well. When both are on,
1702
- # every PostToolUse hook calls your
1703
- # LLM provider to compress the
1704
- # observation — expect significant
1705
- # token spend on active sessions.
1706
- # AGENTMEMORY_SLOTS=false # OFF by default. Editable pinned
1707
- # memory slots — persona,
1708
- # user_preferences, tool_guidelines,
1709
- # project_context, guidance,
1710
- # pending_items, session_patterns,
1711
- # self_notes. Size-limited; agent
1712
- # edits via memory_slot_* tools.
1713
- # Pinned slots addressable for
1714
- # SessionStart injection.
1715
- # AGENTMEMORY_REFLECT=false # OFF by default. Requires SLOTS=on.
1716
- # Stop hook fires mem::slot-reflect:
1717
- # scans recent observations, auto-
1718
- # appends TODOs to pending_items,
1719
- # counts patterns in
1720
- # session_patterns, records touched
1721
- # files in project_context. Fire-
1722
- # and-forget; does not block.
1723
- # AGENTMEMORY_INJECT_CONTEXT=false # OFF by default. When on:
1724
- # - SessionStart may inject ~1-2K
1725
- # chars of project context into
1726
- # the first turn of each session
1727
- # (this is what actually reaches
1728
- # the model — Claude Code treats
1729
- # SessionStart stdout as context)
1730
- # - PreToolUse fires /agentmemory/enrich
1731
- # on every file-touching tool call
1732
- # (resource cleanup, not a token
1733
- # fix — PreToolUse stdout is debug
1734
- # log only per Claude Code docs)
1735
- # Observations are still captured via
1736
- # PostToolUse regardless of this flag.
1737
- # GRAPH_EXTRACTION_ENABLED=false
1738
- # AGENTMEMORY_LLM_NOTHINK=1 # Local reasoning models only: ask the
1739
- # model to skip its hidden thinking pass
1740
- # during graph extraction. Faster runs;
1741
- # relation quality can drop slightly.
1742
- # CONSOLIDATION_ENABLED=false # on by default when an LLM provider is configured
1743
- # LESSON_DECAY_ENABLED=true
1744
- # OBSIDIAN_AUTO_EXPORT=false
1745
- # AGENTMEMORY_EXPORT_ROOT=~/.agentmemory
1746
- # CLAUDE_MEMORY_BRIDGE=false
1747
- # SNAPSHOT_ENABLED=false
1748
-
1749
- # Storage and durability
1750
- # AGENTMEMORY_STATE_BACKEND=file # file (default) or redis; see "Storage backend" below
1751
- # AGENTMEMORY_REDIS_URL=redis://localhost:6379 # Required with redis, plain redis:// only
1752
- # AGENTMEMORY_STATE_SAVE_INTERVAL_MS=2000 # How often the engine writes file state to disk.
1753
- # A hard kill loses at most this window.
1754
- # AGENTMEMORY_INDEX_SAVE_INTERVAL_MS=600000 # Minimum time between search index saves;
1755
- # shutdown and deletes still save at once.
1756
- # AGENTMEMORY_GRAPH_COMPACT_ON_BOOT=true # One-time background trim of oversized graph
1757
- # provenance; false skips it
1758
-
1759
- # Sessions
1760
- # AGENTMEMORY_SESSION_SWEEP_ENABLED=true # Hourly sweep marks sessions left active past
1761
- # the threshold as abandoned. Deletes nothing;
1762
- # new activity makes the session active again.
1763
- # AGENTMEMORY_SESSION_SWEEP_STALE_HOURS=24
1764
-
1765
- # Capture filters (hooks)
1766
- # AGENTMEMORY_CAPTURE_ALLOW= # Comma or space list of tool names or globs;
1767
- # when set, only these tools are captured
1768
- # AGENTMEMORY_CAPTURE_DENY= # Extra names or globs to skip, added to the
1769
- # defaults: memory_*, toolsearch,
1770
- # listmcpresources, fetchmcpresource
1771
- # AGENTMEMORY_CAPTURE_OUTPUT_MAX=8000 # Max characters of tool output per observation
1772
- # AGENTMEMORY_PRE_COMPACT_BUDGET=1500 # Token budget for PreCompact context; 0 disables
1773
-
1774
- # Audit log
1775
- # AGENTMEMORY_AUDIT_RETENTION_MONTHS=0 # Drop month scopes older than N months; 0 keeps all
1776
- # AGENTMEMORY_AUDIT_INDEX_PERSIST=false # 1 or true records index migration and cleanup
1777
- # rows (debugging only)
1778
-
1779
- # Team
1780
- # TEAM_ID=
1781
- # USER_ID=
1782
- # TEAM_MODE=private
1783
-
1784
- # Tool visibility: "all" (54 tools, default) or "core" (8 tools, lean)
1378
+ # Semantic recall on your machine, after the first model download
1379
+ EMBEDDING_PROVIDER=local
1380
+
1381
+ # Optional automatic context injection through the shared hooks
1382
+ # AGENTMEMORY_INJECT_CONTEXT=true
1383
+
1384
+ # Optional LLM-written compression; also requires a configured provider
1385
+ # AGENTMEMORY_AUTO_COMPRESS=true
1386
+
1387
+ # Show 8 essential MCP tools instead of the default 54
1785
1388
  # AGENTMEMORY_TOOLS=core
1389
+
1390
+ # Disable scheduled auto-forget and lesson/insight decay
1391
+ # AUTO_FORGET_ENABLED=false
1392
+ # LESSON_DECAY_ENABLED=false
1393
+ # INSIGHT_DECAY_ENABLED=false
1786
1394
  ```
1787
1395
 
1396
+ The complete reference is [`.env.example`](.env.example), including provider credentials, capture filters, retention, storage, team scope and optional features. `AGENTMEMORY_ENV_FILE` selects another file. Never commit a populated `.env` or bearer secret.
1397
+
1788
1398
  ---
1789
1399
 
1790
1400
  <h2 id="api"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-api.svg"><img src="assets/tags/section-api.svg" alt="API" height="32" /></picture></h2>
1791
1401
 
1792
- 138 endpoints on port `3111`. The REST API binds to `127.0.0.1` by default. Protected endpoints require `Authorization: Bearer <secret>`, and mesh sync endpoints require an explicitly set `AGENTMEMORY_SECRET` on both peers.
1402
+ 146 endpoints on port `3111`. The REST API binds to `127.0.0.1` by default. Protected endpoints require `Authorization: Bearer <secret>`, and mesh sync endpoints require an explicitly set `AGENTMEMORY_SECRET` on both peers.
1793
1403
 
1794
- **Authentication is on by default.** When `AGENTMEMORY_SECRET` is not set (in the shell or in `~/.agentmemory/.env`), the server generates a random secret on first start and stores it in `~/.agentmemory/secret` with mode `0600`. Every bundled client reads it from there when it talks to a local server: the CLI, the viewer, the hooks under `plugin/scripts`, the MCP server and the `@agentmemory/mcp` shim, the configs written by `agentmemory connect`, and the bundled OpenCode, Pi, OpenClaw, Hermes and filesystem-watcher integrations. The stored secret is only sent to loopback URLs (`localhost`, `127.0.0.0/8`, `::1`). An explicit `AGENTMEMORY_SECRET` always wins, and remote clients still need it set. Docker and the `deploy/` entrypoints already generate and export their own secret. To call the API by hand:
1404
+ **Authentication is on by default.** When `AGENTMEMORY_SECRET` is not set (in the shell or in `~/.agentmemory/.env`), the CLI generates a random secret on first start and stores it at `~/.agentmemory/secret`, mirrored to the selected data directory as `secret`, with mode `0600` (the platform-specific default data directory is described above). Bundled clients read the canonical secret first when they talk to a local server: the CLI, the viewer, the hooks under `plugin/scripts`, the MCP server and the `@agentmemory/mcp` shim, the configs written by `agentmemory connect`, and the bundled OpenCode, Pi, OpenClaw, Hermes and filesystem-watcher integrations. The stored secret is only sent to loopback URLs (`localhost`, `127.0.0.0/8`, `::1`). An explicit `AGENTMEMORY_SECRET` always wins, and remote clients need the secret set in their environment. Repository-based Docker self-host deployments and the `deploy/` entrypoints generate and export their own secret. To call the API by hand:
1795
1405
 
1796
1406
  ```bash
1797
- curl -H "Authorization: Bearer $(cat ~/.agentmemory/secret)" http://localhost:3111/agentmemory/health
1407
+ curl -H "Authorization: Bearer <secret-from-data-dir>" http://localhost:3111/agentmemory/health
1798
1408
  ```
1799
1409
 
1800
1410
  **Request rules for writes.** `POST`, `PUT`, `PATCH` and `DELETE` requests to the REST API and the viewer must send `Content-Type: application/json` (a `charset` parameter is fine) whenever they carry a body, and an `Origin` header, when present, must be a loopback origin for the configured REST or viewer port or be listed in `VIEWER_ALLOWED_ORIGINS` (comma-separated, e.g. `https://memory.example.com`). Clients that send no `Origin` header (CLI, hooks, MCP, curl, server-to-server) are unaffected. The viewer also accepts its own origin.
@@ -1812,7 +1422,7 @@ curl -H "Authorization: Bearer $(cat ~/.agentmemory/secret)" http://localhost:31
1812
1422
  | `GET` | `/agentmemory/status` | What is wrong and how to fix it (HTML for browsers, JSON otherwise) |
1813
1423
  | `GET` | `/agentmemory/viewer/snapshot` | Everything the viewer shows, in one response |
1814
1424
  | `POST` | `/agentmemory/session/start` | Start session + get context |
1815
- | `POST` | `/agentmemory/session/end` | End session |
1425
+ | `POST` | `/agentmemory/session/end` | End session; `final: false` (per-turn hooks) defers completion until the session is idle |
1816
1426
  | `POST` | `/agentmemory/observe` | Capture observation (see capture delivery below) |
1817
1427
  | `GET` | `/agentmemory/capture` | Capture inbox, dead letters and offline spool |
1818
1428
  | `POST` | `/agentmemory/capture/retry` | Retry dead-letter captures |
@@ -1826,11 +1436,12 @@ curl -H "Authorization: Bearer $(cat ~/.agentmemory/secret)" http://localhost:31
1826
1436
  | `GET` | `/agentmemory/export` | Export all data |
1827
1437
  | `POST` | `/agentmemory/import` | Import from JSON |
1828
1438
  | `POST` | `/agentmemory/graph/query` | Knowledge graph query |
1439
+ | `POST` | `/agentmemory/graph/reset` | Start an empty graph generation; retain observations and memories |
1829
1440
  | `POST` | `/agentmemory/graph/compact` | Trim oversized graph provenance |
1830
1441
  | `POST` | `/agentmemory/team/share` | Share with team |
1831
1442
  | `GET` | `/agentmemory/audit` | Audit trail |
1832
1443
 
1833
- Full endpoint list: [`src/triggers/api.ts`](src/triggers/api.ts)
1444
+ Full endpoint list: [generated REST reference](plugin/skills/agentmemory-rest-api/REFERENCE.md)
1834
1445
 
1835
1446
  </details>
1836
1447
 
@@ -1848,19 +1459,23 @@ Failed events are retried every `AGENTMEMORY_CAPTURE_RETRY_INTERVAL_MS` (10 s) w
1848
1459
 
1849
1460
  When the server is down, does not answer in time or returns a 5xx, the hook appends the observation to a local spool file, `<data dir>/capture-spool/<host>-<port>.jsonl` (override the folder with `AGENTMEMORY_CAPTURE_SPOOL_DIR`). The file is private to your user (mode 600), secrets are redacted the same way the server redacts them, it holds at most `AGENTMEMORY_CAPTURE_SPOOL_MAX_BYTES` (5 MiB) and drops entries older than `AGENTMEMORY_CAPTURE_SPOOL_MAX_AGE_HOURS` (168). When it is full, new entries are dropped and counted, and `/agentmemory/status` reports it. The hook still exits 0 within its time limit and adds no request when the server is healthy. The spool is sent at the next start and by the first hook that reaches the server again, in a background process so the agent does not wait. Event ids make this safe: an observation that did arrive before a timeout is not stored twice. `npx @agentmemory/agentmemory capture` shows the spool and the server inbox, `--drain` sends the spool now, and `GET /agentmemory/capture` returns the same as JSON. Set `AGENTMEMORY_CAPTURE_SPOOL=false` to turn the spool off.
1850
1461
 
1851
- **Compacting graph provenance.** Each knowledge graph node and edge keeps the ids of the newest 32 observations it came from. Stores written before that cap can hold thousands of ids per hot node, which makes graph search and the viewer slow or drops the worker. agentmemory fixes this by itself: on the first start after upgrading it trims every node, edge, superseded edge (the temporal graph history) and the cached snapshot to the cap in the background, in small slices with a pause between them, so search, capture and the viewer keep working. It saves its progress, resumes after a restart and never runs again once it has finished. `/agentmemory/status` and the viewer Health page show it as pending, running (with the current scope and position), done or failed. Set `AGENTMEMORY_GRAPH_COMPACT_ON_BOOT=false` to turn it off.
1462
+ **Resetting the graph.** Call `POST /agentmemory/graph/reset` to start a new graph generation. The previous graph becomes inaccessible to graph queries, node lookups, statistics, and MCP reads; new imports and extraction populate the new generation. Existing observations and memories remain available. Old graph storage is retained.
1463
+
1464
+ **Upgrading from v0.9.30:** if you already reset the graph before upgrading, run `POST /agentmemory/graph/reset` again after the upgrade. Earlier reset timestamps are not used to infer a completed generation reset.
1465
+
1466
+ **Compacting graph provenance.** Legacy provenance compaction is deferred at startup because it reads complete legacy scopes. `/agentmemory/status` reports `deferred`, or `off` with `AGENTMEMORY_GRAPH_COMPACT_ON_BOOT=false`. Run the manual compaction below during maintenance. Retrieval index migration is separate: use `agentmemory graph-index migrate --allow-legacy-scan` as described in the [maintenance guide](docs/reliability/graph-index-migration.md).
1852
1467
 
1853
1468
  To run it by hand, call `POST /agentmemory/graph/compact`. It walks the name and edge-key indexes instead of listing every node and edge, and is safe to re-run. When it trims ids it writes a `graph_compact` audit entry.
1854
1469
 
1855
1470
  ```bash
1856
- curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: application/json" -d '{}'
1471
+ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: Bearer <secret>" -H "Content-Type: application/json" -d '{}'
1857
1472
  ```
1858
1473
 
1859
1474
  On a large store, or when the call returns 504, run it in slices. Send `scope` (`nodes`, `edges` or `history`), `offset` and `limit`, then call again with the returned `nextOffset` until it is `null`. Do this for `nodes`, `edges` and `history`, and finish with one `{"scope":"snapshot"}` call, because a sliced run does not touch the cached snapshot.
1860
1475
 
1861
1476
  ```bash
1862
- curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: application/json" -d '{"scope":"nodes","offset":0,"limit":200}'
1863
- curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: application/json" -d '{"scope":"snapshot"}'
1477
+ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: Bearer <secret>" -H "Content-Type: application/json" -d '{"scope":"nodes","offset":0,"limit":200}'
1478
+ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Authorization: Bearer <secret>" -H "Content-Type: application/json" -d '{"scope":"snapshot"}'
1864
1479
  ```
1865
1480
 
1866
1481
  ---
@@ -1870,11 +1485,11 @@ curl -X POST http://localhost:3111/agentmemory/graph/compact -H "Content-Type: a
1870
1485
  ```bash
1871
1486
  npm run dev # Hot reload
1872
1487
  npm run build # Production build
1873
- npm test # 2,500+ tests
1488
+ npm test # 4,000+ tests
1874
1489
  npm run test:integration # API tests (requires running services)
1875
1490
  ```
1876
1491
 
1877
- **Prerequisites:** Node.js >= 20 with npm/npx; [iii-engine](https://iii.dev/docs) v0.22.1 or Docker. The macOS/Linux automatic engine install also requires `curl`, a POSIX `sh`, and `tar`; native Windows uses the manual pinned `iii.exe`, WSL2, or Docker Desktop.
1492
+ **Prerequisites:** see [Install](#install). Contribution rules and release checks are in [CONTRIBUTING.md](CONTRIBUTING.md).
1878
1493
 
1879
1494
  <h2 id="license"><picture><source media="(prefers-color-scheme: dark)" srcset="assets/tags/light/section-license.svg"><img src="assets/tags/section-license.svg" alt="License" height="32" /></picture></h2>
1880
1495