# GitHub Copilot Give GitHub Copilot OpenViking context across projects and sessions. After installation, OpenViking Hooks inject relevant context (memories, resources and skills) at session start and before each request, then capture new conversation turns after the response. MCP is available for explicit memory search, reading, and management. This integration is verified with Copilot CLI 1.0.119 on Linux. GitHub documents that VS Code and the GitHub Copilot app share the CLI's hook format, but they have not been tested with this integration. ## Install Prerequisites: macOS or Linux, Node.js 18+, and GitHub Copilot CLI. The installer guides you through the OpenViking connection settings; select **GitHub Copilot** when it asks which agents to set up. It is preselected when `~/.copilot` (or `$COPILOT_HOME`) exists. For a managed connection, select **OpenViking Managed Service**, then: - **Volcengine:** enter your service API key. The installer supplies the URL. - **BytePlus:** enter your API key. See [BytePlus setup](../guides/27-byteplus-setup.md). Older installers use **Custom URL** for BytePlus. 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** and enter its URL. If a connection is already saved, this option is named **Custom URL / keep current**. ```bash 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. ``` Start a new Copilot session after installation. Once installed, start a new Copilot session and ask it to follow https://docs.openviking.ai/agents/en/onboarding.md. It checks the connection and walks you through the first use; see [One-click setup](../getting-started/07-agent-onboarding.md). ## What gets installed The installer writes into Copilot's user configuration under `$COPILOT_HOME` (default `~/.copilot`): - `hooks/openviking-copilot.json`: the lifecycle hooks and the URI guard. Copilot loads user hook files without a trust prompt. - `mcp-config.json`: the OpenViking MCP server `openviking`, a stdio proxy (tools such as `search`, `read`, `remember`, `add_skill`). Copilot shows its tools to the model as `openviking-`, for example `openviking-search`. Other servers in the file are kept. - `skills/`: the `openviking-memory`, `openviking-skills`, `ov-experience-memory`, `openviking-rule-search`, and `ov-memory-doctor` skills. The hooks and the MCP proxy run from the runtime under `~/.openviking/agent-integrations/copilot/`. The installer does not need the `copilot` binary, and it does not install a Copilot plugin. Hooks and MCP read the same credentials from `~/.openviking/ovcli.conf`. `OPENVIKING_URL` and `OPENVIKING_API_KEY` override that file, and per-plugin settings live under `plugin.copilot` (see [Plugin Settings](../configuration/02-client.md#plugin-settings)). Sessions are stored in OpenViking as `cp-`. ## Verify 1. Run `node ~/.openviking/agent-integrations/copilot/scripts/ov-memory-doctor.mjs` and confirm that it reports no ✗. 2. Start a new Copilot session and confirm that the `openviking-*` tools are available. 3. Tell Copilot a test preference and end the session with `/exit`. After memory extraction completes, start a new session in the same workspace and ask about it. ## Host-specific behaviour Copilot registers `sessionStart`, `userPromptSubmitted`, `agentStop`, `preCompact`, and `sessionEnd`, plus a `preToolUse` URI guard on `view|create|edit|grep|glob|bash|powershell`. Capture, commits, recall, the offline queue, and everything else shared are described in the [Capability Reference](./16-capability-reference.md). - The session-start context reaches the model as a separate leading user message. Recall is appended to the prompt inside ``. Capture reads the prompt as the user typed it, so recalled memories are never captured back. - `agentStop` captures without committing. `preCompact` and `sessionEnd` capture and commit, by default in a detached worker so the hook answers at once. Copilot may therefore send its compaction summary request before the `preCompact` commit lands; nothing is lost, because Copilot only appends to the transcript. Compaction removes the session-start message, so the profile and the session-history note go out again with the next prompt. In between, the server's auto-commit policy applies. - Copilot writes a turn to its transcript a moment after `agentStop` fires. In the interactive TUI the detached capture still finds the whole turn; in a headless `-p` run the reply goes out with the `sessionEnd` capture, before the commit. Nothing waits for Copilot's final write: if the `sessionEnd` capture ever read the transcript before Copilot finished writing it (not observed in testing), the last turn would wait until the session is resumed. - `sessionEnd` fires on `/exit` and at the end of a headless `-p` run. Under `--acp` it fires after every prompt, so each prompt commits. A session that closes before its first prompt gets no `sessionEnd`. - `sessionEnd` carries no transcript path; the plugin reads `$COPILOT_HOME/session-state//events.jsonl`, a layout observed in Copilot CLI, not a published interface. - The URI guard denies `view`, `create`, `edit`, `grep`, and `glob` on a `viking://` URI, with an example call to the matching `openviking-`. A shell command (`bash`, `powershell`) that carries a `viking://` URI runs, and the model gets a notice that names the OpenViking tools. - Copilot fails a `preToolUse` hook closed: if the hook command itself fails, for example because the runtime was deleted, Copilot denies those seven tools. A hook that times out lets the call run. - On a resume (`--resume`, `--continue`) Copilot replaces the earlier session-start context with the new one, so on every resume the plugin sends the profile and the session-history note again with it, even when the profile has not changed. - The model passes the session to `session_history` itself. - Subagents get no recall and are not captured. The verified host contract and transcript format are recorded in [`hosts/copilot/DESIGN.md`](https://github.com/volcengine/OpenViking/blob/main/examples/agent-hook-plugin/hosts/copilot/DESIGN.md). ## Upgrade and uninstall Re-run the install command to upgrade. To uninstall, run: ```bash curl -fsSL https://openviking.ai/install | bash -s -- --uninstall --yes --harness copilot ``` Uninstall removes only the OpenViking hooks, the `openviking` MCP server, the skills it installed, and the runtime files. Other configuration is preserved. ## Troubleshooting | Symptom | Cause and fix | |---------|---------------| | Hooks do not run | Start a new session. If you set `COPILOT_HOME`, run the installer with the same value, so the files land where Copilot reads them. | | `view`, `create`, `edit`, `grep`, `glob`, `bash`, and `powershell` are all denied | The URI guard's hook command fails, which Copilot treats as a denial. Run the doctor, then re-run the installer. | | The installer cannot safely update `mcp-config.json` | Copilot accepts comments in the file, but the installer only edits plain JSON. Remove the comments and re-run the installer. | | The installer warns about another OpenViking hook file | Copilot loads every file under `$COPILOT_HOME/hooks/`, so both files run. Remove the one the warning names. | | Skills are listed twice | Without `COPILOT_HOME`, Copilot also reads `~/.agents/skills`. Remove the duplicate copies there. | | MCP does not connect | Check the URL/API key in `~/.openviking/ovcli.conf`, then start a new session. | | Detailed diagnostics are needed | Start Copilot with `OPENVIKING_DEBUG=1` and inspect `~/.openviking/logs/copilot-hooks.log`. | Windows is not supported: the installer is a bash script, and Copilot runs hook commands under PowerShell there. ## See also - [Capability Reference](./16-capability-reference.md) - [Authentication](../guides/04-authentication.md) - [Source: examples/agent-hook-plugin](https://github.com/volcengine/OpenViking/tree/main/examples/agent-hook-plugin) - [Copilot hooks configuration](https://docs.github.com/en/copilot/reference/hooks-configuration)