Overview
Effective context management is crucial for AI agent performance. Maestro provides tools to manage context size, transfer context between agents, and groom context for optimal efficiency.Context Management Settings
Configure context behavior in Settings > Context Management:Session Storage
Maestro automatically stores session messages for each agent type, enabling context persistence and transfer.
Supported Agents
Each agent has its own session storage implementation:- Claude Code - Stores session in
.claude_code/sessions/ - OpenCode - Stores session data in agent-specific format
- Codex - Maintains OpenAI conversation history
- Factory Droid - Custom session storage
Session Data Structure
- Message Format
- Session Result
Context Grooming
How It Works
Spawn Grooming Session
A batch-mode agent process is created with read-only access to analyze the context.
Generate Summary
The agent generates a concise summary of the conversation, preserving:
- Key decisions and conclusions
- Important code changes
- Unresolved issues
- Action items
Grooming API
Grooming Configuration
Timeout Settings
Timeout Settings
Default Timeouts:
- Overall timeout: 5 minutes
- Idle timeout: 5 seconds (with min 100 char response)
- Connection timeout: 10 seconds
SSH Remote Support
SSH Remote Support
Context grooming fully supports SSH remote execution:
Batch Mode Processing
Batch Mode Processing
Grooming uses batch mode (non-interactive) agent execution:
- No PTY allocation
- Direct stdin/stdout communication
- Uses
--print --output-format stream-jsonfor Claude Code - Collects response until process exits or idle timeout
Context Transfer
Transfer context from one agent to another to continue work with a different AI model.
Transfer Workflow
Retrieving Stored Sessions
Context Optimization Tips
1. Use Read-Only Mode for Analysis
Enable read-only mode (Cmd+R) when asking the agent to review or analyze:
2. Leverage Session History
Use the/history command to create checkpoints:
3. Start New Tabs for New Topics
Don’t cram unrelated tasks into a single conversation:- New Tab (
Cmd+T) for each distinct task - Star Important Tabs (
Cmd+Shift+S) to keep them accessible - Close Completed Tabs (
Cmd+W) to reduce clutter
4. Groom Before Major Changes
Before starting a large refactoring or feature:- Groom the current context to summarize decisions
- Start a new tab for the new work
- Reference the summary if needed
Advanced Context Patterns
Group Chat Context
Group Chat manages context across multiple agents simultaneously, with automatic context grooming between rounds.
- Each agent receives context from previous agents
- Context is automatically groomed after each round
- Summary preserves key insights from all agents
Auto Run Context
Auto Run documents maintain their own context:- Phase context is isolated to each phase
- Task context builds on phase context
- Document-level context available to all phases
Monitoring Context Usage
- Agent responses becoming slower
- “Context limit” warnings in output
- Degraded response quality
- Agent forgetting earlier conversation details
Context Cancellation
Cancel ongoing grooming operations:- Grooming takes too long
- You need to modify the grooming prompt
- You want to transfer context without grooming
Next Steps
- Explore Slash Commands for context-aware automation
- Learn about SSH Remote Execution for remote context grooming
- Review Configuration for context management settings