ObservationPack and folded results

The idea

A tool result of 10 KiB or more is stored whole. The step keeps the head, the tail and exact diagnostic anchors. Older results fold to one recall line, and the worker can read exact pages back.

The problem
Large tool outputs filled the context and were sent again on every turn.
Why it matters
The worker sees what matters and can recall the exact original, and failures stay whole.
Where it stands
In production as of

A step-by-step replay of this idea is not published yet. The library adds one when a recorded run shows it.

  • Cache-aware online compaction

    The main line compacts at a finished plan step only when the estimated cache-read savings are larger than the cost to rewrite, fold and carry.

  • Evidence-preserving log reducer

    For a long log that no parser read, a fast model proposes a short receipt. Code checks its hash, exit status and exact quotes before use, and the last 20 lines stay as they are.

  • Context contract per role

    Each model call carries only its role's layers, in a fixed order. People's messages enter as task state with their ids. Budgets are kept by folding and ranking, never by cutting the prefix.

  • Action fusion: edit plus check

    An edit can carry its planned check. The runtime runs the check as its own gated call in the same model turn.

  • Byte-stable prefix, one session per ticket

    The prefix stays reusable: one prompt and tool catalog per item, stage notes appended to the transcript, the model held within a stage, and cache breakpoints per provider. Claude Code runs as one live process.

Turn the numbers into shipped work.

Crewshal runs these choices for you: a persistent AI worker with memory and rules, on your Claude and Codex subscriptions.