MemoryLayer
  • How it works
  • Arena
  • Benchmarks
  • Registry
  • Pricing
  • Docs
Log inGet started free
  • 01Arena
  • 02Benchmarks
  • 03Registry
  • 04Pricing
  • 05Docs
Log inGet started free

Docs

Docs home

Getting started

  • Quickstart
  • Claude Code
  • Cursor

Learn

  • How memory works
  • Search & recall
  • Shared across agents
  • Grounded facts

Reference

  • MCP tools
  • Agent rules
    1. The rules
    2. Which tool, when
  • Bookmarks
  • Registry & CLI

Help

  • FAQ
← MCP toolsBookmarks →
Docs home

Getting started

  • Quickstart
  • Claude Code
  • Cursor

Learn

  • How memory works
  • Search & recall
  • Shared across agents
  • Grounded facts

Reference

  • MCP tools
  • Agent rules
    1. The rules
    2. Which tool, when
  • Bookmarks
  • Registry & CLI

Help

  • FAQ

Docs/Reference

Reference

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 sections

You 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

  • 1.Load schemas with ToolSearch (first turn only — deferred tools need this).
  • 2.Run both recall calls in parallel (user + project namespace).
  • 3.code(ingest) runs automatically on the first turn of each session only.
  • 4.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".
  • 5.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

  1. WhenExact skill or symbol name known

    recall({ item_type: 'skill' })O(1) deterministic — fastest path

  2. WhenCode question about an indexed project

    recall(answer)Primary entry — always first for code Qs

  3. WhenSession just started

    recall({ preview: true })Mandatory before first response

  4. WhenBrief message / need recent context

    recall(list)Recency-sorted, no search needed

  5. WhenNew project mentioned

    code(ingest)Mandatory, run once

  6. WhenUser shares preference / decision / correction

    rememberDedupes automatically

  7. WhenBroad “how does X relate to Y” (Pro+)

    recall({ explore: true })Linked memories, derived facts, open loops

  8. WhenCode answer was empty — need raw hits

    code(locate)Intent-based fallback

  9. WhenNeed specific literal in code

    code(grep)Fallback for literal verification

  10. WhenLong document to store (Pro+)

    remember(chunk)Splits into searchable chunks

  11. WhenMultiple facts at once (Pro+)

    remember(batch)Up to 100 items per call

  12. WhenEnd of session — derive + prune

    consolidate(ripple)Replays recent memories to derive transitive facts + surface contradictions

← PreviousMCP toolsNext →Bookmarks

Something missing or wrong? Email support@memorylayer.in or open an issue.