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.
Recommended CLAUDE.md Section
Section titled “Recommended CLAUDE.md Section”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 abrief 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 contextAdvise Hook
Section titled “Advise Hook”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.
Team-Specific Instructions
Section titled “Team-Specific Instructions”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 asummary when done.
When you discover knowledge that would benefit the team, remember itwithout `is_private` so it flows to the team graph.Best Practices
Section titled “Best Practices”- Put Engram instructions in global
CLAUDE.mdso they apply everywhere - Use project-specific
CLAUDE.mdfor project-scoped conventions - The advise hook ensures context is always fresh without manual recall
- Review and update instructions as your workflow evolves