subagent-execution-governance

subagent-execution-governance is a skill for Claude Code, Codex from ooooooooooooooooooop/agent-tools. It costs 200 tokens per session (5,314 once invoked), scanned A, original, MIT.

A set of rules for assigning coding work to subagents, which are separate AI workers. It separates discovery, planning, implementation, and validation, and limits what each worker may read and write.

In plain words
What is it for?
Planning subagent work, defining file ownership, setting reading and token limits, reviewing implementation results, validating changes, and repairing interrupted assignments.
Why use it?
It prevents agents from exploring indefinitely, editing the same files, or consuming large amounts of context without producing a usable result. Clear ownership and exit conditions make blocked work easier to identify and recover.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/ooooooooooooooooooop/agent-tools/subagent-execution-governance
Any agent
npx skills add ooooooooooooooooooop/agent-tools --skill subagent-execution-governance
Clone the repo
git clone --depth 1 https://github.com/ooooooooooooooooooop/agent-tools

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 subagent-execution-governance

README.md
[![agentmods](https://agentmods.dev/badge/skills/ooooooooooooooooooop/agent-tools/subagent-execution-governance.svg)](https://agentmods.dev/skills/ooooooooooooooooooop/agent-tools/subagent-execution-governance)
Your own site
<a href="https://agentmods.dev/skills/ooooooooooooooooooop/agent-tools/subagent-execution-governance"><img src="https://agentmods.dev/badge/skills/ooooooooooooooooooop/agent-tools/subagent-execution-governance.svg" alt="Measured on agentmods" height="20"></a>
Per session 200 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,314 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00200 $0.05314
Opus 5 $0.00100 $0.02657
Sonnet 5 $0.00040 $0.01063
Haiku 4.5 $0.00020 $0.00531

Measured today against content hash db3ba9c54c44, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

subagent-execution-governance 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 today.

The scan reads SKILL.md. This mod also ships 3 executable files (scripts/session-discipline-audit.js, scripts/splice-ab-experiment.js, scripts/workflow_preflight_router.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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/subagent-execution-governance/SKILL.md · 310 lines

How it starts

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

子代理执行治理(Subagent Execution Governance)

本 skill 由一次真实实现会话审计(session-33b69ec9-1abf-454d-9555-f2d4031a9453)提炼而成。那次会话 3 小时、17 个子代理、执行层消耗 309 万输入 token(主会话 4 倍),b21b9211 一个子代理读了 65 个文件后仍被催"直接实现",主会话被迫 28 次 send_message 催促 + 8 次 interrupt_agent,最终目标未 complete、会话中途悬死。根因不是"监督不够凶",而是子代理的工作边界、信息边界、写权限和退出条件没有工程化。

核心原则

不要从"自由探索"直接走向"实现代理完全失去自主权";正确形态是 契约驱动 + 有界自治 + 结构化升级

目标不是"主代理不断管子代理",而是 系统规则让正常子代理根本不需要被管

失败因果链(本 skill 要打断的):

任务设计错误(探查/实现不分)
  → 执行边界过宽(无限读取授权)
  → 监督不得不频繁介入(催促/中断/重派)
  → send_message / interrupt 注入上下文
  → 上下文继续膨胀 → 缓存命中率恶化 → token 爆炸

一、角色分离(Discovery → Contract → Implementation → Validation)

禁止让一个子代理同时承担"先研究、再实现、再测试"四种认知模式:

角色 产出
Discovery(探查) 自由只读 禁止 契约快照草案(≤15 条 file:line 事实)
Contract Builder(主会话) 验证契约 写契约文件 最终契约快照(含负空间)
Implementation(实现) 有界读取(三级) 只写自有文件 代码 + 变更清单 + 状态
Validation(验证) 只读目标文件/测试 禁止(或只改测试) 测试结果 + 差异报告

主会话承担 Contract Builder 与 Orchestrator:探查结果必须经主会话验证、确认文件无冲突、写入契约快照后,才能派实现子代理。禁止探查子代理直接产出实现任务。

二、契约快照(Implementation Contract)

每个实现子代理派发前必须有一份契约快照,包含正空间和负空间

GOAL:           一句话目标(可验收)
OWN:            本子代理独占写入的文件(单写者)
MAY READ:       自动允许读取的文件/目录白名单
REFERENCE:      参考实现文件(读但不改)
IN SCOPE:       允许做的事
OUT OF SCOPE:   禁止做的事(防 scope creep)
MUST PRESERVE:  必须保持不变的现有行为/API
MUST NOT:       禁止触碰的模块/文件/顺手重构/兜底路径
EXIT:           完成条件(确定性可判)
BLOCKED:        允许升级阻塞的场景(仅限契约外信息缺失)

负空间(OUT OF SCOPE / MUST NOT)是防"模型顺手优化"最有效的手段,必须有,且比正空间更具体

三、读取策略:三级有界读取(不是"只写不读")

实现子代理不自由探索仓库,但保留必要自治——三级读取权限

Level 0 — 自动允许(无预算消耗)
  目标文件、契约快照、指定参考实现、直接测试文件

Level 1 — 有预算的自主读取(最多 N 个额外文件,需带 reason code)
  API_SIGNATURE_UNKNOWN       类型/签名未知
  TEST_EXPECTATION_UNKNOWN    测试预期未知
  TYPE_DEFINITION_REQUIRED    需要类型定义

Level 2 — 需要升级(禁止自主执行)
  跨模块架构探索、repo-wide grep、超过预算、发现契约错误
  → 走结构化 BLOCKED,不自行扩大范围

不要把读的决策权全部收归主会话(会变成"主代理当 I/O 调度器"的 ping-pong);也不要完全放开(会回到无限探索)。Level 1 的 reason code 让升级可观测、可审计。

Read the full file on GitHub · 310 lines

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. today Changed · +30 lines db3ba9c54c44
  2. 5d ago First seen · 280 lines · 200 tokens per session scan A 53180498ca98

Subscribe to this mod's changes

subagent-execution-governance is a skill published in the GitHub repository ooooooooooooooooooop/agent-tools (3 stars, last pushed today), licensed MIT. It adds 200 tokens to every session and 5,314 once invoked, about $0.0010 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-31.

Related

Other skills, from other repositories