@memorax/memorax-code 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -12
- package/bin/memorax-code-npm-preinstall.mjs +7 -2
- package/bin/memorax-code-opencode.mjs +4 -0
- package/bin/memorax-code-plugin-postinstall.mjs +424 -108
- package/docs/configuration.md +153 -29
- package/docs/troubleshooting.md +93 -7
- package/lib/dsh-plugin-install.mjs +22 -0
- package/lib/memorax-code-adapter-common/src/hooks/capture-cwd-hook.mjs +21 -14
- package/lib/memorax-code-adapter-common/src/hooks/ensure-backend-runner.mjs +26 -7
- package/lib/memorax-code-adapter-common/src/hooks/memory-skill-reminder-hook.mjs +86 -95
- package/lib/memorax-code-adapter-common/src/hooks/memory-skill-reminder-policy.mjs +58 -0
- package/lib/memorax-code-adapter-common/src/repo-memory/repo-memory-auto-build.mjs +38 -0
- package/lib/memorax-code-adapter-common/src/repo-memory/repo-memory-job-supervisor.mjs +1 -1
- package/lib/memorax-code-adapter-common/src/windows-cli-invocation.mjs +13 -1
- package/lib/memorax-code-backend/dist/app/backend-server.js +210 -0
- package/lib/memorax-code-backend/dist/{server-observability.js → app/memory-observability.js} +4 -4
- package/lib/memorax-code-backend/dist/{backend-state.js → app/state.js} +1 -1
- package/lib/memorax-code-backend/dist/{claude-adapter-lifecycle.js → clients/claude/lifecycle.js} +2 -2
- package/lib/memorax-code-backend/dist/{claude-memory-hook-runtime.js → clients/claude/memory-hook-runtime.js} +16 -9
- package/lib/memorax-code-backend/dist/clients/codex/lifecycle.js +131 -0
- package/lib/memorax-code-backend/dist/{codex-memory-hook-runtime.js → clients/codex/memory-hook-runtime.js} +18 -11
- package/lib/memorax-code-backend/dist/{codex-plugin-hooks.js → clients/codex/plugin-hooks.js} +1 -1
- package/lib/memorax-code-backend/dist/{codex-plugin-install.js → clients/codex/plugin-install.js} +6 -6
- package/lib/memorax-code-backend/dist/clients/dsh/lifecycle.js +75 -0
- package/lib/memorax-code-backend/dist/clients/dsh/memory-hook-runtime.js +258 -0
- package/lib/memorax-code-backend/dist/clients/dsh/session-turn.js +249 -0
- package/lib/memorax-code-backend/dist/clients/opencode/lifecycle.js +54 -0
- package/lib/memorax-code-backend/dist/clients/opencode/memory-hook-runtime.js +277 -0
- package/lib/memorax-code-backend/dist/clients/opencode/message-turn.js +78 -0
- package/lib/memorax-code-backend/dist/codex-adapter-lifecycle.js +1 -131
- package/lib/memorax-code-backend/dist/{memorax-code-config.js → config/memorax-code.js} +32 -4
- package/lib/memorax-code-backend/dist/{server-cli.js → entrypoints/backend-cli.js} +157 -34
- package/lib/memorax-code-backend/dist/jsonl-append.js +1 -75
- package/lib/memorax-code-backend/dist/{active-client-selection.js → lifecycle/active-clients.js} +12 -1
- package/lib/memorax-code-backend/dist/{backend-service-cleanup.js → lifecycle/backend/cleanup.js} +1 -1
- package/lib/memorax-code-backend/dist/{backend-service-record.js → lifecycle/backend/record.js} +1 -1
- package/lib/memorax-code-backend/dist/{backend-service-result.js → lifecycle/backend/result.js} +2 -2
- package/lib/memorax-code-backend/dist/{service.js → lifecycle/backend/service.js} +16 -16
- package/lib/memorax-code-backend/dist/{backend-token-record.js → lifecycle/backend/token-record.js} +1 -1
- package/lib/memorax-code-backend/dist/{backend-service-token.js → lifecycle/backend/token.js} +2 -2
- package/lib/memorax-code-backend/dist/lifecycle/client-plugin-removal.js +109 -0
- package/lib/memorax-code-backend/dist/{client-selection.js → lifecycle/client-selection.js} +11 -5
- package/lib/memorax-code-backend/dist/{backend-lifecycle-lock.js → lifecycle/lock.js} +1 -1
- package/lib/memorax-code-backend/dist/{memorax-code-lifecycle.js → lifecycle/orchestrator.js} +325 -39
- package/lib/memorax-code-backend/dist/memorax-cli.js +3 -1
- package/lib/memorax-code-backend/dist/memorax-code.js +1 -1
- package/lib/memorax-code-backend/dist/{automatic-memory-retrieval.js → memory/automatic-retrieval.js} +3 -3
- package/lib/memorax-code-backend/dist/{automatic-memory-writeback.js → memory/automatic-writeback.js} +82 -21
- package/lib/memorax-code-backend/dist/{memory-cli.js → memory/cli.js} +45 -10
- package/lib/memorax-code-backend/dist/{memory-hook-command.js → memory/hook-command.js} +156 -9
- package/lib/memorax-code-backend/dist/memory/observability.js +1 -0
- package/lib/memorax-code-backend/dist/memory/payload-redaction.js +212 -0
- package/lib/memorax-code-backend/dist/{memory-reminder-trace-recorder.js → memory/reminder-trace-recorder.js} +20 -7
- package/lib/memorax-code-backend/dist/{repository-memory-context.js → memory/repository-session.js} +25 -4
- package/lib/memorax-code-backend/dist/{memory-service.js → memory/service.js} +30 -6
- package/lib/memorax-code-backend/dist/{memory-turn-coordinator.js → memory/turn-coordinator.js} +7 -3
- package/lib/memorax-code-backend/dist/{memory-writeback-buffer.js → memory/writeback-buffer.js} +31 -2
- package/lib/memorax-code-backend/dist/{memory-writeback-chunk.js → memory/writeback-chunk.js} +1 -1
- package/lib/memorax-code-backend/dist/{memory-writeback-reconciler.js → memory/writeback-reconciler.js} +6 -6
- package/lib/memorax-code-backend/dist/{memory-writeback-task-projection.js → memory/writeback-task-projection.js} +4 -4
- package/lib/memorax-code-backend/dist/{memorax-adapter.js → provider/memorax/adapter.js} +5 -5
- package/lib/memorax-code-backend/dist/{memorax-config.js → provider/memorax/config.js} +4 -4
- package/lib/memorax-code-backend/dist/{memorax-http.js → provider/memorax/http.js} +1 -1
- package/lib/memorax-code-backend/dist/{repo-memory-readiness.js → repository/readiness.js} +3 -3
- package/lib/memorax-code-backend/dist/{repository-memory-scope.js → repository/scope.js} +81 -33
- package/lib/memorax-code-backend/dist/server.js +3 -212
- package/lib/memorax-code-backend/dist/service-entrypoint.js +1 -1
- package/lib/memorax-code-backend/dist/{debug-log.js → shared/debug-log.js} +1 -1
- package/lib/memorax-code-backend/dist/shared/jsonl-append.js +75 -0
- package/lib/memorax-code-backend/dist/shared/windows-cli-invocation.js +148 -0
- package/lib/memorax-code-backend/dist/{trace-config.js → trace/config.js} +43 -5
- package/lib/memorax-code-backend/dist/{trace-context.js → trace/context.js} +53 -2
- package/lib/memorax-code-backend/dist/{trace-store.js → trace/store.js} +3 -3
- package/lib/memorax-code-backend/dist/{server-health.js → transport/http/health.js} +1 -1
- package/lib/memorax-code-backend/dist/{server-memory-hook.js → transport/http/memory-hook.js} +3 -3
- package/lib/memorax-code-backend/dist/{server-http.js → transport/http/request.js} +1 -1
- package/lib/memorax-code-backend/dist/{claude-local-transcript.js → viewer/history/claude-transcript.js} +3 -3
- package/lib/memorax-code-backend/dist/{memory-viewer-session-title.js → viewer/history/session-title.js} +1 -1
- package/lib/memorax-code-backend/dist/{server-memory-viewer.js → viewer/http/public-routes.js} +25 -14
- package/lib/memorax-code-backend/dist/viewer/model.js +1 -0
- package/lib/memorax-code-backend/dist/{memory-viewer-activity.js → viewer/projection/activity.js} +2 -2
- package/lib/memorax-code-backend/dist/{memory-viewer-history-projection.js → viewer/projection/history.js} +1 -1
- package/lib/memorax-code-backend/dist/{memory-viewer-observability.js → viewer/projection/observability.js} +1 -1
- package/lib/memorax-code-backend/dist/{memory-viewer-user-projection.js → viewer/projection/user.js} +1 -1
- package/lib/memorax-code-backend/dist/{memory-viewer-writeback-status.js → viewer/projection/writeback-status.js} +1 -1
- package/lib/memorax-code-backend/dist/{memory-viewer-store.js → viewer/store.js} +59 -32
- package/lib/memorax-code-backend/dist/viewer/ui/icon.js +1 -0
- package/lib/memorax-code-backend/dist/{memory-viewer-user-html.js → viewer/ui/user-html.js} +14 -12
- package/lib/memorax-code-backend/dist/windows-cli-invocation.js +1 -148
- package/lib/memorax-code-backend/package.json +3 -3
- package/lib/memorax-code-claude-adapter/.claude-plugin/plugin.json +1 -1
- package/lib/memorax-code-claude-adapter/hooks/runtime-shell.json +1 -1
- package/lib/memorax-code-claude-adapter/package.json +1 -1
- package/lib/memorax-code-claude-adapter/runtime-hooks/memory-turn.mjs +5 -0
- package/lib/memorax-code-claude-adapter/skills/memorax-code/SKILL.md +23 -15
- package/lib/memorax-code-claude-adapter/skills/memorax-code/defaults.json +8 -5
- package/lib/memorax-code-claude-adapter/skills/memorax-code/references/memorax-add.md +5 -1
- package/lib/memorax-code-claude-adapter/skills/memorax-code/references/memorax-search.md +40 -10
- package/lib/memorax-code-claude-adapter/skills/memorax-code/references/personal-read.md +1 -1
- package/lib/memorax-code-claude-adapter/skills/memorax-code/references/personal-write.md +33 -13
- package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-build.md +62 -13
- package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-read.md +11 -4
- package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-templates.md +179 -59
- package/lib/memorax-code-claude-adapter/skills/memorax-code/references/repo-update.md +18 -7
- package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/collect_all.py +122 -39
- package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/detect_updates.py +73 -10
- package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/github_resource_facets.py +9 -1
- package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +9 -1
- package/lib/memorax-code-claude-adapter/skills/memorax-code/scripts/validate_memory.py +23 -1
- package/lib/memorax-code-claude-adapter/src/plugin-install.mjs +2 -0
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/.claude-plugin/plugin.json +1 -1
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/hooks/runtime-shell.json +1 -1
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/capture-cwd-hook.mjs +21 -14
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/ensure-backend-runner.mjs +26 -7
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/memory-skill-reminder-hook.mjs +86 -95
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/memory-skill-reminder-policy.mjs +58 -0
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/repo-memory/repo-memory-auto-build.mjs +38 -0
- 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
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/windows-cli-invocation.mjs +13 -1
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/package.json +1 -1
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/runtime-hooks/memory-turn.mjs +5 -0
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/SKILL.md +23 -15
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/defaults.json +8 -5
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/memorax-add.md +5 -1
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/memorax-search.md +40 -10
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/personal-read.md +1 -1
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/personal-write.md +33 -13
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-build.md +62 -13
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-read.md +11 -4
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-templates.md +179 -59
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/repo-update.md +18 -7
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/collect_all.py +122 -39
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/detect_updates.py +73 -10
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/github_resource_facets.py +9 -1
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +9 -1
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/scripts/validate_memory.py +23 -1
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/src/plugin-install.mjs +2 -0
- package/lib/memorax-code-codex-adapter/.codex-plugin/plugin.json +1 -1
- package/lib/memorax-code-codex-adapter/hooks/runtime-shell.json +1 -1
- package/lib/memorax-code-codex-adapter/package.json +1 -1
- package/lib/memorax-code-codex-adapter/runtime-hooks/memory-skill-reminder.mjs +16 -2
- package/lib/memorax-code-codex-adapter/skills/memorax-code/SKILL.md +23 -15
- package/lib/memorax-code-codex-adapter/skills/memorax-code/defaults.json +8 -5
- package/lib/memorax-code-codex-adapter/skills/memorax-code/references/memorax-add.md +5 -1
- package/lib/memorax-code-codex-adapter/skills/memorax-code/references/memorax-search.md +40 -10
- package/lib/memorax-code-codex-adapter/skills/memorax-code/references/personal-read.md +1 -1
- package/lib/memorax-code-codex-adapter/skills/memorax-code/references/personal-write.md +33 -13
- package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-build.md +62 -13
- package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-read.md +11 -4
- package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-templates.md +179 -59
- package/lib/memorax-code-codex-adapter/skills/memorax-code/references/repo-update.md +18 -7
- package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/collect_all.py +122 -39
- package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/detect_updates.py +73 -10
- package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/github_resource_facets.py +9 -1
- package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +9 -1
- package/lib/memorax-code-codex-adapter/skills/memorax-code/scripts/validate_memory.py +23 -1
- package/lib/memorax-code-dsh-adapter/cordis.patch.yml +10 -0
- package/lib/memorax-code-dsh-adapter/hooks/repo-memory-job.mjs +68 -0
- package/lib/memorax-code-dsh-adapter/package.json +69 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/SKILL.md +91 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/agents/claude.yaml +10 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/agents/openai.yaml +7 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/defaults.json +12 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/memorax-add.md +86 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/memorax-search.md +91 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/personal-read.md +46 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/personal-write.md +120 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/repo-build.md +319 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/repo-read.md +103 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/repo-templates.md +390 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/repo-update.md +127 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/collect_all.py +579 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/detect_updates.py +919 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/git_commit_facets.py +222 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/github_resource_facets.py +512 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +517 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/prepare_repo_memory.py +411 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/user_profile_memory.py +528 -0
- package/lib/memorax-code-dsh-adapter/skills/memorax-code/scripts/validate_memory.py +248 -0
- package/lib/memorax-code-dsh-adapter/src/backend-client.mjs +119 -0
- package/lib/memorax-code-dsh-adapter/src/dsh-message.mjs +32 -0
- package/lib/memorax-code-dsh-adapter/src/dsh-version.mjs +18 -0
- package/lib/memorax-code-dsh-adapter/src/http-client.mjs +55 -0
- package/lib/memorax-code-dsh-adapter/src/index.mjs +72 -0
- package/lib/memorax-code-dsh-adapter/src/personal-context-worker.mjs +48 -0
- package/lib/memorax-code-dsh-adapter/src/personal-context.mjs +114 -0
- package/lib/memorax-code-dsh-adapter/src/plugin.mjs +724 -0
- package/lib/memorax-code-dsh-adapter/src/profile-lifecycle.mjs +1289 -0
- package/lib/memorax-code-dsh-adapter/src/protocol.mjs +145 -0
- package/lib/memorax-code-dsh-adapter/src/runtime-state.mjs +132 -0
- package/lib/memorax-code-opencode-adapter/hooks/repo-memory-job.mjs +37 -0
- package/lib/memorax-code-opencode-adapter/package.json +10 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/SKILL.md +91 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/agents/claude.yaml +10 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/agents/openai.yaml +7 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/defaults.json +12 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/memorax-add.md +86 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/memorax-search.md +91 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/personal-read.md +46 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/personal-write.md +120 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/repo-build.md +319 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/repo-read.md +103 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/repo-templates.md +390 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/repo-update.md +127 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/collect_all.py +579 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/detect_updates.py +919 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/git_commit_facets.py +222 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/github_resource_facets.py +512 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +517 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/prepare_repo_memory.py +411 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/user_profile_memory.py +528 -0
- package/lib/memorax-code-opencode-adapter/skills/memorax-code/scripts/validate_memory.py +248 -0
- package/lib/memorax-code-opencode-adapter/src/adapter-paths.mjs +37 -0
- package/lib/memorax-code-opencode-adapter/src/cli.mjs +260 -0
- package/lib/memorax-code-opencode-adapter/src/diagnostics.mjs +31 -0
- package/lib/memorax-code-opencode-adapter/src/plugin-install.mjs +673 -0
- package/lib/memorax-code-opencode-adapter/src/plugin.mjs +536 -0
- package/lib/memorax-code-opencode-adapter/src/repo-memory-server-runner.mjs +207 -0
- package/lib/resolve-claude-command.mjs +154 -1
- package/lib/resolve-codex-command.mjs +56 -1
- package/lib/run-entrypoint.mjs +6 -0
- package/package.json +7 -3
- package/lib/memorax-code-backend/dist/client-plugin-removal.js +0 -67
- /package/lib/memorax-code-backend/dist/{claude-transcript-turn.js → clients/claude/transcript-turn.js} +0 -0
- /package/lib/memorax-code-backend/dist/{codex-effective-prompt.js → clients/codex/effective-prompt.js} +0 -0
- /package/lib/memorax-code-backend/dist/{codex-rollout-turn.js → clients/codex/rollout-turn.js} +0 -0
- /package/lib/memorax-code-backend/dist/{codex-session-turn-index.js → clients/codex/session-turn-index.js} +0 -0
- /package/lib/memorax-code-backend/dist/{codex-workspace-links.js → clients/codex/workspace-links.js} +0 -0
- /package/lib/memorax-code-backend/dist/{backend-env.js → config/backend-env.js} +0 -0
- /package/lib/memorax-code-backend/dist/{proxy-env.js → config/proxy-env.js} +0 -0
- /package/lib/memorax-code-backend/dist/{entrypoint.js → entrypoints/main.js} +0 -0
- /package/lib/memorax-code-backend/dist/{backend-process.js → lifecycle/backend/process.js} +0 -0
- /package/lib/memorax-code-backend/dist/{backend-shutdown-request.js → lifecycle/backend/shutdown-request.js} +0 -0
- /package/lib/memorax-code-backend/dist/{backend-status.js → lifecycle/backend/status.js} +0 -0
- /package/lib/memorax-code-backend/dist/{adapter-lifecycle-participant.js → lifecycle/contracts.js} +0 -0
- /package/lib/memorax-code-backend/dist/{install-watchdog.js → lifecycle/install-watchdog.js} +0 -0
- /package/lib/memorax-code-backend/dist/{memory-observability.js → lifecycle/participant.js} +0 -0
- /package/lib/memorax-code-backend/dist/{memory-project.js → memory/project.js} +0 -0
- /package/lib/memorax-code-backend/dist/{incremental-jsonl-projection.js → shared/incremental-jsonl-projection.js} +0 -0
- /package/lib/memorax-code-backend/dist/{utils.js → shared/record.js} +0 -0
- /package/lib/memorax-code-backend/dist/{server-json.js → transport/http/json.js} +0 -0
- /package/lib/memorax-code-backend/dist/{memory-viewer-data-projection-cache.js → viewer/projection/cache.js} +0 -0
- /package/lib/memorax-code-backend/dist/{memory-viewer-event-identity.js → viewer/projection/event-identity.js} +0 -0
- /package/lib/memorax-code-backend/dist/{memory-viewer-redaction.js → viewer/projection/redaction.js} +0 -0
- /package/lib/memorax-code-backend/dist/{memory-viewer-turn-reference.js → viewer/projection/turn-reference.js} +0 -0
- /package/lib/memorax-code-backend/dist/{memory-viewer-logo.js → viewer/ui/logo.js} +0 -0
|
@@ -5,19 +5,23 @@ import {
|
|
|
5
5
|
localBackendRecoveryArguments,
|
|
6
6
|
resolveBackendConnection,
|
|
7
7
|
} from "../backend-connection.mjs";
|
|
8
|
-
import { readStdinJson } from "../config-utils.mjs";
|
|
9
8
|
import { isRepoMemoryJobWorker } from "../repo-memory/repo-memory-job-context.mjs";
|
|
10
9
|
|
|
11
10
|
export const DEFAULT_ENSURE_BACKEND_START_TIMEOUT_MS = 90000;
|
|
11
|
+
const HOOK_INPUT_SYMBOL = Symbol.for("memorax-code.client-hook.input.v1");
|
|
12
12
|
|
|
13
13
|
export async function runEnsureBackendHook(options) {
|
|
14
|
-
if (isRepoMemoryJobWorker() || ensureDisabled(options.ensureBackendValue)) return;
|
|
15
|
-
|
|
16
14
|
const input = await readStdinJson();
|
|
15
|
+
await ensureBackendAvailable(options, input);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export async function ensureBackendAvailable(options, input = {}) {
|
|
19
|
+
if (isRepoMemoryJobWorker() || ensureDisabled(options.ensureBackendValue)) return;
|
|
17
20
|
const homes = options.resolveHomes(input);
|
|
18
21
|
let connection;
|
|
19
22
|
try {
|
|
20
|
-
connection =
|
|
23
|
+
connection = options.backendConnection
|
|
24
|
+
?? resolveBackendConnection({ memoraxCodeHome: homes.memoraxCodeHome });
|
|
21
25
|
} catch (error) {
|
|
22
26
|
options.debug?.(error instanceof Error ? error.message : String(error));
|
|
23
27
|
return;
|
|
@@ -36,6 +40,8 @@ export async function runEnsureBackendHook(options) {
|
|
|
36
40
|
command.value,
|
|
37
41
|
options.buildStartArgs(homes, recoveryArguments),
|
|
38
42
|
parsePositiveInt(options.startTimeoutValue, DEFAULT_ENSURE_BACKEND_START_TIMEOUT_MS),
|
|
43
|
+
options.nodePath,
|
|
44
|
+
options.recoveryEnv,
|
|
39
45
|
);
|
|
40
46
|
if (result.code !== 0) {
|
|
41
47
|
options.debug?.(
|
|
@@ -105,14 +111,14 @@ function memoraxCodeCommandAvailable(command) {
|
|
|
105
111
|
return path.split(delimiter).some((dir) => dir && existsSync(join(dir, command)));
|
|
106
112
|
}
|
|
107
113
|
|
|
108
|
-
function runMemoraxCode(command, args, timeoutMs) {
|
|
114
|
+
function runMemoraxCode(command, args, timeoutMs, nodePath, recoveryEnv) {
|
|
109
115
|
return new Promise((resolve) => {
|
|
110
116
|
const childArgs = nodeEntrypoint(command) ? [command, ...args] : args;
|
|
111
|
-
const childCommand = nodeEntrypoint(command) ? process.execPath : command;
|
|
117
|
+
const childCommand = nodeEntrypoint(command) ? (stringValue(nodePath) ?? process.execPath) : command;
|
|
112
118
|
let stderr = "";
|
|
113
119
|
let settled = false;
|
|
114
120
|
const child = spawn(childCommand, childArgs, {
|
|
115
|
-
env: process.env,
|
|
121
|
+
env: recoveryEnv === undefined ? process.env : { ...process.env, ...recoveryEnv },
|
|
116
122
|
stdio: ["ignore", "ignore", "pipe"],
|
|
117
123
|
});
|
|
118
124
|
const finish = (result) => {
|
|
@@ -140,3 +146,16 @@ function parsePositiveInt(value, fallback) {
|
|
|
140
146
|
const parsed = Number(value);
|
|
141
147
|
return Number.isInteger(parsed) && parsed > 0 ? parsed : fallback;
|
|
142
148
|
}
|
|
149
|
+
|
|
150
|
+
async function readStdinJson() {
|
|
151
|
+
const injected = globalThis[HOOK_INPUT_SYMBOL];
|
|
152
|
+
if (injected && typeof injected === "object" && !Array.isArray(injected)) return injected;
|
|
153
|
+
let text = "";
|
|
154
|
+
for await (const chunk of process.stdin) text += chunk;
|
|
155
|
+
if (!text.trim()) return {};
|
|
156
|
+
try {
|
|
157
|
+
return JSON.parse(text);
|
|
158
|
+
} catch {
|
|
159
|
+
return {};
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -7,31 +7,43 @@ import {
|
|
|
7
7
|
stringOption,
|
|
8
8
|
withJsonFileLock,
|
|
9
9
|
} from "../config-utils.mjs";
|
|
10
|
+
import {
|
|
11
|
+
isMemorySkillReminderDue,
|
|
12
|
+
memorySkillReminderContext,
|
|
13
|
+
personalMemoryReminderContext,
|
|
14
|
+
resolveMemorySkillReminderIntervalTurns,
|
|
15
|
+
} from "./memory-skill-reminder-policy.mjs";
|
|
10
16
|
|
|
11
|
-
const DEFAULT_REMINDER_INTERVAL_TURNS = 5;
|
|
12
|
-
const DEFAULT_MEMORY_SKILL_INVOCATION = "$memorax-code";
|
|
13
17
|
export const PERSONAL_MEMORY_REMINDER_CONTEXT = personalMemoryReminderContext();
|
|
14
|
-
|
|
15
|
-
export function personalMemoryReminderContext(memorySkillInvocation) {
|
|
16
|
-
const invocation = stringOption(memorySkillInvocation) ?? DEFAULT_MEMORY_SKILL_INVOCATION;
|
|
17
|
-
return [
|
|
18
|
-
`MemoraX Code personal-memory reminder: Use ${invocation} when the user states a durable current-repo identity or interaction preference, asks to list or recall stored personal memory, or explicitly asks to save, update, forget, or delete it.`,
|
|
19
|
-
"Route reusable action sequences and work rules to procedure memory; do not store repository facts, one-off task details, or secrets.",
|
|
20
|
-
].join(" ");
|
|
21
|
-
}
|
|
18
|
+
export { personalMemoryReminderContext } from "./memory-skill-reminder-policy.mjs";
|
|
22
19
|
|
|
23
20
|
export async function runMemorySkillReminderHook(options, hookInput) {
|
|
24
21
|
try {
|
|
25
22
|
const input = hookInput ?? await readStdinJson();
|
|
23
|
+
const result = await evaluateMemorySkillReminder(options, input);
|
|
24
|
+
if (!result) return;
|
|
25
|
+
process.stdout.write(`${JSON.stringify({
|
|
26
|
+
hookSpecificOutput: {
|
|
27
|
+
hookEventName: "UserPromptSubmit",
|
|
28
|
+
additionalContext: result.additionalContext,
|
|
29
|
+
},
|
|
30
|
+
})}\n`);
|
|
31
|
+
if (result.reminder) await notifyReminder(options, result.reminder);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
debugError(options, error);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export async function evaluateMemorySkillReminder(options, input) {
|
|
38
|
+
try {
|
|
26
39
|
const sessionId = stringOption(input.session_id) ?? stringOption(input.sessionId);
|
|
27
|
-
if (!sessionId) return;
|
|
40
|
+
if (!sessionId) return undefined;
|
|
28
41
|
const transcriptPath = stringOption(input.transcript_path) ?? stringOption(input.transcriptPath);
|
|
29
|
-
if (options.requireTranscriptPath && !transcriptPath) return;
|
|
42
|
+
if (options.requireTranscriptPath && !transcriptPath) return undefined;
|
|
30
43
|
const hookEventName = stringOption(input.hook_event_name) ?? stringOption(input.hookEventName) ?? "UserPromptSubmit";
|
|
44
|
+
if (hookEventName !== "UserPromptSubmit") return undefined;
|
|
31
45
|
|
|
32
|
-
const memoraxCodeHome =
|
|
33
|
-
if (hookEventName !== "UserPromptSubmit") return;
|
|
34
|
-
|
|
46
|
+
const memoraxCodeHome = resolveMemoraxCodeHome(options);
|
|
35
47
|
const statePath = join(memoraxCodeHome, "adapters", options.adapterDir, "memory-skill-reminders.json");
|
|
36
48
|
const turnId = stringOption(input.turn_id)
|
|
37
49
|
?? stringOption(input.turnId)
|
|
@@ -48,7 +60,7 @@ export async function runMemorySkillReminderHook(options, hookInput) {
|
|
|
48
60
|
);
|
|
49
61
|
if (next.duplicate) return next;
|
|
50
62
|
const sessionState = next.state.sessions[sessionId];
|
|
51
|
-
const memoryReminderDue =
|
|
63
|
+
const memoryReminderDue = isMemorySkillReminderDue(
|
|
52
64
|
sessionState?.turnCount,
|
|
53
65
|
intervalTurns,
|
|
54
66
|
options.remindOnFirstTurn !== false,
|
|
@@ -64,34 +76,30 @@ export async function runMemorySkillReminderHook(options, hookInput) {
|
|
|
64
76
|
turnCount: sessionState?.turnCount,
|
|
65
77
|
};
|
|
66
78
|
});
|
|
67
|
-
if (update.duplicate) return;
|
|
79
|
+
if (update.duplicate) return undefined;
|
|
68
80
|
const { memoryReminderDue, supplementalReminderDue } = update;
|
|
69
81
|
|
|
70
82
|
const baseAdditionalContext = stringOption(options.baseAdditionalContext);
|
|
71
|
-
if (baseAdditionalContext
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
},
|
|
92
|
-
})}\n`);
|
|
93
|
-
if (reminderContext) {
|
|
94
|
-
await notifyReminder(options, {
|
|
83
|
+
if (!baseAdditionalContext && !memoryReminderDue && !supplementalReminderDue) return undefined;
|
|
84
|
+
const cadenceReminderContext = memoryReminderDue
|
|
85
|
+
? await buildCadenceReminderContext(options, input)
|
|
86
|
+
: undefined;
|
|
87
|
+
const personalMemoryContext = supplementalReminderDue || (memoryReminderDue && update.turnCount === 1)
|
|
88
|
+
? await buildPersonalMemoryContext(options, input)
|
|
89
|
+
: undefined;
|
|
90
|
+
const reminderContext = stringOption(combinedReminderContext(options, {
|
|
91
|
+
memoryReminderDue,
|
|
92
|
+
supplementalReminderDue,
|
|
93
|
+
}, cadenceReminderContext, personalMemoryContext));
|
|
94
|
+
const additionalContext = [baseAdditionalContext, reminderContext].filter(Boolean).join("\n\n");
|
|
95
|
+
const triggers = [
|
|
96
|
+
...(memoryReminderDue ? ["cadence"] : []),
|
|
97
|
+
...(supplementalReminderDue ? ["post_compaction"] : []),
|
|
98
|
+
];
|
|
99
|
+
return {
|
|
100
|
+
additionalContext,
|
|
101
|
+
...(reminderContext ? {
|
|
102
|
+
reminder: {
|
|
95
103
|
sessionId,
|
|
96
104
|
turnId,
|
|
97
105
|
transcriptPath,
|
|
@@ -99,13 +107,12 @@ export async function runMemorySkillReminderHook(options, hookInput) {
|
|
|
99
107
|
workspaceKind: stringOption(input.workspace_kind) ?? stringOption(input.workspaceKind),
|
|
100
108
|
content: reminderContext,
|
|
101
109
|
triggers,
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
110
|
+
},
|
|
111
|
+
} : {}),
|
|
112
|
+
};
|
|
105
113
|
} catch (error) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
114
|
+
debugError(options, error);
|
|
115
|
+
return undefined;
|
|
109
116
|
}
|
|
110
117
|
}
|
|
111
118
|
|
|
@@ -125,21 +132,28 @@ export function markSupplementalReminderAfterCompact(options, input) {
|
|
|
125
132
|
const hookEventName = stringOption(input.hook_event_name) ?? stringOption(input.hookEventName);
|
|
126
133
|
if (hookEventName !== "SessionStart" || stringOption(input.source) !== "compact") return;
|
|
127
134
|
const sessionId = stringOption(input.session_id) ?? stringOption(input.sessionId);
|
|
128
|
-
|
|
129
|
-
|
|
135
|
+
markSupplementalReminderForSession(options, sessionId);
|
|
136
|
+
} catch (error) {
|
|
137
|
+
debugError(options, error);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export function markSupplementalReminderForSession(options, sessionId) {
|
|
142
|
+
try {
|
|
143
|
+
const normalizedSessionId = stringOption(sessionId);
|
|
144
|
+
if (!normalizedSessionId) return;
|
|
145
|
+
const memoraxCodeHome = resolveMemoraxCodeHome(options);
|
|
130
146
|
const statePath = join(memoraxCodeHome, "adapters", options.adapterDir, "memory-skill-reminders.json");
|
|
131
147
|
withJsonFileLock(statePath, () => {
|
|
132
148
|
const existing = readJsonFile(statePath);
|
|
133
149
|
atomicWriteJson(statePath, markSupplementalReminderPending(
|
|
134
150
|
existing?.unreadable ? undefined : existing?.value,
|
|
135
151
|
options.runtime,
|
|
136
|
-
|
|
152
|
+
normalizedSessionId,
|
|
137
153
|
));
|
|
138
154
|
});
|
|
139
155
|
} catch (error) {
|
|
140
|
-
|
|
141
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
142
|
-
}
|
|
156
|
+
debugError(options, error);
|
|
143
157
|
}
|
|
144
158
|
}
|
|
145
159
|
|
|
@@ -169,7 +183,7 @@ async function buildPersonalMemoryContext(options, input) {
|
|
|
169
183
|
|
|
170
184
|
function combinedReminderContext(options, due, cadenceReminderContext, personalMemoryContext) {
|
|
171
185
|
const contexts = [];
|
|
172
|
-
if (due.memoryReminderDue) contexts.push(
|
|
186
|
+
if (due.memoryReminderDue) contexts.push(memorySkillReminderContext(options.memorySkillInvocation));
|
|
173
187
|
if (due.supplementalReminderDue || personalMemoryContext) {
|
|
174
188
|
const additionalReminderContext = stringOption(options.additionalReminderContext);
|
|
175
189
|
if (additionalReminderContext) contexts.push(additionalReminderContext);
|
|
@@ -180,15 +194,22 @@ function combinedReminderContext(options, due, cadenceReminderContext, personalM
|
|
|
180
194
|
return contexts.join("\n\n");
|
|
181
195
|
}
|
|
182
196
|
|
|
183
|
-
function memoryReminderContext(options) {
|
|
184
|
-
const invocation = stringOption(options.memorySkillInvocation) ?? DEFAULT_MEMORY_SKILL_INVOCATION;
|
|
185
|
-
return `MemoraX Code reminder: proactively invoke ${invocation} whenever coding memory might help, even when uncertain; when in doubt, run one focused coding-memory search for relevant prior knowledge. Also use ${invocation} for repository-scoped personal memory, and classify the authority before reading or writing.`;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
197
|
function defaultMemoraxCodeHome() {
|
|
189
198
|
return process.env.HOME ? join(process.env.HOME, ".memorax-code") : ".memorax-code";
|
|
190
199
|
}
|
|
191
200
|
|
|
201
|
+
function resolveMemoraxCodeHome(options) {
|
|
202
|
+
return stringOption(options.memoraxCodeHome)
|
|
203
|
+
?? process.env.MEMORAX_CODE_HOME
|
|
204
|
+
?? defaultMemoraxCodeHome();
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function debugError(options, error) {
|
|
208
|
+
if (process.env[options.debugEnv] === "1") {
|
|
209
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
192
213
|
function nextReminderState(existing, runtime, sessionId, turnId) {
|
|
193
214
|
const state = reminderState(existing, runtime);
|
|
194
215
|
const current = state.sessions[sessionId] && typeof state.sessions[sessionId] === "object" && !Array.isArray(state.sessions[sessionId])
|
|
@@ -231,47 +252,17 @@ function reminderState(existing, runtime) {
|
|
|
231
252
|
return state;
|
|
232
253
|
}
|
|
233
254
|
|
|
234
|
-
function shouldRemind(turnCount, intervalTurns, remindOnFirstTurn) {
|
|
235
|
-
if (!Number.isInteger(turnCount) || turnCount <= 0) return false;
|
|
236
|
-
if (remindOnFirstTurn) return (turnCount - 1) % intervalTurns === 0;
|
|
237
|
-
return turnCount > intervalTurns && (turnCount - 1) % intervalTurns === 0;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
255
|
function reminderIntervalTurns(memoraxCodeHome) {
|
|
241
|
-
return
|
|
242
|
-
|
|
243
|
-
|
|
256
|
+
return resolveMemorySkillReminderIntervalTurns({
|
|
257
|
+
environmentValue: process.env.MEMORAX_CODE_MEMORY_SKILL_REMINDER_INTERVAL_TURNS,
|
|
258
|
+
configText: configReminderText(join(memoraxCodeHome, "config.toml")),
|
|
259
|
+
});
|
|
244
260
|
}
|
|
245
261
|
|
|
246
|
-
function
|
|
262
|
+
function configReminderText(path) {
|
|
247
263
|
try {
|
|
248
|
-
return
|
|
264
|
+
return readFileSync(path, "utf8");
|
|
249
265
|
} catch {
|
|
250
266
|
return undefined;
|
|
251
267
|
}
|
|
252
268
|
}
|
|
253
|
-
|
|
254
|
-
function parseReminderIntervalTurns(text) {
|
|
255
|
-
let section = "";
|
|
256
|
-
for (const rawLine of text.split(/\r?\n/)) {
|
|
257
|
-
const line = rawLine.split("#", 1)[0].trim();
|
|
258
|
-
if (!line) continue;
|
|
259
|
-
const sectionMatch = line.match(/^\[([^\]]+)\]$/);
|
|
260
|
-
if (sectionMatch) {
|
|
261
|
-
section = sectionMatch[1].trim();
|
|
262
|
-
continue;
|
|
263
|
-
}
|
|
264
|
-
if (section !== "memory.skill_reminder") continue;
|
|
265
|
-
const fieldMatch = line.match(/^interval_turns\s*=\s*(.+)$/);
|
|
266
|
-
if (fieldMatch) return positiveInteger(fieldMatch[1]);
|
|
267
|
-
}
|
|
268
|
-
return undefined;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
function positiveInteger(value) {
|
|
272
|
-
if (typeof value !== "string") return undefined;
|
|
273
|
-
const normalized = value.trim().replaceAll("_", "");
|
|
274
|
-
if (!/^[1-9]\d*$/.test(normalized)) return undefined;
|
|
275
|
-
const parsed = Number(normalized);
|
|
276
|
-
return Number.isSafeInteger(parsed) ? parsed : undefined;
|
|
277
|
-
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export const DEFAULT_MEMORY_SKILL_REMINDER_INTERVAL_TURNS = 5;
|
|
2
|
+
const DEFAULT_MEMORY_SKILL_INVOCATION = "$memorax-code";
|
|
3
|
+
|
|
4
|
+
export function memorySkillReminderContext(memorySkillInvocation) {
|
|
5
|
+
const invocation = nonEmptyString(memorySkillInvocation) ?? DEFAULT_MEMORY_SKILL_INVOCATION;
|
|
6
|
+
return `MemoraX Code reminder: proactively invoke ${invocation} whenever coding memory might help, even when uncertain; follow the skill's router to decide whether any memory operation is needed. Also use ${invocation} for repository-scoped personal memory, and classify the authority before reading or writing.`;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function personalMemoryReminderContext(memorySkillInvocation) {
|
|
10
|
+
const invocation = nonEmptyString(memorySkillInvocation) ?? DEFAULT_MEMORY_SKILL_INVOCATION;
|
|
11
|
+
return [
|
|
12
|
+
`MemoraX Code personal-memory reminder: Use ${invocation} when the user states a durable current-repo identity or interaction preference, asks to list or recall stored personal memory, or explicitly asks to save, update, forget, or delete it.`,
|
|
13
|
+
"Route reusable action sequences and work rules to procedure memory; do not store repository facts, one-off task details, or secrets.",
|
|
14
|
+
].join(" ");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function resolveMemorySkillReminderIntervalTurns(input = {}) {
|
|
18
|
+
return positiveInteger(input.environmentValue)
|
|
19
|
+
?? parseMemorySkillReminderIntervalTurns(input.configText)
|
|
20
|
+
?? DEFAULT_MEMORY_SKILL_REMINDER_INTERVAL_TURNS;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function isMemorySkillReminderDue(turnCount, intervalTurns, remindOnFirstTurn = true) {
|
|
24
|
+
if (!Number.isInteger(turnCount) || turnCount <= 0) return false;
|
|
25
|
+
if (!Number.isInteger(intervalTurns) || intervalTurns <= 0) return false;
|
|
26
|
+
if (remindOnFirstTurn) return (turnCount - 1) % intervalTurns === 0;
|
|
27
|
+
return turnCount > intervalTurns && (turnCount - 1) % intervalTurns === 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function parseMemorySkillReminderIntervalTurns(text) {
|
|
31
|
+
if (typeof text !== "string") return undefined;
|
|
32
|
+
let section = "";
|
|
33
|
+
for (const rawLine of text.split(/\r?\n/)) {
|
|
34
|
+
const line = rawLine.split("#", 1)[0].trim();
|
|
35
|
+
if (!line) continue;
|
|
36
|
+
const sectionMatch = line.match(/^\[([^\]]+)\]$/);
|
|
37
|
+
if (sectionMatch) {
|
|
38
|
+
section = sectionMatch[1].trim();
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (section !== "memory.skill_reminder") continue;
|
|
42
|
+
const fieldMatch = line.match(/^interval_turns\s*=\s*(.+)$/);
|
|
43
|
+
if (fieldMatch) return positiveInteger(fieldMatch[1]);
|
|
44
|
+
}
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function positiveInteger(value) {
|
|
49
|
+
if (typeof value !== "string") return undefined;
|
|
50
|
+
const normalized = value.trim().replaceAll("_", "");
|
|
51
|
+
if (!/^[1-9]\d*$/.test(normalized)) return undefined;
|
|
52
|
+
const parsed = Number(normalized);
|
|
53
|
+
return Number.isSafeInteger(parsed) ? parsed : undefined;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function nonEmptyString(value) {
|
|
57
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
58
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
|
|
5
|
+
export function scheduleMissingRepoMemoryBuild(repo, options = {}) {
|
|
6
|
+
try {
|
|
7
|
+
const repoPath = nonEmptyString(repo);
|
|
8
|
+
const pluginRoot = nonEmptyString(options.pluginRoot);
|
|
9
|
+
if (!repoPath || !pluginRoot) return false;
|
|
10
|
+
if (existsSync(join(repoPath, ".repo_memory", "PROFILE.md"))) return false;
|
|
11
|
+
|
|
12
|
+
const jobHookPath = join(pluginRoot, "hooks", "repo-memory-job.mjs");
|
|
13
|
+
if (!existsSync(jobHookPath)) return false;
|
|
14
|
+
const child = spawn(options.nodePath ?? process.execPath, [jobHookPath, "maintain", "--repo", repoPath], {
|
|
15
|
+
cwd: repoPath,
|
|
16
|
+
detached: true,
|
|
17
|
+
env: options.env ?? process.env,
|
|
18
|
+
stdio: "ignore",
|
|
19
|
+
windowsHide: true,
|
|
20
|
+
});
|
|
21
|
+
child.once("error", (error) => debug(options, error));
|
|
22
|
+
child.unref();
|
|
23
|
+
return true;
|
|
24
|
+
} catch (error) {
|
|
25
|
+
debug(options, error);
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function nonEmptyString(value) {
|
|
31
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function debug(options, error) {
|
|
35
|
+
if (process.env[options.debugEnv] === "1") {
|
|
36
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -517,7 +517,7 @@ function buildPrompt(repo, snapshotHead, memorySkillInvocation) {
|
|
|
517
517
|
}
|
|
518
518
|
|
|
519
519
|
function updatePrompt(repo, snapshotHead, memorySkillInvocation) {
|
|
520
|
-
return `This invocation is the authorized background repo-memory worker. Complete the requested operation yourself; do not inspect, launch, or defer to another repo-memory job.\n\nUse ${memorySkillInvocation} and select the Repo Memory repo-update operation to incrementally update this repository's existing .repo_memory.\n\nRepository: ${repo}\nSnapshot HEAD: ${snapshotHead}\n\nDefault behavior:\n- Treat existing .repo_memory as the baseline.\n-
|
|
520
|
+
return `This invocation is the authorized background repo-memory worker. Complete the requested operation yourself; do not inspect, launch, or defer to another repo-memory job.\n\nUse ${memorySkillInvocation} and select the Repo Memory repo-update operation to incrementally update this repository's existing .repo_memory.\n\nRepository: ${repo}\nSnapshot HEAD: ${snapshotHead}\n\nDefault behavior:\n- Treat existing .repo_memory as the baseline.\n- Run and follow the packaged repo-update detector's effective history policy.\n- Do not re-enable commit or provider evidence channels disabled by repoHistory.mode.\n- If provider evidence is unavailable when provider history is enabled, preserve existing provider resources.\n- Do not rebuild unless updater reports the baseline is unusable; if a full rebuild is required, stop and report that.\n- Keep file writes scoped to ${repo}/.repo_memory and necessary repo-memory ignore/config entries.\n- Do not modify source code, dependency files, global config, or files outside the target repo unless explicitly required by repo-memory tooling.\n- Ensure PROFILE.md local_head resolves to the snapshot SHA above.\n- Run the packaged repo-memory validator before finishing.\n- Write a concise final summary with changed files, provider evidence status, and any follow-up needed.\n`;
|
|
521
521
|
}
|
|
522
522
|
|
|
523
523
|
function gitSnapshot(repo) {
|
|
@@ -37,7 +37,11 @@ export function resolveWindowsCliInvocation(command, args, options = {}) {
|
|
|
37
37
|
.filter(isNodeEntrypoint)
|
|
38
38
|
.find((candidate) => fileExists(candidate));
|
|
39
39
|
if (!cli) {
|
|
40
|
-
const override = name === "claude"
|
|
40
|
+
const override = name === "claude"
|
|
41
|
+
? "MEMORAX_CODE_CLAUDE_CLI_JS"
|
|
42
|
+
: name === "dsh"
|
|
43
|
+
? "MEMORAX_CODE_DSH_CLI_JS"
|
|
44
|
+
: "MEMORAX_CODE_CODEX_CLI_JS";
|
|
41
45
|
throw new Error(
|
|
42
46
|
`refusing to execute ${pathApi.basename(resolvedCommand)} through a command shell; `
|
|
43
47
|
+ `set ${override} to its Node entrypoint`,
|
|
@@ -75,6 +79,14 @@ function cliEntrypointCandidates(name, command, env, pathApi) {
|
|
|
75
79
|
pathApi.join(root, "..", "@anthropic-ai", "claude-code", "cli.js"),
|
|
76
80
|
];
|
|
77
81
|
}
|
|
82
|
+
if (name === "dsh") {
|
|
83
|
+
return [
|
|
84
|
+
env.MEMORAX_CODE_DSH_CLI_JS,
|
|
85
|
+
env.DSH_CLI_JS,
|
|
86
|
+
pathApi.join(root, "node_modules", "@deepseek-ai", "dsh", "lib", "bin.js"),
|
|
87
|
+
pathApi.join(root, "..", "@deepseek-ai", "dsh", "lib", "bin.js"),
|
|
88
|
+
];
|
|
89
|
+
}
|
|
78
90
|
return [];
|
|
79
91
|
}
|
|
80
92
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { resolveBackendConnection } from "../memorax-code-adapter-common/src/backend-connection.mjs";
|
|
3
3
|
import { readStdinJson } from "../memorax-code-adapter-common/src/config-utils.mjs";
|
|
4
|
+
import { scheduleMissingRepoMemoryBuild } from "../memorax-code-adapter-common/src/repo-memory/repo-memory-auto-build.mjs";
|
|
4
5
|
import { isRepoMemoryJobWorker } from "../memorax-code-adapter-common/src/repo-memory/repo-memory-job-context.mjs";
|
|
5
6
|
|
|
6
7
|
const RETRIEVAL_BACKEND_TIMEOUT_MS = 12_000;
|
|
@@ -29,6 +30,10 @@ try {
|
|
|
29
30
|
cwd: stringValue(input.cwd),
|
|
30
31
|
workspaceKind: stringValue(input.workspace_kind) ?? stringValue(input.workspaceKind),
|
|
31
32
|
});
|
|
33
|
+
scheduleMissingRepoMemoryBuild(stringValue(response?.repoMemoryWorktree), {
|
|
34
|
+
debugEnv: "MEMORAX_CODE_CLAUDE_HOOK_DEBUG",
|
|
35
|
+
pluginRoot: process.env.CLAUDE_PLUGIN_ROOT,
|
|
36
|
+
});
|
|
32
37
|
const additionalContext = stringValue(response?.additionalContext);
|
|
33
38
|
if (additionalContext) {
|
|
34
39
|
process.stdout.write(`${JSON.stringify({
|
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: memorax-code
|
|
3
3
|
description: >-
|
|
4
|
-
Use this skill as the single
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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,
|
|
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,
|
|
12
9
|
checklists, action sequences, prerequisites, gates, exceptions, validation
|
|
13
10
|
rules, communication style, preferred language, or result presentation.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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.
|
|
19
18
|
---
|
|
20
19
|
|
|
21
20
|
# MemoraX Code
|
|
22
21
|
|
|
23
22
|
Classify the requested memory authority first, then its operation. Load only the matching reference unless the request genuinely spans authorities or operations.
|
|
24
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
|
+
|
|
25
29
|
## Authority Router
|
|
26
30
|
|
|
27
31
|
### MemoraX Code Coding Memory
|
|
@@ -52,8 +56,11 @@ Use personal memory for user-owned repository procedures and durable profile or
|
|
|
52
56
|
- Route ordered actions, checklists, prerequisites, gates, exceptions, and validation rules to personal procedure memory, even when phrased as "I prefer", "I like", "我的习惯", or "我喜欢".
|
|
53
57
|
- Route preferred name, answer language, tone, verbosity, explanation style, and result presentation to personal profile memory.
|
|
54
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.
|
|
55
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".
|
|
56
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.
|
|
57
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.
|
|
58
65
|
|
|
59
66
|
Examples:
|
|
@@ -73,11 +80,12 @@ Repo memory and personal memory remain local `.repo_memory` authorities. Resolve
|
|
|
73
80
|
|
|
74
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.
|
|
75
82
|
|
|
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
|
|
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.
|
|
77
84
|
|
|
78
85
|
When explaining Memory Viewer, describe only `/memory-viewer`. It is a
|
|
79
86
|
content-free local summary and must not expose conversation or memory text,
|
|
80
87
|
session or turn identifiers, paths, or trace details. The page never queries
|
|
81
|
-
MemoraX directly; client
|
|
88
|
+
MemoraX directly; it projects client-qualified local activity and keeps each
|
|
89
|
+
supported harness isolated.
|
|
82
90
|
|
|
83
91
|
Never store secrets, credentials, `.env` content, sensitive personal data, raw transcripts, hidden tests, exact patches, temporary target commits, or unsafe destructive commands. Do not announce internal routing or reference loading.
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schema": "repo_memory_builder_defaults.
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
2
|
+
"schema": "repo_memory_builder_defaults.v2",
|
|
3
|
+
"repoHistory": {
|
|
4
|
+
"mode": "provider",
|
|
5
|
+
"limits": {
|
|
6
|
+
"commits": 30,
|
|
7
|
+
"prs": 30,
|
|
8
|
+
"issues": 30
|
|
9
|
+
}
|
|
7
10
|
},
|
|
8
11
|
"summaryChars": 4000
|
|
9
12
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MemoraX Code Coding Memory Add
|
|
2
2
|
|
|
3
|
-
Use these instructions only to add reusable coding knowledge through `memorax-cli`. Invoke the skill as `$memorax-code` in Codex or `/memorax-code` in Claude Code
|
|
3
|
+
Use these instructions only to add reusable coding knowledge through `memorax-cli`. Invoke the skill as `$memorax-code` in Codex or `/memorax-code` in Claude Code. In OpenCode, ask the agent to use the `memorax-code` skill by name. Do not route memory operations through the lifecycle-only `memorax-code` CLI. Do not use this authority for personal procedures, interaction preferences, generated repository facts, or one-off task details.
|
|
4
4
|
|
|
5
5
|
## Eligible Knowledge
|
|
6
6
|
|
|
@@ -71,6 +71,10 @@ anchors: stable/source/path' \
|
|
|
71
71
|
|
|
72
72
|
If add fails, report the exact failure and do not retry automatically, bypass the CLI, or call MemoraX directly.
|
|
73
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
|
+
|
|
74
78
|
## Exclusions
|
|
75
79
|
|
|
76
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.
|