Skip to main content

Longer context can leave important constraints unused

PhaseImplementationRolesEngineer · ArchitectSeverityMediumApplies toAll LLMsEvidenceResearch

In one sentence: Fitting the whole repository into a window does not establish that I can use every part reliably. Effects depend on the model, task, position, and organization. Preserve necessary global evidence and verify that the important constraints were applied.

Symptom​

You give me twenty files and thousands of log lines. I miss “store amounts in integer cents” and fluently deliver a floating-point implementation. The material was present; the result still violated it.

Why this happens​

Research supports this risk without establishing a universal degradation curve. Lost in the Middle found position effects in its tested models on multi-document question answering and key-value retrieval, often with worse performance in the middle. Context Length Alone Hurts... tested five models on several tasks and observed length-related degradation even with perfect retrieval and irrelevant tokens masked.

These results distinguish nominal capacity from reliable use. “More tokens enlarge the attention denominator” cannot explain every result, nor establish that each new model must degrade in the same way. Diagnose missing materials, retrieval errors, compaction loss, and failure to use available evidence separately.

Consequences​

  • I miss a supplied constraint while “I gave it everything” weakens acceptance checks.
  • Irrelevant logs consume space and cost; adding more may not help.
  • Cutting callers or contracts just to shorten input creates a different information gap.

What to do instead​

Select relevant evidence and verify coverage; shortness is not the goal itself.

  • Locate code, failure output, and constraints, retaining references to original files. Cross-file refactors still need callers and shared contracts.
  • Label important requirements clearly and restate them in the current request where useful. Compare position, retrieval, and summary strategies on representative tasks.
  • Verify results with a constraint checklist or executable checks, rather than my claim to have read everything.
  • Use post-compaction recovery checks for related long tasks; consider a fresh session for unrelated work.
  • Keep persistent instructions concise; see CLAUDE.md overload, without omitting evidence needed for the task.

Example​

Before:

You: The whole directory and logs are above. Follow their requirements.
Me: I deliver floating-point amounts and miss the integer-cents requirement.

After:

You: Read the money model, amount constraints, and relevant callers; list unit conversions.
Use integer cents and check negative, boundary, and cross-interface cases.
Me: I confirm the referenced constraint and provide the implementation and check results.

When the exception applies​

Global consistency checks, long-document comparisons, and cross-module analysis may need substantial material. Index it, then retrieve complete relevant passages; expand the search when retrieval fails. Do not discard necessary context merely to save tokens, or assume pinning a rule guarantees compliance.

Version notes​

Verified 2026-10-29

The cited studies cover their tested models, tasks, and experimental settings, not every model and version. Rerun representative tasks after changing models, windows, or retrieval, recording quality, cost, and omissions.

Further reading and sources​