Guide
Optimizations
Best practices for optimizing Gem Team's agent execution, output hygiene, and context caching.
Cost-consciousness and performance are core design principles. This page covers optimization across agent execution, context management, and build pipeline.
Agent Execution Optimization
Model routing recommendations are on the Agents page →. Below covers output hygiene and researcher budgets.
Output Hygiene
Agents are configured to minimize token waste:
- Native tool flags: Agents use
--quiet,--oneline,maxResultsto truncate output at source - Pipeline truncation:
head/tail/grepused only when native flags are insufficient - Context pruning: The context envelope is filtered per-agent: each agent receives only the sections relevant to its task
Researcher Budget Controls
The gem-researcher agent has configurable budgets to prevent runaway exploration:
orchestrator:
researcher:
max_searches: 10 # Max search calls per task
max_files_to_read: 25 # Max files read per task
max_depth: 3 # Max exploration depth (follow-up searches)
Context & Cache Optimization
Context envelope structure and memory tiers are covered in Core Concepts →. This section covers eviction and efficiency settings.
The context envelope is filtered per-agent (each receives only relevant sections). Facts are persisted only at confidence ≥ 0.85, promoted to durable cache at ≥ 0.90 after ≥ 3 uses. Auto-eviction at 90 days of no access.