agentsop-context-scope-discipline

agentsop-context-scope-discipline is a skill for Claude Code, Codex from agentsope/SkillAlchemy. It costs 131 tokens per session (6,201 once invoked), scanned A, original, MIT.

A working guide for keeping the files an AI coding agent edits within a small context budget. It separates files that need to be read from the smaller set that will actually be changed.

In plain words
What is it for?
Managing multi-file code changes, choosing an editable file set, and working in large repositories or coding-agent harnesses.
Why use it?
It helps prevent the agent from losing focus, editing the wrong files, or being distracted by too much repository context.

Skill for Claude CodeCodex

Which agent this was written for is unclear — built for aider. Also seen: mentions Claude Code; built for aider.

Good fit Managing multi-file code changes, choosing an editable file set, and working in…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/agentsope/skillalchemy/agentsop-context-scope-discipline
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add agentsope/SkillAlchemy --skill agentsop-context-scope-discipline
Clone the repo
git clone --depth 1 https://github.com/agentsope/SkillAlchemy

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for agentsop-context-scope-discipline

README.md
[![agentmods](https://agentmods.dev/badge/skills/agentsope/skillalchemy/agentsop-context-scope-discipline.svg)](https://agentmods.dev/skills/agentsope/skillalchemy/agentsop-context-scope-discipline)
Your own site
<a href="https://agentmods.dev/skills/agentsope/skillalchemy/agentsop-context-scope-discipline"><img src="https://agentmods.dev/badge/skills/agentsope/skillalchemy/agentsop-context-scope-discipline.svg" alt="Measured on agentmods" height="20"></a>
Per session 131 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,201 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00131 $0.06201
Opus 5 $0.00066 $0.03100
Sonnet 5 $0.00026 $0.01240
Haiku 4.5 $0.00013 $0.00620

Measured 7d ago against content hash fa9e55df4459, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

agentsop-context-scope-discipline scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/agentsop-context-scope-discipline/SKILL.md · 334 lines

How it starts

The opening of the file, as written. The whole thing — 334 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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 看到的编辑上下文分三层,优先级与写权限递减

内容 写权限 预算策略
系统提示 + 编辑格式 harness 固化 harness 不可控
只读上下文 [[agentsop-repo-map]] 签名地图 + /read 的参考文件 + CONVENTIONS.md 人/agent 配置 给"广度"——用地图覆盖全仓,但只放签名不放函数体
工作集(写集合) /add-ed 的文件 LLM 唯一能编辑的 给"深度"——只放这次真要改的,压在 ~25k 以内

核心区分:repo-map 给"哪儿"(breadth,签名级,便宜),工作集给"怎么改"(depth,全文级,贵)。把这两种需求混进同一个篮子("全 /add 进来再说")是本技能要根除的反模式。

2.3 25k 是稀释阈,不是上限

25k 不是"塞到 25k 就崩",而是"过了 25k 编辑准确率开始断崖式下降"。它是个信号阈

  • 工作集本身 + 对话历史 + repo-map 都算进这一份预算。
  • 文件越多、越大,留给"模型对当前编辑点的注意力"越少。
  • 模型越弱,对 25k 越敏感(弱模型"更容易违背系统提示" [aider.chat/docs/troubleshooting/edit-errors.html])。

2.4 "全加进去保险"是错觉——repo-map 已经替你覆盖了广度

凭直觉,"我要理解这 10 个文件才能改对,那就全 /add"。实测相反:

Aider 只靠 repo-map(不把文件加进工作集)在 SWE-Bench Lite 上仍 70.3% 命中正确文件 [aider.chat/2024/05/22/swe-bench-lite.html]。

Read the full file on GitHub · 334 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 334 lines · 131 tokens per session scan A fa9e55df4459

Subscribe to this mod's changes

agentsop-context-scope-discipline is a skill published in the GitHub repository agentsope/SkillAlchemy (366 stars, last pushed 4d ago), licensed MIT. It adds 131 tokens to every session and 6,201 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

shellgames

Play board games on ShellGames.ai — Chess, Poker, Ludo, Tycoon, Memory, and Spymaster. Use when the agent wants to play games against humans or other AI agents, join tournaments, chat with players, check leaderboards, or manage a ShellGames account. Triggers on "play chess/poker/ludo/memory", "shellgames", "join…

MemTensor/skills-vote · 103 tokens

curl-search

Web search using curl + multiple search engines (Baidu, Google, Bing, DuckDuckGo). Activates when user asks to search, look up, or query something online. Includes security enhancements: input sanitization, command injection protection, and URL encoding.

MemTensor/skills-vote · 55 tokens

skills-vote-local

Use when retrieving the most relevant skills from a local or private skill library instead of relying on network-based skill discovery.

MemTensor/skills-vote · 28 tokens

skills-vote

Find the most relevant external agent skills for the current task, then submit grounded feedback about which skills were actually used and useful in the same session. Whenever you start a task, use this skill first.

MemTensor/skills-vote · 44 tokens

xlsx

Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or…

MemTensor/skills-vote · 201 tokens

pdf

Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and…

MemTensor/skills-vote · 92 tokens