agentsop-context-scope-discipline
Coder-agent working-file budget discipline: keep the editable working set (files you /add into writable context) under ~25k tokens, separate "read" from "edit", delegate breadth to a read-only repo-map, and drop files once edited. Use when an LLM coder-agent edits multiple files, when the working set must stay focused, or when the model starts editing the wrong file / missing targets because too much context dilutes attention. Search working file budget, context dilution, lost in the middle.
npx skills add agentsope/SkillAlchemy --skill agentsop-context-scope-discipline --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Context Scope Discipline — 只把你要改的文件放进工作集 > 一句话:**编辑代码时,工作文件预算(你 `/add`-ed 进可写上下文的文件)要压在 ~25k tokens 以内**。超过这个量,"more context ≠ better edits"——模型注意力被稀释,开始改错文件、漏看你刚加进去的目标。广度交给 [[agentsop-repo-map]](只读签名地图),深度只留给"这次真要编辑"的那几个文件。 这是一个**增强叠加技能(enhance overlay)**。它不替代任何"通用 token 预算"建议,而是把那条泛泛的"少塞上下文"打磨成一条 coder-agent 专属的硬规则:**区分"读"与"改",只把"改"的文件加进工作集**。借用 Aider 的实测阈值—— > "Above about 25k tokens of context, most models start to become distracted." [aider.chat/docs/troubleshooting/edit-errors.html] --- ## 1. 何时激活本技能 下列任一情形成立时,把"工作文件预算纪律"作为该编辑会话的标准约束: - 任务是**多文件编辑**:rename、抽函数、改 API 签名、加 hook 点——你需要理解 N 个文件,但只会真正修改其中一小部分。 - **agent 正在改错文件**:给出的 diff 落在你没想改的文件上,或编造了不存在的路径。这几乎总是"工作集不对"——目标没加进去,或加了太多无关文件把模型呛晕。 - **上下文窗口在涨**:`/tokens`(或等价物)逼近 25k;响应被截断;长会话里模型"记住了错的东西"。 - 你在大仓库里工作,凭"为了保险全加进去"的本能正在把整个目录、整个 repo 灌进可写上下文。 - 你在写**自建 coder harness**,需要一条明确的"可编辑文件白名单何时收/何时放"的规则。 **不应激活的反面信号**:单文件已知的小改动(工作集天然就是 1);纯讨论/架构问答(用只读上下文 + [[agentsop-repo-map]] 即可,不进工作集);非编辑任务。 --- ## 2. 核心心智模型 ### 2.1 一句话铁律 > **more context ≠ better edits.** 过了约 ~25k tokens 的文件量,模型就开始失焦——**只把你这一轮真要编辑的文件加进工作集,其余的靠 [[agentsop-repo-map]] 顶上。** ### 2.2 "读" vs "改"是两种不同的上下文,需要两种不同的预算 LLM 看到的编辑上下文分三层,**优先级与写权限递减**: | 层 | 内容 | 写权限 |
- 1. 何时激活本技能
- 2. 核心心智模型
- 2.1 一句话铁律
- 2.2 "读" vs "改"是两种不同的上下文,需要两种不同的预算
- 2.3 25k 是稀释阈,不是上限
- 2.4 "全加进去保险"是错觉——repo-map 已经替你覆盖了广度
- 2.5 动态预算:工作集涨,地图就该缩
- 2.6 与 [[agentsop-session-state-hygiene]] 的分工
- 3. SOP 工作流
- Phase 1 — 区分"要编辑"和"只要读懂"
- Phase 2 — 不知道改哪个?让 repo-map 定位,而不是全加进来
- Phase 3 — 只 /add 你会编辑的,参考文件用 /read
- Phase 4 — 编辑过程中持续盯预算
- Phase 5 — 一个文件改完就 /drop 它
What does the agentsop-context-scope-discipline skill do?
Coder-agent working-file budget discipline: keep the editable working set (files you /add into writable context) under ~25k tokens, separate "read" from "edit", delegate breadth to a read-only repo-map, and drop files once edited. Use when an LLM coder-agent edits multiple files, when the working set must stay focused, or when the model starts editing the wrong file / missing targets because too much context dilutes attention. Search working file budget, context dilution, lost in the middle.
How do I install it?
Run `npx skills add agentsope/SkillAlchemy --skill agentsop-context-scope-discipline --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From agentsope/SkillAlchemy, a repository with 255 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
