@memorax/memorax-code 0.1.0

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 (282) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +53 -0
  3. package/bin/memorax-cli.mjs +28 -0
  4. package/bin/memorax-code-backend.mjs +4 -0
  5. package/bin/memorax-code-claude.mjs +4 -0
  6. package/bin/memorax-code-codex.mjs +4 -0
  7. package/bin/memorax-code-npm-preinstall.mjs +55 -0
  8. package/bin/memorax-code-plugin-postinstall.mjs +1236 -0
  9. package/bin/memorax-code.mjs +204 -0
  10. package/docs/configuration.md +232 -0
  11. package/docs/troubleshooting.md +179 -0
  12. package/lib/client-hook-runtime.mjs +32 -0
  13. package/lib/memorax-code-adapter-common/src/backend-connection.d.mts +111 -0
  14. package/lib/memorax-code-adapter-common/src/backend-connection.mjs +304 -0
  15. package/lib/memorax-code-adapter-common/src/clients/claude-command.mjs +38 -0
  16. package/lib/memorax-code-adapter-common/src/clients/codex-command.mjs +41 -0
  17. package/lib/memorax-code-adapter-common/src/clients/codex-plugin-artifact.d.mts +3 -0
  18. package/lib/memorax-code-adapter-common/src/clients/codex-plugin-artifact.mjs +38 -0
  19. package/lib/memorax-code-adapter-common/src/config-utils.d.mts +27 -0
  20. package/lib/memorax-code-adapter-common/src/config-utils.mjs +391 -0
  21. package/lib/memorax-code-adapter-common/src/hooks/capture-cwd-hook.mjs +137 -0
  22. package/lib/memorax-code-adapter-common/src/hooks/client-hook-launcher.mjs +324 -0
  23. package/lib/memorax-code-adapter-common/src/hooks/ensure-backend-runner.mjs +142 -0
  24. package/lib/memorax-code-adapter-common/src/hooks/hook-runtime-generation.d.mts +38 -0
  25. package/lib/memorax-code-adapter-common/src/hooks/hook-runtime-generation.mjs +501 -0
  26. package/lib/memorax-code-adapter-common/src/hooks/memory-skill-reminder-hook.mjs +277 -0
  27. package/lib/memorax-code-adapter-common/src/memorax-code-config-file.d.mts +28 -0
  28. package/lib/memorax-code-adapter-common/src/memorax-code-config-file.mjs +296 -0
  29. package/lib/memorax-code-adapter-common/src/memorax-defaults.d.mts +10 -0
  30. package/lib/memorax-code-adapter-common/src/memorax-defaults.mjs +12 -0
  31. package/lib/memorax-code-adapter-common/src/repo-memory/repo-memory-job-context.mjs +28 -0
  32. package/lib/memorax-code-adapter-common/src/repo-memory/repo-memory-job-marker.mjs +252 -0
  33. package/lib/memorax-code-adapter-common/src/repo-memory/repo-memory-job-supervisor.mjs +559 -0
  34. package/lib/memorax-code-adapter-common/src/repo-memory/repo-memory-job-worker.mjs +411 -0
  35. package/lib/memorax-code-adapter-common/src/repo-memory/repo-memory-update-policy-evaluator.mjs +185 -0
  36. package/lib/memorax-code-adapter-common/src/repo-memory/repo-memory-update-policy.mjs +165 -0
  37. package/lib/memorax-code-adapter-common/src/repo-memory/repo-procedure-memory-context.mjs +181 -0
  38. package/lib/memorax-code-adapter-common/src/repo-memory/repo-user-profile-context.mjs +251 -0
  39. package/lib/memorax-code-adapter-common/src/runtime-record.d.mts +55 -0
  40. package/lib/memorax-code-adapter-common/src/runtime-record.mjs +152 -0
  41. package/lib/memorax-code-adapter-common/src/windows-cli-invocation.mjs +100 -0
  42. package/lib/memorax-code-backend/dist/active-client-selection.js +35 -0
  43. package/lib/memorax-code-backend/dist/adapter-lifecycle-participant.js +1 -0
  44. package/lib/memorax-code-backend/dist/automatic-memory-retrieval.js +113 -0
  45. package/lib/memorax-code-backend/dist/automatic-memory-writeback.js +297 -0
  46. package/lib/memorax-code-backend/dist/backend-env.js +13 -0
  47. package/lib/memorax-code-backend/dist/backend-lifecycle-lock.js +42 -0
  48. package/lib/memorax-code-backend/dist/backend-process.js +147 -0
  49. package/lib/memorax-code-backend/dist/backend-service-cleanup.js +18 -0
  50. package/lib/memorax-code-backend/dist/backend-service-record.js +206 -0
  51. package/lib/memorax-code-backend/dist/backend-service-result.js +37 -0
  52. package/lib/memorax-code-backend/dist/backend-service-token.js +11 -0
  53. package/lib/memorax-code-backend/dist/backend-shutdown-request.js +133 -0
  54. package/lib/memorax-code-backend/dist/backend-state.js +58 -0
  55. package/lib/memorax-code-backend/dist/backend-status.js +53 -0
  56. package/lib/memorax-code-backend/dist/backend-token-record.js +79 -0
  57. package/lib/memorax-code-backend/dist/claude-adapter-lifecycle.js +134 -0
  58. package/lib/memorax-code-backend/dist/claude-local-transcript.js +648 -0
  59. package/lib/memorax-code-backend/dist/claude-memory-hook-runtime.js +472 -0
  60. package/lib/memorax-code-backend/dist/claude-transcript-turn.js +876 -0
  61. package/lib/memorax-code-backend/dist/client-plugin-removal.js +67 -0
  62. package/lib/memorax-code-backend/dist/client-selection.js +36 -0
  63. package/lib/memorax-code-backend/dist/codex-adapter-lifecycle.js +131 -0
  64. package/lib/memorax-code-backend/dist/codex-effective-prompt.js +54 -0
  65. package/lib/memorax-code-backend/dist/codex-memory-hook-runtime.js +541 -0
  66. package/lib/memorax-code-backend/dist/codex-plugin-hooks.js +421 -0
  67. package/lib/memorax-code-backend/dist/codex-plugin-install.js +523 -0
  68. package/lib/memorax-code-backend/dist/codex-rollout-turn.js +402 -0
  69. package/lib/memorax-code-backend/dist/codex-session-turn-index.js +88 -0
  70. package/lib/memorax-code-backend/dist/codex-workspace-links.js +55 -0
  71. package/lib/memorax-code-backend/dist/debug-log.js +21 -0
  72. package/lib/memorax-code-backend/dist/entrypoint.js +14 -0
  73. package/lib/memorax-code-backend/dist/incremental-jsonl-projection.js +271 -0
  74. package/lib/memorax-code-backend/dist/install-watchdog.js +71 -0
  75. package/lib/memorax-code-backend/dist/jsonl-append.js +75 -0
  76. package/lib/memorax-code-backend/dist/memorax-adapter.js +451 -0
  77. package/lib/memorax-code-backend/dist/memorax-cli.js +14 -0
  78. package/lib/memorax-code-backend/dist/memorax-code-config.js +279 -0
  79. package/lib/memorax-code-backend/dist/memorax-code-lifecycle.js +523 -0
  80. package/lib/memorax-code-backend/dist/memorax-code.js +3 -0
  81. package/lib/memorax-code-backend/dist/memorax-config.js +283 -0
  82. package/lib/memorax-code-backend/dist/memorax-http.js +142 -0
  83. package/lib/memorax-code-backend/dist/memory-cli.js +345 -0
  84. package/lib/memorax-code-backend/dist/memory-hook-command.js +200 -0
  85. package/lib/memorax-code-backend/dist/memory-observability.js +1 -0
  86. package/lib/memorax-code-backend/dist/memory-project.js +89 -0
  87. package/lib/memorax-code-backend/dist/memory-reminder-trace-recorder.js +58 -0
  88. package/lib/memorax-code-backend/dist/memory-service.js +66 -0
  89. package/lib/memorax-code-backend/dist/memory-turn-coordinator.js +139 -0
  90. package/lib/memorax-code-backend/dist/memory-viewer-activity.js +113 -0
  91. package/lib/memorax-code-backend/dist/memory-viewer-data-projection-cache.js +69 -0
  92. package/lib/memorax-code-backend/dist/memory-viewer-event-identity.js +3 -0
  93. package/lib/memorax-code-backend/dist/memory-viewer-history-projection.js +79 -0
  94. package/lib/memorax-code-backend/dist/memory-viewer-logo.js +1 -0
  95. package/lib/memorax-code-backend/dist/memory-viewer-observability.js +8 -0
  96. package/lib/memorax-code-backend/dist/memory-viewer-redaction.js +52 -0
  97. package/lib/memorax-code-backend/dist/memory-viewer-session-title.js +93 -0
  98. package/lib/memorax-code-backend/dist/memory-viewer-store.js +964 -0
  99. package/lib/memorax-code-backend/dist/memory-viewer-turn-reference.js +12 -0
  100. package/lib/memorax-code-backend/dist/memory-viewer-user-html.js +115 -0
  101. package/lib/memorax-code-backend/dist/memory-viewer-user-projection.js +168 -0
  102. package/lib/memorax-code-backend/dist/memory-viewer-writeback-status.js +97 -0
  103. package/lib/memorax-code-backend/dist/memory-writeback-buffer.js +217 -0
  104. package/lib/memorax-code-backend/dist/memory-writeback-chunk.js +120 -0
  105. package/lib/memorax-code-backend/dist/memory-writeback-reconciler.js +244 -0
  106. package/lib/memorax-code-backend/dist/memory-writeback-task-projection.js +377 -0
  107. package/lib/memorax-code-backend/dist/proxy-env.js +54 -0
  108. package/lib/memorax-code-backend/dist/repo-memory-readiness.js +188 -0
  109. package/lib/memorax-code-backend/dist/repository-memory-context.js +134 -0
  110. package/lib/memorax-code-backend/dist/repository-memory-scope.js +490 -0
  111. package/lib/memorax-code-backend/dist/server-cli.js +787 -0
  112. package/lib/memorax-code-backend/dist/server-health.js +16 -0
  113. package/lib/memorax-code-backend/dist/server-http.js +110 -0
  114. package/lib/memorax-code-backend/dist/server-json.js +4 -0
  115. package/lib/memorax-code-backend/dist/server-memory-hook.js +32 -0
  116. package/lib/memorax-code-backend/dist/server-memory-viewer.js +135 -0
  117. package/lib/memorax-code-backend/dist/server-observability.js +102 -0
  118. package/lib/memorax-code-backend/dist/server.js +220 -0
  119. package/lib/memorax-code-backend/dist/service-entrypoint.js +10 -0
  120. package/lib/memorax-code-backend/dist/service.js +567 -0
  121. package/lib/memorax-code-backend/dist/trace-config.js +112 -0
  122. package/lib/memorax-code-backend/dist/trace-context.js +111 -0
  123. package/lib/memorax-code-backend/dist/trace-store.js +571 -0
  124. package/lib/memorax-code-backend/dist/utils.js +3 -0
  125. package/lib/memorax-code-backend/dist/windows-cli-invocation.js +148 -0
  126. package/lib/memorax-code-backend/package.json +26 -0
  127. package/lib/memorax-code-claude-adapter/.claude-plugin/plugin.json +15 -0
  128. package/lib/memorax-code-claude-adapter/hooks/hook-launcher.mjs +27 -0
  129. package/lib/memorax-code-claude-adapter/hooks/hooks.json +66 -0
  130. package/lib/memorax-code-claude-adapter/hooks/repo-memory-job.mjs +37 -0
  131. package/lib/memorax-code-claude-adapter/hooks/runtime-hook.mjs +4 -0
  132. package/lib/memorax-code-claude-adapter/hooks/runtime-shell.json +5 -0
  133. package/lib/memorax-code-claude-adapter/package.json +13 -0
  134. package/lib/memorax-code-claude-adapter/runtime-hooks/capture-cwd.mjs +17 -0
  135. package/lib/memorax-code-claude-adapter/runtime-hooks/ensure-backend.mjs +59 -0
  136. package/lib/memorax-code-claude-adapter/runtime-hooks/memory-cli-session.mjs +33 -0
  137. package/lib/memorax-code-claude-adapter/runtime-hooks/memory-skill-reminder.mjs +73 -0
  138. package/lib/memorax-code-claude-adapter/runtime-hooks/memory-turn.mjs +91 -0
  139. package/lib/memorax-code-claude-adapter/scripts/build-marketplace.mjs +99 -0
  140. package/lib/memorax-code-claude-adapter/skills/memorax-code/SKILL.md +83 -0
  141. package/lib/memorax-code-claude-adapter/skills/memorax-code/agents/claude.yaml +10 -0
  142. package/lib/memorax-code-claude-adapter/skills/memorax-code/agents/openai.yaml +7 -0
  143. package/lib/memorax-code-claude-adapter/skills/memorax-code/defaults.json +9 -0
  144. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/memorax-add.md +82 -0
  145. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/memorax-search.md +61 -0
  146. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/personal-read.md +46 -0
  147. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/personal-write.md +100 -0
  148. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-build.md +270 -0
  149. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-read.md +96 -0
  150. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-templates.md +270 -0
  151. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-update.md +116 -0
  152. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/collect_all.py +496 -0
  153. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/detect_updates.py +856 -0
  154. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/git_commit_facets.py +222 -0
  155. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/github_resource_facets.py +504 -0
  156. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +509 -0
  157. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/prepare_repo_memory.py +411 -0
  158. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/user_profile_memory.py +528 -0
  159. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/validate_memory.py +226 -0
  160. package/lib/memorax-code-claude-adapter/src/adapter-paths.mjs +46 -0
  161. package/lib/memorax-code-claude-adapter/src/cli.mjs +363 -0
  162. package/lib/memorax-code-claude-adapter/src/config-utils.mjs +1 -0
  163. package/lib/memorax-code-claude-adapter/src/config.mjs +544 -0
  164. package/lib/memorax-code-claude-adapter/src/plugin-artifact-contract.mjs +148 -0
  165. package/lib/memorax-code-claude-adapter/src/plugin-install.mjs +566 -0
  166. package/lib/memorax-code-claude-marketplace/.claude-plugin/marketplace.json +15 -0
  167. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/.claude-plugin/plugin.json +15 -0
  168. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/hooks/hook-launcher.mjs +27 -0
  169. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/hooks/hooks.json +66 -0
  170. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/hooks/repo-memory-job.mjs +37 -0
  171. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/hooks/runtime-hook.mjs +4 -0
  172. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/hooks/runtime-shell.json +5 -0
  173. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/backend-connection.d.mts +111 -0
  174. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/backend-connection.mjs +304 -0
  175. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/clients/claude-command.mjs +38 -0
  176. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/clients/codex-command.mjs +41 -0
  177. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/clients/codex-plugin-artifact.d.mts +3 -0
  178. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/clients/codex-plugin-artifact.mjs +38 -0
  179. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/config-utils.d.mts +27 -0
  180. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/config-utils.mjs +391 -0
  181. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/capture-cwd-hook.mjs +137 -0
  182. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/client-hook-launcher.mjs +324 -0
  183. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/ensure-backend-runner.mjs +142 -0
  184. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/hook-runtime-generation.d.mts +38 -0
  185. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/hook-runtime-generation.mjs +501 -0
  186. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/memory-skill-reminder-hook.mjs +277 -0
  187. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/memorax-code-config-file.d.mts +28 -0
  188. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/memorax-code-config-file.mjs +296 -0
  189. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/memorax-defaults.d.mts +10 -0
  190. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/memorax-defaults.mjs +12 -0
  191. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/repo-memory/repo-memory-job-context.mjs +28 -0
  192. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/repo-memory/repo-memory-job-marker.mjs +252 -0
  193. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/repo-memory/repo-memory-job-supervisor.mjs +559 -0
  194. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/repo-memory/repo-memory-job-worker.mjs +411 -0
  195. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/repo-memory/repo-memory-update-policy-evaluator.mjs +185 -0
  196. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/repo-memory/repo-memory-update-policy.mjs +165 -0
  197. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/repo-memory/repo-procedure-memory-context.mjs +181 -0
  198. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/repo-memory/repo-user-profile-context.mjs +251 -0
  199. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/runtime-record.d.mts +55 -0
  200. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/runtime-record.mjs +152 -0
  201. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/windows-cli-invocation.mjs +100 -0
  202. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/package.json +13 -0
  203. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/runtime-hooks/capture-cwd.mjs +17 -0
  204. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/runtime-hooks/ensure-backend.mjs +59 -0
  205. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/runtime-hooks/memory-cli-session.mjs +33 -0
  206. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/runtime-hooks/memory-skill-reminder.mjs +73 -0
  207. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/runtime-hooks/memory-turn.mjs +91 -0
  208. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/scripts/build-marketplace.mjs +99 -0
  209. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/SKILL.md +83 -0
  210. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/agents/claude.yaml +10 -0
  211. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/agents/openai.yaml +7 -0
  212. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/defaults.json +9 -0
  213. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/memorax-add.md +82 -0
  214. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/memorax-search.md +61 -0
  215. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/personal-read.md +46 -0
  216. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/personal-write.md +100 -0
  217. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-build.md +270 -0
  218. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-read.md +96 -0
  219. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-templates.md +270 -0
  220. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-update.md +116 -0
  221. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/collect_all.py +496 -0
  222. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/detect_updates.py +856 -0
  223. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/git_commit_facets.py +222 -0
  224. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/github_resource_facets.py +504 -0
  225. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +509 -0
  226. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/prepare_repo_memory.py +411 -0
  227. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/user_profile_memory.py +528 -0
  228. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/validate_memory.py +226 -0
  229. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/src/adapter-paths.mjs +46 -0
  230. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/src/cli.mjs +363 -0
  231. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/src/config-utils.mjs +1 -0
  232. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/src/config.mjs +544 -0
  233. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/src/plugin-artifact-contract.mjs +148 -0
  234. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/src/plugin-install.mjs +566 -0
  235. package/lib/memorax-code-codex-adapter/.codex-plugin/plugin.json +33 -0
  236. package/lib/memorax-code-codex-adapter/assets/composer-icon.png +0 -0
  237. package/lib/memorax-code-codex-adapter/assets/logo.png +0 -0
  238. package/lib/memorax-code-codex-adapter/hooks/hook-launcher.mjs +26 -0
  239. package/lib/memorax-code-codex-adapter/hooks/hooks.json +61 -0
  240. package/lib/memorax-code-codex-adapter/hooks/repo-memory-job.mjs +38 -0
  241. package/lib/memorax-code-codex-adapter/hooks/repo-memory-update-policy.mjs +10 -0
  242. package/lib/memorax-code-codex-adapter/hooks/runtime-hook.mjs +4 -0
  243. package/lib/memorax-code-codex-adapter/hooks/runtime-shell.json +5 -0
  244. package/lib/memorax-code-codex-adapter/package.json +13 -0
  245. package/lib/memorax-code-codex-adapter/runtime-hooks/capture-cwd.mjs +18 -0
  246. package/lib/memorax-code-codex-adapter/runtime-hooks/ensure-backend.mjs +82 -0
  247. package/lib/memorax-code-codex-adapter/runtime-hooks/memory-skill-reminder.mjs +125 -0
  248. package/lib/memorax-code-codex-adapter/runtime-hooks/memory-writeback.mjs +52 -0
  249. package/lib/memorax-code-codex-adapter/skills/memorax-code/SKILL.md +83 -0
  250. package/lib/memorax-code-codex-adapter/skills/memorax-code/agents/claude.yaml +10 -0
  251. package/lib/memorax-code-codex-adapter/skills/memorax-code/agents/openai.yaml +7 -0
  252. package/lib/memorax-code-codex-adapter/skills/memorax-code/defaults.json +9 -0
  253. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/memorax-add.md +82 -0
  254. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/memorax-search.md +61 -0
  255. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/personal-read.md +46 -0
  256. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/personal-write.md +100 -0
  257. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-build.md +270 -0
  258. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-read.md +96 -0
  259. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-templates.md +270 -0
  260. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-update.md +116 -0
  261. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/collect_all.py +496 -0
  262. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/detect_updates.py +856 -0
  263. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/git_commit_facets.py +222 -0
  264. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/github_resource_facets.py +504 -0
  265. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +509 -0
  266. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/prepare_repo_memory.py +411 -0
  267. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/user_profile_memory.py +528 -0
  268. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/validate_memory.py +226 -0
  269. package/lib/memorax-code-codex-adapter/src/adapter-paths.mjs +29 -0
  270. package/lib/memorax-code-codex-adapter/src/cli.mjs +368 -0
  271. package/lib/memorax-code-codex-adapter/src/config-utils.mjs +1 -0
  272. package/lib/memorax-code-codex-adapter/src/config.mjs +226 -0
  273. package/lib/memorax-code-codex-adapter/src/session-registry.mjs +331 -0
  274. package/lib/memorax-code-codex-adapter/src/workspace-kind.mjs +68 -0
  275. package/lib/node-version.mjs +11 -0
  276. package/lib/npm-invocation.mjs +31 -0
  277. package/lib/resolve-claude-command.mjs +47 -0
  278. package/lib/resolve-codex-command.mjs +94 -0
  279. package/lib/run-entrypoint.mjs +83 -0
  280. package/lib/vscode-extension-command.mjs +119 -0
  281. package/lib/windows-cli-invocation.mjs +100 -0
  282. package/package.json +45 -0
@@ -0,0 +1,204 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from "node:child_process";
3
+ import { existsSync, readFileSync } from "node:fs";
4
+ import { homedir } from "node:os";
5
+ import { dirname, join, resolve } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+ import { stagePackagedClientHookRuntime } from "../lib/client-hook-runtime.mjs";
8
+ import { unsupportedNodeVersionMessage } from "../lib/node-version.mjs";
9
+ import { resolveNpmInvocation } from "../lib/npm-invocation.mjs";
10
+ import { runBackendEntrypoint } from "../lib/run-entrypoint.mjs";
11
+
12
+ const nodeVersionError = unsupportedNodeVersionMessage();
13
+ if (nodeVersionError) {
14
+ console.error(`memorax-code: ${nodeVersionError}`);
15
+ process.exit(1);
16
+ }
17
+
18
+ function packageRoot() {
19
+ return dirname(dirname(fileURLToPath(import.meta.url)));
20
+ }
21
+
22
+ function readPackageJson() {
23
+ return JSON.parse(readFileSync(join(packageRoot(), "package.json"), "utf8"));
24
+ }
25
+
26
+ function printUpdateHelp() {
27
+ console.log(`Usage: memorax-code update [--preview | --latest] [--force] [--home DIR] [--dry-run]
28
+
29
+ Update the globally installed MemoraX Code npm package.
30
+
31
+ Options:
32
+ --preview Follow the npm preview dist-tag
33
+ --latest Follow the npm latest dist-tag
34
+ --force Reinstall the selected channel with npm install --force
35
+ --home DIR Update the Backend managed under this MemoraX Code home
36
+ --dry-run Print the npm command without running it
37
+ -h, --help Show this help message`);
38
+ }
39
+
40
+ function printCommand(command, args) {
41
+ console.log([command, ...args].join(" "));
42
+ }
43
+
44
+ function npmCommandCwd() {
45
+ for (const candidate of [process.env.HOME, homedir(), "/"]) {
46
+ if (candidate && existsSync(candidate)) return candidate;
47
+ }
48
+ return "/";
49
+ }
50
+
51
+ async function runUpdateCommand(args) {
52
+ let dryRun = false;
53
+ let force = false;
54
+ let requestedChannel;
55
+ let requestedHome;
56
+
57
+ for (let index = 0; index < args.length; index += 1) {
58
+ const arg = args[index];
59
+ if (arg === "--dry-run") {
60
+ dryRun = true;
61
+ } else if (arg === "--force") {
62
+ force = true;
63
+ } else if (arg === "--home") {
64
+ const value = args[++index];
65
+ if (!value || value.startsWith("--")) {
66
+ console.error("memorax-code update: --home requires a directory");
67
+ printUpdateHelp();
68
+ return 2;
69
+ }
70
+ requestedHome = resolve(value);
71
+ } else if (arg.startsWith("--home=")) {
72
+ const value = arg.slice("--home=".length).trim();
73
+ if (!value) {
74
+ console.error("memorax-code update: --home requires a directory");
75
+ printUpdateHelp();
76
+ return 2;
77
+ }
78
+ requestedHome = resolve(value);
79
+ } else if (arg === "--preview" || arg === "--latest") {
80
+ const channel = arg.slice(2);
81
+ if (requestedChannel && requestedChannel !== channel) {
82
+ console.error("memorax-code update: --preview and --latest cannot be used together");
83
+ printUpdateHelp();
84
+ return 2;
85
+ }
86
+ requestedChannel = channel;
87
+ } else if (arg === "--help" || arg === "-h") {
88
+ printUpdateHelp();
89
+ return 0;
90
+ } else {
91
+ console.error(`memorax-code update: unknown option ${arg}`);
92
+ printUpdateHelp();
93
+ return 2;
94
+ }
95
+ }
96
+
97
+ const pkg = readPackageJson();
98
+ const channel = requestedChannel ?? (pkg.version.includes("-") ? "preview" : "latest");
99
+ const npmArgs = ["install", "-g", `${pkg.name}@${channel}`];
100
+ if (force) npmArgs.push("--force");
101
+ npmArgs.push("--foreground-scripts");
102
+
103
+ if (dryRun) {
104
+ printCommand("npm", npmArgs);
105
+ return 0;
106
+ }
107
+
108
+ console.error(`memorax-code update: running ${["npm", ...npmArgs].join(" ")}`);
109
+ const cwd = npmCommandCwd();
110
+ let invocation;
111
+ try {
112
+ invocation = resolveNpmInvocation(npmArgs);
113
+ } catch (error) {
114
+ console.error(`memorax-code update: ${error instanceof Error ? error.message : String(error)}`);
115
+ return 1;
116
+ }
117
+ const child = spawn(invocation.command, invocation.args, {
118
+ stdio: "inherit",
119
+ cwd,
120
+ env: {
121
+ ...process.env,
122
+ PWD: cwd,
123
+ MEMORAX_CODE_NPM_POSTINSTALL_UPDATE: "1",
124
+ ...(requestedHome ? { MEMORAX_CODE_HOME: requestedHome } : {}),
125
+ },
126
+ });
127
+ return await new Promise((resolve) => {
128
+ child.on("error", (error) => {
129
+ console.error(`memorax-code update: failed to start npm: ${error.message}`);
130
+ resolve(1);
131
+ });
132
+ child.on("close", (code, signal) => {
133
+ if (signal) {
134
+ console.error(`memorax-code update: npm exited from signal ${signal}`);
135
+ resolve(1);
136
+ } else {
137
+ resolve(code ?? 1);
138
+ }
139
+ });
140
+ });
141
+ }
142
+
143
+ if (process.argv[2] === "update") {
144
+ process.exit(await runUpdateCommand(process.argv.slice(3)));
145
+ }
146
+
147
+ if (process.argv[2] === "--version" || process.argv[2] === "-v") {
148
+ const pkg = readPackageJson();
149
+ console.log(`memorax-code ${pkg.version}`);
150
+ process.exit(0);
151
+ }
152
+
153
+ if (shouldStageClientHookRuntime(process.argv.slice(2))
154
+ && !truthyEnv(process.env.MEMORAX_CODE_DEFER_CLIENT_HOOK_RUNTIME_ACTIVATION)) {
155
+ try {
156
+ const memoraxCodeHome = requestedMemoraxCodeHome(process.argv.slice(2));
157
+ const generation = await stagePackagedClientHookRuntime({
158
+ packageRoot: packageRoot(),
159
+ memoraxCodeHome,
160
+ });
161
+ process.env.MEMORAX_CODE_PENDING_CLIENT_HOOK_RUNTIME_V1 = JSON.stringify({
162
+ version: 1,
163
+ memoraxCodeHome,
164
+ generation: {
165
+ version: generation.version,
166
+ runtimeAbi: generation.runtimeAbi,
167
+ generationId: generation.generationId,
168
+ packageVersion: generation.packageVersion,
169
+ contentDigest: generation.contentDigest,
170
+ createdAt: generation.createdAt,
171
+ },
172
+ });
173
+ } catch (error) {
174
+ console.error(`memorax-code: failed to stage client Hook runtime: ${error instanceof Error ? error.message : String(error)}`);
175
+ process.exit(1);
176
+ }
177
+ }
178
+
179
+ await runBackendEntrypoint("memorax-code.js");
180
+
181
+ function shouldStageClientHookRuntime(args) {
182
+ if (args.includes("--help") || args.includes("-h")) return false;
183
+ return args[0] === "start" || args[0] === "restart";
184
+ }
185
+
186
+ function requestedMemoraxCodeHome(args) {
187
+ const inline = args.find((arg) => arg.startsWith("--home="));
188
+ if (inline) {
189
+ const value = inline.slice("--home=".length);
190
+ if (!value.trim()) throw new Error("--home requires a directory");
191
+ return resolve(value);
192
+ }
193
+ const index = args.indexOf("--home");
194
+ if (index >= 0) {
195
+ const value = args[index + 1];
196
+ if (!value || value.startsWith("--")) throw new Error("--home requires a directory");
197
+ return resolve(value);
198
+ }
199
+ return resolve(process.env.MEMORAX_CODE_HOME || join(homedir(), ".memorax-code"));
200
+ }
201
+
202
+ function truthyEnv(value) {
203
+ return ["1", "true", "yes"].includes(String(value ?? "").trim().toLowerCase());
204
+ }
@@ -0,0 +1,232 @@
1
+ # Configuration
2
+
3
+ MemoraX Code reads persistent configuration from:
4
+
5
+ ```text
6
+ $MEMORAX_CODE_HOME/config.toml
7
+ ```
8
+
9
+ `MEMORAX_CODE_HOME` defaults to `~/.memorax-code`. There is no separate
10
+ configuration-path setting. Treat the whole file as private: it can contain a
11
+ MemoraX API key and must not be committed or pasted into public issues.
12
+
13
+ ## Precedence and reload behavior
14
+
15
+ Where a setting supports every layer, precedence is:
16
+
17
+ ```text
18
+ explicit command/context value > environment variable > config.toml > code fallback
19
+ ```
20
+
21
+ Use `config.toml` for durable choices and environment variables for temporary
22
+ overrides or credentials that should not be written to disk. After editing the
23
+ file, run:
24
+
25
+ ```sh
26
+ memorax-code start
27
+ memorax-code status
28
+ memorax-cli status
29
+ ```
30
+
31
+ This reconciles the managed Backend and client integrations. Some Hook and CLI
32
+ processes reread configuration sooner, but `memorax-code start` is the
33
+ supported consistency boundary.
34
+
35
+ TOML booleans are `true` or `false`. Environment booleans accept
36
+ `true/false`, `1/0`, `yes/no`, and `on/off`. Unknown fields are ignored and
37
+ are not a compatibility contract.
38
+
39
+ ## New configuration
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.
47
+
48
+ On POSIX systems MemoraX Code creates `$MEMORAX_CODE_HOME` with mode `0700`
49
+ and a new `config.toml` with mode `0600`. Windows relies on the current user's
50
+ filesystem ACLs.
51
+
52
+ ## Client selection
53
+
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:
57
+
58
+ ```text
59
+ --clients codex|claude|codex,claude|all|none
60
+ ```
61
+
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.
65
+
66
+ ## MemoraX connection
67
+
68
+ MemoraX is the required remote-memory service:
69
+
70
+ ```toml
71
+ [memorax]
72
+ endpoint = "https://platform.memorax.net"
73
+ user_id = "your-base-user-id"
74
+ api_key = "your-api-key"
75
+ # timeout_ms = 5000
76
+ # startup_timeout_ms = 3000
77
+ ```
78
+
79
+ | Field | Environment override | Fallback |
80
+ | --- | --- | --- |
81
+ | `endpoint` | `MEMORAX_CODE_MEMORAX_ENDPOINT` | `https://platform.memorax.net` |
82
+ | `user_id` | `MEMORAX_CODE_MEMORAX_USER_ID` | required |
83
+ | `api_key` | `MEMORAX_CODE_MEMORAX_API_KEY` | required |
84
+ | `timeout_ms` | `MEMORAX_CODE_MEMORAX_TIMEOUT_MS` | `5000` ms |
85
+ | `startup_timeout_ms` | `MEMORAX_CODE_MEMORAX_STARTUP_TIMEOUT_MS` | `3000` ms |
86
+
87
+ MemoraX requests send the API key and the query or content required by the
88
+ selected memory operation to the HTTPS endpoint. Override `endpoint` only with
89
+ a compatible MemoraX service you trust.
90
+
91
+ `startup_timeout_ms` controls synchronous automatic retrieval and is capped at
92
+ 10 seconds. `user_id` is a base identity; MemoraX Code derives a
93
+ repository-scoped identity for Git workspaces and a folder-scoped identity for
94
+ non-Git workspaces. It never falls back to the unscoped base identity.
95
+
96
+ ## Retrieval
97
+
98
+ Automatic prompt retrieval is disabled by default.
99
+
100
+ | Field | Environment override | Fallback |
101
+ | --- | --- | --- |
102
+ | `enabled` | `MEMORAX_CODE_MEMORY_RETRIEVAL_ENABLED` | `false` |
103
+ | `top_k` | `MEMORAX_CODE_MEMORAX_TOP_K` | `6` |
104
+ | `k_dense` | `MEMORAX_CODE_MEMORAX_K_DENSE` | effective `top_k` |
105
+ | `k_sparse` | `MEMORAX_CODE_MEMORAX_K_SPARSE` | effective `top_k`; `0` disables sparse |
106
+ | `min_score` | `MEMORAX_CODE_MEMORAX_MIN_SCORE` | unset; range `0..1` |
107
+ | `max_context_chars` | `MEMORAX_CODE_MEMORAX_MAX_CONTEXT_CHARS` | `4000` |
108
+ | `max_item_chars` | `MEMORAX_CODE_MEMORAX_MAX_ITEM_CHARS` | `1000` |
109
+ | `render_by_memory_type` | `MEMORAX_CODE_MEMORAX_RENDER_BY_MEMORY_TYPE` | `true` |
110
+ | `memory_type_order` | `MEMORAX_CODE_MEMORAX_MEMORY_TYPE_ORDER` | `core,episodic,semantic,procedural,unclassified` |
111
+
112
+ 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
115
+ credentials and a trusted workspace scope resolve.
116
+
117
+ ## Writeback and explicit add
118
+
119
+ New configurations explicitly set automatic transcript writeback to enabled.
120
+ An existing configuration without `enabled` remains disabled.
121
+
122
+ | Field | Environment override | Fallback |
123
+ | --- | --- | --- |
124
+ | `enabled` | `MEMORAX_CODE_MEMORY_WRITEBACK_ENABLED` | `false` when absent |
125
+ | `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 |
127
+ | `buffer_max_age_ms` | `MEMORAX_CODE_MEMORY_WRITEBACK_BUFFER_MAX_AGE_MS` | `600000` |
128
+ | `buffer_max_chars` | `MEMORAX_CODE_MEMORY_WRITEBACK_BUFFER_MAX_CHARS` | `128000` |
129
+ | `max_message_chars` | `MEMORAX_CODE_MEMORY_WRITEBACK_MAX_MESSAGE_CHARS` | `64000` |
130
+ | `chunk_enabled` | `MEMORAX_CODE_MEMORY_WRITEBACK_CHUNK_ENABLED` | `true` |
131
+ | `chunk_max_chars` | `MEMORAX_CODE_MEMORY_WRITEBACK_CHUNK_MAX_CHARS` | `8000` |
132
+ | `chunk_overlap_ratio` | `MEMORAX_CODE_MEMORY_WRITEBACK_CHUNK_OVERLAP_RATIO` | `0.05`; range `0 <= x < 1` |
133
+
134
+ The global kill switch
135
+ `MEMORAX_CODE_MEMORAX_WRITEBACK_ENABLED=false` disables automatic writeback and
136
+ explicit `memory add`.
137
+
138
+ | Field | Environment override | Fallback |
139
+ | --- | --- | --- |
140
+ | `memory.add.content_type` | `MEMORAX_CODE_MEMORAX_ADD_CONTENT_TYPE` | command-dependent |
141
+ | `memory.add.mode` | `MEMORAX_CODE_MEMORAX_ADD_MODE` | command-dependent |
142
+ | `memory.add.output_language` | `MEMORAX_CODE_MEMORY_OUTPUT_LANGUAGE` | `zh` |
143
+ | `memory.cli.add_enabled` | `MEMORAX_CODE_MEMORY_CLI_ADD_ENABLED` | `true` |
144
+ | `memory.cli.max_memory_chars` | `MEMORAX_CODE_MEMORY_CLI_MAX_MEMORY_CHARS` | `2000` |
145
+
146
+ `output_language` accepts only `zh` or `en`. It is a local user preference,
147
+ not a model-controlled request option; every automatic and explicit add sends
148
+ the resolved value to MemoraX. Invalid values fail closed instead of silently
149
+ selecting another language. The setting affects newly generated content;
150
+ `raw` input and client-supplied `pre_summarized` text are not translated.
151
+ Command arguments override the other add defaults.
152
+
153
+ ## Skill reminder and repository maintenance
154
+
155
+ `[memory.skill_reminder].interval_turns` defaults to `5`; its environment
156
+ 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.
159
+
160
+ | Field | Environment override | Fallback |
161
+ | --- | --- | --- |
162
+ | `policy` | `MEMORAX_CODE_REPO_MEMORY_UPDATE_POLICY` | `adaptive` |
163
+ | `commit_threshold` | `MEMORAX_CODE_REPO_MEMORY_STALE_COMMIT_THRESHOLD` | `5` |
164
+ | `cooldown_hours` | `MEMORAX_CODE_REPO_MEMORY_UPDATE_COOLDOWN_HOURS` | `24` |
165
+
166
+ Supported policies are `every-commit`, `commit-count`, `daily`,
167
+ `pull-request`, `pull-request-or-daily`, and `adaptive`. Invalid policy values
168
+ fall back to `adaptive`.
169
+
170
+ ## Local traces
171
+
172
+ `[trace.codex]` and `[trace.claude]` support the same fields:
173
+
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` |
181
+
182
+ Content capture can include prompts, responses, recalled memory, writeback
183
+ content, reminder text, and local paths. Set `capture_content=false` for
184
+ metadata-only local traces, or `enabled=false` to disable a client's trace.
185
+ Trace files stay under `$MEMORAX_CODE_HOME`; MemoraX Code has no trace upload,
186
+ export, or public collector.
187
+
188
+ ## Backend runtime settings
189
+
190
+ Backend connection and process authority is not stored in `config.toml`.
191
+ Common operator settings are:
192
+
193
+ | Environment | Purpose |
194
+ | --- | --- |
195
+ | `MEMORAX_CODE_HOME` | Select the state and configuration root |
196
+ | `MEMORAX_CODE_BACKEND_URL` | Override the Backend URL for one command or Hook |
197
+ | `MEMORAX_CODE_BACKEND_HOST` / `MEMORAX_CODE_BACKEND_PORT` | Select the managed bind; default `127.0.0.1:8787` |
198
+ | `MEMORAX_CODE_BACKEND_TOKEN` | Supply a transient Backend token |
199
+ | `MEMORAX_CODE_BACKEND_MODE` | Select explicit local or server behavior |
200
+ | `MEMORAX_CODE_BACKEND_ALLOW_EXTERNAL` | Allow an explicitly intended non-loopback bind |
201
+ | `MEMORAX_CODE_BACKEND_LOOPBACK_AUTH` | Control token use on loopback |
202
+ | `MEMORAX_CODE_BACKEND_LOG` | Override the managed Backend log path |
203
+
204
+ External binds fail unless explicitly allowed and protected by a Backend
205
+ token. Persistent connection, token, and PID records live under
206
+ `$MEMORAX_CODE_HOME/runtime/backend/`; do not hand-edit them.
207
+
208
+ ## Failure behavior and diagnostics
209
+
210
+ - Missing `config.toml` is treated as an empty configuration and can be seeded
211
+ on startup.
212
+ - Malformed TOML, a non-table root, or invalid `[clients]` types block
213
+ lifecycle mutations before adapters or processes are changed.
214
+ - Ordinary memory and trace readers use safe fallbacks when the file cannot be
215
+ read or parsed; memory readers may also warn. Unsupported field types are
216
+ ignored.
217
+ - Targeted configuration updates preserve unrelated and unknown TOML content.
218
+ - Invalid or unsupported Backend runtime records fail closed instead of
219
+ silently falling back to `127.0.0.1:8787`.
220
+
221
+ Use these commands before editing state manually:
222
+
223
+ ```sh
224
+ memorax-code status
225
+ memorax-code status --json
226
+ memorax-cli status
227
+ memorax-cli status --json
228
+ memorax-code-codex doctor
229
+ memorax-code-claude doctor
230
+ ```
231
+
232
+ The status commands do not print the MemoraX API key or Backend token.
@@ -0,0 +1,179 @@
1
+ # Troubleshooting
2
+
3
+ Start with the user-facing diagnostics:
4
+
5
+ ```sh
6
+ memorax-code status
7
+ memorax-cli status
8
+ memorax-code-codex doctor
9
+ memorax-code-claude doctor
10
+ memorax-code logs
11
+ ```
12
+
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.
16
+
17
+ ## Installed, but memory is unavailable
18
+
19
+ The package and Backend can be healthy while MemoraX remains unconfigured. Run:
20
+
21
+ ```sh
22
+ memorax-cli status
23
+ ```
24
+
25
+ Configure `endpoint`, `user_id`, and `api_key` under `[memorax]` in
26
+ `$MEMORAX_CODE_HOME/config.toml`, or set their environment equivalents. The
27
+ current default endpoint is `https://platform.memorax.net`.
28
+
29
+ After changing persistent configuration:
30
+
31
+ ```sh
32
+ memorax-code start
33
+ memorax-cli status
34
+ ```
35
+
36
+ Automatic retrieval is disabled by default and is independent from explicit
37
+ search. Automatic writeback requires `[memory.writeback] enabled = true` and
38
+ must not be disabled by
39
+ `MEMORAX_CODE_MEMORAX_WRITEBACK_ENABLED=false`.
40
+
41
+ ## Backend does not start
42
+
43
+ ```sh
44
+ memorax-code status
45
+ memorax-code logs
46
+ memorax-code start
47
+ ```
48
+
49
+ Check the reported bind address, port, and error code. The default is
50
+ `127.0.0.1:8787`; another process may already own that port. A non-loopback
51
+ bind is rejected unless external access is explicitly enabled and a Backend
52
+ token is configured.
53
+
54
+ If `status` reports an invalid or unsupported connection authority, MemoraX
55
+ Code deliberately does not fall back to port 8787. `memorax-code stop` remains
56
+ available. After confirming the intended local address, recover with:
57
+
58
+ ```sh
59
+ memorax-code start --host 127.0.0.1 --port <intended-port>
60
+ ```
61
+
62
+ The persisted authority changes only after the Backend becomes healthy. A
63
+ one-off `--backend-url` or `MEMORAX_CODE_BACKEND_URL` override does not rewrite
64
+ it.
65
+
66
+ To rotate a Backend token:
67
+
68
+ ```sh
69
+ memorax-code stop
70
+ memorax-code token --rotate
71
+ memorax-code start
72
+ ```
73
+
74
+ Rotation is rejected while the managed Backend is running.
75
+
76
+ Lifecycle state and locks fail closed when process ownership is uncertain.
77
+ Do not delete PID or lock files while a process or lifecycle command may still
78
+ be active. Let concurrent work finish, then rerun `memorax-code status`.
79
+
80
+ ## Codex plugin or Hook is inactive
81
+
82
+ ```sh
83
+ memorax-code codex-plugin install
84
+ memorax-code codex-plugin activate --yes
85
+ memorax-code codex-plugin trust-hooks
86
+ memorax-code start --clients codex
87
+ memorax-code-codex doctor
88
+ ```
89
+
90
+ Codex requires review for new or changed Hook command hashes. A declined or
91
+ non-interactive update can leave Hooks untrusted even though the update
92
+ succeeded. Do not write trust entries directly. If the skill is missing, rerun
93
+ `memorax-code start --clients codex`, then restart or refresh Codex.
94
+
95
+ ## Claude Code plugin or Hook is inactive
96
+
97
+ ```sh
98
+ memorax-code start --clients claude
99
+ memorax-code-claude doctor
100
+ ```
101
+
102
+ This reconciles the Claude Code marketplace plugin and Hooks. If the plugin is
103
+ still missing or stale, restart or refresh Claude Code. Do not manually copy
104
+ Hooks into Claude settings.
105
+
106
+ An already-open client may keep its loaded plugin shell while a later prompt
107
+ uses the updated Hook runtime. Restart or refresh the client to load a changed
108
+ plugin manifest, icon, or bundled skill.
109
+
110
+ ## Hooks cannot reach localhost on macOS
111
+
112
+ If shell requests work but Hook diagnostics fail, a global proxy or client
113
+ environment may be intercepting `127.0.0.1` or `localhost`.
114
+
115
+ ```sh
116
+ memorax-code start
117
+ memorax-code-codex doctor
118
+ memorax-code-claude doctor
119
+ /usr/sbin/scutil --proxy
120
+ /bin/launchctl getenv NO_PROXY
121
+ /bin/launchctl getenv no_proxy
122
+ ```
123
+
124
+ Correct the proxy or process environment, then fully quit and reopen the
125
+ client. MemoraX Code does not edit system proxy settings or login
126
+ environments. Redact proxy details before sharing diagnostics.
127
+
128
+ ## MemoraX search, add, or scope fails
129
+
130
+ ```sh
131
+ memorax-cli status
132
+ memorax-cli search --query 'test'
133
+ memorax-code-codex doctor
134
+ memorax-code-claude doctor
135
+ ```
136
+
137
+ Common causes are:
138
+
139
+ - missing or invalid MemoraX endpoint, base user ID, or API key;
140
+ - the global writeback kill switch or CLI add switch disabling `memory add`;
141
+ - no trusted workspace for the current session;
142
+ - an unreadable, malformed, or symlinked Git marker;
143
+ - one live session attempting to change to a different repository/workspace;
144
+ - local DNS, proxy, or network failure.
145
+
146
+ MemoraX Code reads filesystem Git metadata without executing Git. Linked
147
+ worktrees share the remote repository identity; non-Git workspaces use the
148
+ normalized folder name. Resolution never falls back to the bare base user ID.
149
+
150
+ Codex projectless tasks under its canonical dated-task location intentionally
151
+ use the shared `Codex-General` memory name. Open a task in a real workspace
152
+ when repository isolation matters.
153
+
154
+ ## Model-provider requests fail while MemoraX Code is healthy
155
+
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
160
+ `$MEMORAX_CODE_HOME`.
161
+
162
+ ## Safe issue reports
163
+
164
+ Collect structured, redacted output:
165
+
166
+ ```sh
167
+ memorax-code status --json
168
+ memorax-cli status --json
169
+ memorax-code-codex doctor --json
170
+ memorax-code-claude doctor --json
171
+ ```
172
+
173
+ Include the MemoraX Code version, operating system, affected client,
174
+ reproduction steps, failing command, and the smallest relevant log excerpt.
175
+
176
+ Never attach API keys, Backend tokens, environment files, complete client
177
+ configuration, private transcripts, raw trace files, or unreviewed local
178
+ paths. Redact usernames, workspace paths, remote URLs, and content before
179
+ sharing.
@@ -0,0 +1,32 @@
1
+ import { existsSync } from "node:fs";
2
+ import { join, resolve } from "node:path";
3
+ import { pathToFileURL } from "node:url";
4
+
5
+ export async function stagePackagedClientHookRuntime(options) {
6
+ const runtime = await loadRuntimeModule(options.packageRoot);
7
+ return runtime.stageClientHookRuntimeGeneration(options);
8
+ }
9
+
10
+ export async function activatePackagedClientHookRuntime(options) {
11
+ const runtime = await loadRuntimeModule(options.packageRoot);
12
+ return runtime.activateClientHookRuntimeGeneration(options);
13
+ }
14
+
15
+ export async function preparePackagedClientHookRuntime(options) {
16
+ const runtime = await loadRuntimeModule(options.packageRoot);
17
+ return runtime.prepareClientHookRuntimeGeneration(options);
18
+ }
19
+
20
+ async function loadRuntimeModule(packageRoot) {
21
+ const root = resolve(packageRoot);
22
+ const path = join(
23
+ root,
24
+ "lib",
25
+ "memorax-code-adapter-common",
26
+ "src",
27
+ "hooks",
28
+ "hook-runtime-generation.mjs",
29
+ );
30
+ if (!existsSync(path)) throw new Error("packaged client Hook runtime installer is missing");
31
+ return await import(pathToFileURL(path).href);
32
+ }