> ## Documentation Index
> Fetch the complete documentation index at: https://agent-memory.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Persistent Memory to GitHub Copilot

> Connect Agent Memory to GitHub Copilot CLI and Copilot Workspace via MCP. Copilot remembers your codebase patterns and decisions across sessions.

GitHub Copilot CLI supports MCP. Connect Agent Memory to give Copilot persistent memory of your codebase architecture, conventions, and past decisions. Once connected, Copilot can reference what it learned in earlier sessions — the JWT middleware you chose, the test patterns you follow, the bug you already fixed twice.

## Connect Copilot CLI

<Steps>
  <Step title="Start the Agent Memory server">
    In a separate terminal, start the memory server before launching Copilot:

    ```bash theme={null}
    agentmemory
    ```

    The server runs on port 3111. Keep this terminal open.
  </Step>

  <Step title="Wire Agent Memory into Copilot">
    Run the connect command:

    ```bash theme={null}
    agentmemory connect copilot-cli
    ```

    This merges `mcpServers.agentmemory` into `~/.copilot/mcp-config.json` (or `$COPILOT_HOME/mcp-config.json` when `COPILOT_HOME` is set), preserving any existing MCP server entries.
  </Step>

  <Step title="Restart Copilot">
    Copilot picks up MCP servers on next launch or after running `/mcp` inside a session.
  </Step>
</Steps>

## Full Plugin Install (hooks and skills)

For the complete experience with lifecycle hooks and skills, install the plugin directly inside a Copilot session:

```bash theme={null}
copilot plugin install rohitg00/agentmemory:plugin
```

The plugin adds hook-based automatic capture on top of the MCP tools, so Copilot captures context without you needing to ask it to remember things explicitly.

## Manual MCP Config

If you prefer to configure it yourself, add this block to `~/.copilot/mcp-config.json`:

```json theme={null}
{
  "mcpServers": {
    "agentmemory": {
      "type": "local",
      "command": "npx",
      "args": ["-y", "@agentmemory/mcp"],
      "env": {
        "AGENTMEMORY_URL": "${AGENTMEMORY_URL:-http://localhost:3111}",
        "AGENTMEMORY_SECRET": "${AGENTMEMORY_SECRET:-}",
        "AGENTMEMORY_TOOLS": "${AGENTMEMORY_TOOLS:-all}"
      },
      "tools": ["*"]
    }
  }
}
```

<Note>
  The `"tools": ["*"]` field tells Copilot to make all Agent Memory tools available. The `"type": "local"` field marks this as a locally-spawned MCP server.
</Note>

## What Copilot Remembers

Once Agent Memory is connected, Copilot builds a persistent picture of your project across sessions:

<CardGroup cols={2}>
  <Card title="Project conventions and patterns" icon="ruler-combined">
    Naming conventions, folder structures, preferred libraries, and code style patterns observed across sessions.
  </Card>

  <Card title="Past bug fixes and root causes" icon="bug">
    When you fix a bug, Agent Memory records the root cause. Copilot can recall this context if a related issue comes up later.
  </Card>

  <Card title="Architecture decisions" icon="diagram-project">
    Technology choices, dependency decisions, and the reasoning behind them — so Copilot understands why your project is structured the way it is.
  </Card>

  <Card title="Frequently accessed files" icon="star">
    Files you touch often and their roles in the codebase, so Copilot understands what is important in your project.
  </Card>
</CardGroup>

## Install Native Skills (optional)

After connecting, install Agent Memory's skills to make Copilot more proactive about using memory:

```bash theme={null}
npx skills add rohitg00/agentmemory -y
```

This installs 15 skills that teach Copilot when to call recall, save, and pattern-detection tools.

## Verification

After connecting, start a new Copilot session and ask it about a past decision:

> What do you remember about how authentication is set up in this project?

If Agent Memory has context from a previous session where you worked on auth, Copilot will surface it. If the session is fresh, ask it to use `memory_recall` directly:

> Use memory\_recall to search for any context about this project.

To check the server from your terminal:

```bash theme={null}
agentmemory status
```

The real-time viewer at `http://localhost:3113` shows all stored memories and when they were last accessed.

## Windows Note

`agentmemory connect copilot-cli` is the one connect adapter that is Windows-safe. On Windows, the MCP server config uses `cmd.exe` under the hood to spawn `npx`. All other `agentmemory connect` adapters currently require macOS or Linux (or WSL2 on Windows).
