You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Count-based microcompact rewrites live tool results on a fixed cadence that has nothing to do with token pressure. On any turn with more than ~10 compactable tool calls, the agent wipes earlier observations and the model starts re-running the same commands. Hosts (AionUi / AionCore) surface this as a repeating Microcompact: cleared 6 tool results tip until the context is burned.
This is still the default behavior on v0.2.11, which is the tag currently pinned by AionCore / AionUi (aioncoreVersion: "v0.2.1"). I know PR #266 later disabled legacy microcompact on main and replaced it with tool_output_max_bytes; this issue is to (1) get that change into the tag hosts actually ship, and (2) fix the remaining footguns if microcompact_enabled is turned back on.
Environment
aionrs: v0.2.11 (AionCore git dependency)
Host: AionUi Desktop, aionrs / Aion CLI backend
Model: Qwen-class (observed with Qwen3.8-27B)
Trigger: attach a large Office/PDF and ask the agent to read or summarize it
Symptoms
The transcript ends in an unbounded tool loop. The UI tip is almost always exactlyMicrocompact: cleared 6 tool results.
Converted files were already on disk (e.g. api_doc.md ~151KB). Later ls results were still live, but the model kept re-listing and re-converting.
Prompt rules (“do not re-run after Microcompact, read the file instead”) did not stop it.
A 24K-token session compacted 16 times. A 77K-token session compacted 0 times (tools not in the compactable set). This is not a context-window overflow.
live compactable tool_result count > micro_keep_recent * 2
Defaults: micro_keep_recent = 5 → fire when live results > 10.
Then microcompact keeps the 5 most recent live results and replaces older Read / ExecCommand / Grep / Glob / Write / Edit bodies with [Tool result cleared]. Thinking and assistant text are not touched. Token usage and context_window are not consulted.
Steady state:
11 live results → clear 6 → keep 5 → grow to 11 → clear 6 again
That is why the tip is always cleared 6. Any task longer than ~10 tool steps loses its earlier observations, so the model retries.
Docs still describe this as designed (docs/advanced.md on the v0.2.11 line: count > 10 or a 1-hour gap).
Config merge footgun (hosts cannot raise the default cleanly)
AionCore passes project_dir = conversation workspace and forwards config.compact through resolve_aionui_config. aionrs Config::resolve reads <workspace>/.aionrs.toml.
When merging a project [compact] block, if context_window is still the crate default 200000 and enabled is not false, the entire project compact section is discarded. Hosts that write:
[compact]
micro_keep_recent = 80
get a no-op unless they also change context_window to something other than 200000 (we used 131072).
That changes the trigger from “> 10 live results” to “> 160” and avoids the merge discard. It is a host-side band-aid, not a substitute for fixing the trigger.
Summary
Count-based microcompact rewrites live tool results on a fixed cadence that has nothing to do with token pressure. On any turn with more than ~10 compactable tool calls, the agent wipes earlier observations and the model starts re-running the same commands. Hosts (AionUi / AionCore) surface this as a repeating
Microcompact: cleared 6 tool resultstip until the context is burned.This is still the default behavior on v0.2.11, which is the tag currently pinned by AionCore / AionUi (
aioncoreVersion: "v0.2.1"). I know PR #266 later disabled legacy microcompact onmainand replaced it withtool_output_max_bytes; this issue is to (1) get that change into the tag hosts actually ship, and (2) fix the remaining footguns ifmicrocompact_enabledis turned back on.Environment
Symptoms
Microcompact: cleared 6 tool results.api_doc.md~151KB). Laterlsresults were still live, but the model kept re-listing and re-converting.A 24K-token session compacted 16 times. A 77K-token session compacted 0 times (tools not in the compactable set). This is not a context-window overflow.
Root cause
crates/aion-agent/src/compact/micro.rs(count_trigger):Defaults:
micro_keep_recent = 5→ fire when live results > 10.Then
microcompactkeeps the 5 most recent live results and replaces olderRead/ExecCommand/Grep/Glob/Write/Editbodies with[Tool result cleared]. Thinking and assistant text are not touched. Token usage andcontext_windoware not consulted.Steady state:
That is why the tip is always cleared 6. Any task longer than ~10 tool steps loses its earlier observations, so the model retries.
Docs still describe this as designed (
docs/advanced.mdon the v0.2.11 line: count > 10 or a 1-hour gap).Config merge footgun (hosts cannot raise the default cleanly)
AionCore passes
project_dir= conversation workspace and forwardsconfig.compactthroughresolve_aionui_config. aionrsConfig::resolvereads<workspace>/.aionrs.toml.When merging a project
[compact]block, ifcontext_windowis still the crate default 200000 andenabledis notfalse, the entire project compact section is discarded. Hosts that write:get a no-op unless they also change
context_windowto something other than 200000 (we used131072).Suggested fix
keep_recent * 2micro_keep_recentwell above 5[compact]block just becausecontext_windowequals the crate defaulttool_output_max_bytes) over rewriting earlier turns.Workaround used by hosts today
Write this into the session workspace before agent bootstrap:
That changes the trigger from “> 10 live results” to “> 160” and avoids the merge discard. It is a host-side band-aid, not a substitute for fixing the trigger.
Related: iOfficeAI/aionrs#266, docs/advanced.md.