# Windsurf

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

## Recommended setup — let Windsurf 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 Windsurf 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 Windsurf's config only when Windsurf is the current target.

## Prerequisites

- Windsurf installed.
- PowerMem backend running 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 Windsurf by hand.

### Install

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

### Configure

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

In MCP mode, the extension writes:

```json
{
  "contextProvider": "powermem-mcp",
  "mcp": {
    "url": "http://localhost:8848/mcp"
  }
}
```

If you configure a local MCP path, it writes:

```json
{
  "contextProvider": "powermem-mcp",
  "mcp": {
    "configPath": "uvx"
  }
}
```

In HTTP mode, it writes:

```json
{
  "contextProvider": "powermem",
  "api": "http://localhost:8848/api/v1/memories/search"
}
```

If your server requires auth, the extension adds `apiKey`.

## Verify

1. Restart Windsurf.
2. Confirm the PowerMem context provider is loaded.
3. Add a memory containing `PowerMem Windsurf probe: dragonfruit-zx9`.
4. Search for `dragonfruit-zx9` from Windsurf and confirm a result is returned.

## Troubleshooting

- If Windsurf does not pick up the config, check that `~/.windsurf/context/powermem.json` exists and is valid JSON.
- If MCP mode fails, verify the backend exposes `/mcp`.
- If local MCP mode fails, verify the configured command is available on `PATH`.

## Uninstall

Delete `~/.windsurf/context/powermem.json`, then restart Windsurf.
