Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/veerps57/memento/agents-mdgit clone --depth 1 https://github.com/veerps57/mementoWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/veerps57/memento/agents-md)<a href="https://agentmods.dev/instructions/veerps57/memento/agents-md"><img src="https://agentmods.dev/badge/instructions/veerps57/memento/agents-md.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.03844 | $0.03844 |
| Opus 5 | $0.01922 | $0.01922 |
| Sonnet 5 | $0.00769 | $0.00769 |
| Haiku 4.5 | $0.00384 | $0.00384 |
Grade A, and why
memento AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 160 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AGENTS.md
Canonical instructions for AI agents working on the Memento codebase.
This file is read by tools that follow the agents.md convention — Cursor, Cline, Aider, Claude Code, OpenCode, and others. CLAUDE.md is a symlink to this file. .github/copilot-instructions.md points back here.
If you are an AI agent: read this entire file before making any change. If you are a human working with an AI agent, please ensure the agent has read this file.
What Memento is
Memento is a local-first, LLM-agnostic memory layer for AI assistants. It runs an MCP server over a local SQLite database. Any MCP-capable client — coding assistants, desktop chat clients, custom agents — can read and write durable, structured memory through it.
A full architectural walkthrough is in ARCHITECTURE.md. Decision history is in docs/adr/.
The four guiding principles
Every change must be justified against these. They are non-negotiable.
- First principles. Every construct exists because we proved we need it. Not "because that's how things are usually done."
- Modular. Any component must be replaceable without rewriting the rest.
- Extensible. New variants must not require breaking changes.
- Config-driven by the user. Behavior is shaped by configuration, not by code.
Architectural rules — non-negotiable
These are encoded as tests and CI gates where possible. Do not bypass them.
- Single command registry → MCP and CLI as adapters. Every command exists in the registry once and is projected to both surfaces by adapters. Parity is structural, not aspirational.
- No hardcoded behavioral constants. Anything that affects retrieval, decay, conflict detection, scrubbing, or storage behavior MUST be a
ConfigKey. Adding a constant in code is a code-review rejection. - Every state-changing operation writes an audit event (
MemoryEventfor memory changes,ConfigEventfor config changes). OwnerRefis always populated, even when it is always{ type: 'local', id: 'self' }. The model is multi-user-ready from day one.memento importenforces this rule by rewriting any non-local-selfOwnerRefin an imported artefact to the local owner — see ADR-0019.- Immutable fields stay immutable.
id,createdAt,schemaVersion, andscopeare never mutated after creation. To "move" a memory between scopes, supersede it with a new memory in the new scope. - Status transitions are explicit. A
forgottenmemory does not silently becomeactive. Every transition has its own command (forget,restore,archive,supersede). - Exhaustive switches on discriminated unions use the
assertNeverpattern. A structural test asserts that decay, retrieval, and conflict-detection rules exist for everyMemoryKind. - Conflict detection runs via a post-write hook, never inline. The write path does not block on conflict checks beyond a configured timeout.
- Decay is computed at query time, not stored. Effective confidence is
stored × decayFactor(now − lastConfirmedAt, halfLife). Thecompactjob materializes archives for memories that have decayed below threshold. ScopeResolveris composed of small, mockable resolvers (GitRemoteResolver,WorkspacePathResolver,SessionResolver). The composite is a thin policy layer.MemoryEventis the audit source of truth.lastConfirmedAtonMemoryis a denormalized cache, validated at write-time and bynpx @psraghuveer/memento doctor.memento importnever trusts caller-supplied audit claims: by default the source artefact's per-memory event chain is collapsed into one syntheticimportedevent whoseactorandatreflect the importer, not the source — see ADR-0019.- No configurable invariants. Integrity rules (immutability, status transitions, supersession atomicity) are hardcoded. Configurable invariants are no invariants.
memory.updateonly mutates non-content fields (tags, kind, pinned, sensitive). Content changes route throughsupersedeto preserve history. Same-type kind edits (e.g. updating a snippet'slanguagein place, updating a decision'srationale) are allowed; cross-type kind changes (snippet → fact, decision → preference, etc.) are rejected withINVALID_INPUTand route throughsupersedeso kind-specific metadata stays in the audit chain. The error message points the caller to the right command.- Embedding model migration is explicit.
memento embedding rebuildis the only way to re-embed memories. Never silent.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago First seen · 160 lines · 3,844 tokens per session scan A 3fe06548e7d7
memento AGENTS.md is an instructions file published in the GitHub repository veerps57/memento (22 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 3,844 tokens to every session, about $0.0192 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other instructions, from other repositories
gitlab-mcp-server context-engineering.instructions.md
Guidelines for structuring code and projects to maximize GitHub Copilot effectiveness through better context management.
brainvault CLAUDE.md
Instructions for SumithSB/brainvault, covering brainvault, key constraints, structure, install scope and running.
copilot-memory-store copilot-instructions.md
Instructions for timothywarner-org/copilot-memory-store, covering copilot memory store – ai agent instructions, core modules, memory file behavior, cli & mcp workflows and llm compression.
goai AGENTS.md
AGENTS.md instructions for zendev-sh/goai, covering agents.md - goai, commands, architecture, key rules and adding providers.
honcho CLAUDE.md
Claude Code instructions for plastic-labs/honcho, covering claude.md, honcho overview, what is honcho?, core concepts and peer paradigm.
amfs CLAUDE.md
Instructions for raia-live/amfs, covering amfs memory — agent instructions, available mcp tools, identity, brain tools (agent-scoped) and shared knowledge tools.