agentsclimarketplace

Wire shape aligned budgeting

Skill vishuwa2004/cskill-agents/agents/codex/skills/wire-shape-aligned-budgeting

Build curated agent skills for coding CLIs, terminal tools, context engines, remote bridges, and multi-agent runtimes

Install
npx -y skills add vishuwa2004/cskill-agents --skill wire-shape-aligned-budgeting

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Keep each wire message’s aggregate tool_result size within the configured budget by compacting the largest fresh results first.

SKILL.md

2.4 KB, 433 tokens by cl100k_base, as published. Nobody here has run it

SKILL: Wire-Shape Aligned Budgeting

Domain: tool-result-budget Trigger: Apply this when building user messages that include multiple tool_result blocks to ensure the total stays under max tool results per message chars before the API call. Source Pattern: Distilled from reviewed tool execution, streaming, persistence, and output-budget implementations.

Core Method

Apply budgeting at the same level the wire protocol actually sends data: one outbound user message at a time. For each message, find the tool-result blocks that are eligible for replacement, immediately reapply any replacement decisions that were already frozen on earlier turns, and then compact the smallest number of newly oversized results needed to get under the limit. Persist or offload those large results, replace them with stable previews, and record the decision so retries, resumes, and forks keep producing the same message shape.

Key Rules

  • Treat replacement state as durable budgeting history; clone it for forks instead of mutating a shared object in place.
  • Skip non-text or explicitly exempt results rather than trying to compact binary or protected payloads.
  • Select new candidates by their original size, not by their preview size, so the algorithm removes the biggest pressure first.
  • Reapply the exact stored preview for previously compacted results so prompt-cache shape stays stable across turns.
  • Mark a decision durable at the same time you emit its preview so future turns do not re-decide the same result differently.

Example Application

If a single user message contains several large tool results, run this budgeting pass before the API call. The largest fresh results get persisted and replaced with previews until the message fits, while already-compacted results keep their exact prior preview text.

Anti-Patterns (What NOT to do)

  • Avoid touching a message twice in the same turn; a second pass would reapply replacements again and break prompt-cache determinism.
  • Don’t treat frozen IDs as fresh candidates; once a tool_result is seen, its fate is locked.
  • Don’t persist results that already fit the budget just to create extra records—compact only when the limit is exceeded.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.