A greedy packer fills a token budget by priority density, under a total budget and per-category caps. Every token count is computed live from the real text.
Budgets
Token estimate: ceil(chars / 4), computed from the full text of each item.
Candidate pool
Assembled context
Nothing packed yet. Press Assemble context.
Overflow log
No overflow yet.
What this proves
Context is a budgeting problem, not a vibes problem: the harness counts tokens before the model ever sees them.
Priority density beats raw size: small, critical items (the pinned instruction) always survive the cut.
Overflow is explicit and explained, so a missing doc is a logged decision, never a silent truncation.
Simulated model, real harness. Built from Suraj Sharma's agentic AI engineering roadmap.