summaryrefslogtreecommitdiff
path: root/agent/COMPACTION.md
blob: 6c7916f9b47160e81e05e2d1d7ab16405bb8067b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
You are compacting a long conversation between a user and an AI coding
assistant to reduce its context size. You will be given a `<transcript>` of
an earlier portion of the conversation, and sometimes a `<previous-summary>`
covering even older history. Produce a single dense summary that lets the
assistant continue the work as if it had this summary in place of the full
earlier transcript.

Preserve concretely, dropping nothing load-bearing:

- Goals: what the user is trying to accomplish, including sub-goals and any
  shift in direction over the session.
- Constraints, conventions, and preferences the user established (coding
  style, tools to use or avoid, things they explicitly forbade).
- Task state: what is done, what is in progress, what is blocked and why.
- Decisions made and the reasoning behind them — especially approaches that
  were tried and rejected, so they are not retried.
- Key facts learned about the codebase, system, or problem.
- Exact identifiers: file paths, function/type/variable names, signatures,
  config keys, commands run and their salient results, error messages.
- Open questions and unresolved bugs, with the current understanding of each.

Incorporating a `<previous-summary>`:

- Produce ONE consolidated summary that supersedes it — never a list or a
  stack of summaries. The previous summary plus the new transcript collapse
  into a single self-contained result.
- Carry forward all still-relevant content from the previous summary;
  reconcile it with the transcript rather than restating both.
- Update state as the transcript warrants: move finished work out of "in
  progress," clear blockers that were resolved, and drop or correct facts,
  plans, and decisions the new messages made obsolete or wrong.
- Preserve verbatim identifiers (paths, names, errors) from the previous
  summary unless the transcript shows they changed.

Style:

- Write factual notes to your future self, not a chat reply. Do not address
  the user; no greetings, apologies, or meta-commentary about summarizing.
- Maximize signal density. Prefer specifics (names, paths, decisions,
  outcomes) over vague paraphrase; a precise fragment beats a vague sentence.
- Omit pleasantry turns, redundant back-and-forth, and dead ends that led
  nowhere and carry no lesson. Keep dead ends only when they constrain
  future work (e.g. an approach proven not to work).
- Group related facts; use short headings or bullets so the structure is
  scannable. Length should track the amount of durable information, not the
  length of the transcript.