diff --git a/README.md b/README.md index ca6a96e..56e2e55 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,58 @@ uv run mnemosyne Point your LLM client (e.g., Claude Code) to the proxy URL (e.g., `http://127.0.0.1:8080/v1`). +## Claude Code Integration + +Mnemosyne works with [Claude Code](https://docs.anthropic.com/en/docs/claude-code) out of the box. Claude Code uses the Anthropic SDK internally, which respects the `ANTHROPIC_BASE_URL` environment variable. + +### Quick Start + +```bash +ANTHROPIC_BASE_URL=http://127.0.0.1:8080 claude +``` + +### Permanent Setup + +Add to your shell profile (`~/.zshrc`, `~/.bashrc`, etc.): + +```bash +export ANTHROPIC_BASE_URL=http://127.0.0.1:8080 +``` + +All Claude Code sessions will then route through Mnemosyne automatically. + +### Authentication + +Claude Code normally authenticates via Anthropic OAuth. When routing through Mnemosyne, there are two options: + +1. **OAuth passthrough** (recommended): Mnemosyne forwards OAuth credentials to Anthropic transparently. No extra configuration needed — just run `claude` as usual. + +2. **API key**: Set `ANTHROPIC_API_KEY` directly and Mnemosyne will forward it: + ```bash + export ANTHROPIC_API_KEY=sk-ant-... + export ANTHROPIC_BASE_URL=http://127.0.0.1:8080 + ``` + +### Systemd Service + +To ensure Mnemosyne is always running when Claude Code starts, install the systemd user service: + +```bash +cp mnemosyne.service ~/.config/systemd/user/ +systemctl --user enable mnemosyne.service +systemctl --user start mnemosyne.service +``` + +### Verifying the Connection + +While Claude Code is running, check the dashboard at `http://127.0.0.1:8080/dashboard` or query the API: + +```bash +curl -s http://127.0.0.1:8080/api/sessions | python3 -m json.tool +``` + +You should see an active session with incoming/outgoing byte counts. + ## API Reference * `/api/sessions`: List active conversation sessions.