DocsReference
Agent rules
The always-on instructions that make an agent check memory first. memorylayer setup writes them for you; copy them here for any other agent.
The rules, per agent
~/.claude/CLAUDE.md266 lines · 14 sectionsYou have persistent memory + code intelligence via MemoryLayer (MCP). The UserPromptSubmit hook injects instructions each turn — follow them. Skipping them means answering without project history, prior decisions, or code knowledge already stored. Use memory tools before reading files.
Every turn
- Load schemas with ToolSearch (first turn only — deferred tools need this).
- Run both recall calls in parallel (user + project namespace).
code(ingest)runs automatically on the first turn of each session only.- Before reading files, answer from memory — pick the right tool:
- Specific lookup (symbol/function/fact):
recall({ query, namespace, intent: "find_symbol" }) - Broad/exploratory question:
recall({ query, namespace, explore: true })explore=true returns primary results PLUS related memories via tag, temporal, and semantic edges — use it when you want surrounding context. - Only fall back to Read/Bash if the above returns answer_kind="empty".
- After significant work, save what you learned with remember.
Tool selection quick reference
- recall
- read anything: search · answer · weave · list · load (intent-routed)
- remember
- write anything: upsert · update · delete · chunk · batch (param-routed)
- code
- all code intelligence: ingest · locate · impact · grep (action-routed)
- consolidate
- maintenance + ACT-R compile: TTL prune · replay-and-derive (ripple) · compose chunk
- verify
- hallucination gate: split text into claims, check each vs stored knowledge
- prove
- formal proof for a single claim (proven > retrieved confidence)
- domain
- formal domain management: load · export · status · set_mode
- audit
- batch Z3 invariant checker — CI-ready
Which tool, when
WhenExact skill or symbol name known
recall({ item_type: 'skill' })O(1) deterministic — fastest pathWhenCode question about an indexed project
recall(answer)Primary entry — always first for code QsWhenSession just started
recall({ preview: true })Mandatory before first responseWhenBrief message / need recent context
recall(list)Recency-sorted, no search neededWhenNew project mentioned
code(ingest)Mandatory, run onceWhenUser shares preference / decision / correction
rememberDedupes automaticallyWhenBroad “how does X relate to Y” (Pro+)
recall({ explore: true })Linked memories, derived facts, open loopsWhenCode answer was empty — need raw hits
code(locate)Intent-based fallbackWhenNeed specific literal in code
code(grep)Fallback for literal verificationWhenLong document to store (Pro+)
remember(chunk)Splits into searchable chunksWhenMultiple facts at once (Pro+)
remember(batch)Up to 100 items per callWhenEnd of session — derive + prune
consolidate(ripple)Replays recent memories to derive transitive facts + surface contradictions
Something missing or wrong? Email support@memorylayer.in or open an issue.