@andre.li/memoark 0.3.1 → 0.3.2

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 (497) hide show
  1. package/README.en.md +388 -69
  2. package/README.md +674 -309
  3. package/README.zh-CN.md +816 -0
  4. package/bin/memoark.mjs +7 -2
  5. package/dist/adapters/store.d.ts.map +1 -1
  6. package/dist/adapters/store.js +6 -5
  7. package/dist/adapters/store.js.map +1 -1
  8. package/dist/cli-helpers.d.ts +12 -0
  9. package/dist/cli-helpers.d.ts.map +1 -0
  10. package/dist/cli-helpers.js +11 -0
  11. package/dist/cli-helpers.js.map +1 -0
  12. package/dist/cli.js +682 -126
  13. package/dist/cli.js.map +1 -1
  14. package/dist/collectors/feishu/chat-name-resolver.d.ts +33 -0
  15. package/dist/collectors/feishu/chat-name-resolver.d.ts.map +1 -0
  16. package/dist/collectors/feishu/chat-name-resolver.js +63 -0
  17. package/dist/collectors/feishu/chat-name-resolver.js.map +1 -0
  18. package/dist/collectors/feishu/collector.d.ts +4 -0
  19. package/dist/collectors/feishu/collector.d.ts.map +1 -1
  20. package/dist/collectors/feishu/collector.js +27 -4
  21. package/dist/collectors/feishu/collector.js.map +1 -1
  22. package/dist/collectors/feishu/docs/blocks.d.ts +25 -0
  23. package/dist/collectors/feishu/docs/blocks.d.ts.map +1 -0
  24. package/dist/collectors/feishu/docs/blocks.js +34 -0
  25. package/dist/collectors/feishu/docs/blocks.js.map +1 -0
  26. package/dist/collectors/feishu/docs/candidate.d.ts +17 -0
  27. package/dist/collectors/feishu/docs/candidate.d.ts.map +1 -0
  28. package/dist/collectors/feishu/docs/candidate.js +36 -0
  29. package/dist/collectors/feishu/docs/candidate.js.map +1 -0
  30. package/dist/collectors/feishu/docs/config.d.ts +41 -0
  31. package/dist/collectors/feishu/docs/config.d.ts.map +1 -0
  32. package/dist/collectors/feishu/docs/config.js +30 -0
  33. package/dist/collectors/feishu/docs/config.js.map +1 -0
  34. package/dist/collectors/feishu/docs/decision.d.ts +14 -0
  35. package/dist/collectors/feishu/docs/decision.d.ts.map +1 -0
  36. package/dist/collectors/feishu/docs/decision.js +43 -0
  37. package/dist/collectors/feishu/docs/decision.js.map +1 -0
  38. package/dist/collectors/feishu/docs/full-builder.d.ts +17 -0
  39. package/dist/collectors/feishu/docs/full-builder.d.ts.map +1 -0
  40. package/dist/collectors/feishu/docs/full-builder.js +136 -0
  41. package/dist/collectors/feishu/docs/full-builder.js.map +1 -0
  42. package/dist/collectors/feishu/docs/hash.d.ts +8 -0
  43. package/dist/collectors/feishu/docs/hash.d.ts.map +1 -0
  44. package/dist/collectors/feishu/docs/hash.js +15 -0
  45. package/dist/collectors/feishu/docs/hash.js.map +1 -0
  46. package/dist/collectors/feishu/docs/ingest.d.ts +54 -0
  47. package/dist/collectors/feishu/docs/ingest.d.ts.map +1 -0
  48. package/dist/collectors/feishu/docs/ingest.js +120 -0
  49. package/dist/collectors/feishu/docs/ingest.js.map +1 -0
  50. package/dist/collectors/feishu/docs/llm-json.d.ts +13 -0
  51. package/dist/collectors/feishu/docs/llm-json.d.ts.map +1 -0
  52. package/dist/collectors/feishu/docs/llm-json.js +40 -0
  53. package/dist/collectors/feishu/docs/llm-json.js.map +1 -0
  54. package/dist/collectors/feishu/docs/pointer-builder.d.ts +7 -0
  55. package/dist/collectors/feishu/docs/pointer-builder.d.ts.map +1 -0
  56. package/dist/collectors/feishu/docs/pointer-builder.js +11 -0
  57. package/dist/collectors/feishu/docs/pointer-builder.js.map +1 -0
  58. package/dist/collectors/feishu/docs/render.d.ts +8 -0
  59. package/dist/collectors/feishu/docs/render.d.ts.map +1 -0
  60. package/dist/collectors/feishu/docs/render.js +105 -0
  61. package/dist/collectors/feishu/docs/render.js.map +1 -0
  62. package/dist/collectors/feishu/docs/run.d.ts +37 -0
  63. package/dist/collectors/feishu/docs/run.d.ts.map +1 -0
  64. package/dist/collectors/feishu/docs/run.js +143 -0
  65. package/dist/collectors/feishu/docs/run.js.map +1 -0
  66. package/dist/collectors/feishu/docs/status.d.ts +16 -0
  67. package/dist/collectors/feishu/docs/status.d.ts.map +1 -0
  68. package/dist/collectors/feishu/docs/status.js +24 -0
  69. package/dist/collectors/feishu/docs/status.js.map +1 -0
  70. package/dist/collectors/feishu/docs/store-writer.d.ts +32 -0
  71. package/dist/collectors/feishu/docs/store-writer.d.ts.map +1 -0
  72. package/dist/collectors/feishu/docs/store-writer.js +71 -0
  73. package/dist/collectors/feishu/docs/store-writer.js.map +1 -0
  74. package/dist/collectors/feishu/docs/toc.d.ts +3 -0
  75. package/dist/collectors/feishu/docs/toc.d.ts.map +1 -0
  76. package/dist/collectors/feishu/docs/toc.js +19 -0
  77. package/dist/collectors/feishu/docs/toc.js.map +1 -0
  78. package/dist/collectors/feishu/docs/triggers.d.ts +7 -0
  79. package/dist/collectors/feishu/docs/triggers.d.ts.map +1 -0
  80. package/dist/collectors/feishu/docs/triggers.js +31 -0
  81. package/dist/collectors/feishu/docs/triggers.js.map +1 -0
  82. package/dist/collectors/feishu/docs/types.d.ts +109 -0
  83. package/dist/collectors/feishu/docs/types.d.ts.map +1 -0
  84. package/dist/collectors/feishu/docs/types.js +2 -0
  85. package/dist/collectors/feishu/docs/types.js.map +1 -0
  86. package/dist/collectors/feishu/docs/upgrade-queue.d.ts +19 -0
  87. package/dist/collectors/feishu/docs/upgrade-queue.d.ts.map +1 -0
  88. package/dist/collectors/feishu/docs/upgrade-queue.js +36 -0
  89. package/dist/collectors/feishu/docs/upgrade-queue.js.map +1 -0
  90. package/dist/collectors/feishu/docs/url-parser.d.ts +3 -0
  91. package/dist/collectors/feishu/docs/url-parser.d.ts.map +1 -0
  92. package/dist/collectors/feishu/docs/url-parser.js +39 -0
  93. package/dist/collectors/feishu/docs/url-parser.js.map +1 -0
  94. package/dist/collectors/feishu/docs/walkers.d.ts +24 -0
  95. package/dist/collectors/feishu/docs/walkers.d.ts.map +1 -0
  96. package/dist/collectors/feishu/docs/walkers.js +90 -0
  97. package/dist/collectors/feishu/docs/walkers.js.map +1 -0
  98. package/dist/collectors/feishu/docs/wiki-resolver.d.ts +15 -0
  99. package/dist/collectors/feishu/docs/wiki-resolver.d.ts.map +1 -0
  100. package/dist/collectors/feishu/docs/wiki-resolver.js +24 -0
  101. package/dist/collectors/feishu/docs/wiki-resolver.js.map +1 -0
  102. package/dist/collectors/feishu/lark-cli-client.d.ts +12 -0
  103. package/dist/collectors/feishu/lark-cli-client.d.ts.map +1 -1
  104. package/dist/collectors/feishu/lark-cli-client.js +37 -2
  105. package/dist/collectors/feishu/lark-cli-client.js.map +1 -1
  106. package/dist/collectors/feishu/lark-cli-identity-backend.d.ts +28 -0
  107. package/dist/collectors/feishu/lark-cli-identity-backend.d.ts.map +1 -0
  108. package/dist/collectors/feishu/lark-cli-identity-backend.js +110 -0
  109. package/dist/collectors/feishu/lark-cli-identity-backend.js.map +1 -0
  110. package/dist/collectors/feishu/self-open-id.d.ts +20 -0
  111. package/dist/collectors/feishu/self-open-id.d.ts.map +1 -0
  112. package/dist/collectors/feishu/self-open-id.js +31 -0
  113. package/dist/collectors/feishu/self-open-id.js.map +1 -0
  114. package/dist/collectors/feishu/sources/dm.d.ts.map +1 -1
  115. package/dist/collectors/feishu/sources/dm.js +4 -0
  116. package/dist/collectors/feishu/sources/dm.js.map +1 -1
  117. package/dist/collectors/feishu/sources/mail.d.ts.map +1 -1
  118. package/dist/collectors/feishu/sources/mail.js +18 -20
  119. package/dist/collectors/feishu/sources/mail.js.map +1 -1
  120. package/dist/collectors/feishu/sources/messages.d.ts +2 -0
  121. package/dist/collectors/feishu/sources/messages.d.ts.map +1 -1
  122. package/dist/collectors/feishu/sources/messages.js +28 -1
  123. package/dist/collectors/feishu/sources/messages.js.map +1 -1
  124. package/dist/collectors/feishu/types.d.ts +37 -3
  125. package/dist/collectors/feishu/types.d.ts.map +1 -1
  126. package/dist/collectors/feishu/types.js.map +1 -1
  127. package/dist/config-center/connection-checks.d.ts.map +1 -1
  128. package/dist/config-center/connection-checks.js +1 -1
  129. package/dist/config-center/connection-checks.js.map +1 -1
  130. package/dist/config-center/schema.d.ts.map +1 -1
  131. package/dist/config-center/schema.js +77 -0
  132. package/dist/config-center/schema.js.map +1 -1
  133. package/dist/consolidator/consolidator.d.ts +13 -1
  134. package/dist/consolidator/consolidator.d.ts.map +1 -1
  135. package/dist/consolidator/consolidator.js +12 -2
  136. package/dist/consolidator/consolidator.js.map +1 -1
  137. package/dist/core/canonicalize.js +5 -1
  138. package/dist/core/canonicalize.js.map +1 -1
  139. package/dist/core/config.d.ts +52 -9
  140. package/dist/core/config.d.ts.map +1 -1
  141. package/dist/core/config.js +86 -24
  142. package/dist/core/config.js.map +1 -1
  143. package/dist/core/env-validation.d.ts +9 -0
  144. package/dist/core/env-validation.d.ts.map +1 -0
  145. package/dist/core/env-validation.js +94 -0
  146. package/dist/core/env-validation.js.map +1 -0
  147. package/dist/core/identity-resolver.d.ts +24 -3
  148. package/dist/core/identity-resolver.d.ts.map +1 -1
  149. package/dist/core/identity-resolver.js +147 -2
  150. package/dist/core/identity-resolver.js.map +1 -1
  151. package/dist/core/person-identity.d.ts +124 -0
  152. package/dist/core/person-identity.d.ts.map +1 -0
  153. package/dist/core/person-identity.js +342 -0
  154. package/dist/core/person-identity.js.map +1 -0
  155. package/dist/core/person-slug.d.ts +21 -0
  156. package/dist/core/person-slug.d.ts.map +1 -0
  157. package/dist/core/person-slug.js +93 -0
  158. package/dist/core/person-slug.js.map +1 -0
  159. package/dist/core/pipeline-factory.d.ts +1 -1
  160. package/dist/core/pipeline-factory.d.ts.map +1 -1
  161. package/dist/core/pipeline-factory.js +8 -3
  162. package/dist/core/pipeline-factory.js.map +1 -1
  163. package/dist/core/pipeline.d.ts +16 -0
  164. package/dist/core/pipeline.d.ts.map +1 -1
  165. package/dist/core/pipeline.js +49 -1
  166. package/dist/core/pipeline.js.map +1 -1
  167. package/dist/core/resource-loader.d.ts +2 -0
  168. package/dist/core/resource-loader.d.ts.map +1 -0
  169. package/dist/core/resource-loader.js +12 -0
  170. package/dist/core/resource-loader.js.map +1 -0
  171. package/dist/core/schemas.d.ts +2981 -309
  172. package/dist/core/schemas.d.ts.map +1 -1
  173. package/dist/core/schemas.js +27 -0
  174. package/dist/core/schemas.js.map +1 -1
  175. package/dist/core/signal-scoring.d.ts.map +1 -1
  176. package/dist/core/signal-scoring.js +5 -1
  177. package/dist/core/signal-scoring.js.map +1 -1
  178. package/dist/core/source-ref.d.ts +4 -0
  179. package/dist/core/source-ref.d.ts.map +1 -0
  180. package/dist/core/source-ref.js +24 -0
  181. package/dist/core/source-ref.js.map +1 -0
  182. package/dist/core/state.d.ts +1 -1
  183. package/dist/core/state.d.ts.map +1 -1
  184. package/dist/core/state.js +3 -2
  185. package/dist/core/state.js.map +1 -1
  186. package/dist/core/types.d.ts +34 -6
  187. package/dist/core/types.d.ts.map +1 -1
  188. package/dist/daemon/reload-manager.d.ts +27 -0
  189. package/dist/daemon/reload-manager.d.ts.map +1 -0
  190. package/dist/daemon/reload-manager.js +67 -0
  191. package/dist/daemon/reload-manager.js.map +1 -0
  192. package/dist/daemon/scheduler.d.ts +9 -1
  193. package/dist/daemon/scheduler.d.ts.map +1 -1
  194. package/dist/daemon/scheduler.js +113 -38
  195. package/dist/daemon/scheduler.js.map +1 -1
  196. package/dist/daemon/serve-runtime.d.ts +31 -0
  197. package/dist/daemon/serve-runtime.d.ts.map +1 -0
  198. package/dist/daemon/serve-runtime.js +230 -0
  199. package/dist/daemon/serve-runtime.js.map +1 -0
  200. package/dist/embedded-assets.generated.d.ts.map +1 -1
  201. package/dist/embedded-assets.generated.js +3 -3
  202. package/dist/embedded-assets.generated.js.map +1 -1
  203. package/dist/extractors/playbook-extractor.d.ts +35 -0
  204. package/dist/extractors/playbook-extractor.d.ts.map +1 -0
  205. package/dist/extractors/playbook-extractor.js +98 -0
  206. package/dist/extractors/playbook-extractor.js.map +1 -0
  207. package/dist/extractors/prompts/examples/agent-session.md +257 -0
  208. package/dist/extractors/prompts/signal-extract.md +199 -0
  209. package/dist/extractors/prompts/system.md +45 -0
  210. package/dist/extractors/signal-extractor.d.ts +2 -1
  211. package/dist/extractors/signal-extractor.d.ts.map +1 -1
  212. package/dist/extractors/signal-extractor.js +99 -7
  213. package/dist/extractors/signal-extractor.js.map +1 -1
  214. package/dist/hooks/handlers.d.ts +21 -0
  215. package/dist/hooks/handlers.d.ts.map +1 -0
  216. package/dist/hooks/handlers.js +22 -0
  217. package/dist/hooks/handlers.js.map +1 -0
  218. package/dist/hooks/inject.d.ts +7 -0
  219. package/dist/hooks/inject.d.ts.map +1 -0
  220. package/dist/hooks/inject.js +18 -0
  221. package/dist/hooks/inject.js.map +1 -0
  222. package/dist/hooks/install.d.ts +14 -0
  223. package/dist/hooks/install.d.ts.map +1 -0
  224. package/dist/hooks/install.js +34 -0
  225. package/dist/hooks/install.js.map +1 -0
  226. package/dist/hooks/output.d.ts +19 -0
  227. package/dist/hooks/output.d.ts.map +1 -0
  228. package/dist/hooks/output.js +13 -0
  229. package/dist/hooks/output.js.map +1 -0
  230. package/dist/hooks/recall-client.d.ts +25 -0
  231. package/dist/hooks/recall-client.d.ts.map +1 -0
  232. package/dist/hooks/recall-client.js +56 -0
  233. package/dist/hooks/recall-client.js.map +1 -0
  234. package/dist/hooks/run-event.d.ts +13 -0
  235. package/dist/hooks/run-event.d.ts.map +1 -0
  236. package/dist/hooks/run-event.js +20 -0
  237. package/dist/hooks/run-event.js.map +1 -0
  238. package/dist/hooks/settings-edit.d.ts +10 -0
  239. package/dist/hooks/settings-edit.d.ts.map +1 -0
  240. package/dist/hooks/settings-edit.js +44 -0
  241. package/dist/hooks/settings-edit.js.map +1 -0
  242. package/dist/hooks/writeback.d.ts +12 -0
  243. package/dist/hooks/writeback.d.ts.map +1 -0
  244. package/dist/hooks/writeback.js +48 -0
  245. package/dist/hooks/writeback.js.map +1 -0
  246. package/dist/install/clients/claude-code.d.ts +3 -0
  247. package/dist/install/clients/claude-code.d.ts.map +1 -0
  248. package/dist/install/clients/claude-code.js +30 -0
  249. package/dist/install/clients/claude-code.js.map +1 -0
  250. package/dist/install/clients/claude-desktop.d.ts +3 -0
  251. package/dist/install/clients/claude-desktop.d.ts.map +1 -0
  252. package/dist/install/clients/claude-desktop.js +31 -0
  253. package/dist/install/clients/claude-desktop.js.map +1 -0
  254. package/dist/install/clients/codex.d.ts +3 -0
  255. package/dist/install/clients/codex.d.ts.map +1 -0
  256. package/dist/install/clients/codex.js +32 -0
  257. package/dist/install/clients/codex.js.map +1 -0
  258. package/dist/install/clients/cursor.d.ts +3 -0
  259. package/dist/install/clients/cursor.d.ts.map +1 -0
  260. package/dist/install/clients/cursor.js +35 -0
  261. package/dist/install/clients/cursor.js.map +1 -0
  262. package/dist/install/clients/hermes.d.ts +3 -0
  263. package/dist/install/clients/hermes.d.ts.map +1 -0
  264. package/dist/install/clients/hermes.js +35 -0
  265. package/dist/install/clients/hermes.js.map +1 -0
  266. package/dist/install/clients/index.d.ts +4 -0
  267. package/dist/install/clients/index.d.ts.map +1 -0
  268. package/dist/install/clients/index.js +18 -0
  269. package/dist/install/clients/index.js.map +1 -0
  270. package/dist/install/clients/windsurf.d.ts +3 -0
  271. package/dist/install/clients/windsurf.d.ts.map +1 -0
  272. package/dist/install/clients/windsurf.js +32 -0
  273. package/dist/install/clients/windsurf.js.map +1 -0
  274. package/dist/install/command.d.ts +14 -0
  275. package/dist/install/command.d.ts.map +1 -0
  276. package/dist/install/command.js +34 -0
  277. package/dist/install/command.js.map +1 -0
  278. package/dist/install/directive.d.ts +7 -0
  279. package/dist/install/directive.d.ts.map +1 -0
  280. package/dist/install/directive.js +31 -0
  281. package/dist/install/directive.js.map +1 -0
  282. package/dist/install/index.d.ts +26 -0
  283. package/dist/install/index.d.ts.map +1 -0
  284. package/dist/install/index.js +117 -0
  285. package/dist/install/index.js.map +1 -0
  286. package/dist/install/json-config.d.ts +11 -0
  287. package/dist/install/json-config.d.ts.map +1 -0
  288. package/dist/install/json-config.js +39 -0
  289. package/dist/install/json-config.js.map +1 -0
  290. package/dist/install/marked-block.d.ts +11 -0
  291. package/dist/install/marked-block.d.ts.map +1 -0
  292. package/dist/install/marked-block.js +34 -0
  293. package/dist/install/marked-block.js.map +1 -0
  294. package/dist/install/skill.d.ts +4 -0
  295. package/dist/install/skill.d.ts.map +1 -0
  296. package/dist/install/skill.js +61 -0
  297. package/dist/install/skill.js.map +1 -0
  298. package/dist/install/toml-config.d.ts +4 -0
  299. package/dist/install/toml-config.d.ts.map +1 -0
  300. package/dist/install/toml-config.js +51 -0
  301. package/dist/install/toml-config.js.map +1 -0
  302. package/dist/install/types.d.ts +37 -0
  303. package/dist/install/types.d.ts.map +1 -0
  304. package/dist/install/types.js +4 -0
  305. package/dist/install/types.js.map +1 -0
  306. package/dist/install/yaml-config.d.ts +4 -0
  307. package/dist/install/yaml-config.d.ts.map +1 -0
  308. package/dist/install/yaml-config.js +18 -0
  309. package/dist/install/yaml-config.js.map +1 -0
  310. package/dist/processors/privacy.d.ts +4 -1
  311. package/dist/processors/privacy.d.ts.map +1 -1
  312. package/dist/processors/privacy.js +5 -3
  313. package/dist/processors/privacy.js.map +1 -1
  314. package/dist/profile/accumulate.d.ts +28 -0
  315. package/dist/profile/accumulate.d.ts.map +1 -0
  316. package/dist/profile/accumulate.js +48 -0
  317. package/dist/profile/accumulate.js.map +1 -0
  318. package/dist/profile/behavior.d.ts +32 -0
  319. package/dist/profile/behavior.d.ts.map +1 -0
  320. package/dist/profile/behavior.js +122 -0
  321. package/dist/profile/behavior.js.map +1 -0
  322. package/dist/profile/four-color.d.ts +12 -0
  323. package/dist/profile/four-color.d.ts.map +1 -0
  324. package/dist/profile/four-color.js +39 -0
  325. package/dist/profile/four-color.js.map +1 -0
  326. package/dist/profile/profile-synth.d.ts +27 -0
  327. package/dist/profile/profile-synth.d.ts.map +1 -0
  328. package/dist/profile/profile-synth.js +174 -0
  329. package/dist/profile/profile-synth.js.map +1 -0
  330. package/dist/profile/types.d.ts +84 -0
  331. package/dist/profile/types.d.ts.map +1 -0
  332. package/dist/profile/types.js +11 -0
  333. package/dist/profile/types.js.map +1 -0
  334. package/dist/server/api.d.ts +8 -2
  335. package/dist/server/api.d.ts.map +1 -1
  336. package/dist/server/api.js +69 -34
  337. package/dist/server/api.js.map +1 -1
  338. package/dist/server/backfill-routes.d.ts.map +1 -1
  339. package/dist/server/backfill-routes.js +14 -1
  340. package/dist/server/backfill-routes.js.map +1 -1
  341. package/dist/server/chat-name-refresh-job.d.ts +33 -0
  342. package/dist/server/chat-name-refresh-job.d.ts.map +1 -0
  343. package/dist/server/chat-name-refresh-job.js +120 -0
  344. package/dist/server/chat-name-refresh-job.js.map +1 -0
  345. package/dist/server/chat-name-routes.d.ts +13 -0
  346. package/dist/server/chat-name-routes.d.ts.map +1 -0
  347. package/dist/server/chat-name-routes.js +81 -0
  348. package/dist/server/chat-name-routes.js.map +1 -0
  349. package/dist/server/config-routes.d.ts +2 -0
  350. package/dist/server/config-routes.d.ts.map +1 -1
  351. package/dist/server/config-routes.js +2 -1
  352. package/dist/server/config-routes.js.map +1 -1
  353. package/dist/server/mcp-http.d.ts +26 -0
  354. package/dist/server/mcp-http.d.ts.map +1 -0
  355. package/dist/server/mcp-http.js +102 -0
  356. package/dist/server/mcp-http.js.map +1 -0
  357. package/dist/server/mcp.d.ts +191 -25
  358. package/dist/server/mcp.d.ts.map +1 -1
  359. package/dist/server/mcp.js +1111 -68
  360. package/dist/server/mcp.js.map +1 -1
  361. package/dist/server/open-browser.d.ts +3 -0
  362. package/dist/server/open-browser.d.ts.map +1 -0
  363. package/dist/server/open-browser.js +12 -0
  364. package/dist/server/open-browser.js.map +1 -0
  365. package/dist/server/runtime.d.ts +13 -0
  366. package/dist/server/runtime.d.ts.map +1 -0
  367. package/dist/server/runtime.js +27 -0
  368. package/dist/server/runtime.js.map +1 -0
  369. package/dist/server/setup-server.d.ts.map +1 -1
  370. package/dist/server/setup-server.js +8 -11
  371. package/dist/server/setup-server.js.map +1 -1
  372. package/dist/setup/connection-tests.d.ts +1 -1
  373. package/dist/setup/connection-tests.d.ts.map +1 -1
  374. package/dist/setup/connection-tests.js +4 -2
  375. package/dist/setup/connection-tests.js.map +1 -1
  376. package/dist/setup/generate-config.d.ts.map +1 -1
  377. package/dist/setup/generate-config.js +31 -1
  378. package/dist/setup/generate-config.js.map +1 -1
  379. package/dist/setup/init-wizard.d.ts +1 -0
  380. package/dist/setup/init-wizard.d.ts.map +1 -1
  381. package/dist/setup/init-wizard.js +38 -21
  382. package/dist/setup/init-wizard.js.map +1 -1
  383. package/dist/setup/validate-config.d.ts +5 -1
  384. package/dist/setup/validate-config.d.ts.map +1 -1
  385. package/dist/setup/validate-config.js +18 -0
  386. package/dist/setup/validate-config.js.map +1 -1
  387. package/dist/store/data-dir-lock.d.ts +15 -0
  388. package/dist/store/data-dir-lock.d.ts.map +1 -0
  389. package/dist/store/data-dir-lock.js +96 -0
  390. package/dist/store/data-dir-lock.js.map +1 -0
  391. package/dist/store/database.d.ts +2 -0
  392. package/dist/store/database.d.ts.map +1 -1
  393. package/dist/store/database.js +23 -10
  394. package/dist/store/database.js.map +1 -1
  395. package/dist/store/graph.d.ts +22 -0
  396. package/dist/store/graph.d.ts.map +1 -1
  397. package/dist/store/graph.js +97 -7
  398. package/dist/store/graph.js.map +1 -1
  399. package/dist/store/migrations/index.d.ts.map +1 -1
  400. package/dist/store/migrations/index.js +52 -0
  401. package/dist/store/migrations/index.js.map +1 -1
  402. package/dist/store/pages.d.ts +7 -0
  403. package/dist/store/pages.d.ts.map +1 -1
  404. package/dist/store/pages.js +56 -1
  405. package/dist/store/pages.js.map +1 -1
  406. package/dist/store/person-behavior.d.ts +28 -0
  407. package/dist/store/person-behavior.d.ts.map +1 -0
  408. package/dist/store/person-behavior.js +127 -0
  409. package/dist/store/person-behavior.js.map +1 -0
  410. package/dist/store/pglite-assets.d.ts +15 -0
  411. package/dist/store/pglite-assets.d.ts.map +1 -0
  412. package/dist/store/pglite-assets.js +47 -0
  413. package/dist/store/pglite-assets.js.map +1 -0
  414. package/dist/store/query-rewrite.d.ts +28 -0
  415. package/dist/store/query-rewrite.d.ts.map +1 -0
  416. package/dist/store/query-rewrite.js +97 -0
  417. package/dist/store/query-rewrite.js.map +1 -0
  418. package/dist/store/schema.sql +107 -0
  419. package/dist/store/search.d.ts +36 -8
  420. package/dist/store/search.d.ts.map +1 -1
  421. package/dist/store/search.js +188 -76
  422. package/dist/store/search.js.map +1 -1
  423. package/dist/store/tags.d.ts.map +1 -1
  424. package/dist/store/tags.js +6 -2
  425. package/dist/store/tags.js.map +1 -1
  426. package/dist/store/timeline.d.ts +13 -1
  427. package/dist/store/timeline.d.ts.map +1 -1
  428. package/dist/store/timeline.js +134 -4
  429. package/dist/store/timeline.js.map +1 -1
  430. package/dist/store/trgm-search.d.ts +13 -0
  431. package/dist/store/trgm-search.d.ts.map +1 -0
  432. package/dist/store/trgm-search.js +53 -0
  433. package/dist/store/trgm-search.js.map +1 -0
  434. package/dist/store/wikilink.d.ts +17 -0
  435. package/dist/store/wikilink.d.ts.map +1 -0
  436. package/dist/store/wikilink.js +58 -0
  437. package/dist/store/wikilink.js.map +1 -0
  438. package/dist/sync/obsidian.d.ts.map +1 -1
  439. package/dist/sync/obsidian.js +5 -1
  440. package/dist/sync/obsidian.js.map +1 -1
  441. package/dist/synth/cache.d.ts +17 -0
  442. package/dist/synth/cache.d.ts.map +1 -0
  443. package/dist/synth/cache.js +67 -0
  444. package/dist/synth/cache.js.map +1 -0
  445. package/dist/synth/citations.d.ts +12 -0
  446. package/dist/synth/citations.d.ts.map +1 -0
  447. package/dist/synth/citations.js +28 -0
  448. package/dist/synth/citations.js.map +1 -0
  449. package/dist/synth/context.d.ts +10 -0
  450. package/dist/synth/context.d.ts.map +1 -0
  451. package/dist/synth/context.js +67 -0
  452. package/dist/synth/context.js.map +1 -0
  453. package/dist/synth/engine.d.ts +16 -0
  454. package/dist/synth/engine.d.ts.map +1 -0
  455. package/dist/synth/engine.js +111 -0
  456. package/dist/synth/engine.js.map +1 -0
  457. package/dist/synth/gaps.d.ts +17 -0
  458. package/dist/synth/gaps.d.ts.map +1 -0
  459. package/dist/synth/gaps.js +57 -0
  460. package/dist/synth/gaps.js.map +1 -0
  461. package/dist/synth/index.d.ts +6 -0
  462. package/dist/synth/index.d.ts.map +1 -0
  463. package/dist/synth/index.js +6 -0
  464. package/dist/synth/index.js.map +1 -0
  465. package/dist/synth/intent.d.ts +6 -0
  466. package/dist/synth/intent.d.ts.map +1 -0
  467. package/dist/synth/intent.js +13 -0
  468. package/dist/synth/intent.js.map +1 -0
  469. package/dist/synth/intents/daily-report.d.ts +7 -0
  470. package/dist/synth/intents/daily-report.d.ts.map +1 -0
  471. package/dist/synth/intents/daily-report.js +37 -0
  472. package/dist/synth/intents/daily-report.js.map +1 -0
  473. package/dist/synth/intents/index.d.ts +2 -0
  474. package/dist/synth/intents/index.d.ts.map +1 -0
  475. package/dist/synth/intents/index.js +12 -0
  476. package/dist/synth/intents/index.js.map +1 -0
  477. package/dist/synth/intents/person-strategy.d.ts +40 -0
  478. package/dist/synth/intents/person-strategy.d.ts.map +1 -0
  479. package/dist/synth/intents/person-strategy.js +66 -0
  480. package/dist/synth/intents/person-strategy.js.map +1 -0
  481. package/dist/synth/intents/recall.d.ts +8 -0
  482. package/dist/synth/intents/recall.d.ts.map +1 -0
  483. package/dist/synth/intents/recall.js +26 -0
  484. package/dist/synth/intents/recall.js.map +1 -0
  485. package/dist/synth/intents/troubleshoot.d.ts +11 -0
  486. package/dist/synth/intents/troubleshoot.d.ts.map +1 -0
  487. package/dist/synth/intents/troubleshoot.js +66 -0
  488. package/dist/synth/intents/troubleshoot.js.map +1 -0
  489. package/dist/synth/scope.d.ts +13 -0
  490. package/dist/synth/scope.d.ts.map +1 -0
  491. package/dist/synth/scope.js +139 -0
  492. package/dist/synth/scope.js.map +1 -0
  493. package/dist/synth/types.d.ts +117 -0
  494. package/dist/synth/types.d.ts.map +1 -0
  495. package/dist/synth/types.js +2 -0
  496. package/dist/synth/types.js.map +1 -0
  497. package/package.json +18 -6
package/README.en.md CHANGED
@@ -1,6 +1,7 @@
1
1
  <p align="center">
2
2
  <h1 align="center">Memoark</h1>
3
- <p align="center"><strong>Turn your Feishu work and AI-agent sessions into one private memory your agents can actually use. Local-first, you own it.</strong></p>
3
+ <p align="center"><em>You are the sum of your working relationships.</em></p>
4
+ <p align="center"><strong>A local-first memory system for your work — turning your DMs, group chats, emails, docs, and meetings into a private personal memory, so your AI agents truly know you.</strong></p>
4
5
  </p>
5
6
 
6
7
  <p align="center">
@@ -9,9 +10,10 @@
9
10
 
10
11
  <p align="center">
11
12
  <a href="LICENSE"><img alt="License: Apache 2.0" src="https://img.shields.io/badge/License-Apache_2.0-blue.svg"></a>
13
+ <a href="https://www.npmjs.com/package/@andre.li/memoark"><img alt="npm" src="https://img.shields.io/npm/v/@andre.li/memoark?color=cb3837&logo=npm"></a>
12
14
  <img alt="Runtime: Bun" src="https://img.shields.io/badge/runtime-Bun-black">
13
15
  <img alt="Language: TypeScript" src="https://img.shields.io/badge/lang-TypeScript-3178c6">
14
- <img alt="Tests: 800+" src="https://img.shields.io/badge/tests-800%2B-success">
16
+ <img alt="Tests: 1000+" src="https://img.shields.io/badge/tests-1000%2B-success">
15
17
  </p>
16
18
 
17
19
  <p align="center">
@@ -24,11 +26,16 @@
24
26
  </p>
25
27
 
26
28
  <p align="center">
27
- <img src="docs/assets/web-ui-graph.jpeg" alt="Memoark knowledge graph — entities, decisions, tasks, and knowledge connected across your work" width="850">
29
+ <img src="https://raw.githubusercontent.com/AndreLYL/memoark/main/docs/assets/web-ui-graph.jpeg" alt="Memoark knowledge graph — entities, decisions, tasks, and knowledge connected across your work" width="850">
28
30
  <br>
29
31
  <em>Your work, as a living knowledge graph — people, decisions, tasks, and knowledge, connected.</em>
30
32
  </p>
31
33
 
34
+ <!-- TODO(demo): replace with an 8-12s demo GIF — ask Memoark a question inside Claude Code
35
+ and watch the agent recall a Feishu meeting decision + linked task over MCP.
36
+ Research shows a GIF of "the product actually working" is the single highest-converting
37
+ element in a README. -->
38
+
32
39
  ---
33
40
 
34
41
  ## The Problem
@@ -44,7 +51,9 @@ But every time you open a new agent session, it knows nothing. You re-explain wh
44
51
 
45
52
  ## The Solution
46
53
 
47
- Memoark is a **local-first personal memory system** built on two equal input streams your **Feishu work** and your **AI-agent sessions**. It extracts structured signals (entities, decisions, tasks, discoveries, knowledge, relationships) into one searchable knowledge graph on your own machine, then serves that memory back to any agent over **MCP**.
54
+ Memoark is a **local-first personal memory system built for the Chinese workplace**. Work in China happens inside Feishu, DingTalk, and WeCom — Memoark pulls the DMs, group chats, emails, meetings, and docs out of these tools, together with your AI-agent sessions, and extracts them into structured signals (entities, decisions, tasks, discoveries, knowledge, relationships) into one searchable knowledge graph on your own machine, then serves that memory back to any agent over **MCP**.
55
+
56
+ > The MVP focuses on full **Feishu** capture; **DingTalk, WeCom**, and more Chinese workplace tools are on the roadmap (below).
48
57
 
49
58
  The result: your agents both **write to** and **read from** the same memory — so Claude Code, Codex, and any MCP client finally *know you and your work*.
50
59
 
@@ -69,22 +78,39 @@ The result: your agents both **write to** and **read from** the same memory —
69
78
  >
70
79
  > Memoark connects these three events automatically — across platforms, across time — and hands the whole thread to your agent on demand.
71
80
 
81
+ ## Three Pillars
82
+
83
+ **🔒 Local-first, truly private**
84
+ Your data never leaves your machine. PGLite embedded database stores everything, optional local embeddings via Ollama, zero cloud dependency. Dual-track privacy redaction (reversible / irreversible) scrubs sensitive data before it's written.
85
+
86
+ **🕸️ An entity knowledge graph, not a pile of vector chunks**
87
+ Signals are anchored to entities (people, projects, tools) and linked in a directed graph. You get answers *with context* — who, why, and what it relates to — instead of isolated similar-text fragments.
88
+
89
+ **🤖 MCP-native + Feishu capture**
90
+ **29 built-in MCP tools** let any agent both query and write back to your memory. Full Feishu capture (7 sources) turns your real work — requirements, proposals, team decisions — into a first-class data source, something neither pure RAG nor note apps can do.
91
+
72
92
  ## Features
73
93
 
74
94
  **🛰️ Full Feishu (Lark) Capture**
75
- Your work lives in Feishu. Memoark collects across **7 sources** — DMs, group chats, email, calendar, docs, tasks, and message search — turning your working relationships into structured memory.
95
+ Your work lives in Feishu. Memoark collects across **7 sources** — DMs, group chats, email, calendar, docs, tasks, and message search — turning your working relationships into structured memory. Doc capture produces upgradable "summary cards" (DocSource v2).
76
96
 
77
97
  **🤖 Agents That Know You (MCP)**
78
- Use Memoark as the memory layer for any MCP agent — Claude Code, Cursor, Windsurf. **17 built-in tools** let your agent query your history, read entity pages, and write new knowledge back. Agents are both producers and consumers of your memory.
79
-
80
- **🔒 Private & Local-First**
81
- Your data never leaves your machine. PGLite embedded database, optional local embeddings via Ollama, no cloud dependency. You own your memory.
98
+ Use Memoark as the memory layer for any MCP agent — Claude Code, Cursor, Claude Desktop, Windsurf. **29 built-in tools** let your agent query your history, read entity pages, and write new knowledge back. Agents are both producers and consumers of your memory.
82
99
 
83
100
  **🧠 AI-Powered Signal Extraction**
84
101
  An LLM pipeline extracts 7 types of structured signals from raw conversations: entities, timeline events, decisions, tasks, discoveries, knowledge, and relationships.
85
102
 
86
103
  **🔍 Hybrid Semantic Search**
87
- Full-text search + vector retrieval fused with Reciprocal Rank Fusion (RRF). Ask in natural language — powered by PGLite FTS + pgvector.
104
+ Full-text search (tsvector, multilingual) + vector retrieval fused with Reciprocal Rank Fusion (RRF). Ask in natural language — powered by PGLite FTS + pgvector.
105
+
106
+ **♻️ Memory Consolidation (Dream Cycle)**
107
+ A background consolidator automatically runs tier rotation (hot → warm → cold), repairs dead links, and infers preferences — so your memory organizes itself over time.
108
+
109
+ **⏰ Resident Daemon + Scheduled Capture**
110
+ A built-in daemon collects from your sources on a schedule, with run history and alerts, keeping your memory continuously fresh.
111
+
112
+ **🔗 Obsidian Bidirectional Sync**
113
+ Export your memory pages to an Obsidian vault (Markdown), edit them, and import them back.
88
114
 
89
115
  **🕸️ Knowledge Graph + Web UI**
90
116
  See the connections between people, projects, and decisions. Browse a built-in web UI with dashboard, timeline, force-directed graph, and search.
@@ -92,16 +118,112 @@ See the connections between people, projects, and decisions. Browse a built-in w
92
118
  **🔌 REST API**
93
119
  Full Hono-powered HTTP API for all store operations. Integrate with any client.
94
120
 
121
+ ## Works With
122
+
123
+ Memoark is a standard MCP stdio server and plugs into any MCP client:
124
+
125
+ **Claude Code** · **Cursor** · **Claude Desktop** · **Windsurf** · and any MCP-compatible agent.
126
+
127
+ ## Feature Inventory
128
+
129
+ The full capability list (✅ = shipped and included in the package).
130
+
131
+ ### 📥 Data Collection
132
+ - ✅ Feishu group chats (OpenAPI chat/message)
133
+ - ✅ Feishu DMs / recent chats (lark-cli `message_search`, user mode)
134
+ - ✅ Feishu email
135
+ - ✅ Feishu calendar events
136
+ - ✅ Feishu tasks
137
+ - ✅ Feishu doc summary cards (DocSource v2: pointer card → upgraded full card on trigger)
138
+ - ✅ Claude Code sessions (`~/.claude/projects/`)
139
+ - ✅ Codex CLI sessions (`~/.codex/`)
140
+ - ✅ OpenClaw Hermes multi-agent sessions (`~/.openclaw/agents/`, auto sub-agent discovery)
141
+ - ✅ Incremental collection: per-source cursor + content-hash dedup
142
+ - ✅ Historical backfill: coverage stats, start / cancel / reset
143
+
144
+ ### 🧠 Signal Extraction Pipeline
145
+ - ✅ Collect → Dedup → Block Builder → Noise Filter → Signal Extractor → Privacy
146
+ - ✅ Two-layer noise filtering: L1 rules + L2 LLM scoring
147
+ - ✅ 7 structured signal types: entities, timeline, decisions, tasks, discoveries, knowledge, relationships
148
+ - ✅ LLM providers: OpenAI / Anthropic (plus a mock for testing)
149
+ - ✅ Signal scoring and entity extraction
150
+ - ✅ JSON / Markdown output formats
151
+ - ✅ Output adapters: store (PGLite) / file / gbrain / stdout
152
+ - ✅ Provenance: every signal traces back to its source message
153
+
154
+ ### 🔒 Privacy & Security
155
+ - ✅ Redaction before write; data stays fully local
156
+ - ✅ Dual-track modes: reversible / irreversible
157
+ - ✅ Built-in redaction: phone, ID card, bank card, with custom replacement token
158
+ - ✅ API keys always masked in the config center
159
+
160
+ ### 🗄️ Storage & Retrieval
161
+ - ✅ PGLite embedded PostgreSQL (in-process, zero external deps)
162
+ - ✅ pgvector vector search
163
+ - ✅ tsvector full-text search (simple tokenizer, multilingual)
164
+ - ✅ RRF hybrid search (FTS + vector fusion) with compiled_truth / backlink boosts
165
+ - ✅ Recursive chunking (300 words / 50-word overlap), embedding reuse + stale detection
166
+ - ✅ Embeddings: OpenAI / Ollama (local)
167
+
168
+ ### 🕸️ Knowledge Graph
169
+ - ✅ Directed link graph with link types and context
170
+ - ✅ BFS traversal (controllable depth / direction)
171
+ - ✅ Backlinks
172
+ - ✅ Entity anchoring: signals attach to people / projects / tools
173
+ - ✅ Entity profile aggregation (signals + timeline)
174
+
175
+ ### 👤 Person Identity
176
+ - ✅ Identity resolution and canonicalization
177
+ - ✅ Alias / handle linking (Feishu open_id, email, name, nickname, slug)
178
+ - ✅ Strong / weak link strength
179
+ - ✅ Person merge (re-points links / timeline / tags / aliases)
180
+ - ✅ Recanonicalize slug (fix a wrong canonicalization)
181
+
182
+ ### ♻️ Memory Lifecycle & Daemon
183
+ - ✅ Memory consolidation (dream cycle): hot → warm → cold tier rotation
184
+ - ✅ Dead-link repair
185
+ - ✅ Preference inference (learns preferences from history)
186
+ - ✅ Resident daemon: scheduled per-source capture, scheduling, run history, alerts
187
+
188
+ ### 🔗 Sync & Interop
189
+ - ✅ Obsidian bidirectional sync (export vault / import back)
190
+ - ✅ MCP stdio server (29 tools)
191
+ - ✅ REST API (Hono — pages / search / graph / tags / timeline / embed / extract / provenance / event stream)
192
+
193
+ ### 🖥️ Web UI (React + Vite)
194
+ - ✅ Dashboard overview
195
+ - ✅ Timeline view (feed)
196
+ - ✅ Force-directed knowledge graph
197
+ - ✅ Search interface
198
+ - ✅ Entity / page detail
199
+ - ✅ In-browser config editing + guided setup wizard
200
+
201
+ ### ⚙️ Configuration & Onboarding
202
+ - ✅ Interactive config center (full-screen TUI, React + ink)
203
+ - ✅ Linear Q&A wizard fallback (`--no-tui`) / fully automatic (`--auto`)
204
+ - ✅ Auto-detection: runtime, API keys, existing data sources
205
+ - ✅ Hardware assessment → recommends local / remote embeddings
206
+ - ✅ Live connection checks (LLM / embedding API key and connectivity)
207
+ - ✅ `memoark doctor` environment diagnostics
208
+
95
209
  ## Use Cases
96
210
 
97
- **Onboard your agent to a project in seconds**
98
- Start a Claude Code session and ask *"what's the current state of the memoark project?"* — your agent pulls the aggregated decisions, open tasks, and recent timeline straight from your memory, no re-explaining.
211
+ > Memoark answers not "what do I know" but "**what should I do**" — every scenario returns a cited, traceable action, not a pile of chunks.
212
+
213
+ **🌟 Know how to talk to someone before you meet them (Hero)**
214
+ *"I'm meeting Director Zhang tomorrow to negotiate a renewal price increase — what should I keep in mind?"* — `prep_for_person` **passively infers** a communication profile from your real interactions (direct vs. indirect, data-driven vs. relationship-driven, landmines), tailors advice to this goal, and flags gaps (*"nothing new about Zhang in 18 days — the profile may be stale"*). Zero questionnaire; the profile never leaves your machine.
99
215
 
100
- **Recall a person or a thread**
101
- *"What did I discuss with my colleague last week?"* — Memoark stitches together the Feishu DMs, the meeting, and the follow-up task into one answer.
216
+ **📋 Generate a cross-channel daily report in one line**
217
+ *"Help me write today's daily report"* — `daily_report` aggregates today's signals scattered across DMs, group chats, email, Feishu Minutes notes, and calendar into 7 sections: decisions / in-progress / my tasks / awaiting-reply·@mentions / relationship updates / tomorrow's reminders. Action items in meeting notes that name you land in "my tasks" automatically.
102
218
 
103
- **Auto-written work log**
104
- Browse your timeline like a diary that writes itself what you decided, what you shipped, and across which platforms.
219
+ **🔧 Troubleshoot by the playbook**
220
+ *"Why won't the ADAS engage?"* `troubleshoot` walks the playbook's diagnostic chain (`precedes`) to give ordered steps and explain what each result means. Playbooks can be authored by hand or auto-extracted (as drafts) from your troubleshooting conversations.
221
+
222
+ **⚡ Onboard your agent to a project in seconds**
223
+ *"What's the current state of the memoark project?"* — `get_session_context` pulls the aggregated decisions, open tasks, and recent timeline straight from memory, no re-explaining.
224
+
225
+ **🔎 Recall a person or a thread**
226
+ *"What did I discuss with this colleague last week?"* — stitches Feishu DMs, the meeting, and the follow-up task into one cited answer.
105
227
 
106
228
  ## Why Memoark
107
229
 
@@ -114,9 +236,9 @@ Browse your timeline like a diary that writes itself — what you decided, what
114
236
  | Agent-native: read **and** write over MCP | ✅ | ❌ | ❌ | ✅ | partial |
115
237
  | Entity + relationship knowledge graph | ✅ | ❌ | manual | ✅ | partial |
116
238
  | Structured signal extraction (not just chunks) | ✅ | ❌ | ❌ | ✅ | ✅ |
117
- | Focused MCP surface (17 tools, not 40+) | ✅ | n/a | n/a | (40+) | varies |
239
+ | Memory consolidation + scheduled-capture daemon | ✅ | | | partial | partial |
118
240
 
119
- > Pure RAG gives you vectors but no entities or relationships, so answers lack context. Note apps are powerful but rely on manual upkeep. GBrain is capable but heavy, with a sprawling MCP surface. Memoark keeps it local, focused, and agent-native — with Feishu work as a first-class source.
241
+ > Pure RAG gives you vectors but no entities or relationships, so answers lack context. Note apps are powerful but rely on manual upkeep. Memoark keeps it local and agent-native — with Feishu work as a first-class source.
120
242
 
121
243
  ## Quick Start
122
244
 
@@ -125,6 +247,28 @@ Browse your timeline like a diary that writes itself — what you decided, what
125
247
  - [Node.js](https://nodejs.org) >= 18 (for the `npx` / `npm` install)
126
248
  - (Optional) [Ollama](https://ollama.ai) for local embeddings
127
249
 
250
+ ### One-step launch (recommended)
251
+
252
+ ```bash
253
+ # Run without installing — no config? it auto-launches the setup wizard,
254
+ # then starts the server and opens your browser
255
+ npx @andre.li/memoark start
256
+
257
+ # Running with no subcommand is equivalent to `start`
258
+ npx @andre.li/memoark
259
+ ```
260
+
261
+ `memoark start` is the single-step path: if there's no `memoark.yaml`, it opens the browser setup wizard first, then starts the HTTP server and auto-opens your browser.
262
+
263
+ > The npm package is `@andre.li/memoark` (scoped), but the command is still `memoark`.
264
+
265
+ ### Ports at a glance
266
+
267
+ | Service | Default port | Address |
268
+ |---------|--------------|---------|
269
+ | HTTP API + Web UI | `3927` | `http://localhost:3927` |
270
+ | MCP Streamable HTTP (`--mcp-http`) | `3928` | `http://localhost:3928/mcp` |
271
+
128
272
  ### Install (recommended: npm)
129
273
 
130
274
  ```bash
@@ -135,8 +279,6 @@ npx @andre.li/memoark --help
135
279
  npm install -g @andre.li/memoark
136
280
  ```
137
281
 
138
- > The npm package is `@andre.li/memoark` (scoped), but the command is still `memoark`.
139
-
140
282
  ### Install from source (development)
141
283
 
142
284
  ```bash
@@ -211,16 +353,58 @@ memoark search "JWT token" --mode fts
211
353
  ### Start the Server
212
354
 
213
355
  ```bash
214
- # HTTP API (default port 3927)
356
+ # HTTP API + Web UI (default http://localhost:3927) — auto-opens your browser
215
357
  memoark serve
216
358
 
217
- # MCP stdio (for AI agent integration — Claude Code, Cursor, etc.)
359
+ # Skip the auto-open (e.g. on a remote/headless host)
360
+ memoark serve --no-open
361
+
362
+ # MCP stdio (local direct connect for AI agents — Claude Code, Cursor, etc.; no browser)
218
363
  memoark serve --mcp
364
+
365
+ # MCP Streamable HTTP (remote / multi-client, default http://localhost:3928/mcp; no browser)
366
+ memoark serve --mcp-http
219
367
  ```
220
368
 
369
+ > Without a `memoark.yaml`, `serve` tells you to run `memoark start` for one-step setup + launch, or `memoark init --web` to configure first.
370
+
221
371
  ### Connect Your Agent (MCP)
222
372
 
223
- Point any MCP client at Memoark so it can read and write your memory. For Claude Code:
373
+ **One command (recommended)**: `memoark install` writes the MCP config plus a tiny memory directive into your AI client (**global by default**, across all projects). Supports **Claude Code · Claude Desktop · Cursor · Codex · Windsurf**:
374
+
375
+ ```bash
376
+ memoark install # detect installed clients and wire them up
377
+ memoark install --agent claude-code # target a single client
378
+ memoark install --dry-run # preview file changes, write nothing
379
+ memoark uninstall # clean removal (idempotent)
380
+ ```
381
+
382
+ Reopen the client and you're set — ask "what did X tell me last week?" or "where is this project at?" and the agent will **proactively query Memoark** per the injected directive (cheap-first: `search` keyword lookup at zero cost, escalating to `query`/`recall` only if thin) instead of guessing.
383
+
384
+ > Claude Desktop has no rules file, so it relies on the MCP server's `instructions` field. You can also configure things manually below.
385
+
386
+ **Automatic recall on Claude Code (optional · hooks)**: go further on Claude Code so memory arrives with zero effort:
387
+
388
+ ```bash
389
+ memoark hooks install # SessionStart + UserPromptSubmit read hooks (on by default)
390
+ memoark hooks install --write-back # also enable end-of-session auto write-back (opt-in)
391
+ memoark hooks uninstall # remove
392
+ ```
393
+
394
+ - **SessionStart**: injects an "active projects / decisions / open tasks / key people" digest at the start of each session (the always-on core).
395
+ - **UserPromptSubmit**: a **zero-cost FTS** probe before each prompt; injects only on a hit (≤3 items, ≤3000 chars, appended after the user message to preserve prompt cache).
396
+ - **SessionEnd** (`--write-back`, off by default): asynchronous incremental extraction back into memory, so it compounds.
397
+
398
+ > Read hooks default on (local, cheap); write-back is explicit `--write-back` (cost + privacy, opt-in). Other clients have no lifecycle hooks and rely on the instruction layer above for model-initiated recall.
399
+
400
+ **Let the agent install itself**: for agents that can read a URL, just say "onboard me to Memoark following [`MEMOARK_FOR_AGENTS.md`](MEMOARK_FOR_AGENTS.md)" and it runs the commands above and self-checks. For **OpenClaw / Hermes**, use `memoark install --agent hermes` (writes `mcp_servers` into `config.yaml` + drops the `memoark` skill; run `/reload-mcp` in-session to apply); or scaffold the skill alone with `memoark skill scaffold --dir ~/.hermes/skills`.
401
+
402
+ Memoark offers two MCP transports — pick by scenario:
403
+
404
+ - **stdio (`--mcp`)** — local direct connect; the agent spawns `memoark` as a subprocess. Zero network setup; best for a single client on one machine.
405
+ - **Streamable HTTP (`--mcp-http`)** — over HTTP (default `3928`); use it for remote access or sharing one memory across multiple clients.
406
+
407
+ Point any MCP client at Memoark so it can read and write your memory. For Claude Code (stdio, local direct connect):
224
408
 
225
409
  ```json
226
410
  {
@@ -245,39 +429,75 @@ bun run dev # dashboard, timeline, knowledge graph, search
245
429
 
246
430
  ## Architecture
247
431
 
432
+ Memoark is **5 vertical data-flow layers + 3 cross-cutting concerns**. Data flows top-down: sources are collected, extracted into signals, stored as local memory, then read/written through the bottom interfaces. **Person identity**, **consolidation**, and **scheduling** cut across the stack.
433
+
434
+ <p align="center">
435
+ <img src="https://raw.githubusercontent.com/AndreLYL/memoark/main/docs/assets/architecture.png" alt="Memoark architecture — 5 vertical layers + 3 cross-cutting concerns" width="920">
436
+ </p>
437
+
438
+ <details>
439
+ <summary>📐 View the editable Mermaid source</summary>
440
+
441
+ ```mermaid
442
+ flowchart TB
443
+ subgraph L1["① Config & Onboarding"]
444
+ cfg["TUI config center · Web UI config · memoark.yaml<br/>auto-detect · hardware assessment · connection checks"]
445
+ end
446
+ subgraph L2["② Collection"]
447
+ feishu["Feishu: DMs · groups · email · calendar · tasks · message search · docs"]
448
+ agent["AI-agent sessions: Claude Code · Codex · Hermes"]
449
+ inc["Incremental (cursor + dedup) · historical Backfill"]
450
+ planned1["Planned: DingTalk · WeCom · local documents"]:::planned
451
+ end
452
+ subgraph L3["③ Extraction Pipeline"]
453
+ pipe["Block Builder → Noise Filter (rules+LLM) → Signal Extractor (OpenAI/Anthropic)<br/>→ entity extraction → scoring → privacy redaction → 7 signal types"]
454
+ end
455
+ subgraph L4["④ Memory Store"]
456
+ store["PGLite + pgvector<br/>Page · Chunk · Tag · Timeline · Graph<br/>hybrid search (FTS + vector + RRF)"]
457
+ end
458
+ subgraph L5["⑤ Interfaces & Consumption"]
459
+ cli["CLI"]
460
+ mcp["MCP (29 tools)"]
461
+ rest["REST API"]
462
+ web["Web UI (read-only)"]
463
+ obs["Obsidian bidirectional sync"]
464
+ end
465
+
466
+ L1 --> L2 --> L3 --> L4 --> L5
467
+
468
+ subgraph X["Cross-cutting concerns"]
469
+ id["🧬 Person Identity<br/>merge same person across platforms"]
470
+ cons["♻️ Consolidation / Dream Cycle<br/>tier rotation · dead-link repair · preference inference"]
471
+ sched["⏰ Scheduling / AutoFetch<br/>scheduled capture · run history · alerts"]
472
+ end
473
+
474
+ id -.-> L2
475
+ id -.-> L4
476
+ cons -.-> L4
477
+ sched -.-> L2
478
+
479
+ classDef planned stroke-dasharray: 5 5,fill:#f6f6f6,color:#888;
248
480
  ```
249
- ┌─────────────────────────────────────────────────────────────────┐
250
- │ Data Sources │
251
- │ Feishu (DMs · groups · email · calendar · docs · tasks) │
252
- │ AI Agents (Claude Code · Codex · Hermes) │
253
- └───────────────────────────────┬─────────────────────────────────┘
254
-
255
- ┌─────────▼──────────┐
256
- │ Signal Extraction
257
- │ Pipeline │
258
- │ │
259
- │ Collector │
260
- │ → Dedup │
261
- │ → Block Builder │
262
- │ → Noise Filter │
263
- │ → Signal Extractor │
264
- │ → Privacy │
265
- └─────────┬──────────┘
266
-
267
- ┌─────────▼──────────┐
268
- │ Storage Layer │
269
- │ PGLite + pgvector │
270
- │ (Embedded PG) │
271
- └─────────┬──────────┘
272
-
273
- ┌───────────────────┼───────────────────┐
274
- │ │ │ │
275
- ┌────────▼─────┐ ┌───▼────┐ ┌────────▼───┐ ┌─────▼──────┐
276
- │ CLI │ │ MCP │ │ REST API │ │ Web UI │
277
- │ Management │ │ Server │ │ (Hono) │ │ (React) │
278
- │ & Extraction │ │(stdio) │ │ │ │ │
279
- └───────────────┘ └────────┘ └────────────┘ └────────────┘
280
- ```
481
+
482
+ </details>
483
+
484
+ ### Layer Breakdown
485
+
486
+ | Layer | Responsibility |
487
+ |-------|----------------|
488
+ | **① Config & Onboarding** | TUI config center (React + ink), Web UI config, hand-edited `memoark.yaml`; auto-detect runtime / API keys / sources, hardware-aware embedding recommendation, live connection checks |
489
+ | **② Collection** | Feishu (DMs / groups / email / calendar / tasks / message search / docs), AI-agent sessions (Claude Code / Codex / Hermes); incremental capture (per-source cursor + content dedup), historical Backfill. **Planned**: DingTalk, WeCom, local documents |
490
+ | **③ Extraction Pipeline** | Block Builder → Noise Filter (L1 rules + L2 LLM) → Signal Extractor (OpenAI / Anthropic) → entity extraction → scoring → privacy redaction; emits 7 signal types via output adapters (store / file / gbrain / stdout) |
491
+ | **④ Memory Store** | PGLite (in-process embedded PostgreSQL) + pgvector; Page / Chunk / Tag / Timeline / Graph stores; hybrid search (tsvector FTS + vector + RRF) |
492
+ | **⑤ Interfaces & Consumption** | CLI, MCP Server (29 tools — agent read / write / maintain), REST API (Hono), Web UI (search / view / graph / timeline, **read-only today**), Obsidian bidirectional sync |
493
+
494
+ **Cross-cutting concerns (span layers, not standalone pipeline stages):**
495
+
496
+ - **🧬 Person Identity** — spans Collection ↔ Store: recognize and merge the same person across platforms (Feishu open_id, email, nickname), alias linking, canonicalization. The foundation of "the sum of your social relations".
497
+ - **♻️ Consolidation (Dream Cycle)** — background pass over the store: hot → warm → cold rotation, dead-link repair, preference inference.
498
+ - **⏰ Scheduling / AutoFetch** — background driver of Collection: scheduled capture, run history, alerts. *(Runs inside `serve` today; standalone daemon + autostart is on the roadmap.)*
499
+
500
+ > Runs on macOS / Linux / Windows · one-command install (npm / npx) · local-first, self-hosted, zero cloud dependency.
281
501
 
282
502
  ### Signal Extraction Pipeline
283
503
 
@@ -314,8 +534,42 @@ bun run dev # dashboard, timeline, knowledge graph, search
314
534
  | **TimelineStore** | Chronological entries per page with dedup |
315
535
  | **EmbeddingService** | Batch embedding via OpenAI or Ollama, stale-chunk detection |
316
536
 
537
+ ## MCP Tools
538
+
539
+ Memoark's MCP server exposes **29 tools** spanning retrieval, synthesis, page CRUD, graph, tags, timeline, identity, and Feishu doc ingestion. Prefer the high-level tools first:
540
+
541
+ | Category | Tools |
542
+ |----------|-------|
543
+ | **Retrieval (high-level)** | `query`, `get_session_context`, `get_entity_profile`, `list_signals_by_entity` |
544
+ | **Synthesis** | `synthesize`, `recall` (cited, gap-aware composed answers with inline `[n]`), `prep_for_person` (person communication profile → goal-conditioned strategy; passively inferred, no questionnaire, local-first, ethics-guardrailed), `daily_report` (cross-channel 7-section daily report), `troubleshoot` (one-shot diagnosis along a playbook chain) |
545
+ | **Search** | `search` |
546
+ | **Pages / content** | `get_page`, `put_page`, `list_pages`, `get_chunks` |
547
+ | **Graph** | `add_link`, `remove_link`, `get_links`, `get_backlinks`, `traverse_graph` |
548
+ | **Tags** | `add_tag`, `remove_tag`, `get_tags` |
549
+ | **Timeline** | `add_timeline_entry`, `get_timeline` |
550
+ | **Identity (people)** | `link_person_alias`, `list_person_handles`, `remove_person_alias`, `merge_persons`, `recanonicalize_person` |
551
+ | **Feishu docs** | `ingest_feishu_doc` |
552
+ | **Health** | `get_health` |
553
+
317
554
  ## CLI Reference
318
555
 
556
+ | Command | Description |
557
+ |---------|-------------|
558
+ | `memoark start` | One-step launch: setup if needed, then serve + auto-open browser (bare `memoark` is equivalent) |
559
+ | `memoark init` | Interactive config center to generate / edit `memoark.yaml` (`--auto` / `--no-tui` / `--force` / `--web`) |
560
+ | `memoark extract` | Extract signals from a data source |
561
+ | `memoark search <query>` | Search memory (hybrid / `--mode fts`) |
562
+ | `memoark embed` | Generate embeddings for stale chunks |
563
+ | `memoark serve` | Start HTTP API (auto-opens browser, `--no-open` to skip) / `--mcp` stdio / `--mcp-http` |
564
+ | `memoark consolidate` | Run memory consolidation (tier rotation hot→warm / warm→cold) |
565
+ | `memoark export` | Export memory pages to an Obsidian vault (Markdown) |
566
+ | `memoark import` | Import an Obsidian vault back into Memoark |
567
+ | `memoark docs` | Feishu doc summary cards: `sync` / `status` / `retry` |
568
+ | `memoark identity` | Person identity: aliases, merge, rename |
569
+ | `memoark sources` | `list` sources / `test <name>` connectivity |
570
+ | `memoark doctor` | Diagnose configuration and connectivity |
571
+ | `memoark config` | `init` (alias of `memoark init`) / `edit` (browser UI) |
572
+
319
573
  ### `memoark extract`
320
574
 
321
575
  Extract signals from data sources.
@@ -331,16 +585,31 @@ memoark extract \
331
585
  --dry-run # Test without LLM calls or writes
332
586
  ```
333
587
 
588
+ ### `memoark start`
589
+
590
+ One-step launch. If no `memoark.yaml` exists, it opens the browser setup wizard first; once configured, it starts the HTTP server and auto-opens your browser. Running `memoark` with no subcommand does the same thing.
591
+
592
+ ```bash
593
+ memoark start
594
+ memoark # equivalent
595
+ ```
596
+
334
597
  ### `memoark serve`
335
598
 
336
599
  Start the Memoark server.
337
600
 
338
601
  ```bash
339
- # HTTP API (default port from config)
602
+ # HTTP API + Web UI (default http://localhost:3927) auto-opens the browser
340
603
  memoark serve
341
604
 
342
- # MCP stdio transport (for AI agent integration)
605
+ # Skip the auto-open
606
+ memoark serve --no-open
607
+
608
+ # MCP stdio transport (local direct connect for AI agents)
343
609
  memoark serve --mcp
610
+
611
+ # MCP Streamable HTTP transport (remote / multi-client, default http://localhost:3928/mcp)
612
+ memoark serve --mcp-http
344
613
  ```
345
614
 
346
615
  ### `memoark search <query>`
@@ -402,6 +671,36 @@ Test data source connectivity.
402
671
  memoark sources test claude-code
403
672
  ```
404
673
 
674
+ ### `memoark consolidate`
675
+
676
+ Run memory lifecycle tier rotation (the "dream cycle").
677
+
678
+ ```bash
679
+ memoark consolidate # hot→warm and/or warm→cold rotation
680
+ ```
681
+
682
+ ### `memoark export` / `memoark import`
683
+
684
+ Bidirectional Obsidian sync.
685
+
686
+ ```bash
687
+ memoark export # memory pages → Obsidian vault (Markdown)
688
+ memoark import # Obsidian vault → Memoark
689
+ ```
690
+
691
+ ### `memoark docs`
692
+
693
+ Feishu doc summary cards (DocSource v2) — build lightweight pointer cards first, then upgrade triggered docs to full summary cards.
694
+
695
+ ```bash
696
+ memoark docs sync # scan docs, build pointer cards, upgrade triggered docs
697
+ memoark docs status # show card counts by type
698
+ memoark docs retry <doc_token> # retry a failed full-card extraction
699
+ memoark docs retry --all-failed # retry every failed doc
700
+ ```
701
+
702
+ Agents can also ingest a single doc directly via the MCP tool `ingest_feishu_doc` (pass a doc URL or token).
703
+
405
704
  ## Configuration
406
705
 
407
706
  ### `memoark.yaml`
@@ -527,7 +826,7 @@ Extracts session data from OpenClaw Hermes agents.
527
826
  - [x] EmbeddingService (OpenAI / Ollama)
528
827
  - [x] StoreAdapter — pipeline writes directly to PGLite
529
828
  - [x] Hono REST API
530
- - [x] MCP Server with 17 stdio tools
829
+ - [x] MCP Server with 29 stdio tools
531
830
  - [x] CLI serve, search, embed commands
532
831
 
533
832
  ### Phase 3 — Web UI (Complete)
@@ -538,23 +837,42 @@ Extracts session data from OpenClaw Hermes agents.
538
837
  - [x] Search interface
539
838
  - [x] Entity / page detail views
540
839
 
541
- ### Phase 4 — Context-Aware Extraction (Planned)
840
+ ### Phase 4 — Consolidation & Daemon (Complete)
841
+
842
+ - [x] Memory consolidation ("dream cycle"): tier rotation, dead-link repair, preference inference
843
+ - [x] Resident daemon with scheduled extraction (scheduler, run history, alerts)
844
+ - [x] Person identity management (aliases, merge, rename)
845
+ - [x] Feishu doc summary cards (DocSource v2)
846
+ - [x] Obsidian bidirectional sync (export / import)
847
+
848
+ ### Phase 5 — Self-Hosted Always-On (In Progress · MVP)
542
849
 
850
+ - [ ] Standalone daemon service + autostart (systemd / launchd / Windows service) — "configure once, runs maintenance-free"
851
+ - [ ] Agent Hook: auto read/write memory on session end / key decisions
852
+
853
+ ### Phase 6 — More Chinese Workplace Sources (Planned)
854
+
855
+ - [ ] DingTalk
856
+ - [ ] WeCom (WeChat Work)
857
+ - [ ] WeChat chat history
858
+ - [ ] Local document source (scan local files, community-driven · low priority)
859
+
860
+ ### Phase 7 — Context-Aware Extraction & Q&A (In Progress)
861
+
862
+ - [x] Synthesis layer (basic): `synthesize` / `recall` — cited composed answers with inline `[n]` + gap analysis, intent-template framework, per-scope caching
863
+ - [x] **Person communication profile (Hero)**: `prep_for_person(person, goal?)` — passively infers a communication profile from real interactions (zero-LLM behavior layer + behavior-quadrant trait layer + relation layer + four-color shell) and gives goal-conditioned, `[n]`-cited communication strategy. No questionnaire, local-first, ethics-guardrailed (suggestions, not manipulation); disabled by default, per-person opt-in
864
+ - [x] **Cross-channel daily report**: `daily_report(date?)` — aggregates today's signals across DMs/group/email/Feishu Minutes/calendar into 7 sections; meeting notes yield `decisions` and owner-tagged `action_items` (yours land in "my tasks")
865
+ - [x] **Troubleshooting Playbooks**: `troubleshoot(query)` — ordered steps along the playbook `precedes` chain with per-result meaning; hierarchical tree (`part_of`) organizes problem domains; playbooks authored by hand or auto-extracted (draft) from conversations
866
+ - [x] **Retrieval quality**: best-chunk-per-page pooling (surface on strongest evidence), zero-LLM self-wiring (`[[slug]]`/`[[rel:slug]]` graph edges on write), rule-based query rewrite
543
867
  - [ ] ContextBuffer — share context across conversation blocks
544
868
  - [ ] Weighted admission scoring (replaces binary noise filter)
545
869
  - [ ] Narrative assembler — aggregate signals into per-entity narratives
546
-
547
- ### Phase 5 — Consolidation & Daemon (Planned)
548
-
549
- - [ ] Memory consolidation ("dream cycle"): entity merge, link repair, pattern discovery
550
- - [ ] Resident background service with scheduled extraction
551
870
  - [ ] Natural language Q&A over stored memories
552
871
 
553
- ### Phase 6Sync & New Sources (Planned)
872
+ ### Phase 8Web UI Enhancements (Planned)
554
873
 
555
- - [ ] Obsidian bidirectional sync
556
- - [ ] WeChat chat history
557
- - [ ] More platforms based on community demand
874
+ - [ ] Memory editing (read-only today)
875
+ - [ ] Audit view (signal provenance visualization)
558
876
 
559
877
  ## Tech Stack
560
878
 
@@ -569,7 +887,7 @@ Extracts session data from OpenClaw Hermes agents.
569
887
  | Web UI | React + Vite |
570
888
  | MCP | @modelcontextprotocol/sdk |
571
889
  | Linter | Biome |
572
- | Tests | Vitest (800+ tests) |
890
+ | Tests | Vitest (1000+ tests) |
573
891
 
574
892
  ## Development
575
893
 
@@ -600,6 +918,7 @@ Contributions welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) before sub
600
918
 
601
919
  - 🐛 Found a bug or have a feature request? [Open an issue](https://github.com/AndreLYL/memoark/issues).
602
920
  - 💡 Questions and ideas are welcome in the issue tracker.
921
+ - ⭐ If Memoark helps you, give it a Star — it's the best way to support the project.
603
922
 
604
923
  ## License
605
924