[← Back to README](../README.md) # Agent Setup Engram works with **any MCP-compatible agent**. Pick your agent below. > Cloud bootstrap automation in agent scripts/plugins is intentionally deferred in this rollout. Use `engram cloud ...` manually for now. > > Deferred validation scope for this rollout: > > - Setup/plugin scripts are **not** yet validated as cloud enrollment/login orchestrators. > - `engram setup ...` installs MCP/plugin integrations only; it does **not** auto-run `engram cloud config/enroll/upgrade`. > - Cloud onboarding contract remains CLI-first until script-level cloud flows are explicitly implemented. If a generic MCP client retains an absolute Engram executable path after you move or replace the binary, run `engram doctor` to identify the affected client, then run `engram setup ` with the new binary to refresh its Engram registration (Pi is an exception: its Engram MCP entry is user-owned and must be updated manually). Doctor is read-only and does not flag bare custom commands or missing registrations. Setup preserves unrelated MCP server entries. ## Quick Reference | Agent | One-liner | Manual Config | | ------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------- | | Claude Code | `engram setup claude-code` | [Details](#claude-code) | | Pi | `engram setup pi` | [Details](#pi) | | OpenCode | `engram setup opencode` | [Details](#opencode) | | Gemini CLI | `engram setup gemini-cli` | [Details](#gemini-cli) | | Codex | `engram setup codex` | [Details](#codex) | | Antigravity CLI | `engram setup antigravity-cli` | [Details](#antigravity) | | Windsurf | `engram setup windsurf` | [Details](#windsurf) | | Qwen Code | `engram setup qwen` | [Details](#qwen-code) | | Kiro | `engram setup kiro` | [Details](#kiro) | | Cursor | `engram setup cursor` | [Details](#cursor) | | VS Code Copilot | `engram setup vscode-copilot` | [Details](#vs-code-copilot--claude-code-extension) | | Kilo Code | `engram setup kilocode` | [Details](#kilo-code) | | Kimi Code | `engram setup kimi` | [Details](#kimi-code) | | CommandCode | `engram setup commandcode` | [Details](#commandcode) | | Any MCP agent | `engram mcp` (stdio) | [Details](#any-other-mcp-agent) | > **Native setup for all agents above.** `engram setup ` configures the > supported integration and Memory Protocol idempotently. Pi uses native tools instead of registering Engram MCP; Claude Code is the > exception to direct config writes: its CLI owns user-scope MCP registration. The > per-agent sections below describe each integration's authoritative owner and > manual equivalent. > The OpenCode adapter treats optional `ENGRAM_BIN`, `ENGRAM_PORT`, and `ENGRAM_URL` values containing only whitespace as unset and uses their normal defaults. ### Protocol verbosity `engram setup claude-code --protocol=slim` requests the slim session-start protocol. Slim is honored only for the `claude-code` agent; all other agents remain on `full`. For Claude Code, slim activates only when Engram is a clean tagged release at or above 1.4.0. Local `dev`, Go pseudo-version, dirty, and other non-release builds remain on `full`; setup persists the selection and warns so you can install a supported tagged release. Claude slim also requires plugin 0.1.1+. If setup cannot verify the enabled marketplace plugin, it warns without changing the selected mode; session-only `claude --plugin-dir ...` installs cannot be detected. ## Pi Install Engram's Pi-native package: ```bash engram setup pi ``` This source version of `engram setup pi` runs `pi install npm:gentle-engram@0.4.1`, then ensures Pi settings contain that package, replacing earlier `0.1.8`, `0.1.11`, `0.1.12`, `0.1.14`, `0.1.15`, `0.1.16`, `0.2.0`, `0.3.0`, and `0.4.0` pins when present. Engram core `3.3.1` uses the same `0.4.1` pin; older core `3.3.0` binaries pin `0.3.0`, so use the explicit manual install below to select `0.4.1` with an older core. Pi agent writes use native `mem_*` tools, not Engram MCP registration. `engram setup pi` does not create or change `mcpServers.engram`. Earlier `0.1.16` `pi-engram init` still registers Engram MCP and must not be used for native-only setup; version `0.2.0` init does not create or change `mcp.json` and warns about an existing `mcpServers.engram` entry. If the Pi agent directory's `mcp.json` already contains `mcpServers.engram`, Go setup warns with its exact path and key; manually remove only that key and restart/reload Pi for the native-only guarantee. Until then native-only agent writes are **not guaranteed**. Other MCP servers are preserved. Pi 0.99.0 and later ship built-in MCP (`mcp.json`, `/mcp`, `pi mcp add`); an installed `pi-mcp-adapter` replaces that built-in support, so neither `engram setup pi` nor `pi-engram init` adds it. An existing adapter entry in `settings.json` is left untouched. For versioned mise installations, setup selects the shim directory from an absolute `MISE_SHIMS_DIR`, the effective absolute `shims_dir` reported by `mise settings get shims_dir` (including global config), or the mise data directory's default `shims` folder, in that order. Invalid settings output or an unavailable mise CLI leaves the default directory as the fallback. If the shim is missing from the selected directory, the caller uses its existing executable/PATH fallback policy; setup never writes mise warnings as the Engram MCP command. When [mise](https://mise.jdx.dev/) is detected in `PATH`, `engram setup pi` also auto-pins `npmCommand` in Pi's `settings.json` to `["mise", "exec", "node@", "--", "npm"]`, preventing Node version drift from silently changing which npm root Pi uses. If `npmCommand` already exists in `settings.json`, the existing value is preserved. This step is a no-op when mise is not installed. Manual equivalent: ```bash pi install npm:gentle-engram@0.4.1 ``` Restart Pi after installation. The package has two paths: - **HTTP event capture**: the Pi extension sends prompts, summaries, passive task learnings, and compact Pi-native `mem_*` tool calls to `engram serve`. - **Other MCP servers**: use Pi's built-in MCP (`mcp.json`) for servers such as Notion. Deliberate standalone/direct MCP clients can still launch `engram mcp` separately; do not register it in Pi for native-only agent writes. Earlier `0.1.16` init still registers Engram MCP; `0.2.0` init does not create or change `mcp.json`. Use an existing Engram HTTP server: ```bash # Set ENGRAM_URL before launching the Pi agent CLI ("pi" is the command, not part of the URL) ENGRAM_URL=http://127.0.0.1:7437 pi ``` `ENGRAM_URL` tells the `gentle-engram` Pi extension to use an already-running `engram serve` instance instead of auto-starting one. This is standard shell syntax: `KEY=value command`. The URL is the HTTP REST API base; it is not an MCP endpoint. ### Local server ownership Loopback reachability is not an ownership boundary. Engram stores an opaque identity in each local data directory and default-managed Claude Code, Codex, Pi, and OpenCode startups only adopt a matching local server. A different or older local server without that identity is reported instead of silently sharing memory. Set an explicit `ENGRAM_URL` to opt into an external server, or use `ENGRAM_PORT` or `ENGRAM_SOCKET` to isolate local servers. Use a custom Engram binary for MCP tools and local auto-start: ```bash ENGRAM_BIN=/path/to/engram pi ``` If the binary is missing, Pi-native local server startup reports an error without crashing Pi. ### Project auto-detection (important) `mem_save` resolves its write project in this order: validated explicit `project`, existing `session_id` association, repo `.engram/config.json`/cwd detection, then directory-basename fallback. Automatic Git detection stores the first normalized remote/root label in private shared Git metadata, so remote renames, linked worktrees, and repository moves keep using that label. If that binding is corrupt or cannot be written, detection fails closed; set `.engram/config.json` to the intended project rather than relying on the current remote name. Global local/cloud `project_id` propagation and alias migration remain deferred. Use an explicit `project` when you intentionally want to target a known project; invalid or unbacked names fail loudly instead of silently falling back. MCP also exposes deferred `mem_judge_many` (ordered per-item decisions) and `mem_session_finalize` (atomic caller-authored summary plus close). Finalize requires an existing exact session and matching project ownership; retries are local-only. These tools do not change the native Pi/HTTP wrappers or host lifecycle hooks. See [the MCP reference](../DOCS.md#mcp-tools-27-tools). Other write tools still primarily use cwd/repo detection unless their schema says otherwise. Start the MCP server from the repo or add `.engram/config.json` when you want deterministic default writes. OpenCode binds `mem_save`, `mem_save_prompt`, `mem_session_summary`, and `mem_capture_passive` to its confirmed top-level runtime session and maps subagents to their authoritative parent. Pi binds `mem_save`, `mem_save_prompt`, `mem_session_summary`, and `mem_capture_passive` to the exact `ctx.sessionManager.getSessionId()` runtime session. Those four wrappers ignore model-supplied session IDs, and a missing or unacknowledged runtime session fails safely instead of writing under a synthesized ID. To lock write tools to the canonical project for a repo, add `.engram/config.json` at the repo root: ```json { "project_name": "sias-app" } ``` When present, `project_name` is the default auto-detected target for writes from the repo and its subdirectories and overrides lower-confidence cwd/git detection. It is NOT an unbreakable lock against an explicit `mem_save(project=...)`, but explicit project writes are still validated against known context before they are accepted. Read tools can still use an explicit `project` filter when you need to query another existing project. Empty or invalid `project_name` values fail writes loudly instead of falling back silently. For monorepos, prefer subproject configs such as `backend/.engram/config.json` and `frontend/.engram/config.json`. Engram uses the **nearest** config under the enclosing git root, so backend/frontend can resolve as separate projects while still blocking `$HOME/.engram/config.json` ancestor leakage. **Recommended first call:** `mem_current_project` — confirms which project Engram detected before you start writing. Returns `project_source` (how it was detected) and `available_projects` (if cwd is ambiguous). **Cross-project recall:** when the detected project is empty or the wrong one, call `mem_list_projects` to enumerate every known project with counts, then scope `mem_search`/`mem_context` to the project you need. `mem_list_projects` is included in the `agent` profile, and `engram mcp` registers all tools by default — `--tools=agent` is not required. The Pi-native `gentle-engram` plugin exposes the same listing over HTTP (`GET /projects`) and also offers `mem_pin`/`mem_unpin` for local observation pin state. If a write tool returns `ambiguous_project`, the agent must not guess. This happens when the MCP server is started from a parent directory that contains multiple repositories, for example: ```text /Users/you/work ├── alan-thegentleman/ ├── angular-18-jest-playwright/ └── engram/ ``` The first write fails with an error like: ```json { "error_code": "ambiguous_project", "available_projects": [ "alan-thegentleman", "angular-18-jest-playwright", "engram" ] } ``` Ask the user to choose exactly one value from `available_projects`. For ambiguous-project recovery, retry `mem_save` with BOTH fields: ```json { "project": "chosen-project-from-available-projects", "project_choice_reason": "user_selected_after_ambiguous_project" } ``` On success, `mem_save` writes to the selected project and reports the recovery source: ```json { "project": "engram", "project_source": "user_selected_after_ambiguous_project", "project_path": "/Users/you/work/engram" } ``` If the exact choices normalize to the same stored project bucket, Engram returns `project_name_collision` instead of writing. Ask the user to rename or disambiguate the colliding projects before retrying. ### Ambiguous-project recovery rules Normal `mem_save` precedence: - explicit `project` - existing `session_id` project - repo `.engram/config.json` / cwd detection - directory-basename fallback Additional rules: - `project`, after trimming surrounding whitespace, must be a name, not a path. - Empty, whitespace-only, path-like, or control-character names are rejected. - Names are normalized the same way the store normalizes projects. - Invalid explicit `project` names fail loudly. - Valid-looking explicit `project` names are accepted only when backed by known context: an existing local project in the store, a matching existing session project, the nearest resolvable repo/subproject `.engram/config.json`, or exact ambiguous-project recovery. - Unbacked explicit `project` values are rejected; `mem_save(project=...)` is a validated selection, not an arbitrary project-creation path. - If `session_id` is provided and no session exists, `mem_save` fails loudly instead of falling back to cwd/config detection. - If both explicit `project` and `session_id` are supplied, they must match after normalization or the write is rejected. - `project_choice_reason=user_selected_after_ambiguous_project` is only valid when cwd detection is actually ambiguous; stale flags on a non-ambiguous cwd do not override explicit `project` precedence or session mismatch checks. - When ambiguous-project recovery is active, `project` must exactly match one of `available_projects`; invented or normalized guesses are rejected. - Exact choices may still fail with `project_name_collision` when two available names collapse to the same normalized storage bucket, such as `foo--bar` and `foo-bar`. - Ordinary explicit `mem_save(project=...)` calls may also fail with `project_name_collision` when the raw explicit name collapses into an existing config-backed, session-backed, or store-backed project bucket, such as `foo--bar` versus `foo-bar`. `mem_save_prompt` keeps the older cwd/default behavior. Its `project` field is only for ambiguous-project recovery together with `project_choice_reason=user_selected_after_ambiguous_project`. Mental model: ```text normal mem_save call ↓ explicit project wins when valid ↓ otherwise existing session project wins ↓ otherwise repo/cwd detection picks the default target ``` Ambiguous recovery: ```text write fails with ambiguous_project ↓ user chooses one exact value from available_projects ↓ agent retries with project + project_choice_reason ↓ Engram validates the exact choice and writes to that repo ``` If validation returns `project_name_collision`, do not guess. Ask the user to disambiguate the project names first. Alternatives: `cd` into the target repo before starting the MCP server, or add repo `.engram/config.json`. **Read tools** (`mem_search`, `mem_context`, `mem_stats`, `mem_timeline`, `mem_doctor`, `mem_get_observation`) accept an optional `project` override validated against known projects. Omit it to use the process override or cwd detection. For `mem_get_observation`, `project` selects response-envelope context only; the observation is still retrieved by ID without ownership filtering. `mem_get_observation` retains its read-only stored-owner fallback: only when cwd detection is ambiguous and the observation has a nonblank stored project does it use that project (`project_source: "stored_project"`, `project_path: ""`). This identifies the record's owner, not a verified repository path, and does not bypass malformed or unknown explicit/process overrides. `mem_update` and `mem_delete` require caller-supplied `expected_project`, including for personal/global scopes. Never fetch the target to fill a missing assertion. The normalized stored owner is checked atomically with the mutation. ID-addressed updates/deletes do not resolve server cwd or process overrides: a matching assertion works on shared multi-project servers, while an incorrect assertion is rejected without mutation. Update responses report the matched owner with `project_source: "explicit_override"` and an empty `project_path`. The assertion is not authentication, a permission grant, or a recovery token; save/recovery and session ownership protections remain unchanged. This is an intentional compatibility break for clients omitting `expected_project`. The in-repository Pi schema and forwarding require it; external gentle-engram relays need separate adaptation. --- ## OpenCode > **Prerequisite**: Install the `engram` binary first (via [Homebrew](INSTALLATION.md#homebrew-macos--linux), [Windows binary](INSTALLATION.md#windows), [binary download](INSTALLATION.md#download-binary-all-platforms), or [source](INSTALLATION.md#install-from-source-macos--linux)). The plugin needs it for the MCP server and session tracking. **Recommended: Full setup with one command** — installs the plugin AND registers the MCP server in your global `opencode.json` or `opencode.jsonc` automatically: ```bash engram setup opencode ``` This does three things: 1. Copies the plugin to `~/.config/opencode/plugins/engram.ts` (session tracking, Memory Protocol, compaction recovery) 2. Adds the `engram` MCP server entry to your global OpenCode configuration with `--tools=agent` (21 agent-facing tools) 3. Adds `opencode-subagent-statusline` to your `tui.json` or `tui.jsonc` so OpenCode shows sub-agent activity in the sidebar/home footer MCP registration adds a missing local Engram entry and refreshes only `command[0]` for an existing local entry, preserving all other configuration bytes, including comments, trailing commas, formatting, key order, flags, options, and other servers. It supports both V1 `mcp.engram` and V2 `mcp.servers.engram`; remote entries are left untouched. Setup uses `opencode.jsonc` when it exists, otherwise `opencode.json`; OpenCode loads both global files and merges `.jsonc` last. The directory is `$XDG_CONFIG_HOME/opencode` when set, otherwise `~/.config/opencode` on all platforms. Project and environment overrides may take precedence over this global entry. Malformed or ambiguous MCP configuration (including duplicate keys, a non-object root, or a non-object `mcp` or `mcp.servers` block) is refused without changing that file. Setup still installs the plugin and attempts TUI registration, but prints the existing manual-MCP warning. This byte-preservation guarantee applies to MCP registration, not the separate `tui.json(c)` writer. ### Recover after moving the Engram binary Setup bakes the current executable path into the OpenCode plugin. After a disk migration or binary move, run `engram setup opencode` using the current Engram installation, then restart OpenCode. A nonblank `ENGRAM_BIN` overrides that baked default; correct or unset a stale override before restarting. A missing selected binary does not trigger automatic PATH fallback. Early local readiness diagnostics distinguish `binary-not-found`, `identity-command-failed` (launch error or nonzero exit), and `identity-output-invalid` (not a 32-character lowercase hexadecimal identity). They identify `ENGRAM_BIN override` versus `setup-default` without exposing paths or command output. `identity-mismatch` separately means the responding server did not match the selected binary's identity; do not bypass that check or replace a running server to silence it. HTTP rejection and acknowledgement diagnostics remain separate. These diagnostics narrow an early failure; they do not establish or resolve the original cause of attribution failures with an otherwise healthy server. ### Verify each layer after setup `engram setup opencode` confirms only that it wrote the plugin and, when no warning was printed, the OpenCode MCP registration. It cannot confirm that OpenCode connected to the server or that an already-running agent session exposes the tools. 1. Restart OpenCode, then run `opencode mcp list`. Confirm that OpenCode reports the `engram` server as connected. This verifies the client/server connection, not tool exposure in an agent session. 2. Start a **new** OpenCode agent session and confirm that it can use an `engram_mem_*` tool before relying on Engram. A connected server, HTTP health check, or successful `engram setup` does not by itself prove that tools are visible in the active agent session. If the server is connected but the new session does not expose Engram tools, restart OpenCode and create another new session. Engram cannot directly inspect or verify the tool exposure of the active OpenCode agent session. The plugin auto-starts the HTTP server if needed for session tracking. If your environment blocks background processes, run it manually: ```bash engram serve & ``` > **Windows**: OpenCode uses `~/.config/opencode/` on Windows too (it does not read `%APPDATA%\opencode\`). `engram setup opencode` writes to `~/.config/opencode/plugins/` and the global `opencode.json(c)` selected as described above. To run the server in the background: `Start-Process engram -ArgumentList "serve" -WindowStyle Hidden` (PowerShell) or just run `engram serve` in a separate terminal. **Alternative: Manual MCP-only setup** (no plugin, all 27 tools by default): Add to your `opencode.json` (global: `~/.config/opencode/opencode.json` on all platforms, or project-level): ```json { "mcp": { "engram": { "type": "local", "command": ["engram", "mcp"], "enabled": true } } } ``` See [Plugins → OpenCode Plugin](PLUGINS.md#opencode-plugin) for details on what the plugin provides beyond bare MCP. --- ## Claude Code > **Prerequisite**: Install the `engram` binary first (via [Homebrew](INSTALLATION.md#homebrew-macos--linux), [Windows binary](INSTALLATION.md#windows), [binary download](INSTALLATION.md#download-binary-all-platforms), or [source](INSTALLATION.md#install-from-source-macos--linux)). The plugin needs it for the MCP server and session tracking scripts. **Option A: Plugin via marketplace** — installs session hooks, scripts, compaction recovery, and the Memory Protocol skill: ```bash claude plugin marketplace add Gentleman-Programming/engram claude plugin install engram ``` Marketplace installation provides plugin assets only; it does not register the MCP server. > **If the marketplace command fails with a schema error** > > Older Claude Code CLI versions cannot parse some plugin manifest fields and will reject `claude plugin marketplace add` with messages like `Invalid schema: plugins.0.source: Invalid input`. The fix is to update the CLI: > > ```bash > claude --version # check what you have > claude update # upgrade to the latest > ``` > > Then re-run the marketplace command. If you cannot update for some reason, **Option C (Bare MCP)** below works on any Claude Code version because it does not go through the marketplace. **Option B: Supported complete setup (required for plugin MCP)** — run after Option A, or run it alone to install or refresh the marketplace plugin and register MCP: ```bash engram setup claude-code ``` The supported plugin-and-hook setup requires `jq` and `curl` on `PATH` before installation. On Windows, `curl.exe` satisfies curl detection, but `jq` must also be installed and available to the shell Claude Code uses. If those hook prerequisites are unavailable, use **Option C (Bare MCP)**, the MCP-only fallback; it does not install or run plugin hooks. When the plugin is already installed, `engram setup claude-code` runs `claude plugin marketplace update engram` followed by `claude plugin update engram@engram --scope user`. Setup installs and updates the user-scope copy; it does not update existing project- or local-scope copies. If either update fails, setup returns an error before MCP registration. Restart Claude Code after updating to load the new hooks. Updating the Engram binary alone does not update the plugin. `engram setup claude-code` delegates MCP registration to Claude CLI. Claude writes the user-scope top-level `mcpServers.engram` entry in `~/.claude.json` (Windows: `%USERPROFILE%\\.claude.json`); when `CLAUDE_CONFIG_DIR` is set, Claude uses `$CLAUDE_CONFIG_DIR/.claude.json`. Engram reads only that documented entry: an omitted `type` or explicit `"stdio"` with the exact absolute command and arguments (` mcp --tools=agent`) is a no-op; explicit `null`, empty or other types, and mismatched commands or arguments remain conflicts. A missing entry is added with `claude mcp add --transport stdio --scope user engram -- mcp --tools=agent` and then verified. A mismatched or unreadable entry is reported as a conflict and is never overwritten. If verification fails after a proven-absent add, setup asks Claude to remove that user-scope entry and reports both errors if rollback fails. You'll be asked whether to add Engram's agent-profile MCP tools to `~/.claude/settings.json` `permissions.allow`. Existing marketplace plugin copies receive hooks, scripts, and skills updates through normal Claude Code plugin updates; do not edit the plugin cache manually. `engram setup claude-code --protocol=slim` requires Engram plugin version 0.1.1 or later. Setup checks `claude plugin list --json` after a successful install and warns, without failing or changing the selected slim mode, when it cannot verify the installed enabled marketplace plugin. Update through your normal Claude Code plugin update path and restart Claude Code. Session-only `claude --plugin-dir ...` plugins cannot be detected by this check. **Option C: Bare MCP** — 23 agent-profile tools, no session management: Use Claude CLI to register the user-scope server (replace the placeholder with the absolute Engram executable path): ```bash claude mcp add --transport stdio --scope user engram -- mcp --tools=agent ``` Claude rejects an existing user-scope server with the same name rather than overwriting it. To remove the registration later, run `claude mcp remove engram --scope user`. With the Claude plugin, the host `PreToolUse` hook denies Engram write/session tools when host-session registration cannot be confirmed (including an explicitly malformed `ENGRAM_PORT`); it does not silently use the default port. Direct/manual MCP calls do not pass through this hook and retain the generic MCP handler's behavior, including writes to an ended session ID. Disabling or bypassing hooks, or a host hook timeout, cannot provide this hook-level guarantee. With bare MCP, add a [Surviving Compaction](#surviving-compaction-recommended) prompt to your `CLAUDE.md` so the agent remembers to use Engram after context resets. > **Windows note:** Claude Code lifecycle adapters use bash scripts. On Windows, Claude Code runs them through Git Bash (bundled with [Git for Windows](https://gitforwindows.org/)) or WSL. The `PreToolUse` hook for Engram write/session MCP tools is different: it invokes the portable native `engram hook claude-pre-tool-use` transformer. The `UserPromptSubmit` hook automatically switches to a fork-light safe path under Git Bash/MSYS2: the first-prompt ToolSearch still runs, while later save-reminder checks are skipped so prompt submission does not block. If Git Bash itself is blocked by Defender/EDR, the plugin also ships `scripts/user-prompt-submit.ps1` as a native PowerShell fallback for local override/testing. That fallback applies only to `UserPromptSubmit`; the complete plugin setup still requires `jq` and `curl` for its shared Bash hooks. **Option C (Bare MCP)** remains the no-hook fallback and works natively on Windows without any shell dependency. Windows usernames containing spaces (e.g. `C:\Users\John Doe\...`) are supported — all hook commands quote `${CLAUDE_PLUGIN_ROOT}` so the path is passed as a single argument even when it contains spaces. PowerShell fallback test and local override example: ```powershell '{"session_id":"edr/test:1"}' | pwsh -NoProfile -ExecutionPolicy Bypass -File "C:\path\to\engram\plugin\claude-code\scripts\user-prompt-submit.ps1" ``` ```json { "hooks": { "UserPromptSubmit": [ { "hooks": [ { "type": "command", "command": "pwsh -NoProfile -ExecutionPolicy Bypass -File \"C:\\path\\to\\engram\\plugin\\claude-code\\scripts\\user-prompt-submit.ps1\"", "timeout": 10 } ] } ] } } ``` See [Plugins → Claude Code Plugin](PLUGINS.md#claude-code-plugin) for details on what the plugin provides. ### Troubleshooting: Claude Code plugin install on Linux If `claude plugin install engram` fails on Linux with an error like: ``` EXDEV: cross-device link not permitted ``` this is a Node.js `fs.rename` limitation, not an Engram bug. Node uses `fs.rename` to move the downloaded plugin archive from the system temp directory (`/tmp`) to the plugin destination under your home directory. On many Linux systems `/tmp` and `/home` live on separate filesystems (common with `tmpfs` on `/tmp`), and the kernel rejects cross-device renames. **One-shot workaround** — set `TMPDIR` to a location on the same filesystem as your home directory before running the install: ```bash mkdir -p ~/.cache/claude-tmp TMPDIR=~/.cache/claude-tmp claude plugin install engram ``` **Permanent fix** — add the export to your shell rc file so all future `claude plugin install` commands work without the prefix: ```bash # ~/.bashrc or ~/.zshrc export TMPDIR="$HOME/.cache/claude-tmp" mkdir -p "$TMPDIR" ``` Then reload your shell (`source ~/.bashrc`) and re-run the install. > This is an upstream Claude Code CLI limitation that affects any plugin installed via `claude plugin install`, not just Engram. Docker-based environments are typically not affected because the container's `/tmp` and `/home` usually share the same overlay filesystem. --- ## Gemini CLI Recommended: one command to set up MCP + compaction recovery instructions: ```bash engram setup gemini-cli ``` `engram setup gemini-cli` now does three things: - Registers `mcpServers.engram` in `~/.gemini/settings.json` (Windows: `%APPDATA%\gemini\settings.json`) - Writes `~/.gemini/system.md` with the Engram Memory Protocol, including post-compaction recovery and the required `mem_session_summary` then `mem_session_end` close sequence - Removes a legacy `GEMINI_SYSTEM_MD` override from `~/.gemini/.env`; Gemini CLI loads `system.md` directly and the override resolves it relative to the working directory > `engram setup gemini-cli` automatically writes the full Memory Protocol to `~/.gemini/system.md`, so the agent knows exactly when to save, search, and close sessions. No additional configuration needed. Manual alternative: add to your `~/.gemini/settings.json` (global) or `.gemini/settings.json` (project); on Windows: `%APPDATA%\gemini\settings.json`: ```json { "mcpServers": { "engram": { "command": "engram", "args": ["mcp"] } } } ``` Or via the CLI: ```bash gemini mcp add engram engram mcp ``` --- ## Codex Recommended: one command to set up MCP + compaction recovery instructions: ```bash engram setup codex ``` `engram setup codex` does four things: - Registers `[mcp_servers.engram]` in the active Codex config (`$CODEX_HOME/config.toml` when `CODEX_HOME` is absolute, otherwise `~/.codex/config.toml`; on Windows the default is `%USERPROFILE%\.codex\config.toml`) and pins the current absolute executable path - Writes `engram-instructions.md` and `engram-compact-prompt.md` beside the active config as informational copies of the Memory Protocol - Installs the Codex plugin with `codex plugin marketplace add Gentleman-Programming/engram --ref main` and `codex plugin add engram@engram`. The plugin hooks inject the Memory Protocol additively, so this is how Codex actually receives it. If the CLI is missing or either command fails, setup returns an error, not complete success. The MCP config and informational instruction files remain written, but plugin activation is incomplete. Ensure `codex` is in `PATH`, resolve the reported command error, and run both commands above manually (or rerun `engram setup codex`), then restart Codex. Do not wire the informational files into prompt override keys as a workaround. - Removes complete top-level legacy `model_instructions_file` / `experimental_compact_prompt_file` string assignments, including quoted keys and multiline strings, if a previous Engram version wrote them Setup prepares legacy-key cleanup and MCP changes before writing `config.toml`. It preserves unrelated text, comments, and line endings. If a string/container is unterminated, an obsolete setting has a non-string value, or MCP is registered through an unsupported dotted/inline form instead of `[mcp_servers.engram]`, setup returns an error without changing the config or invoking the Codex plugin commands. Resolve the reported input manually and rerun setup. This bounded preservation check is not a general TOML validator and adds no parser dependency. > **Do not set `model_instructions_file` in Codex.** Unlike most instruction mechanisms, that key *replaces* Codex's built-in system instructions instead of adding to them. Pointing it at `engram-instructions.md` wipes Codex's own base prompt (`You are Codex, ...`) and degrades the agent. Earlier Engram versions did this automatically; current versions strip the keys instead. If you set them manually, you are deliberately opting into overriding Codex's base prompt. On Windows, setup also writes an executable marker at the first line of `config.toml`; the native `UserPromptSubmit` hook reads it from the same active config. If `engram.exe` moves, rerun `engram setup codex` before restarting Codex to refresh both pins. The Codex plugin passes the exact runtime `session_id` into model context only after the server confirms registration. On confirmed registration, startup, resume, clear, and post-compaction hooks instruct the model to reuse that binding for memory writes and retain it across compaction. On failed or unconfirmed registration, those hooks withhold the active memory-tool protocol while preserving the handoff warning, any fetched context, and the compacted summary for the current task. Stop agent-attributed memory writes until the host hook re-registers the same runtime ID on startup or resume; do not invent an ID or retry MCP writes without `session_id`. When Codex `PreToolUse` runs for a classified Engram MCP write/session tool, it confirms the current project for the host cwd and requires a matching successful registration before allowing and binding the host ID (`id` for session start/end). Registration retains shared ownership, including cross-project writes. Supported namespaced calls such as `mcp__plugin_engram_engram__mem_save` are bound too; other arguments are preserved. Failed or ended registration and malformed calls are denied without updated input, and an explicitly malformed `ENGRAM_PORT` never falls back to the default. Successful rewrites require `permissionDecision: "allow"` with `updatedInput`. This hook is best-effort: skipped, bypassed, or timed-out hooks provide no guarantee, and no claim is made for every Codex prompt pathway. Direct/manual MCP calls remain independent of the hook and retain generic MCP behavior (including ended-session writes); independent CLI/manual saves cannot substitute for agent session attribution. Post-compaction uses the same explicit `ENGRAM_URL` (or local `ENGRAM_PORT`) as startup. Manual alternative: add to your active Codex `config.toml` (Windows default: `%USERPROFILE%\.codex\config.toml`). On Windows, run `engram setup codex` to pin the MCP and native hook executable to its current absolute path: If `CODEX_HOME` is set, adjust the instruction-file paths below to that directory. ```toml [mcp_servers.engram] command = "engram" args = ["mcp"] ``` ### Troubleshooting: "MCP Transport closed" Codex communicates with Engram over a stdio MCP session that is started fresh each time Codex launches. If that session becomes stale — for example after replacing the `engram` binary, editing `config.toml` or the instruction files, or force-stopping an `engram` process — subsequent tool calls fail with: ``` Transport closed ``` **Recovery sequence** 1. Close the current Codex chat or window entirely. 2. If any `engram` processes are still running, stop them: - macOS/Linux: `pkill -x engram` - Windows: `taskkill /IM engram.exe /F` 3. Open a new Codex chat. Codex starts a fresh `engram mcp` stdio process on launch, which clears the stale session. **Prevention** - After replacing `engram.exe` / the `engram` binary, rerun `engram setup codex` on Windows, then start a new Codex chat before using memory tools. - After editing the active Codex `config.toml`, `engram-instructions.md`, or `engram-compact-prompt.md`, restart Codex to pick up the new config. - Avoid force-killing `engram` while a Codex session is active; prefer closing the chat first so Codex can shut down the MCP process cleanly. > **Windows note:** On Windows the stale process is most commonly left behind after an in-place binary replacement. The `taskkill` command above reliably clears it. If Codex shows the error immediately on a fresh chat, rerun `engram setup codex` so the MCP and native hook pins point to the current executable. --- ## VS Code (Copilot / Claude Code Extension) VS Code supports MCP servers natively in its chat panel (Copilot agent mode). This works with **any** AI agent running inside VS Code — Copilot, Claude Code extension, or any other MCP-compatible chat provider. **Automated (user profile):** ```bash engram setup vscode-copilot ``` This registers the engram server under the `servers` object (with `type: stdio`) in your VS Code User `mcp.json` and writes a Copilot instructions file at `/prompts/engram.instructions.md` (frontmatter `applyTo: "**"`). User dir per platform: macOS `~/Library/Application Support/Code/User/`, Linux `~/.config/Code/User/`, Windows `%APPDATA%\Code\User\`. **Option A: Workspace config** (recommended for teams — commit to source control): Add to `.vscode/mcp.json` in your project: ```json { "servers": { "engram": { "command": "engram", "args": ["mcp"] } } } ``` **Option B: User profile** (global, available across all workspaces): 1. Open Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`) 2. Run **MCP: Open User Configuration** 3. Add the same `engram` server entry above to VS Code User `mcp.json`: - macOS: `~/Library/Application Support/Code/User/mcp.json` - Linux: `~/.config/Code/User/mcp.json` - Windows: `%APPDATA%\Code\User\mcp.json` **Option C: CLI one-liner:** ```bash code --add-mcp "{\"name\":\"engram\",\"command\":\"engram\",\"args\":[\"mcp\"]}" ``` > **Using Claude Code extension in VS Code?** The Claude Code extension runs inside VS Code but uses its own MCP config. Follow the [Claude Code](#claude-code) instructions above — the `.claude/settings.json` config works whether you use Claude Code as a CLI or as a VS Code extension. > **Windows**: Make sure `engram.exe` is in your `PATH`. VS Code resolves MCP commands from the system PATH. **Adding the Memory Protocol** (recommended — teaches the agent when to save and search memories): Without the Memory Protocol, the agent has the tools but doesn't know WHEN to use them. Add these instructions to your agent's prompt: **For Copilot:** Create a `.instructions.md` file in the VS Code User `prompts/` folder and paste the Memory Protocol from [DOCS.md](../DOCS.md#memory-protocol-full-text). Recommended file path: - macOS: `~/Library/Application Support/Code/User/prompts/engram-memory.instructions.md` - Linux: `~/.config/Code/User/prompts/engram-memory.instructions.md` - Windows: `%APPDATA%\Code\User\prompts\engram-memory.instructions.md` **For any VS Code chat extension:** Add the Memory Protocol text to your extension's custom instructions or system prompt configuration. The Memory Protocol tells the agent: - **When to save** — after bugfixes, decisions, discoveries, config changes, patterns - **When to search** — reactive ("remember", "recall") + proactive (overlapping past work) - **Session close** — mandatory `mem_session_summary` before ending - **After compaction** — first persist the injected summary with `mem_session_summary`; request `mem_context` only if additional context is needed See [Surviving Compaction](#surviving-compaction-recommended) for the minimal version, or [DOCS.md](../DOCS.md#memory-protocol-full-text) for the full Memory Protocol text you can copy-paste. ### Project detection in VS Code, WSL, and CI VS Code, WSL, and most CI runners start the MCP server process without inheriting the shell's working directory, so cwd-based project detection may resolve to the wrong project or fall back to a directory basename you don't recognise. The reliable fix is to pin the project explicitly at startup time. Both forms below work: **Flag form** (recommended — visible in config): ```json { "servers": { "engram": { "command": "engram", "args": ["mcp", "--project=my-project", "--tools=agent"] } } } ``` **Environment variable form** (useful when the config format does not support extra args, or when you want to override without editing the config file): ```json { "servers": { "engram": { "command": "engram", "args": ["mcp", "--tools=agent"], "env": { "ENGRAM_PROJECT": "my-project" } } } } ``` Both `--project=my-project` and `ENGRAM_PROJECT=my-project` set `MCPConfig.DefaultProject`, which takes precedence over cwd detection for current-project tools for the lifetime of that MCP process. Deliberately global operations keep their own omission contract. > The `--project` flag and `ENGRAM_PROJECT` env var are the same mechanism. If both are supplied, the flag wins. The value must be a project name, not a path. Operations that cannot establish project context reject unknown values; documented creation and recovery writes retain their creation semantics. Same pattern applies to: - WSL terminals where VS Code opens a remote window (`\\wsl$\...` paths) — the MCP server process runs inside WSL but VS Code does not forward the workspace directory as cwd. - CI pipelines (GitHub Actions, GitLab CI, etc.) where the agent runs in a container and the checkout path differs from the project name you use locally. - Any Docker-based agent host where the container cwd does not match your Engram project name. --- ## Antigravity [Antigravity](https://antigravity.google) is Google's AI-first IDE/CLI with native MCP and skill support. **Automated:** ```bash engram setup antigravity-cli ``` This registers `mcpServers.engram` in the shared `~/.gemini/config/mcp_config.json` (read by Antigravity CLI, IDE, and SDK) and writes the Memory Protocol as a marker-delimited block in `~/.gemini/GEMINI.md`, preserving any existing content. **Manual** — open the MCP Store (`...` dropdown in the agent panel) → **Manage MCP Servers** → **View raw config**, and add to `~/.gemini/config/mcp_config.json`: ```json { "mcpServers": { "engram": { "command": "engram", "args": ["mcp", "--tools=agent"] } } } ``` Then add the Memory Protocol as a global rule in `~/.gemini/GEMINI.md`. See [DOCS.md](../DOCS.md#memory-protocol-full-text) for the full text. > **Note:** Antigravity has its own skill, rule, and MCP systems separate from VS Code. Do not use `.vscode/mcp.json`. This is distinct from `engram setup gemini-cli`, which writes the Gemini CLI's own `settings.json` / `system.md`. --- ## Cursor **Automated:** ```bash engram setup cursor ``` This registers `mcpServers.engram` in the global `~/.cursor/mcp.json` and writes the Memory Protocol to `~/.cursor/engram-memory-protocol.md` as an informational file for you to paste into User Rules (see the note below). **Manual** — add to your `.cursor/mcp.json` (global: `~/.cursor/mcp.json`; or project-relative `.cursor/mcp.json`): ```json { "mcpServers": { "engram": { "command": "engram", "args": ["mcp", "--tools=agent"] } } } ``` > **Windows**: Make sure `engram.exe` is in your `PATH`. Cursor resolves MCP commands from the system PATH. > **Memory Protocol:** Setup writes the protocol to `~/.cursor/engram-memory-protocol.md` as an informational file — Cursor does not load it automatically. Open it, copy the contents, and paste them into Cursor's **Customize → Rules → User Rules**. > > See [DOCS.md](../DOCS.md#memory-protocol-full-text) for the full text, or use the minimal version from [Surviving Compaction](#surviving-compaction-recommended). > > **Note:** To share the protocol with a team, commit an in-repo `.cursor/rules/*.mdc` file; project rules must use the `.mdc` extension with frontmatter — a plain `.md` file there is ignored. The legacy `.cursorrules` file at the project root is still recognized but deprecated. --- ## Windsurf **Automated:** ```bash engram setup windsurf ``` This registers `mcpServers.engram` in `~/.codeium/windsurf/mcp_config.json` (Cascade's MCP config) and writes the Memory Protocol as a marker block in `~/.codeium/windsurf/memories/global_rules.md`. **Manual** — add to `~/.codeium/windsurf/mcp_config.json`: ```json { "mcpServers": { "engram": { "command": "engram", "args": ["mcp", "--tools=agent"] } } } ``` > **Memory Protocol:** Add the Memory Protocol to `~/.codeium/windsurf/memories/global_rules.md`. See [DOCS.md](../DOCS.md#memory-protocol-full-text) for the full text. --- ## Qwen Code **Automated:** ```bash engram setup qwen ``` Registers `mcpServers.engram` in `~/.qwen/settings.json` and writes the Memory Protocol as a marker block in `~/.qwen/QWEN.md`. --- ## Kiro **Automated:** ```bash engram setup kiro ``` Registers `mcpServers.engram` in `~/.kiro/settings/mcp.json` and writes the Memory Protocol as a marker block in `~/.kiro/steering/engram.md`. (Kiro uses a split layout: MCP and steering live under `~/.kiro/` regardless of where the IDE keeps app settings.) --- ## Kilo Code **Automated:** ```bash engram setup kilocode ``` Registers the engram server under the OpenCode-style `mcp` object in `~/.config/kilo/opencode.json` and writes the Memory Protocol as a marker block in `~/.config/kilo/AGENTS.md`. --- ## Kimi Code **Automated:** ```bash engram setup kimi ``` Registers `mcpServers.engram` in `~/.kimi-code/mcp.json` and writes the Memory Protocol as a marker block in `~/.kimi-code/AGENTS.md`. Both files live under the Kimi Code data root, so when `KIMI_CODE_HOME` is set the setup honors it and writes there instead. **`KIMI_CODE_HOME` is only honored when it is an absolute path.** A relative value (for example `KIMI_CODE_HOME=.kimi-code`) is ignored and setup falls back to the default `~/.kimi-code` root, so config never lands in whatever directory you happened to run `engram` from. The `Next steps` printed after setup name the files that were actually written, so they follow the override. --- ## CommandCode **Automated:** ```bash engram setup commandcode ``` Registers `mcpServers.engram` in the user-scope `~/.commandcode/mcp.json` (private, available across all projects) and writes the Memory Protocol as a marker block in the user-tier `~/.commandcode/AGENTS.md`. Memory is re-read every request, so `AGENTS.md` edits apply on the next turn with no restart; restart the session so the MCP server is picked up. On Windows the CLI binary is `cmdc` instead of `cmd`, but the config paths are the same. --- ## Any other MCP agent The pattern is always the same — point your agent's MCP config to `engram mcp` via stdio transport. --- ## Surviving Compaction (Recommended) > **Is this step required?** No — `engram setup` handles all the MCP wiring. These snippets are an optional resilience layer. Add them if your agent forgets about Engram after long sessions or context resets. They are especially useful for agents that do not have a full plugin (VS Code, Cursor, Windsurf, Antigravity) and have no automated session tracking. When your agent compacts (summarizes long conversations to free context), it starts fresh — and might forget about Engram. To make memory truly resilient, add this to your agent's system prompt or config file: **For Claude Code** (`CLAUDE.md`): ```markdown ## Memory You have access to Engram persistent memory via MCP tools (mem_save, mem_search, mem_session_summary, etc.). - Save proactively after significant work — don't wait to be asked. - After any compaction or context reset, first persist the injected summary with `mem_session_summary`. Request `mem_context` only if additional context is needed. ``` **For OpenCode** (agent prompt in `opencode.json`): ```text After any compaction or context reset, first persist the injected summary with mem_session_summary. Request mem_context only if additional context is needed. Save memories proactively with mem_save after significant work. ``` **For Gemini CLI** (`GEMINI.md`): ```markdown ## Memory You have access to Engram persistent memory via MCP tools (mem_save, mem_search, mem_session_summary, etc.). - Save proactively after significant work — don't wait to be asked. - After any compaction or context reset, first persist the injected summary with `mem_session_summary`. Request `mem_context` only if additional context is needed. ``` **For VS Code** (`Code/User/prompts/*.instructions.md` or custom instructions): ```markdown ## Memory You have access to Engram persistent memory via MCP tools (mem_save, mem_search, mem_session_summary, etc.). - Save proactively after significant work — don't wait to be asked. - After any compaction or context reset, first persist the injected summary with `mem_session_summary`. Request `mem_context` only if additional context is needed. ``` **For Antigravity** (`~/.gemini/GEMINI.md` or `.agent/rules/`): ```markdown ## Memory You have access to Engram persistent memory via MCP tools (mem_save, mem_search, mem_session_summary, etc.). - Save proactively after significant work — don't wait to be asked. - After any compaction or context reset, first persist the injected summary with `mem_session_summary`. Request `mem_context` only if additional context is needed. ``` **For Cursor** (Customize → Rules → User Rules; the generated `~/.cursor/engram-memory-protocol.md` is informational and is not loaded automatically): ```text You have access to Engram persistent memory (mem_save, mem_search, mem_context, mem_session_summary). Save proactively after significant work. After context resets, first persist the injected summary with mem_session_summary. Request mem_context only if additional context is needed. ``` **For Windsurf** (`.windsurfrules`): ```text You have access to Engram persistent memory (mem_save, mem_search, mem_context, mem_session_summary). Save proactively after significant work. After context resets, first persist the injected summary with mem_session_summary. Request mem_context only if additional context is needed. ``` This is the **nuclear option** — system prompts survive everything, including compaction. Use it when you want guaranteed agent behavior without relying on plugin hooks. It is optional for agents that have a full plugin (Claude Code, OpenCode, Gemini CLI, Codex) and required for agents that do not (VS Code, Cursor, Windsurf, Antigravity). --- ## Conflict Surfacing (automatic) When you save a memory with `mem_save`, Engram automatically scans for similar existing observations using FTS5 full-text search. If any candidates are found above a relevance threshold, the response includes a `candidates[]` array and `judgment_required: true`. Nothing to configure — this runs on every save. ### What the agent sees `mem_save` returns an enriched envelope when candidates exist: ```json { "result": "Memory saved: \"...\"\nCONFLICT REVIEW PENDING — 2 candidate(s); use mem_judge to record verdicts.", "id": 42, "sync_id": "obs_abc123", "judgment_required": true, "judgment_status": "pending", "judgment_id": "rel-", "candidates": [ { "id": 18, "sync_id": "obs_xyz789", "title": "We use sessions for auth", "type": "decision", "score": -3.14, "judgment_id": "rel-" } ] } ``` When no candidates are found, `judgment_required` is `false` and no `candidates` field is present. The `result` string is unchanged. ### How the agent resolves conflicts The agent iterates `candidates[]` and calls `mem_judge` once per entry, using that entry's own `judgment_id`. The agent does NOT use the top-level `judgment_id` for multiple candidates — each candidate has its own. The agent's built-in heuristic (from `serverInstructions`) decides when to ask the user versus resolve autonomously: - **Ask the user** when confidence is below 0.7, OR when the chosen relation is `supersedes` or `conflicts_with` AND the observation type is `architecture`, `policy`, or `decision`. - **Resolve silently** when confidence >= 0.7 AND the relation is `related`, `compatible`, `scoped`, or `not_conflict`. When asking, the agent raises it naturally in the conversation — not as a blocking CLI prompt or dashboard action. ### How the user sees this The user sees it in the normal conversation flow. Example: > "I noticed memory #18 ('We use sessions for auth') might conflict with what we just saved. Want me to mark the new one as superseding it, or are they about different scopes? I can also mark them as compatible if both still apply." There is no separate dashboard or conflict list in Phase 1. ### What happens after judgment Once the agent calls `mem_judge` with a verdict: - The relation row is persisted with `judgment_status: "judged"` and the chosen `relation`. - If the relation is `supersedes`, future `mem_search` results show `supersedes: # ()` and `superseded_by: #<id> (<title>)` annotations on the affected observations, including the related memory's title. - If the relation is `conflicts_with`, future `mem_search` results show `conflicts: #<id> (<title>)` on both observations. - If the relation is `compatible`, `related`, `scoped`, or `not_conflict`, the judgment is stored in `memory_relations` but no annotation appears in search results. **Cloud sync**: when the project is enrolled in Engram Cloud and autosync is enabled, `mem_judge` verdicts propagate to other machines via the standard mutation push/pull cycle. The annotation appears in `mem_search` results on any machine that has pulled the relevant mutations. Relations that reference an observation not yet present locally are deferred and retried automatically on subsequent pull cycles — the verdict is never lost. Nothing breaks if `mem_judge` is never called — pending relations accumulate unjudged but do not affect other operations. ### Proactive semantic comparison (mem_compare) Agents can also proactively judge the relationship between any two memories using `mem_compare` (also available in the agent profile). Unlike `mem_judge`, which resolves a candidate surfaced by `mem_save`, `mem_compare` lets the agent compare any two observation IDs it has already read, and persist a verdict directly. This is useful for agent-initiated semantic audit workflows. See [Plugins → mem_compare reference](PLUGINS.md#mcp-tool-reference--mem_compare) for parameters and behavior. --- ## Cloud Autosync toggle `engram serve` and `engram mcp` support continuous background replication to an Engram Cloud server. This is **opt-in** and never fatal on missing config. ### Prerequisites 1. A running Engram Cloud server (see `docker-compose.cloud.yml` or `engram cloud serve`). The server must be a build that includes the mutation endpoints (`POST /sync/mutations/push`, `GET /sync/mutations/pull`). If the server is older, autosync enters `PhaseBackoff` with `reason_code: transport_failed` and logs `server_unsupported` to stderr. 2. A valid bearer token configured on the server. ### Enable autosync ```sh export ENGRAM_CLOUD_AUTOSYNC=1 # exact "1" only export ENGRAM_CLOUD_TOKEN=your-token # bearer token export ENGRAM_CLOUD_SERVER=https://cloud.engram.example.com engram serve # or engram mcp ``` The process logs `[autosync] started (server=...)` on success. Missing token or server URL logs `[autosync] ERROR: ...` and the process starts normally without autosync. For `engram mcp`, autosync runs for the lifetime of the stdio MCP process and is stopped when that process exits. --- ## Cloud dashboard (templ contributors) If you are contributing to the cloud dashboard (`internal/cloud/dashboard/`), the HTML components are rendered via [templ](https://templ.guide/). Before committing changes to any `.templ` file, regenerate the Go output: ```sh # Download module dependencies ahead of time (optional; no global templ install needed) go mod download # Regenerate make templ # or directly: go tool templ generate -path ./internal/cloud/dashboard ``` Commit the regenerated `components_templ.go`, `layout_templ.go`, and `login_templ.go` alongside your `.templ` source changes. `TestTemplGeneratedFilesAreCheckedIn` checks for missing generated files; CI also checks regeneration for drift.