context-budget-discipline
Context Budget Discipline
This skill single-sources the context-budget rules that long-running workflow hosts enforce during execution: when to reset a session, how to hand off state across a reset, and how to keep sub-agent returns bounded. Hosts thin-reference it; the threshold table, ledger format and recovery rules live here and are never copied into host bodies.
Token volume in an agentic loop is turns × context-size-per-turn, and the context re-send dominates the bill. An unbounded single-session lifecycle run is therefore a cost and correctness defect, not a style preference: recall degrades as the transcript grows (context rot), and every turn pays for the whole history again.
Iron Law
A single continuous session MUST NOT span a whole multi-phase lifecycle once projected context crosses the compaction threshold, and no reset MAY happen without a complete disk-ledger entry written first.
The Four Rules
1. Phase boundaries are reset evaluation points
At every major phase boundary of the host lifecycle (for example analysis → implement → verify → report, mapped to the host's own integer stages), evaluate a context reset:
- fresh session seeded from the ledger (preferred when the next phase needs little prior detail), or
- in-place compaction — summarize state to the ledger, then reopen a compact session (platform-agnostic intent; use whatever summarization the platform offers).