@memorax/memorax-code 0.1.1 → 0.1.3

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 (246) 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 +424 -108
  5. package/docs/configuration.md +153 -29
  6. package/docs/troubleshooting.md +93 -7
  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 +38 -0
  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} +16 -9
  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} +18 -11
  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} +157 -34
  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 +3 -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} +82 -21
  49. package/lib/memorax-code-backend/dist/{memory-cli.js → memory/cli.js} +45 -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} +25 -4
  55. package/lib/memorax-code-backend/dist/{memory-service.js → memory/service.js} +30 -6
  56. package/lib/memorax-code-backend/dist/{memory-turn-coordinator.js → memory/turn-coordinator.js} +7 -3
  57. package/lib/memorax-code-backend/dist/{memory-writeback-buffer.js → memory/writeback-buffer.js} +31 -2
  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/{repository-memory-scope.js → repository/scope.js} +81 -33
  66. package/lib/memorax-code-backend/dist/server.js +3 -212
  67. package/lib/memorax-code-backend/dist/service-entrypoint.js +1 -1
  68. package/lib/memorax-code-backend/dist/{debug-log.js → shared/debug-log.js} +1 -1
  69. package/lib/memorax-code-backend/dist/shared/jsonl-append.js +75 -0
  70. package/lib/memorax-code-backend/dist/shared/windows-cli-invocation.js +148 -0
  71. package/lib/memorax-code-backend/dist/{trace-config.js → trace/config.js} +43 -5
  72. package/lib/memorax-code-backend/dist/{trace-context.js → trace/context.js} +53 -2
  73. package/lib/memorax-code-backend/dist/{trace-store.js → trace/store.js} +3 -3
  74. package/lib/memorax-code-backend/dist/{server-health.js → transport/http/health.js} +1 -1
  75. package/lib/memorax-code-backend/dist/{server-memory-hook.js → transport/http/memory-hook.js} +3 -3
  76. package/lib/memorax-code-backend/dist/{server-http.js → transport/http/request.js} +1 -1
  77. package/lib/memorax-code-backend/dist/{claude-local-transcript.js → viewer/history/claude-transcript.js} +3 -3
  78. package/lib/memorax-code-backend/dist/{memory-viewer-session-title.js → viewer/history/session-title.js} +1 -1
  79. package/lib/memorax-code-backend/dist/{server-memory-viewer.js → viewer/http/public-routes.js} +25 -14
  80. package/lib/memorax-code-backend/dist/viewer/model.js +1 -0
  81. package/lib/memorax-code-backend/dist/{memory-viewer-activity.js → viewer/projection/activity.js} +2 -2
  82. package/lib/memorax-code-backend/dist/{memory-viewer-history-projection.js → viewer/projection/history.js} +1 -1
  83. package/lib/memorax-code-backend/dist/{memory-viewer-observability.js → viewer/projection/observability.js} +1 -1
  84. package/lib/memorax-code-backend/dist/{memory-viewer-user-projection.js → viewer/projection/user.js} +1 -1
  85. package/lib/memorax-code-backend/dist/{memory-viewer-writeback-status.js → viewer/projection/writeback-status.js} +1 -1
  86. package/lib/memorax-code-backend/dist/{memory-viewer-store.js → viewer/store.js} +59 -32
  87. package/lib/memorax-code-backend/dist/viewer/ui/icon.js +1 -0
  88. package/lib/memorax-code-backend/dist/{memory-viewer-user-html.js → viewer/ui/user-html.js} +14 -12
  89. package/lib/memorax-code-backend/dist/windows-cli-invocation.js +1 -148
  90. package/lib/memorax-code-backend/package.json +3 -3
  91. package/lib/memorax-code-claude-adapter/.claude-plugin/plugin.json +1 -1
  92. package/lib/memorax-code-claude-adapter/hooks/runtime-shell.json +1 -1
  93. package/lib/memorax-code-claude-adapter/package.json +1 -1
  94. package/lib/memorax-code-claude-adapter/runtime-hooks/memory-turn.mjs +5 -0
  95. package/lib/memorax-code-claude-adapter/skills/memorax-code/SKILL.md +23 -15
  96. package/lib/memorax-code-claude-adapter/skills/memorax-code/defaults.json +8 -5
  97. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/memorax-add.md +5 -1
  98. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/memorax-search.md +40 -10
  99. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/personal-read.md +1 -1
  100. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/personal-write.md +33 -13
  101. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-build.md +62 -13
  102. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-read.md +11 -4
  103. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-templates.md +179 -59
  104. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-update.md +18 -7
  105. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/collect_all.py +122 -39
  106. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/detect_updates.py +73 -10
  107. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/github_resource_facets.py +9 -1
  108. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +9 -1
  109. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/validate_memory.py +23 -1
  110. package/lib/memorax-code-claude-adapter/src/plugin-install.mjs +2 -0
  111. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/.claude-plugin/plugin.json +1 -1
  112. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/hooks/runtime-shell.json +1 -1
  113. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/capture-cwd-hook.mjs +21 -14
  114. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/ensure-backend-runner.mjs +26 -7
  115. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/memory-skill-reminder-hook.mjs +86 -95
  116. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/memory-skill-reminder-policy.mjs +58 -0
  117. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/repo-memory/repo-memory-auto-build.mjs +38 -0
  118. 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
  119. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/windows-cli-invocation.mjs +13 -1
  120. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/package.json +1 -1
  121. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/runtime-hooks/memory-turn.mjs +5 -0
  122. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/SKILL.md +23 -15
  123. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/defaults.json +8 -5
  124. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/memorax-add.md +5 -1
  125. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/memorax-search.md +40 -10
  126. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/personal-read.md +1 -1
  127. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/personal-write.md +33 -13
  128. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-build.md +62 -13
  129. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-read.md +11 -4
  130. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-templates.md +179 -59
  131. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-update.md +18 -7
  132. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/collect_all.py +122 -39
  133. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/detect_updates.py +73 -10
  134. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/github_resource_facets.py +9 -1
  135. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +9 -1
  136. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/validate_memory.py +23 -1
  137. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/src/plugin-install.mjs +2 -0
  138. package/lib/memorax-code-codex-adapter/.codex-plugin/plugin.json +1 -1
  139. package/lib/memorax-code-codex-adapter/hooks/runtime-shell.json +1 -1
  140. package/lib/memorax-code-codex-adapter/package.json +1 -1
  141. package/lib/memorax-code-codex-adapter/runtime-hooks/memory-skill-reminder.mjs +16 -2
  142. package/lib/memorax-code-codex-adapter/skills/memorax-code/SKILL.md +23 -15
  143. package/lib/memorax-code-codex-adapter/skills/memorax-code/defaults.json +8 -5
  144. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/memorax-add.md +5 -1
  145. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/memorax-search.md +40 -10
  146. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/personal-read.md +1 -1
  147. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/personal-write.md +33 -13
  148. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-build.md +62 -13
  149. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-read.md +11 -4
  150. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-templates.md +179 -59
  151. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-update.md +18 -7
  152. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/collect_all.py +122 -39
  153. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/detect_updates.py +73 -10
  154. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/github_resource_facets.py +9 -1
  155. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +9 -1
  156. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/validate_memory.py +23 -1
  157. package/lib/memorax-code-dsh-adapter/cordis.patch.yml +10 -0
  158. package/lib/memorax-code-dsh-adapter/hooks/repo-memory-job.mjs +68 -0
  159. package/lib/memorax-code-dsh-adapter/package.json +69 -0
  160. package/lib/memorax-code-dsh-adapter/skills/memorax-code/SKILL.md +91 -0
  161. package/lib/memorax-code-dsh-adapter/skills/memorax-code/agents/claude.yaml +10 -0
  162. package/lib/memorax-code-dsh-adapter/skills/memorax-code/agents/openai.yaml +7 -0
  163. package/lib/memorax-code-dsh-adapter/skills/memorax-code/defaults.json +12 -0
  164. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/memorax-add.md +86 -0
  165. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/memorax-search.md +91 -0
  166. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/personal-read.md +46 -0
  167. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/personal-write.md +120 -0
  168. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/repo-build.md +319 -0
  169. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/repo-read.md +103 -0
  170. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/repo-templates.md +390 -0
  171. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/repo-update.md +127 -0
  172. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/collect_all.py +579 -0
  173. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/detect_updates.py +919 -0
  174. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/git_commit_facets.py +222 -0
  175. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/github_resource_facets.py +512 -0
  176. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +517 -0
  177. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/prepare_repo_memory.py +411 -0
  178. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/user_profile_memory.py +528 -0
  179. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/validate_memory.py +248 -0
  180. package/lib/memorax-code-dsh-adapter/src/backend-client.mjs +119 -0
  181. package/lib/memorax-code-dsh-adapter/src/dsh-message.mjs +32 -0
  182. package/lib/memorax-code-dsh-adapter/src/dsh-version.mjs +18 -0
  183. package/lib/memorax-code-dsh-adapter/src/http-client.mjs +55 -0
  184. package/lib/memorax-code-dsh-adapter/src/index.mjs +72 -0
  185. package/lib/memorax-code-dsh-adapter/src/personal-context-worker.mjs +48 -0
  186. package/lib/memorax-code-dsh-adapter/src/personal-context.mjs +114 -0
  187. package/lib/memorax-code-dsh-adapter/src/plugin.mjs +724 -0
  188. package/lib/memorax-code-dsh-adapter/src/profile-lifecycle.mjs +1289 -0
  189. package/lib/memorax-code-dsh-adapter/src/protocol.mjs +145 -0
  190. package/lib/memorax-code-dsh-adapter/src/runtime-state.mjs +132 -0
  191. package/lib/memorax-code-opencode-adapter/hooks/repo-memory-job.mjs +37 -0
  192. package/lib/memorax-code-opencode-adapter/package.json +10 -0
  193. package/lib/memorax-code-opencode-adapter/skills/memorax-code/SKILL.md +91 -0
  194. package/lib/memorax-code-opencode-adapter/skills/memorax-code/agents/claude.yaml +10 -0
  195. package/lib/memorax-code-opencode-adapter/skills/memorax-code/agents/openai.yaml +7 -0
  196. package/lib/memorax-code-opencode-adapter/skills/memorax-code/defaults.json +12 -0
  197. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/memorax-add.md +86 -0
  198. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/memorax-search.md +91 -0
  199. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/personal-read.md +46 -0
  200. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/personal-write.md +120 -0
  201. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/repo-build.md +319 -0
  202. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/repo-read.md +103 -0
  203. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/repo-templates.md +390 -0
  204. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/repo-update.md +127 -0
  205. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/collect_all.py +579 -0
  206. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/detect_updates.py +919 -0
  207. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/git_commit_facets.py +222 -0
  208. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/github_resource_facets.py +512 -0
  209. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +517 -0
  210. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/prepare_repo_memory.py +411 -0
  211. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/user_profile_memory.py +528 -0
  212. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/validate_memory.py +248 -0
  213. package/lib/memorax-code-opencode-adapter/src/adapter-paths.mjs +37 -0
  214. package/lib/memorax-code-opencode-adapter/src/cli.mjs +260 -0
  215. package/lib/memorax-code-opencode-adapter/src/diagnostics.mjs +31 -0
  216. package/lib/memorax-code-opencode-adapter/src/plugin-install.mjs +673 -0
  217. package/lib/memorax-code-opencode-adapter/src/plugin.mjs +536 -0
  218. package/lib/memorax-code-opencode-adapter/src/repo-memory-server-runner.mjs +207 -0
  219. package/lib/resolve-claude-command.mjs +154 -1
  220. package/lib/resolve-codex-command.mjs +56 -1
  221. package/lib/run-entrypoint.mjs +6 -0
  222. package/package.json +7 -3
  223. package/lib/memorax-code-backend/dist/client-plugin-removal.js +0 -67
  224. /package/lib/memorax-code-backend/dist/{claude-transcript-turn.js → clients/claude/transcript-turn.js} +0 -0
  225. /package/lib/memorax-code-backend/dist/{codex-effective-prompt.js → clients/codex/effective-prompt.js} +0 -0
  226. /package/lib/memorax-code-backend/dist/{codex-rollout-turn.js → clients/codex/rollout-turn.js} +0 -0
  227. /package/lib/memorax-code-backend/dist/{codex-session-turn-index.js → clients/codex/session-turn-index.js} +0 -0
  228. /package/lib/memorax-code-backend/dist/{codex-workspace-links.js → clients/codex/workspace-links.js} +0 -0
  229. /package/lib/memorax-code-backend/dist/{backend-env.js → config/backend-env.js} +0 -0
  230. /package/lib/memorax-code-backend/dist/{proxy-env.js → config/proxy-env.js} +0 -0
  231. /package/lib/memorax-code-backend/dist/{entrypoint.js → entrypoints/main.js} +0 -0
  232. /package/lib/memorax-code-backend/dist/{backend-process.js → lifecycle/backend/process.js} +0 -0
  233. /package/lib/memorax-code-backend/dist/{backend-shutdown-request.js → lifecycle/backend/shutdown-request.js} +0 -0
  234. /package/lib/memorax-code-backend/dist/{backend-status.js → lifecycle/backend/status.js} +0 -0
  235. /package/lib/memorax-code-backend/dist/{adapter-lifecycle-participant.js → lifecycle/contracts.js} +0 -0
  236. /package/lib/memorax-code-backend/dist/{install-watchdog.js → lifecycle/install-watchdog.js} +0 -0
  237. /package/lib/memorax-code-backend/dist/{memory-observability.js → lifecycle/participant.js} +0 -0
  238. /package/lib/memorax-code-backend/dist/{memory-project.js → memory/project.js} +0 -0
  239. /package/lib/memorax-code-backend/dist/{incremental-jsonl-projection.js → shared/incremental-jsonl-projection.js} +0 -0
  240. /package/lib/memorax-code-backend/dist/{utils.js → shared/record.js} +0 -0
  241. /package/lib/memorax-code-backend/dist/{server-json.js → transport/http/json.js} +0 -0
  242. /package/lib/memorax-code-backend/dist/{memory-viewer-data-projection-cache.js → viewer/projection/cache.js} +0 -0
  243. /package/lib/memorax-code-backend/dist/{memory-viewer-event-identity.js → viewer/projection/event-identity.js} +0 -0
  244. /package/lib/memorax-code-backend/dist/{memory-viewer-redaction.js → viewer/projection/redaction.js} +0 -0
  245. /package/lib/memorax-code-backend/dist/{memory-viewer-turn-reference.js → viewer/projection/turn-reference.js} +0 -0
  246. /package/lib/memorax-code-backend/dist/{memory-viewer-logo.js → viewer/ui/logo.js} +0 -0
@@ -38,12 +38,13 @@ are not a compatibility contract.
38
38
 
39
39
  ## New configuration
40
40
 
41
- The generated template selects both clients, disables automatic retrieval,
42
- enables automatic writeback, sets the preferred language to Chinese (`zh`),
43
- uses a five-turn skill reminder and the adaptive repository-update policy, and
44
- enables content-bearing local traces for both clients. npm installation may
45
- narrow `[clients]` to clients detected on the host. The tables below list all
46
- fallbacks, including tuning fields omitted from the generated file.
41
+ The generated template selects all four client integrations, disables automatic
42
+ retrieval, enables automatic writeback, sets the preferred language to Chinese
43
+ (`zh`), uses a five-turn skill reminder and the adaptive repository-update
44
+ policy, and enables content-bearing local traces for Codex, Claude Code, and
45
+ OpenCode. npm installation may narrow `[clients]` to clients detected on the
46
+ host. The tables below list all fallbacks, including tuning fields omitted from
47
+ the generated file.
47
48
 
48
49
  On POSIX systems MemoraX Code creates `$MEMORAX_CODE_HOME` with mode `0700`
49
50
  and a new `config.toml` with mode `0600`. Windows relies on the current user's
@@ -51,17 +52,87 @@ filesystem ACLs.
51
52
 
52
53
  ## Client selection
53
54
 
54
- If `[clients]` is absent, lifecycle commands select both clients. If it is
55
- present, `codex` and `claude` are boolean fields and an omitted client is
56
- disabled. The command-line override is:
55
+ If `[clients]` is absent, lifecycle commands select Codex, Claude Code, DSH,
56
+ and OpenCode. If it is present, `codex`, `claude`, `dsh`, and `opencode` are
57
+ boolean fields. Omitted `codex`, `claude`, or `opencode` values are disabled;
58
+ an omitted `dsh` value remains enabled so configurations written before DSH
59
+ support can discover an existing local Harness. Set `dsh = false` explicitly
60
+ to disable that integration. The command-line override accepts a
61
+ comma-separated subset:
57
62
 
58
63
  ```text
59
- --clients codex|claude|codex,claude|all|none
64
+ --clients codex|claude|dsh|opencode|<comma-separated subset>|all|none
60
65
  ```
61
66
 
62
- Client selection controls plugin and Hook lifecycle only. It does not change
63
- Codex or Claude Code provider settings. `--clients none` runs the Backend
64
- without managing either client integration.
67
+ A normal npm install or reinstall refreshes `[clients]` from the available
68
+ clients detected at that time. OpenCode is available when its explicit, XDG,
69
+ or default configuration directory exists, or when `opencode` is on `PATH`.
70
+ DSH is available when at least one valid Profile exists under
71
+ `$DSH_HOME/profiles`; `DSH_HOME` defaults to `~/.dsh`. An explicit
72
+ `[clients].dsh = false` is preserved.
73
+ Update-mode postinstall runs preserve enabled
74
+ clients and also probe each disabled client. An interactive update offers each
75
+ runnable disabled integration for activation with a default of yes. Declining
76
+ the prompt, or running non-interactively, keeps that integration disabled. A
77
+ selected client that is temporarily unavailable also remains selected in the
78
+ configuration instead of being permanently disabled. When an update newly
79
+ enables Codex, it requests initial Hook activation after the client-selection
80
+ prompt.
81
+
82
+ Client selection controls managed client-integration lifecycle only. It does
83
+ not change Codex, Claude Code, DSH, or OpenCode provider settings.
84
+ `--clients none` runs the Backend without managing a client integration.
85
+
86
+ ## DeepSeek Harness integration paths
87
+
88
+ DSH Profiles are discovered under:
89
+
90
+ ```text
91
+ $DSH_HOME/profiles/<profile-name>/
92
+ ```
93
+
94
+ `DSH_HOME` defaults to `~/.dsh`. The managed ownership record lives at
95
+ `$MEMORAX_CODE_HOME/adapters/dsh/state.json`. Runtime packages are materialized
96
+ under `$MEMORAX_CODE_HOME/adapters/dsh/runtime/generations/` and installed into
97
+ Profiles through DSH's native plugin command. The globally installed npm
98
+ package remains immutable; do not copy or edit the generated state or runtime
99
+ directories by hand.
100
+
101
+ MemoraX Code is tested with DSH `0.1.0-rc.6`. Other valid semantic versions are
102
+ accepted but appear as untested in status output; compatibility is not
103
+ guaranteed. An unavailable or malformed `dsh --version` result fails Profile
104
+ reconciliation when a Profile exists. Run `memorax-code start --clients dsh`
105
+ after changing `DSH_HOME`, DSH, or its Profiles.
106
+
107
+ ## OpenCode integration paths
108
+
109
+ The managed OpenCode plugin loader and shared skill use OpenCode's automatic
110
+ discovery directories:
111
+
112
+ ```text
113
+ ~/.config/opencode/plugins/memorax-code.js
114
+ ~/.config/opencode/skills/memorax-code/
115
+ ```
116
+
117
+ Set `OPENCODE_CONFIG_DIR` to override the complete OpenCode configuration root.
118
+ Otherwise, `XDG_CONFIG_HOME` replaces `~/.config` when set. The managed adapter
119
+ record lives at `$MEMORAX_CODE_HOME/adapters/opencode/state.json`. Content-free
120
+ plugin runtime evidence lives beside it in `workspaces.json` and records only
121
+ the observed event, workspace, optional session identifier, and timestamp.
122
+
123
+ MemoraX Code does not add entries to or otherwise modify `opencode.json` or
124
+ `opencode.jsonc`. Restart or refresh OpenCode after installation or after these
125
+ managed assets change.
126
+
127
+ The managed loader records the exact MemoraX Code home, OpenCode configuration
128
+ directory, installed Node runtime, and `memorax-code` entrypoint. When the
129
+ enabled plugin loads, it performs a best-effort Backend health check and uses
130
+ those installed package paths to restore an unavailable loopback Backend. A
131
+ prompt waits no more than the plugin instance's single five-second recovery
132
+ budget; if that budget expires, automatic memory handling for that turn is
133
+ skipped while recovery continues in the background. This preserves the
134
+ configured client selection. Remote Backend URLs, invalid connection
135
+ authority, and a removed package command are not recovered automatically.
65
136
 
66
137
  ## MemoraX connection
67
138
 
@@ -110,20 +181,20 @@ Automatic prompt retrieval is disabled by default.
110
181
  | `memory_type_order` | `MEMORAX_CODE_MEMORAX_MEMORY_TYPE_ORDER` | `core,episodic,semantic,procedural,unclassified` |
111
182
 
112
183
  The TOML form of `memory_type_order` is an array of strings; the environment
113
- form is comma-separated. `enabled` controls automatic `UserPromptSubmit`
114
- retrieval only. Explicit `memorax-cli search` remains available when
184
+ form is comma-separated. `enabled` controls automatic prompt retrieval only.
185
+ Explicit `memorax-cli search` remains available when
115
186
  credentials and a trusted workspace scope resolve.
116
187
 
117
188
  ## Writeback and explicit add
118
189
 
119
- New configurations explicitly set automatic transcript writeback to enabled.
190
+ New configurations explicitly set automatic completed-turn writeback to enabled.
120
191
  An existing configuration without `enabled` remains disabled.
121
192
 
122
193
  | Field | Environment override | Fallback |
123
194
  | --- | --- | --- |
124
195
  | `enabled` | `MEMORAX_CODE_MEMORY_WRITEBACK_ENABLED` | `false` when absent |
125
196
  | `buffer_enabled` | `MEMORAX_CODE_MEMORY_WRITEBACK_BUFFER_ENABLED` | `true` |
126
- | `buffer_max_turns` | `MEMORAX_CODE_MEMORY_WRITEBACK_BUFFER_MAX_TURNS` | `8`; `-1` disables automatic Hook writeback |
197
+ | `buffer_max_turns` | `MEMORAX_CODE_MEMORY_WRITEBACK_BUFFER_MAX_TURNS` | `8`; `-1` disables automatic writeback |
127
198
  | `buffer_max_age_ms` | `MEMORAX_CODE_MEMORY_WRITEBACK_BUFFER_MAX_AGE_MS` | `600000` |
128
199
  | `buffer_max_chars` | `MEMORAX_CODE_MEMORY_WRITEBACK_BUFFER_MAX_CHARS` | `128000` |
129
200
  | `max_message_chars` | `MEMORAX_CODE_MEMORY_WRITEBACK_MAX_MESSAGE_CHARS` | `64000` |
@@ -150,12 +221,42 @@ selecting another language. The setting affects newly generated content;
150
221
  `raw` input and client-supplied `pre_summarized` text are not translated.
151
222
  Command arguments override the other add defaults.
152
223
 
224
+ ### Automatic writeback redaction
225
+
226
+ Automatic writeback first bounds each user or assistant message with
227
+ `max_message_chars`, discarding an incomplete token at the cutoff, and then
228
+ runs a local best-effort detector before hashing, buffering, chunking, or
229
+ sending the content. The detector replaces these categories with typed
230
+ placeholders:
231
+
232
+ | Category | Placeholder |
233
+ | --- | --- |
234
+ | Private keys | `[REDACTED:PRIVATE_KEY]` |
235
+ | Authorization tokens and JWTs | `[REDACTED:AUTH_TOKEN]` |
236
+ | Cookie values | `[REDACTED:COOKIE]` |
237
+ | Common API key formats | `[REDACTED:API_KEY]` |
238
+ | Credential assignments, CLI arguments, URL query values, and URL passwords | `[REDACTED:CREDENTIAL]` |
239
+ | Email addresses | `[REDACTED:EMAIL]` |
240
+ | Long numbers, including common spaces, hyphens, and parentheses | `[REDACTED:LONG_NUMBER]` |
241
+ | UUIDs, fixed-length hexadecimal strings, and high-entropy alphanumeric identifiers | `[REDACTED:OPAQUE_ID]` |
242
+
243
+ If either bounded message has no meaningful content after replacement, the
244
+ automatic writeback is skipped before network dispatch. The detector is
245
+ always active for automatic writeback, but it is not a complete
246
+ data-loss-prevention system and may miss unknown or weak-context sensitive
247
+ formats. Explicit `memorax-cli add` content and Search queries are sent as
248
+ entered and do not pass through this detector.
249
+
153
250
  ## Skill reminder and repository maintenance
154
251
 
155
252
  `[memory.skill_reminder].interval_turns` defaults to `5`; its environment
156
253
  override is `MEMORAX_CODE_MEMORY_SKILL_REMINDER_INTERVAL_TURNS`. A positive
157
- value controls the reminder cadence for both clients, beginning with the first
158
- eligible prompt.
254
+ value controls the native skill reminder cadence for supported client
255
+ sessions, beginning with the first eligible prompt or Turn. The same interval
256
+ controls trusted repo-scoped Procedure Memory. User Profile preferences are
257
+ applied on first observation and restored with a personal-memory reminder
258
+ after successful context compaction. These local contexts remain separate
259
+ from automatic writeback content.
159
260
 
160
261
  | Field | Environment override | Fallback |
161
262
  | --- | --- | --- |
@@ -167,24 +268,45 @@ Supported policies are `every-commit`, `commit-count`, `daily`,
167
268
  `pull-request`, `pull-request-or-daily`, and `adaptive`. Invalid policy values
168
269
  fall back to `adaptive`.
169
270
 
271
+ In Codex, Claude Code, DSH, and OpenCode, the first eligible prompt starts a
272
+ background build only when the Backend has authorized a Git worktree and that
273
+ worktree has no `.repo_memory/PROFILE.md`. If the Backend or workspace
274
+ authority is unavailable, the client integration skips that attempt instead
275
+ of falling back to its local workspace path. DSH schedules this work through
276
+ its native pre-step integration rather than a Hook.
277
+
278
+ A relevant repo-read runs supervised maintenance in all four clients. The
279
+ configured policy may select a build, update, or no-op. DSH maintenance
280
+ requires an enabled, managed Profile that includes `@deepseek-ai/dsh-headless`.
281
+ OpenCode executes the job through its active local server. Desktop-only
282
+ installations do not require a standalone `opencode` executable in `PATH`.
283
+
170
284
  ## Local traces
171
285
 
172
- `[trace.codex]` and `[trace.claude]` support the same fields:
286
+ `[trace.codex]`, `[trace.claude]`, `[trace.dsh]`, and `[trace.opencode]`
287
+ support the same fields:
173
288
 
174
- | Field | Codex environment | Claude environment | Fallback |
175
- | --- | --- | --- | --- |
176
- | `enabled` | `MEMORAX_CODE_CODEX_TRACE_ENABLED` | `MEMORAX_CODE_CLAUDE_TRACE_ENABLED` | `true` |
177
- | `capture_content` | `MEMORAX_CODE_CODEX_TRACE_CAPTURE_CONTENT` | `MEMORAX_CODE_CLAUDE_TRACE_CAPTURE_CONTENT` | `true` |
178
- | `retention_days` | `MEMORAX_CODE_CODEX_TRACE_RETENTION_DAYS` | `MEMORAX_CODE_CLAUDE_TRACE_RETENTION_DAYS` | `7` |
179
- | `max_event_chars` | `MEMORAX_CODE_CODEX_TRACE_MAX_EVENT_CHARS` | `MEMORAX_CODE_CLAUDE_TRACE_MAX_EVENT_CHARS` | `20000` |
180
- | `max_file_bytes` | `MEMORAX_CODE_CODEX_TRACE_MAX_FILE_BYTES` | `MEMORAX_CODE_CLAUDE_TRACE_MAX_FILE_BYTES` | `52428800` |
289
+ | Field | Codex environment | Claude environment | DSH environment | OpenCode environment | Fallback |
290
+ | --- | --- | --- | --- | --- | --- |
291
+ | `enabled` | `MEMORAX_CODE_CODEX_TRACE_ENABLED` | `MEMORAX_CODE_CLAUDE_TRACE_ENABLED` | `MEMORAX_CODE_DSH_TRACE_ENABLED` | `MEMORAX_CODE_OPENCODE_TRACE_ENABLED` | `true` |
292
+ | `capture_content` | `MEMORAX_CODE_CODEX_TRACE_CAPTURE_CONTENT` | `MEMORAX_CODE_CLAUDE_TRACE_CAPTURE_CONTENT` | `MEMORAX_CODE_DSH_TRACE_CAPTURE_CONTENT` | `MEMORAX_CODE_OPENCODE_TRACE_CAPTURE_CONTENT` | `true` |
293
+ | `retention_days` | `MEMORAX_CODE_CODEX_TRACE_RETENTION_DAYS` | `MEMORAX_CODE_CLAUDE_TRACE_RETENTION_DAYS` | `MEMORAX_CODE_DSH_TRACE_RETENTION_DAYS` | `MEMORAX_CODE_OPENCODE_TRACE_RETENTION_DAYS` | `7` |
294
+ | `max_event_chars` | `MEMORAX_CODE_CODEX_TRACE_MAX_EVENT_CHARS` | `MEMORAX_CODE_CLAUDE_TRACE_MAX_EVENT_CHARS` | `MEMORAX_CODE_DSH_TRACE_MAX_EVENT_CHARS` | `MEMORAX_CODE_OPENCODE_TRACE_MAX_EVENT_CHARS` | `20000` |
295
+ | `max_file_bytes` | `MEMORAX_CODE_CODEX_TRACE_MAX_FILE_BYTES` | `MEMORAX_CODE_CLAUDE_TRACE_MAX_FILE_BYTES` | `MEMORAX_CODE_DSH_TRACE_MAX_FILE_BYTES` | `MEMORAX_CODE_OPENCODE_TRACE_MAX_FILE_BYTES` | `52428800` |
181
296
 
182
- Content capture can include prompts, responses, recalled memory, writeback
183
- content, reminder text, and local paths. Set `capture_content=false` for
297
+ Depending on the enabled client capabilities, content capture can include
298
+ prompts, responses, recalled memory, writeback content, reminder text, and
299
+ local paths. Set `capture_content=false` for
184
300
  metadata-only local traces, or `enabled=false` to disable a client's trace.
185
301
  Trace files stay under `$MEMORAX_CODE_HOME`; MemoraX Code has no trace upload,
186
302
  export, or public collector.
187
303
 
304
+ DSH trace contains only normalized lifecycle and memory-operation events. Its
305
+ native Session Event Log and raw events remain local to DSH; MemoraX Code does
306
+ not copy that log into trace. Memory Viewer includes DSH activity from
307
+ normalized operational events and retained trace, and never reads the native
308
+ Session Event Log.
309
+
188
310
  ## Backend runtime settings
189
311
 
190
312
  Backend connection and process authority is not stored in `config.toml`.
@@ -227,6 +349,8 @@ memorax-cli status
227
349
  memorax-cli status --json
228
350
  memorax-code-codex doctor
229
351
  memorax-code-claude doctor
352
+ memorax-code status --clients dsh
353
+ memorax-code-opencode doctor
230
354
  ```
231
355
 
232
356
  The status commands do not print the MemoraX API key or Backend token.
@@ -7,12 +7,16 @@ memorax-code status
7
7
  memorax-cli status
8
8
  memorax-code-codex doctor
9
9
  memorax-code-claude doctor
10
+ memorax-code status --clients dsh
11
+ memorax-code-opencode doctor
10
12
  memorax-code logs
11
13
  ```
12
14
 
13
- `status` checks the Backend and client integrations. `memory status` checks
14
- credentials, scope, and memory switches without printing secrets. Each client
15
- `doctor` checks its plugin, skill, workspace, and Backend connection.
15
+ `memorax-code status` checks the Backend and selected client integrations,
16
+ including DSH and OpenCode. `memorax-cli status` checks credentials, scope, and
17
+ memory switches without printing secrets. Codex, Claude Code, and OpenCode
18
+ also provide client-specific `doctor` commands; DSH uses the shared lifecycle
19
+ status.
16
20
 
17
21
  ## Installed, but memory is unavailable
18
22
 
@@ -103,6 +107,55 @@ This reconciles the Claude Code marketplace plugin and Hooks. If the plugin is
103
107
  still missing or stale, restart or refresh Claude Code. Do not manually copy
104
108
  Hooks into Claude settings.
105
109
 
110
+ ## DeepSeek Harness Profile integration is inactive
111
+
112
+ ```sh
113
+ dsh --version
114
+ pnpm --version
115
+ memorax-code start --clients dsh
116
+ memorax-code status --clients dsh
117
+ ```
118
+
119
+ MemoraX Code discovers existing Profiles under `$DSH_HOME/profiles`;
120
+ `DSH_HOME` defaults to `~/.dsh`. A `no_existing_profiles` result means DSH has
121
+ not created a valid Profile in that home. A `dsh_version_unavailable` result
122
+ means the selected `dsh` command did not return a valid semantic version. The
123
+ tested baseline is `0.1.0-rc.6`; another valid version is allowed but marked
124
+ untested. A `pnpm_not_found` result means DSH's native Profile plugin manager
125
+ could not find `pnpm` on `PATH`; install `pnpm`, then rerun the start command.
126
+
127
+ After repairing the command, Profile manifest, or home selection, rerun the
128
+ start command and restart or refresh DSH. `profile_drift`,
129
+ `profile_manifest_unreadable`, and `runtime_authority_invalid` are managed-state
130
+ failures rather than reasons to edit the Profile or
131
+ `$MEMORAX_CODE_HOME/adapters/dsh/state.json` manually. The lifecycle command
132
+ uses DSH's plugin manager to reconcile the integration. Stop and uninstall
133
+ remove the managed MemoraX Code plugin, not the DSH Profile or its session
134
+ data.
135
+
136
+ ## OpenCode plugin or skill is inactive
137
+
138
+ ```sh
139
+ memorax-code start --clients opencode
140
+ memorax-code status --clients opencode
141
+ memorax-code-opencode doctor
142
+ ```
143
+
144
+ Rerun the start command to reconcile the managed plugin and skill, then restart
145
+ or refresh OpenCode. The configuration root follows `OPENCODE_CONFIG_DIR`, then
146
+ `XDG_CONFIG_HOME`, and otherwise defaults to `~/.config/opencode`. MemoraX Code
147
+ does not add plugin entries to `opencode.json` or `opencode.jsonc`.
148
+
149
+ An enabled managed plugin normally attempts to restore an unavailable local
150
+ loopback Backend when OpenCode loads it. A prompt stops waiting after the
151
+ plugin instance's single five-second recovery budget and skips automatic
152
+ memory handling for that turn, but the Backend start continues in the
153
+ background. If that recovery is skipped or fails, use `memorax-code status` and
154
+ `memorax-code logs`, then run the start command above. If doctor reports no
155
+ plugin runtime evidence, restart or refresh OpenCode and rerun it. Automatic
156
+ recovery intentionally skips remote URLs, invalid connection authority, and
157
+ stale loaders whose recorded package command no longer exists.
158
+
106
159
  An already-open client may keep its loaded plugin shell while a later prompt
107
160
  uses the updated Hook runtime. Restart or refresh the client to load a changed
108
161
  plugin manifest, icon, or bundled skill.
@@ -116,6 +169,8 @@ environment may be intercepting `127.0.0.1` or `localhost`.
116
169
  memorax-code start
117
170
  memorax-code-codex doctor
118
171
  memorax-code-claude doctor
172
+ memorax-code status --clients dsh
173
+ memorax-code-opencode doctor
119
174
  /usr/sbin/scutil --proxy
120
175
  /bin/launchctl getenv NO_PROXY
121
176
  /bin/launchctl getenv no_proxy
@@ -132,6 +187,8 @@ memorax-cli status
132
187
  memorax-cli search --query 'test'
133
188
  memorax-code-codex doctor
134
189
  memorax-code-claude doctor
190
+ memorax-code status --clients dsh
191
+ memorax-code-opencode doctor
135
192
  ```
136
193
 
137
194
  Common causes are:
@@ -147,16 +204,43 @@ MemoraX Code reads filesystem Git metadata without executing Git. Linked
147
204
  worktrees share the remote repository identity; non-Git workspaces use the
148
205
  normalized folder name. Resolution never falls back to the bare base user ID.
149
206
 
207
+ A live Codex, Claude Code, DSH, or OpenCode session remains pinned to the
208
+ repository or local workspace resolved at the start of the session. Starting
209
+ the client from a parent workspace and then entering a nested Git repository
210
+ does not rebind the session. The only in-session scope upgrade is from a direct
211
+ `.git` directory whose internal metadata was malformed or incomplete to a
212
+ verified Git repository at the same canonical workspace root and for the same
213
+ Base User ID.
214
+
215
+ During that degraded state, MemoraX Code reports
216
+ `workspaceScopeFallbackReason: git_metadata_invalid` for manual CLI operations
217
+ and continues Search and Add with the normalized local folder name. Automatic
218
+ writeback also continues under that fallback scope without interrupting the
219
+ client task. The reported `effectiveUserId` identifies the fallback namespace
220
+ and may differ from the restored Git repository namespace. Repair the
221
+ repository or restore valid `.git` metadata, and later Search, Add, and
222
+ automatic writeback in the same client session automatically use the verified
223
+ Git repository scope. Memories already accepted under the fallback namespace
224
+ are not migrated. Any unsent automatic-writeback buffer for the fallback scope
225
+ is discarded instead of being flushed into either namespace.
226
+
227
+ Invalid or unreadable Git marker files, symlinked markers, and session scope
228
+ conflicts do not use this fallback. If Search or Add reports
229
+ `workspace_scope_mismatch` or `workspace_scope_unavailable`, start a new
230
+ session from the target repository or local workspace and verify that its
231
+ `.git` metadata is readable and valid. These failures stop Search or Add before
232
+ any request is sent to MemoraX.
233
+
150
234
  Codex projectless tasks under its canonical dated-task location intentionally
151
235
  use the shared `Codex-General` memory name. Open a task in a real workspace
152
236
  when repository isolation matters.
153
237
 
154
238
  ## Model-provider requests fail while MemoraX Code is healthy
155
239
 
156
- MemoraX Code does not proxy Codex or Claude Code model requests. If
157
- `memorax-code status` and the relevant client doctor are healthy, inspect the
158
- provider URL, credentials, model selection, and network settings owned by that
159
- client. Do not copy model-provider credentials into
240
+ MemoraX Code does not proxy Codex, Claude Code, DSH, or OpenCode model
241
+ requests. If `memorax-code status` and the available client-specific doctor
242
+ are healthy, inspect the provider URL, credentials, model selection, and
243
+ network settings owned by that client. Do not copy model-provider credentials into
160
244
  `$MEMORAX_CODE_HOME`.
161
245
 
162
246
  ## Safe issue reports
@@ -168,6 +252,8 @@ memorax-code status --json
168
252
  memorax-cli status --json
169
253
  memorax-code-codex doctor --json
170
254
  memorax-code-claude doctor --json
255
+ memorax-code status --clients dsh --json
256
+ memorax-code-opencode doctor --json
171
257
  ```
172
258
 
173
259
  Include the MemoraX Code version, operating system, affected client,
@@ -0,0 +1,22 @@
1
+ import { existsSync } from "node:fs";
2
+ import { dirname, join, resolve } from "node:path";
3
+ import { fileURLToPath, pathToFileURL } from "node:url";
4
+
5
+ const packageLib = dirname(fileURLToPath(import.meta.url));
6
+ const stagedLifecycle = join(
7
+ packageLib,
8
+ "memorax-code-dsh-adapter",
9
+ "src",
10
+ "profile-lifecycle.mjs",
11
+ );
12
+ const sourceLifecycle = resolve(
13
+ packageLib,
14
+ "../../../ts/memorax-code-dsh-adapter/src/profile-lifecycle.mjs",
15
+ );
16
+ const lifecycle = await import(
17
+ pathToFileURL(existsSync(stagedLifecycle) ? stagedLifecycle : sourceLifecycle).href
18
+ );
19
+
20
+ export const collectDshAdapterStatus = lifecycle.collectDshAdapterStatus;
21
+ export const discoverDshProfiles = lifecycle.discoverDshProfiles;
22
+ export const withDshPluginLifecycleLock = lifecycle.withDshPluginLifecycleLock;
@@ -10,6 +10,18 @@ import {
10
10
 
11
11
  export async function runCaptureCwdHook(options) {
12
12
  const input = await readStdinJson();
13
+ const record = recordWorkspaceEvidence(options, input);
14
+ if (!record) return;
15
+
16
+ if (record.cwd) {
17
+ const pluginDataPath = pluginDataWorkspacePath();
18
+ if (pluginDataPath) writeWorkspaceState(pluginDataPath, record, options);
19
+ }
20
+ writeSessionRegistry(memoraxCodeSessionRegistryPath(options), record, options);
21
+ return input;
22
+ }
23
+
24
+ export function recordWorkspaceEvidence(options, input) {
13
25
  const transcriptPath = stringOption(input.transcript_path) ?? stringOption(input.transcriptPath);
14
26
  if (options.requireTranscriptPathForTurnEvents && isTurnScopedEvent(input) && !transcriptPath) return;
15
27
  const cwd = typeof input.cwd === "string" && input.cwd.trim()
@@ -24,19 +36,12 @@ export async function runCaptureCwdHook(options) {
24
36
  capturedAt: new Date().toISOString(),
25
37
  };
26
38
 
27
- const registryPath = memoraxCodeSessionRegistryPath(options);
28
-
29
39
  if (cwd) {
30
- const targets = [
31
- memoraxCodeWorkspacePath(options),
32
- pluginDataWorkspacePath(),
33
- ].filter(Boolean);
34
-
35
- for (const target of targets) writeWorkspaceState(target, record, options);
40
+ const workspacePath = memoraxCodeWorkspacePath(options);
41
+ if (workspacePath) writeWorkspaceState(workspacePath, record, options);
36
42
  }
37
43
 
38
- writeSessionRegistry(registryPath, record, options);
39
- return input;
44
+ return record;
40
45
  }
41
46
 
42
47
  function isTurnScopedEvent(input) {
@@ -45,17 +50,19 @@ function isTurnScopedEvent(input) {
45
50
  }
46
51
 
47
52
  function memoraxCodeWorkspacePath(options) {
48
- const home = memoraxCodeHome();
53
+ const home = memoraxCodeHome(options);
49
54
  return home ? join(home, "adapters", options.adapterDir, "workspaces.json") : undefined;
50
55
  }
51
56
 
52
57
  function memoraxCodeSessionRegistryPath(options) {
53
- const home = memoraxCodeHome();
58
+ const home = memoraxCodeHome(options);
54
59
  return home ? join(home, "adapters", options.adapterDir, "session-registry.json") : undefined;
55
60
  }
56
61
 
57
- function memoraxCodeHome() {
58
- return process.env.MEMORAX_CODE_HOME || (process.env.HOME ? join(process.env.HOME, ".memorax-code") : undefined);
62
+ function memoraxCodeHome(options) {
63
+ return stringOption(options.memoraxCodeHome)
64
+ ?? stringOption(process.env.MEMORAX_CODE_HOME)
65
+ ?? (process.env.HOME ? join(process.env.HOME, ".memorax-code") : undefined);
59
66
  }
60
67
 
61
68
  function pluginDataWorkspacePath() {
@@ -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
+ }