Summary invents a decision
Detect: Generated summary disagrees with recorded approval.
Recover: Use authoritative decision fields and validate summary claims.
Allocate finite model context to the evidence and state that matter, preserving constraints and enough capacity for a complete response.
Context window optimization selects, compresses, and orders information within a model’s input and output limits. A large supported window does not imply that every included token contributes equally to answer quality. Long histories can add irrelevant detail, conflicting instructions, and substantial prefill cost.
The useful abstraction is a context budget with protected and optional segments. System constraints, current task facts, and indispensable evidence receive explicit allocation; old dialogue and redundant retrieval receive selective retention or summarization. Summaries are derived artifacts and should retain provenance, unresolved decisions, and links to recover original detail.
A prototype measures token use and answer quality as conversation length grows.
Production reserves output capacity, compacts history at defined thresholds, and tests whether critical facts survive compaction.
Enterprise scale tracks budget use by task, supports versioned summaries, and evaluates long-context alternatives against retrieval and selective reconstruction.
Counts the actual request format using the selected model’s tokenizer or supported estimate.
Reserves mandatory policy, current task, evidence, and output capacity.
Produces bounded summaries with source references and unresolved commitments.
Removes duplication and chooses passages supporting the requested answer.
Tests fact retention, contradiction handling, and response completeness.
flowchart TD
H["Long conversation history"] --> S["Versioned summary"]
E["Retrieved passages"] --> D["Deduplicate and select"]
P["Mandatory policy and current task"] --> B["Context allocator"]
S --> B
D --> B
B --> O["Reserved output capacity"]
B --> V["Token and fact-retention check"]
V --> M["Model request"]Classify candidate segments by trust, freshness, relevance, and required retention.
Allocate mandatory instructions and an adequate output budget before optional text.
Keep passages covering distinct answer requirements rather than merely the highest similarity scores.
Summarize older dialogue while preserving decisions, identifiers, and unresolved obligations.
Count serialized tokens and confirm protected facts and constraints remain present.
Retrieve original records if a later task requires information omitted by compaction.
Engineering services · Illustrative enterprise scenario, not a reported customer outcome.
A design assistant follows weeks of decisions about an industrial control upgrade.
Old alternatives and repeated documents crowd out current constraints and requested analysis.
Preserve approved decisions and unresolved questions without resending every turn.
A decision ledger and versioned conversation summary feed a context allocator with targeted source retrieval.
If the summary conflicts with the authoritative decision ledger, the ledger wins and the summary is rebuilt.
Measure retained-constraint accuracy, input tokens, and complete-answer rate; shrinking the prompt is useful only if required reasoning evidence survives.
| Decision | Benefit | Cost |
|---|---|---|
| Aggressive summarization | Reduces recurring context cost. | Can lose details or distort commitments. |
| Larger windows | Retain more original evidence. | Increase latency and do not guarantee effective use. |
| On-demand reconstruction | Restores omitted detail selectively. | Adds retrieval and state-management complexity. |
Detect: Generated summary disagrees with recorded approval.
Recover: Use authoritative decision fields and validate summary claims.
Detect: Responses end before required sections complete.
Recover: Reserve output capacity and reduce optional input.
Preserve commitments and durable identifiers explicitly.
Retain source links and recover originals.
Evaluate task quality and constraint retention.