@memorax/memorax-code 0.1.2 → 0.1.4

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 (242) hide show
  1. package/README.md +16 -12
  2. package/bin/memorax-code-npm-preinstall.mjs +7 -2
  3. package/bin/memorax-code-opencode.mjs +4 -0
  4. package/bin/memorax-code-plugin-postinstall.mjs +342 -93
  5. package/docs/configuration.md +148 -35
  6. package/docs/troubleshooting.md +73 -13
  7. package/lib/dsh-plugin-install.mjs +22 -0
  8. package/lib/memorax-code-adapter-common/src/hooks/capture-cwd-hook.mjs +21 -14
  9. package/lib/memorax-code-adapter-common/src/hooks/ensure-backend-runner.mjs +26 -7
  10. package/lib/memorax-code-adapter-common/src/hooks/memory-skill-reminder-hook.mjs +86 -95
  11. package/lib/memorax-code-adapter-common/src/hooks/memory-skill-reminder-policy.mjs +58 -0
  12. package/lib/memorax-code-adapter-common/src/repo-memory/repo-memory-auto-build.mjs +2 -2
  13. package/lib/memorax-code-adapter-common/src/repo-memory/repo-memory-job-supervisor.mjs +1 -1
  14. package/lib/memorax-code-adapter-common/src/windows-cli-invocation.mjs +13 -1
  15. package/lib/memorax-code-backend/dist/app/backend-server.js +210 -0
  16. package/lib/memorax-code-backend/dist/{server-observability.js → app/memory-observability.js} +4 -4
  17. package/lib/memorax-code-backend/dist/{backend-state.js → app/state.js} +1 -1
  18. package/lib/memorax-code-backend/dist/{claude-adapter-lifecycle.js → clients/claude/lifecycle.js} +2 -2
  19. package/lib/memorax-code-backend/dist/{claude-memory-hook-runtime.js → clients/claude/memory-hook-runtime.js} +7 -7
  20. package/lib/memorax-code-backend/dist/clients/codex/lifecycle.js +131 -0
  21. package/lib/memorax-code-backend/dist/{codex-memory-hook-runtime.js → clients/codex/memory-hook-runtime.js} +9 -9
  22. package/lib/memorax-code-backend/dist/{codex-plugin-hooks.js → clients/codex/plugin-hooks.js} +1 -1
  23. package/lib/memorax-code-backend/dist/{codex-plugin-install.js → clients/codex/plugin-install.js} +6 -6
  24. package/lib/memorax-code-backend/dist/clients/dsh/lifecycle.js +75 -0
  25. package/lib/memorax-code-backend/dist/clients/dsh/memory-hook-runtime.js +258 -0
  26. package/lib/memorax-code-backend/dist/clients/dsh/session-turn.js +249 -0
  27. package/lib/memorax-code-backend/dist/clients/opencode/lifecycle.js +54 -0
  28. package/lib/memorax-code-backend/dist/clients/opencode/memory-hook-runtime.js +277 -0
  29. package/lib/memorax-code-backend/dist/clients/opencode/message-turn.js +78 -0
  30. package/lib/memorax-code-backend/dist/codex-adapter-lifecycle.js +1 -131
  31. package/lib/memorax-code-backend/dist/{memorax-code-config.js → config/memorax-code.js} +32 -4
  32. package/lib/memorax-code-backend/dist/{server-cli.js → entrypoints/backend-cli.js} +137 -37
  33. package/lib/memorax-code-backend/dist/jsonl-append.js +1 -75
  34. package/lib/memorax-code-backend/dist/{active-client-selection.js → lifecycle/active-clients.js} +12 -1
  35. package/lib/memorax-code-backend/dist/{backend-service-cleanup.js → lifecycle/backend/cleanup.js} +1 -1
  36. package/lib/memorax-code-backend/dist/{backend-service-record.js → lifecycle/backend/record.js} +1 -1
  37. package/lib/memorax-code-backend/dist/{backend-service-result.js → lifecycle/backend/result.js} +2 -2
  38. package/lib/memorax-code-backend/dist/{service.js → lifecycle/backend/service.js} +16 -16
  39. package/lib/memorax-code-backend/dist/{backend-token-record.js → lifecycle/backend/token-record.js} +1 -1
  40. package/lib/memorax-code-backend/dist/{backend-service-token.js → lifecycle/backend/token.js} +2 -2
  41. package/lib/memorax-code-backend/dist/lifecycle/client-plugin-removal.js +109 -0
  42. package/lib/memorax-code-backend/dist/{client-selection.js → lifecycle/client-selection.js} +11 -5
  43. package/lib/memorax-code-backend/dist/{backend-lifecycle-lock.js → lifecycle/lock.js} +1 -1
  44. package/lib/memorax-code-backend/dist/{memorax-code-lifecycle.js → lifecycle/orchestrator.js} +325 -39
  45. package/lib/memorax-code-backend/dist/memorax-cli.js +1 -1
  46. package/lib/memorax-code-backend/dist/memorax-code.js +1 -1
  47. package/lib/memorax-code-backend/dist/{automatic-memory-retrieval.js → memory/automatic-retrieval.js} +3 -3
  48. package/lib/memorax-code-backend/dist/{automatic-memory-writeback.js → memory/automatic-writeback.js} +75 -21
  49. package/lib/memorax-code-backend/dist/{memory-cli.js → memory/cli.js} +23 -10
  50. package/lib/memorax-code-backend/dist/{memory-hook-command.js → memory/hook-command.js} +156 -9
  51. package/lib/memorax-code-backend/dist/memory/observability.js +1 -0
  52. package/lib/memorax-code-backend/dist/memory/payload-redaction.js +212 -0
  53. package/lib/memorax-code-backend/dist/{memory-reminder-trace-recorder.js → memory/reminder-trace-recorder.js} +20 -7
  54. package/lib/memorax-code-backend/dist/{repository-memory-context.js → memory/repository-session.js} +2 -2
  55. package/lib/memorax-code-backend/dist/{memory-service.js → memory/service.js} +27 -5
  56. package/lib/memorax-code-backend/dist/{memory-turn-coordinator.js → memory/turn-coordinator.js} +2 -1
  57. package/lib/memorax-code-backend/dist/{memory-writeback-buffer.js → memory/writeback-buffer.js} +3 -3
  58. package/lib/memorax-code-backend/dist/{memory-writeback-chunk.js → memory/writeback-chunk.js} +1 -1
  59. package/lib/memorax-code-backend/dist/{memory-writeback-reconciler.js → memory/writeback-reconciler.js} +6 -6
  60. package/lib/memorax-code-backend/dist/{memory-writeback-task-projection.js → memory/writeback-task-projection.js} +4 -4
  61. package/lib/memorax-code-backend/dist/{memorax-adapter.js → provider/memorax/adapter.js} +5 -5
  62. package/lib/memorax-code-backend/dist/{memorax-config.js → provider/memorax/config.js} +4 -4
  63. package/lib/memorax-code-backend/dist/{memorax-http.js → provider/memorax/http.js} +1 -1
  64. package/lib/memorax-code-backend/dist/{repo-memory-readiness.js → repository/readiness.js} +3 -3
  65. package/lib/memorax-code-backend/dist/server.js +3 -212
  66. package/lib/memorax-code-backend/dist/service-entrypoint.js +1 -1
  67. package/lib/memorax-code-backend/dist/{debug-log.js → shared/debug-log.js} +1 -1
  68. package/lib/memorax-code-backend/dist/shared/jsonl-append.js +75 -0
  69. package/lib/memorax-code-backend/dist/shared/windows-cli-invocation.js +148 -0
  70. package/lib/memorax-code-backend/dist/{trace-config.js → trace/config.js} +43 -5
  71. package/lib/memorax-code-backend/dist/{trace-context.js → trace/context.js} +53 -2
  72. package/lib/memorax-code-backend/dist/{trace-store.js → trace/store.js} +3 -3
  73. package/lib/memorax-code-backend/dist/{server-health.js → transport/http/health.js} +1 -1
  74. package/lib/memorax-code-backend/dist/{server-memory-hook.js → transport/http/memory-hook.js} +3 -3
  75. package/lib/memorax-code-backend/dist/{server-http.js → transport/http/request.js} +1 -1
  76. package/lib/memorax-code-backend/dist/{claude-local-transcript.js → viewer/history/claude-transcript.js} +3 -3
  77. package/lib/memorax-code-backend/dist/{memory-viewer-session-title.js → viewer/history/session-title.js} +1 -1
  78. package/lib/memorax-code-backend/dist/{server-memory-viewer.js → viewer/http/public-routes.js} +15 -15
  79. package/lib/memorax-code-backend/dist/viewer/model.js +1 -0
  80. package/lib/memorax-code-backend/dist/{memory-viewer-activity.js → viewer/projection/activity.js} +2 -2
  81. package/lib/memorax-code-backend/dist/{memory-viewer-history-projection.js → viewer/projection/history.js} +1 -1
  82. package/lib/memorax-code-backend/dist/{memory-viewer-observability.js → viewer/projection/observability.js} +1 -1
  83. package/lib/memorax-code-backend/dist/{memory-viewer-user-projection.js → viewer/projection/user.js} +1 -1
  84. package/lib/memorax-code-backend/dist/{memory-viewer-writeback-status.js → viewer/projection/writeback-status.js} +1 -1
  85. package/lib/memorax-code-backend/dist/{memory-viewer-store.js → viewer/store.js} +59 -32
  86. package/lib/memorax-code-backend/dist/{memory-viewer-user-html.js → viewer/ui/user-html.js} +11 -10
  87. package/lib/memorax-code-backend/dist/windows-cli-invocation.js +1 -148
  88. package/lib/memorax-code-backend/package.json +3 -3
  89. package/lib/memorax-code-claude-adapter/.claude-plugin/plugin.json +1 -1
  90. package/lib/memorax-code-claude-adapter/hooks/runtime-shell.json +1 -1
  91. package/lib/memorax-code-claude-adapter/package.json +1 -1
  92. package/lib/memorax-code-claude-adapter/skills/memorax-code/SKILL.md +11 -2
  93. package/lib/memorax-code-claude-adapter/skills/memorax-code/defaults.json +8 -5
  94. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/memorax-add.md +1 -1
  95. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/memorax-search.md +37 -9
  96. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/personal-read.md +1 -1
  97. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/personal-write.md +33 -13
  98. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-build.md +62 -13
  99. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-read.md +11 -4
  100. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-templates.md +179 -59
  101. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-update.md +18 -7
  102. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/collect_all.py +122 -39
  103. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/detect_updates.py +73 -10
  104. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/github_resource_facets.py +9 -1
  105. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +9 -1
  106. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/validate_memory.py +23 -1
  107. package/lib/memorax-code-claude-adapter/src/plugin-install.mjs +1 -0
  108. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/.claude-plugin/plugin.json +1 -1
  109. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/hooks/runtime-shell.json +1 -1
  110. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/capture-cwd-hook.mjs +21 -14
  111. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/ensure-backend-runner.mjs +26 -7
  112. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/memory-skill-reminder-hook.mjs +86 -95
  113. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/memory-skill-reminder-policy.mjs +58 -0
  114. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/repo-memory/repo-memory-auto-build.mjs +2 -2
  115. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/repo-memory/repo-memory-job-supervisor.mjs +1 -1
  116. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/windows-cli-invocation.mjs +13 -1
  117. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/package.json +1 -1
  118. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/SKILL.md +11 -2
  119. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/defaults.json +8 -5
  120. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/memorax-add.md +1 -1
  121. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/memorax-search.md +37 -9
  122. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/personal-read.md +1 -1
  123. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/personal-write.md +33 -13
  124. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-build.md +62 -13
  125. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-read.md +11 -4
  126. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-templates.md +179 -59
  127. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-update.md +18 -7
  128. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/collect_all.py +122 -39
  129. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/detect_updates.py +73 -10
  130. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/github_resource_facets.py +9 -1
  131. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +9 -1
  132. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/validate_memory.py +23 -1
  133. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/src/plugin-install.mjs +1 -0
  134. package/lib/memorax-code-codex-adapter/.codex-plugin/plugin.json +1 -1
  135. package/lib/memorax-code-codex-adapter/hooks/runtime-shell.json +1 -1
  136. package/lib/memorax-code-codex-adapter/package.json +1 -1
  137. package/lib/memorax-code-codex-adapter/runtime-hooks/memory-skill-reminder.mjs +10 -2
  138. package/lib/memorax-code-codex-adapter/skills/memorax-code/SKILL.md +11 -2
  139. package/lib/memorax-code-codex-adapter/skills/memorax-code/defaults.json +8 -5
  140. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/memorax-add.md +1 -1
  141. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/memorax-search.md +37 -9
  142. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/personal-read.md +1 -1
  143. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/personal-write.md +33 -13
  144. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-build.md +62 -13
  145. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-read.md +11 -4
  146. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-templates.md +179 -59
  147. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-update.md +18 -7
  148. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/collect_all.py +122 -39
  149. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/detect_updates.py +73 -10
  150. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/github_resource_facets.py +9 -1
  151. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +9 -1
  152. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/validate_memory.py +23 -1
  153. package/lib/memorax-code-dsh-adapter/cordis.patch.yml +10 -0
  154. package/lib/memorax-code-dsh-adapter/hooks/repo-memory-job.mjs +68 -0
  155. package/lib/memorax-code-dsh-adapter/package.json +69 -0
  156. package/lib/memorax-code-dsh-adapter/skills/memorax-code/SKILL.md +91 -0
  157. package/lib/memorax-code-dsh-adapter/skills/memorax-code/agents/claude.yaml +10 -0
  158. package/lib/memorax-code-dsh-adapter/skills/memorax-code/agents/openai.yaml +7 -0
  159. package/lib/memorax-code-dsh-adapter/skills/memorax-code/defaults.json +12 -0
  160. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/memorax-add.md +86 -0
  161. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/memorax-search.md +91 -0
  162. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/personal-read.md +46 -0
  163. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/personal-write.md +120 -0
  164. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/repo-build.md +319 -0
  165. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/repo-read.md +103 -0
  166. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/repo-templates.md +390 -0
  167. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/repo-update.md +127 -0
  168. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/collect_all.py +579 -0
  169. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/detect_updates.py +919 -0
  170. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/git_commit_facets.py +222 -0
  171. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/github_resource_facets.py +512 -0
  172. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +517 -0
  173. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/prepare_repo_memory.py +411 -0
  174. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/user_profile_memory.py +528 -0
  175. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/validate_memory.py +248 -0
  176. package/lib/memorax-code-dsh-adapter/src/backend-client.mjs +119 -0
  177. package/lib/memorax-code-dsh-adapter/src/dsh-message.mjs +32 -0
  178. package/lib/memorax-code-dsh-adapter/src/dsh-version.mjs +18 -0
  179. package/lib/memorax-code-dsh-adapter/src/http-client.mjs +55 -0
  180. package/lib/memorax-code-dsh-adapter/src/index.mjs +72 -0
  181. package/lib/memorax-code-dsh-adapter/src/personal-context-worker.mjs +48 -0
  182. package/lib/memorax-code-dsh-adapter/src/personal-context.mjs +114 -0
  183. package/lib/memorax-code-dsh-adapter/src/plugin.mjs +724 -0
  184. package/lib/memorax-code-dsh-adapter/src/profile-lifecycle.mjs +1358 -0
  185. package/lib/memorax-code-dsh-adapter/src/protocol.mjs +145 -0
  186. package/lib/memorax-code-dsh-adapter/src/runtime-state.mjs +132 -0
  187. package/lib/memorax-code-opencode-adapter/hooks/repo-memory-job.mjs +37 -0
  188. package/lib/memorax-code-opencode-adapter/package.json +10 -0
  189. package/lib/memorax-code-opencode-adapter/skills/memorax-code/SKILL.md +91 -0
  190. package/lib/memorax-code-opencode-adapter/skills/memorax-code/agents/claude.yaml +10 -0
  191. package/lib/memorax-code-opencode-adapter/skills/memorax-code/agents/openai.yaml +7 -0
  192. package/lib/memorax-code-opencode-adapter/skills/memorax-code/defaults.json +12 -0
  193. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/memorax-add.md +86 -0
  194. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/memorax-search.md +91 -0
  195. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/personal-read.md +46 -0
  196. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/personal-write.md +120 -0
  197. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/repo-build.md +319 -0
  198. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/repo-read.md +103 -0
  199. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/repo-templates.md +390 -0
  200. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/repo-update.md +127 -0
  201. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/collect_all.py +579 -0
  202. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/detect_updates.py +919 -0
  203. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/git_commit_facets.py +222 -0
  204. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/github_resource_facets.py +512 -0
  205. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +517 -0
  206. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/prepare_repo_memory.py +411 -0
  207. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/user_profile_memory.py +528 -0
  208. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/validate_memory.py +248 -0
  209. package/lib/memorax-code-opencode-adapter/src/adapter-paths.mjs +37 -0
  210. package/lib/memorax-code-opencode-adapter/src/cli.mjs +260 -0
  211. package/lib/memorax-code-opencode-adapter/src/diagnostics.mjs +31 -0
  212. package/lib/memorax-code-opencode-adapter/src/plugin-install.mjs +673 -0
  213. package/lib/memorax-code-opencode-adapter/src/plugin.mjs +539 -0
  214. package/lib/memorax-code-opencode-adapter/src/repo-memory-server-runner.mjs +442 -0
  215. package/lib/run-entrypoint.mjs +6 -0
  216. package/package.json +7 -3
  217. package/lib/memorax-code-backend/dist/client-plugin-removal.js +0 -67
  218. /package/lib/memorax-code-backend/dist/{claude-transcript-turn.js → clients/claude/transcript-turn.js} +0 -0
  219. /package/lib/memorax-code-backend/dist/{codex-effective-prompt.js → clients/codex/effective-prompt.js} +0 -0
  220. /package/lib/memorax-code-backend/dist/{codex-rollout-turn.js → clients/codex/rollout-turn.js} +0 -0
  221. /package/lib/memorax-code-backend/dist/{codex-session-turn-index.js → clients/codex/session-turn-index.js} +0 -0
  222. /package/lib/memorax-code-backend/dist/{codex-workspace-links.js → clients/codex/workspace-links.js} +0 -0
  223. /package/lib/memorax-code-backend/dist/{backend-env.js → config/backend-env.js} +0 -0
  224. /package/lib/memorax-code-backend/dist/{proxy-env.js → config/proxy-env.js} +0 -0
  225. /package/lib/memorax-code-backend/dist/{entrypoint.js → entrypoints/main.js} +0 -0
  226. /package/lib/memorax-code-backend/dist/{backend-process.js → lifecycle/backend/process.js} +0 -0
  227. /package/lib/memorax-code-backend/dist/{backend-shutdown-request.js → lifecycle/backend/shutdown-request.js} +0 -0
  228. /package/lib/memorax-code-backend/dist/{backend-status.js → lifecycle/backend/status.js} +0 -0
  229. /package/lib/memorax-code-backend/dist/{adapter-lifecycle-participant.js → lifecycle/contracts.js} +0 -0
  230. /package/lib/memorax-code-backend/dist/{install-watchdog.js → lifecycle/install-watchdog.js} +0 -0
  231. /package/lib/memorax-code-backend/dist/{memory-observability.js → lifecycle/participant.js} +0 -0
  232. /package/lib/memorax-code-backend/dist/{memory-project.js → memory/project.js} +0 -0
  233. /package/lib/memorax-code-backend/dist/{repository-memory-scope.js → repository/scope.js} +0 -0
  234. /package/lib/memorax-code-backend/dist/{incremental-jsonl-projection.js → shared/incremental-jsonl-projection.js} +0 -0
  235. /package/lib/memorax-code-backend/dist/{utils.js → shared/record.js} +0 -0
  236. /package/lib/memorax-code-backend/dist/{server-json.js → transport/http/json.js} +0 -0
  237. /package/lib/memorax-code-backend/dist/{memory-viewer-data-projection-cache.js → viewer/projection/cache.js} +0 -0
  238. /package/lib/memorax-code-backend/dist/{memory-viewer-event-identity.js → viewer/projection/event-identity.js} +0 -0
  239. /package/lib/memorax-code-backend/dist/{memory-viewer-redaction.js → viewer/projection/redaction.js} +0 -0
  240. /package/lib/memorax-code-backend/dist/{memory-viewer-turn-reference.js → viewer/projection/turn-reference.js} +0 -0
  241. /package/lib/memorax-code-backend/dist/{memory-viewer-icon.js → viewer/ui/icon.js} +0 -0
  242. /package/lib/memorax-code-backend/dist/{memory-viewer-logo.js → viewer/ui/logo.js} +0 -0
@@ -5,19 +5,23 @@ import {
5
5
  localBackendRecoveryArguments,
6
6
  resolveBackendConnection,
7
7
  } from "../backend-connection.mjs";
8
- import { readStdinJson } from "../config-utils.mjs";
9
8
  import { isRepoMemoryJobWorker } from "../repo-memory/repo-memory-job-context.mjs";
10
9
 
11
10
  export const DEFAULT_ENSURE_BACKEND_START_TIMEOUT_MS = 90000;
11
+ const HOOK_INPUT_SYMBOL = Symbol.for("memorax-code.client-hook.input.v1");
12
12
 
13
13
  export async function runEnsureBackendHook(options) {
14
- if (isRepoMemoryJobWorker() || ensureDisabled(options.ensureBackendValue)) return;
15
-
16
14
  const input = await readStdinJson();
15
+ await ensureBackendAvailable(options, input);
16
+ }
17
+
18
+ export async function ensureBackendAvailable(options, input = {}) {
19
+ if (isRepoMemoryJobWorker() || ensureDisabled(options.ensureBackendValue)) return;
17
20
  const homes = options.resolveHomes(input);
18
21
  let connection;
19
22
  try {
20
- connection = resolveBackendConnection({ memoraxCodeHome: homes.memoraxCodeHome });
23
+ connection = options.backendConnection
24
+ ?? resolveBackendConnection({ memoraxCodeHome: homes.memoraxCodeHome });
21
25
  } catch (error) {
22
26
  options.debug?.(error instanceof Error ? error.message : String(error));
23
27
  return;
@@ -36,6 +40,8 @@ export async function runEnsureBackendHook(options) {
36
40
  command.value,
37
41
  options.buildStartArgs(homes, recoveryArguments),
38
42
  parsePositiveInt(options.startTimeoutValue, DEFAULT_ENSURE_BACKEND_START_TIMEOUT_MS),
43
+ options.nodePath,
44
+ options.recoveryEnv,
39
45
  );
40
46
  if (result.code !== 0) {
41
47
  options.debug?.(
@@ -105,14 +111,14 @@ function memoraxCodeCommandAvailable(command) {
105
111
  return path.split(delimiter).some((dir) => dir && existsSync(join(dir, command)));
106
112
  }
107
113
 
108
- function runMemoraxCode(command, args, timeoutMs) {
114
+ function runMemoraxCode(command, args, timeoutMs, nodePath, recoveryEnv) {
109
115
  return new Promise((resolve) => {
110
116
  const childArgs = nodeEntrypoint(command) ? [command, ...args] : args;
111
- const childCommand = nodeEntrypoint(command) ? process.execPath : command;
117
+ const childCommand = nodeEntrypoint(command) ? (stringValue(nodePath) ?? process.execPath) : command;
112
118
  let stderr = "";
113
119
  let settled = false;
114
120
  const child = spawn(childCommand, childArgs, {
115
- env: process.env,
121
+ env: recoveryEnv === undefined ? process.env : { ...process.env, ...recoveryEnv },
116
122
  stdio: ["ignore", "ignore", "pipe"],
117
123
  });
118
124
  const finish = (result) => {
@@ -140,3 +146,16 @@ function parsePositiveInt(value, fallback) {
140
146
  const parsed = Number(value);
141
147
  return Number.isInteger(parsed) && parsed > 0 ? parsed : fallback;
142
148
  }
149
+
150
+ async function readStdinJson() {
151
+ const injected = globalThis[HOOK_INPUT_SYMBOL];
152
+ if (injected && typeof injected === "object" && !Array.isArray(injected)) return injected;
153
+ let text = "";
154
+ for await (const chunk of process.stdin) text += chunk;
155
+ if (!text.trim()) return {};
156
+ try {
157
+ return JSON.parse(text);
158
+ } catch {
159
+ return {};
160
+ }
161
+ }
@@ -7,31 +7,43 @@ import {
7
7
  stringOption,
8
8
  withJsonFileLock,
9
9
  } from "../config-utils.mjs";
10
+ import {
11
+ isMemorySkillReminderDue,
12
+ memorySkillReminderContext,
13
+ personalMemoryReminderContext,
14
+ resolveMemorySkillReminderIntervalTurns,
15
+ } from "./memory-skill-reminder-policy.mjs";
10
16
 
11
- const DEFAULT_REMINDER_INTERVAL_TURNS = 5;
12
- const DEFAULT_MEMORY_SKILL_INVOCATION = "$memorax-code";
13
17
  export const PERSONAL_MEMORY_REMINDER_CONTEXT = personalMemoryReminderContext();
14
-
15
- export function personalMemoryReminderContext(memorySkillInvocation) {
16
- const invocation = stringOption(memorySkillInvocation) ?? DEFAULT_MEMORY_SKILL_INVOCATION;
17
- return [
18
- `MemoraX Code personal-memory reminder: Use ${invocation} when the user states a durable current-repo identity or interaction preference, asks to list or recall stored personal memory, or explicitly asks to save, update, forget, or delete it.`,
19
- "Route reusable action sequences and work rules to procedure memory; do not store repository facts, one-off task details, or secrets.",
20
- ].join(" ");
21
- }
18
+ export { personalMemoryReminderContext } from "./memory-skill-reminder-policy.mjs";
22
19
 
23
20
  export async function runMemorySkillReminderHook(options, hookInput) {
24
21
  try {
25
22
  const input = hookInput ?? await readStdinJson();
23
+ const result = await evaluateMemorySkillReminder(options, input);
24
+ if (!result) return;
25
+ process.stdout.write(`${JSON.stringify({
26
+ hookSpecificOutput: {
27
+ hookEventName: "UserPromptSubmit",
28
+ additionalContext: result.additionalContext,
29
+ },
30
+ })}\n`);
31
+ if (result.reminder) await notifyReminder(options, result.reminder);
32
+ } catch (error) {
33
+ debugError(options, error);
34
+ }
35
+ }
36
+
37
+ export async function evaluateMemorySkillReminder(options, input) {
38
+ try {
26
39
  const sessionId = stringOption(input.session_id) ?? stringOption(input.sessionId);
27
- if (!sessionId) return;
40
+ if (!sessionId) return undefined;
28
41
  const transcriptPath = stringOption(input.transcript_path) ?? stringOption(input.transcriptPath);
29
- if (options.requireTranscriptPath && !transcriptPath) return;
42
+ if (options.requireTranscriptPath && !transcriptPath) return undefined;
30
43
  const hookEventName = stringOption(input.hook_event_name) ?? stringOption(input.hookEventName) ?? "UserPromptSubmit";
44
+ if (hookEventName !== "UserPromptSubmit") return undefined;
31
45
 
32
- const memoraxCodeHome = process.env.MEMORAX_CODE_HOME || defaultMemoraxCodeHome();
33
- if (hookEventName !== "UserPromptSubmit") return;
34
-
46
+ const memoraxCodeHome = resolveMemoraxCodeHome(options);
35
47
  const statePath = join(memoraxCodeHome, "adapters", options.adapterDir, "memory-skill-reminders.json");
36
48
  const turnId = stringOption(input.turn_id)
37
49
  ?? stringOption(input.turnId)
@@ -48,7 +60,7 @@ export async function runMemorySkillReminderHook(options, hookInput) {
48
60
  );
49
61
  if (next.duplicate) return next;
50
62
  const sessionState = next.state.sessions[sessionId];
51
- const memoryReminderDue = shouldRemind(
63
+ const memoryReminderDue = isMemorySkillReminderDue(
52
64
  sessionState?.turnCount,
53
65
  intervalTurns,
54
66
  options.remindOnFirstTurn !== false,
@@ -64,34 +76,30 @@ export async function runMemorySkillReminderHook(options, hookInput) {
64
76
  turnCount: sessionState?.turnCount,
65
77
  };
66
78
  });
67
- if (update.duplicate) return;
79
+ if (update.duplicate) return undefined;
68
80
  const { memoryReminderDue, supplementalReminderDue } = update;
69
81
 
70
82
  const baseAdditionalContext = stringOption(options.baseAdditionalContext);
71
- if (baseAdditionalContext || memoryReminderDue || supplementalReminderDue) {
72
- const cadenceReminderContext = memoryReminderDue
73
- ? await buildCadenceReminderContext(options, input)
74
- : undefined;
75
- const personalMemoryContext = supplementalReminderDue || (memoryReminderDue && update.turnCount === 1)
76
- ? await buildPersonalMemoryContext(options, input)
77
- : undefined;
78
- const reminderContext = stringOption(combinedReminderContext(options, {
79
- memoryReminderDue,
80
- supplementalReminderDue,
81
- }, cadenceReminderContext, personalMemoryContext));
82
- const additionalContext = [baseAdditionalContext, reminderContext].filter(Boolean).join("\n\n");
83
- const triggers = [
84
- ...(memoryReminderDue ? ["cadence"] : []),
85
- ...(supplementalReminderDue ? ["post_compaction"] : []),
86
- ];
87
- process.stdout.write(`${JSON.stringify({
88
- hookSpecificOutput: {
89
- hookEventName: "UserPromptSubmit",
90
- additionalContext,
91
- },
92
- })}\n`);
93
- if (reminderContext) {
94
- await notifyReminder(options, {
83
+ if (!baseAdditionalContext && !memoryReminderDue && !supplementalReminderDue) return undefined;
84
+ const cadenceReminderContext = memoryReminderDue
85
+ ? await buildCadenceReminderContext(options, input)
86
+ : undefined;
87
+ const personalMemoryContext = supplementalReminderDue || (memoryReminderDue && update.turnCount === 1)
88
+ ? await buildPersonalMemoryContext(options, input)
89
+ : undefined;
90
+ const reminderContext = stringOption(combinedReminderContext(options, {
91
+ memoryReminderDue,
92
+ supplementalReminderDue,
93
+ }, cadenceReminderContext, personalMemoryContext));
94
+ const additionalContext = [baseAdditionalContext, reminderContext].filter(Boolean).join("\n\n");
95
+ const triggers = [
96
+ ...(memoryReminderDue ? ["cadence"] : []),
97
+ ...(supplementalReminderDue ? ["post_compaction"] : []),
98
+ ];
99
+ return {
100
+ additionalContext,
101
+ ...(reminderContext ? {
102
+ reminder: {
95
103
  sessionId,
96
104
  turnId,
97
105
  transcriptPath,
@@ -99,13 +107,12 @@ export async function runMemorySkillReminderHook(options, hookInput) {
99
107
  workspaceKind: stringOption(input.workspace_kind) ?? stringOption(input.workspaceKind),
100
108
  content: reminderContext,
101
109
  triggers,
102
- });
103
- }
104
- }
110
+ },
111
+ } : {}),
112
+ };
105
113
  } catch (error) {
106
- if (process.env[options.debugEnv] === "1") {
107
- console.error(error instanceof Error ? error.message : String(error));
108
- }
114
+ debugError(options, error);
115
+ return undefined;
109
116
  }
110
117
  }
111
118
 
@@ -125,21 +132,28 @@ export function markSupplementalReminderAfterCompact(options, input) {
125
132
  const hookEventName = stringOption(input.hook_event_name) ?? stringOption(input.hookEventName);
126
133
  if (hookEventName !== "SessionStart" || stringOption(input.source) !== "compact") return;
127
134
  const sessionId = stringOption(input.session_id) ?? stringOption(input.sessionId);
128
- if (!sessionId) return;
129
- const memoraxCodeHome = process.env.MEMORAX_CODE_HOME || defaultMemoraxCodeHome();
135
+ markSupplementalReminderForSession(options, sessionId);
136
+ } catch (error) {
137
+ debugError(options, error);
138
+ }
139
+ }
140
+
141
+ export function markSupplementalReminderForSession(options, sessionId) {
142
+ try {
143
+ const normalizedSessionId = stringOption(sessionId);
144
+ if (!normalizedSessionId) return;
145
+ const memoraxCodeHome = resolveMemoraxCodeHome(options);
130
146
  const statePath = join(memoraxCodeHome, "adapters", options.adapterDir, "memory-skill-reminders.json");
131
147
  withJsonFileLock(statePath, () => {
132
148
  const existing = readJsonFile(statePath);
133
149
  atomicWriteJson(statePath, markSupplementalReminderPending(
134
150
  existing?.unreadable ? undefined : existing?.value,
135
151
  options.runtime,
136
- sessionId,
152
+ normalizedSessionId,
137
153
  ));
138
154
  });
139
155
  } catch (error) {
140
- if (process.env[options.debugEnv] === "1") {
141
- console.error(error instanceof Error ? error.message : String(error));
142
- }
156
+ debugError(options, error);
143
157
  }
144
158
  }
145
159
 
@@ -169,7 +183,7 @@ async function buildPersonalMemoryContext(options, input) {
169
183
 
170
184
  function combinedReminderContext(options, due, cadenceReminderContext, personalMemoryContext) {
171
185
  const contexts = [];
172
- if (due.memoryReminderDue) contexts.push(memoryReminderContext(options));
186
+ if (due.memoryReminderDue) contexts.push(memorySkillReminderContext(options.memorySkillInvocation));
173
187
  if (due.supplementalReminderDue || personalMemoryContext) {
174
188
  const additionalReminderContext = stringOption(options.additionalReminderContext);
175
189
  if (additionalReminderContext) contexts.push(additionalReminderContext);
@@ -180,15 +194,22 @@ function combinedReminderContext(options, due, cadenceReminderContext, personalM
180
194
  return contexts.join("\n\n");
181
195
  }
182
196
 
183
- function memoryReminderContext(options) {
184
- const invocation = stringOption(options.memorySkillInvocation) ?? DEFAULT_MEMORY_SKILL_INVOCATION;
185
- return `MemoraX Code reminder: proactively invoke ${invocation} whenever coding memory might help, even when uncertain; follow the skill's router to decide whether any memory operation is needed. Also use ${invocation} for repository-scoped personal memory, and classify the authority before reading or writing.`;
186
- }
187
-
188
197
  function defaultMemoraxCodeHome() {
189
198
  return process.env.HOME ? join(process.env.HOME, ".memorax-code") : ".memorax-code";
190
199
  }
191
200
 
201
+ function resolveMemoraxCodeHome(options) {
202
+ return stringOption(options.memoraxCodeHome)
203
+ ?? process.env.MEMORAX_CODE_HOME
204
+ ?? defaultMemoraxCodeHome();
205
+ }
206
+
207
+ function debugError(options, error) {
208
+ if (process.env[options.debugEnv] === "1") {
209
+ console.error(error instanceof Error ? error.message : String(error));
210
+ }
211
+ }
212
+
192
213
  function nextReminderState(existing, runtime, sessionId, turnId) {
193
214
  const state = reminderState(existing, runtime);
194
215
  const current = state.sessions[sessionId] && typeof state.sessions[sessionId] === "object" && !Array.isArray(state.sessions[sessionId])
@@ -231,47 +252,17 @@ function reminderState(existing, runtime) {
231
252
  return state;
232
253
  }
233
254
 
234
- function shouldRemind(turnCount, intervalTurns, remindOnFirstTurn) {
235
- if (!Number.isInteger(turnCount) || turnCount <= 0) return false;
236
- if (remindOnFirstTurn) return (turnCount - 1) % intervalTurns === 0;
237
- return turnCount > intervalTurns && (turnCount - 1) % intervalTurns === 0;
238
- }
239
-
240
255
  function reminderIntervalTurns(memoraxCodeHome) {
241
- return positiveInteger(process.env.MEMORAX_CODE_MEMORY_SKILL_REMINDER_INTERVAL_TURNS)
242
- ?? configReminderIntervalTurns(join(memoraxCodeHome, "config.toml"))
243
- ?? DEFAULT_REMINDER_INTERVAL_TURNS;
256
+ return resolveMemorySkillReminderIntervalTurns({
257
+ environmentValue: process.env.MEMORAX_CODE_MEMORY_SKILL_REMINDER_INTERVAL_TURNS,
258
+ configText: configReminderText(join(memoraxCodeHome, "config.toml")),
259
+ });
244
260
  }
245
261
 
246
- function configReminderIntervalTurns(path) {
262
+ function configReminderText(path) {
247
263
  try {
248
- return parseReminderIntervalTurns(readFileSync(path, "utf8"));
264
+ return readFileSync(path, "utf8");
249
265
  } catch {
250
266
  return undefined;
251
267
  }
252
268
  }
253
-
254
- function parseReminderIntervalTurns(text) {
255
- let section = "";
256
- for (const rawLine of text.split(/\r?\n/)) {
257
- const line = rawLine.split("#", 1)[0].trim();
258
- if (!line) continue;
259
- const sectionMatch = line.match(/^\[([^\]]+)\]$/);
260
- if (sectionMatch) {
261
- section = sectionMatch[1].trim();
262
- continue;
263
- }
264
- if (section !== "memory.skill_reminder") continue;
265
- const fieldMatch = line.match(/^interval_turns\s*=\s*(.+)$/);
266
- if (fieldMatch) return positiveInteger(fieldMatch[1]);
267
- }
268
- return undefined;
269
- }
270
-
271
- function positiveInteger(value) {
272
- if (typeof value !== "string") return undefined;
273
- const normalized = value.trim().replaceAll("_", "");
274
- if (!/^[1-9]\d*$/.test(normalized)) return undefined;
275
- const parsed = Number(normalized);
276
- return Number.isSafeInteger(parsed) ? parsed : undefined;
277
- }
@@ -0,0 +1,58 @@
1
+ export const DEFAULT_MEMORY_SKILL_REMINDER_INTERVAL_TURNS = 5;
2
+ const DEFAULT_MEMORY_SKILL_INVOCATION = "$memorax-code";
3
+
4
+ export function memorySkillReminderContext(memorySkillInvocation) {
5
+ const invocation = nonEmptyString(memorySkillInvocation) ?? DEFAULT_MEMORY_SKILL_INVOCATION;
6
+ return `MemoraX Code reminder: proactively invoke ${invocation} whenever coding memory might help, even when uncertain; follow the skill's router to decide whether any memory operation is needed. Also use ${invocation} for repository-scoped personal memory, and classify the authority before reading or writing.`;
7
+ }
8
+
9
+ export function personalMemoryReminderContext(memorySkillInvocation) {
10
+ const invocation = nonEmptyString(memorySkillInvocation) ?? DEFAULT_MEMORY_SKILL_INVOCATION;
11
+ return [
12
+ `MemoraX Code personal-memory reminder: Use ${invocation} when the user states a durable current-repo identity or interaction preference, asks to list or recall stored personal memory, or explicitly asks to save, update, forget, or delete it.`,
13
+ "Route reusable action sequences and work rules to procedure memory; do not store repository facts, one-off task details, or secrets.",
14
+ ].join(" ");
15
+ }
16
+
17
+ export function resolveMemorySkillReminderIntervalTurns(input = {}) {
18
+ return positiveInteger(input.environmentValue)
19
+ ?? parseMemorySkillReminderIntervalTurns(input.configText)
20
+ ?? DEFAULT_MEMORY_SKILL_REMINDER_INTERVAL_TURNS;
21
+ }
22
+
23
+ export function isMemorySkillReminderDue(turnCount, intervalTurns, remindOnFirstTurn = true) {
24
+ if (!Number.isInteger(turnCount) || turnCount <= 0) return false;
25
+ if (!Number.isInteger(intervalTurns) || intervalTurns <= 0) return false;
26
+ if (remindOnFirstTurn) return (turnCount - 1) % intervalTurns === 0;
27
+ return turnCount > intervalTurns && (turnCount - 1) % intervalTurns === 0;
28
+ }
29
+
30
+ export function parseMemorySkillReminderIntervalTurns(text) {
31
+ if (typeof text !== "string") return undefined;
32
+ let section = "";
33
+ for (const rawLine of text.split(/\r?\n/)) {
34
+ const line = rawLine.split("#", 1)[0].trim();
35
+ if (!line) continue;
36
+ const sectionMatch = line.match(/^\[([^\]]+)\]$/);
37
+ if (sectionMatch) {
38
+ section = sectionMatch[1].trim();
39
+ continue;
40
+ }
41
+ if (section !== "memory.skill_reminder") continue;
42
+ const fieldMatch = line.match(/^interval_turns\s*=\s*(.+)$/);
43
+ if (fieldMatch) return positiveInteger(fieldMatch[1]);
44
+ }
45
+ return undefined;
46
+ }
47
+
48
+ function positiveInteger(value) {
49
+ if (typeof value !== "string") return undefined;
50
+ const normalized = value.trim().replaceAll("_", "");
51
+ if (!/^[1-9]\d*$/.test(normalized)) return undefined;
52
+ const parsed = Number(normalized);
53
+ return Number.isSafeInteger(parsed) ? parsed : undefined;
54
+ }
55
+
56
+ function nonEmptyString(value) {
57
+ return typeof value === "string" && value.trim() ? value.trim() : undefined;
58
+ }
@@ -11,10 +11,10 @@ export function scheduleMissingRepoMemoryBuild(repo, options = {}) {
11
11
 
12
12
  const jobHookPath = join(pluginRoot, "hooks", "repo-memory-job.mjs");
13
13
  if (!existsSync(jobHookPath)) return false;
14
- const child = spawn(process.execPath, [jobHookPath, "maintain", "--repo", repoPath], {
14
+ const child = spawn(options.nodePath ?? process.execPath, [jobHookPath, "maintain", "--repo", repoPath], {
15
15
  cwd: repoPath,
16
16
  detached: true,
17
- env: process.env,
17
+ env: options.env ?? process.env,
18
18
  stdio: "ignore",
19
19
  windowsHide: true,
20
20
  });
@@ -517,7 +517,7 @@ function buildPrompt(repo, snapshotHead, memorySkillInvocation) {
517
517
  }
518
518
 
519
519
  function updatePrompt(repo, snapshotHead, memorySkillInvocation) {
520
- return `This invocation is the authorized background repo-memory worker. Complete the requested operation yourself; do not inspect, launch, or defer to another repo-memory job.\n\nUse ${memorySkillInvocation} and select the Repo Memory repo-update operation to incrementally update this repository's existing .repo_memory.\n\nRepository: ${repo}\nSnapshot HEAD: ${snapshotHead}\n\nDefault behavior:\n- Treat existing .repo_memory as the baseline.\n- Detect local commit delta from the stored baseline to the exact snapshot SHA above.\n- Also try GitHub/GitLab PR, MR, and issue evidence when provider CLIs and authentication are available.\n- If provider evidence is unavailable, continue with local git evidence and preserve existing provider resources.\n- Do not rebuild unless updater reports the baseline is unusable; if a full rebuild is required, stop and report that.\n- Keep file writes scoped to ${repo}/.repo_memory and necessary repo-memory ignore/config entries.\n- Do not modify source code, dependency files, global config, or files outside the target repo unless explicitly required by repo-memory tooling.\n- Ensure PROFILE.md local_head resolves to the snapshot SHA above.\n- Run the packaged repo-memory validator before finishing.\n- Write a concise final summary with changed files, provider evidence status, and any follow-up needed.\n`;
520
+ return `This invocation is the authorized background repo-memory worker. Complete the requested operation yourself; do not inspect, launch, or defer to another repo-memory job.\n\nUse ${memorySkillInvocation} and select the Repo Memory repo-update operation to incrementally update this repository's existing .repo_memory.\n\nRepository: ${repo}\nSnapshot HEAD: ${snapshotHead}\n\nDefault behavior:\n- Treat existing .repo_memory as the baseline.\n- Run and follow the packaged repo-update detector's effective history policy.\n- Do not re-enable commit or provider evidence channels disabled by repoHistory.mode.\n- If provider evidence is unavailable when provider history is enabled, preserve existing provider resources.\n- Do not rebuild unless updater reports the baseline is unusable; if a full rebuild is required, stop and report that.\n- Keep file writes scoped to ${repo}/.repo_memory and necessary repo-memory ignore/config entries.\n- Do not modify source code, dependency files, global config, or files outside the target repo unless explicitly required by repo-memory tooling.\n- Ensure PROFILE.md local_head resolves to the snapshot SHA above.\n- Run the packaged repo-memory validator before finishing.\n- Write a concise final summary with changed files, provider evidence status, and any follow-up needed.\n`;
521
521
  }
522
522
 
523
523
  function gitSnapshot(repo) {
@@ -37,7 +37,11 @@ export function resolveWindowsCliInvocation(command, args, options = {}) {
37
37
  .filter(isNodeEntrypoint)
38
38
  .find((candidate) => fileExists(candidate));
39
39
  if (!cli) {
40
- const override = name === "claude" ? "MEMORAX_CODE_CLAUDE_CLI_JS" : "MEMORAX_CODE_CODEX_CLI_JS";
40
+ const override = name === "claude"
41
+ ? "MEMORAX_CODE_CLAUDE_CLI_JS"
42
+ : name === "dsh"
43
+ ? "MEMORAX_CODE_DSH_CLI_JS"
44
+ : "MEMORAX_CODE_CODEX_CLI_JS";
41
45
  throw new Error(
42
46
  `refusing to execute ${pathApi.basename(resolvedCommand)} through a command shell; `
43
47
  + `set ${override} to its Node entrypoint`,
@@ -75,6 +79,14 @@ function cliEntrypointCandidates(name, command, env, pathApi) {
75
79
  pathApi.join(root, "..", "@anthropic-ai", "claude-code", "cli.js"),
76
80
  ];
77
81
  }
82
+ if (name === "dsh") {
83
+ return [
84
+ env.MEMORAX_CODE_DSH_CLI_JS,
85
+ env.DSH_CLI_JS,
86
+ pathApi.join(root, "node_modules", "@deepseek-ai", "dsh", "lib", "bin.js"),
87
+ pathApi.join(root, "..", "@deepseek-ai", "dsh", "lib", "bin.js"),
88
+ ];
89
+ }
78
90
  return [];
79
91
  }
80
92
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memorax-code/claude-adapter",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "description": "Claude Code Hook adapter for MemoraX Code memory services.",
@@ -21,6 +21,11 @@ description: >-
21
21
 
22
22
  Classify the requested memory authority first, then its operation. Load only the matching reference unless the request genuinely spans authorities or operations.
23
23
 
24
+ After selecting an operation reference, read it completely in a standalone
25
+ tool call and wait for the full result before constructing or executing that
26
+ operation. Never combine reading a required reference with the command or
27
+ action it governs in the same shell command or tool call.
28
+
24
29
  ## Authority Router
25
30
 
26
31
  ### MemoraX Code Coding Memory
@@ -51,8 +56,11 @@ Use personal memory for user-owned repository procedures and durable profile or
51
56
  - Route ordered actions, checklists, prerequisites, gates, exceptions, and validation rules to personal procedure memory, even when phrased as "I prefer", "I like", "我的习惯", or "我喜欢".
52
57
  - Route preferred name, answer language, tone, verbosity, explanation style, and result presentation to personal profile memory.
53
58
  - Route task-learned repairs, coding pitfalls, project engineering conventions, and reusable design lessons to MemoraX Code coding memory.
59
+ - Route prior project discussions, experiment conclusions, saved engineering findings, earlier fixes, and reusable project lessons to MemoraX Code coding memory. Do not route them to repo memory merely because they concern a project. Use repo memory for repository identity, architecture, module maps, commits, PRs, MRs, and issues.
54
60
  - Route repository architecture, module maps, commit history, PRs, MRs, and issues to repo memory. Verify claims about current behavior against live code.
61
+ - Use both repo memory and MemoraX Code coding memory only when a request genuinely needs distinct repository evidence and reusable engineering lessons. This can apply to implementation, debugging, refactoring, migration planning, or validation when the answer may depend on repository module maps, commit/PR/issue evidence, and prior fixes, pitfalls, conventions, validation patterns, or design rationale. Do not use both authorities just because a request mentions a repository, file, module, or "previous".
55
62
  - Route current-task instructions and temporary plans to the current task only; do not persist them.
63
+ - Current-task-only applies only when completing the request does not depend on prior project state. Do not select it merely because the requested action happens in the current turn. When implementation, debugging, review, experiment continuation, or validation depends on earlier project decisions, results, fixes, constraints, or plans that the user has not explicitly and completely supplied, route to MemoraX Code coding memory.
56
64
  - Do not infer an authority from verbs such as "remember", "recall", "refresh", or "update" alone. Ask one focused question when the target remains ambiguous.
57
65
 
58
66
  Examples:
@@ -72,11 +80,12 @@ Repo memory and personal memory remain local `.repo_memory` authorities. Resolve
72
80
 
73
81
  Apply instructions in this order: system and developer instructions, `AGENTS.md`, the current user request, then stored memory. Memory is guidance or historical context, not proof of current repository behavior.
74
82
 
75
- For MemoraX Code coding memory, use `memorax-cli` exactly as described by the selected reference. Invoke this skill as `$memorax-code` in Codex or `/memorax-code` in Claude Code; neither invocation is a shell command. `memorax-code` is the lifecycle CLI and must not be used for memory search or add. Do not call MemoraX HTTP endpoints directly.
83
+ For MemoraX Code coding memory, use `memorax-cli` exactly as described by the selected reference. Invoke this skill as `$memorax-code` in Codex or `/memorax-code` in Claude Code. In OpenCode, ask the agent to use the `memorax-code` skill by name. These invocation forms are not shell commands. `memorax-code` is the lifecycle CLI and must not be used for memory search or add. Do not call MemoraX HTTP endpoints directly.
76
84
 
77
85
  When explaining Memory Viewer, describe only `/memory-viewer`. It is a
78
86
  content-free local summary and must not expose conversation or memory text,
79
87
  session or turn identifiers, paths, or trace details. The page never queries
80
- MemoraX directly; client Hooks are the trace ingress authority.
88
+ MemoraX directly; it projects client-qualified local activity and keeps each
89
+ supported harness isolated.
81
90
 
82
91
  Never store secrets, credentials, `.env` content, sensitive personal data, raw transcripts, hidden tests, exact patches, temporary target commits, or unsafe destructive commands. Do not announce internal routing or reference loading.
@@ -1,9 +1,12 @@
1
1
  {
2
- "schema": "repo_memory_builder_defaults.v1",
3
- "limits": {
4
- "commits": 30,
5
- "prs": 30,
6
- "issues": 30
2
+ "schema": "repo_memory_builder_defaults.v2",
3
+ "repoHistory": {
4
+ "mode": "provider",
5
+ "limits": {
6
+ "commits": 30,
7
+ "prs": 30,
8
+ "issues": 30
9
+ }
7
10
  },
8
11
  "summaryChars": 4000
9
12
  }
@@ -1,6 +1,6 @@
1
1
  # MemoraX Code Coding Memory Add
2
2
 
3
- Use these instructions only to add reusable coding knowledge through `memorax-cli`. Invoke the skill as `$memorax-code` in Codex or `/memorax-code` in Claude Code; do not route memory operations through the lifecycle-only `memorax-code` CLI. Do not use this authority for personal procedures, interaction preferences, generated repository facts, or one-off task details.
3
+ Use these instructions only to add reusable coding knowledge through `memorax-cli`. Invoke the skill as `$memorax-code` in Codex or `/memorax-code` in Claude Code. In OpenCode, ask the agent to use the `memorax-code` skill by name. Do not route memory operations through the lifecycle-only `memorax-code` CLI. Do not use this authority for personal procedures, interaction preferences, generated repository facts, or one-off task details.
4
4
 
5
5
  ## Eligible Knowledge
6
6
 
@@ -1,6 +1,6 @@
1
1
  # MemoraX Code Coding Memory Search
2
2
 
3
- Use these instructions only to search reusable coding memory through `memorax-cli`. Invoke the skill as `$memorax-code` in Codex or `/memorax-code` in Claude Code; do not route memory operations through the lifecycle-only `memorax-code` CLI. Do not call MemoraX HTTP endpoints directly, print credentials, or edit memory storage by hand.
3
+ Use these instructions only to search reusable coding memory through `memorax-cli`. Invoke the skill as `$memorax-code` in Codex or `/memorax-code` in Claude Code. In OpenCode, ask the agent to use the `memorax-code` skill by name. Do not route memory operations through the lifecycle-only `memorax-code` CLI. Do not call MemoraX HTTP endpoints directly, print credentials, or edit memory storage by hand.
4
4
 
5
5
  ## Scope
6
6
 
@@ -21,8 +21,12 @@ Search when prior coding memory may change localization, implementation, review,
21
21
  - a request for a previous fix, failed approach, coding convention, design decision, or reusable lesson;
22
22
  - implementation, review, planning, API, schema, parser, workflow-contract, or migration work where prior project guidance may matter;
23
23
  - explicit instructions to follow previous agreements or remembered engineering conventions.
24
+ - a request to recover, verify, or apply prior project discussions, experiment results, saved memory, earlier decisions, previous changes, or historical constraints, unless the needed facts are fully present in the current visible context.
25
+ - a requested action that depends on prior project state, results, fixes, constraints, or plans when the exact evidence needed is not explicitly present in the current user-provided material.
24
26
 
25
- Skip search for simple current-code facts, tiny edits, typo fixes, one-shot commands, or behavior directly established by a clear live source.
27
+ Skip search for simple current-code facts, tiny edits, typo fixes, one-shot commands, or behavior directly established by a clear live source. Do not skip merely by saying the current conversation is sufficient or a relevant result was already retrieved; skip only when the current user message, selected text, or nearby visible context fully contains the facts needed for the answer. A nearby summary is sufficient for explaining that summary, but not automatically sufficient for diagnosing a regression, continuing an experiment, reviewing consistency with prior behavior, or claiming a complete historical account. A word such as "previous", "earlier", "remember", or "history" is not enough by itself to search when the visible context already contains the requested prior facts.
28
+
29
+ Do not search merely because a prior result or fix might exist. For an exact calculation from currently available data, or a current screenshot or reproducible symptom with sufficient live evidence, use the current evidence first. Search only when the user request or visible context establishes a concrete historical dependency.
26
30
 
27
31
  Choose the closest coding scene to shape the query:
28
32
 
@@ -34,23 +38,47 @@ If the user asks for commit, PR, MR, issue, or repository architecture evidence,
34
38
 
35
39
  ## Query Workflow
36
40
 
37
- Run at most one focused search before answering or editing. A development task may run one additional materially different search only after a failed test or dead-end investigation.
41
+ Before searching, identify the user's current action, target, concrete behavior or symptom, and the historical knowledge that could change the next action. When the request is fragmented, derive one narrow working intent from only its explicit target, condition, and requested or implied outcome. Do not add generic security, authorization, concurrency, auditing, reliability, or best-practice concerns unless the request names that boundary or it is necessary to resolve the working intent. Ask one focused question when no actionable intent can be named.
42
+
43
+ Run up to two focused first-round searches before answering or editing: a primary query for the smallest user-facing decision, and a materially different complementary query only when a second independent fact can change the action. Keep one query when the request describes one strongly coupled calculation, diagnosis, ownership question, or lifecycle decision; do not split it merely to create coverage. Run independent first-round searches in parallel by default. If parallel execution encounters a transport, rate-limit, or caller-environment failure, run any remaining searches serially; do not switch solely because a successful search returns an unexpected number of items. After merging the first-round results, run at most one follow-up query only when one named residual gap can change implementation, localization, risk, or validation. Do not use the follow-up merely because results are few, generic, or incomplete.
44
+
45
+ Write each query as one short natural-language question or intent statement, not a keyword list. Derive it from the user's retrieval goal instead of copying or concatenating nouns from the prompt. Follow the user's language for the prose while preserving exact code, API, path, workflow, and project identifiers. Retain at least one distinctive noun phrase from the user's wording as an anchor, together with any explicit negation, time/order, quantity, or scope qualifier. Also retain one stable task entity explicitly established by the current conversation or live code/documentation when it is needed to resolve that anchor or make the target decidable; do not drop it merely because it is absent from the newest fragmented user message. Do not replace an anchor or stable entity with a more abstract mechanism, a more specific implementation guess, or an unverified term. Preserve whether a retained detail is an observed symptom, desired outcome, disputed field or hypothesis, or explicit exclusion; do not turn an observation into a required invariant or replace a named disputed field with a generic reference.
38
46
 
39
- Write each query as one short natural-language question or intent statement, not a keyword list. Derive it from the user's retrieval goal instead of copying or concatenating nouns from the prompt. Follow the user's language for the prose while preserving exact code, API, path, workflow, and project identifiers. State what prior knowledge is needed and the relationship, decision, constraint, behavior, or risk being investigated. Include 2-5 stable exact identifiers when they are relevant and known, but integrate them grammatically instead of appending search tags or filler.
47
+ Preserve the user's requested answer shape as well as the target: for example, whether a value was introduced by a prior code change, which failed experiments require rerun, how a negative case differs, what source boundary applies, or which existing plan remains current. Encode an explicit exclusion, source boundary, or qualifier such as only, previous, failed, negative, not, latest, or before/after when it changes the answer. Do not turn an imperative, URL, copied log, or full task request into the query verbatim; extract the smallest reusable historical fact that could change the next action. When the user explicitly names several independent deliverables and their respective historical facts could change different next actions, use the existing two-query allowance for complementary coverage: let the primary query cover the central implementation or decision, and let the complementary query cover the separate validation, artifact, reporting, or boundary question. Do not split one tightly coupled task or create a second query merely to enumerate every noun.
48
+
49
+ State a fact-sized relationship that can change the next action: a target under a condition, and the decision, invariant, consequence, root cause, ownership, compatibility, validation question, or requested answer at issue. For behavior, data, and lifecycle work, every query must use this visible shape: `<target>: <condition>,<decision / invariant / consequence / validation question>?`. Keep the colon in both Chinese and English so the target, condition, and decision boundary remain explicit. Do not emit a generic topic, a keyword list, a label such as `primary query`, or an explanation around the query.
50
+
51
+ For a complementary first-round pair, each query must stand alone and cover a different decision boundary. Use a complementary pair only when the provided context gives each decision boundary a distinct exact code, API, path, workflow, or project identifier; otherwise keep one focused combined query that preserves both user-stated facts. Do not merely restate the same question with synonyms. If the user describes only one tightly coupled decision, emit exactly one query. Use one or two stable exact identifiers when they sharpen the query, and integrate them grammatically instead of appending search tags or filler. Use only user-provided anchors and stable terms from live code or documentation; do not reconstruct unseen fact wording from recalled memory.
40
52
 
41
53
  Pass the query directly with `--query`. Put every dynamically generated query in single quotes, never double quotes. Treat `$HOME`, backticks, and `$(command)` as literal text inside those quotes. Replace each literal single quote in the value with the exact POSIX sequence `'\''`.
42
54
 
43
- For example:
55
+ Use these actual output shapes as examples. They are queries themselves, not full user prompts or instructions for the user. Each Chinese/English pair is a language variant: choose the one matching the user, never run both merely because both are shown. The comments explain the example only and are not part of emitted query text.
44
56
 
45
57
  ```bash
46
- memorax-cli search --query 'What prior decisions define the memorax-code parser API failure boundary for malformed input?'
47
- memorax-cli search --query 'What prior review policies and regression risks apply to the memorax-code parser API cleanup boundary?'
48
- memorax-cli search --query 'memorax-code Backend、Codex adapter memory 层的职责如何衔接,之前为什么这样划分?'
58
+ # One tightly coupled decision: emit one query.
59
+ memorax-cli search --query 'Trace 生产版本:升级后到达的记录中,应以哪个客户端版本字段判断由旧插件产生,而非新版本上传进程?'
60
+ memorax-cli search --query 'Trace producer version: after an upgrade, which client-version field shows that an event came from the old plugin rather than the new uploader?'
61
+
62
+ # Two independent boundaries: emit a complementary pair.
63
+ memorax-cli search --query '任务上下文:升级新包后已打开任务仍按旧提示,是否绑定旧版本且必须新开对话?'
64
+ memorax-cli search --query '包缓存版本冲突:本地新包与缓存冲突时,已打开任务为何仍使用旧提示,如何确认实际加载版本?'
65
+ memorax-cli search --query 'Task context after upgrade: can an already-open task keep old injected context, and must validation use a fresh task?'
66
+ memorax-cli search --query 'Package-cache version collision: how do we confirm which version the active task actually loaded?'
67
+
68
+ # Preserve an explicit lifecycle condition and the required invariant.
69
+ memorax-cli search --query '自动写回:事件回调不等待 Promise 时,如何在消息终态后执行并防止重复?'
70
+ memorax-cli search --query 'Automatic writeback: when an event callback does not await a Promise, how should it run after message terminal state without duplicates?'
71
+
72
+ # Preserve a source boundary rather than turning it into a generic SDK question.
73
+ memorax-cli search --query '桌面 SDK 数据权威:无原生命令行时,应从哪些规范化消息和会话生命周期事件获取数据?'
74
+ memorax-cli search --query 'Desktop SDK authority: without a native CLI, which normalized messages and session lifecycle events are authoritative?'
49
75
  ```
50
76
 
51
77
  Keep queries under 25 words when practical for the language, but do not shorten them into ungrammatical fragments. Exclude secrets, private URLs, full prompts, raw transcripts, copied files, long logs, stack traces, and one-off task details.
52
78
 
53
- Read or summarize at most two relevant items. Prefer memories matching the current repository, module, API, lifecycle surface, ownership boundary, behavior, and failure mode. Treat verified memories as routing and validation hints, not patch recipes. Treat failed-attempt memories as negative evidence. Ignore stale or unrelated items and anything conflicting with current source, tests, or durable documentation.
79
+ Do not use abstract query facets such as "state", "fix", "safety", or "best practice" unless they are the concrete target. Do not use generic security or safety queries as complementary queries; bind every query to an exact target, condition, and behavior boundary.
80
+
81
+ Merge and deduplicate first-round results by item identity when available, otherwise by matching scope, condition, claim, and consequence. Accept a memory only when all three checks pass: it has the same component, API, workflow, or ownership boundary; it has the same behavior, symptom, condition, or change; and it supplies a condition, conclusion, consequence, fix, or validation idea that can change the current action. Read or summarize at most two accepted direct hits. Prefer memories matching the current repository, module, API, lifecycle surface, ownership boundary, behavior, and failure mode. Treat verified memories as routing and validation hints, not patch recipes. Treat failed-attempt memories as negative evidence. Ignore stale or unrelated items and anything conflicting with current source, tests, or durable documentation. For application questions, reject retrieval-strategy, evaluation, prompting, or workflow-process memories as domain evidence even if they repeat application terms. If no memory passes all three checks, say that memory is insufficient for the requested decision rather than filling the gap with a generic principle.
54
82
 
55
83
  ## Transport Failures
56
84