Neural Inverse is Open Source →
← Back to changelog
May 24, 2026

Power Mode Session Compaction

Picture Sanjay SenthilkumarSanjay Senthilkumar

Power Mode now handles 200+ step sessions with automatic context window management via progressive 4-level compaction.

Power Mode's agent loop now supports long multi-step sessions without hitting context limits. The new compaction engine keeps 200-step workflows within token budgets while preserving all critical state.

What changed

Automatic compaction When a session exceeds 100K tokens, compaction triggers automatically before the next LLM call. The engine progressively applies 4 levels of optimization until the target (60K tokens) is reached.

4-level progressive strategy

  1. Truncate verbose tool outputs (>8K tokens → 200 + 100 tokens + truncation marker)
  2. Drop reasoning parts from old messages (internal chain-of-thought)
  3. Collapse redundant exploration sequences (3+ read/list calls → summary)
  4. LLM-generated structured summaries (with heuristic fallback)

Preservation rules The first user message, last 6 messages, unresolved errors, and active file references are always kept verbatim. This ensures the agent never loses the original goal or recent context.

Non-fatal design Compaction failures never crash the agent loop. If compaction fails, the session continues with full history.

Why this matters

Long agentic sessions are common for complex tasks. Before compaction, 200-step runs would hit context limits around step 40-50 and start degrading or failing. Now sessions run smoothly to 200 steps while keeping token count below 60K.

Technical details

  • Token estimation: Browser-safe content-aware heuristics (prose: 4.0 chars/token, code: 3.5, JSON: 3.0)
  • LLM summarization: Produces structured output (goal, decisions, file changes, errors, per-step summaries)
  • Re-compactable: Handles sessions that were already compacted once
  • 100K trigger → 60K target: Leaves 40K headroom before next compaction

Implementation: src/vs/workbench/contrib/powerMode/browser/session/compaction/

Copyright 2026 Neural Inverse Inc.


Was this page helpful?