Add Memory to Aider AI Coding Assistant

Aider is one of the best terminal-based AI coding assistants available. But like most AI tools, it starts fresh every session. This guide shows how to integrate REM Labs so Aider remembers your project context, past decisions, and coding patterns between sessions using a simple wrapper script.

The Problem with Stateless Sessions

Aider excels at editing code through conversation. But when you quit and restart, it has no memory of what you discussed, what architecture decisions you made, or what conventions you established. You end up re-adding the same files and re-explaining the same context every time.

Step 1: Install the REM Labs CLI

pip install remlabs # or npm install -g @remlabs/cli

Set your API key (get one free at remlabs.ai/console):

export REMLABS_API_KEY="your-api-key"

Step 2: Create an Aider Wrapper Script

Create a wrapper that loads relevant memories before starting Aider and saves new context after:

#!/bin/bash # aider-with-memory.sh # Recall relevant memories for this project CONTEXT=$(remlabs recall "project context and conventions" \ --namespace "$(basename $PWD)" --limit 10 --format text) # Create a temporary context file CONTEXT_FILE=$(mktemp) echo "$CONTEXT" > "$CONTEXT_FILE" # Start aider with memory context pre-loaded aider --message-file "$CONTEXT_FILE" "$@" # Clean up rm -f "$CONTEXT_FILE"

Step 3: Store Memories from Aider

After an Aider session where you make important decisions, save them to REM Labs:

# Store a decision remlabs remember "We use the repository pattern for all database access. Each model gets its own repository class in src/repositories/" \ --tags "architecture,database,patterns" \ --namespace "my-project" # Store a convention remlabs remember "Error handling: always use AppError class from src/lib/errors.ts. Never throw raw Error objects." \ --tags "conventions,errors" \ --namespace "my-project"

Automated Memory with Git Hooks

Automate memory storage by adding a post-commit hook that summarizes changes:

#!/bin/bash # .git/hooks/post-commit MSG=$(git log -1 --pretty=%B) DIFF=$(git diff HEAD~1 --stat) remlabs remember "Commit: $MSG\nFiles changed:\n$DIFF" \ --tags "git,commits" \ --namespace "$(basename $PWD)"

Advanced: Python Integration

For deeper integration, use the REM Labs Python SDK alongside Aider programmatically:

from remlabs import RemLabs client = RemLabs(api_key="your-api-key") # Before starting aider session memories = client.recall( query="project architecture and conventions", namespace="my-project", limit=10 ) # Format as context string for aider context = "\n".join([m["content"] for m in memories]) print(f"Loaded {len(memories)} memories for context")

Tip: Use namespaces matching your project directory name. This way, memories are automatically scoped when you switch between codebases.

Give Aider a memory that lasts

Free tier. Works with any Aider configuration.

Get started free →