From 7d09c48ae8488530b8eadb99a69841f26e25f9c3 Mon Sep 17 00:00:00 2001 From: Sisyphus Date: Thu, 25 Dec 2025 16:26:27 +0900 Subject: [PATCH] Enable dynamic tool output truncation by default (#225) - Changed truncate_all_tool_outputs default from false to true - Updated schema documentation to reflect new default - Added entry in README experimental features table - Regenerated JSON schema This prevents prompts from becoming too long by dynamically truncating output from all tool calls, not just whitelisted ones. Feature is experimental and enabled by default to help manage context window usage across all tools. Co-authored-by: sisyphus-dev-ai --- README.md | 1 + src/config/schema.ts | 2 +- src/hooks/tool-output-truncator.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 43be8b7..62a2857 100644 --- a/README.md +++ b/README.md @@ -887,6 +887,7 @@ Opt-in experimental features that may change or be removed in future versions. U | ------------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `aggressive_truncation` | `false` | When token limit is exceeded, aggressively truncates tool outputs to fit within limits. More aggressive than the default truncation behavior. Falls back to summarize/revert if insufficient. | | `auto_resume` | `false` | Automatically resumes session after successful recovery from thinking block errors or thinking disabled violations. Extracts the last user message and continues. | +| `truncate_all_tool_outputs` | `true` | Dynamically truncates output from all tool calls to prevent prompts from being too long. Helps manage context window usage across all tools, not just whitelisted ones. | **Warning**: These features are experimental and may cause unexpected behavior. Enable only if you understand the implications. diff --git a/src/config/schema.ts b/src/config/schema.ts index a50bcff..ef6229e 100644 --- a/src/config/schema.ts +++ b/src/config/schema.ts @@ -114,7 +114,7 @@ export const ExperimentalConfigSchema = z.object({ preemptive_compaction: z.boolean().optional(), /** Threshold percentage to trigger preemptive compaction (default: 0.80) */ preemptive_compaction_threshold: z.number().min(0.5).max(0.95).optional(), - /** Truncate all tool outputs, not just whitelisted tools (default: false) */ + /** Truncate all tool outputs, not just whitelisted tools (default: true) */ truncate_all_tool_outputs: z.boolean().optional(), }) diff --git a/src/hooks/tool-output-truncator.ts b/src/hooks/tool-output-truncator.ts index 7af9df2..b852103 100644 --- a/src/hooks/tool-output-truncator.ts +++ b/src/hooks/tool-output-truncator.ts @@ -24,7 +24,7 @@ interface ToolOutputTruncatorOptions { export function createToolOutputTruncatorHook(ctx: PluginInput, options?: ToolOutputTruncatorOptions) { const truncator = createDynamicTruncator(ctx) - const truncateAll = options?.experimental?.truncate_all_tool_outputs ?? false + const truncateAll = options?.experimental?.truncate_all_tool_outputs ?? true const toolExecuteAfter = async ( input: { tool: string; sessionID: string; callID: string },