LEAP
LEAP builds skills through two pipelines: Branch A distills a skill from raw data, while Branch B combines multiple skills into one. It is called by the main…
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
$ npx -y skills add agentsope/SkillAlchemy --skill agentsop-context-scope-discipline --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/agentsop-context-scope-disciplineContext preview
The summary Claude sees to decide when to auto-load this skill.
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
name: agentsop-context-scope-discipline version: 0.1.0 description: >- 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 keywords: context window full, agent edits wrong file, too much context, /add /drop files, working file budget, context dilution, lost in the middle. domain: working-file budget management for LLM coder-agents (multi-file editing) source: aider.chat troubleshooting/edit-errors (25k distraction threshold) + /add /drop discipline; generalized across coder harnesses audience: coder-agents (Aider/Claude Code/Cursor/Cline/custom) editing multiple files where the working set must stay focused status: enhancement overlay — sharpens the generic token-budget rule into a coding-agent-specific working-file discipline type: enhance overlays: token-budget skills (this adds the coder-agent "only load what you'll edit" rule) crosslinks: "[[agentsop-repo-map]], [[agentsop-session-state-hygiene]]"
> 一句话:**编辑代码时,工作文件预算(你 `/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);纯讨论/架构问答(用只读上下文 + [[agentsop-repo-map]] 即可,不进工作集);非编辑任务。
---
> **more context ≠ better edits.** 过了约 ~25k tokens 的文件量,模型就开始失焦——**只把你这一轮真要编辑的文件加进工作集,其余的靠 [[agentsop-repo-map]] 顶上。**
LLM 看到的编辑上下文分三层,**优先级与写权限递减**:
| 层 | 内容 | 写权限 | 预算策略 | |---|---|---|---| | 系统提示 + 编辑格式 | harness 固化 | harness | 不可控 | | **只读上下文** | [[agentsop-repo-map]] 签名地图 + `/read` 的参考文件 + CONVENTIONS.md | 人/agent 配置 | 给"广度"——用地图覆盖全仓,但只放签名不放函数体 | | **工作集(写集合)** | `/add`-ed 的文件 | LLM **唯一**能编辑的 | 给"深度"——只放这次真要改的,压在 ~25k 以内 |
> **核心区分**:repo-map 给"哪儿"(breadth,签名级,便宜),工作集给"怎么改"(depth,全文级,贵)。把这两种需求混进同一个篮子("全 `/add` 进来再说")是本技能要根除的反模式。
25k 不是"塞到 25k 就崩",而是"过了 25k 编辑准确率开始断崖式下降"。它是个**信号阈**:
凭直觉,"我要理解这 10 个文件才能改对,那就全 `/add`"。实测相反:
> Aider **只靠 repo-map**(不把文件加进工作集)在 SWE-Bench Lite 上仍 **70.3%** 命中正确文件 [aider.chat/2024/05/22/swe-bench-lite.html]。
即"找文件"这件事不需要把文件灌进工作集——只读地图就够了。工作集只为"编辑"存在。把这两件事拆开,是省预算的关键。详见 [[agentsop-repo-map]]。
预算是一份蛋糕,不是各自独立的盘子。`/add` 了正确文件后,[[agentsop-repo-map]] 应自动缩小("adjusts ... based on the state of the chat" [aider.chat/docs/repomap.html]),把 token 让给真代码。如果你的 harness 不会自动缩地图,编辑期就手动 `--map-tokens` 调小或归零。
本技能管**文件维度**(工作集里有哪些文件);[[agentsop-session-state-hygiene]] 管**历史维度**(对话历史是否污染当前任务)。二者共用同一份 25k 预算:
---
任务进来,第一步不是 `/add`,而是分类。对每个相关文件问一句:**"这一轮我会修改它的字节吗?"**
会改它的字节 → 候选写集合(稍后 /add) 只需理解它的契约 → 只读:/read,或干脆只靠 repo-map 的签名 不确定改哪些 → 先不加任何文件,进 Phase 2 让 repo-map 帮你定位
> 经验法则:写集合目标 **≤ 5 个文件**。超过,多半是任务没拆够。
> /ask which files implement <feature>? < [模型基于只读 repo-map 回答候选文件]
模型命名出目标后,**你**再决定把哪些加进工作集(Op `locate-then-add`)。"找文件"和"改文件"永远两步走——这是 [[agentsop-repo-map]] 与本技能共享的设计哲学。
/add src/auth.py tests/test_auth.py # 这两个会改 → 进写集合 /read src/config.py docs/auth.md # 只参考,不改 → 只读
铁律重申:**少 `/add`,敢 `/drop`**。"为了保险全加"恰恰是让模型改错文件的主因。
/tokens # 看当前占用;接近 25k 是黄灯
| 信号 | 动作 | |---|---| | `/tokens` 逼近 25k | `/drop` 已经改完、不再相关的文件 | | repo-map 占比偏大 | 调小 `--map-tokens`(目标文件已定,地图可缩) | | 模型反复改错文件 | `/ls` 检查工作集;`/drop` 多余的,`/add` 缺的 | | 历史漂移(不是文件问题) | 转交 [[agentsop-session-state-hygiene]]:`/clear` |
工作集不是"会话期一直累积"的。某文件这一轮的修改告一段落、后续子任务不再碰它——立即 `/drop`。把腾出的预算还给下一批要改的文件。这是把工作集**当滑动窗口**用,而不是当垃圾堆。
地图也缩了、能 `/drop` 的都 `/drop` 了,预算还是破 25k?这是**任务太宽**的信号,不是预算的问题:
1. 进子目录 + --subtree-only(缩小 repo-map 范围,见 [[agentsop-repo-map]] §3) 2. 拆任务:大需求拆成多个收敛子目标,每个子目标一个会话 3. 每个新会话只带它真正要改的那 ≤5 个文件
---
每条给 **Trigger / Action / Output / Evidence**。命令名以 Aider 为参考,行为框架无关。
Turn people, methods, and experience into installable, reusable agent skills. SkillAlchemy is an open-world agent skill creation system that turns underspecified skill briefs and open-world sources into installable, reusable agent skills.
LEAP builds skills through two pipelines: Branch A distills a skill from raw data, while Branch B combines multiple skills into one. It is called by the main…
Lens — Add a cognitive lens to any problem. It accepts a task description and produces an enhanced description that surfaces hidden dimensions, prerequisites,…
Cross-framework enhancement overlay for choosing a multi-agent topology BEFORE writing any agent. A binary-question rubric — is single-agent + tools enough? do…
SOP for terminal-based, git-native AI pair programming with Aider (git work-tree + tree-sitter repo-map + edit-format + human-in-loop REPL). Use when editing…
Screens biomedical / life-science papers for signs of data fabrication, image manipulation, and statistical anomalies, using the detection techniques distilled…
Universal discipline for any LM-driven loop — agent retries, plan-act-observe, multi-agent handoffs, optimiser passes, test-fix cycles. Encodes the one rule…