ai/cursor/tech-team/skills/context-budget-guard/SKILL.md
Heuristic context budget checks using file-size and count proxies — integrates with context-cache-discipline; no tokenizer introspection claims.
npx skillsauth add akshay-na/dotfiles context-budget-guardInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill before major reads, large merges, or multi-tool bursts when you need a cheap, model-agnostic signal that the session is approaching an unsafe context load.
context-cache-discipline first. This skill does not duplicate that material.mandatory-delegation.mdc) still governs who may do work inline vs Task.Maintain a running estimated_units for the current turn (reset per user turn unless your orchestrator policy says otherwise). Units are not tokens — they are comparable weights for relative overload only.
| Signal | Add to estimated_units |
|--------|-------------------------|
| File read (full file in context) | file_size_bytes / 4 (floor 1 per file) |
| Tool call with substantial returned body | 500 × number of such calls (cap each call’s contribution at 8000 unless you have byte counts) |
| Sub-agent YAML envelope (in parent context) | 200 per envelope merged |
| Plan or long rule file read | line_count * 8 (floor 80 for any file >10 lines) |
Large-file shortcut: if a file is >500 lines OR >40 KiB, treat as high-risk for coordinator inline work — prefer Task to a scoped sub-agent even before summing units.
Let U = estimated_units. Let W = a notional window proxy chosen conservatively:
W = 1_000_000 units (~order-of-magnitude stand-in for “large context”; tune per platform using observability in later phases).U > 0.40 * W before the next large action → prefer delegation (Task a sub-agent with a tight brief) rather than pulling more bulk into the coordinator.U > 0.80 * W after an action → force-delegate the remainder: coordinator stops bulk work; Task fresh sub-agent(s) with shard ids + disjoint touches[].If you cannot estimate W, use the large-file shortcut + 40%/80% as relative triggers: crossing 40% of a session-local baseline you set at turn start (e.g. sum of first three tool returns) means slow down and delegate; 2× that baseline ≈ 80% emergency path.
U for planned reads; if a single read would jump U over 40% of W (or 2× baseline), Task instead.subagent-response-protocol).Tasks with smaller payloads.When estimated_units crosses bands defined in memory-demotion.yml → context_demotion (40% / 80% proxies aligned with this skill):
W: reduce L2/L3 KB reads; prefer L0/L1 + delegation.fresh_eyes session flag.Load ladder details from brain-memory-kb; do not invent parallel retention integers in this skill.
Thresholds are initial. Prefer agent-observability + org observability phases to compare proxy U vs observed session behavior and tune W / multipliers — no false precision.
development
Discovery + naming convention reference for typed dev/SME/QA/devops team members in any workspace folder. Primary consumer: `tech-lead` (org-tier).
devops
Automated task classification, agent selection, and state tracking. Use when routing tasks to agents, selecting pipelines, or managing task state.
testing
Use when designing scalable systems, evaluating consistency models, planning state management, making architectural decisions, or when trade-offs around coupling, failure isolation, and reversibility need explicit reasoning before implementation.
tools
CTO/tech-lead helper — split work into disjoint shard briefs with caps (instance_cap, partition_basis, determinism keys).