memory · bhartendu-kumar, cursor — Claude Code & Cline rule: project memory files
Keeps project memory in a fixed set of files the agent reads before work: requirements, architecture, stack, task plan, current state.
no license ★ 1,054 updated 2025-07-17
.cursor/rules/memory.mdcWhat memory does
Seven files carry the memory: a requirements doc, architecture, the technical stack, a task backlog, the current working state, and two journals for mistakes and for lessons. The rule lays them out as a hierarchy, with a mermaid diagram showing what builds on what.
Work runs in one of two modes. Plan mode reads docs/ and tasks/, checks whether anything is missing and brings you a strategy to approve. Act mode refreshes the docs first and only then touches code. You can name the mode outright with MODE = ACT MODE, otherwise the agent infers it and asks when the request is unclear. Expect an extra question at the start of a session.
The whole scheme depends on the files being there. Without them plan mode has nothing to read and starts by drafting the set, including the PRD at project start. Asking the agent to update memory files makes it go through every core file again, which is how the picture stays current.
What it helps with
- keep requirements and architecture in files the agent reads first
- pick a task back up after a session restart
- log a fix so the same mistake is not repeated
- separate planning from code edits
- keep RFCs and literature notes next to the task plan
Example prompts for the agent
- MODE = PLAN MODE: read the memory files in
docs/andtasks/, then propose a plan. - Update memory files: go through
tasks/active_context.mdandtasks/tasks_plan.md. - Write that fix into
.cursor/rules/error-documentation.mdcbefore you continue.
How to install memory
Manually: put the files in place
.cursor/rules/memory.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/memory.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/memory.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/memory.mdManually: put the files in place
.clinerules/memory.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about memory
How do I install memory in Claude Code?
Put the rule file at .claude/rules/memory.md. The frontmatter sets alwaysApply: true, so it fires on every request.
What does the memory rule do?
It defines which files hold the project memory, in what order the agent reads them and when it writes updates back.
What if the memory files do not exist yet?
Plan mode drafts them before anything else. The PRD is created at project start when it is missing.
Similar IDE rules
All IDE rules for Agent setup: memory, context, orchestration →memory by other authors comes first.