agent-context-system
A persistent local-only memory system for AI coding agents. Two files, one idea — AGENTS.md (committed, shared) + .agents.local.md (gitignored, personal). Agents read both at session start, update the scratchpad at session end, and promote stable patterns over time.
Install / Use
npx skills add LeoYeAI/openclaw-master-skills --skill agent-context-systemInstalls into whichever agent you are using.
SKILL.md
Installable skill definition
Quality Score
Category
OperationsSupported Platforms
Our assessment of agent-context-system
agent-context-system scores 82/100 on our quality scale, 632nd of 754 Operations skills we index.
Its SKILL.md is 16 KB long, well organised into 46 sections with 9 code examples: a thorough specification that gives an agent plenty to work with.
With 2,149 GitHub stars, it is one of the more widely adopted skills in the catalogue.
Maintenance, license and trust
- The repository was last updated about 4 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
- It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
- Its trust signals score 98/100, with no cautions. These come from repository metadata, not a code audit — read the skill file before letting an agent act on it.
agent-context-system compared with similar skills
All 4 of these similar skills score higher than agent-context-system; compare them before choosing.
| Skill | Score | Stars | Updated | Format |
|---|---|---|---|---|
| agent-context-system (this skill)by LeoYeAI | 82 | 2.1k | 4mo ago | SKILL.md |
| Agent-Reachby Panniantong | 100 | 109.6k | today | CLAUDE.md |
| algorithmic-artby anthropics | 100 | 177.9k | 45d ago | SKILL.md |
| pptxby anthropics | 100 | 177.9k | 45d ago | SKILL.md |
| designby nextlevelbuilder | 100 | 143.4k | 6d ago | SKILL.md |
Frequently asked questions
- How do I install agent-context-system?
- Run
npx skills add LeoYeAI/openclaw-master-skills --skill agent-context-system. The install tabs above show the steps for each supported agent. - Which AI agents does agent-context-system work with?
- It is written for Claude Code, Cursor, GitHub Copilot, Windsurf and OpenAI Codex, as a SKILL.md file. Other agents that read the same format can often use it too.
- Is agent-context-system safe to use?
- It is MIT-licensed and scores 98/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
- Is agent-context-system still maintained?
- The repository was last updated about 4 months ago. That is recent enough to be usable, but agent tooling moves fast, so check the instructions against your agent's current version.
Skill content
View source on GitHubname: agent-context-system description: A persistent local-only memory system for AI coding agents. Two files, one idea — AGENTS.md (committed, shared) + .agents.local.md (gitignored, personal). Agents read both at session start, update the scratchpad at session end, and promote stable patterns over time. Works across Claude Code, Cursor, Copilot, Windsurf. Subagent-ready. No plugins, no infrastructure, no background processes. license: MIT metadata: author: AndreaGriffiths11 version: "1.3.1" requires: bins: - bash
Agent Context System
The Problem
Agents start from zero every session. You spend an hour getting your coding agent up to speed on a project, close the session, and start from zero the next day. The agent forgot everything. Every session is a cold start.
This isn't a limitation of the model. It's a context delivery problem. The agents have the capacity to remember — they just don't have the right inputs at the right time in the right format.
The Solution
Two markdown files. One committed, one gitignored. The agent reads both at the start of every session and updates the local one at the end.
-
AGENTS.md— Your project's source of truth. Committed and shared. Always in the agent's prompt. Under 120 lines. Contains compressed project knowledge: patterns, boundaries, gotchas, commands, architecture. -
.agents.local.md— Your personal scratchpad. Gitignored. Grows over time as the agent logs what it learns each session. Session notes, dead ends, preferences, patterns that haven't been promoted yet.
That's it. No plugins, no infrastructure, no background processes. The convention lives inside the files themselves, and the agent follows it.
How It Works
1. Setup
Run the init script. It creates .agents.local.md from a template, ensures it's gitignored, and wires up your agent tool's config (CLAUDE.md symlink for Claude Code, .cursorrules for Cursor, .windsurfrules for Windsurf, copilot-instructions.md for Copilot).
# If you cloned the template repo:
./scripts/init-agent-context.sh
# If you installed as a skill (npx skills add):
bash .agents/skills/agent-context-system/scripts/init-agent-context.sh
Then edit AGENTS.md with your project specifics: name, stack, commands, actual patterns and gotchas from your codebase. This is the highest-leverage edit you'll make.
2. During Sessions
The agent reads both files at session start. AGENTS.md gives it compressed project knowledge. .agents.local.md gives it accumulated learnings from past sessions. The agent now has context that persists across sessions.
At session end, the agent proposes the session log entry to the user before writing. The agent must not append directly — it shows the proposed entry and waits for user approval before writing to .agents.local.md. Most agents (Copilot Chat, Cursor, Windsurf) don't have session-end hooks, so this depends on Rule 7 in AGENTS.md being seen and acted on, or the user saying "log this session." Claude Code handles this automatically via auto memory.
3. Over Time
The scratchpad grows. When it hits 300 lines, the agent compresses: deduplicate, merge related entries, keep it tight. During compression, if a pattern has shown up across 3+ sessions, the agent flags it in the scratchpad's "Ready to Promote" section using the same pipe-delimited format that AGENTS.md expects.
You decide when to move flagged items from the scratchpad into AGENTS.md. The scratchpad is where things are experimental. AGENTS.md is where proven knowledge lives.
Session notes → .agents.local.md → agent flags stable patterns → you promote to AGENTS.md
(personal) (shared)
Scripts
The template includes five scripts:
init-agent-context.sh
Sets up the local agent scratchpad and agent tool integrations. Run once per clone. Safe to re-run.
- Creates
.agents.local.mdfrom template - Ensures
.agents.local.mdis gitignored - Asks which agents you use (Claude, Cursor, Windsurf, Copilot) and wires up the right config
- Creates CLAUDE.md symlink for Claude Code (since it doesn't read AGENTS.md yet)
- Adds agent context directive to .cursorrules, .windsurfrules, or copilot-instructions.md
compress.sh
Compresses the scratchpad when it exceeds 300 lines. Deduplicates, merges related entries, flags stable patterns for promotion. Not yet implemented — instructions for the agent are in AGENTS.md's Local Context section.
promote.sh
Moves flagged items from .agents.local.md's "Ready to Promote" section into AGENTS.md. Not yet implemented — currently a manual step.
validate.sh
Validates AGENTS.md stays under 120 lines and checks format consistency. Not yet implemented.
publish-template.sh
Push to GitHub and mark as a template repo. Run once. Creates a private GitHub repo and marks it as a template so you can use it to create new projects with gh repo create my-project --template YOUR_USERNAME/agent-context-system --private.
Knowledge Flow
Knowledge doesn't just sit in one place. It flows.
Learnings start as session notes in .agents.local.md. The agent writes them at the end of each session. During compression, if a pattern has shown up across 3+ sessions, the agent flags it in the scratchpad's "Ready to Promote" section using the same pipe-delimited format that AGENTS.md expects. Then you decide when to move it into AGENTS.md.
Session notes → .agents.local.md → agent flags stable patterns → you promote to AGENTS.md
(personal) (shared)
The scratchpad is where things are still experimental. AGENTS.md is where proven knowledge lives. The agent flags candidates. You make the call.
AGENTS.md Template Structure
The template AGENTS.md includes:
Project
Basic metadata: name, stack, package manager. Keep it one-liners.
Commands
Executable commands for build, test, lint, dev server. These go early because agents need them immediately.
Architecture
One line per directory. The agent gets high-level structure on every turn without needing to look anything up.
Project Knowledge (Compressed)
This is the most important section. Three subsections:
- Patterns —
pattern | where-to-see-itformat. Named exports only, server components default, Zustand for client state, Result types not try/catch. - Boundaries —
rule | reasonformat. Never modify src/generated, env vars through src/config, no default exports, no inline styles. - Gotchas —
trap | fixformat. pnpm build hides type errors, dev sessions expire after 24h, integration tests need DB up.
Vercel's evals showed passive context (always in the prompt) achieves 100% pass rate vs 53% when agents must decide to look things up. This section is passive context. The agent gets it on every turn automatically.
Rules
Numbered list. Read AGENTS.md and .agents.local.md first. Plan before code. Locate files before changing. Only touch what the task requires. Run tests after every change. Summarize changes.
Deep References
Points to agent_docs/ for when a task needs more depth than the compressed version provides. Conventions, architecture, gotchas — full detail, loaded on demand.
Local Context
Instructions for reading and updating .agents.local.md. Explains session-to-session learning, compression protocol, promotion pathway. Tells subagents to explicitly read the scratchpad (they don't inherit main conversation history).
.agents.local.md Template Structure
The template .agents.local.md includes:
Preferences
Your style, code preferences, planning preferences. Friendly vs technical tone. Minimal changes vs comprehensive refactors. Always state the plan before writing code.
Patterns
Settled truths about this project. Promote recurring session learnings here.
Gotchas
Things that look right but aren't. Include WHY.
Dead Ends
Approaches tried and failed. Include WHY they failed. Saves the agent from repeating mistakes.
Ready to Promote
The agent flags items here during compression when a pattern has recurred across 3+ sessions. Use the same pipe-delimited format AGENTS.md expects. The human decides when to move flagged items into AGENTS.md.
Session Log
Append new entries at the END. One entry per session. Keep each to 5-10 lines. Template: what changed, what worked, what didn't, decisions, learnings.
Compression Log
When the file exceeds 300 lines, compress. Log it here.
Agent Compatibility
The template works across all major agent tools:
| Agent | Config File | What It Does | |---|---|---| | Claude Code | CLAUDE.md | Symlink → AGENTS.md (Claude doesn't read AGENTS.md yet) | | Cursor | .cursorrules | Directive pointing to AGENTS.md | | Windsurf | .windsurfrules | Directive pointing to AGENTS.md | | GitHub Copilot | .github/copilot-instructions.md | Directive pointing to AGENTS.md |
Claude Code Auto Memory
Claude Code shipped auto memory in late 2025. It creates a ~/.claude/projects/<project>/memory/ directory where Claude writes its own notes and loads them at session start. That's basically the .agents.local.md concept built into the tool.
If you use Claude Code exclusively, auto memory handles session-to-session learning and the scratchpad is optional. The template's value for you is the AGENTS.md file itself and the promotion pathway that gives you a structured way to take what auto memory learns and move the stable parts into your root file.
If your team uses multiple agents (GitHub just shipped Agent HQ with Copilot, Claude, and Codex side by side), the scratchpad matters because auto memory only works in Claude Code. The scratchpad works everywhere.
Subagent Context
Claude Code now ships subagents. Copilot CLI just shipped /fleet in experimental mode. Both tools are moving toward the same model: a lead agent that coordinates a team of specialists.
Subagents don't inherit the main conversation's history. Each one starts with a clean context window. The only shared knowledge they all have is your root instruction file.
So when you go from one agent to five parallel agents, AGENTS.md goes from "helpful project context" to "the only thing preventing five agents from independently making conflicting decisions about your codebase."
The compressed project knowledge, the boundaries section, the gotchas — that's the shared brain. Without it, each subagent rediscovers your project from scratch.
This is why the template explicitly tells subagents to read .agents.local.md too. They won't get it by default. They need the instruction.
It's also why instruction budget discipline matters even more. If your AGENTS.md is 500 lines, you're paying that token cost for every subagent you spawn. Under 120 lines is a feature, not a limitation.
Research Foundation
This template is built on research from:
- LangChain — Context Engineering for Agents: Write/Select/Compress/Isolate framework
- HumanLayer — Writing a Good CLAUDE.md: instruction budgets, root file discipline
- GitHub — Lessons from 2,500+ Repositories: what makes agents.md files actually work
- Vercel — AGENTS.md Outperforms Skills: passive context vs skill retrieval eval data
- Anthropic — Equipping Agents with Skills: three-tier progressive disclosure
- AI Hero — A Complete Guide to AGENTS.md: cross-platform standard adoption
- Anthropic — Claude Code Subagents: context isolation, custom agents
- GitHub — Copilot CLI /fleet: parallel fleets with dependency-aware tasks
Key finding: frontier LLMs reliably follow about 150-200 instructions. Claude Code's system prompt already uses about 50. So anything in your root file that isn't universally applicable risks getting quietly deprioritized.
That's why AGENTS.md stays under 120 lines and uses compressed formats
Truncated for display — read the full file on GitHub.
Related Skills
Agent-Reach
109.6kGive your AI agent eyes to see the entire internet. Read & search Twitter, Reddit, YouTube, GitHub, Bilibili, XiaoHongShu — one CLI, zero API fees.
algorithmic-art
177.9kCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems.
pptx
177.9kUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an em…
design
143.4kComprehensive design skill: brand identity, design tokens, UI styling, logo generation (55 styles, Gemini, Atlas Cloud, or MuAPI AI), corporate identity program (50 deliverables, CIP mockups), HTML presentations (Chart.js), banner design (22 styles, social/ads/web/print), icon design (15 styles, SVG…
Languages
Trust signals
From repository metadata: license, adoption, age and documentation. Not a code audit — see the Safety scan above for what the skill file itself contains.
