Entropic 2.14.3
Local-first agentic inference engine
Loading...
Searching...
No Matches
context_fit.h File Reference

v2.13.0 prompt-vs-context admission arithmetic for one turn. More...

#include <cstddef>
#include <string>
Include dependency graph for context_fit.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  entropic::ContextFit
 One turn's irreducible prompt, measured against the tier budget. More...
 

Namespaces

namespace  entropic
 Activate model on GPU (WARM → ACTIVE).
 

Functions

bool entropic::context_fit_overflows (const ContextFit &f)
 Whether this turn's prompt cannot fit the tier's context at all.
 
int entropic::context_fit_history_tokens (const ContextFit &f)
 Tokens left over once system prompt and tool block are accounted.
 
std::string entropic::context_fit_largest_contributor (const ContextFit &f)
 Name the single largest contributor to the overflow.
 
std::string entropic::context_fit_breakdown (const ContextFit &f)
 Per-contributor token breakdown, as one clause.
 
std::string entropic::context_overflow_message (const ContextFit &f)
 The refusal an operator reads, carrying every number they need.
 

Detailed Description

v2.13.0 prompt-vs-context admission arithmetic for one turn.

Pure functions (no llama.cpp, no I/O) so the refusal decision and the operator-facing diagnosis are unit-testable on the CPU pre-commit tier. The backend supplies the measurements; this decides whether the turn can run and, when it cannot, says which knob the operator has to turn.

Found by the v2.13.0 release gate: a handle staged 27 tools (18,594 bytes) into a tier configured context_length: 2048, rendered a 5,026-token prompt, and llama.cpp answered every turn with Decode chunk failed (slot=0, start=287, off=1536, chunk=512) followed by Cache restore failed, falling back to full prefill. The engine then burned its empty-turn allowance on a prompt that could never have fitted. Same fail-open class as gh#95 and gh#154: the engine knew both numbers and proceeded anyway.

Version
2.13.0

Definition in file context_fit.h.