From 5fe66a5803fc93419b21a7d8c88b14cdc50fdc3a Mon Sep 17 00:00:00 2001 From: fujie Date: Wed, 11 Mar 2026 12:38:06 +0800 Subject: [PATCH] feat(async-context-compression): upgrade summary prompt to Working Memory architecture - Redefine summary task as 'Working Memory' generation for higher density - Add explicit instructions to extract facts from raw JSON tool outputs - Implement 'Incremental Integration' rule to prevent recursive summary degradation - Enforce strict Markdown state structure (Goal, Facts, Code, Pending) --- .../async_context_compression.py | 153 ++++++++++-------- 1 file changed, 89 insertions(+), 64 deletions(-) diff --git a/plugins/filters/async-context-compression/async_context_compression.py b/plugins/filters/async-context-compression/async_context_compression.py index 51bf7a2..fcdf0b3 100644 --- a/plugins/filters/async-context-compression/async_context_compression.py +++ b/plugins/filters/async-context-compression/async_context_compression.py @@ -1516,27 +1516,31 @@ class Filter: "index": index, "role": message.get("role", "unknown"), "has_tool_calls": bool(isinstance(tool_calls, list) and tool_calls), - "tool_call_count": len(tool_calls) - if isinstance(tool_calls, list) - else 0, - "tool_call_id_lengths": [ - len(str(tc.get("id", ""))) - for tc in tool_calls[:3] - if isinstance(tc, dict) - ] - if isinstance(tool_calls, list) - else [], + "tool_call_count": ( + len(tool_calls) if isinstance(tool_calls, list) else 0 + ), + "tool_call_id_lengths": ( + [ + len(str(tc.get("id", ""))) + for tc in tool_calls[:3] + if isinstance(tc, dict) + ] + if isinstance(tool_calls, list) + else [] + ), "has_tool_call_id": isinstance(message.get("tool_call_id"), str), - "tool_call_id_length": len(str(message.get("tool_call_id", ""))) - if isinstance(message.get("tool_call_id"), str) - else 0, + "tool_call_id_length": ( + len(str(message.get("tool_call_id", ""))) + if isinstance(message.get("tool_call_id"), str) + else 0 + ), "content_type": type(content).__name__, "content_length": len(content) if isinstance(content, str) else 0, "has_tool_details_block": isinstance(content, str) and '