# Speculative Execution in Claude Code, Hidden but Fully Built

> A developer reverse-engineered Claude Code's binary and found a built but server-gated feature: speculative execution pre-runs your next action in a sandbox.

Published: 2026-03-27
URL: https://daniliants.com/insights/i-found-a-little-something-in-claude-code-that-ll-change-the-way-we/
Tags: claude-code, speculative-execution, developer-tools, ai-coding, anthropic, reverse-engineering

---

## Summary

A developer reverse-engineered Claude Code's binary and discovered a fully built but server-gated feature called "speculative execution" - Claude predicts your next action, pre-executes it in a sandboxed overlay filesystem, and delivers instant results when you accept. Combined with the recently shipped "auto mode" permissions, this could eliminate the entire post-coding workflow (tests, docs, commits) by running them speculatively in the background.

## Key Insight

- **Speculative execution is fully built inside Claude Code** but gated behind a server-side flag called "Tengu speculation" that returns false. The overlay filesystem, permission tiers, and pipelining are all implemented.
- **How it works:** After completing a task, Claude generates a prompt suggestion (e.g., "run the tests"), then immediately starts executing that suggestion in a sandboxed overlay filesystem. File writes go to the sandbox, not the real codebase. If you accept, the overlay syncs back. If you type something else, it gets discarded.
- **Permission tiers are baked in:** Read-only tools (file reads, grep, ls) run freely during speculation. File edits and shell commands only execute if previously approved. Speculation halts at any unapproved permission boundary.
- **Chained speculation:** When one speculative execution completes, it immediately generates the next prediction and starts executing that too - staying multiple steps ahead.
- **Auto mode + speculation = the real play:** The recently shipped "auto mode" (intelligent command classifier) removes the permission wall that currently makes speculation impractical. Together, they'd automate the entire best-practices pipeline (test, lint, commit, document, PR) without the developer ever asking.
- **Anthropic is tracking metrics:** Time-save measurements and speculation acceptance rates are visible in the binary, suggesting this is heading toward public release.