MEMORY

Context Management

Long-running tasks can exceed a model context window. ChemAgent estimates context use, reserves capacity for new output, and compresses older material when configured limits are approached.

Context budget

  • Configured maximum

    The deployment sets the maximum context tokens available to the agent.

  • Reserved capacity

    Part of the window remains available for the next request and model output.

  • Structured estimation

    Text, images, tool arguments, and tool results contribute differently to the estimate.

Compression workflow

  1. 1
    Detect pressure

    Current turns and the system prompt approach the available budget.

  2. 2
    Preserve recent work

    The most relevant recent turns remain in active context.

  3. 3
    Summarize older work

    Discarded material is summarized and persisted to daily memory.

  4. 4
    Continue the session

    The retained context receives the summary needed for continuity.

Limits

Compression is lossy

Important engineering facts, approvals, and source references should be stored explicitly in project documents or durable knowledge rather than relying on conversation compression alone.