Claude Code
Integrate memories.sh with Claude Code.
Claude Code reads project instructions from CLAUDE.md in the project root and supports MCP servers via .mcp.json.
Quick Setup
The fastest way to set up memories.sh with Claude Code:
cd your-project
memories initThis automatically:
- Detects Claude Code (looks for
.claude/directory) - Configures MCP in
.mcp.json(project root) - Generates
CLAUDE.mdwith your existing memories
Manual Setup
Option 1: Generated File
memories generate claudeThis creates a CLAUDE.md file in your project root with all your rules, decisions, and facts. Claude Code reads this automatically.
The generated file includes:
- All your rules, decisions, and facts
- Instructions for Claude to save new memories via MCP
Option 2: MCP Server
Add memories.sh to your Claude Code MCP configuration.
Project-level (.mcp.json in project root):
{
"mcpServers": {
"memories": {
"command": "npx",
"args": ["-y", "@memories.sh/cli", "serve"]
}
}
}Global (~/.mcp.json):
{
"mcpServers": {
"memories": {
"command": "npx",
"args": ["-y", "@memories.sh/cli", "serve"]
}
}
}Recommended: Use Both
Using both methods together gives the best experience:
- Generated file — Provides a static baseline that's always available
- MCP server — Gives Claude live access to search and add memories
Migrating Existing Rules
If you have an existing CLAUDE.md, you can import it:
memories ingest claudeThis extracts individual rules from your existing file and stores them as memories.
Syncing Claude Code Config
To sync your Claude Code configuration across machines:
# On your main machine
memories files ingest
# On a new machine
memories files apply --global --forceThis syncs:
.claude/CLAUDE.md— Your global instructions.claude/commands/*.md— Custom slash commands.claude/rules/*.md— Rule files.claude/hooks/*— Session hooks.claude/tasks/*.md— Task definitions.claude/skills/**/*— Skills and their references
Claude Code-Specific Features
Slash Commands
If you've created custom slash commands in .claude/commands/, these are synced with memories files:
# Import your commands
memories files ingest
# On another machine
memories files apply --globalTasks
Project task files (.claude/tasks/*.md) are also synced:
# Import project tasks
memories files ingest --project
# Apply on another machine
cd your-project
memories files apply --projectHooks
Hook scripts (.claude/hooks/*.sh) for session management are synced too, so your custom automation follows you everywhere.