← 返回开源 Skills
OPEN-SOURCE SKILL · token-budget-guard

token-budget-guard — 多 Agent 守缓存与防拆单套娃 Skill

适合同时跑多个并行 Agent 的项目,放到 .claude/skills/token-budget-guard/SKILL.md 中,在协调会话开工时加载。

推荐存放路径: .claude/skills/token-budget-guard/SKILL.md

---
name: token-budget-guard
description: Token and coordination discipline for parallel multi-agent workflows. Preserves 1-hour Prompt Cache, prevents multi-generation ticket splitting, and keeps worker reports concise.
---

# Multi-Agent Token Budget Guard

## 1. Protect the 1-Hour Prompt Cache
- Pin the coordinator session to a single primary model for its full lifecycle. Do not switch models or toggle MCP tool definitions mid-session (doing so busts Prompt Cache immediately).
- Delegate rare hard edge cases to a one-off higher-tier subagent instead of upgrading the coordinator.
- Keep scheduled wakeup intervals at **<= 55 minutes** so recurring checks land inside the 1-hour cache TTL.
- Hand off the coordinator around **~300K context tokens**—not too early (avoids paying ~100K cold-start tax repeatedly) and not too late.

## 2. Keep Contexts Isolated & Short
- Start a **fresh session** for every distinct ticket; never extend an unrelated old thread.
- Run codebase search and log inspection in lightweight read-only subagents.
- Cap every worker completion report to **<= 10 lines** (status, PR/commit link, verification result, blockers). Never paste raw API JSON or full logs into the coordinator.

## 3. Split Threshold & Risk-Tiered Sign-Off
- Never split trivial cleanup that can be finished in the current session.
- **Max 1 generation**: a follow-up ticket may not spawn another follow-up ticket.
- Non-semantic text/typo edits in acceptance docs self-approve with the PR; only semantic, money, or permission changes require central sign-off.