Skip to main content
ContextBuilder — the compact per-turn working packet (§9). Assembles only what the model needs this turn: goal, phase, recent evidence (summaries, most-recent-first-budgeted), and the tools allowed for the current phase. The model discovers the repo incrementally through tools; it never receives the whole repository by default.

Classes

ContextBuilder

Builds the per-turn ContextPacket from TaskState under a fixed budget (§9). Evidence is compacted less-lossily (Phase 2.5): recent items keep full detail until a char budget is spent, older items degrade to their summary line (not dropped), the last N verifier outputs are pinned verbatim, and adjacent duplicates collapse to one ... (xN) line. Action history is cheap (one line each) so it is kept on a longer horizon than evidence. Args: detail_char_budget: Total chars of evidence detail shown verbatim before older items degrade to summary-only. max_detail_chars: Per-item detail truncation budget. max_evidence_lines: Hard cap on rendered evidence lines (newest kept). max_actions: Max prior-action lines to surface. verifier_pin_count: How many recent verifier outputs keep detail verbatim regardless of budget — a repair loop needs its recent failure history, not just the latest verdict.

ContextBuilder.build(self, state: TaskState, ws: Workspace, registry: ToolRegistry) -> ContextPacket

Assemble the working packet for the current turn from state (§9). Args: state: The task state, source of truth for the packet. ws: The run-scoped Workspace handle. registry: The ToolRegistry, for phase-active tools. Returns: The ContextPacket for this turn.

ContextPacket

The compact, per-turn working set assembled for one model decision (§9).
Fields

ToolSummary

A tool’s name, description, and input schema, as shown to the model.
Fields