{"id":"agent-memory-discipline","name":"agent-memory-discipline","summary":"行動する前に長期記憶から記憶を呼び起こすべき時と、後で持続的な決定、修正、失敗を保存すべき時を教えます。","body":"# Agent memory discipline\n\nConnecting a memory tool does not make an agent use it. Tools register, the session runs, and nothing gets recalled or saved. This skill supplies the missing part: standing rules for when to read memory and when to write it.\n\nIt is backend-agnostic. Everything below works the same whether memory is a folder of Markdown files, a local MCP server, or a hosted service.\n\n## Recall before acting\n\nRead memory **before** doing any of these, not after:\n\n- starting work on a project you have touched before\n- choosing a library, pattern, or tool\n- writing tests, commits, or documentation, where conventions apply\n- answering \"how do we usually do X here\"\n- anything the user phrases as \"again\", \"like last time\", or \"as we agreed\"\n\nDo **not** recall for one-off factual questions, arithmetic, or anything fully specified in the current message. Recall costs a tool call and context; spending it on a self-contained question is waste.\n\nSearch with the words the user actually used, plus the project or repository name. If the first search returns nothing useful, try one broader query, then stop and proceed without memory rather than looping.\n\n## Save after deciding\n\nWrite to memory when one of these has just happened:\n\n- a **decision** was made and will still matter next week (\"we use pnpm\", \"the billing module stays untouched\")\n- the user **corrected** you, which is the strongest signal there is\n- an approach **failed**, and why it failed\n- a preference was stated that applies beyond this task\n- a fact about the environment was discovered the hard way (a port, a flag, a service that must be running)\n\nDo **not** save: the contents of files you can read again, restatements of the current task, transient state, anything the user marked as temporary, and anything containing secrets, tokens, or personal data.\n\nOne memory, one fact. A paragraph containing four decisions cannot be superseded cleanly when one of them changes.\n\n## Write it so it survives\n\nA memory that is useless in three weeks was written wrong. Each entry should carry, in the text if the backend has no fields for it:\n\n- **what** was decided or observed, in one sentence\n- **why**, briefly, because the reason outlives the decision\n- **when** it became true, and when it stopped being true if it has\n- **where it came from**: a file, a commit, a conversation, a test run\n\nPrefer the user's own words over your paraphrase. Paraphrase drifts.\n\n## Do not overwrite the past, close it\n\nWhen something changes, the old memory is not wrong. It is **closed**.\n\nIf the project moved from Redux to Zustand, \"we use Redux\" was true from January to June. Deleting it destroys the explanation for every component written in that window. Mark it superseded, keep its validity window, and write the new one alongside.\n\nThis is the single most destructive habit in agent memory, and it is invisible until someone asks a question about old code.\n\n## Keep contradictions instead of resolving them silently\n\nIf recall returns two entries that disagree, do not pick the closer match and proceed. Surface both, with their dates, and ask or flag.\n\nA convention that a recent failure contradicts is exactly the situation where the user needs to be told, not smoothed over.\n\n## Evidence and policy are different weights\n\n- **Evidence** is what happened: one run, one failure, one observation. Cheap, plentiful, individually unreliable.\n- **Policy** is what should happen: a convention, a decision, a rule. Expensive, and should be hard to change by accident.\n\nAn observation becomes policy when a human confirms it, when it lands in a merged decision record, or when it has worked repeatedly. Never promote a single observation to a rule on your own.\n\n## A worked example\n\nThe user says: *\"stop using npm here, we're on pnpm.\"*\n\n1. This is a correction, which is the strongest save signal. Save it.\n2. Write: `Project uses pnpm, not npm. Stated by the user on 2026-08-11 after a lockfile conflict. Applies to all packages in this repo.`\n3. Do not also save \"the user was annoyed\", \"I ran npm install\", or the lockfile contents.\n4. Next session, before running any package command in this repo, recall first and find it.\n\n## Checklist to keep in the loop\n\nBefore acting on project-specific work: **did I recall?**\nAfter a decision, correction, or failure: **did I save it, in one sentence, with its reason?**\nWhen something changed: **did I close the old entry instead of deleting it?**\n\n---\n\n## Backends\n\nThis skill assumes a memory tool exists. Any of these work:\n\n- **Files.** A `memory/` folder of Markdown notes, one fact per file. No dependencies, fully greppable, versionable in git.\n- **A local MCP memory server.** Keeps everything on your machine; several open-source options exist.\n- **A hosted memory service over MCP.** Adds portability across tools and machines at the cost of your data living elsewhere.\n\n*Written and maintained by the team behind [Mnemoverse](https://mnemoverse.com), which is one hosted implementation. The rules above are deliberately backend-neutral and were written to be useful without it.*","author":"@davepoon","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/davepoon/buildwithclaude/tree/main/plugins/all-skills/skills/agent-memory-discipline","license":"MIT","category":"ai-agents","lang":"en","tokens":1130,"stars":0,"calls30d":2,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[],"requires":{"mcp":[],"tools":[]},"safety":{"flags":[],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":["mnemoverse.com"]}}