agentleFS
yuanJewelyuanJewel/skills/context-budget/SKILL.md

context-budget

Skill2 starsChanged 4 days agoMITView on GitHub

During an active AI session, measure context pressure, apply configurable proportional warning and handover limits, and close phases before context is lost. Checkpoint contents and recovery belong to context-handoff; cumulative cost estimates belong to estimation. Short Q&A needs no persistent budget file.

60 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use agent-payment-x402, openclaw-persona-forge and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • TironFoxSkill

    agent-payment-x402

    Add x402 payment execution to AI agents — per-task budgets, spending controls, and non-custodial wallets via MCP tools. Use when agents need to pay for APIs, services, or other agents.

    Also in 6 projects that use this

  • TironFoxSkill

    openclaw-persona-forge

    为 OpenClaw AI Agent 锻造完整的龙虾灵魂方案。根据用户偏好或随机抽卡, 输出身份定位、灵魂描述(SOUL.md)、角色化底线规则、名字和头像生图提示词。 如当前环境提供已审核的生图 skill,可自动生成统一风格头像图片。 当用户需要创建、设计或定制 OpenClaw 龙虾灵魂时使用。 不适用于:微调已有 SOUL.md、非 OpenClaw 平台的角色设计、纯工具型无性格 Agent。 触发词:龙虾灵魂、虾魂、OpenClaw 灵魂、养虾灵魂、龙虾角色、龙虾定位、 龙虾剧本杀角色、龙虾游戏角色、龙虾 NPC、龙虾性格、龙虾背景故事、 lobster soul、lobster character、抽卡、随机龙虾、龙虾 SOUL、gacha。

    Also in 5 projects that use this

  • loulanyueSkill

    nuxt4-patterns

    Nuxt 4 app patterns for hydration safety, performance, route rules, lazy loading, and SSR-safe data fetching with useFetch and useAsyncData.

    Also in 9 projects that use this

  • renepfSkill

    orch-pipeline

    Shared orchestration engine for the orch-* skill family. Defines the gated Research-Plan-TDD-Review-Commit pipeline, the size classifier, the agent map, and the two human gates that the orch-* operation skills delegate to. Not usually invoked directly.

    Also in 4 projects that use this

  • Exploration-labsSkill

    token-budget-advisor

    Proactive token budget assessment and task chunking strategy. Use this skill when queries involve multiple large file uploads, requests for comprehensive multi-document analysis, complex multi-step workflows with heavy research (10+ tool calls), phrases like "complete analysis", "full audit", "thorough review", "deep dive", or tasks combining extensive research with large output artifacts. This skill helps assess token consumption risk early and recommend chunking strategies before beginning work.

    Also in 11 projects that use this

  • loulanyueSkill

    santa-method

    Multi-agent adversarial verification with convergence loop. Two independent review agents must both pass before output ships.

    Also in 8 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

21 rules. 0 are common, 16 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 56 edited versions we read keep these.

  • 16

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use context-handoff for what to save, where to keep it and how to resume.

    line 11
  2. Distinctive:

    If unavailable, use the smallest evidenced window among applicable candidates and label it an estimate with its basis.

    line 17
  3. Distinctive:

    When either input is unknown, close phases and checkpoint before large operations without claiming a threshold was crossed.

    line 21
  4. Very specific:

    Use project warning R and working limit L.

    line 23
  5. Very specific:

    If the host auto-compacts at A, keep L strictly below A, lowering R as needed.

    line 25
  6. Distinctive:

    Before loading a large file or tool result, bound the read to relevant sections or a summary when the whole input could cross the limit.

    line 38
  7. Distinctive:

    If its size is unknown, choose bounded reads rather than treating it as safe.

    line 39
  8. Distinctive:

    Check in-flight execution first.

    line 46
  9. Distinctive:

    Follow context-handoff takeover rules to verify, wait or use already authorised controls.

    line 48
  10. Distinctive:

    Read back and verify that the checkpoint was saved before compaction or opening a replacement session.

    line 50
  11. Distinctive:

    No writable location, failed write or incomplete read-back -> retain current history and saved material, report the unsaved gap, and do not …

    line 51
  12. Distinctive:

    Use only an already authorised, supported host compaction or new-session mechanism.

    line 53
  13. Very specific:

    After one compaction, verify success and obtain a fresh reading.

    line 56
  14. Very specific:

    If pressure is still at or above R, use a new session through the same persistence and in-flight checks.

    line 57
  15. Distinctive:

    Use only permitted, visible telemetry.

    line 65
  16. Distinctive:

    Do not install hooks, change host configuration, poll in the background or assume this text controls host auto-compaction.

    line 67
  17. Distinctive:

    Do not create a second state store or expand authority to send messages, stop tools or launch sessions.

    line 68
  18. Very specific:

    No transition is complete while its execution state is unknown.

    line 71
  19. Distinctive:

    No directly adopted external source.

    line 76
  20. Distinctive:

    No scripts, hooks, absolute window sizes or host-specific guarantees are included.

    line 78
  21. Distinctive:

    No third-party license file is required.

    line 79

“Common” is measured: kept by at least 6 in 10 of the 56 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Context budget

Decide when to warn, save and continue with less context. Use context-handoff for what to save, where to keep it and how to resume; reuse the project's existing state entry.

Measure

  • Take the current model/session, effective window, latest occupancy reading and its sampling time/meaning, project thresholds, host compaction limits and in-flight state.
  • Window W: use the host's current display or applicable project configuration, accounting for host reservations. If unavailable, use the smallest evidenced window among applicable candidates and label it an estimate with its basis; no known minimum means unknown. Recalculate when the model, host or window configuration changes.
  • Occupancy C: use current context usage, not cumulative billing, subscription allowance, cache hit rate or child-agent usage. Missing, stale or post-compaction empty readings mean unknown, never zero; do not invent a percentage from message counts or intuition. When either input is unknown, close phases and checkpoint before large operations without claiming a threshold was crossed.
  • With compatible readings, pressure is C / W; label measured versus estimated values and keep their basis and sample time in existing state.
  • Use project warning R and working limit L; otherwise default to R = 0.60, L = 0.80, with 0 < R < L < 1. These are configurable working lines, not official model limits. If the host auto-compacts at A, keep L strictly below A, lowering R as needed. Reserve room for the checkpoint, output/reasoning and pending tool results; reaching the hard window is too late. Invalid thresholds or insufficient margin -> checkpoint now and report the gap; do not continue on an invalid budget. Unknown A -> record the uncertainty and checkpoint early; do not promise to precede host compaction.
  • Each parent and child session has its own window, readings and warning cycle; never pool them into one occupancy ratio.

Act at a useful boundary

  1. Warning: on first reaching R, report pressure, uncertainty, current phase and checkpoint location through the existing communication surface. Warn once per cycle, but always report escalation to L; reset the cycle after a verified successful transition or a confirmed model/window change. In unattended work, write the notice in authorised task state or the receipt and continue the applicable branch without waiting for a reply. A warning creates no approval step.
  2. Working limit: at L, or before an operation expected to cross it, open no new complex branch; reach a safe point and follow "Preserve before transition". Before loading a large file or tool result, bound the read to relevant sections or a summary when the whole input could cross the limit. If its size is unknown, choose bounded reads rather than treating it as safe.
  3. Phase complete: deliver verified results and refresh any needed continuation checkpoint even below R. A completed task ends normally; otherwise continue authorised work when capacity permits. Phase closure alone does not require compaction or a new session, and short Q&A creates no state file.

Preserve before transition

  1. Check in-flight execution first. A subtask or tool running or in an unknown state -> do not compact or change session. Follow context-handoff takeover rules to verify, wait or use already authorised controls; pressure grants no permission to stop work.
  2. Save through context-handoff to the project's authorised, successor-readable location. Read back and verify that the checkpoint was saved before compaction or opening a replacement session. No writable location, failed write or incomplete read-back -> retain current history and saved material, report the unsaved gap, and do not transition. A copyable continuation note may expose the gap; it is not proof of persistence.
  3. Use only an already authorised, supported host compaction or new-session mechanism. Without that capability, report the checkpoint entry and the remaining continuation action; never claim it ran. A saved checkpoint does not itself grant session-creation permission.
  4. After one compaction, verify success and obtain a fresh reading; never infer success or zero occupancy from a request acknowledgement. If pressure is still at or above R, use a new session through the same persistence and in-flight checks; do not compact repeatedly. An absent fresh reading remains unknown: retain the continuation entry and use phase-based closure, without retrying compaction in a loop. Failed compaction -> preserve the prior checkpoint and available history, report the actual state and use the supported continuation route.
  5. Resume through context-handoff, checking current facts and authorisation before work. Reset the cycle after a verified successful transition or a confirmed model/window change; retain cumulative cost records separately.

Boundaries and completion

Use only permitted, visible telemetry; do not read credential files or their contents to obtain measurements. Checkpoints must contain no secrets, passwords, authentication tokens or contents from credential paths; record safe evidence locators only. Do not install hooks, change host configuration, poll in the background or assume this text controls host auto-compaction. Do not create a second state store or expand authority to send messages, stop tools or launch sessions.

Completion means the notice or phase result and any required checkpoint are verifiable, with unknown readings, unsaved gaps and the next action explicit. No transition is complete while its execution state is unknown. Routine measurement suits low/low; uncertain capacity or transition failures suit normal/high, resolved through the project's resource mapping.

Sources

  1. No directly adopted external source; this package defines an own-authored proportional scheduling policy.
  2. Wording and decision flow are own-authored, pending host behaviour verification; general context-budgeting ideas inform the policy. No scripts, hooks, absolute window sizes or host-specific guarantees are included. Checkpoint and recovery contracts remain in context-handoff.
  3. No third-party license file is required; the root LICENSE applies.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.