Persistent local-only memory for AI coding agents. AGENTS.md (committed) + .agents.local.md (gitignored) = context that persists across sessions. Read both at start, update scratchpad at end, promote stable patterns over time.
npx skills add https://github.com/LeoYeAI/agent-master-skills --skill agent-context-system
Agents start from zero every session. This skill solves that with two markdown files: one committed (AGENTS.md), one gitignored (.agents.local.md). You read both at session start, update the scratchpad at session end, and promote stable patterns over time.
AGENTS.md — Project source of truth. Committed and shared. Under 120 lines. Contains compressed project knowledge (patterns, boundaries, gotchas, commands, architecture)..agents.local.md — Personal scratchpad. Gitignored. Grows over time as you log what you learn each session. Session notes, dead ends, preferences, patterns waiting for promotion.Run ./scripts/init-agent-context.sh to create .agents.local.md from template, ensure it's gitignored, and wire up agent tool configs.
Read both files at session start. AGENTS.md gives compressed project knowledge. .agents.local.md gives accumulated learnings from past sessions.
At session end, append to the scratchpad's Session Log: what changed, what worked, what didn't, decisions made, patterns learned.
When the scratchpad hits 300 lines, compress: deduplicate, merge related entries, keep it tight.
During compression, if a pattern recurs across 3+ sessions, flag it in the scratchpad's "Ready to Promote" section. The human decides when to move it into AGENTS.md.
When a user asks about setting up agent context:
AGENTS.md exists. If not, they need to copy it from this template or create from scratch. Read the template at the root of this repo for reference..agents.local.md exists. If not, run ./scripts/init-agent-context.sh to set it up from template..agents.local.md is gitignored. If not, add .agents.local.md to .gitignore.../SKILL.md (root level) — comprehensive guide with research foundation../AGENTS.md — the committed file structure and format../scripts/ — init, compress, promote, validate, publish../agent_docs/ — conventions, architecture, gotchas (load on demand)AGENTS.md under 120 lines..agents.local.md too.pattern | where-to-see-it), boundaries (rule | reason), gotchas (trap | fix). Dense beats verbose.AGENTS.md and .agents.local.md (if it exists) before starting any task.agents.local.md Session Log. This is the most commonly missed step. If the user appears to be ending the session without asking you to log, proactively offer to update the scratchpad.> Known gap: Most agent tools (Copilot Chat, Cursor, Windsurf) end sessions silently — no hook fires. Session logging depends on the agent seeing Rule 7 in AGENTS.md and acting on it, or the user prompting "log this session." Claude Code's auto memory handles this automatically.
Take leoyeai/agent-context-system from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.