An interactive educational webapp that visualizes how Claude Code works internally. Explore the agentic loop algorithm through interactive flowcharts and step-by-step scenario walkthroughs.
- Scenario-based learning: Walk through real-world scenarios like file reads, multi-tool tasks, permission denials, and subagent delegation
- Step-by-step playback: Use playback controls to step forward/backward through each execution step
- Live flowchart: Watch the algorithm flow animate as you step through scenarios
- Detailed inspection: Click any node to see payload data, tool inputs/outputs, and hook configurations
- Complete reference diagram: See the entire Claude Code algorithm as an interactive flowchart
- 20 algorithm nodes covering session lifecycle, context management, agentic loop, tool execution, hooks, subagents, and output
- Click for details: Each node shows detailed explanations and code examples
- Learn tab: ~15 minute read covering all aspects of the algorithm
- ASCII diagrams: Visual explanations of data flow
- Pseudocode: Understand the logic without implementation details
- Real code examples: JSON configurations and TypeScript snippets
- Permission modes: Toggle between default, acceptEdits, plan, and more
- Permission rules: See how deny/ask/allow rules affect execution
- Hook configuration: Understand how hooks intercept and modify behavior
- React 19 with TypeScript
- Vite for fast development and building
- React Flow (@xyflow/react) for interactive flowcharts
- Dagre for automatic graph layout
- Zustand for state management
- Tailwind CSS v4 for styling
- React Router for navigation
- Prism React Renderer for syntax highlighting
- Lucide React for icons
- Node.js 18+
- npm or yarn
# Clone the repository
git clone https://github.com/jonwiggins/claude-code-visualizer.git
cd claude-code-visualizer
# Install dependencies
npm install
# Start the development server
npm run devThe app will be available at http://localhost:5173
# Build the app
npm run build
# Preview the production build
npm run previewsrc/
├── components/ # React components
│ ├── FlowCanvas.tsx # Main flowchart visualization
│ ├── FlowNode.tsx # Custom node component
│ ├── ScenarioPicker.tsx
│ ├── PlaybackControls.tsx
│ ├── ExecutionLog.tsx
│ ├── DetailPanel.tsx
│ ├── SandboxPanel.tsx
│ └── CodeBlock.tsx # Syntax-highlighted code
├── pages/
│ ├── VisualizerPage.tsx # Interactive visualizer
│ └── LearnPage.tsx # Documentation article
├── algorithmOverview.ts # Algorithm nodes and edges data
├── scenarios.ts # Scenario definitions
├── store.ts # Zustand state management
├── types.ts # TypeScript type definitions
├── App.tsx # Main app with routing
└── main.tsx # Entry point
The visualizer includes several pre-built scenarios:
- Algorithm Overview - Complete reference diagram of the Claude Code algorithm
- Simple File Read - Basic tool execution flow with Read tool
- Multi-Tool Task - Multiple tools used in sequence (Glob → Bash → Read)
- Subagent Delegation - Spawning an Explore subagent for codebase analysis
- Permission Denied - How deny rules block tool execution
- Hook Blocking - PreToolUse hook modifying tool input
- Context Compaction - Automatic summarization when context limit is reached
Claude Code operates through a continuous loop:
- User Input → User sends a message
- Model Inference → Claude analyzes and decides on action
- Tool Execution → If needed, tools are executed (with permission checks)
- Result Integration → Tool results are added to context
- Loop → Back to inference until task is complete
- Response → Final response sent to user
- Session Lifecycle: Initialization, hooks, context loading
- Permission System: deny > ask > allow rule evaluation
- Hooks: PreToolUse, PostToolUse, Stop, and other extension points
- Subagents: Isolated agents for specialized tasks
- Context Compaction: Automatic summarization for long conversations
Contributions are welcome! Please feel free to submit issues and pull requests.
MIT License - see LICENSE file for details.
- Built to help developers understand Claude Code by Anthropic
- Uses React Flow for flowchart visualization
- Inspired by the official Claude Code documentation
Note: This is an educational visualization tool and is not officially affiliated with Anthropic. For official documentation, visit claude.ai/code.
