Skip to content
Tutorial / Step 11

Manage Context with Compaction, Sessions, and Forks

Preserve decisive facts, remove noise, and isolate alternate work paths.

Answer in brief

Preserve decisive facts, remove noise, and isolate alternate work paths.

More context is not always better. Repeated logs and discarded designs compete with the contract, code evidence, and unfinished work.

Separate Three Kinds of State

InformationHome
Conversation factsSession events
Current task stateStructured checkpoint
Long-lived project knowledgeProject docs or Skills

DeepSeek Harness compaction is optional. It can run under pressure or confirmed overflow, or be triggered manually while idle. A successful operation replaces a safe visible range with a summary while durable start, summary, and end events retain accounting and traceability.

Important boundaries:

  • a summary is a new visible checkpoint, not proof that original events vanished;
  • tool calls and results must remain paired at range boundaries;
  • large tool results may be deterministically pruned first;
  • failed attempts remain diagnosable instead of claiming completion.

A Durable Checkpoint

Goal:
Immutable constraints:
Confirmed facts with evidence:
Completed and verified:
Current changes:
Ordered next actions:
Open risks:

Remove detail from rejected proposals, but keep the decisive reason so future work does not repeat them.

New Session or Fork?

Start a new session when the objective changes, the old work is complete, logs are mostly irrelevant, or you need an unbiased review. Send a minimal handoff: goal, scope, state, key files, verification, and open questions.

Fork when two approaches share the same known baseline. Compare their diffs, evidence, risk, and migration cost. A session fork is not automatically a Git branch or isolated filesystem; avoid concurrent edits to the same workspace without explicit isolation.

Practice by compressing a long task into a 300-word handoff, continuing in a fresh session, and checking whether the Agent can restate every critical constraint.

Next: Skills and Project Memory.

Primary sources