Claude 메모리 스킬: 결정과 이유를 저장하고 다시 결정하기 전에 불러오기
Dmitriy Solodukha, Caprock 개발자 · 게시일
Claude Code와 Codex에서 테스트
어떤 에이전트에서든 작동하는 Claude 메모리 스킬입니다. 항목마다 날짜와 이유를 담은 결정 하나를 저장소에 저장하고, 다시 결정하기 전에 검색합니다.
memory 스킬은 Claude Code, Codex, OpenCode, Cursor에서 동일하게 작동하는 Claude 메모리 스킬입니다. 결정, 쉽게 알기 어려운 발견, 선호 사항을 이유와 날짜가 포함된 항목 하나로 저장소의 docs/memory/ 또는 MEMORY.md에 저장합니다. 이미 내려진 결정일 수 있는 사안을 결정하기 전에 이 항목들을 검색합니다. 메모리는 과거에 대한 주장이므로, 각 항목을 따르기 전에 코드와 대조해 확인합니다.
memory 스킬 설치
에이전트마다 명령어 하나로 설치합니다. 스킬은 SKILL.md 파일 하나이며, 설치 시 실행되는 것은 없습니다.
스킬 아홉 가지 전체를 플러그인으로 설치합니다. Claude Code 안에서 다음을 입력합니다:
이 스킬만 설치하려면 터미널에서 프로젝트 폴더로 이동한 뒤 다음을 실행합니다:
추가 옵션: -g 모든 프로젝트에 설치하려면 앞의 옵션을 추가합니다.
터미널에서 프로젝트 폴더로 이동한 뒤 다음을 실행합니다:
추가 옵션: -g 모든 프로젝트에 설치하려면 앞의 옵션을 추가합니다.
터미널에서 프로젝트 폴더로 이동한 뒤 다음을 실행합니다:
추가 옵션: -g 모든 프로젝트에 설치하려면 앞의 옵션을 추가합니다. 아직 OpenCode에서 테스트하지 않았습니다. 이 스킬은 개방형 형식의 일반 지침이지만, OpenCode에서 실행해 검증한 적은 없습니다.
터미널에서 프로젝트 폴더로 이동한 뒤 다음을 실행합니다:
추가 옵션: -g 모든 프로젝트에 설치하려면 앞의 옵션을 추가합니다. 아직 Cursor에서 테스트하지 않았습니다. 이 스킬은 개방형 형식의 일반 지침이지만, Cursor에서 실행해 검증한 적은 없습니다.
memory 스킬을 사용하는 프롬프트
요청이 스킬 설명과 일치하면 에이전트가 해당 스킬을 선택합니다. 이름을 명시하면 확실하게 선택할 수 있습니다. 프롬프트를 클릭하면 복사됩니다.
Claude 메모리 스킬의 저장 및 불러오기 방식
- 항목당 하나의 사실: 절대 날짜가 포함된 제목, Decision, Finding 또는 Preference, 이유와 발언자, 적용 범위, 대체하는 항목 순서입니다. 기존 항목은 대체됨으로 표시하며, 절대 삭제하지 않습니다.
- 위치: 저장소에서 이미 사용하는 위치(
docs/memory/,MEMORY.md,docs/adr/)에 항목당 파일 하나로 저장합니다. 기존 위치가 없다면docs/memory/YYYY-MM-DD-short-title.md에 저장합니다. 모든 세션이 따라야 하는 규칙은CLAUDE.md또는AGENTS.md에도 한 줄로 기록합니다. - 결정 전 기억 확인: 검색하고(Caprock이 있으면
current_decisions와search_memories, 없으면 메모리 파일과git log --grep사용), 일치하는 항목을 끝까지 읽고, 코드와 대조합니다. 그런 다음 해당 내용을 따르거나, 모순을 표시하거나, 생각이 바뀌면 새 항목으로 대체합니다.
메모리 파일은 저장소의 일부입니다. 커밋과 리뷰 대상이며, 저장소를 읽을 수 있는 모든 사람이 볼 수 있습니다.
실행한 내용과 에이전트의 수행 결과
각 스킬은 2026년 11월 29일에 해당 스킬용으로 만든 임시 저장소에서 프로젝트 스킬로 설치해 실행했습니다. store/db.py에서 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.
memory를 호출하고 스킬 형식에 맞춰 docs/memory/2026-11-29-sqlite-store.md를 생성한 뒤 store/db.py와 대조해 확인했습니다. Caprock의 2nd Brain은 MCP를 통해 읽기 전용으로 접근할 수 있다고 설명하고, 해당 폴더를 가져오는 방법도 안내했습니다. 저장소 밖에 있는 Claude Code 자체 자동 메모리에도 기록했습니다.
Codex (0.163.0, codex exec)
The same prompt, plus: "what did we already decide about the database?"
스킬을 읽고, Caprock의 current_decisions와 search_memories를 호출하고, 파일을 검색해 항목을 찾은 뒤 코드와 대조했으며, 중복으로 작성하지 않았습니다.
테스트한 에이전트
- Claude Code:
.claude/skills/에 프로젝트 스킬로 설치한 상태에서 2026년 11월 29일에claude -p --model sonnet으로 테스트했습니다. - Codex: 2026년 11월 29일에 Codex 0.163.0(
codex exec)로 테스트했으며, 스킬은.agents/skills/에 설치했습니다. - OpenCode와 Cursor: 테스트하지 않았습니다. 스킬은 공개 Agent Skills 형식의 일반 지침이지만, 어느 쪽에서도 실행하여 확인하지 않았습니다.
한도
- Caprock의 MCP 도구는 읽기 전용이므로 2nd Brain에 저장할 수 없습니다. 그곳에 가져온 파일은 에이전트 접근을 켠 후에만 에이전트에 전달됩니다.
- 메모리 폴더는 에이전트가 찾아볼 때만 읽습니다. 모든 세션에 적용할 규칙은
CLAUDE.md또는AGENTS.md에 둡니다. - 공개 저장소에서는 기록 항목도 공개됩니다. 스킬은 비공개 세부 정보를 제외하고 그 사실을 알립니다.
Caprock을 사용할 때와 사용하지 않을 때
Caprock MCP 서버가 연결되어 있으면 스킬은 current_decisions, search_memories, get_memory, next_session_handoff를 통해 기억을 불러옵니다. 이 도구들은 결정과 발견 사항을 담은 Caprock의 2nd Brain을 읽습니다. 연결 여부와 관계없이 파일에 저장합니다. Caprock은 컴퓨터의 모든 코딩 에이전트 세션을 기록하는 무료 오픈 소스 앱입니다.
SKILL.md 전문
dspv/skills의 리비전 dfce799에 있는 파일 그대로입니다. 수동으로 설치하려면 프로젝트 안에 Claude Code용은 .claude/skills/memory/SKILL.md, Codex용은 .agents/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.
```
memory 스킬 관련 질문
- Claude 메모리 스킬이란 무엇인가요?
- Claude Code에 세션 간에 무엇을 어떻게 보존할지 알려 주는 스킬입니다. 항목마다 날짜와 이유를 담은 결정이나 발견 하나를 다음 세션이 찾을 위치에 저장하고, 다시 결정하기 전에 검색합니다.
- 이 메모리 스킬은 CLAUDE.md와 어떻게 다른가요?
- `CLAUDE.md`는 모든 세션에 로드되므로 규칙을 담습니다. memory 스킬은 결정 사항과 발견 사항을 별도 항목으로 저장해 관련이 있을 때 검색하며, 모든 세션이 따라야 하는 규칙만 `CLAUDE.md`에 한 줄 추가합니다.
- memory 스킬이 Codex에서도 작동하나요?
- 네. Codex 0.163.0은 2026년 11월 29일 테스트에서 이 스킬로 저장된 결정 사항을 불러왔으며, 중복으로 작성하지 않았습니다.
- 붙여 넣은 비밀 정보도 저장하나요?
- 아니요. 토큰, 비밀번호, 다른 사람의 개인정보는 요청하더라도 저장하지 않으며, 스킬이 그 이유를 설명합니다.