# agent-memory-mcp [Health: Active]

**Category:** 🧠 Knowledge & Memory  
**Repository:** https://github.com/xultrax-web/agent-memory-mcp  
**GitHub Stars:** 1  
**npm Downloads (last month):** 773  
**Views:** 10  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/agent-memory-mcp-3

## Description
Markdown memory for AI agents. Files you can read, edit, grep, and commit. Not a database.

## Tools
Capabilities this server exposes over MCP:

- **save_memory** — Save (or update) a memory. Memories are markdown files with YAML frontmatter, stored at the resolved memory dir. Use a short kebab-case name; the description is what's shown in the index and used for search ranking.
- **search_memories** — Fuzzy search across name, description, and body. Tolerates typos, word-order shifts, and partial matches. Returns top matches with relevance scores (0-100) and body-context snippets. Use this for human-readable browsing.
- **relevant_memories** — Find memories relevant to a query and return their FULL content (not summaries). Designed for LLM ingestion — call this when the assistant needs context on a topic and the memory index alone isn't specific enough. Returns up to `max` memories as a markdown document.
- **get_memory** — Fetch a single memory by name.
- **list_memories** — List stored memories, optionally filtered by type and/or tags. Paginated.
- **delete_memory** — Move a memory to .trash/ (soft delete). The file is removed from the index but recoverable via restore_memory until you manually empty .trash/. Receipt REQUIRED and bound to THIS memory: first call check_action({action: 'delete memory <name>', action_type: 'deletions'}) — using that EXACT action string — to obtain a fresh Compliance Receipt, then pass it as `receipt`. The receipt must carry {action_type: 'deletions'} AND the matching action_hash for 'delete memory <name>', and is single-use — it cannot be replayed to delete a different memory or the same one twice.
- **restore_memory** — Restore a memory from .trash/ back into the active store. Picks the most recent trash entry for the name.
- **doctor** — Check storage integrity. Reports orphan files (on disk but not indexed), dangling index entries (no file), unreadable files, and invalid types. Pass rebuild-index=true to reconstruct MEMORY.md from disk.
- **stats** — Dashboard of memory-store state: counts per type, total size, largest memory, audit-log size, trash count.
- **rotate_key** — Rotate the receipt-signing key material (HMAC and/or Ed25519). Generates fresh keys and INVALIDATES every outstanding Compliance Receipt. Use after a suspected key leak — e.g. the .keyring was ever committed or synced. Optional `mode`: 'hmac' | 'ed25519' | 'both' (default 'both').
- **init** — Install a starter guardrail pack — sensible hard/soft rules (protect main, block rm -rf, no prod data destruction, no curl|sh, flag secrets) — and emit them to every tool's companion files. Zero-config protection on day one. Pass force=true to overwrite same-named rules. Pair with `agent-memory install-hooks` so hard rules actually block tool calls.
- **validate_receipt** — Validate a CRP 1.1 (Ed25519) Compliance Receipt issued by ANOTHER agent-memory server using that server's published public key — no shared secret (the federation primitive). Checks signature, expiry, and required caveats. Pass `receipt` (object or JSON string) and `public_key` (inline PEM or a file path; the issuer gets theirs via `agent-memory export-pubkey`).
- **log_events** — Read recent entries from the audit event log (.events.jsonl). Returns the last N events, optionally filtered by action.
- **verify_memory** — Re-evaluate a memory's claims against signals in its content. Extracts URLs, dates, and file paths from the body; flags stale-date signals on project-type memories; returns type-specific verification heuristics for the LLM or operator to act on. Pairs with the audit_stale prompt.
- **find_backlinks** — List memories that link to the given memory via [[wiki-link]] syntax in their bodies. Useful for building a 'what references this' view.
- **find_related** — Surface memories related to a given one. Ranks by combining: outbound [[wiki-links]], inbound backlinks, shared tags, same type, and content similarity (name + description). Use this to navigate the memory graph by association rather than by exact lookup.
- **sync_status** — Report the git-sync state of the memory store: remote URL, branch, local uncommitted files, commits ahead/behind origin. Use this before opening a new session to know if you have stale memories from another machine.
- **sync_push** — Commit any local memory changes and push to the configured git remote. Auto-generates a timestamped commit message if none provided. Use at the end of a session to make memories available on your other machines.
- **sync_pull** — Pull memory updates from the configured git remote (fast-forward only). Run at the start of a session to get memories saved on other machines. Refuses to pull if there are uncommitted local changes.
- **save_rule** — Save (or update) a rule memory · the 'memory as constraint' wedge. Rules constrain agent behavior, not just store facts. Severity 'hard' = must obey; 'soft' = prefer to obey. Rules auto-project out to AGENTS.md (read by Claude Code, Codex CLI, Cursor, Aider, Devin, Copilot, Gemini CLI, Windsurf, and Amazon Q natively) when AGENT_MEMORY_AUTO_EMIT_DIR is set, or via the emit_companions tool on demand.
- **list_rules** — List every active rule memory with severity, scope, and staleness markers (>90 days since last_verified). Use this to audit which rules are currently constraining the agent.
- **audit** — v0.11.4 · operational health report for the rule store. Surfaces: rule count by severity, stale rules (last_verified > 90 days or null), pattern conflicts (two rules sharing an enforce_on category AND an identical regex pattern), recent check_action denials, and recent unreceipted destructive ops. Default returns pretty-printed text; pass {format: 'json'} for structured output. Run daily-ish · the report is fast and gives the operator a single view of what's drifting.
- **check_action** — v0.11.3 · the protocol enforcement point. Pass a proposed action description + its category; the server matches against rule memories (type=rule) and either:
  - APPROVES: returns a short-lived Compliance Receipt (HMAC-signed, 60s default) the agent can pass to destructive tools (e.g. delete_memory) as proof of compliance.
  - DENIES: returns structured hard_violations (severity:hard rules that block) and/or soft_warnings (severity:soft rules that warn but allow).

Tier 1 (deterministic) matches the action against rule.matches regexes + rule.enforce_on category filter. Works on every MCP client.
Tier 2 (v0.11.7+) calls back to the client via MCP sampling/createMessage to judge rule.applies_when natural-language conditions. Auto-enabled on clients that declared the sampling capability; silently skipped on clients that didn't.
- **emit_companions** — Regenerate companion rule files from the current rule memories. Writes one or more of: AGENTS.md (universal cross-tool standard, Linux Foundation), CLAUDE.md (Claude Code's 5-level hierarchy), .cursor/rules/*.mdc (Cursor's MDC format · hard rules get alwaysApply:true, soft rules become description-driven), .gemini/instructions.md (Gemini CLI). Default writes ALL four targets. Use `targets` to filter. Output dir resolves from `out_dir`, then AGENT_MEMORY_COMPANION_DIR env, then process.cwd().

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "agent-memory-mcp": {
    "command": "npx",
    "args": ["-y","@xultrax-web/agent-memory-mcp"]
  }
}
```

## Documentation

## What agent-memory-mcp does

agent-memory-mcp provides a file-based memory store for AI coding agents. Each memory is a Markdown file with YAML frontmatter, stored in a resolved memory directory and represented in an index. The files remain directly accessible for reading, editing, searching, and committing with normal developer tools. The project uses Git rather than a database, daemon, or hosted service to preserve and synchronize memory.

The store can hold general context such as decisions, recipes, and project notes, as well as rule memories. Rules describe constraints with fields such as severity, scope, natural-language conditions, matching patterns, enforcement categories, and verification dates. Hard rules are intended to block matching operations; soft rules produce warnings.

## How it works

Use `save_memory` to create or update a Markdown memory, then browse it with `search_memories`, `list_memories`, or `get_memory`. Fuzzy search considers the memory name, description, and body, while `relevant_memories` returns complete matching documents for model context. `find_backlinks` and `find_related` support navigation through `[[wiki-link]]` references, shared tags, memory types, and content similarity.

Rule enforcement centers on `check_action`. The server compares a proposed action with rule patterns and enforcement categories. Approved actions receive a short-lived Compliance Receipt; denied actions return hard violations and soft warnings. Destructive deletion of a memory requires a fresh receipt bound to that specific memory and action, and the receipt can only be used once. `validate_receipt` lets another agent-memory server verify Ed25519 receipts using the issuing server's public key.

The server also includes an optional sampling-based second tier for rules containing natural-language `applies_when` conditions. Clients that advertise MCP sampling can use that tier; deterministic pattern matching remains available for clients without it.

## Setup and configuration

Install the package globally with `npm i -g @xultrax-web/agent-memory-mcp`, or invoke it through `npx -y`. Add the server to an MCP client, then run `init` to install starter guardrails covering examples such as protecting the main branch, avoiding recursive deletion, and flagging secrets. `install-hooks` connects hard and soft rules to Claude Code's `PreToolUse` hook so rules can affect the agent's shell and file operations, not only this server's tools.

Set `AGENT_MEMORY_AUTO_EMIT_DIR` to have rule saves regenerate companion files automatically. `AGENT_MEMORY_COMPANION_DIR` selects the default output directory for `emit_companions`; an explicit `out_dir` takes precedence. The companion targets are `AGENTS.md`, `CLAUDE.md`, `.cursor/rules/*.mdc`, and `.gemini/instructions.md`. Set `CRP_SIGNING_MODE=ed25519` to use Ed25519 signing and publish a public key for cross-server receipt validation.

## Tools and capabilities

- Save, update, retrieve, list, fuzzy-search, and delete memories.
- Restore soft-deleted files from `.trash/` and inspect storage integrity with `doctor`.
- Review counts, sizes, audit-log data, and trash contents with `stats`.
- Inspect audit events, verify memory signals, and identify stale or questionable content.
- Save rules, list active rules, audit rule health, and regenerate agent-specific companion files.
- Check proposed actions and validate receipts from another server.
- Inspect Git sync state, pull fast-forward updates, and commit and push memory changes.
- Rotate HMAC or Ed25519 signing keys, invalidating outstanding receipts.

## Limitations and notes

Memory deletion is intentionally a two-step operation: call `check_action` with the exact deletion action, then pass the resulting receipt to `delete_memory`. Deleted files move to `.trash/` and remain recoverable until that directory is emptied.

`check_action` gates tools exposed by agent-memory-mcp. Enforcing rules on an agent's real shell commands or file writes requires the Claude Code hook installed through `install-hooks`. The server's keyring is kept under the memory directory and should not be committed or synchronized.

Git synchronization is fast-forward only for pulls, and `sync_pull` refuses to run when local memory changes are uncommitted. Companion-file generation supports four target formats, with output selection controlled by `emit_companions`.

_Full upstream README: https://allmcps.com/mcp/agent-memory-mcp-3/readme_

