Cross-Session Memory Skill
Instructions for AI Agents
You are an AI coding assistant with the ability to maintain context across sessions using a file-based context system. This system is platform-agnostic and works across Cursor, Claude Code, Codex, and other AI coding tools.
Context File Locations
All context files live in docs/ (relative to the project root):
| File | Purpose |
|---|---|
AGENT.md | Instructions you read at every session start |
project.md | Static project overview and architecture |
session.md | Dynamic session state—start here |
memory.md | Accumulated learnings and decisions |
Session Start Protocol
When starting a new session:
- •
Read context files in this order:
- •
docs/AGENT.md(if exists) - •
docs/project.md(if exists) - •
docs/session.md(if exists) - •
docs/memory.md(if exists)
- •
- •
Locate resume point: Find
## RESUME HEREsection indocs/session.md - •
Summarize state: Tell the user:
- •What task was in progress
- •What was last completed
- •Any blockers or pending items
- •
Confirm before proceeding: Ask the user if the summary is accurate
During Session Protocol
Update docs/session.md after:
- •Creating, modifying, or deleting files
- •Completing significant tasks or milestones
- •Encountering blockers or errors
- •Making architectural decisions
- •Changing direction or approach
Session End Protocol
Before the session ends:
- •
Update
## RESUME HEREwith:- •Current status (in-progress, blocked, completed)
- •Last action attempted/completed
- •Next logical step
- •Any open questions or decisions needed
- •
Update progress checkboxes if applicable
- •
Archive session if switching contexts (optional)
Initialization Protocol
When user requests context setup (no docs/ context files exist):
- •Create
docs/directory (if needed) - •Create all four template files
- •Populate
project.mdwith project information gathered from user - •Initialize
session.mdwith first session entry
File Templates
AGENT.md Template
# Agent Instructions This project uses cross-session context tracking. At the start of each session: 1. Read all files in `docs/` directory (focus on `AGENT.md`, `project.md`, `session.md`, `memory.md`) 2. Find `## RESUME HERE` in `session.md` 3. Summarize current state before proceeding 4. Update `session.md` after significant actions ## Project Conventions <!-- Add project-specific conventions here --> ## Do Not - Modify files without updating context - Assume context from previous sessions - Skip the resume summary step
project.md Template
# Project Overview ## Name <!-- Project name --> ## Description <!-- Brief description --> ## Goals <!-- High-level objectives --> ## Architecture <!-- System design, key components --> ## Tech Stack <!-- Languages, frameworks, tools --> ## Key Files <!-- Important files and their purposes --> ## Constraints <!-- Limitations, requirements, boundaries -->
session.md Template
# Session Context ## RESUME HERE **Status**: Not started **Last Updated**: <!-- timestamp --> **Platform**: <!-- cursor/claude-code/codex --> ### Current Task <!-- What are we working on --> ### Last Action <!-- What was just done --> ### Next Step <!-- What should happen next --> ### Blockers <!-- Any issues preventing progress --> --- ## Progress ### Completed - [ ] <!-- Task 1 --> - [ ] <!-- Task 2 --> ### In Progress - [ ] <!-- Current task --> ### Pending - [ ] <!-- Future task --> --- ## Session Log ### Session 1 - <!-- date --> **Platform**: <!-- platform used --> **Duration**: <!-- time spent --> #### Accomplished <!-- What was done --> #### Decisions Made <!-- Key decisions --> #### Issues Encountered <!-- Problems and solutions -->
memory.md Template
# Project Memory Accumulated learnings and decisions that persist across sessions. ## Decisions | Date | Decision | Rationale | Status | |------|----------|-----------|--------| <!-- Decisions log --> ## Learnings ### What Works <!-- Successful patterns --> ### What Doesn't Work <!-- Failed approaches to avoid --> ## Conventions Discovered <!-- Project-specific patterns found during development --> ## External Dependencies | Dependency | Purpose | Notes | |------------|---------|-------| <!-- External services, APIs, etc. --> ## Gotchas <!-- Things to watch out for -->
Usage Examples
Initialize Context
User: "Set up context tracking for this project"
AI Response:
- •Create
docs/directory (if needed) - •Generate all four template files
- •Ask user about project details
- •Populate
project.mdwith gathered information - •Confirm setup complete
Resume Session
User: "Let's continue where we left off"
AI Response:
- •Read
docs/session.md - •Find
## RESUME HEREsection - •Summarize: "Last session you were working on [X]. You completed [Y] and were about to [Z]. There's a blocker regarding [W]. Is this accurate?"
- •Wait for confirmation
- •Proceed with next step
End Session
User: "I need to stop for now"
AI Response:
- •Update
## RESUME HEREwith current state - •Log session in Session Log section
- •Update any memory items if applicable
- •Confirm context saved
- •Suggest: "Context saved. When you resume, I'll pick up from [current state]."
Transfer to Different Platform
User: "I'm switching to Cursor from Claude Code"
AI Response:
- •Ensure
docs/session.mdis fully updated - •Add note: "Transferred from Claude Code on [date]"
- •Confirm all context files are saved
- •Explain: "Context is saved in
docs/. When you open in Cursor, instruct it to readdocs/session.mdto resume."