From 51aa1339ef1ef29d9ffe883e2094863a417d8ba5 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Wed, 24 Dec 2025 12:49:45 +0100 Subject: [PATCH] Add LLM context diagram to compaction docs --- packages/coding-agent/docs/hooks.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/coding-agent/docs/hooks.md b/packages/coding-agent/docs/hooks.md index d1bc4e6f..943fde7d 100644 --- a/packages/coding-agent/docs/hooks.md +++ b/packages/coding-agent/docs/hooks.md @@ -211,6 +211,17 @@ After compaction (new entry appended): The session file is append-only. When loading, the session loader finds the latest compaction entry, uses its summary, then loads messages starting from `firstKeptEntryIndex`. +``` +What gets sent to the LLM as context: + + ┌─────────────────────────────────────────────────────────────┐ + │ [system prompt] [summary msg] [msg idx 5] [msg idx 6] [msg idx 7] │ + └─────────────────────────────────────────────────────────────┘ + ↑ └───────────┬───────────┘ + from NEW compact's messages from + summary firstKeptEntryIndex onwards +``` + **Event fields:** | Field | Description |