@memorax/memorax-code 0.1.9 → 0.1.11

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 (101) hide show
  1. package/README.md +10 -0
  2. package/bin/memorax-code-codebuddy.mjs +4 -0
  3. package/bin/memorax-code-setup.mjs +182 -65
  4. package/bin/memorax-code.mjs +74 -45
  5. package/docs/configuration.md +85 -22
  6. package/docs/troubleshooting.md +72 -5
  7. package/lib/automatic-update.mjs +233 -0
  8. package/lib/memorax-code-adapter-common/src/automatic-update-state.d.mts +24 -0
  9. package/lib/memorax-code-adapter-common/src/automatic-update-state.mjs +73 -0
  10. package/lib/memorax-code-adapter-common/src/clients/codebuddy-command.mjs +82 -0
  11. package/lib/memorax-code-adapter-common/src/config-utils.d.mts +2 -0
  12. package/lib/memorax-code-adapter-common/src/config-utils.mjs +11 -0
  13. package/lib/memorax-code-adapter-common/src/hooks/client-hook-launcher.mjs +3 -0
  14. package/lib/memorax-code-adapter-common/src/hooks/ensure-backend-runner.mjs +45 -10
  15. package/lib/memorax-code-adapter-common/src/repo-memory/repo-memory-job-worker.mjs +88 -3
  16. package/lib/memorax-code-adapter-common/src/windows-cli-invocation.mjs +11 -1
  17. package/lib/memorax-code-backend/dist/app/backend-server.js +2 -2
  18. package/lib/memorax-code-backend/dist/app/memory-observability.js +2 -2
  19. package/lib/memorax-code-backend/dist/clients/codebuddy/jsonl-history.js +208 -0
  20. package/lib/memorax-code-backend/dist/clients/codebuddy/lifecycle.js +44 -0
  21. package/lib/memorax-code-backend/dist/clients/codebuddy/memory-hook-runtime.js +250 -0
  22. package/lib/memorax-code-backend/dist/clients/codebuddy/turn-id.js +16 -0
  23. package/lib/memorax-code-backend/dist/clients/codex/plugin-install.js +129 -7
  24. package/lib/memorax-code-backend/dist/config/memorax-code.js +14 -1
  25. package/lib/memorax-code-backend/dist/entrypoints/backend-cli.js +43 -6
  26. package/lib/memorax-code-backend/dist/lifecycle/active-clients.js +3 -0
  27. package/lib/memorax-code-backend/dist/lifecycle/automatic-update-scheduler.js +133 -0
  28. package/lib/memorax-code-backend/dist/lifecycle/client-plugin-removal.js +14 -2
  29. package/lib/memorax-code-backend/dist/lifecycle/client-selection.js +6 -4
  30. package/lib/memorax-code-backend/dist/lifecycle/orchestrator.js +48 -9
  31. package/lib/memorax-code-backend/dist/memory/cli.js +4 -2
  32. package/lib/memorax-code-backend/dist/memory/hook-command.js +31 -1
  33. package/lib/memorax-code-backend/dist/memory/reminder-trace-recorder.js +5 -1
  34. package/lib/memorax-code-backend/dist/memory/service.js +12 -0
  35. package/lib/memorax-code-backend/dist/shared/windows-cli-invocation.js +10 -1
  36. package/lib/memorax-code-backend/dist/trace/config.js +12 -0
  37. package/lib/memorax-code-backend/dist/trace/context.js +21 -1
  38. package/lib/memorax-code-backend/dist/trace/store.js +12 -1
  39. package/lib/memorax-code-backend/package.json +1 -1
  40. package/lib/memorax-code-claude-adapter/.claude-plugin/plugin.json +1 -1
  41. package/lib/memorax-code-claude-adapter/hooks/runtime-shell.json +1 -1
  42. package/lib/memorax-code-claude-adapter/package.json +1 -1
  43. package/lib/memorax-code-claude-adapter/runtime-hooks/ensure-backend.mjs +2 -0
  44. package/lib/memorax-code-claude-adapter/src/plugin-install.mjs +3 -0
  45. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/.claude-plugin/plugin.json +1 -1
  46. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/hooks/runtime-shell.json +1 -1
  47. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/automatic-update-state.d.mts +24 -0
  48. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/automatic-update-state.mjs +73 -0
  49. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/clients/codebuddy-command.mjs +82 -0
  50. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/config-utils.d.mts +2 -0
  51. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/config-utils.mjs +11 -0
  52. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/client-hook-launcher.mjs +3 -0
  53. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/hooks/ensure-backend-runner.mjs +45 -10
  54. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/repo-memory/repo-memory-job-worker.mjs +88 -3
  55. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/memorax-code-adapter-common/src/windows-cli-invocation.mjs +11 -1
  56. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/package.json +1 -1
  57. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/runtime-hooks/ensure-backend.mjs +2 -0
  58. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/src/plugin-install.mjs +3 -0
  59. package/lib/memorax-code-codebuddy-adapter/.codebuddy-plugin/plugin.json +7 -0
  60. package/lib/memorax-code-codebuddy-adapter/hooks/common-runtime.mjs +13 -0
  61. package/lib/memorax-code-codebuddy-adapter/hooks/hooks.json +38 -0
  62. package/lib/memorax-code-codebuddy-adapter/hooks/repo-memory-job.mjs +40 -0
  63. package/lib/memorax-code-codebuddy-adapter/hooks/runtime-hook.mjs +289 -0
  64. package/lib/memorax-code-codebuddy-adapter/package.json +9 -0
  65. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/SKILL.md +85 -0
  66. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/agents/claude.yaml +10 -0
  67. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/agents/openai.yaml +7 -0
  68. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/defaults.json +12 -0
  69. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/references/memorax-add.md +88 -0
  70. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/references/memorax-search.md +93 -0
  71. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/references/personal-read.md +46 -0
  72. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/references/personal-write.md +120 -0
  73. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/references/repo-build.md +319 -0
  74. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/references/repo-read.md +103 -0
  75. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/references/repo-templates.md +390 -0
  76. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/references/repo-update.md +127 -0
  77. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/scripts/collect_all.py +579 -0
  78. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/scripts/detect_updates.py +919 -0
  79. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/scripts/git_commit_facets.py +222 -0
  80. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/scripts/github_resource_facets.py +512 -0
  81. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +517 -0
  82. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/scripts/prepare_repo_memory.py +411 -0
  83. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/scripts/user_profile_memory.py +528 -0
  84. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/scripts/validate_memory.py +248 -0
  85. package/lib/memorax-code-codebuddy-adapter/src/cli.mjs +58 -0
  86. package/lib/memorax-code-codebuddy-adapter/src/config.mjs +340 -0
  87. package/lib/memorax-code-codebuddy-adapter/src/hook-manifest.mjs +47 -0
  88. package/lib/memorax-code-codebuddy-adapter/src/runtime-observation.mjs +65 -0
  89. package/lib/memorax-code-codex-adapter/.codex-plugin/plugin.json +1 -1
  90. package/lib/memorax-code-codex-adapter/hooks/runtime-shell.json +1 -1
  91. package/lib/memorax-code-codex-adapter/package.json +1 -1
  92. package/lib/memorax-code-codex-adapter/runtime-hooks/ensure-backend.mjs +4 -1
  93. package/lib/memorax-code-dsh-adapter/package.json +2 -1
  94. package/lib/memorax-code-dsh-adapter/src/profile-lifecycle.mjs +1 -0
  95. package/lib/memorax-code-opencode-adapter/package.json +1 -1
  96. package/lib/npm-invocation.mjs +51 -8
  97. package/lib/resolve-codebuddy-command.mjs +123 -0
  98. package/lib/run-entrypoint.mjs +25 -1
  99. package/lib/windows-cli-invocation.mjs +11 -1
  100. package/lib/windows-user-path.mjs +218 -0
  101. package/package.json +5 -3
@@ -1,13 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawn, spawnSync } from "node:child_process";
3
- import { existsSync, readFileSync } from "node:fs";
3
+ import { readFileSync } from "node:fs";
4
4
  import { homedir } from "node:os";
5
5
  import { dirname, join, resolve } from "node:path";
6
6
  import { fileURLToPath, pathToFileURL } from "node:url";
7
+ import { runAutomaticUpdate } from "../lib/automatic-update.mjs";
7
8
  import { stagePackagedClientHookRuntime } from "../lib/client-hook-runtime.mjs";
8
9
  import { unsupportedNodeVersionMessage } from "../lib/node-version.mjs";
9
- import { resolveNpmInvocation } from "../lib/npm-invocation.mjs";
10
- import { runBackendEntrypoint } from "../lib/run-entrypoint.mjs";
10
+ import { runNpmCommand } from "../lib/npm-invocation.mjs";
11
+ import { ensureNpmPackageRuntimeEnv, runBackendEntrypoint } from "../lib/run-entrypoint.mjs";
12
+ import { ensureWindowsNpmGlobalPath } from "../lib/windows-user-path.mjs";
11
13
 
12
14
  const nodeVersionError = unsupportedNodeVersionMessage();
13
15
  if (nodeVersionError) {
@@ -86,13 +88,6 @@ function printCommand(command, args) {
86
88
  console.log([command, ...args].join(" "));
87
89
  }
88
90
 
89
- function npmCommandCwd() {
90
- for (const candidate of [process.env.HOME, homedir(), "/"]) {
91
- if (candidate && existsSync(candidate)) return candidate;
92
- }
93
- return "/";
94
- }
95
-
96
91
  async function runAccountCommand(args) {
97
92
  if (args.includes("--help") || args.includes("-h")) {
98
93
  printAccountHelp();
@@ -127,6 +122,7 @@ async function runAccountCommand(args) {
127
122
  }
128
123
 
129
124
  async function runUpdateCommand(args) {
125
+ let automatic = false;
130
126
  let dryRun = false;
131
127
  let force = false;
132
128
  let requestedChannel;
@@ -134,7 +130,9 @@ async function runUpdateCommand(args) {
134
130
 
135
131
  for (let index = 0; index < args.length; index += 1) {
136
132
  const arg = args[index];
137
- if (arg === "--dry-run") {
133
+ if (arg === "--automatic") {
134
+ automatic = true;
135
+ } else if (arg === "--dry-run") {
138
136
  dryRun = true;
139
137
  } else if (arg === "--force") {
140
138
  force = true;
@@ -173,6 +171,17 @@ async function runUpdateCommand(args) {
173
171
  }
174
172
 
175
173
  const pkg = readPackageJson();
174
+ if (automatic) {
175
+ if (dryRun || force || requestedChannel) {
176
+ console.error("memorax-code update: --automatic cannot be combined with channel, force, or dry-run options");
177
+ return 2;
178
+ }
179
+ return await runAutomaticUpdateCommand({
180
+ pkg,
181
+ memoraxCodeHome: requestedHome ?? requestedMemoraxCodeHome([]),
182
+ });
183
+ }
184
+
176
185
  const channel = requestedChannel ?? (pkg.version.includes("-") ? "preview" : "latest");
177
186
  const npmArgs = ["install", "-g", `${pkg.name}@${channel}`];
178
187
  if (force) npmArgs.push("--force");
@@ -183,51 +192,47 @@ async function runUpdateCommand(args) {
183
192
  }
184
193
 
185
194
  console.error(`memorax-code update: running ${["npm", ...npmArgs].join(" ")}`);
186
- const cwd = npmCommandCwd();
187
- let invocation;
195
+ let npmResult;
188
196
  try {
189
- invocation = resolveNpmInvocation(npmArgs);
197
+ npmResult = await runNpmCommand(npmArgs, {
198
+ env: {
199
+ ...process.env,
200
+ ...(requestedHome ? { MEMORAX_CODE_HOME: requestedHome } : {}),
201
+ },
202
+ stdio: "inherit",
203
+ });
190
204
  } catch (error) {
191
- console.error(`memorax-code update: ${error instanceof Error ? error.message : String(error)}`);
205
+ console.error(`memorax-code update: failed to start npm: ${error instanceof Error ? error.message : String(error)}`);
192
206
  return 1;
193
207
  }
194
- const child = spawn(invocation.command, invocation.args, {
195
- stdio: "inherit",
196
- cwd,
197
- env: {
198
- ...process.env,
199
- PWD: cwd,
200
- ...(requestedHome ? { MEMORAX_CODE_HOME: requestedHome } : {}),
201
- },
202
- });
203
- const npmExitCode = await new Promise((resolve) => {
204
- child.on("error", (error) => {
205
- console.error(`memorax-code update: failed to start npm: ${error.message}`);
206
- resolve(1);
207
- });
208
- child.on("close", (code, signal) => {
209
- if (signal) {
210
- console.error(`memorax-code update: npm exited from signal ${signal}`);
211
- resolve(1);
212
- } else {
213
- resolve(code ?? 1);
214
- }
215
- });
216
- });
217
- if (npmExitCode !== 0) return npmExitCode;
208
+ if (npmResult.signal) {
209
+ console.error(`memorax-code update: npm exited from signal ${npmResult.signal}`);
210
+ }
211
+ if (npmResult.exitCode !== 0) return npmResult.exitCode;
218
212
 
219
213
  const memoraxCodeHome = requestedHome ?? requestedMemoraxCodeHome([]);
220
- if (!existsSync(join(memoraxCodeHome, "runtime", "backend", "backend.pid.json"))) {
221
- console.error("memorax-code update: package updated; the managed Backend remains stopped; run `memorax-code setup` from a terminal to review client and Hook changes");
222
- return 0;
223
- }
224
214
  if (!setupCanPrompt()) {
225
- console.error("memorax-code update: package updated; run `memorax-code setup` from a terminal to review client and Hook changes");
215
+ console.error("memorax-code update: package updated; run `memorax-code setup` from a terminal to reconcile clients and verify Hook changes");
226
216
  return 0;
227
217
  }
228
218
  return await runSetupCommand(["--home", memoraxCodeHome], { updateMode: true });
229
219
  }
230
220
 
221
+ async function runAutomaticUpdateCommand({ pkg, memoraxCodeHome }) {
222
+ try {
223
+ const result = await runAutomaticUpdate({
224
+ env: process.env,
225
+ memoraxCodeHome,
226
+ packageRoot: packageRoot(),
227
+ packageName: pkg.name,
228
+ packageVersion: pkg.version,
229
+ });
230
+ return result.ok ? 0 : 1;
231
+ } catch {
232
+ return 1;
233
+ }
234
+ }
235
+
231
236
  async function runSetupCommand(args, { updateMode = false } = {}) {
232
237
  if (args.includes("--help") || args.includes("-h")) {
233
238
  printSetupHelp();
@@ -247,6 +252,7 @@ async function runSetupCommand(args, { updateMode = false } = {}) {
247
252
  console.error("memorax-code setup: an interactive terminal is required");
248
253
  return 1;
249
254
  }
255
+ if (!updateMode) repairWindowsSetupPath();
250
256
  try {
251
257
  const { withSetupCompletionLock } = await loadSetupCompletionApi();
252
258
  return await withSetupCompletionLock(memoraxCodeHome, async (completion) => {
@@ -259,7 +265,7 @@ async function runSetupCommand(args, { updateMode = false } = {}) {
259
265
  return 0;
260
266
  }
261
267
  if (updateMode) {
262
- console.error("memorax-code update: reviewing client and Hook changes in the foreground");
268
+ console.error("memorax-code update: reconciling clients and verified Codex Hook changes in the foreground");
263
269
  }
264
270
  return await spawnSetupProcess(memoraxCodeHome, {
265
271
  updateMode,
@@ -272,6 +278,28 @@ async function runSetupCommand(args, { updateMode = false } = {}) {
272
278
  }
273
279
  }
274
280
 
281
+ function repairWindowsSetupPath() {
282
+ if (readPackageJson().name !== "@memorax/memorax-code") return;
283
+ const repair = ensureWindowsNpmGlobalPath();
284
+ if (repair.userPathChanged) {
285
+ console.error("memorax-code setup: added npm's global command directory to the Windows user PATH");
286
+ }
287
+ if (repair.processPathChanged) {
288
+ console.error("memorax-code setup: npm global commands are available to the setup process");
289
+ }
290
+ if (repair.restartRecommended) {
291
+ console.error("memorax-code setup: restart or refresh coding agents that were already running so they inherit the updated PATH");
292
+ }
293
+ if (repair.status === "warning") {
294
+ const detail = repair.reason === "npm_prefix_unavailable"
295
+ ? "the npm global command directory could not be determined"
296
+ : repair.reason === "global_shims_missing"
297
+ ? "the installed MemoraX Code command shims could not be verified"
298
+ : "the Windows user PATH could not be updated";
299
+ console.error(`memorax-code setup: Windows PATH repair was not completed because ${detail}; setup will continue`);
300
+ }
301
+ }
302
+
275
303
  async function routeDefaultCommand() {
276
304
  const memoraxCodeHome = requestedMemoraxCodeHome([]);
277
305
  try {
@@ -378,6 +406,7 @@ function hasReadyMemoraxConfiguration(memoraxCodeHome) {
378
406
  }
379
407
 
380
408
  async function spawnSetupProcess(memoraxCodeHome, { updateMode = false, setupMode = "automatic" } = {}) {
409
+ ensureNpmPackageRuntimeEnv();
381
410
  const env = {
382
411
  ...process.env,
383
412
  MEMORAX_CODE_HOME: memoraxCodeHome,
@@ -39,13 +39,13 @@ are not a compatibility contract.
39
39
 
40
40
  ## New configuration
41
41
 
42
- The generated template selects all four client integrations, disables automatic
42
+ The generated template selects the existing client integrations, including the optional CodeBuddy/WorkBuddy adapter, disables automatic
43
43
  retrieval, enables automatic writeback, sets the preferred language to Chinese
44
44
  (`zh`), uses a five-turn skill reminder and the adaptive repository-update
45
- policy, and enables content-bearing local traces for Codex, Claude Code, and
46
- OpenCode. Foreground setup may narrow `[clients]` to clients detected on the
47
- host. The tables below list all fallbacks, including tuning fields omitted from
48
- the generated file.
45
+ policy, and enables content-bearing local traces for Codex, Claude Code,
46
+ CodeBuddy/WorkBuddy, and OpenCode. Foreground setup may narrow `[clients]` to
47
+ clients detected on the host. The tables below list all fallbacks, including
48
+ tuning fields omitted from the generated file.
49
49
 
50
50
  On POSIX systems MemoraX Code creates `$MEMORAX_CODE_HOME` with mode `0700`
51
51
  and a new `config.toml` with mode `0600`. Windows relies on the current user's
@@ -54,7 +54,7 @@ filesystem ACLs.
54
54
  ## Client selection
55
55
 
56
56
  If `[clients]` is absent, lifecycle commands select Codex, Claude Code, DSH,
57
- and OpenCode. If it is present, `codex`, `claude`, `dsh`, and `opencode` are
57
+ and OpenCode; CodeBuddy is opt-in unless detected during installation. If it is present, `codex`, `claude`, `dsh`, `opencode`, and `codebuddy` are
58
58
  boolean fields. Omitted `codex`, `claude`, or `opencode` values are disabled;
59
59
  an omitted `dsh` value remains enabled so configurations written before DSH
60
60
  support can discover an existing local Harness. Set `dsh = false` explicitly
@@ -62,7 +62,7 @@ to disable that integration. The command-line override accepts a
62
62
  comma-separated subset:
63
63
 
64
64
  ```text
65
- --clients codex|claude|dsh|opencode|<comma-separated subset>|all|none
65
+ --clients codex|claude|dsh|opencode|codebuddy|<comma-separated subset>|all|none
66
66
  ```
67
67
 
68
68
  Foreground `memorax-code setup` refreshes `[clients]` from the clients
@@ -77,12 +77,14 @@ disabled client is offered for activation with a default of yes; declining
77
77
  keeps it disabled. A selected client that is temporarily unavailable remains
78
78
  selected instead of being permanently disabled. Direct npm installation does
79
79
  not detect clients or modify `[clients]`.
80
+ Automatic update reconciliation also preserves the exact persisted selection;
81
+ it does not offer or enable a newly detected client.
80
82
 
81
83
  Client selection controls managed client-integration lifecycle only. It does
82
84
  not change Codex, Claude Code, DSH, or OpenCode provider settings.
83
85
  `--clients none` runs the Backend without managing a client integration.
84
86
 
85
- ## Setup and package-transition state
87
+ ## Setup, automatic update, and package-transition state
86
88
 
87
89
  npm installation and foreground setup are separate operations.
88
90
  `npm install -g @memorax/memorax-code` installs or replaces package files
@@ -104,8 +106,9 @@ Successful setup writes a private versioned record at:
104
106
  $MEMORAX_CODE_HOME/runtime/setup/setup-completion.json
105
107
  ```
106
108
 
107
- The record controls only no-argument CLI routing. When it is valid, the command
108
- shows status. When it is absent and an interactive terminal is available,
109
+ The record controls no-argument CLI routing and eligibility for background
110
+ update reconciliation. When it is valid, the command shows status. When it is
111
+ absent and an interactive terminal is available,
109
112
  `memorax-code` validates and reuses a complete effective configuration, then
110
113
  runs setup and reconciliation once to write the record. If the configuration
111
114
  is incomplete or no interactive terminal is available, it points to
@@ -113,6 +116,32 @@ is incomplete or no interactive terminal is available, it points to
113
116
  product uninstall removes this marker while retaining `config.toml`; stop and
114
117
  partial client uninstall preserve it.
115
118
 
119
+ After setup completion, the managed Backend schedules detached update checks
120
+ while it remains running. It reads the next deadline from the private update
121
+ record, so an active Backend continues checking even when the user stays in one
122
+ client session. Stable installations follow npm `latest`; prerelease
123
+ installations follow `preview`. A successful result is reused for eight hours,
124
+ while a failed check, install, or reconciliation retries after 15 minutes. Set
125
+ `MEMORAX_CODE_AUTO_UPDATE=false` before starting or restarting the managed
126
+ Backend to disable the scheduler. Client startup Hooks only recover an
127
+ unavailable Backend and do not schedule updates.
128
+
129
+ The updater installs an exact published version and runs an internal
130
+ non-interactive setup mode. That mode preserves `[clients]`, connection data,
131
+ and memory preferences. For Codex, only new or changed Hooks returned by the
132
+ incremental check are trusted silently, and the exact Hook selection is
133
+ validated again before and after the config write. A changed marketplace
134
+ identity or unverifiable Hook set prevents reconciliation from completing.
135
+ The standalone `memorax-code codex-plugin trust-hooks` command still performs
136
+ explicit review.
137
+
138
+ The installed version and next check deadline are stored in another private
139
+ record:
140
+
141
+ ```text
142
+ $MEMORAX_CODE_HOME/runtime/install/automatic-update.json
143
+ ```
144
+
116
145
  Replacing a running managed Backend uses a separate private record:
117
146
 
118
147
  ```text
@@ -121,8 +150,8 @@ $MEMORAX_CODE_HOME/runtime/install/package-transition.json
121
150
 
122
151
  Preinstall records and retires the running installation. Postinstall restores
123
152
  and verifies it before consuming the record. A fresh or already-stopped
124
- installation has no transition and remains stopped. Do not edit either runtime
125
- record by hand.
153
+ installation has no transition and remains stopped. Direct npm installation
154
+ does not run product reconciliation. Do not edit these runtime records by hand.
126
155
 
127
156
  ## DeepSeek Harness integration paths
128
157
 
@@ -169,6 +198,31 @@ MemoraX Code does not add entries to or otherwise modify `opencode.json` or
169
198
  `opencode.jsonc`. Restart or refresh OpenCode after installation or after these
170
199
  managed assets change.
171
200
 
201
+ ## CodeBuddy and WorkBuddy integration paths
202
+
203
+ The managed CodeBuddy/WorkBuddy marketplace plugin and shared Skill use the
204
+ native plugin layout:
205
+
206
+ ```text
207
+ <CODEBUDDY_HOME>/plugins/marketplaces/memorax-code-local/plugins/memorax-code-codebuddy-adapter/
208
+ ├── hooks/
209
+ └── skills/memorax-code/
210
+ ```
211
+
212
+ `CODEBUDDY_HOME` or `WORKBUDDY_HOME` overrides the default root. Windows prefers
213
+ `%USERPROFILE%\.workbuddy` and falls back to an existing `%USERPROFILE%\.codebuddy`
214
+ for legacy CodeBuddy installations. When both homes exist, setup removes only the
215
+ legacy MemoraX-managed plugin state from `.codebuddy`; other platforms use
216
+ `~/.workbuddy`. The Skill is
217
+ materialized from the canonical MemoraX Code Skill and is owned by the managed
218
+ marketplace plugin; user files outside that plugin are not modified.
219
+
220
+ On Windows, setup writes destination-specific native Hook paths so PowerShell
221
+ does not receive a `/c/Users/...` plugin path. `memorax-code-codebuddy status
222
+ --json` reports `codebuddyHooks.status` as `unverified` until a real WorkBuddy
223
+ Hook executes, `observed` afterward, and `invalid` when the installed Hook
224
+ manifest or runtime is incomplete. Restart or refresh WorkBuddy after setup.
225
+
172
226
  The managed loader records the exact MemoraX Code home, OpenCode configuration
173
227
  directory, installed Node runtime, and `memorax-code` entrypoint. When the
174
228
  enabled plugin loads, it performs a best-effort Backend health check and uses
@@ -319,14 +373,22 @@ Supported policies are `every-commit`, `commit-count`, `daily`,
319
373
  `pull-request`, `pull-request-or-daily`, and `adaptive`. Invalid policy values
320
374
  fall back to `adaptive`.
321
375
 
322
- In Codex, Claude Code, DSH, and OpenCode, the first eligible prompt starts a
376
+ In Codex, Claude Code, CodeBuddy/WorkBuddy, DSH, and OpenCode, the first eligible prompt starts a
323
377
  background build only when the Backend has authorized a Git worktree and that
324
378
  worktree has no `.repo_memory/PROFILE.md`. If the Backend or workspace
325
379
  authority is unavailable, the client integration skips that attempt instead
326
380
  of falling back to its local workspace path. DSH schedules this work through
327
381
  its native pre-step integration rather than a Hook.
328
382
 
329
- A relevant repo-read runs supervised maintenance in all four clients. The
383
+ CodeBuddy/WorkBuddy repository jobs run the headless client under a bounded
384
+ worker. `MEMORAX_CODE_REPO_MEMORY_JOB_TIMEOUT_MS` sets the client execution
385
+ limit (default `600000` ms); `MEMORAX_CODE_REPO_MEMORY_JOB_KILL_GRACE_MS` sets
386
+ the grace period before the worker force-terminates a client that ignores
387
+ `SIGTERM` (default `5000` ms). A timeout is recorded as
388
+ `codebuddy_timeout` (or `<runner>_timeout`) in the job state, so a stalled
389
+ headless client cannot leave an active job and repository marker indefinitely.
390
+
391
+ A relevant repo-read runs supervised maintenance in all supported clients. The
330
392
  configured policy may select a build, update, or no-op. DSH maintenance
331
393
  requires an enabled, managed Profile that includes `@deepseek-ai/dsh-headless`.
332
394
  OpenCode executes the job through its active local server. Desktop-only
@@ -334,16 +396,16 @@ installations do not require a standalone `opencode` executable in `PATH`.
334
396
 
335
397
  ## Local traces
336
398
 
337
- `[trace.codex]`, `[trace.claude]`, `[trace.dsh]`, and `[trace.opencode]`
399
+ `[trace.codex]`, `[trace.claude]`, `[trace.dsh]`, `[trace.opencode]`, and `[trace.codebuddy]`
338
400
  support the same fields:
339
401
 
340
- | Field | Codex environment | Claude environment | DSH environment | OpenCode environment | Fallback |
341
- | --- | --- | --- | --- | --- | --- |
342
- | `enabled` | `MEMORAX_CODE_CODEX_TRACE_ENABLED` | `MEMORAX_CODE_CLAUDE_TRACE_ENABLED` | `MEMORAX_CODE_DSH_TRACE_ENABLED` | `MEMORAX_CODE_OPENCODE_TRACE_ENABLED` | `true` |
343
- | `capture_content` | `MEMORAX_CODE_CODEX_TRACE_CAPTURE_CONTENT` | `MEMORAX_CODE_CLAUDE_TRACE_CAPTURE_CONTENT` | `MEMORAX_CODE_DSH_TRACE_CAPTURE_CONTENT` | `MEMORAX_CODE_OPENCODE_TRACE_CAPTURE_CONTENT` | `true` |
344
- | `retention_days` | `MEMORAX_CODE_CODEX_TRACE_RETENTION_DAYS` | `MEMORAX_CODE_CLAUDE_TRACE_RETENTION_DAYS` | `MEMORAX_CODE_DSH_TRACE_RETENTION_DAYS` | `MEMORAX_CODE_OPENCODE_TRACE_RETENTION_DAYS` | `7` |
345
- | `max_event_chars` | `MEMORAX_CODE_CODEX_TRACE_MAX_EVENT_CHARS` | `MEMORAX_CODE_CLAUDE_TRACE_MAX_EVENT_CHARS` | `MEMORAX_CODE_DSH_TRACE_MAX_EVENT_CHARS` | `MEMORAX_CODE_OPENCODE_TRACE_MAX_EVENT_CHARS` | `20000` |
346
- | `max_file_bytes` | `MEMORAX_CODE_CODEX_TRACE_MAX_FILE_BYTES` | `MEMORAX_CODE_CLAUDE_TRACE_MAX_FILE_BYTES` | `MEMORAX_CODE_DSH_TRACE_MAX_FILE_BYTES` | `MEMORAX_CODE_OPENCODE_TRACE_MAX_FILE_BYTES` | `52428800` |
402
+ | Field | Codex environment | Claude environment | DSH environment | OpenCode environment | CodeBuddy/WorkBuddy environment | Fallback |
403
+ | --- | --- | --- | --- | --- | --- | --- |
404
+ | `enabled` | `MEMORAX_CODE_CODEX_TRACE_ENABLED` | `MEMORAX_CODE_CLAUDE_TRACE_ENABLED` | `MEMORAX_CODE_DSH_TRACE_ENABLED` | `MEMORAX_CODE_OPENCODE_TRACE_ENABLED` | `MEMORAX_CODE_CODEBUDDY_TRACE_ENABLED` | `true` |
405
+ | `capture_content` | `MEMORAX_CODE_CODEX_TRACE_CAPTURE_CONTENT` | `MEMORAX_CODE_CLAUDE_TRACE_CAPTURE_CONTENT` | `MEMORAX_CODE_DSH_TRACE_CAPTURE_CONTENT` | `MEMORAX_CODE_OPENCODE_TRACE_CAPTURE_CONTENT` | `MEMORAX_CODE_CODEBUDDY_TRACE_CAPTURE_CONTENT` | `true` |
406
+ | `retention_days` | `MEMORAX_CODE_CODEX_TRACE_RETENTION_DAYS` | `MEMORAX_CODE_CLAUDE_TRACE_RETENTION_DAYS` | `MEMORAX_CODE_DSH_TRACE_RETENTION_DAYS` | `MEMORAX_CODE_OPENCODE_TRACE_RETENTION_DAYS` | `MEMORAX_CODE_CODEBUDDY_TRACE_RETENTION_DAYS` | `7` |
407
+ | `max_event_chars` | `MEMORAX_CODE_CODEX_TRACE_MAX_EVENT_CHARS` | `MEMORAX_CODE_CLAUDE_TRACE_MAX_EVENT_CHARS` | `MEMORAX_CODE_DSH_TRACE_MAX_EVENT_CHARS` | `MEMORAX_CODE_OPENCODE_TRACE_MAX_EVENT_CHARS` | `MEMORAX_CODE_CODEBUDDY_TRACE_MAX_EVENT_CHARS` | `20000` |
408
+ | `max_file_bytes` | `MEMORAX_CODE_CODEX_TRACE_MAX_FILE_BYTES` | `MEMORAX_CODE_CLAUDE_TRACE_MAX_FILE_BYTES` | `MEMORAX_CODE_DSH_TRACE_MAX_FILE_BYTES` | `MEMORAX_CODE_OPENCODE_TRACE_MAX_FILE_BYTES` | `MEMORAX_CODE_CODEBUDDY_TRACE_MAX_FILE_BYTES` | `52428800` |
347
409
 
348
410
  Depending on the enabled client capabilities, content capture can include
349
411
  prompts, responses, recalled memory, writeback content, reminder text, and
@@ -364,6 +426,7 @@ Common operator settings are:
364
426
  | Environment | Purpose |
365
427
  | --- | --- |
366
428
  | `MEMORAX_CODE_HOME` | Select the state and configuration root |
429
+ | `MEMORAX_CODE_AUTO_UPDATE` | Set to `false` to disable client-start background update checks |
367
430
  | `MEMORAX_CODE_BACKEND_URL` | Override the Backend URL for one command or Hook |
368
431
  | `MEMORAX_CODE_BACKEND_HOST` / `MEMORAX_CODE_BACKEND_PORT` | Select the managed bind; default `127.0.0.1:8787` |
369
432
  | `MEMORAX_CODE_BACKEND_TOKEN` | Supply a transient Backend token |
@@ -42,6 +42,22 @@ Setup requires terminal input and terminal-visible stderr. A pipe, background
42
42
  process, or redirected stdin/stderr cannot complete setup; rerun it in a normal
43
43
  interactive terminal.
44
44
 
45
+ On Windows, interactive setup verifies npm's global command directory and adds
46
+ it to the current setup process and the Windows user `PATH` when needed. If the
47
+ current shell cannot find `memorax-code`, use npm's actual global prefix to
48
+ bootstrap setup:
49
+
50
+ ```powershell
51
+ $NpmGlobalBin = (npm prefix -g).Trim()
52
+ $env:Path = "$NpmGlobalBin;$env:Path"
53
+ & (Join-Path $NpmGlobalBin "memorax-code.cmd") setup
54
+ ```
55
+
56
+ The same npm package installs both `memorax-code` and `memorax-cli`; do not
57
+ install a separate CLI package. Open a new terminal after setup changes the
58
+ user `PATH`. Restart or refresh only coding agents that were already running
59
+ or still cannot find `memorax-cli`.
60
+
45
61
  ## Setup does not complete
46
62
 
47
63
  Setup writes
@@ -99,6 +115,34 @@ migration. `memorax-code start` alone does not commit that migration. Once a
99
115
  fixed release has started the Backend from its private runtime directory,
100
116
  later updates do not require this workaround.
101
117
 
118
+ ## Automatic update does not run or repeatedly retries
119
+
120
+ Background checks start only after setup has written a valid
121
+ `$MEMORAX_CODE_HOME/runtime/setup/setup-completion.json` record and the managed
122
+ Backend is running. Confirm that `MEMORAX_CODE_AUTO_UPDATE` was not set to
123
+ `false` when that Backend started. Client SessionStart events are not update
124
+ triggers. A successful check is reused for eight hours; failures retry after 15
125
+ minutes.
126
+
127
+ The installed version and next check deadline are recorded at:
128
+
129
+ ```text
130
+ $MEMORAX_CODE_HOME/runtime/install/automatic-update.json
131
+ ```
132
+
133
+ Do not edit that record while an update may be running. For an immediate
134
+ foreground retry, run `memorax-code update` from an interactive terminal, then
135
+ check `memorax-code status`.
136
+
137
+ During Codex reconciliation, verified new or changed MemoraX Code Hooks are
138
+ trusted silently. A changed marketplace identity, malformed Hook response, or
139
+ Hook that changes again during the config write is not trusted; automatic
140
+ reconciliation remains incomplete and retries later. After confirming the
141
+ installed plugin source, use `memorax-code codex-plugin trust-hooks` for an
142
+ explicit diagnostic review, then rerun `memorax-code setup` if needed. Direct
143
+ npm installation replaces package files but does not perform this product
144
+ reconciliation.
145
+
102
146
  ## Installed, but memory is unavailable
103
147
 
104
148
  The package and Backend can be healthy while MemoraX remains unconfigured. Run:
@@ -199,11 +243,12 @@ memorax-code start --clients codex
199
243
  memorax-code-codex doctor
200
244
  ```
201
245
 
202
- Codex requires review for new or changed Hook command hashes. A declined,
203
- non-interactive, or direct npm update can leave changed Hooks untrusted even
204
- though package replacement succeeded. Run `memorax-code setup` for foreground
205
- review; do not write trust entries directly. If the skill is missing, rerun
206
- `memorax-code start --clients codex`, then restart or refresh Codex.
246
+ MemoraX Code update reconciliation silently trusts only the exact new or changed
247
+ Hook hashes returned by Codex after the marketplace identity is verified.
248
+ Direct npm installation does not run that reconciliation and can leave changed
249
+ Hooks untrusted. Use the commands above instead of writing trust entries
250
+ directly. If the skill is missing, rerun `memorax-code start --clients codex`,
251
+ then restart or refresh Codex.
207
252
 
208
253
  ## Claude Code plugin or Hook is inactive
209
254
 
@@ -216,6 +261,28 @@ This reconciles the Claude Code marketplace plugin and Hooks. If the plugin is
216
261
  still missing or stale, restart or refresh Claude Code. Do not manually copy
217
262
  Hooks into Claude settings.
218
263
 
264
+ ## CodeBuddy or WorkBuddy Hook is inactive
265
+
266
+ ```sh
267
+ memorax-code start --clients codebuddy
268
+ memorax-code-codebuddy status --json
269
+ ```
270
+
271
+ On Windows, the managed plugin prefers `%USERPROFILE%\.workbuddy` and falls back
272
+ to an existing `%USERPROFILE%\.codebuddy` for legacy CodeBuddy installations,
273
+ while `CODEBUDDY_HOME` or `WORKBUDDY_HOME` remains an explicit override. If both
274
+ homes exist, setup removes only the MemoraX-managed plugin registration,
275
+ marketplace, and cache from `.codebuddy`; unrelated data remains untouched. A
276
+ `codebuddyHooks.status` value of `unverified` means the files are configured but
277
+ the current plugin version has not yet produced a real Hook event. Restart or
278
+ refresh WorkBuddy, submit one prompt, and check status again. `observed` means
279
+ the Hook entrypoint and its shared runtime loaded; `invalid` means setup should
280
+ be rerun.
281
+
282
+ If WorkBuddy still reports a Hook command containing `/c/Users/...`, it is
283
+ loading a stale plugin manifest. Rerun the start command above and fully
284
+ restart WorkBuddy. Do not manually edit the installed Hook command.
285
+
219
286
  ## DeepSeek Harness Profile integration is inactive
220
287
 
221
288
  ```sh