TRAE
Give TRAE, TRAE CN, and TraeCode CLI 2.0 long-term memory across projects and sessions. OpenViking Hooks automatically load relevant context, capture each conversation turn, and commit it for memory extraction. MCP remains available for explicit memory search, reading, and management.
Install
Prerequisites: macOS or Linux, Node.js 18+, and a TRAE/TRAE CN release that supports the SessionStart, UserPromptSubmit, PreToolUse, and Stop Hooks. TraeCode CLI 2.0 uses the Codex-compatible plugin format directly. The installer guides you through the OpenViking connection settings.
When prompted for the connection, Volcengine Cloud users should select Volcengine OpenViking Cloud and enter their API key. Select Self-hosted / local for a server on this machine (http://127.0.0.1:1933); for a remote self-hosted server, select Custom URL / keep current and enter its URL.
curl -fsSL https://openviking.ai/install | bash
# AI agents: not sure about running this? The script's header says what it does and how to verify it.When the installer asks which harnesses to install, select TRAE, TRAE CN, TraeCode CLI 2.0, or several of them. Quit and restart the corresponding client after installation.
TraeCode CLI 2.0: trust the hooks on first launch
TraeCode CLI 2.0 uses the Codex-format plugin. Starting trae-cli shows a hook review prompt similar to the one below; the exact layout varies by version. Pick Trust all and continue; Continue without trusting leaves the hooks off.
Hooks need review
6 hooks are new or changed.
Hooks can run outside the sandbox after you trust them.
1. Review hooks
> 2. Trust all and continue
3. Continue without trusting (hooks won't run)You can also use /hooks to review the OpenViking commands and trust and enable the hooks you want to use. Confirm openviking-memory is enabled in /plugins. Modified definitions may need review again. MCP connectivity alone does not verify recall or capture; see the Codex hook setup.
TRAE and TRAE CN use the installed hooks.json and need no hook approval; restart the corresponding client after installation.
What gets installed
SessionStartloads your profile, current project memory, and an<available-skills>catalog of your OpenViking skills.UserPromptSubmitrecalls and injects context for the current request, including your own skills and those shared with your account underviking://agent/skills.PreToolUseon TRAE and TRAE CN deniesRead,Glob, andGrepcalls whose path is aviking://URI and points to OpenViking MCP tools; aBashorRunCommandcommand that carries aviking://URI still runs, with a notice suggesting those tools. TraeCode CLI 2.0 uses the Codex plugin, whosePreToolUsematches onlyBash: it adds the same notice and never denies a call.- TRAE/TRAE CN
Stopcaptures and commits the completed turn. TraeCode CLI 2.0 follows the Codex plugin’s capture and lifecycle commit policy. - The OpenViking MCP server transparently exposes the full server MCP tool set (20 tools):
find,search,read,list,tree,remember,write,edit,add_resource,add_skill,list_watches,cancel_watch,grep,glob,forget,health,list_users,list_groups,get_acl, andset_acl.searchwithmode="context"returns assembled context. The skill catalog lists your own skills before those shared with your account, with each description cut to about 40 tokens. Its budget,skillCatalogTokenBudget(default1200tokens), is separate from the profile budget; when not every description fits, the catalog lists names only. SetskillCatalogtofalseor the budget to0to turn it off, either in thepluginsection of~/.openviking/ovcli.conf(Plugin Settings) or throughOPENVIKING_SKILL_CATALOGandOPENVIKING_SKILL_CATALOG_TOKEN_BUDGET.
Verify
- Restart TRAE, TRAE CN, or TraeCode CLI 2.0 and create a new Agent session.
- Confirm that
openvikingis connected in the client's MCP settings. - Ask about an existing project or preference and confirm that the answer uses stored memory.
- Tell the Agent a temporary preference, confirm capture and commit in the logs, then wait for memory extraction before asking about it in a new session in the same workspace.
- For TraeCode CLI 2.0, run
trae-cli plugin listto confirm thatopenviking-memoryis enabled, then run/hooksin the session and confirm the OpenViking entries are trusted and switched on.
For Hook diagnostics, start the client with OPENVIKING_DEBUG=1 and inspect:
- TRAE:
~/.openviking/logs/trae-hooks.log - TRAE CN:
~/.openviking/logs/trae-cn-hooks.log - TraeCode CLI 2.0:
~/.openviking/logs/codex-hooks.log
Upgrade and uninstall
Re-run the install command to upgrade. To uninstall TRAE CN:
curl -fsSL https://openviking.ai/install | bash -s -- --uninstall --yes --harness trae-cnReplace trae-cn with trae for TRAE. For TraeCode CLI 2.0, use trae-cli plugin uninstall openviking-memory@openviking. Running the installer with --harness trae-cli --uninstall only removes the deprecated standalone Hooks integration from older installations.
Troubleshooting
| Symptom | Cause and fix |
|---|---|
| Automatic recall does not run | Quit the client completely, restart it, and create a new Agent session. |
| TraeCode CLI 2.0 has the plugin, but nothing is recalled or captured | The startup hook-trust prompt was skipped or answered with Continue without trusting; an update that touches a hook asks for trust again. Trust and enable the OpenViking entries in /hooks, and confirm openviking-memory is enabled in /plugins — two independent switches, both have to be on. |
| MCP does not connect | Check the URL/API key in ~/.openviking/ovcli.conf, then restart the client. |
| A new session cannot recall the previous turn | Inspect the Hook log and confirm that Stop ran without /commit connection or authentication errors. |
| The same content is captured more than once | Check user and project Hooks for older trae-auto-recall.mjs or trae-auto-capture.mjs entries. Re-running the installer removes OpenViking-managed legacy entries. |
| TraeCode CLI 2.0 does not list the plugin | Run trae-cli plugin list; if openviking-memory is absent, rerun the installer and select TraeCode CLI 2.0. |