# Zarządzanie oknem kontekstu

EN: **Context window management: placement, compaction and context rot** · id `contextmanagement` · aliases: context management, context compaction, context rot, lost in the middle, long-context prompting, kompakcja kontekstu, zarządzanie kontekstem

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Aplikacje LLM i agenci](https://aiatlasgraph.com/t/applications.md) › [Prompty i kontekst](https://aiatlasgraph.com/t/prompting.md) › Zarządzanie oknem kontekstu

## Description

- PL: Decydowanie, które tokeny i w jakiej kolejności trafiają do ograniczonego kontekstu: rozmieszczenie, przycinanie, streszczanie i notatki zewnętrzne.
- EN: Deciding which tokens enter a limited context and in what order: placement, trimming, summarisation and external notes.

## In one sentence

- PL: Model widzi naraz tylko ograniczoną ilość tekstu, więc trzeba wybierać, co mu podać, gdzie to umieścić i co skrócić.
- EN: A model sees only a limited amount of text at once, so you choose what to give it, where to place it and what to shorten.

## Problem it solves

- PL: W długiej rozmowie lub dużym dokumencie model zaczyna gubić ważne szczegóły, mylić fakty i zapominać wcześniejsze ustalenia.
- EN: In a long conversation or large document the model starts losing key details, mixing up facts and forgetting earlier decisions.

## What it does

- PL: Jak notatki na biurku przy dużym projekcie: trzymasz pod ręką tylko to, co teraz potrzebne, a resztę streszczasz i odkładasz do teczki.
- EN: Like the notes on your desk during a big project: you keep only what you need now within reach and summarise and file the rest.

## Everyday example

- PL: Po godzinie wspólnej pracy nad raportem asystent streszcza dotychczasowe ustalenia i zaczyna z czystym kontekstem, nie tracąc ważnych decyzji.
- EN: After an hour working on a report together, the assistant summarises what was decided and continues with a clean context, keeping key decisions.

## This concerns you if you…

- PL: prowadzisz z asystentem bardzo długie rozmowy
- PL: wklejasz duże dokumenty i dziwisz się pominiętym szczegółom
- EN: have very long conversations with an assistant
- EN: paste large documents and wonder why details get missed

## Keywords

context engineering · compaction · context rot · lost in the middle · needle in a haystack · tool result clearing · structured note-taking · token budget

## How it works

- PL: W długim lub przeładowanym kontekście modele mogą gorzej wykorzystywać część informacji, a badania wykazały m.in. słabsze użycie treści umieszczonej pośrodku wejścia. Stosuje się więc selekcję, kompresję, streszczenia, pamięć zewnętrzną i kontrolę kolejności informacji.
- EN: In long or overloaded contexts, models may use some information less effectively; studies have found, among other effects, weaker use of content placed in the middle of the input. Systems therefore use selection, compression, summaries, external memory, and deliberate information ordering.

## Limits

- PL: Streszczenie może wyrzucić szczegół, który okaże się potem kluczowy, a każda kompakcja to dodatkowe wywołanie i koszt. Zachowanie przy długim kontekście różni się między modelami, więc strategie trzeba mierzyć, a nie przyjmować na wiarę.
- EN: A summary may drop a detail that later proves crucial, and each compaction is an extra call and cost. Long-context behaviour differs between models, so strategies must be measured, not taken on faith.

## Key terms

- PL: **context rot**: Spadek trafności modelu wraz ze wzrostem długości kontekstu.
- PL: **kompakcja**: Zastąpienie długiej historii jej zwięzłym streszczeniem.
- PL: **lost in the middle**: Słabsze wykorzystanie informacji umieszczonych w środku długiego wejścia.
- EN: **context rot**: Model accuracy dropping as context length grows.
- EN: **compaction**: Replacing long history with a concise summary.
- EN: **lost in the middle**: Weaker use of information placed mid-way through a long input.

## Know first

- [Wydłużanie okna kontekstu (Context window extension)](https://aiatlasgraph.com/t/contextextension.md)
- [Pamięć i stan (Memory and state)](https://aiatlasgraph.com/t/memory.md)

## Related topics

Untyped, symmetric "see also" links.

- [Odpowiedzi oparte na literaturze i zaleceniach medycznych (RAG) (Retrieval-augmented generation for medicine)](https://aiatlasgraph.com/t/medicalrag.md)
- [Orkiestracja subagentów (Subagent orchestration)](https://aiatlasgraph.com/t/subagents.md)
- [Pamięć i stan (Memory and state)](https://aiatlasgraph.com/t/memory.md)
- [Przekazanie pracy między sesjami (Cross-session handoff for agents)](https://aiatlasgraph.com/t/sessionhandoff.md)
- [Stopniowe wczytywanie umiejętności (Progressive disclosure of skills)](https://aiatlasgraph.com/t/skilldisclosure.md)
- [Uprząż agenta (Agent harness)](https://aiatlasgraph.com/t/agentharness.md)

## Sources

- [Prompting best practices (Claude Docs)](<https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices>) `claude-prompting-best-practices` · by Anthropic · sponsored
- [Effective context engineering for AI agents](<https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents>) `anthropic-context-engineering-2025` · by Anthropic (Applied AI team) · sponsored
- [Lost in the Middle: How Language Models Use Long Contexts](<https://arxiv.org/abs/2307.03172>) `lost-in-the-middle-2023` · by Nelson F. Liu, Kevin Lin, John Hewitt, Ashwin Paranjape, Michele Bevilacqua, Fabio Petroni, Percy Liang

---

AI Atlas revision 122 (2026-10-30) · HTML: https://aiatlasgraph.com/t/contextmanagement · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-10-30
