From bcfd5169a28f3a379ddb1e06f728aa5f2e4fcaff Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Fri, 6 Mar 2026 16:58:16 +0100 Subject: [PATCH] docs(coding-agent): document tool result truncation in compaction serialization --- packages/coding-agent/docs/compaction.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/coding-agent/docs/compaction.md b/packages/coding-agent/docs/compaction.md index daeaa434..2b34273a 100644 --- a/packages/coding-agent/docs/compaction.md +++ b/packages/coding-agent/docs/compaction.md @@ -262,6 +262,8 @@ Before summarization, messages are serialized to text via [`serializeConversatio This prevents the model from treating it as a conversation to continue. +Tool results are truncated to 2000 characters during serialization. Content beyond that limit is replaced with a marker indicating how many characters were truncated. This keeps summarization requests within reasonable token budgets, since tool results (especially from `read` and `bash`) are typically the largest contributors to context size. + ## Custom Summarization via Extensions Extensions can intercept and customize both compaction and branch summarization. See [`extensions/types.ts`](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/src/core/extensions/types.ts) for event type definitions.