Heuristic:0xSteph Pentest ai agents Lite Mode Token Optimization
| Knowledge Sources | |
|---|---|
| Domains | Optimization, Agent_Framework, Cost_Management |
| Last Updated | 2026-10-22 12:00 GMT |
Overview
Token cost optimization strategy that switches advisory-only agents to the Haiku model while keeping Tier 2 execution agents on Sonnet, reducing token cost by ~40-60% for advisory tasks without sacrificing execution safety.
Description
The Lite Mode Token Optimization heuristic governs how the pentest-ai installer manages the trade-off between agent capability and token cost. In standard mode, all agents use `model: sonnet`. In lite mode (`--lite` flag), 10 advisory-only agents (no Bash tool, no execution risk) are rewritten to use `model: haiku` via `sed` substitution during installation. Haiku is roughly 90% as capable as Sonnet for advisory tasks at a fraction of the token cost. Critically, Tier 2 execution agents (recon-advisor, web-hunter, vuln-scanner, ad-attacker, exploit-chainer, poc-validator, bizlogic-hunter, swarm-orchestrator) stay on Sonnet because tool-use accuracy matters when composing and executing commands against live targets. The heuristic extends to conversation management: starting new sessions per phase, pasting only relevant scan output subsets, and using `/clear` between unrelated tasks.
Usage
Use this heuristic when installing pentest-ai agents for personal use, exploration, learning, or cost-sensitive engagements where advisory depth is sufficient. Do not use lite mode for professional engagements requiring maximum execution accuracy. Apply the conversation management practices (short sessions, focused prompts) regardless of lite/standard mode — they reduce token cost in all scenarios.
The Insight (Rule of Thumb)
- Action: Use `--lite` flag during installation to switch advisory agents to Haiku; keep execution agents on Sonnet.
- Value:
- Advisory agents on Haiku (10 agents): engagement-planner, report-generator, detection-engineer, threat-modeler, ctf-solver, stig-analyst, exploit-guide, attack-planner, forensics-analyst, malware-analyst
- Execution agents on Sonnet (8 agents): recon-advisor, web-hunter, vuln-scanner, ad-attacker, exploit-chainer, poc-validator, bizlogic-hunter, swarm-orchestrator
- Cost reduction: ~40-60% for advisory tasks, 0% for execution tasks
- System prompt cost: ~900 tokens (engagement-planner) to ~7,600 tokens (threat-modeler); average ~3,100 tokens per agent
- Trade-off: Slightly condensed responses from advisory agents; execution agents are unaffected.
- Conversation rule: Start a new Claude Code session for each engagement phase (recon, exploitation, reporting). Paste only relevant output subsets, not full dumps. Use `/clear` between unrelated tasks.
- Prompt rule: Be specific in prompts. "Show me the Impacket command for Kerberoasting service accounts in corp.local" is cheaper than "Help me with Active Directory attacks."
Reasoning
Token cost has three components: system prompt (fixed, loaded once per conversation), user input, and agent output. The system prompt ranges from ~900 to ~7,600 tokens per agent, averaging ~3,100. With 31+ agents available, the system prompt cost dominates for short conversations. Lite mode reduces this by using Haiku for agents that don't execute commands — the advisory-only agents whose outputs are analysis and recommendations, not tool calls. The 10 agents chosen for Haiku are those with no Bash tool in their YAML frontmatter, meaning they cannot execute commands and thus don't benefit from Sonnet's superior tool-use accuracy.
Execution agents must stay on Sonnet because the cost of a tool-use error (wrong nmap flags, incorrect sqlmap syntax) is much higher than the token savings. A misflagged scan can miss vulnerabilities or trigger alerts, while a slightly less detailed advisory response from Haiku is acceptable.
The conversation management practices compound with lite mode: a 5-message single-agent conversation costs 15,000-30,000 tokens, while a full swarm engagement can cost 100,000-300,000. Short sessions and focused prompts keep costs at the lower end.