Skip to content

CLAUDE.md Integration

The CLAUDE.md file tells Claude Code how to behave in your project. Adding Engram instructions ensures your AI uses memory effectively — remembering proactively, recalling context, and building knowledge graphs.

Add this to your global ~/.claude/CLAUDE.md or project-specific CLAUDE.md:

# Memory
Use the memory MCP server as your primary memory system.
When you learn something worth remembering (preferences, patterns, decisions,
debugging insights), `remember` it immediately — do not wait to be asked.
Use project scoping: project-specific knowledge gets the project name,
cross-project preferences get "global".
After remembering, `recall` related memories and `connect` them with edges
(`relates_to`, `part_of`, `supersedes`, `contradicts`, `derived_from`)
to build a knowledge graph.
Keep memories atomic — one concept per memory. For complex topics, create a
brief hub memory first, then store details as children using `parent_id`.
To keep memories clean:
- `recall` before `remember` to check for duplicates
- `update` (by id) to refine existing memories
- `merge` when multiple memories cover the same topic
- `forget` to remove wrong or outdated memories
- Set `expires_in_days` for temporary context

For automatic context injection, configure Claude Code’s advise hook to recall relevant memories before each message. Add to your Claude Code settings:

{
"hooks": {
"UserPromptSubmit": [
{
"command": "engram recall --query \"$PROMPT\" --project \"$PROJECT\" --limit 5 --format context"
}
]
}
}

This injects relevant memories into the conversation context before Claude processes each message.

For team setups, add instructions about team memory behavior:

For focused work sessions (debugging, feature implementation), use
`begin_episode` with a descriptive title. Use `end_episode` with a
summary when done.
When you discover knowledge that would benefit the team, remember it
without `is_private` so it flows to the team graph.
  • Put Engram instructions in global CLAUDE.md so they apply everywhere
  • Use project-specific CLAUDE.md for project-scoped conventions
  • The advise hook ensures context is always fresh without manual recall
  • Review and update instructions as your workflow evolves