@memorax/memorax-code 0.1.11 → 0.1.12

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 (81) hide show
  1. package/README.md +7 -4
  2. package/bin/memorax-code-setup.mjs +136 -34
  3. package/bin/memorax-code-trae.mjs +4 -0
  4. package/docs/configuration.md +106 -52
  5. package/docs/troubleshooting.md +45 -6
  6. package/lib/memorax-code-backend/dist/clients/claude/transcript-turn.js +2 -2
  7. package/lib/memorax-code-backend/dist/clients/codex/rollout-turn.js +1 -1
  8. package/lib/memorax-code-backend/dist/clients/trae/lifecycle.js +53 -0
  9. package/lib/memorax-code-backend/dist/clients/trae/memory-hook-runtime.js +302 -0
  10. package/lib/memorax-code-backend/dist/clients/trae/turn-id.js +16 -0
  11. package/lib/memorax-code-backend/dist/config/memorax-code.js +14 -1
  12. package/lib/memorax-code-backend/dist/entrypoints/backend-cli.js +22 -4
  13. package/lib/memorax-code-backend/dist/lifecycle/active-clients.js +3 -0
  14. package/lib/memorax-code-backend/dist/lifecycle/client-plugin-removal.js +14 -2
  15. package/lib/memorax-code-backend/dist/lifecycle/client-selection.js +5 -3
  16. package/lib/memorax-code-backend/dist/lifecycle/orchestrator.js +62 -9
  17. package/lib/memorax-code-backend/dist/memory/hook-command.js +34 -2
  18. package/lib/memorax-code-backend/dist/memory/reminder-trace-recorder.js +5 -1
  19. package/lib/memorax-code-backend/dist/memory/service.js +12 -0
  20. package/lib/memorax-code-backend/dist/trace/config.js +12 -1
  21. package/lib/memorax-code-backend/dist/trace/context.js +26 -1
  22. package/lib/memorax-code-backend/package.json +1 -1
  23. package/lib/memorax-code-claude-adapter/.claude-plugin/plugin.json +1 -1
  24. package/lib/memorax-code-claude-adapter/hooks/runtime-shell.json +1 -1
  25. package/lib/memorax-code-claude-adapter/package.json +1 -1
  26. package/lib/memorax-code-claude-adapter/skills/memorax-code/SKILL.md +3 -1
  27. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/memorax-add.md +16 -3
  28. package/lib/memorax-code-claude-adapter/skills/memorax-code/references/memorax-search.md +15 -2
  29. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/.claude-plugin/plugin.json +1 -1
  30. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/hooks/runtime-shell.json +1 -1
  31. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/package.json +1 -1
  32. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/SKILL.md +3 -1
  33. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/memorax-add.md +16 -3
  34. package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/skills/memorax-code/references/memorax-search.md +15 -2
  35. package/lib/memorax-code-codebuddy-adapter/.codebuddy-plugin/plugin.json +1 -1
  36. package/lib/memorax-code-codebuddy-adapter/package.json +1 -1
  37. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/SKILL.md +3 -1
  38. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/references/memorax-add.md +16 -3
  39. package/lib/memorax-code-codebuddy-adapter/skills/memorax-code/references/memorax-search.md +15 -2
  40. package/lib/memorax-code-codex-adapter/.codex-plugin/plugin.json +1 -1
  41. package/lib/memorax-code-codex-adapter/hooks/runtime-shell.json +1 -1
  42. package/lib/memorax-code-codex-adapter/package.json +1 -1
  43. package/lib/memorax-code-codex-adapter/skills/memorax-code/SKILL.md +3 -1
  44. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/memorax-add.md +16 -3
  45. package/lib/memorax-code-codex-adapter/skills/memorax-code/references/memorax-search.md +15 -2
  46. package/lib/memorax-code-dsh-adapter/package.json +1 -1
  47. package/lib/memorax-code-dsh-adapter/skills/memorax-code/SKILL.md +3 -1
  48. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/memorax-add.md +16 -3
  49. package/lib/memorax-code-dsh-adapter/skills/memorax-code/references/memorax-search.md +15 -2
  50. package/lib/memorax-code-opencode-adapter/package.json +1 -1
  51. package/lib/memorax-code-opencode-adapter/skills/memorax-code/SKILL.md +3 -1
  52. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/memorax-add.md +16 -3
  53. package/lib/memorax-code-opencode-adapter/skills/memorax-code/references/memorax-search.md +15 -2
  54. package/lib/memorax-code-trae-adapter/hooks/runtime-hook.mjs +340 -0
  55. package/lib/memorax-code-trae-adapter/package.json +9 -0
  56. package/lib/memorax-code-trae-adapter/skills/memorax-code/SKILL.md +87 -0
  57. package/lib/memorax-code-trae-adapter/skills/memorax-code/agents/claude.yaml +10 -0
  58. package/lib/memorax-code-trae-adapter/skills/memorax-code/agents/openai.yaml +7 -0
  59. package/lib/memorax-code-trae-adapter/skills/memorax-code/defaults.json +12 -0
  60. package/lib/memorax-code-trae-adapter/skills/memorax-code/references/memorax-add.md +101 -0
  61. package/lib/memorax-code-trae-adapter/skills/memorax-code/references/memorax-search.md +106 -0
  62. package/lib/memorax-code-trae-adapter/skills/memorax-code/references/personal-read.md +46 -0
  63. package/lib/memorax-code-trae-adapter/skills/memorax-code/references/personal-write.md +120 -0
  64. package/lib/memorax-code-trae-adapter/skills/memorax-code/references/repo-build.md +319 -0
  65. package/lib/memorax-code-trae-adapter/skills/memorax-code/references/repo-read.md +103 -0
  66. package/lib/memorax-code-trae-adapter/skills/memorax-code/references/repo-templates.md +390 -0
  67. package/lib/memorax-code-trae-adapter/skills/memorax-code/references/repo-update.md +127 -0
  68. package/lib/memorax-code-trae-adapter/skills/memorax-code/scripts/collect_all.py +579 -0
  69. package/lib/memorax-code-trae-adapter/skills/memorax-code/scripts/detect_updates.py +919 -0
  70. package/lib/memorax-code-trae-adapter/skills/memorax-code/scripts/git_commit_facets.py +222 -0
  71. package/lib/memorax-code-trae-adapter/skills/memorax-code/scripts/github_resource_facets.py +512 -0
  72. package/lib/memorax-code-trae-adapter/skills/memorax-code/scripts/gitlab_resource_facets.py +517 -0
  73. package/lib/memorax-code-trae-adapter/skills/memorax-code/scripts/prepare_repo_memory.py +411 -0
  74. package/lib/memorax-code-trae-adapter/skills/memorax-code/scripts/user_profile_memory.py +528 -0
  75. package/lib/memorax-code-trae-adapter/skills/memorax-code/scripts/validate_memory.py +248 -0
  76. package/lib/memorax-code-trae-adapter/src/adapter-paths.mjs +69 -0
  77. package/lib/memorax-code-trae-adapter/src/cli.mjs +59 -0
  78. package/lib/memorax-code-trae-adapter/src/config.mjs +630 -0
  79. package/lib/memorax-code-trae-adapter/src/runtime-observation.mjs +55 -0
  80. package/lib/run-entrypoint.mjs +6 -0
  81. package/package.json +5 -3
@@ -39,13 +39,13 @@ are not a compatibility contract.
39
39
 
40
40
  ## New configuration
41
41
 
42
- The generated template selects the existing client integrations, including the optional CodeBuddy/WorkBuddy adapter, disables automatic
43
- retrieval, enables automatic writeback, sets the preferred language to Chinese
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,
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.
42
+ The generated template selects the existing client integrations, including the
43
+ optional CodeBuddy/WorkBuddy and Trae adapters, disables automatic retrieval,
44
+ enables automatic writeback, sets the preferred language to Chinese (`zh`),
45
+ uses a five-turn skill reminder and the adaptive repository-update policy, and
46
+ enables content-bearing local traces for every supported client. Foreground
47
+ setup may narrow `[clients]` to clients detected on the host. The tables below
48
+ list all fallbacks, including 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,15 +54,19 @@ filesystem ACLs.
54
54
  ## Client selection
55
55
 
56
56
  If `[clients]` is absent, lifecycle commands select Codex, Claude Code, DSH,
57
- and OpenCode; CodeBuddy is opt-in unless detected during installation. If it is present, `codex`, `claude`, `dsh`, `opencode`, and `codebuddy` are
58
- boolean fields. Omitted `codex`, `claude`, or `opencode` values are disabled;
59
- an omitted `dsh` value remains enabled so configurations written before DSH
60
- support can discover an existing local Harness. Set `dsh = false` explicitly
61
- to disable that integration. The command-line override accepts a
57
+ and OpenCode; CodeBuddy/WorkBuddy and Trae are opt-in unless detected during
58
+ foreground setup. If the table is present, `codex`, `claude`, `dsh`,
59
+ `opencode`, `codebuddy`, and `trae` are boolean fields. Direct lifecycle
60
+ commands treat omitted `codex`, `claude`, `opencode`, `codebuddy`, or `trae`
61
+ values as disabled. Setup and update reconciliation retain an omitted field as
62
+ an undecided choice for client support added after the configuration was
63
+ written. An omitted `dsh` value remains enabled so configurations written
64
+ before DSH support can discover an existing local Harness. Set `dsh = false`
65
+ explicitly to disable that integration. The command-line override accepts a
62
66
  comma-separated subset:
63
67
 
64
68
  ```text
65
- --clients codex|claude|dsh|opencode|codebuddy|<comma-separated subset>|all|none
69
+ --clients codex|claude|dsh|opencode|codebuddy|trae|<comma-separated subset>|all|none
66
70
  ```
67
71
 
68
72
  Foreground `memorax-code setup` refreshes `[clients]` from the clients
@@ -70,18 +74,23 @@ available at that time. OpenCode is available when its explicit, XDG, or
70
74
  default configuration directory exists, or when `opencode` is on `PATH`.
71
75
  DSH is available when at least one valid Profile exists under
72
76
  `$DSH_HOME/profiles`; `DSH_HOME` defaults to `~/.dsh`. An explicit
73
- `[clients].dsh = false` is preserved.
74
-
75
- On later setup runs, enabled client intent is preserved. Each newly available
76
- disabled client is offered for activation with a default of yes; declining
77
- keeps it disabled. A selected client that is temporarily unavailable remains
78
- selected instead of being permanently disabled. Direct npm installation does
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.
77
+ `[clients].dsh = false` is preserved. Trae is available when its data home or
78
+ application is detected. `TRAE_CN_HOME`, then `TRAE_HOME`, overrides its
79
+ default `~/.trae-cn` data home.
80
+
81
+ On later setup runs, explicit `true` and `false` client choices are preserved.
82
+ A detected client whose field is absent is offered for activation with a
83
+ default of yes; declining records `false`. An absent client that is not
84
+ detected remains absent, while a selected client that is temporarily
85
+ unavailable remains selected. Direct npm installation does not detect clients
86
+ or modify `[clients]`.
87
+ Automatic update reconciliation preserves explicit choices and silently
88
+ enables a detected client whose field is absent. This lets configurations
89
+ written before an adapter was supported adopt it when its runtime is already
90
+ installed, without overriding an explicit `false`.
82
91
 
83
92
  Client selection controls managed client-integration lifecycle only. It does
84
- not change Codex, Claude Code, DSH, or OpenCode provider settings.
93
+ not change any coding agent's provider settings.
85
94
  `--clients none` runs the Backend without managing a client integration.
86
95
 
87
96
  ## Setup, automatic update, and package-transition state
@@ -89,8 +98,10 @@ not change Codex, Claude Code, DSH, or OpenCode provider settings.
89
98
  npm installation and foreground setup are separate operations.
90
99
  `npm install -g @memorax/memorax-code` installs or replaces package files
91
100
  without reading terminal input. `memorax-code setup` owns client detection,
92
- connection setup, configuration writes, Codex Hook activation or review, and
93
- final readiness checks.
101
+ connection setup, configuration writes, client integration activation or
102
+ review, and final readiness checks. Trae setup installs the managed Hook
103
+ entries but cannot turn on Trae's application-level Global Hooks setting; the
104
+ user must enable that setting once in Trae Settings.
94
105
 
95
106
  Default setup reuses a complete effective connection. Otherwise it detects the
96
107
  logged-in operating-system username and maps the system language to `zh` or
@@ -127,13 +138,14 @@ Backend to disable the scheduler. Client startup Hooks only recover an
127
138
  unavailable Backend and do not schedule updates.
128
139
 
129
140
  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.
141
+ non-interactive setup mode. That mode preserves explicit `[clients]` choices,
142
+ enables detected clients missing from an older configuration, and preserves
143
+ connection data and memory preferences. For Codex, only new or changed Hooks
144
+ returned by the incremental check are trusted silently, and the exact Hook
145
+ selection is validated again before and after the config write. A changed
146
+ marketplace identity or unverifiable Hook set prevents reconciliation from
147
+ completing. The standalone `memorax-code codex-plugin trust-hooks` command
148
+ still performs explicit review.
137
149
 
138
150
  The installed version and next check deadline are stored in another private
139
151
  record:
@@ -223,6 +235,38 @@ does not receive a `/c/Users/...` plugin path. `memorax-code-codebuddy status
223
235
  Hook executes, `observed` afterward, and `invalid` when the installed Hook
224
236
  manifest or runtime is incomplete. Restart or refresh WorkBuddy after setup.
225
237
 
238
+ ## Trae integration paths
239
+
240
+ The managed Trae Global Hooks and shared Skill use Trae's data home:
241
+
242
+ ```text
243
+ ~/.trae-cn/hooks.json
244
+ ~/.trae-cn/skills/memorax-code/
245
+ ```
246
+
247
+ `TRAE_CN_HOME`, then `TRAE_HOME`, overrides the default root; lifecycle
248
+ commands can override it for one invocation with `--trae-home`. The ownership
249
+ record and content-addressed Hook runtime live under
250
+ `$MEMORAX_CODE_HOME/adapters/trae/`. Setup merges one marked MemoraX Code Hook
251
+ into each of `SessionStart`, `UserPromptSubmit`, and `Stop`, preserves other
252
+ Trae Hooks and settings, and refuses to replace an unmanaged
253
+ `skills/memorax-code` directory. Disable and uninstall remove only entries
254
+ marked as MemoraX Code-owned and the managed Skill.
255
+
256
+ Trae does not expose a reliable programmatic switch for application-level
257
+ Global Hooks. After the first setup, enable **Global Hooks** once in Trae
258
+ Settings and start a new session. `memorax-code-trae status --json` reports the
259
+ Hook runtime as `unverified` until Trae executes a managed Hook, then as
260
+ `observed`; it also reports when this one-time activation may still be needed.
261
+
262
+ Trae does not currently expose a stable raw Session or a headless CLI. The
263
+ adapter therefore correlates the prompt from `UserPromptSubmit` with the final
264
+ assistant message from `Stop` and uses that closed, validated Hook pair as
265
+ Trae's automatic-writeback content authority. It does not guess from another
266
+ Turn or maintain a pending queue. The Skill can still perform explicit Repo
267
+ Memory work, but automatic background Repo Memory jobs are unavailable in
268
+ Trae until the client provides a suitable headless worker.
269
+
226
270
  The managed loader records the exact MemoraX Code home, OpenCode configuration
227
271
  directory, installed Node runtime, and `memorax-code` entrypoint. When the
228
272
  enabled plugin loads, it performs a best-effort Backend health check and uses
@@ -373,12 +417,14 @@ Supported policies are `every-commit`, `commit-count`, `daily`,
373
417
  `pull-request`, `pull-request-or-daily`, and `adaptive`. Invalid policy values
374
418
  fall back to `adaptive`.
375
419
 
376
- In Codex, Claude Code, CodeBuddy/WorkBuddy, DSH, and OpenCode, the first eligible prompt starts a
377
- background build only when the Backend has authorized a Git worktree and that
378
- worktree has no `.repo_memory/PROFILE.md`. If the Backend or workspace
379
- authority is unavailable, the client integration skips that attempt instead
380
- of falling back to its local workspace path. DSH schedules this work through
381
- its native pre-step integration rather than a Hook.
420
+ In Codex, Claude Code, CodeBuddy/WorkBuddy, DSH, and OpenCode, the first
421
+ eligible prompt starts a background build only when the Backend has authorized
422
+ a Git worktree and that worktree has no `.repo_memory/PROFILE.md`. If the
423
+ Backend or workspace authority is unavailable, the client integration skips
424
+ that attempt instead of falling back to its local workspace path. DSH schedules
425
+ this work through its native pre-step integration rather than a Hook. Trae
426
+ receives the shared Skill, User Profile, and Procedure reminders, but does not
427
+ start this background build because Trae has no supported headless worker.
382
428
 
383
429
  CodeBuddy/WorkBuddy repository jobs run the headless client under a bounded
384
430
  worker. `MEMORAX_CODE_REPO_MEMORY_JOB_TIMEOUT_MS` sets the client execution
@@ -388,24 +434,26 @@ the grace period before the worker force-terminates a client that ignores
388
434
  `codebuddy_timeout` (or `<runner>_timeout`) in the job state, so a stalled
389
435
  headless client cannot leave an active job and repository marker indefinitely.
390
436
 
391
- A relevant repo-read runs supervised maintenance in all supported clients. The
392
- configured policy may select a build, update, or no-op. DSH maintenance
393
- requires an enabled, managed Profile that includes `@deepseek-ai/dsh-headless`.
394
- OpenCode executes the job through its active local server. Desktop-only
395
- installations do not require a standalone `opencode` executable in `PATH`.
437
+ A relevant repo-read runs supervised maintenance in the five headless-capable
438
+ client integrations. The configured policy may select a build, update, or
439
+ no-op. DSH maintenance requires an enabled, managed Profile that includes
440
+ `@deepseek-ai/dsh-headless`. OpenCode executes the job through its active local
441
+ server. Desktop-only installations do not require a standalone `opencode`
442
+ executable in `PATH`. Trae users can invoke the Skill explicitly, but Trae is
443
+ not an automatic maintenance runner.
396
444
 
397
445
  ## Local traces
398
446
 
399
- `[trace.codex]`, `[trace.claude]`, `[trace.dsh]`, `[trace.opencode]`, and `[trace.codebuddy]`
400
- support the same fields:
447
+ `[trace.codex]`, `[trace.claude]`, `[trace.dsh]`, `[trace.opencode]`,
448
+ `[trace.codebuddy]`, and `[trace.trae]` support the same fields:
401
449
 
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` |
450
+ | Field | Codex environment | Claude environment | DSH environment | OpenCode environment | CodeBuddy/WorkBuddy environment | Trae environment | Fallback |
451
+ | --- | --- | --- | --- | --- | --- | --- | --- |
452
+ | `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` | `MEMORAX_CODE_TRAE_TRACE_ENABLED` | `true` |
453
+ | `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` | `MEMORAX_CODE_TRAE_TRACE_CAPTURE_CONTENT` | `true` |
454
+ | `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` | `MEMORAX_CODE_TRAE_TRACE_RETENTION_DAYS` | `7` |
455
+ | `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` | `MEMORAX_CODE_TRAE_TRACE_MAX_EVENT_CHARS` | `20000` |
456
+ | `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` | `MEMORAX_CODE_TRAE_TRACE_MAX_FILE_BYTES` | `52428800` |
409
457
 
410
458
  Depending on the enabled client capabilities, content capture can include
411
459
  prompts, responses, recalled memory, writeback content, reminder text, and
@@ -418,6 +466,10 @@ DSH trace contains only normalized lifecycle and memory-operation events. Its
418
466
  native Session Event Log and raw events remain local to DSH; MemoraX Code does
419
467
  not copy that log into trace.
420
468
 
469
+ Trae trace contains only normalized lifecycle and memory-operation events from
470
+ the validated Hook pair. Trae does not expose a raw Session authority for
471
+ MemoraX Code to copy.
472
+
421
473
  ## Backend runtime settings
422
474
 
423
475
  Backend connection and process authority is not stored in `config.toml`.
@@ -465,6 +517,8 @@ memorax-code-codex doctor
465
517
  memorax-code-claude doctor
466
518
  memorax-code status --clients dsh
467
519
  memorax-code-opencode doctor
520
+ memorax-code-codebuddy status --json
521
+ memorax-code-trae status --json
468
522
  ```
469
523
 
470
524
  The status commands do not print the MemoraX API key or Backend token.
@@ -9,14 +9,23 @@ memorax-code-codex doctor
9
9
  memorax-code-claude doctor
10
10
  memorax-code status --clients dsh
11
11
  memorax-code-opencode doctor
12
+ memorax-code-codebuddy status --json
13
+ memorax-code-trae status --json
12
14
  memorax-code logs
13
15
  ```
14
16
 
17
+ In Windows PowerShell, use `memorax-cli.cmd` everywhere this guide shows
18
+ `memorax-cli`. If an unqualified command fails with `UnauthorizedAccess` or
19
+ `PSSecurityException` because PowerShell selected `memorax-cli.ps1`, rerun the
20
+ same command once with `memorax-cli.cmd`, preserving its arguments and working
21
+ directory. Do not run `Set-ExecutionPolicy` for MemoraX commands.
22
+
15
23
  `memorax-code status` checks the Backend and selected client integrations,
16
- including DSH and OpenCode. `memorax-cli status` checks credentials, scope, and
17
- memory switches without printing secrets. Codex, Claude Code, and OpenCode
18
- also provide client-specific `doctor` commands; DSH uses the shared lifecycle
19
- status.
24
+ including DSH, OpenCode, CodeBuddy/WorkBuddy, and Trae. `memorax-cli status`
25
+ checks credentials, scope, and memory switches without printing secrets.
26
+ Codex, Claude Code, and OpenCode provide client-specific `doctor` commands;
27
+ CodeBuddy/WorkBuddy and Trae provide adapter status commands, and DSH uses the
28
+ shared lifecycle status.
20
29
 
21
30
  ## Package installed, but setup did not start
22
31
 
@@ -176,8 +185,9 @@ Memory write and memory search reminders are tracked independently. A reminder
176
185
  is emitted when the corresponding remaining quota reaches 10% or less and
177
186
  again at 0%; raw quota counts are not shown.
178
187
 
179
- Automatic quota reminders are currently supported in Codex, Claude Code, and
180
- OpenCode. DeepSeek Harness does not currently surface these reminders.
188
+ Automatic quota reminders are currently supported in Codex, Claude Code,
189
+ CodeBuddy/WorkBuddy, OpenCode, and Trae. DeepSeek Harness does not currently
190
+ surface these reminders.
181
191
 
182
192
  A guest reminder displays the complete Mark ID when the ready local trial
183
193
  identity matches the active API key. Registered-account reminders do not
@@ -283,6 +293,33 @@ If WorkBuddy still reports a Hook command containing `/c/Users/...`, it is
283
293
  loading a stale plugin manifest. Rerun the start command above and fully
284
294
  restart WorkBuddy. Do not manually edit the installed Hook command.
285
295
 
296
+ ## Trae Global Hooks or Skill is inactive
297
+
298
+ ```sh
299
+ memorax-code start --clients trae
300
+ memorax-code-trae status --json
301
+ ```
302
+
303
+ Trae uses `TRAE_CN_HOME`, then `TRAE_HOME`, and otherwise defaults to
304
+ `~/.trae-cn`. Setup merges the managed `SessionStart`, `UserPromptSubmit`, and
305
+ `Stop` entries into `hooks.json` and installs the shared Skill without
306
+ replacing unrelated Hooks. If status reports `globalHooksActivationRequired`
307
+ or a Hook status of `unverified`, open Trae Settings, enable **Global Hooks**
308
+ once, fully restart or refresh Trae, start a new session, and submit one
309
+ prompt. A subsequent status should report `observed`.
310
+
311
+ If status reports `hooks_invalid`, repair the existing Trae `hooks.json`
312
+ syntax before rerunning the start command. If it reports `skill_conflict`, an
313
+ unmanaged `skills/memorax-code` directory already exists; preserve or move that
314
+ directory deliberately before asking MemoraX Code to manage the Skill. Do not
315
+ copy generated runtime files or edit entries containing
316
+ `--memorax-code-trae-hook-v1` by hand.
317
+
318
+ Trae currently provides no stable raw Session or headless CLI. Automatic
319
+ writeback therefore requires a matching `UserPromptSubmit` and `Stop` Hook
320
+ pair, and automatic background Repo Memory jobs are not available. Explicit
321
+ Search/Add and Skill-driven Repo Memory remain available.
322
+
286
323
  ## DeepSeek Harness Profile integration is inactive
287
324
 
288
325
  ```sh
@@ -355,6 +392,7 @@ memorax-code-codex doctor
355
392
  memorax-code-claude doctor
356
393
  memorax-code status --clients dsh
357
394
  memorax-code-opencode doctor
395
+ memorax-code-trae status --json
358
396
  /usr/sbin/scutil --proxy
359
397
  /bin/launchctl getenv NO_PROXY
360
398
  /bin/launchctl getenv no_proxy
@@ -373,6 +411,7 @@ memorax-code-codex doctor
373
411
  memorax-code-claude doctor
374
412
  memorax-code status --clients dsh
375
413
  memorax-code-opencode doctor
414
+ memorax-code-trae status --json
376
415
  ```
377
416
 
378
417
  Common causes are:
@@ -488,13 +488,13 @@ function isNamedExecutable(word, name) {
488
488
  if (!word)
489
489
  return false;
490
490
  const normalized = word.replaceAll("\\", "/");
491
- if (normalized === name || normalized === `${name}.mjs`)
491
+ if (normalized === name || normalized === `${name}.cmd` || normalized === `${name}.mjs`)
492
492
  return true;
493
493
  const absolute = normalized.startsWith("/") || /^[A-Za-z]:\//u.test(normalized);
494
494
  if (!absolute)
495
495
  return false;
496
496
  const basename = normalized.slice(normalized.lastIndexOf("/") + 1);
497
- return basename === name || basename === `${name}.mjs`;
497
+ return basename === name || basename === `${name}.cmd` || basename === `${name}.mjs`;
498
498
  }
499
499
  function claudeMemoryActivities(assistantMessages) {
500
500
  const activities = [];
@@ -349,7 +349,7 @@ function activityCandidatesFromResponseItem(payload) {
349
349
  operation: match[1] === "build" ? "repo-build" : "repo-update",
350
350
  });
351
351
  }
352
- const memoryCliPattern = /(?:["']?cmd["']?\s*:\s*\\?["'`]|&&|\|\||;)\s*memorax-cli\s+(search|add)\b/giu;
352
+ const memoryCliPattern = /(?:["']?cmd["']?\s*:\s*\\?["'`]|&&|\|\||;)\s*memorax-cli(?:\.cmd)?\s+(search|add)\b/giu;
353
353
  for (const match of input.matchAll(memoryCliPattern)) {
354
354
  candidates.push({
355
355
  offset: match.index,
@@ -0,0 +1,53 @@
1
+ export const traeAdapterLifecycle = {
2
+ async status({ argv, serviceOptions }) {
3
+ try {
4
+ return await (await load()).readTraeAdapterStatus(options(argv, serviceOptions));
5
+ }
6
+ catch (error) {
7
+ return { ok: false, action: "status", error: error instanceof Error ? error.message : String(error) };
8
+ }
9
+ },
10
+ async prepareEnable({ argv, serviceOptions }) {
11
+ try {
12
+ return await (await load()).enableTraeAdapter(options(argv, serviceOptions));
13
+ }
14
+ catch (error) {
15
+ return { ok: false, action: "enable", error: error instanceof Error ? error.message : String(error) };
16
+ }
17
+ },
18
+ async disable({ argv, serviceOptions }) {
19
+ try {
20
+ return await (await load()).disableTraeAdapter(options(argv, serviceOptions));
21
+ }
22
+ catch (error) {
23
+ return { ok: false, action: "disable", error: error instanceof Error ? error.message : String(error) };
24
+ }
25
+ },
26
+ async remove({ argv, serviceOptions }) {
27
+ try {
28
+ return await (await load()).removeTraeAdapterInstallation(options(argv, serviceOptions));
29
+ }
30
+ catch (error) {
31
+ return {
32
+ ok: false,
33
+ action: "trae-adapter-remove",
34
+ reason: "adapter_remove_failed",
35
+ message: error instanceof Error ? error.message : String(error),
36
+ };
37
+ }
38
+ },
39
+ };
40
+ function options(argv, serviceOptions) {
41
+ const traeHome = argValue(argv, "--trae-home");
42
+ return {
43
+ ...(traeHome ? { traeHome } : {}),
44
+ memoraxCodeHome: serviceOptions.home,
45
+ };
46
+ }
47
+ async function load() {
48
+ return await import(new URL("../../../../memorax-code-trae-adapter/src/config.mjs", import.meta.url).href);
49
+ }
50
+ function argValue(argv, name) {
51
+ const index = argv.indexOf(name);
52
+ return index >= 0 ? argv[index + 1] : undefined;
53
+ }