Skill de memoria de Claude: guarda decisiones con sus motivos y recupéralas antes de decidir

Dmitriy Solodukha, desarrollador de Caprock · Publicado el

Probado el en Claude Code y Codex

Skill de memoria de Claude para todo agente: una decisión fechada y su motivo por entrada, guardada en el repositorio y buscada antes de decidir de nuevo.

La skill memory es una skill de memoria de Claude que funciona igual en Claude Code, Codex, OpenCode y Cursor: guarda una decisión, un hallazgo poco evidente o una preferencia como una entrada con fecha y su motivo, en docs/memory/ o en un MEMORY.md del repositorio, y busca en esas entradas antes de decidir algo que quizá ya hayas decidido. Un recuerdo es una afirmación sobre el pasado, así que comprueba cada uno con el código antes de seguirlo.

Instala la skill memory

Un comando por agente. La skill es un único SKILL.md; no se ejecuta nada al instalarla.

Las nueve skills como plugin. Escribe esto dentro de Claude Code:

O solo esta skill, desde la carpeta de tu proyecto en una terminal:

Añade -g para instalarla en todos los proyectos.

Prompts que usan la skill memory

El agente elige la skill cuando tus palabras coinciden con su descripción; nombrarla lo asegura. Haz clic en un prompt para copiarlo.

Cómo guarda y recupera información la skill de memoria de Claude

  • Un dato por entrada: un título con una fecha absoluta, seguido de Decision, Finding o Preference, el porqué (y quién lo dijo), dónde se aplica y qué sustituye. Las entradas antiguas se marcan como sustituidas; nunca se eliminan.
  • Dónde: el lugar que ya usa el repositorio (docs/memory/, MEMORY.md, docs/adr/); si no hay ninguno, docs/memory/YYYY-MM-DD-short-title.md, un archivo por entrada. Una regla que todas las sesiones deban seguir también recibe una línea en CLAUDE.md o AGENTS.md.
  • Recuperar antes de decidir: busca (con Caprock, current_decisions y search_memories; sin él, los archivos de memoria y git log --grep), lee la coincidencia completa, compruébala con el código y luego síguela, señala una contradicción o sustitúyela cuando cambies de opinión.

Los archivos de memoria forman parte del repositorio: se incluyen en commits, se revisan y son visibles para cualquiera que pueda leerlo.

Qué ejecutamos y qué hicieron los agentes

Cada skill se ejecutó el 29 de noviembre de 2026 en un repositorio desechable creado para ella, con la skill instalada como skill de proyecto. Un repositorio pequeño cuyo store/db.py usa sqlite3.

Claude Code (claude -p --model sonnet)

Remember this decision: the store stays on SQLite, not Postgres, because it's a single-user local app with no server. Save it so the next session knows.

Invocó memory, creó docs/memory/2026-11-29-sqlite-store.md en el formato de la skill, lo contrastó con store/db.py e indicó que 2nd Brain de Caprock es de solo lectura a través de MCP y cómo importar allí la carpeta. También escribió en la memoria automática del propio Claude Code, fuera del repositorio.

Codex (0.163.0, codex exec)

The same prompt, plus: "what did we already decide about the database?"

Leyó la skill, llamó a current_decisions y search_memories de Caprock, buscó en los archivos, encontró la entrada, la contrastó con el código y no escribió un duplicado.

Agentes en los que se probó

  • Claude Code: probado el 29 de noviembre de 2026 con claude -p --model sonnet, con la skill instalada como skill de proyecto en .claude/skills/.
  • Codex: probado el 29 de noviembre de 2026 con Codex 0.163.0 (codex exec), con la skill en .agents/skills/.
  • OpenCode y Cursor: sin probar. La skill consiste en instrucciones en el formato abierto Agent Skills, pero ninguna ejecución en ninguno de los dos la ha verificado.

Límites

  • No puede guardar en 2nd Brain de Caprock: las herramientas MCP de Caprock son de solo lectura. Los archivos que importas allí solo llegan a los agentes después de que actives esa opción.
  • Una carpeta de memoria solo se lee cuando un agente la consulta; las reglas para cada sesión deben estar en CLAUDE.md o AGENTS.md.
  • En un repositorio público, las entradas son públicas; la skill omite los detalles privados y lo indica.

Con Caprock y sin él

Cuando el servidor MCP de Caprock está conectado, la skill recupera información mediante current_decisions, search_memories, get_memory y next_session_handoff, que leen las decisiones y los hallazgos de 2nd Brain de Caprock. Guarda en archivos en cualquier caso. Caprock es la app gratis y de código abierto que registra todas las sesiones de agentes de programación en tu computadora.

Obtener Caprock →

El SKILL.md completo

El archivo tal como está en dspv/skills en la revisión dfce799. Para instalarlo manualmente, guárdalo como .claude/skills/memory/SKILL.md para Claude Code o .agents/skills/memory/SKILL.md para Codex en tu proyecto.

skills/memory/SKILL.md
---
name: memory
description: >-
  Keep decisions and findings across coding-agent sessions, and recall them before deciding again.
  Use when the user says "remember this", "save this decision", "note that", "what did we decide
  about X", "did we already try this", "why did we do it this way", or when a session settles a
  decision, finds a non-obvious fact or hears a preference worth keeping. A claude memory skill
  that works the same in Claude Code, Codex, OpenCode and Cursor: one dated fact per entry with
  its why, stored in a docs/memory/ folder or a MEMORY.md in the repository, and read through
  Caprock 2nd Brain's MCP tools (search_memories, get_memory, current_decisions) when present.
license: Apache-2.0
---

# Memory

Keep what a later session would otherwise have to rediscover or ask again, and look it up before
deciding anything the user may already have decided. A memory is a claim about the past: check it
against the code before relying on it.

## When to save

Save one entry when any of these happens:

- **A decision and its why.** "Use SQLite, not Postgres: one user, no server." The why is the part
  that stops a later session from reopening it.
- **A non-obvious fact.** Something that cost time to learn and is not visible in the code: a
  flaky test and its cause, an API quirk, a command that must run first, a dead end already tried.
- **A user preference.** How they want work done: "never commit to master", "short replies",
  "ask before adding a dependency".
- **The user asks**: "remember", "save", "note that", "keep in mind".

Do not save:

- What the code, `git log` or the docs already say. Point to them instead.
- Secrets, tokens, passwords, personal data of other people. Never, even when asked; say why.
- Guesses, plans that were not agreed, or the step-by-step of the current task.
- Anything that holds only for this session.

## How to write an entry

One fact per entry, so it can be found, read and replaced on its own:

```markdown
## 2026-11-29: Use SQLite for the local store

- Decision: the local store is SQLite in `data/app.db`, not Postgres.
- Why: one user per install, no server to run; the user said so on 2026-11-29.
- Scope: `store/`. Revisit if the app gets a hosted multi-user mode.
- Supersedes: none.
```

Rules for every entry:

- **Absolute date** (`2026-11-29`), never "today" or "last week".
- **Kind** in the first word of the body: Decision, Finding or Preference.
- **Why**, and who said it when it came from the user.
- **Where it applies**: files, module or command, so a reader can check it.
- **Supersedes** when it replaces an older entry. Mark the old one
  `Superseded by 2026-11-29: <title>`; do not delete it, the history is the why.
- Short: a title and two to five lines. A long story goes in the repository's docs, and the entry
  links to it.

## Where to save

Pick the first that applies, and say which one you used:

1. **The place the repository already uses.** Look for `docs/memory/`, `MEMORY.md`,
   `docs/decisions/`, `docs/adr/` or a decisions section in `CLAUDE.md` or `AGENTS.md`. Follow its
   format, even when it differs from the one above.
2. **Nothing yet**: create `docs/memory/` with one file per entry, named
   `YYYY-MM-DD-short-title.md` (for example `docs/memory/2026-11-29-sqlite-store.md`). One file per
   entry keeps merges clean and lets each entry be replaced alone.
3. **A small repository, or the user prefers one file**: a `MEMORY.md` at the root, newest entry
   first.

A rule that every session must follow (a preference like "never push to master") also gets one line
in the agent instruction file the repository uses (`CLAUDE.md`, `AGENTS.md`), because that file is
loaded into every session and a memory folder is read only when someone looks.

Memory files are part of the repository: they are committed, reviewed and visible to everyone who
can read it. Before writing to a public repository, leave out anything private and say so.

## Caprock 2nd Brain

When the Caprock MCP tools are available (a server named `caprock`), use them to recall. Caprock
(<https://caprock.dev>, free, open source, runs locally) records the agent sessions on the computer
and keeps a 2nd Brain of their decisions and findings.

Its MCP tools are read-only: an agent cannot save into 2nd Brain through them. Save to files as
above. 2nd Brain gets memories in its own ways: it builds them from finished sessions when the user
has switched that on, from lines the user drops in by hand, and from a Markdown folder imported on
its 2nd Brain screen (Import from Obsidian, which also takes a plain folder such as `docs/memory/`).
An imported folder reaches agents only after the user turns on "Let agents use these notes" for it.
Do not tell the user a file you wrote is in 2nd Brain unless one of those is true.

Tools to use, with their arguments:

- `current_decisions(project?, limit?)`: the decisions in force for a project, newest first, with
  superseded ones left out. `project` is the repository folder's name; omitted, the repository the
  server was started in.
- `search_memories(query, project?, limit?)`: ranked candidates with kind, date, project and a
  summary. Titles may be in the user's language; keywords are English. Judge by meaning; if nothing
  fits, retry with other words, fewer words or the component's name.
- `get_memory(id)`: one memory in full, with its links. A memory with `superseded_by` is no longer
  current: read the one it names.
- `next_session_handoff(repo?)`: what Caprock hands a new session in this repository.

## Recall before deciding

Before choosing a library, changing an approach, reverting something or asking the user a question
they may have answered:

1. **Search.** With Caprock: `current_decisions` for the project, then `search_memories` with the
   subject's words. Without it: search the memory files (`docs/memory/`, `MEMORY.md`, decision
   records, `CLAUDE.md`, `AGENTS.md`) for the subject's words, and `git log --grep=<word>` for the
   commit that made the change.
2. **Read the match in full** (`get_memory`, or open the file). Follow any supersedes link to the
   newest entry.
3. **Check it against the code.** Memories go stale: the file moved, the dependency was swapped,
   the flag was removed. Open the files the entry names and confirm it still holds.
4. **Act on what you found**:
   - It holds: follow it, and say "Following the decision of 2026-11-29: ...".
   - The code contradicts it: say so, follow the code for now, and ask whether to update the
     memory. When the user agrees, write a new entry that supersedes the old one.
   - The user wants to change it: do what they say, then write the new decision with
     `Supersedes:` pointing at the old one.
   - Nothing found: decide as usual. If it is worth keeping, save it.

Stop searching after two or three phrasings with no fitting result; say nothing was found rather
than stretching a weak match.

## Output

After saving, one or two lines:

```text
Saved to docs/memory/2026-11-29-sqlite-store.md: Decision, use SQLite for the local store
(why: one user, no server). Supersedes nothing.
```

After recalling, cite the source and its date, and whether it was checked:

```text
Found: Decision 2026-11-29, "Use SQLite for the local store" (docs/memory/2026-11-29-sqlite-store.md).
Checked: store/db.go still opens data/app.db. Following it.
```

Preguntas sobre la skill memory

¿Qué es una skill de memoria de Claude?
Una skill que le dice a Claude Code qué conservar entre sesiones y cómo: una decisión o un hallazgo fechados por entrada, con su motivo, guardados donde los buscará la siguiente sesión y consultados antes de volver a decidir.
¿En qué se diferencia esta skill de memoria de CLAUDE.md?
`CLAUDE.md` se carga en cada sesión, así que contiene reglas. La skill memory guarda decisiones y hallazgos como entradas independientes que se buscan cuando son relevantes, y añade una línea a `CLAUDE.md` solo si se trata de una regla que debe seguirse en todas las sesiones.
¿Funciona en Codex la skill memory?
Sí. Codex 0.163.0 recuperó una decisión guardada mediante esta skill en la prueba del 29 de noviembre de 2026 y no escribió un duplicado.
¿Guardará los secretos que pegue?
No. Nunca se guardan tokens, contraseñas ni datos personales de otras personas, aunque lo pidas; la skill explica por qué.

Fuentes

La app en sí está en inglés.