memento AGENTS.md

memento AGENTS.md is an instructions file for Codex, OpenCode from veerps57/memento. It costs 3,844 tokens per session, scanned A, original, Apache-2.0.

Repository instructions for AI agents working on Memento, a local memory service for AI assistants. It uses an MCP server and a local SQLite database so compatible clients can read and write lasting structured memory.

In plain words
What is it for?
Planning and implementing Memento changes while checking them against its first-principles, modularity, extensibility, and other architectural rules.
Why use it?
They help agents understand the product and follow its four required design principles before changing code.

Instructions file for CodexOpenCode

Install

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.

agentmods
npx agentmods add instructions/veerps57/memento/agents-md
Clone the repo
git clone --depth 1 https://github.com/veerps57/memento

Made for: Codex, OpenCode.

Wrote 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.

agentmods badge for memento AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/veerps57/memento/agents-md.svg)](https://agentmods.dev/instructions/veerps57/memento/agents-md)
Your own site
<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>
Per session 3,844 This file is loaded in full into every session.
When invoked 3,844 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce 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

Measured 4d ago against content hash 3fe06548e7d7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

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.

AGENTS.md · 160 lines

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.

  1. First principles. Every construct exists because we proved we need it. Not "because that's how things are usually done."
  2. Modular. Any component must be replaceable without rewriting the rest.
  3. Extensible. New variants must not require breaking changes.
  4. 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.

  1. 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.
  2. 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.
  3. Every state-changing operation writes an audit event (MemoryEvent for memory changes, ConfigEvent for config changes).
  4. OwnerRef is always populated, even when it is always { type: 'local', id: 'self' }. The model is multi-user-ready from day one. memento import enforces this rule by rewriting any non-local-self OwnerRef in an imported artefact to the local owner — see ADR-0019.
  5. Immutable fields stay immutable. id, createdAt, schemaVersion, and scope are never mutated after creation. To "move" a memory between scopes, supersede it with a new memory in the new scope.
  6. Status transitions are explicit. A forgotten memory does not silently become active. Every transition has its own command (forget, restore, archive, supersede).
  7. Exhaustive switches on discriminated unions use the assertNever pattern. A structural test asserts that decay, retrieval, and conflict-detection rules exist for every MemoryKind.
  8. Conflict detection runs via a post-write hook, never inline. The write path does not block on conflict checks beyond a configured timeout.
  9. Decay is computed at query time, not stored. Effective confidence is stored × decayFactor(now − lastConfirmedAt, halfLife). The compact job materializes archives for memories that have decayed below threshold.
  10. ScopeResolver is composed of small, mockable resolvers (GitRemoteResolver, WorkspacePathResolver, SessionResolver). The composite is a thin policy layer.
  11. MemoryEvent is the audit source of truth. lastConfirmedAt on Memory is a denormalized cache, validated at write-time and by npx @psraghuveer/memento doctor. memento import never trusts caller-supplied audit claims: by default the source artefact's per-memory event chain is collapsed into one synthetic imported event whose actor and at reflect the importer, not the source — see ADR-0019.
  12. No configurable invariants. Integrity rules (immutability, status transitions, supersession atomicity) are hardcoded. Configurable invariants are no invariants.
  13. memory.update only mutates non-content fields (tags, kind, pinned, sensitive). Content changes route through supersede to preserve history. Same-type kind edits (e.g. updating a snippet's language in place, updating a decision's rationale) are allowed; cross-type kind changes (snippet → fact, decision → preference, etc.) are rejected with INVALID_INPUT and route through supersede so kind-specific metadata stays in the audit chain. The error message points the caller to the right command.
  14. Embedding model migration is explicit. memento embedding rebuild is the only way to re-embed memories. Never silent.

Read the full file on GitHub · 160 lines

Changes

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.

  1. 4d ago First seen · 160 lines · 3,844 tokens per session scan A 3fe06548e7d7

Subscribe to this mod's changes

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.