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.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install agent-context-system或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install agent-context-system⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/agent-context-system/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: 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 ---
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.
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.
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.
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.
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)
The template includes five scripts:
init-agent-context.shSets up the local agent scratchpad and agent tool integrations. Run once per clone. Safe to re-run.
.agents.local.md from template.agents.local.md is gitignoredcompress.shCompresses 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.shMoves flagged items from .agents.local.md's "Ready to Promote" section into AGENTS.md. Not yet implemented — currently a manual step.
validate.shValidates AGENTS.md stays under 120 lines and checks format consistency. Not yet implemented.
publish-template.shPush 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 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.
The template AGENTS.md includes:
Basic metadata: name, stack, package manager. Keep it one-liners.
Executable commands for build, test, lint, dev server. These go early because agents need them immediately.
One line per directory. The agent gets high-level structure on every turn without needing to look anything up.
This is the most important section. Three subsections:
pattern | where-to-see-it format. Named exports only, server components default, Zustand for client state, Result types not try/catch.rule | reason format. Never modify src/generated, env vars through src/config, no default exports, no inline styles.trap | fix format. 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.
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.
Points to agent_docs/ for when a task needs more depth than the compressed version provides. Conventions, architecture, gotchas — full detail, loaded on demand.
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).
The template .agents.local.md includes:
Your style, code preferences, planning preferences. Friendly vs technical tone. Minimal changes vs comprehensive refactors. Always state the plan before writing code.
Settled truths about this project. Promote recurring session learnings here.
...
安装 Agent Context System 后,可以对 AI 说这些话来触发它
Help me get started with Agent Context System
Explains what Agent Context System does, walks through the setup, and runs a quick demo based on your current project
Use Agent Context System to a persistent local-only memory system for AI coding agents
Invokes Agent Context System with the right parameters and returns the result directly in the conversation
What can I do with Agent Context System in my developer & devops workflow?
Lists the top use cases for Agent Context System, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/agent-context-system/ 目录(个人级,所有项目可用),或 .claude/skills/agent-context-system/(项目级)。重启 AI 客户端后,用 /agent-context-system 主动调用,或让 AI 根据上下文自动发现并使用。
Agent Context System 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
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. Works across Claude Code, Cursor, Copilot, Windsurf. Subagent-ready. No plugins, no infrastructure, no background processes.
Automate my developer & devops tasks using Agent Context System
Identifies repetitive steps in your workflow and sets up Agent Context System to handle them automatically
Agent Context System 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。