agentsop-repo-state-gating

agentsop-repo-state-gating is a skill for Claude Code, Codex from agentsope/SkillAlchemy. It costs 138 tokens per session (4,669 once invoked), scanned A, original, MIT.

A short repository check that classifies a codebase as new, large and existing, medium-sized, or a library or SDK. A repository is the project's files and version history; an SDK is code other developers use.

In plain words
What is it for?
Use it when first entering a repository or after its structure changes to choose an agent strategy, context method, tool, and level of autonomy.
Why use it?
The right coding-agent approach depends on the project's shape, so this check helps avoid using too much context or the wrong tool.

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 Use it when first entering a repository or after its structure changes to choose an agent strategy, context method, tool, and level of autonomy.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/agentsope/skillalchemy/agentsop-repo-state-gating
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-repo-state-gating
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-repo-state-gating

README.md
[![agentmods](https://agentmods.dev/badge/skills/agentsope/skillalchemy/agentsop-repo-state-gating/github.svg)](https://agentmods.dev/skills/agentsope/skillalchemy/agentsop-repo-state-gating)
Your own site
<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.

agentmods 80×15 button for agentsop-repo-state-gating

Your own site · 80×15
<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>
Per session 138 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,669 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. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
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]
How audits are shown
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.00138 $0.04669
Opus 5 $0.00069 $0.02335
Sonnet 5 $0.00028 $0.00934
Haiku 4.5 $0.00014 $0.00467

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

Security

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 12d 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-repo-state-gating/SKILL.md · 304 lines

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 环  | 破坏向后兼容

四个杠杆(按优先级递减):

  1. 上下文原语:repo-map / scaffolder / docstrings / test runner
  2. 自治程度:full-auto / approve-each-tool / ask-then-code / pair
  3. 工具选择:Claude Code / Cursor / Aider / Cline
  4. 范围纪律:/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]

Read the full file on GitHub · 304 lines

Files

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.

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. 12d ago First seen · 304 lines · 138 tokens per session scan A c732efecad0f

Subscribe to this mod's changes

agentsop-repo-state-gating is a skill published in the GitHub repository agentsope/SkillAlchemy (396 stars, last pushed 10d ago), licensed MIT. It adds 138 tokens to every session and 4,669 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