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.
npx skills add agentsope/SkillAlchemy --skill agentsop-repo-state-gatinggit clone --depth 1 https://github.com/agentsope/SkillAlchemyWrote 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.
[](https://agentmods.dev/skills/agentsope/skillalchemy/agentsop-repo-state-gating)<a href="https://agentmods.dev/skills/agentsope/skillalchemy/agentsop-repo-state-gating"><img src="https://agentmods.dev/badge/skills/agentsope/skillalchemy/agentsop-repo-state-gating/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/agentsope/skillalchemy/agentsop-repo-state-gating"><img src="https://agentmods.dev/badge/skills/agentsope/skillalchemy/agentsop-repo-state-gating.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector warn
SkillSpector: 2 findings, up to medium
These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →
- medium MCP Rug Pull · line 37 npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.Fix: Pin the version: npx @scope/[email protected]
- medium MCP Rug Pull · line 195 npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.Fix: Pin the version: npx @scope/[email protected]
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00138 | $0.04669 |
| Opus 5.5 | $0.00055 | $0.01868 |
| Sonnet 5.5 | $0.00028 | $0.00934 |
| Haiku 4.5 | $0.00014 | $0.00467 |
Grade A, and why
agentsop-repo-state-gating 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 3mo 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.
How it starts
The opening of the file, as written. The whole thing — 304 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Repo-State Gating — 5-Line Decision at Project Kickoff
一句话:agent strategy = f(repo-state)。先判定 repo 状态,再选工具/上下文原语/自治程度。 跳过这一步 = 用错工具,浪费一个小时的上下文。
1. 何时激活
只在以下时刻跑一次(≤5 分钟):
- 新会话第一次进入某仓库(含
cd切到新目录、git clone后第一次启动 agent) - 仓库形态显著变化:从空目录跑到 100+ 文件、引入新子系统、merge 一个大 PR
- agent 选错过工具之后的复盘("我为什么开了 Cursor 写 SDK / 用 Aider 起新项目")
- 被项目经理/同事问到 "你应该用 X 还是 Y" — 给一个 5 行的答复
不要激活:
- 同一 repo 当天已经 gate 过 → 复用上一次结论
- 单次脚本性任务("帮我跑个一次性的数据迁移") → 跳过,直接干
- 你已经知道答案且仓库状态明显("这是个三天前刚
npx create-next-app的仓库") → 仍写下结论,但 30 秒搞定
2. 核心心智模型
2.1 一句话
不同 repo 状态,agent 的最佳武器不同。同一个 prompt 在 greenfield 里能跑通,在 brownfield 里会胡编路径;同一个 Aider 在 brownfield 里发光,在 greenfield 里失去 70% 价值。
2.2 四个状态 × 四个杠杆
状态 | 关键约束 | 最大杠杆 | 风险
----------------------+-------------------+---------------------+-------------------
Greenfield | 没有现成符号 | LM 自治 + scaffolder| 过度设计、目录漂移
Brownfield-large | 上下文炸 + 风格僵 | repo-map + 严格 /add| 修错文件、违反约定
Mid-size-familiar | 你脑里有图 | 最小上下文 + /ask | 多加文件稀释信号
Library / SDK | 你的代码即 API | 约定 + test-fix 环 | 破坏向后兼容
四个杠杆(按优先级递减):
- 上下文原语:repo-map / scaffolder / docstrings / test runner
- 自治程度:full-auto / approve-each-tool / ask-then-code / pair
- 工具选择:Claude Code / Cursor / Aider / Cline
- 范围纪律:/add 数量、token 预算上限、是否允许 free-roam
2.3 错误状态假设的代价
| 假设错 | 症状 | 损失 |
|---|---|---|
| 把 brownfield 当 greenfield | LM 编造路径、违反隐含约定、改错文件 | 1–3 小时回滚 + 信任度 |
| 把 greenfield 当 brownfield | 等不到 repo-map 帮忙(图是空的)、纠结要不要 /add | 启动成本 + 错失 scaffolder |
| 把 library 当一般 brownfield | 改了公共 API 没改 changelog、破坏外部用户 | 隐性 bug,回归测试才能发现 |
| 把 mid-size-familiar 当 brownfield-large | 过度加载文件 / 反复扫 repo-map / token 爆 | 浪费的不是错误,而是 慢 |
引用:Aider 自己声明,"For 'build me a new project from scratch' the repo-map is empty and the safety guarantees provide no marginal value." [aider-sop-skill/references/R4-anti-patterns.md §1] 引用:The General Partnership (2026):"legacy code doesn't come in neat, modular pieces… AI agent must learn the project's established patterns and not break things." [thegeneralpartnership.substack.com/p/a-practical-guide-to-brownfield-ai]
What ships with it
4 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.
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.
- 3mo ago First seen · 304 lines · 138 tokens per session scan A c732efecad0f
agentsop-repo-state-gating is a skill published in the GitHub repository agentsope/SkillAlchemy (513 stars, last pushed 22d ago), licensed MIT. It adds 138 tokens to every session and 4,669 once invoked, about $0.0006 per session on Opus 5.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.
agentsop-repo-state-gating compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| agentsop-repo-state-gatingagentsope/SkillAlchemy | Skill | 513 | 22d ago | MIT | A | 138 | Claude Code, Codex |
| shellgamesMemTensor/skills-vote | Skill | 309 | 2mo ago | MIT | A | 103 | Claude Code, Codex |
| curl-searchMemTensor/skills-vote | Skill | 309 | 2mo ago | MIT | A | 55 | Claude Code, Codex |
| skills-vote-localMemTensor/skills-vote | Skill | 309 | 2mo ago | MIT | A | 28 | Claude Code, Codex |
| skills-voteMemTensor/skills-vote | Skill | 309 | 2mo ago | MIT | C | 44 | Claude Code, Codex |
| xlsxMemTensor/skills-vote | Skill | 309 | 2mo ago | MIT | A | 201 | Claude Code, Codex |
| pdfMemTensor/skills-vote | Skill | 309 | 2mo ago | MIT | A | 92 | Claude Code, Codex |