@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,99 @@
1
+ #!/usr/bin/env node
2
+ import { cp, mkdir, readdir, readFile, rm, writeFile } from "node:fs/promises";
3
+ import { dirname, join, resolve } from "node:path";
4
+ import { fileURLToPath, pathToFileURL } from "node:url";
5
+ import {
6
+ collectClaudePluginArtifactSources,
7
+ describeClaudePluginArtifactProblems,
8
+ inspectClaudePluginArtifact,
9
+ } from "../src/plugin-artifact-contract.mjs";
10
+
11
+ const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
12
+ const ADAPTER_ROOT = resolve(SCRIPT_DIR, "..");
13
+ const PLUGIN_NAME = "memorax-code-claude-adapter";
14
+
15
+ export async function buildClaudeMarketplace({ outputDir, adapterRoot = ADAPTER_ROOT } = {}) {
16
+ if (!outputDir) throw new Error("outputDir is required");
17
+ const marketplaceRoot = resolve(outputDir);
18
+ const pluginRoot = join(marketplaceRoot, "plugins", PLUGIN_NAME);
19
+ const artifactSources = collectClaudePluginArtifactSources({ adapterRoot });
20
+
21
+ await rm(marketplaceRoot, { recursive: true, force: true });
22
+ await mkdir(join(marketplaceRoot, ".claude-plugin"), { recursive: true });
23
+ await mkdir(pluginRoot, { recursive: true });
24
+
25
+ await writeFile(
26
+ join(marketplaceRoot, ".claude-plugin", "marketplace.json"),
27
+ `${JSON.stringify({
28
+ name: "memorax-code-local",
29
+ description: "MemoraX Code integration for Claude Code.",
30
+ owner: {
31
+ name: "MemoraX Code Local",
32
+ },
33
+ plugins: [
34
+ {
35
+ name: PLUGIN_NAME,
36
+ displayName: "MemoraX Code",
37
+ source: `./plugins/${PLUGIN_NAME}`,
38
+ description: "Connect Claude Code to MemoraX Code memory.",
39
+ },
40
+ ],
41
+ }, null, 2)}\n`
42
+ );
43
+
44
+ for (const source of artifactSources) {
45
+ const destination = join(pluginRoot, ...source.relativePath.split("/"));
46
+ await mkdir(dirname(destination), { recursive: true });
47
+ await cp(source.sourcePath, destination, { force: true });
48
+ }
49
+ await rewriteAdapterCommonImports(pluginRoot);
50
+ const inspection = inspectClaudePluginArtifact(pluginRoot, artifactSources);
51
+ if (!inspection.ok) {
52
+ throw new Error(
53
+ `generated Claude plugin violates its artifact contract: ${describeClaudePluginArtifactProblems(inspection)}`,
54
+ );
55
+ }
56
+
57
+ return {
58
+ ok: true,
59
+ marketplaceRoot,
60
+ pluginName: PLUGIN_NAME,
61
+ pluginRoot,
62
+ };
63
+ }
64
+
65
+ async function rewriteAdapterCommonImports(pluginRoot) {
66
+ for (const dir of ["hooks", "runtime-hooks", "src"]) {
67
+ for (const path of await mjsFiles(join(pluginRoot, dir))) {
68
+ const text = await readFile(path, "utf8");
69
+ const next = text.replaceAll("../../memorax-code-adapter-common/src/", "../memorax-code-adapter-common/src/");
70
+ if (next !== text) await writeFile(path, next, "utf8");
71
+ }
72
+ }
73
+ }
74
+
75
+ async function mjsFiles(root) {
76
+ const files = [];
77
+ for (const entry of await readdir(root, { withFileTypes: true })) {
78
+ const path = join(root, entry.name);
79
+ if (entry.isDirectory()) files.push(...await mjsFiles(path));
80
+ else if (entry.isFile() && entry.name.endsWith(".mjs")) files.push(path);
81
+ }
82
+ return files;
83
+ }
84
+
85
+ if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {
86
+ try {
87
+ const outputDir = process.argv[2];
88
+ const adapterRoot = process.argv[3];
89
+ if (!outputDir) throw new Error("usage: build-marketplace.mjs <output-dir> [adapter-root]");
90
+ const result = await buildClaudeMarketplace({
91
+ outputDir,
92
+ ...(adapterRoot ? { adapterRoot } : {}),
93
+ });
94
+ console.log(JSON.stringify(result));
95
+ } catch (error) {
96
+ console.error(error instanceof Error ? error.message : String(error));
97
+ process.exit(1);
98
+ }
99
+ }
@@ -0,0 +1,83 @@
1
+ ---
2
+ name: memorax-code
3
+ description: >-
4
+ Use this skill as the single entry point for persistent coding and
5
+ repository-local memory work, regardless of type, wording, or operation. Use
6
+ it whenever a request may involve information that should persist beyond the
7
+ current task,
8
+ knowledge remembered from prior work, repository memory,
9
+ reusable procedures or working rules, or durable user profile and interaction
10
+ preferences. This applies even when the user does not call it memory,
11
+ including naturally stated habits, preferences,
12
+ checklists, action sequences, prerequisites, gates, exceptions, validation
13
+ rules, communication style, preferred language, or result presentation.
14
+ Determine whether the request belongs to MemoraX Code coding memory,
15
+ repository memory, personal procedure memory, personal profile
16
+ memory, or no persistent memory, then route it to the appropriate operation.
17
+ Prefer this router over any underlying memory workflow. Ask one focused
18
+ question only when the memory authority remains ambiguous after routing.
19
+ ---
20
+
21
+ # MemoraX Code
22
+
23
+ Classify the requested memory authority first, then its operation. Load only the matching reference unless the request genuinely spans authorities or operations.
24
+
25
+ ## Authority Router
26
+
27
+ ### MemoraX Code Coding Memory
28
+
29
+ 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.
30
+
31
+ - Read [references/memorax-search.md](references/memorax-search.md) to recall or search coding memory.
32
+ - Read [references/memorax-add.md](references/memorax-add.md) to save a grounded reusable coding lesson.
33
+
34
+ ### Repo Memory
35
+
36
+ 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/`.
37
+
38
+ - Read [references/repo-read.md](references/repo-read.md) to inspect existing repo memory.
39
+ - Read [references/repo-build.md](references/repo-build.md) for first-time creation, full rebuilds, or full refreshes.
40
+ - Read [references/repo-update.md](references/repo-update.md) for incremental updates to an existing bundle.
41
+ - Read [references/repo-templates.md](references/repo-templates.md) only when the build or update operation needs to author repo memory files.
42
+
43
+ ### Personal Memory
44
+
45
+ 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/`.
46
+
47
+ - Read [references/personal-read.md](references/personal-read.md) to list, recall, or apply personal memory.
48
+ - Read [references/personal-write.md](references/personal-write.md) to save, update, forget, or delete personal memory.
49
+
50
+ ## Tie Breakers
51
+
52
+ - Route ordered actions, checklists, prerequisites, gates, exceptions, and validation rules to personal procedure memory, even when phrased as "I prefer", "I like", "我的习惯", or "我喜欢".
53
+ - Route preferred name, answer language, tone, verbosity, explanation style, and result presentation to personal profile memory.
54
+ - Route task-learned repairs, coding pitfalls, project engineering conventions, and reusable design lessons to MemoraX Code coding memory.
55
+ - Route repository architecture, module maps, commit history, PRs, MRs, and issues to repo memory. Verify claims about current behavior against live code.
56
+ - Route current-task instructions and temporary plans to the current task only; do not persist them.
57
+ - Do not infer an authority from verbs such as "remember", "recall", "refresh", or "update" alone. Ask one focused question when the target remains ambiguous.
58
+
59
+ Examples:
60
+
61
+ - "先测试再提 PR,帮我记住" routes to personal procedure write.
62
+ - "我喜欢中文简短回答" routes to personal profile write.
63
+ - "之前这个 bug 怎么修的?" routes to MemoraX Code coding memory search unless the user asks for commit or PR evidence.
64
+ - "这个仓库的架构是什么?" routes to repo memory read.
65
+ - "重新生成仓库 memory" routes to repo memory build.
66
+ - "更新一下 memory" requires clarification when no authority is identifiable.
67
+
68
+ ## Shared Rules
69
+
70
+ 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.
71
+
72
+ 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.
73
+
74
+ 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.
75
+
76
+ For MemoraX Code coding memory, use `memorax-cli` exactly as described by the selected reference. Invoke this skill as `$memorax-code` in Codex or `/memorax-code` in Claude Code; neither invocation is a shell command. `memorax-code` is the lifecycle CLI and must not be used for memory search or add. Do not call MemoraX HTTP endpoints directly.
77
+
78
+ When explaining Memory Viewer, describe only `/memory-viewer`. It is a
79
+ content-free local summary and must not expose conversation or memory text,
80
+ session or turn identifiers, paths, or trace details. The page never queries
81
+ MemoraX directly; client Hooks are the trace ingress authority.
82
+
83
+ 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,9 @@
1
+ {
2
+ "schema": "repo_memory_builder_defaults.v1",
3
+ "limits": {
4
+ "commits": 30,
5
+ "prs": 30,
6
+ "issues": 30
7
+ },
8
+ "summaryChars": 4000
9
+ }
@@ -0,0 +1,82 @@
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; 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
+ ## Exclusions
75
+
76
+ 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.
77
+
78
+ 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.
79
+
80
+ ## Output
81
+
82
+ 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,61 @@
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; 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
+ Require a readable active workspace binding. A CLI command from a linked worktree of the bound repository is valid. If the CLI reports `workspace_scope_mismatch`, ask the user to start a task in the target repository or local workspace. Do not retry from an unrelated scope or fall back to an unscoped user id.
12
+
13
+ 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.
14
+
15
+ ## Search Decision
16
+
17
+ Search when prior coding memory may change localization, implementation, review, validation, or explanation. Typical triggers include:
18
+
19
+ - a request for a previous fix, failed approach, coding convention, design decision, or reusable lesson;
20
+ - implementation, review, planning, API, schema, parser, workflow-contract, or migration work where prior project guidance may matter;
21
+ - explicit instructions to follow previous agreements or remembered engineering conventions.
22
+
23
+ Skip search for simple current-code facts, tiny edits, typo fixes, one-shot commands, or behavior directly established by a clear live source.
24
+
25
+ Choose the closest coding scene to shape the query:
26
+
27
+ - **Development:** implementation, debugging, refactoring, test repair, build failures, feature work, API design, or migration planning.
28
+ - **Review:** diff, commit, PR, patch, audit, risk assessment, or review-comment handling.
29
+ - **Understanding:** implementation location, module explanation, architecture rationale, or repository comprehension when repo memory is not the requested authority.
30
+
31
+ If the user asks for commit, PR, MR, issue, or repository architecture evidence, return to `SKILL.md` and route to repo memory instead.
32
+
33
+ ## Query Workflow
34
+
35
+ Run at most one focused search before answering or editing. A development task may run one additional materially different search only after a failed test or dead-end investigation.
36
+
37
+ Write each query as one short natural-language question or intent statement, not a keyword list. Derive it from the user's retrieval goal instead of copying or concatenating nouns from the prompt. Follow the user's language for the prose while preserving exact code, API, path, workflow, and project identifiers. State what prior knowledge is needed and the relationship, decision, constraint, behavior, or risk being investigated. Include 2-5 stable exact identifiers when they are relevant and known, but integrate them grammatically instead of appending search tags or filler.
38
+
39
+ 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 `'\''`.
40
+
41
+ For example:
42
+
43
+ ```bash
44
+ memorax-cli search --query 'What prior decisions define the memorax-code parser API failure boundary for malformed input?'
45
+ memorax-cli search --query 'What prior review policies and regression risks apply to the memorax-code parser API cleanup boundary?'
46
+ memorax-cli search --query 'memorax-code 中 Backend、Codex adapter 与 memory 层的职责如何衔接,之前为什么这样划分?'
47
+ ```
48
+
49
+ 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.
50
+
51
+ Read or summarize at most two relevant items. Prefer memories matching the current repository, module, API, lifecycle surface, ownership boundary, behavior, and failure mode. Treat verified memories as routing and validation hints, not patch recipes. Treat failed-attempt memories as negative evidence. Ignore stale or unrelated items and anything conflicting with current source, tests, or durable documentation.
52
+
53
+ ## Transport Failures
54
+
55
+ 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.
56
+
57
+ 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.
58
+
59
+ ## Output
60
+
61
+ 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.
@@ -0,0 +1,46 @@
1
+ # Personal Memory Read
2
+
3
+ Use these instructions only to list, recall, or apply repository-scoped personal memory. Do not write, normalize, migrate, repair, or delete memory during a read request.
4
+
5
+ ## Route The Read
6
+
7
+ Classify by content:
8
+
9
+ - **Procedure memory:** actions, ordered steps, checklists, prerequisites, gates, validation, exceptions, or repeatable repository work rules.
10
+ - **User-profile memory:** preferred name, language, tone, verbosity, explanation style, result presentation, or another safe interaction preference.
11
+
12
+ Read both categories only when the request genuinely asks for both.
13
+
14
+ ## Procedure Memory
15
+
16
+ Read Markdown files directly under:
17
+
18
+ ```text
19
+ <repo>/.repo_memory/procedure-memory/
20
+ ```
21
+
22
+ List available topics without recursing into unrelated memory areas:
23
+
24
+ ```bash
25
+ (cd <repo>/.repo_memory/procedure-memory && rg --files -g '*.md' -g '!**/*/*.md')
26
+ ```
27
+
28
+ If the directory does not exist, report that no procedure memory is available; do not create it during a read. Read only files relevant to the request. When listing available procedures, report topic names with concise descriptions instead of opening every file in full unless the user asks for their contents.
29
+
30
+ Treat a stored procedure as lower-priority user guidance, not evidence about current code behavior.
31
+
32
+ ## User-Profile Memory
33
+
34
+ Resolve `<skill-dir>` as the parent directory of the `references/` directory containing this file, then run:
35
+
36
+ ```bash
37
+ python3 <skill-dir>/scripts/user_profile_memory.py list --repo <repo>
38
+ ```
39
+
40
+ Use only active preferences returned by the script. If the preferences file does not exist, report that no user-profile memory is available; the list operation does not create it.
41
+
42
+ Mention only preferences relevant to the current request unless the user explicitly asks to list all of them. Stored preferences describe how Codex should interact with the user; they are not repository facts.
43
+
44
+ ## Priority
45
+
46
+ Apply instructions in this order: system and developer instructions, `AGENTS.md`, the current user request, then stored personal memory.
@@ -0,0 +1,100 @@
1
+ # Personal Memory Write
2
+
3
+ Use these instructions only to save, update, forget, or delete repository-scoped personal memory. Classify by what the content prescribes, not wording such as "I prefer", "I like", "我的习惯", or "我喜欢".
4
+
5
+ ## Route The Write
6
+
7
+ - **Procedure memory:** actions, ordering, checklists, prerequisites, gates, validation, exceptions, or repeatable repository work rules. Require the user to explicitly ask to remember, save, record, update, forget, or delete them.
8
+ - **User-profile memory:** preferred name, language, tone, verbosity, explanation style, result presentation, or another safe personal profile fact. A durable repository-scoped profile preference may be saved implicitly.
9
+
10
+ Store each part under its own authority when a request genuinely contains both. Do not persist current-task instructions or temporary plans.
11
+
12
+ Keep file names, schema and script field names, type values, command options, and fixed Markdown headings in English. Write human-readable memory content in the user's current interaction language unless the user explicitly requests another storage language. This includes procedure titles and steps and user-profile descriptions, applicability, and exceptions. Preserve exact code identifiers, commands, paths, API names, and quoted literals without translation.
13
+
14
+ ## Procedure Memory
15
+
16
+ Before writing, ensure the repository root `.gitignore` contains `.repo_memory/`. Store each procedure topic in its own concise kebab-case file directly under:
17
+
18
+ ```text
19
+ <repo>/.repo_memory/procedure-memory/
20
+ ```
21
+
22
+ Do not create a global procedures file, index, event log, generated metadata, or version history. Do not edit `.repo_memory/PROFILE.md`, `.repo_memory/resources/`, `.repo_memory/raw/`, or `.repo_memory/user-profile/`.
23
+
24
+ Choose the closest existing topic file. Update it when the user refines the same procedure; create a new file only for a distinct topic. Remove superseded wording rather than preserving old versions.
25
+
26
+ Use this shape when useful:
27
+
28
+ ```markdown
29
+ # 代码审查
30
+
31
+ Use when: 审查当前仓库中的代码变更时。
32
+
33
+ ## Procedure
34
+
35
+ 1. 创建 PR 前先审查变更。
36
+ 2. 解决阻塞性问题。
37
+ 3. 审查完成后再创建 PR。
38
+
39
+ ## Exceptions
40
+
41
+ - 优先遵循用户当前提出的更具体指令。
42
+ ```
43
+
44
+ Delete only the topic file or section the user explicitly identifies. Do not retain deleted text in tombstones, backups, inactive entries, or history files.
45
+
46
+ ## User-Profile Memory
47
+
48
+ Use only:
49
+
50
+ ```text
51
+ <repo>/.repo_memory/user-profile/preferences.md
52
+ ```
53
+
54
+ Resolve `<skill-dir>` as the parent directory of the `references/` directory containing this file. The script owns directory creation, `.gitignore` updates, parsing, normalization, locking, duplicate detection, counts, and deterministic rewriting. Do not hand-edit `preferences.md` except when diagnosing a script failure.
55
+
56
+ List existing preferences before adding and perform semantic matching:
57
+
58
+ ```bash
59
+ python3 <skill-dir>/scripts/user_profile_memory.py list --repo <repo>
60
+ ```
61
+
62
+ If equivalent content exists, do not add it again. Update the matching id when an existing entry expresses the same preference differently. Add only a genuinely new preference:
63
+
64
+ ```bash
65
+ python3 <skill-dir>/scripts/user_profile_memory.py add \
66
+ --repo <repo> \
67
+ --type communication \
68
+ --description "用户希望在当前仓库中使用简洁的中文回答。" \
69
+ --applies-when "回答当前仓库相关问题时。" \
70
+ --do-not-apply-when "用户明确要求使用其他语言或格式。"
71
+ ```
72
+
73
+ Allowed script types are `communication`, `workflow`, `environment`, and `profile`. These type names do not expand this authority: never use `workflow` or `environment` to store an executable repository procedure.
74
+
75
+ Update a clearly identified preference in place:
76
+
77
+ ```bash
78
+ python3 <skill-dir>/scripts/user_profile_memory.py update \
79
+ --repo <repo> \
80
+ --id <preference-id> \
81
+ --description <current-description> \
82
+ --applies-when <current-scope> \
83
+ --do-not-apply-when <exception>
84
+ ```
85
+
86
+ If multiple preferences may match, ask the user to choose before updating. Delete only an explicitly identified preference:
87
+
88
+ ```bash
89
+ python3 <skill-dir>/scripts/user_profile_memory.py delete \
90
+ --repo <repo> \
91
+ --id <preference-id>
92
+ ```
93
+
94
+ For delete-all requests, list active preferences and delete each id. Do not preserve deleted text elsewhere.
95
+
96
+ ## Safety And Output
97
+
98
+ Do not store secrets, tokens, credentials, `.env` content, sensitive personal data, repository facts, code history, design rationale, one-off task details, raw transcripts, hidden tests, exact patches, raw diffs, target commits, or unsafe destructive commands.
99
+
100
+ After a successful write, update, or deletion, identify the affected topic or preference briefly and confirm that it is local to the current repository.