Skip to content

Integration: Aider

PathStatusNotes
Harness (proxy)✅ SupportedAider routes through MemStrata via --openai-api-base
MCP serverAider does not support MCP natively
Browser extensionAider is terminal-based; no browser surface

Confidence: High. The harness proxy has been the primary Aider integration path since MemStrata v5.0. Tested with Aider v0.50+.

How it works: MemStrata exposes an OpenAI-compatible API on localhost:8080/v1. Aider is configured to use this as its API base. Every request Aider makes passes through the MemStrata harness, which compresses the context before forwarding to your real LLM provider. From Aider’s perspective, MemStrata is transparent.


1. Start the MemStrata harness

Terminal window
memstrata serve --port 8080

The harness starts an OpenAI-compatible endpoint at http://localhost:8080/v1. Your real LLM provider credentials stay in MemStrata’s config (set once with memstrata config set provider).

2. Configure Aider to use the harness

Run Aider with the --openai-api-base flag:

Terminal window
aider --openai-api-base http://localhost:8080/v1 --openai-api-key memstrata

The --openai-api-key value (memstrata) is a placeholder — authentication to your real provider is handled by the harness using your stored credentials. Pass any non-empty string.

3. Alias for convenience

Add to your shell profile:

Terminal window
alias aider-ms='aider --openai-api-base http://localhost:8080/v1 --openai-api-key memstrata'

Then just run aider-ms instead of aider.

4. Verify

Start an Aider session and run:

/ask What does the main() function do?

In a second terminal, check the harness log:

Terminal window
memstrata logs --tail 20

You should see entries like:

[2025-01-15 10:23:41] aider | compressed 4,821 → 2,109 tokens (56% reduction) | recall: 0.91

The harness forwards requests to whatever provider you’ve configured. To use a specific model:

Terminal window
aider --openai-api-base http://localhost:8080/v1 \
--openai-api-key memstrata \
--model gpt-4o

Or, to use Claude via the harness (the harness translates the OpenAI API format to Anthropic’s format):

Terminal window
aider --openai-api-base http://localhost:8080/v1 \
--openai-api-key memstrata \
--model claude-3-7-sonnet-20250219

Supported provider translations: OpenAI → OpenAI (passthrough), OpenAI → Anthropic, OpenAI → Ollama (local). Configure in memstrata config set provider.


SignalCaptured?Notes
/ask queries✅ YesFull context compression applied
/code requests✅ YesHarness compresses codebase context
Architect mode✅ YesBoth planning and editing turns
--map-tokens flag⚠️ PartialAider’s repo map and MemStrata’s graph index both run; MemStrata’s compressed output takes precedence
Edit application (file writes)✅ YesTracked for 24h survival metric
/run commandsShell commands; not AI turns
Voice input (--voice)✅ YesTranscribed text is captured as a normal turn

On --map-tokens interaction: Aider builds its own repo map and includes it in the prompt. When MemStrata is in the loop, it deduplicates and compresses this alongside its own graph context. If you want MemStrata to have full control, set --map-tokens 0 to disable Aider’s map and let MemStrata handle context entirely.


Aider shows “Connection refused” for api-base
The harness isn’t running. In a separate terminal: memstrata serve --port 8080.

openai.AuthenticationError
Pass any non-empty string as the API key (--openai-api-key memstrata). The real credentials are in MemStrata’s config.

Aider works but savings metrics don’t appear on dashboard
Check that memstrata index has been run on your project. The dashboard only shows metrics for indexed projects.

Slow responses with large codebases
First-request latency includes the graph query. Subsequent requests in the same session are faster (the relevant subgraph is cached). If it’s consistently slow, run memstrata index --rebuild to refresh the index.

Aider’s /diff shows unexpected changes
MemStrata never modifies the code Aider writes — it only compresses the input context, not the output. If diffs are unexpected, the cause is in Aider’s editing behavior, not MemStrata.