← Back to News

feature

Oct 8, 2026

GitHub Copilot and VS Code Agent Hooks with MCP Capture

Capture GitHub Copilot agent sessions in VS Code and query past session history via MCP using native agent hooks.

RCLM now captures GitHub Copilot agent sessions directly in Visual Studio Code using the native VS Code Agent Hooks specification, while automatically configuring the ReclaimLLM Model Context Protocol (MCP) server for session search and recall.

When running Copilot Chat in Agent mode, RCLM records complete sessions—including conversation turns, tool executions, generated file diffs, and token metrics—and uploads them to your ReclaimLLM dashboard. At the same time, the local MCP integration lets Copilot query past sessions and pull historical context into current conversations without leaving VS Code.

How it works

Visual Studio Code provides an agent hooks mechanism that executes local command binaries in response to agent lifecycle events. RCLM hooks into this system via a dedicated handler (rclm-copilot-hooks) that receives event payloads on standard input and exits cleanly without interrupting editor workflows.

You can install Copilot hooks alongside all supported clients or target Copilot specifically:

# Install across all supported clients (now includes Copilot by default)
rclm-hooks-install

# Or install for GitHub Copilot in VS Code only
rclm-hooks-install --copilot
# (alias: rclm-hooks-install --vscode)

The installer configures both lifecycle capture and MCP memory tools in one pass:

  1. Lifecycle Hook Configuration: Registers commands for the complete agent lifecycle:

    • SessionStart: Initializes local tracking, records the workspace root and model, and prepares context policies.
    • UserPromptSubmit: Captures prompt inputs from the developer.
    • PreToolUse: Intercepts tool calls before execution to enforce local data loss prevention (such as secret redaction in sensitive files) and output compression.
    • PostToolUse: Captures tool outputs, file changes, and token counts.
    • Stop: Assembles the normalized session record and uploads it to ReclaimLLM.
    • SubagentStart / SubagentStop and PreCompact: Records subagent delegations and context window compaction checkpoints.
  2. Automated MCP Server Setup: Configures rclm-mcp so Copilot Chat can call ReclaimLLM tools (search_sessions, get_session, summarize_session, file_brief, and handoff) directly.

Global vs. workspace-local configuration

By default, RCLM installs hooks globally in your home directory:

  • Hooks: ~/.copilot/hooks/rclm.json
  • MCP Config: ~/.copilot/mcp-config.json

If you prefer to restrict capture or check hook configuration into a repository, use --local:

cd /path/to/project
rclm-hooks-install --local --copilot

This writes hook definitions to .github/hooks/rclm.json and MCP server settings to .vscode/mcp.json. Any team member with Workspace Trust enabled will share the same hook and tool setup.

Historical session backfill

If you previously used GitHub Copilot CLI or have existing session logs, rclm-sync backfills your historical sessions:

rclm-sync --copilot

The sync parser reads historical event logs from ~/.copilot/session-state/, extracts message turns and tool executions, and uploads them to your dashboard without duplicating already captured sessions.

Why native agent hooks

Before this release, recording GitHub Copilot interactions required routing traffic through an external HTTP proxy. While proxy capture records raw completions, it misses critical agent-level semantics: internal tool calls, subagent spawns, file diffs, and working directory context.

Building a dedicated VS Code extension was considered, but extensions add background overhead, require Marketplace distribution, and duplicate functionality that VS Code already provides through native hooks.

By building on VS Code's native agent hooks, RCLM achieves:

  • Zero extension overhead: No extra background extensions running in VS Code.
  • Fail-open resilience: Hook commands run asynchronously with strict timeouts and unconditionally exit with code 0. A capture issue will never disrupt your coding session.
  • Real-time privacy: Tool calls pass through RCLM's local DLP engine before execution, preventing accidental leakage of sensitive files or credentials.

Current limitations and edge cases

  • Workspace Trust required: For security, VS Code only executes agent hooks and registers workspace MCP servers in trusted folders. If hooks are not triggering, ensure your workspace is marked as trusted.
  • Image downscaling: Image downscaling is currently unsupported under Copilot's post-tool replacement contract. Image payloads pass through to the model unchanged.
  • Editor compatibility: Agent hooks require a recent build of Visual Studio Code with Copilot Chat agent mode enabled (such as VS Code Insiders or the latest release).

Feedback

We are watching how the VS Code agent hooks specification evolves across new VS Code releases. If you run into unexpected payload shapes, missing tool invocations, or edge cases with multi-root workspaces, please open an issue or reach out through the dashboard.