Skip to content

Conversation

@jenny-miromind
Copy link
Collaborator

@jenny-miromind jenny-miromind commented Jan 9, 2026

MiroThinker v1.5 Context Management Strategy

MiroThinker v1.5 employs a two-layer context management mechanism, each addressing different dimensions of context challenges.

Overview

Layer Config Parameter Purpose
Layer 1 keep_tool_result Controls context growth within a single attempt
Layer 2 context_compress_limit Compresses context window and enables knowledge transfer across attempts

Layer 1: keep_tool_result - Recency-based Context Retention

Core Problem

Traditional ReAct stuffs all tool outputs into the message history, leading to:

  • Context bloat
  • Early tool outputs crowding out space
  • Low utilization efficiency

Solution

Config Value Behavior
keep_tool_result = K Keep only the most recent K tool responses, while preserving the complete thoughts & actions trace
keep_tool_result = -1 Keep all tool results (no trimming)

Benefits

  • Focus on recent observations
  • Free up context space
  • Support longer interaction/tool call trajectories

Layer 2: context_compress_limit - Context Compression

Core Problem

Even with keep_tool_result trimming, a single attempt may still fail to complete the task due to:

  • Running out of turns (max_turns)
  • Reaching context window limits

Solution

Config Value Behavior
context_compress_limit = 0 Disable context compression retry; only one chance, fallback to intermediate answers on failure
context_compress_limit = N Enable context compression retry; up to N retries

Relation to DeepSeek V3.2's "Discard-all" Strategy

This mechanism is conceptually similar to DeepSeek V3.2's "Discard-all" strategy, which resets the context by discarding all previous tool call history. Both approaches share the same core insight:

A fresh start with learned experience is often more effective than continuing with a bloated context.

How It Works

When a task is not completed within the given turns and context window:

Step 1: Generate Failure Experience Summary (context compression)

Compress conversation history into ~500-1000 tokens structured summary containing:

  • Failure type: incomplete / blocked / misdirected / format_missed
    • incomplete: ran out of turns before finishing
    • blocked: got stuck due to tool failure or missing information
    • misdirected: went down the wrong path
    • format_missed: found the answer but forgot to use \boxed{}
  • What happened: the approach taken and why a final answer was not reached
  • Useful findings: facts, intermediate results, or conclusions to be reused

Step 2: Inject Summary on Retry

  • Summary is injected into the original user query
  • Model starts fresh with a clean context window
  • Learns from past failures, avoids repeating mistakes

How the Two Layers Work Together

┌─────────────────────────────────────────────────────────────────────────────┐
│                          Single Task Attempt                                │
│  ┌─────────────────────────────────────────────────────────────────────┐    │
│  │  keep_tool_result = K                                               │    │
│  │  ════════════════════                                               │    │
│  │  • Keep only the most recent K tool responses                       │    │
│  │  • Preserve complete thoughts & actions trace                       │    │
│  │  → Controls context growth within a single attempt                  │    │
│  └─────────────────────────────────────────────────────────────────────┘    │
└─────────────────────────────────────────────────────────────────────────────┘
                                    │
                                    ▼ Task not completed?
┌─────────────────────────────────────────────────────────────────────────────┐
│                       context_compress_limit > 0                            │
│  ════════════════════════════════════════════════                           │
│  1. Generate Failure Experience Summary (compress context)                  │
│  2. Inject summary into task description                                    │
│  3. Start fresh with clean context                                          │
│  → Enables knowledge transfer across attempts                               │
└─────────────────────────────────────────────────────────────────────────────┘

@jenny-miromind jenny-miromind changed the title Update context management for MiroThinker Update context management for MiroThinker v1.5 Jan 9, 2026
@jenny-miromind jenny-miromind merged commit c4d0b3c into main Jan 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants