The most popular AI coding tool in the world just leaked its source code. 500,000 lines of TypeScript. Here's what we found inside — and why it proves that orchestrating agents with prompts is architecturally bankrupt.
return `You are Claude Code, an AI assistant that orchestrates
software engineering tasks across multiple workers.
## 1. Your Role
You are a **coordinator**. Your job is to:
- Help the user achieve their goal
- Direct workers to research, implement and verify code changes
- Synthesize results and communicate with the user`The most sophisticated agent coordination system at Anthropic is a string template injected into a chat window. The "state machine" is whatever the LLM remembers. The "recovery strategy" is "resume the conversation."
If the context window fills up or the session crashes, the entire pipeline state is gone.
An engine doesn't forget.
It remembers everything. Recalls it intelligently. Your context window stays cheap because the engine already knows.
// ~/.claude/teams/{team_name}/permissions/pending/{requestId}.json
// ~/.claude/teams/{team_name}/permissions/resolved/{requestId}.json
const LOCK_OPTIONS = {
retries: {
retries: 10,
minTimeout: 5,
maxTimeout: 100,
},
}Workers communicate by writing JSON to a shared directory. Concurrent access is handled by filesystem locks with retry loops. The leader polls for new files. The worker polls for responses.
If a lock fails, the message is lost. If the process dies mid-write, the file is corrupted.
This is how programs communicated in 1985.
An engine has event-sourced state with CAS guarantees.
Messages don't get lost. Workers don't collide. Every state transition is atomic, recoverable, and free.
export function isScratchpadEnabled(): boolean {
return checkStatsigFeatureGate_CACHED_MAY_BE_STALE('tengu_scratch')
}IMPORTANT: Always use this scratchpad directory for temporary
files instead of `/tmp` or other system temp directories:
`/private/tmp/claude-501/`
The scratchpad directory is session-specific, isolated from the
user's project, and can be used freely without permission prompts.Workers share state through a temporary directory that's gone when the session ends. The "security model" is a GrowthBook feature flag called tengu_scratch.
The path is hardcoded into the system prompt. If two sessions run simultaneously, they collide.
An engine has versioned, event-sourced artifacts that survive anything.
Context is indexed and sandboxed for free. Only what matters reaches the window you're paying for. The floor rises — your token bill drops.
Their state lives in a conversation. Ours lives in a database.
Crash mid-task? The entity is still there. Another worker picks it up. Zero tokens wasted. Zero progress lost.
feature('KAIROS')
feature('KAIROS_BRIEF')
feature('KAIROS_CHANNELS')
feature('KAIROS_DREAM')
feature('KAIROS_GITHUB_WEBHOOKS')
feature('KAIROS_PUSH_NOTIFICATION')
feature('VOICE_MODE')
feature('COORDINATOR_MODE')
feature('BUDDY')
feature('DAEMON')
feature('WEB_BROWSER_TOOL')
feature('ANTI_DISTILLATION_CC')
// ... 88 build-time feature flags
// ... 17+ runtime flags with bird codenames
// tengu_amber_quartz_disabled
// tengu_turtle_carbon
// tengu_onyx_plover
// tengu_passport_quailThe daemon mode you want? Gated behind a server-side flag Anthropic controls. The voice mode? Requires OAuth and a kill switch called tengu_amber_quartz_disabled.
The coordinator mode? An environment variable that only works if the build-time flag was compiled in.
You don't control the tool. The tool controls what you're allowed to use.
An engine doesn't need permission from its vendor to run.
Your pipeline. Your infrastructure. Your rules. No kill switches. No bird codenames. No one else's roadmap.
One of these is 500,000 lines of TypeScript built by a $60 billion company.
The other is an engine.
They're reaching for the same thing. Autonomous agent coordination. Workers that claim tasks, do work, report back. State that survives crashes. Flows that learn.
They're building it inside a chat client with JSON files and system prompts and feature flags named after birds.
We built the engine.