Master Claude Code: 8 Leaked Source Insights
Claude Code is a full agent runtime with 85 slash commands, claude.md memory, wildcard permissions, and multi-agent coordination—design its operating environment with these to save tokens and boost output like top 1% users.
Claude Code's Agent Runtime Architecture Exposes Hidden Leverage
Claude Code isn't a terminal chatbot—its leaked 2,000-file, 500k+ line TypeScript codebase (built with Bun and React) reveals a complete agent runtime including tool system, command service, memory layers, permission engine, task manager, multi-agent coordinator, and MCP client/server. User input flows through CLI parser → query engine → LLM API → tool loop → terminal render. This means chatbot-style prompts access only 10% of capabilities; real power lies in surrounding systems like decomposition into parallel agents (one explores code, another implements/tests) and background tasks. Structure requests as search/plan/execute/verify phases instead of monolithic prompts to align with its design, avoiding suboptimal results from cramming everything into one thread.
Slash Commands and Context Management Cut Costs and Boost Control
85 slash commands exist, but most users know <5; prioritize these for 10x value: /init generates claude.md as project operating manual (injected every session); /plan maps complex tasks before execution to prevent unwanted edits and save tokens; /compact compresses long histories (e.g., /compact keep website integration info) to drop noise; /review and /security-review run structured code reviews as first-class workflows; /context controls loaded files (every file costs tokens); /cost tracks spend; /resume and /summary persist sessions without re-explaining. Treat context as cash: habitually use /compact, /context, and /summary to minimize unnecessary tokens, turning management into a discipline.
Permissions, Memory, and Extensions Enable Autonomous Workflows
Wildcard permissions in settings.json (global/project-level) eliminate repetitive approvals—e.g., allow all git commands or allow file edits in src/—shifting from babysitting to hands-off agent operation for daily tasks. claude.md is core memory (not docs): keep it short/opinionated with rules like "TypeScript strict mode always," "tests in test/ folders," "PNPM not npm," routing to other files; layers include user/project/team sync, injected pre-chat for consistent behavior. MCP integration (client/server) plus skills/plugins form extension layer—connect databases/APIs/internal tools to build domain-specific ecosystems, compounding value beyond coding.
Gated Features and Top Habits for Infrastructure-Level Tuning
Feature flags (e.g., userType: 'anthropic') gate voice mode, daemon mode, coordinator—watch updates as they're likely rolling out (e.g., recent computer use was long internal). Top 1% users design the environment: update claude.md regularly; master 6-8 key commands; set permissions for repeats; decompose tasks; manage context ruthlessly; connect via MCP/plugins; tune configs (model routing, sub-agent overrides, shell/privacy, cloud backends like Bedrock/Vertex). This shifts Claude Code from app to tuned infrastructure, yielding better results and lower costs.