# GitHub Copilot

Connect GitHub Copilot to PowerMem with the config generated by the [PowerMem VS Code extension](https://github.com/oceanbase/powermem/tree/main/apps/vscode-extension/). The extension writes `~/.github/copilot/powermem.json`.

## Recommended setup — let your IDE agent set it up

First download the code and enter the directory:

```bash
git clone https://github.com/oceanbase/powermem
cd powermem
```

Then open the AI agent window in the IDE where you use GitHub Copilot and paste this one line:

```text
Read and follow apps/vscode-extension/SETUP.md to setup PowerMem
```

The agent follows [`apps/vscode-extension/SETUP.md`](https://github.com/oceanbase/powermem/blob/main/apps/vscode-extension/SETUP.md), prefers a reusable `powermem-server` HTTP API backend, and updates GitHub Copilot's config only when Copilot is the current target.

## Prerequisites

- GitHub Copilot installed in your editor.
- A running PowerMem backend at `http://localhost:8848` or another reachable URL.
- PowerMem configured with your LLM provider, API key, and model.

## Manual setup

Use this section only when you want to wire GitHub Copilot by hand.

### Install

Install the PowerMem VS Code extension in VS Code or Cursor, then run **PowerMem: Setup**.

### Configure

Run **PowerMem: Link to AI Tools**.

In MCP mode, the extension writes:

```json
{
  "name": "PowerMem",
  "type": "mcp",
  "mcpServer": {
    "command": "powermem-mcp",
    "args": ["stdio"]
  },
  "url": "http://localhost:8848/mcp"
}
```

In HTTP mode, it writes:

```json
{
  "name": "PowerMem",
  "type": "context_provider",
  "endpoint": "http://localhost:8848/api/v1/memories/search"
}
```

If your PowerMem server requires auth, the extension adds an `X-API-Key` authentication header in HTTP mode or `POWERMEM_API_KEY` for local MCP.

## Verify

1. Reload the editor or restart Copilot.
2. Confirm Copilot has loaded the PowerMem provider.
3. Add a memory containing `PowerMem Copilot probe: dragonfruit-zx9`.
4. Ask Copilot to search memory for `dragonfruit-zx9` and confirm it retrieves the probe.

## Troubleshooting

- If Copilot does not see PowerMem, confirm `~/.github/copilot/powermem.json` exists.
- If MCP fails, verify `powermem-mcp stdio` works or use remote MCP at `http://localhost:8848/mcp`.
- If HTTP mode fails with auth errors, rerun **PowerMem: Setup** and set the API key.

## Uninstall

Delete `~/.github/copilot/powermem.json`, then reload the editor.
