Get persistent memory working with Cline (formerly Claude Dev) in VS Code.
- Cline extension installed from VS Code Marketplace
- API key configured (Anthropic, OpenRouter, or other provider)
- Python 3.10+
- pipx installed (
pip install --user pipx && pipx ensurepath)
pipx install memorygraphMCPVerify installation:
memorygraph --version- Open VS Code
- Click the Cline icon in the sidebar
- Click the gear icon (settings) at the top
- Scroll to MCP Servers section
- Click Edit MCP Settings
This opens cline_mcp_settings.json. Add MemoryGraph:
{
"mcpServers": {
"memorygraph": {
"command": "memorygraph",
"args": [],
"disabled": false
}
}
}Click the refresh button in Cline's sidebar or reload VS Code.
In Cline's chat, ask:
What MCP tools do you have available for memory?
You should see MemoryGraph tools listed.
Store a memory:
Store this for later: The auth service uses JWT with 24-hour expiry
Retrieve it:
What token expiry does the auth service use?
{
"mcpServers": {
"memorygraph": {
"command": "memorygraph",
"args": ["--profile", "extended"],
"disabled": false
}
}
}{
"mcpServers": {
"memorygraph": {
"command": "memorygraph",
"args": [],
"env": {
"MEMORY_SQLITE_PATH": "/path/to/memory.db"
},
"disabled": false
}
}
}{
"mcpServers": {
"memorygraph": {
"command": "/Users/yourname/.local/bin/memorygraph",
"args": [],
"disabled": false
}
}
}Find your path: which memorygraph
Cline stores MCP settings at:
- macOS:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json - Linux:
~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json - Windows:
%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
Or access via Cline settings UI (recommended).
- Check the MCP Servers section in Cline settings
- Look for status indicator next to memorygraph
- Click the server name to see error details
{
"memorygraph": {
"disabled": false // Ensure this is false
}
}-
Verify installation:
which memorygraph memorygraph --version
-
Use full path:
{ "command": "/Users/yourname/.local/bin/memorygraph" } -
Ensure pipx bin is in PATH:
pipx ensurepath # Restart terminal and VS Code
- Open VS Code Output panel (
Cmd/Ctrl + Shift + U) - Select "Cline" from the dropdown
- Look for MCP-related messages
echo '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}},"id":1}' | memorygraphYou should see a JSON response.
- Leverage autonomous mode - Cline can use memory tools automatically during tasks
- Store decisions - Have Cline remember architectural decisions
- Track solutions - Store what worked when fixing bugs
- Project context - Build up knowledge about your codebase
Add this to .clinerules or your project's rules file for automatic memory usage:
## Memory Protocol
### REQUIRED: Before Starting Work
You MUST use `recall_memories` before any task. Query by project, tech, or task type.
### REQUIRED: Automatic Storage Triggers
Store memories on ANY of:
- **Git commit** → what was fixed/added
- **Bug fix** → problem + solution
- **Version release** → summarize changes
- **Architecture decision** → choice + rationale
- **Pattern discovered** → reusable approach
### Timing Mode (default: on-commit)
`memory_mode: immediate | on-commit | session-end`
### Memory Fields
- **Type**: solution | problem | code_pattern | fix | error | workflow
- **Title**: Specific, searchable (not generic)
- **Content**: Accomplishment, decisions, patterns
- **Tags**: project, tech, category (REQUIRED)
- **Importance**: 0.8+ critical, 0.5-0.7 standard, 0.3-0.4 minor
- **Relationships**: Link related memories when they exist
Do NOT wait to be asked. Memory storage is automatic.File locations:
- Project-specific:
.clinerulesin project root - Global: Cline Settings > Custom Instructions
Cline is an autonomous coding agent. MemoryGraph enhances this by:
- Persisting task context across sessions
- Remembering past decisions for consistency
- Tracking what worked in previous autonomous runs
- Building project knowledge over time
Task: Refactor the user service
Before you start, check if we have any memories about the user service
architecture or past refactoring decisions.
[Cline searches memories, finds relevant context]
Now proceed with the refactoring, and store any important decisions
you make for future reference.
Cline is popular with OpenRouter for free/cheap models. MemoryGraph works with any model Cline supports:
- Configure your OpenRouter API key in Cline
- MCP tools work the same regardless of model
- Memory persists across model switches
Cline supports multiple MCP servers:
{
"mcpServers": {
"memorygraph": {
"command": "memorygraph",
"args": ["--profile", "extended"]
},
"filesystem": {
"command": "mcp-server-filesystem",
"args": ["/path/to/allowed/dir"]
}
}
}Works with: Cline (VS Code extension) Transport: stdio Profiles: core (9 tools), extended (11 tools) Model support: Any model supported by Cline