@memorax/memorax-code 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/README.md +16 -12
  2. package/bin/memorax-code-npm-preinstall.mjs +7 -2
  3. package/bin/memorax-code-opencode.mjs +4 -0
  4. package/bin/memorax-code-plugin-postinstall.mjs +342 -93
  5. package/docs/configuration.md +148 -35
  6. package/docs/troubleshooting.md +73 -13
  7. package/lib/dsh-plugin-install.mjs +22 -0
  8. package/lib/memorax-code-adapter-common/src/hooks/capture-cwd-hook.mjs +21 -14
  9. package/lib/memorax-code-adapter-common/src/hooks/ensure-backend-runner.mjs +26 -7
  10. package/lib/memorax-code-adapter-common/src/hooks/memory-skill-reminder-hook.mjs +86 -95
  11. package/lib/memorax-code-adapter-common/src/hooks/memory-skill-reminder-policy.mjs +58 -0
  12. package/lib/memorax-code-adapter-common/src/repo-memory/repo-memory-auto-build.mjs +2 -2
  13. package/lib/memorax-code-adapter-common/src/repo-memory/repo-memory-job-supervisor.mjs +1 -1
  14. package/lib/memorax-code-adapter-common/src/windows-cli-invocation.mjs +13 -1
  15. package/lib/memorax-code-backend/dist/app/backend-server.js +210 -0
  16. package/lib/memorax-code-backend/dist/{server-observability.js → app/memory-observability.js} +4 -4
  17. package/lib/memorax-code-backend/dist/{backend-state.js → app/state.js} +1 -1
  18. package/lib/memorax-code-backend/dist/{claude-adapter-lifecycle.js → clients/claude/lifecycle.js} +2 -2
  19. package/lib/memorax-code-backend/dist/{claude-memory-hook-runtime.js → clients/claude/memory-hook-runtime.js} +7 -7
  20. package/lib/memorax-code-backend/dist/clients/codex/lifecycle.js +131 -0
  21. package/lib/memorax-code-backend/dist/{codex-memory-hook-runtime.js → clients/codex/memory-hook-runtime.js} +9 -9
  22. package/lib/memorax-code-backend/dist/{codex-plugin-hooks.js → clients/codex/plugin-hooks.js} +1 -1
  23. package/lib/memorax-code-backend/dist/{codex-plugin-install.js → clients/codex/plugin-install.js} +6 -6
  24. package/lib/memorax-code-backend/dist/clients/dsh/lifecycle.js +75 -0
  25. package/lib/memorax-code-backend/dist/clients/dsh/memory-hook-runtime.js +258 -0
  26. package/lib/memorax-code-backend/dist/clients/dsh/session-turn.js +249 -0
  27. package/lib/memorax-code-backend/dist/clients/opencode/lifecycle.js +54 -0
  28. package/lib/memorax-code-backend/dist/clients/opencode/memory-hook-runtime.js +277 -0
  29. package/lib/memorax-code-backend/dist/clients/opencode/message-turn.js +78 -0
  30. package/lib/memorax-code-backend/dist/codex-adapter-lifecycle.js +1 -131
  31. package/lib/memorax-code-backend/dist/{memorax-code-config.js → config/memorax-code.js} +32 -4
  32. package/lib/memorax-code-backend/dist/{server-cli.js → entrypoints/backend-cli.js} +137 -37
  33. package/lib/memorax-code-backend/dist/jsonl-append.js +1 -75
  34. package/lib/memorax-code-backend/dist/{active-client-selection.js → lifecycle/active-clients.js} +12 -1
  35. package/lib/memorax-code-backend/dist/{backend-service-cleanup.js → lifecycle/backend/cleanup.js} +1 -1
  36. package/lib/memorax-code-backend/dist/{backend-service-record.js → lifecycle/backend/record.js} +1 -1
  37. package/lib/memorax-code-backend/dist/{backend-service-result.js → lifecycle/backend/result.js} +2 -2
  38. package/lib/memorax-code-backend/dist/{service.js → lifecycle/backend/service.js} +16 -16
  39. package/lib/memorax-code-backend/dist/{backend-token-record.js → lifecycle/backend/token-record.js} +1 -1
  40. package/lib/memorax-code-backend/dist/{backend-service-token.js → lifecycle/backend/token.js} +2 -2
  41. package/lib/memorax-code-backend/dist/lifecycle/client-plugin-removal.js +109 -0
  42. package/lib/memorax-code-backend/dist/{client-selection.js → lifecycle/client-selection.js} +11 -5
  43. package/lib/memorax-code-backend/dist/{backend-lifecycle-lock.js → lifecycle/lock.js} +1 -1
  44. package/lib/memorax-code-backend/dist/{memorax-code-lifecycle.js → lifecycle/orchestrator.js} +325 -39
  45. package/lib/memorax-code-backend/dist/memorax-cli.js +1 -1
  46. package/lib/memorax-code-backend/dist/memorax-code.js +1 -1
  47. package/lib/memorax-code-backend/dist/{automatic-memory-retrieval.js → memory/automatic-retrieval.js} +3 -3
  48. package/lib/memorax-code-backend/dist/{automatic-memory-writeback.js → memory/automatic-writeback.js} +75 -21
  49. package/lib/memorax-code-backend/dist/{memory-cli.js → memory/cli.js} +23 -10
  50. package/lib/memorax-code-backend/dist/{memory-hook-command.js → memory/hook-command.js} +156 -9
  51. package/lib/memorax-code-backend/dist/memory/observability.js +1 -0
  52. package/lib/memorax-code-backend/dist/memory/payload-redaction.js +212 -0
  53. package/lib/memorax-code-backend/dist/{memory-reminder-trace-recorder.js → memory/reminder-trace-recorder.js} +20 -7
  54. package/lib/memorax-code-backend/dist/{repository-memory-context.js → memory/repository-session.js} +2 -2
  55. package/lib/memorax-code-backend/dist/{memory-service.js → memory/service.js} +27 -5
  56. package/lib/memorax-code-backend/dist/{memory-turn-coordinator.js → memory/turn-coordinator.js} +2 -1
  57. package/lib/memorax-code-backend/dist/{memory-writeback-buffer.js → memory/writeback-buffer.js} +3 -3
  58. package/lib/memorax-code-backend/dist/{memory-writeback-chunk.js → memory/writeback-chunk.js} +1 -1
  59. package/lib/memorax-code-backend/dist/{memory-writeback-reconciler.js → memory/writeback-reconciler.js} +6 -6
  60. package/lib/memorax-code-backend/dist/{memory-writeback-task-projection.js → memory/writeback-task-projection.js} +4 -4
  61. package/lib/memorax-code-backend/dist/{memorax-adapter.js → provider/memorax/adapter.js} +5 -5
  62. package/lib/memorax-code-backend/dist/{memorax-config.js → provider/memorax/config.js} +4 -4
  63. package/lib/memorax-code-backend/dist/{memorax-http.js → provider/memorax/http.js} +1 -1
  64. package/lib/memorax-code-backend/dist/{repo-memory-readiness.js → repository/readiness.js} +3 -3
  65. package/lib/memorax-code-backend/dist/server.js +3 -212
  66. package/lib/memorax-code-backend/dist/service-entrypoint.js +1 -1
  67. package/lib/memorax-code-backend/dist/{debug-log.js → shared/debug-log.js} +1 -1
  68. package/lib/memorax-code-backend/dist/shared/jsonl-append.js +75 -0
  69. package/lib/memorax-code-backend/dist/shared/windows-cli-invocation.js +148 -0
  70. package/lib/memorax-code-backend/dist/{trace-config.js → trace/config.js} +43 -5
  71. package/lib/memorax-code-backend/dist/{trace-context.js → trace/context.js} +53 -2
  72. package/lib/memorax-code-backend/dist/{trace-store.js → trace/store.js} +3 -3
  73. package/lib/memorax-code-backend/dist/{server-health.js → transport/http/health.js} +1 -1
  74. package/lib/memorax-code-backend/dist/{server-memory-hook.js → transport/http/memory-hook.js} +3 -3
  75. package/lib/memorax-code-backend/dist/{server-http.js → transport/http/request.js} +1 -1
  76. package/lib/memorax-code-backend/dist/{claude-local-transcript.js → viewer/history/claude-transcript.js} +3 -3
  77. package/lib/memorax-code-backend/dist/{memory-viewer-session-title.js → viewer/history/session-title.js} +1 -1
  78. package/lib/memorax-code-backend/dist/{server-memory-viewer.js → viewer/http/public-routes.js} +15 -15
  79. package/lib/memorax-code-backend/dist/viewer/model.js +1 -0
  80. package/lib/memorax-code-backend/dist/{memory-viewer-activity.js → viewer/projection/activity.js} +2 -2
  81. package/lib/memorax-code-backend/dist/{memory-viewer-history-projection.js → viewer/projection/history.js} +1 -1
  82. package/lib/memorax-code-backend/dist/{memory-viewer-observability.js → viewer/projection/observability.js} +1 -1
  83. package/lib/memorax-code-backend/dist/{memory-viewer-user-projection.js → viewer/projection/user.js} +1 -1
  84. package/lib/memorax-code-backend/dist/{memory-viewer-writeback-status.js → viewer/projection/writeback-status.js} +1 -1
  85. package/lib/memorax-code-backend/dist/{memory-viewer-store.js → viewer/store.js} +59 -32
  86. package/lib/memorax-code-backend/dist/{memory-viewer-user-html.js → viewer/ui/user-html.js} +11 -10
  87. package/lib/memorax-code-backend/dist/windows-cli-invocation.js +1 -148
  88. package/lib/memorax-code-backend/package.json +3 -3
  89. package/lib/memorax-code-claude-adapter/.claude-plugin/plugin.json +1 -1
  90. package/lib/memorax-code-claude-adapter/hooks/runtime-shell.json +1 -1
  91. package/lib/memorax-code-claude-adapter/package.json +1 -1
  92. package/lib/memorax-code-claude-adapter/skills/memorax-code/SKILL.md +11 -2
  93. package/lib/memorax-code-claude-adapter/skills/memorax-code/defaults.json +8 -5
  94. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/memorax-add.md +1 -1
  95. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/memorax-search.md +37 -9
  96. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/personal-read.md +1 -1
  97. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/personal-write.md +33 -13
  98. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-build.md +62 -13
  99. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-read.md +11 -4
  100. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-templates.md +179 -59
  101. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-update.md +18 -7
  102. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/collect_all.py +122 -39
  103. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/detect_updates.py +73 -10
  104. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/github_resource_facets.py +9 -1
  105. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +9 -1
  106. package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/validate_memory.py +23 -1
  107. package/lib/memorax-code-claude-adapter/src/plugin-install.mjs +1 -0
  108. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/.claude-plugin/plugin.json +1 -1
  109. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/hooks/runtime-shell.json +1 -1
  110. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/capture-cwd-hook.mjs +21 -14
  111. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/ensure-backend-runner.mjs +26 -7
  112. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/memory-skill-reminder-hook.mjs +86 -95
  113. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/memory-skill-reminder-policy.mjs +58 -0
  114. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/repo-memory/repo-memory-auto-build.mjs +2 -2
  115. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/repo-memory/repo-memory-job-supervisor.mjs +1 -1
  116. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/windows-cli-invocation.mjs +13 -1
  117. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/package.json +1 -1
  118. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/SKILL.md +11 -2
  119. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/defaults.json +8 -5
  120. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/memorax-add.md +1 -1
  121. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/memorax-search.md +37 -9
  122. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/personal-read.md +1 -1
  123. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/personal-write.md +33 -13
  124. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-build.md +62 -13
  125. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-read.md +11 -4
  126. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-templates.md +179 -59
  127. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-update.md +18 -7
  128. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/collect_all.py +122 -39
  129. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/detect_updates.py +73 -10
  130. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/github_resource_facets.py +9 -1
  131. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +9 -1
  132. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/validate_memory.py +23 -1
  133. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/src/plugin-install.mjs +1 -0
  134. package/lib/memorax-code-codex-adapter/.codex-plugin/plugin.json +1 -1
  135. package/lib/memorax-code-codex-adapter/hooks/runtime-shell.json +1 -1
  136. package/lib/memorax-code-codex-adapter/package.json +1 -1
  137. package/lib/memorax-code-codex-adapter/runtime-hooks/memory-skill-reminder.mjs +10 -2
  138. package/lib/memorax-code-codex-adapter/skills/memorax-code/SKILL.md +11 -2
  139. package/lib/memorax-code-codex-adapter/skills/memorax-code/defaults.json +8 -5
  140. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/memorax-add.md +1 -1
  141. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/memorax-search.md +37 -9
  142. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/personal-read.md +1 -1
  143. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/personal-write.md +33 -13
  144. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-build.md +62 -13
  145. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-read.md +11 -4
  146. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-templates.md +179 -59
  147. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-update.md +18 -7
  148. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/collect_all.py +122 -39
  149. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/detect_updates.py +73 -10
  150. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/github_resource_facets.py +9 -1
  151. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +9 -1
  152. package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/validate_memory.py +23 -1
  153. package/lib/memorax-code-dsh-adapter/cordis.patch.yml +10 -0
  154. package/lib/memorax-code-dsh-adapter/hooks/repo-memory-job.mjs +68 -0
  155. package/lib/memorax-code-dsh-adapter/package.json +69 -0
  156. package/lib/memorax-code-dsh-adapter/skills/memorax-code/SKILL.md +91 -0
  157. package/lib/memorax-code-dsh-adapter/skills/memorax-code/agents/claude.yaml +10 -0
  158. package/lib/memorax-code-dsh-adapter/skills/memorax-code/agents/openai.yaml +7 -0
  159. package/lib/memorax-code-dsh-adapter/skills/memorax-code/defaults.json +12 -0
  160. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/memorax-add.md +86 -0
  161. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/memorax-search.md +91 -0
  162. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/personal-read.md +46 -0
  163. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/personal-write.md +120 -0
  164. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/repo-build.md +319 -0
  165. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/repo-read.md +103 -0
  166. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/repo-templates.md +390 -0
  167. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/repo-update.md +127 -0
  168. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/collect_all.py +579 -0
  169. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/detect_updates.py +919 -0
  170. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/git_commit_facets.py +222 -0
  171. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/github_resource_facets.py +512 -0
  172. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +517 -0
  173. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/prepare_repo_memory.py +411 -0
  174. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/user_profile_memory.py +528 -0
  175. package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/validate_memory.py +248 -0
  176. package/lib/memorax-code-dsh-adapter/src/backend-client.mjs +119 -0
  177. package/lib/memorax-code-dsh-adapter/src/dsh-message.mjs +32 -0
  178. package/lib/memorax-code-dsh-adapter/src/dsh-version.mjs +18 -0
  179. package/lib/memorax-code-dsh-adapter/src/http-client.mjs +55 -0
  180. package/lib/memorax-code-dsh-adapter/src/index.mjs +72 -0
  181. package/lib/memorax-code-dsh-adapter/src/personal-context-worker.mjs +48 -0
  182. package/lib/memorax-code-dsh-adapter/src/personal-context.mjs +114 -0
  183. package/lib/memorax-code-dsh-adapter/src/plugin.mjs +724 -0
  184. package/lib/memorax-code-dsh-adapter/src/profile-lifecycle.mjs +1358 -0
  185. package/lib/memorax-code-dsh-adapter/src/protocol.mjs +145 -0
  186. package/lib/memorax-code-dsh-adapter/src/runtime-state.mjs +132 -0
  187. package/lib/memorax-code-opencode-adapter/hooks/repo-memory-job.mjs +37 -0
  188. package/lib/memorax-code-opencode-adapter/package.json +10 -0
  189. package/lib/memorax-code-opencode-adapter/skills/memorax-code/SKILL.md +91 -0
  190. package/lib/memorax-code-opencode-adapter/skills/memorax-code/agents/claude.yaml +10 -0
  191. package/lib/memorax-code-opencode-adapter/skills/memorax-code/agents/openai.yaml +7 -0
  192. package/lib/memorax-code-opencode-adapter/skills/memorax-code/defaults.json +12 -0
  193. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/memorax-add.md +86 -0
  194. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/memorax-search.md +91 -0
  195. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/personal-read.md +46 -0
  196. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/personal-write.md +120 -0
  197. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/repo-build.md +319 -0
  198. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/repo-read.md +103 -0
  199. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/repo-templates.md +390 -0
  200. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/repo-update.md +127 -0
  201. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/collect_all.py +579 -0
  202. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/detect_updates.py +919 -0
  203. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/git_commit_facets.py +222 -0
  204. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/github_resource_facets.py +512 -0
  205. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +517 -0
  206. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/prepare_repo_memory.py +411 -0
  207. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/user_profile_memory.py +528 -0
  208. package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/validate_memory.py +248 -0
  209. package/lib/memorax-code-opencode-adapter/src/adapter-paths.mjs +37 -0
  210. package/lib/memorax-code-opencode-adapter/src/cli.mjs +260 -0
  211. package/lib/memorax-code-opencode-adapter/src/diagnostics.mjs +31 -0
  212. package/lib/memorax-code-opencode-adapter/src/plugin-install.mjs +673 -0
  213. package/lib/memorax-code-opencode-adapter/src/plugin.mjs +539 -0
  214. package/lib/memorax-code-opencode-adapter/src/repo-memory-server-runner.mjs +442 -0
  215. package/lib/run-entrypoint.mjs +6 -0
  216. package/package.json +7 -3
  217. package/lib/memorax-code-backend/dist/client-plugin-removal.js +0 -67
  218. /package/lib/memorax-code-backend/dist/{claude-transcript-turn.js → clients/claude/transcript-turn.js} +0 -0
  219. /package/lib/memorax-code-backend/dist/{codex-effective-prompt.js → clients/codex/effective-prompt.js} +0 -0
  220. /package/lib/memorax-code-backend/dist/{codex-rollout-turn.js → clients/codex/rollout-turn.js} +0 -0
  221. /package/lib/memorax-code-backend/dist/{codex-session-turn-index.js → clients/codex/session-turn-index.js} +0 -0
  222. /package/lib/memorax-code-backend/dist/{codex-workspace-links.js → clients/codex/workspace-links.js} +0 -0
  223. /package/lib/memorax-code-backend/dist/{backend-env.js → config/backend-env.js} +0 -0
  224. /package/lib/memorax-code-backend/dist/{proxy-env.js → config/proxy-env.js} +0 -0
  225. /package/lib/memorax-code-backend/dist/{entrypoint.js → entrypoints/main.js} +0 -0
  226. /package/lib/memorax-code-backend/dist/{backend-process.js → lifecycle/backend/process.js} +0 -0
  227. /package/lib/memorax-code-backend/dist/{backend-shutdown-request.js → lifecycle/backend/shutdown-request.js} +0 -0
  228. /package/lib/memorax-code-backend/dist/{backend-status.js → lifecycle/backend/status.js} +0 -0
  229. /package/lib/memorax-code-backend/dist/{adapter-lifecycle-participant.js → lifecycle/contracts.js} +0 -0
  230. /package/lib/memorax-code-backend/dist/{install-watchdog.js → lifecycle/install-watchdog.js} +0 -0
  231. /package/lib/memorax-code-backend/dist/{memory-observability.js → lifecycle/participant.js} +0 -0
  232. /package/lib/memorax-code-backend/dist/{memory-project.js → memory/project.js} +0 -0
  233. /package/lib/memorax-code-backend/dist/{repository-memory-scope.js → repository/scope.js} +0 -0
  234. /package/lib/memorax-code-backend/dist/{incremental-jsonl-projection.js → shared/incremental-jsonl-projection.js} +0 -0
  235. /package/lib/memorax-code-backend/dist/{utils.js → shared/record.js} +0 -0
  236. /package/lib/memorax-code-backend/dist/{server-json.js → transport/http/json.js} +0 -0
  237. /package/lib/memorax-code-backend/dist/{memory-viewer-data-projection-cache.js → viewer/projection/cache.js} +0 -0
  238. /package/lib/memorax-code-backend/dist/{memory-viewer-event-identity.js → viewer/projection/event-identity.js} +0 -0
  239. /package/lib/memorax-code-backend/dist/{memory-viewer-redaction.js → viewer/projection/redaction.js} +0 -0
  240. /package/lib/memorax-code-backend/dist/{memory-viewer-turn-reference.js → viewer/projection/turn-reference.js} +0 -0
  241. /package/lib/memorax-code-backend/dist/{memory-viewer-icon.js → viewer/ui/icon.js} +0 -0
  242. /package/lib/memorax-code-backend/dist/{memory-viewer-logo.js → viewer/ui/logo.js} +0 -0
@@ -0,0 +1,145 @@
1
+ export const MEMORY_HOOK_COMMAND_VERSION = 1;
2
+ export const MEMORY_HOOK_CLIENT = "dsh";
3
+
4
+ const TURN_SCOPED_EVENT_TYPES = new Set([
5
+ "step/start",
6
+ "step/end",
7
+ "assistant/chunk",
8
+ "assistant/message",
9
+ "tool/call",
10
+ "tool/result",
11
+ ]);
12
+
13
+ export function createTurnStartCommand(input) {
14
+ return {
15
+ version: MEMORY_HOOK_COMMAND_VERSION,
16
+ client: MEMORY_HOOK_CLIENT,
17
+ sessionId: requiredString(input?.sessionId, "sessionId"),
18
+ turn: positiveSafeInteger(input?.turn, "turn"),
19
+ startSeq: nonNegativeSafeInteger(input?.startSeq, "startSeq"),
20
+ cwd: requiredString(input?.cwd, "cwd"),
21
+ prompt: requiredString(input?.prompt, "prompt"),
22
+ };
23
+ }
24
+
25
+ export function createWritebackCommand(input) {
26
+ const sessionId = requiredString(input?.sessionId, "sessionId");
27
+ const turn = positiveSafeInteger(input?.turn, "turn");
28
+ const startSeq = nonNegativeSafeInteger(input?.startSeq, "startSeq");
29
+ const endSeq = nonNegativeSafeInteger(input?.endSeq, "endSeq");
30
+ const cwd = requiredString(input?.cwd, "cwd");
31
+ const sessionHeader = sessionHeaderValue(input?.sessionHeader, sessionId, cwd);
32
+ const events = exactTurnWindow(input?.events, { turn, startSeq, endSeq });
33
+ return {
34
+ version: MEMORY_HOOK_COMMAND_VERSION,
35
+ client: MEMORY_HOOK_CLIENT,
36
+ sessionId,
37
+ turn,
38
+ startSeq,
39
+ endSeq,
40
+ cwd,
41
+ sessionHeader: structuredClone(sessionHeader),
42
+ events: structuredClone(events),
43
+ };
44
+ }
45
+
46
+ export function createSkillReminderCommand(input) {
47
+ return {
48
+ version: MEMORY_HOOK_COMMAND_VERSION,
49
+ client: MEMORY_HOOK_CLIENT,
50
+ sessionId: requiredString(input?.sessionId, "sessionId"),
51
+ turn: positiveSafeInteger(input?.turn, "turn"),
52
+ cwd: requiredString(input?.cwd, "cwd"),
53
+ content: requiredString(input?.content, "content"),
54
+ triggers: skillReminderTriggers(input?.triggers),
55
+ };
56
+ }
57
+
58
+ /**
59
+ * Select and verify the exact persisted interval after readFrom(). Later Turns
60
+ * may already be durable, so only the inclusive requested suffix is returned.
61
+ */
62
+ export function exactTurnWindow(events, expected) {
63
+ if (!Array.isArray(events)) throw new TypeError("DSH persisted events must be an array");
64
+ const turn = positiveSafeInteger(expected?.turn, "turn");
65
+ const startSeq = nonNegativeSafeInteger(expected?.startSeq, "startSeq");
66
+ const endSeq = nonNegativeSafeInteger(expected?.endSeq, "endSeq");
67
+ if (endSeq < startSeq) throw new Error("DSH turn endSeq precedes startSeq");
68
+
69
+ const selected = [];
70
+ for (const event of events) {
71
+ if (!record(event) || !Number.isSafeInteger(event.seq) || event.seq < 0) {
72
+ throw new Error("DSH persisted event has an invalid sequence number");
73
+ }
74
+ if (event.seq > endSeq) break;
75
+ selected.push(event);
76
+ }
77
+ const expectedLength = endSeq - startSeq + 1;
78
+ if (selected.length !== expectedLength) {
79
+ throw new Error("DSH persisted turn interval is incomplete");
80
+ }
81
+ for (let index = 0; index < selected.length; index += 1) {
82
+ if (selected[index].seq !== startSeq + index) {
83
+ throw new Error("DSH persisted turn interval is not contiguous");
84
+ }
85
+ }
86
+
87
+ const first = selected[0];
88
+ const last = selected.at(-1);
89
+ if (first.type !== "turn/start" || first.data?.turn !== turn) {
90
+ throw new Error("DSH persisted turn interval has no matching start boundary");
91
+ }
92
+ if (last.type !== "turn/end" || last.data?.turn !== turn) {
93
+ throw new Error("DSH persisted turn interval has no matching end boundary");
94
+ }
95
+ for (let index = 1; index < selected.length - 1; index += 1) {
96
+ const event = selected[index];
97
+ if (event.type === "turn/start" || event.type === "turn/end") {
98
+ throw new Error("DSH persisted turn interval contains a nested turn boundary");
99
+ }
100
+ if (TURN_SCOPED_EVENT_TYPES.has(event.type) && event.data?.turn !== turn) {
101
+ throw new Error("DSH persisted turn event belongs to another turn");
102
+ }
103
+ }
104
+ return selected;
105
+ }
106
+
107
+ function sessionHeaderValue(value, sessionId, cwd) {
108
+ if (!record(value)) throw new TypeError("DSH sessionHeader must be an object");
109
+ if (value.id !== sessionId) throw new Error("DSH sessionHeader id does not match sessionId");
110
+ if (value.cwd !== cwd) throw new Error("DSH sessionHeader cwd does not match cwd");
111
+ return value;
112
+ }
113
+
114
+ function requiredString(value, name) {
115
+ if (typeof value !== "string" || !value.trim()) {
116
+ throw new TypeError(`DSH ${name} must be a non-empty string`);
117
+ }
118
+ return value.trim();
119
+ }
120
+
121
+ function positiveSafeInteger(value, name) {
122
+ if (!Number.isSafeInteger(value) || value < 1) {
123
+ throw new TypeError(`DSH ${name} must be a positive safe integer`);
124
+ }
125
+ return value;
126
+ }
127
+
128
+ function nonNegativeSafeInteger(value, name) {
129
+ if (!Number.isSafeInteger(value) || value < 0) {
130
+ throw new TypeError(`DSH ${name} must be a non-negative safe integer`);
131
+ }
132
+ return value;
133
+ }
134
+
135
+ function record(value) {
136
+ return value !== null && typeof value === "object" && !Array.isArray(value);
137
+ }
138
+
139
+ function skillReminderTriggers(value) {
140
+ if (!Array.isArray(value) || value.length === 0
141
+ || value.some((trigger) => trigger !== "cadence" && trigger !== "post_compaction")) {
142
+ throw new TypeError("DSH triggers must be a non-empty array of supported reminder triggers");
143
+ }
144
+ return [...new Set(value)];
145
+ }
@@ -0,0 +1,132 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { isAbsolute, join, relative, resolve, sep } from "node:path";
3
+
4
+ import { parseDshVersion } from "./dsh-version.mjs";
5
+
6
+ const PACKAGE_METADATA_VERSION = 1;
7
+ const STATE_VERSION = 1;
8
+ /** Read the current durable enablement authority for this installed DSH bundle. */
9
+ export function requireEnabledDshRuntime(pluginRoot) {
10
+ const authority = requireDshRuntimeAuthority(pluginRoot);
11
+ if (!authority.enabled) throw disabledError();
12
+ return {
13
+ memoraxCodeCommand: authority.memoraxCodeCommand,
14
+ memoraxCodeHome: authority.memoraxCodeHome,
15
+ dshCommand: authority.dshCommand,
16
+ dshHome: authority.dshHome,
17
+ dshVersion: authority.dshVersion,
18
+ profiles: authority.profiles,
19
+ revision: authority.revision,
20
+ };
21
+ }
22
+
23
+ /** Validate one installed bundle's metadata against its durable lifecycle state. */
24
+ export function requireDshRuntimeAuthority(pluginRoot) {
25
+ const root = resolveRequiredPath(pluginRoot, "pluginRoot");
26
+ const metadata = readRecord(join(root, ".memorax-code-package.json"));
27
+ if (metadata?.version !== PACKAGE_METADATA_VERSION
28
+ || !nonEmptyString(metadata.memoraxCodeCommand)
29
+ || !nonEmptyString(metadata.memoraxCodeHome)
30
+ || !nonEmptyString(metadata.dshCommand)
31
+ || !nonEmptyString(metadata.dshHome)
32
+ || !parseDshVersion(metadata.dshVersion)
33
+ || !nonEmptyString(metadata.sourceAdapterRoot)
34
+ || !nonEmptyString(metadata.runtimeBundleRoot)) {
35
+ throw disabledError();
36
+ }
37
+
38
+ const memoraxCodeHome = resolve(metadata.memoraxCodeHome);
39
+ const dshHome = resolve(metadata.dshHome);
40
+ const runtimeBundleRoot = resolve(metadata.runtimeBundleRoot);
41
+ if (!isPathInside(
42
+ runtimeBundleRoot,
43
+ join(memoraxCodeHome, "adapters", "dsh", "runtime", "generations"),
44
+ )) {
45
+ throw disabledError();
46
+ }
47
+ const state = readRecord(join(memoraxCodeHome, "adapters", "dsh", "state.json"));
48
+ if (state?.version !== STATE_VERSION
49
+ || state.runtime !== "dsh"
50
+ || state.integration !== "plugin"
51
+ || typeof state.enabled !== "boolean"
52
+ || resolveString(state.memoraxCodeHome) !== memoraxCodeHome
53
+ || resolveString(state.dshHome) !== dshHome
54
+ || resolveString(state.adapterRoot) !== resolve(metadata.sourceAdapterRoot)
55
+ || resolveString(state.runtimeBundleRoot) !== runtimeBundleRoot
56
+ || state.memoraxCodeCommand !== metadata.memoraxCodeCommand
57
+ || state.dshCommand !== metadata.dshCommand
58
+ || state.dshVersion !== metadata.dshVersion
59
+ || !Array.isArray(state.profiles)
60
+ || !state.profiles.every(validProfileName)
61
+ || !timestampString(state.updatedAt)) {
62
+ throw disabledError();
63
+ }
64
+
65
+ return {
66
+ enabled: state.enabled,
67
+ sourceAdapterRoot: resolve(metadata.sourceAdapterRoot),
68
+ runtimeBundleRoot,
69
+ memoraxCodeCommand: metadata.memoraxCodeCommand,
70
+ memoraxCodeHome,
71
+ dshCommand: metadata.dshCommand,
72
+ dshHome,
73
+ dshVersion: metadata.dshVersion,
74
+ profiles: [...state.profiles],
75
+ revision: state.updatedAt,
76
+ };
77
+ }
78
+
79
+ function readRecord(path) {
80
+ try {
81
+ const value = JSON.parse(readFileSync(path, "utf8"));
82
+ return value !== null && typeof value === "object" && !Array.isArray(value)
83
+ ? value
84
+ : undefined;
85
+ } catch {
86
+ return undefined;
87
+ }
88
+ }
89
+
90
+ function resolveRequiredPath(value, name) {
91
+ const normalized = nonEmptyString(value);
92
+ if (!normalized) throw new TypeError(`DSH ${name} must be a non-empty path`);
93
+ return resolve(normalized);
94
+ }
95
+
96
+ function resolveString(value) {
97
+ const normalized = nonEmptyString(value);
98
+ return normalized ? resolve(normalized) : undefined;
99
+ }
100
+
101
+ function nonEmptyString(value) {
102
+ return typeof value === "string" && value.trim() ? value.trim() : undefined;
103
+ }
104
+
105
+ function timestampString(value) {
106
+ const normalized = nonEmptyString(value);
107
+ return normalized && Number.isFinite(Date.parse(normalized)) ? normalized : undefined;
108
+ }
109
+
110
+ function validProfileName(value) {
111
+ return typeof value === "string"
112
+ && value.length > 0
113
+ && value !== "."
114
+ && value !== ".."
115
+ && value !== "node_modules"
116
+ && !value.includes("/")
117
+ && !value.includes("\\");
118
+ }
119
+
120
+ function isPathInside(value, parent) {
121
+ const child = relative(resolve(parent), resolve(value));
122
+ return child !== ""
123
+ && child !== ".."
124
+ && !child.startsWith(`..${sep}`)
125
+ && !isAbsolute(child);
126
+ }
127
+
128
+ function disabledError() {
129
+ const error = new Error("MemoraX Code DSH integration is not enabled");
130
+ error.code = "MEMORAX_CODE_DSH_DISABLED";
131
+ return error;
132
+ }
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync } from "node:fs";
3
+ import { dirname, resolve } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { runRepoMemoryJob } from "../../memorax-code-adapter-common/src/repo-memory/repo-memory-job-supervisor.mjs";
6
+ import { evaluateRepository } from "../../memorax-code-adapter-common/src/repo-memory/repo-memory-update-policy-evaluator.mjs";
7
+
8
+ const hookDir = dirname(fileURLToPath(import.meta.url));
9
+ const adapterRoot = dirname(hookDir);
10
+ const packagedValidator = resolve(adapterRoot, "skills/memorax-code/scripts/validate_memory.py");
11
+ const validatorPath = existsSync(packagedValidator)
12
+ ? packagedValidator
13
+ : resolve(adapterRoot, "../memorax-code-codex-adapter/skills/memorax-code/scripts/validate_memory.py");
14
+
15
+ try {
16
+ const payload = runRepoMemoryJob(process.argv.slice(2), {
17
+ runner: "opencode",
18
+ finalMessageSource: "stdout",
19
+ memorySkillInvocation: "the `memorax-code` skill",
20
+ validatorPath,
21
+ evaluateRepository,
22
+ createCommand({ prompt, repo }) {
23
+ return [
24
+ process.execPath,
25
+ resolve(adapterRoot, "src/repo-memory-server-runner.mjs"),
26
+ "--repo",
27
+ repo,
28
+ "--prompt",
29
+ prompt,
30
+ ];
31
+ },
32
+ });
33
+ process.stdout.write(`${JSON.stringify(payload)}\n`);
34
+ } catch (error) {
35
+ process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
36
+ process.exit(1);
37
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@memorax-code/opencode-adapter",
3
+ "version": "0.1.4",
4
+ "private": true,
5
+ "type": "module",
6
+ "description": "OpenCode plugin adapter for MemoraX Code memory services.",
7
+ "scripts": {
8
+ "test": "node --test test/*.test.mjs"
9
+ }
10
+ }
@@ -0,0 +1,91 @@
1
+ ---
2
+ name: memorax-code
3
+ description: >-
4
+ Use this skill as the single router for persistent coding and repository-local
5
+ memory. Invoke it whenever a request may involve prior-work knowledge,
6
+ repository memory, reusable procedures or rules, durable profile or
7
+ interaction preferences, or information worth retaining beyond the current
8
+ task. This applies without memory wording, including habits, preferences,
9
+ checklists, action sequences, prerequisites, gates, exceptions, validation
10
+ rules, communication style, preferred language, or result presentation.
11
+ Classify the request as coding memory, repository memory, personal procedure
12
+ memory, personal profile memory, or no persistent memory, then route it to the
13
+ matching operation. Invoking this router does not require coding-memory
14
+ search. Reuse a relevant coding-memory result already retrieved in this
15
+ conversation; otherwise let the matching operation decide on search. Prefer
16
+ this router over underlying memory workflows. Ask one focused question only when
17
+ memory authority remains ambiguous.
18
+ ---
19
+
20
+ # MemoraX Code
21
+
22
+ Classify the requested memory authority first, then its operation. Load only the matching reference unless the request genuinely spans authorities or operations.
23
+
24
+ After selecting an operation reference, read it completely in a standalone
25
+ tool call and wait for the full result before constructing or executing that
26
+ operation. Never combine reading a required reference with the command or
27
+ action it governs in the same shell command or tool call.
28
+
29
+ ## Authority Router
30
+
31
+ ### MemoraX Code Coding Memory
32
+
33
+ Use MemoraX Code coding memory for reusable engineering knowledge learned across coding work: prior fixes, failed approaches, coding conventions, implementation pitfalls, validation patterns, and design rationale.
34
+
35
+ - Read [references/memorax-search.md](references/memorax-search.md) to recall or search coding memory.
36
+ - Read [references/memorax-add.md](references/memorax-add.md) to save a grounded reusable coding lesson.
37
+
38
+ ### Repo Memory
39
+
40
+ Use repo memory for repository identity, architecture maps, module routing, local commit history, and GitHub or GitLab PR, MR, and issue evidence stored under `.repo_memory/PROFILE.md`, `.repo_memory/resources/`, and `.repo_memory/raw/`.
41
+
42
+ - Read [references/repo-read.md](references/repo-read.md) to inspect existing repo memory.
43
+ - Read [references/repo-build.md](references/repo-build.md) for first-time creation, full rebuilds, or full refreshes.
44
+ - Read [references/repo-update.md](references/repo-update.md) for incremental updates to an existing bundle.
45
+ - Read [references/repo-templates.md](references/repo-templates.md) only when the build or update operation needs to author repo memory files.
46
+
47
+ ### Personal Memory
48
+
49
+ Use personal memory for user-owned repository procedures and durable profile or interaction preferences stored under `.repo_memory/procedure-memory/` and `.repo_memory/user-profile/`.
50
+
51
+ - Read [references/personal-read.md](references/personal-read.md) to list, recall, or apply personal memory.
52
+ - Read [references/personal-write.md](references/personal-write.md) to save, update, forget, or delete personal memory.
53
+
54
+ ## Tie Breakers
55
+
56
+ - Route ordered actions, checklists, prerequisites, gates, exceptions, and validation rules to personal procedure memory, even when phrased as "I prefer", "I like", "我的习惯", or "我喜欢".
57
+ - Route preferred name, answer language, tone, verbosity, explanation style, and result presentation to personal profile memory.
58
+ - Route task-learned repairs, coding pitfalls, project engineering conventions, and reusable design lessons to MemoraX Code coding memory.
59
+ - Route prior project discussions, experiment conclusions, saved engineering findings, earlier fixes, and reusable project lessons to MemoraX Code coding memory. Do not route them to repo memory merely because they concern a project. Use repo memory for repository identity, architecture, module maps, commits, PRs, MRs, and issues.
60
+ - Route repository architecture, module maps, commit history, PRs, MRs, and issues to repo memory. Verify claims about current behavior against live code.
61
+ - Use both repo memory and MemoraX Code coding memory only when a request genuinely needs distinct repository evidence and reusable engineering lessons. This can apply to implementation, debugging, refactoring, migration planning, or validation when the answer may depend on repository module maps, commit/PR/issue evidence, and prior fixes, pitfalls, conventions, validation patterns, or design rationale. Do not use both authorities just because a request mentions a repository, file, module, or "previous".
62
+ - Route current-task instructions and temporary plans to the current task only; do not persist them.
63
+ - Current-task-only applies only when completing the request does not depend on prior project state. Do not select it merely because the requested action happens in the current turn. When implementation, debugging, review, experiment continuation, or validation depends on earlier project decisions, results, fixes, constraints, or plans that the user has not explicitly and completely supplied, route to MemoraX Code coding memory.
64
+ - Do not infer an authority from verbs such as "remember", "recall", "refresh", or "update" alone. Ask one focused question when the target remains ambiguous.
65
+
66
+ Examples:
67
+
68
+ - "先测试再提 PR,帮我记住" routes to personal procedure write.
69
+ - "我喜欢中文简短回答" routes to personal profile write.
70
+ - "之前这个 bug 怎么修的?" routes to MemoraX Code coding memory search unless the user asks for commit or PR evidence.
71
+ - "这个仓库的架构是什么?" routes to repo memory read.
72
+ - "重新生成仓库 memory" routes to repo memory build.
73
+ - "更新一下 memory" requires clarification when no authority is identifiable.
74
+
75
+ ## Shared Rules
76
+
77
+ For MemoraX Code coding memory, run `memorax-cli` from the active task workspace. The installed Hook and session binding supply the authoritative workspace root; do not run Git commands to discover or replace it. The Backend resolves repository scope from that trusted workspace and read-only filesystem Git metadata.
78
+
79
+ Repo memory and personal memory remain local `.repo_memory` authorities. Resolve their repository root exactly as described by the selected reference, including its Git requirements.
80
+
81
+ Apply instructions in this order: system and developer instructions, `AGENTS.md`, the current user request, then stored memory. Memory is guidance or historical context, not proof of current repository behavior.
82
+
83
+ For MemoraX Code coding memory, use `memorax-cli` exactly as described by the selected reference. Invoke this skill as `$memorax-code` in Codex or `/memorax-code` in Claude Code. In OpenCode, ask the agent to use the `memorax-code` skill by name. These invocation forms are not shell commands. `memorax-code` is the lifecycle CLI and must not be used for memory search or add. Do not call MemoraX HTTP endpoints directly.
84
+
85
+ When explaining Memory Viewer, describe only `/memory-viewer`. It is a
86
+ content-free local summary and must not expose conversation or memory text,
87
+ session or turn identifiers, paths, or trace details. The page never queries
88
+ MemoraX directly; it projects client-qualified local activity and keeps each
89
+ supported harness isolated.
90
+
91
+ Never store secrets, credentials, `.env` content, sensitive personal data, raw transcripts, hidden tests, exact patches, temporary target commits, or unsafe destructive commands. Do not announce internal routing or reference loading.
@@ -0,0 +1,10 @@
1
+ interface:
2
+ display_name: "MemoraX Code"
3
+ short_description: "Route coding, repo, and personal memory"
4
+ default_prompt: "Use /memorax-code-claude-adapter:memorax-code to route a coding-memory, repo-memory, or personal-memory request to the correct operation."
5
+
6
+ policy:
7
+ allow_implicit_invocation: true
8
+ install_targets:
9
+ - "~/.claude/skills/memorax-code"
10
+ - ".claude/skills/memorax-code"
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "MemoraX Code"
3
+ short_description: "Route coding, repo, and personal memory"
4
+ default_prompt: "Use $memorax-code to route a coding-memory, repo-memory, or personal-memory request to the correct operation."
5
+
6
+ policy:
7
+ allow_implicit_invocation: true
@@ -0,0 +1,12 @@
1
+ {
2
+ "schema": "repo_memory_builder_defaults.v2",
3
+ "repoHistory": {
4
+ "mode": "provider",
5
+ "limits": {
6
+ "commits": 30,
7
+ "prs": 30,
8
+ "issues": 30
9
+ }
10
+ },
11
+ "summaryChars": 4000
12
+ }
@@ -0,0 +1,86 @@
1
+ # MemoraX Code Coding Memory Add
2
+
3
+ Use these instructions only to add reusable coding knowledge through `memorax-cli`. Invoke the skill as `$memorax-code` in Codex or `/memorax-code` in Claude Code. In OpenCode, ask the agent to use the `memorax-code` skill by name. Do not route memory operations through the lifecycle-only `memorax-code` CLI. Do not use this authority for personal procedures, interaction preferences, generated repository facts, or one-off task details.
4
+
5
+ ## Eligible Knowledge
6
+
7
+ Add a coding memory only when the task yields stable, grounded, reusable engineering knowledge, such as:
8
+
9
+ - a verified repair invariant or validation pattern;
10
+ - a reusable failed-attempt lesson;
11
+ - a confirmed coding convention, lifecycle boundary, or implementation pitfall;
12
+ - durable design rationale that will help future coding work.
13
+
14
+ Route user-owned ordered actions, checklists, gates, and work rules to personal procedure memory. Route preferred language, tone, verbosity, name, and presentation to personal profile memory. Route commit, PR, issue, architecture-map, and repository-history facts to repo memory.
15
+
16
+ Do not add positive repair lessons based only on unverified edits or assistant self-report. Verification may come from a focused test, evaluator, CI check, accepted review, manual reproduction, or deployed behavior. A failed attempt may be saved as negative evidence when the failure itself is clear and reusable.
17
+
18
+ ## Add Workflow
19
+
20
+ For a proactive add, write all generated prose in `--memory`, `--reason`, and the confirmation in the language of the user's current request; preserve exact code, API, path, workflow, and project identifiers.
21
+
22
+ Run from the active task workspace. Pass the memory and reason directly. Put every dynamically generated `--memory` and `--reason` value in single quotes, never double quotes. Treat `$HOME`, backticks, and `$(command)` as literal text inside those quotes. Replace each literal single quote in a value with the exact POSIX sequence `'\''`.
23
+
24
+ ```bash
25
+ memorax-cli add \
26
+ --memory 'Concise reusable memory.' \
27
+ --type procedural \
28
+ --reason 'Capture reusable coding memory.'
29
+ ```
30
+
31
+ Use an appropriate supported type such as `core`, `semantic`, `procedural`, `episodic`, or `unclassified`. Use `preference` only for an engineering convention owned by MemoraX Code coding memory, not for a personal interaction preference.
32
+
33
+ For a complex verified repair or failed approach, use this compact card when it improves later retrieval:
34
+
35
+ ```text
36
+ CODE_AGENT_MEMORY
37
+ repo: <repository or product area>
38
+ scope: <module/path::symbol/API or lifecycle boundary>
39
+ status: <verified|failed_attempt|candidate>
40
+ signal: <test, CI, review, reproduction, deployment, failure, or unknown>
41
+ problem: <small behavioral symptom or engineering situation>
42
+ technical_context: <stable API, lifecycle, state owner, or data-shape detail>
43
+ surfaces: <observable producer/consumer or setup/runtime/cleanup boundaries>
44
+ failed_shape: <reusable wrong assumption or unsafe patch shape, or none>
45
+ validation: <small reusable check contract>
46
+ principle: <abstract invariant or decision rule>
47
+ anchors: <stable repository source, tests, or public docs>
48
+ ```
49
+
50
+ Keep the card under 1,100 characters when practical. It must guide future investigation while still requiring live-code inspection.
51
+
52
+ Pass a completed multi-line card as one single-quoted `--memory` argument:
53
+
54
+ ```bash
55
+ memorax-cli add \
56
+ --memory 'CODE_AGENT_MEMORY
57
+ repo: owner/name
58
+ scope: module/path::symbol
59
+ status: verified
60
+ signal: focused test passed
61
+ problem: concise reusable symptom
62
+ technical_context: stable implementation fact
63
+ surfaces: affected boundary
64
+ failed_shape: reusable pitfall or none
65
+ validation: smallest reusable check
66
+ principle: reusable invariant
67
+ anchors: stable/source/path' \
68
+ --type procedural \
69
+ --reason 'Capture verified reusable coding memory.'
70
+ ```
71
+
72
+ If add fails, report the exact failure and do not retry automatically, bypass the CLI, or call MemoraX directly.
73
+
74
+ If a successful Add result reports `workspaceScopeFallbackReason: git_metadata_invalid`, malformed or incomplete metadata inside a direct `.git` directory was downgraded to the normalized local folder scope. Add has already been submitted with the reported `effectiveUserId`. Present its `userNotice` once without pausing the current task or asking the user to repair Git first, then continue the current task. After the repository or `.git` metadata is repaired, later Search, Add, and automatic writeback in the same client session automatically use the restored Git repository scope.
75
+
76
+ If `memorax-cli add` reports `workspace_scope_mismatch` or `workspace_scope_unavailable`, do not bypass the scope. Do not change the CLI working directory and retry. Tell the user that the memory was not submitted and no request was sent to MemoraX, then present the CLI's `userAction` in natural language. Continue the current task using only live code and documentation.
77
+
78
+ ## Exclusions
79
+
80
+ Do not add secrets, credentials, private URLs, raw authorization headers, exact patches, target commits, hidden tests, target diffs, vulnerability details, exploit steps, copied source, long logs, stack traces, raw transcripts, temporary errors, or facts directly recoverable from current files and git history.
81
+
82
+ Do not add speculation, assistant-only praise, or a current instruction merely because it contains "remember". Return to `SKILL.md` when the content belongs to personal memory or repo memory.
83
+
84
+ ## Output
85
+
86
+ After an add request is accepted, confirm briefly that it was submitted for processing and identify the reusable coding lesson at a high level. If add is disabled or fails, report the issue and continue without bypassing the CLI.
@@ -0,0 +1,91 @@
1
+ # MemoraX Code Coding Memory Search
2
+
3
+ Use these instructions only to search reusable coding memory through `memorax-cli`. Invoke the skill as `$memorax-code` in Codex or `/memorax-code` in Claude Code. In OpenCode, ask the agent to use the `memorax-code` skill by name. Do not route memory operations through the lifecycle-only `memorax-code` CLI. Do not call MemoraX HTTP endpoints directly, print credentials, or edit memory storage by hand.
4
+
5
+ ## Scope
6
+
7
+ Run the CLI from the active task workspace. The installed Hook and session binding supply the authoritative workspace root; do not run `git rev-parse`, infer the root from Git metadata, or substitute an unrelated working directory. Do not make `memorax-cli status` a mandatory preflight; use it only to diagnose a configuration or scope failure.
8
+
9
+ Coding memory uses `<MemoraX base user ID>@<normalized repository name>` for Git workspaces and the normalized folder name for genuine non-Git directories. MemoraX Code resolves `.git`, `gitdir`, and `commondir` without executing Git. Linked worktrees share one repository scope; another clone, repository, or non-Git directory retains a different local session key even when its readable name matches.
10
+
11
+ If a successful Search result reports `workspaceScopeFallbackReason: git_metadata_invalid`, malformed or incomplete metadata inside a direct `.git` directory was downgraded to the normalized local folder scope. Search has already run with the reported `effectiveUserId`. Present its `userNotice` once without pausing the current task or asking the user to repair Git first, then continue with the returned memory and live evidence. After the repository or `.git` metadata is repaired, later Search, Add, and automatic writeback in the same client session automatically use the restored Git repository scope.
12
+
13
+ Require a readable active workspace binding. A CLI command from a linked worktree of the bound repository is valid. If `memorax-cli search` reports `workspace_scope_mismatch` or `workspace_scope_unavailable`, do not bypass the scope or fall back to an unscoped user id. Do not change the CLI working directory and retry. Tell the user that memory search was not executed and no request was sent to MemoraX, then present the CLI's `userAction` in natural language. Continue the current task using only live code and documentation.
14
+
15
+ If `memorax-cli` is not on `PATH`, or memory is disabled, unconfigured, or unavailable, report that briefly and continue with live code or documentation. Authenticate through MemoraX Code configuration; never recover credentials from shell history or place tokens in prompts. Treat injected memory as a hypothesis and verify it against the current checkout.
16
+
17
+ ## Search Decision
18
+
19
+ Search when prior coding memory may change localization, implementation, review, validation, or explanation. Typical triggers include:
20
+
21
+ - a request for a previous fix, failed approach, coding convention, design decision, or reusable lesson;
22
+ - implementation, review, planning, API, schema, parser, workflow-contract, or migration work where prior project guidance may matter;
23
+ - explicit instructions to follow previous agreements or remembered engineering conventions.
24
+ - a request to recover, verify, or apply prior project discussions, experiment results, saved memory, earlier decisions, previous changes, or historical constraints, unless the needed facts are fully present in the current visible context.
25
+ - a requested action that depends on prior project state, results, fixes, constraints, or plans when the exact evidence needed is not explicitly present in the current user-provided material.
26
+
27
+ Skip search for simple current-code facts, tiny edits, typo fixes, one-shot commands, or behavior directly established by a clear live source. Do not skip merely by saying the current conversation is sufficient or a relevant result was already retrieved; skip only when the current user message, selected text, or nearby visible context fully contains the facts needed for the answer. A nearby summary is sufficient for explaining that summary, but not automatically sufficient for diagnosing a regression, continuing an experiment, reviewing consistency with prior behavior, or claiming a complete historical account. A word such as "previous", "earlier", "remember", or "history" is not enough by itself to search when the visible context already contains the requested prior facts.
28
+
29
+ Do not search merely because a prior result or fix might exist. For an exact calculation from currently available data, or a current screenshot or reproducible symptom with sufficient live evidence, use the current evidence first. Search only when the user request or visible context establishes a concrete historical dependency.
30
+
31
+ Choose the closest coding scene to shape the query:
32
+
33
+ - **Development:** implementation, debugging, refactoring, test repair, build failures, feature work, API design, or migration planning.
34
+ - **Review:** diff, commit, PR, patch, audit, risk assessment, or review-comment handling.
35
+ - **Understanding:** implementation location, module explanation, architecture rationale, or repository comprehension when repo memory is not the requested authority.
36
+
37
+ If the user asks for commit, PR, MR, issue, or repository architecture evidence, return to `SKILL.md` and route to repo memory instead.
38
+
39
+ ## Query Workflow
40
+
41
+ Before searching, identify the user's current action, target, concrete behavior or symptom, and the historical knowledge that could change the next action. When the request is fragmented, derive one narrow working intent from only its explicit target, condition, and requested or implied outcome. Do not add generic security, authorization, concurrency, auditing, reliability, or best-practice concerns unless the request names that boundary or it is necessary to resolve the working intent. Ask one focused question when no actionable intent can be named.
42
+
43
+ Run up to two focused first-round searches before answering or editing: a primary query for the smallest user-facing decision, and a materially different complementary query only when a second independent fact can change the action. Keep one query when the request describes one strongly coupled calculation, diagnosis, ownership question, or lifecycle decision; do not split it merely to create coverage. Run independent first-round searches in parallel by default. If parallel execution encounters a transport, rate-limit, or caller-environment failure, run any remaining searches serially; do not switch solely because a successful search returns an unexpected number of items. After merging the first-round results, run at most one follow-up query only when one named residual gap can change implementation, localization, risk, or validation. Do not use the follow-up merely because results are few, generic, or incomplete.
44
+
45
+ Write each query as one short natural-language question or intent statement, not a keyword list. Derive it from the user's retrieval goal instead of copying or concatenating nouns from the prompt. Follow the user's language for the prose while preserving exact code, API, path, workflow, and project identifiers. Retain at least one distinctive noun phrase from the user's wording as an anchor, together with any explicit negation, time/order, quantity, or scope qualifier. Also retain one stable task entity explicitly established by the current conversation or live code/documentation when it is needed to resolve that anchor or make the target decidable; do not drop it merely because it is absent from the newest fragmented user message. Do not replace an anchor or stable entity with a more abstract mechanism, a more specific implementation guess, or an unverified term. Preserve whether a retained detail is an observed symptom, desired outcome, disputed field or hypothesis, or explicit exclusion; do not turn an observation into a required invariant or replace a named disputed field with a generic reference.
46
+
47
+ Preserve the user's requested answer shape as well as the target: for example, whether a value was introduced by a prior code change, which failed experiments require rerun, how a negative case differs, what source boundary applies, or which existing plan remains current. Encode an explicit exclusion, source boundary, or qualifier such as only, previous, failed, negative, not, latest, or before/after when it changes the answer. Do not turn an imperative, URL, copied log, or full task request into the query verbatim; extract the smallest reusable historical fact that could change the next action. When the user explicitly names several independent deliverables and their respective historical facts could change different next actions, use the existing two-query allowance for complementary coverage: let the primary query cover the central implementation or decision, and let the complementary query cover the separate validation, artifact, reporting, or boundary question. Do not split one tightly coupled task or create a second query merely to enumerate every noun.
48
+
49
+ State a fact-sized relationship that can change the next action: a target under a condition, and the decision, invariant, consequence, root cause, ownership, compatibility, validation question, or requested answer at issue. For behavior, data, and lifecycle work, every query must use this visible shape: `<target>: <condition>,<decision / invariant / consequence / validation question>?`. Keep the colon in both Chinese and English so the target, condition, and decision boundary remain explicit. Do not emit a generic topic, a keyword list, a label such as `primary query`, or an explanation around the query.
50
+
51
+ For a complementary first-round pair, each query must stand alone and cover a different decision boundary. Use a complementary pair only when the provided context gives each decision boundary a distinct exact code, API, path, workflow, or project identifier; otherwise keep one focused combined query that preserves both user-stated facts. Do not merely restate the same question with synonyms. If the user describes only one tightly coupled decision, emit exactly one query. Use one or two stable exact identifiers when they sharpen the query, and integrate them grammatically instead of appending search tags or filler. Use only user-provided anchors and stable terms from live code or documentation; do not reconstruct unseen fact wording from recalled memory.
52
+
53
+ Pass the query directly with `--query`. Put every dynamically generated query in single quotes, never double quotes. Treat `$HOME`, backticks, and `$(command)` as literal text inside those quotes. Replace each literal single quote in the value with the exact POSIX sequence `'\''`.
54
+
55
+ Use these actual output shapes as examples. They are queries themselves, not full user prompts or instructions for the user. Each Chinese/English pair is a language variant: choose the one matching the user, never run both merely because both are shown. The comments explain the example only and are not part of emitted query text.
56
+
57
+ ```bash
58
+ # One tightly coupled decision: emit one query.
59
+ memorax-cli search --query 'Trace 生产版本:升级后到达的记录中,应以哪个客户端版本字段判断由旧插件产生,而非新版本上传进程?'
60
+ memorax-cli search --query 'Trace producer version: after an upgrade, which client-version field shows that an event came from the old plugin rather than the new uploader?'
61
+
62
+ # Two independent boundaries: emit a complementary pair.
63
+ memorax-cli search --query '任务上下文:升级新包后已打开任务仍按旧提示,是否绑定旧版本且必须新开对话?'
64
+ memorax-cli search --query '包缓存版本冲突:本地新包与缓存冲突时,已打开任务为何仍使用旧提示,如何确认实际加载版本?'
65
+ memorax-cli search --query 'Task context after upgrade: can an already-open task keep old injected context, and must validation use a fresh task?'
66
+ memorax-cli search --query 'Package-cache version collision: how do we confirm which version the active task actually loaded?'
67
+
68
+ # Preserve an explicit lifecycle condition and the required invariant.
69
+ memorax-cli search --query '自动写回:事件回调不等待 Promise 时,如何在消息终态后执行并防止重复?'
70
+ memorax-cli search --query 'Automatic writeback: when an event callback does not await a Promise, how should it run after message terminal state without duplicates?'
71
+
72
+ # Preserve a source boundary rather than turning it into a generic SDK question.
73
+ memorax-cli search --query '桌面 SDK 数据权威:无原生命令行时,应从哪些规范化消息和会话生命周期事件获取数据?'
74
+ memorax-cli search --query 'Desktop SDK authority: without a native CLI, which normalized messages and session lifecycle events are authoritative?'
75
+ ```
76
+
77
+ Keep queries under 25 words when practical for the language, but do not shorten them into ungrammatical fragments. Exclude secrets, private URLs, full prompts, raw transcripts, copied files, long logs, stack traces, and one-off task details.
78
+
79
+ Do not use abstract query facets such as "state", "fix", "safety", or "best practice" unless they are the concrete target. Do not use generic security or safety queries as complementary queries; bind every query to an exact target, condition, and behavior boundary.
80
+
81
+ Merge and deduplicate first-round results by item identity when available, otherwise by matching scope, condition, claim, and consequence. Accept a memory only when all three checks pass: it has the same component, API, workflow, or ownership boundary; it has the same behavior, symptom, condition, or change; and it supplies a condition, conclusion, consequence, fix, or validation idea that can change the current action. Read or summarize at most two accepted direct hits. Prefer memories matching the current repository, module, API, lifecycle surface, ownership boundary, behavior, and failure mode. Treat verified memories as routing and validation hints, not patch recipes. Treat failed-attempt memories as negative evidence. Ignore stale or unrelated items and anything conflicting with current source, tests, or durable documentation. For application questions, reject retrieval-strategy, evaluation, prompting, or workflow-process memories as domain evidence even if they repeat application terms. If no memory passes all three checks, say that memory is insufficient for the requested decision rather than filling the gap with a generic principle.
82
+
83
+ ## Transport Failures
84
+
85
+ If search fails with `fetch failed`, `This operation was aborted`, a timeout, DNS failure, `ENOTFOUND`, `EAI_AGAIN`, or a similar transport or sandbox error, retry the same `memorax-cli search` once in an approved network-enabled execution mode when one is available. Preserve the same query, workspace, and environment variables.
86
+
87
+ Do not apply this retry to `memorax-cli add`, authentication or configuration failures, or HTTP errors. If no approved mode is available or the one retry fails, report the exact CLI failure and continue with live evidence. Do not interpret a transport failure as an empty result, bypass the CLI, or call MemoraX directly.
88
+
89
+ ## Output
90
+
91
+ Mention only an invariant, pitfall, convention, or validation idea that materially affects the answer. Ground claims about current implementation behavior in live code and checks.