May 1, 2026

Massive Compaction Overhaul: Append-Only State

The compaction subsystem underwent a major architectural rewrite, shifting from a dedicated `compactions` table to an append-only approach using the `tool_calls

The compaction subsystem underwent a major architectural rewrite, shifting from a dedicated compactions table to an append-only approach using the tool_calls table for storing compacted summaries.

compactions table storage was dropped, and tool_calls entries with tool_name='compaction' now serve as the canonical record. The watermark is stored within the params of these records.

The overflow handling path was simplified, collapsing the old Stage 1 and Stage 2 processes into a single _handle_overflow() method. This method now triggers _run_full_compaction upon hitting the 80% threshold or receiving a PayloadTooLargeError, resetting the ACT trail and starting the iteration over.

Compaction prompts were updated to ContinuityCompactionSystemPrompt, instructing the model in second person to summarize its ongoing conversation, requiring six sections, and mandating that only the <summary>...</summary> body be stored.

A new SubagentTrailCompactionProcessor was introduced, allowing subagents to manage their own trail compaction without resetting the main ACT iteration.

Configuration and flow logic were stabilized: max_tokens and compact_at are now persisted for each provider during boot, removing runtime threshold calculations from the hot path.

Various tests were updated, including new tests verifying the SQL join for canonical lookup and testing the <summary> regex parser. The removal of the self_model_service compaction stale signal prevented recursive prompting issues.

  • Compaction state is now append-only, utilizing tool_calls instead of the compactions table.

  • Overflow handling collapsed into a single _handle_overflow() path.

  • System prompts were rewritten for continuity, instructing the model to summarize its own conversation.

  • max_tokens and compact_at are persisted per provider during boot.

  • A SubagentTrailCompactionProcessor handles compaction specific to subagents.

  • The old self_model_service compaction stale signal was removed to prevent recursive prompting.