Claude Code Unpacked: Inside the 40+ Tools and Agent Architecture
#AI

Claude Code Unpacked: Inside the 40+ Tools and Agent Architecture

Startups Reporter
5 min read

A deep dive into Claude Code's architecture reveals an agent loop with 35+ tools, 79+ commands, and unreleased features like persistent mode and remote control.

What actually happens when you type a message into Claude Code? The agent loop, 40+ tools, multi-agent orchestration, and unreleased features, mapped straight from the source.

Featured image

The Agent Loop: From Keypress to Rendered Response

When you type a message into Claude Code, it triggers a sophisticated pipeline that processes your input through multiple stages:

  1. User Input - Keyboard input comes from Ink's TextInput component. In non-interactive mode, it reads from piped stdin instead.
  2. Message - The raw text gets parsed and prepared for processing
  3. History - Previous conversation context is retrieved
  4. System - System-level instructions and constraints are applied
  5. API - The message is sent to Claude's API for processing
  6. Tokens - Response tokens are counted and managed
  7. Tools? - The system determines if tool usage is needed
  8. Loop - The agent loop processes the response
  9. Render - The final output is rendered to the terminal
  10. Hooks - Any registered hooks are executed
  11. Await - The system waits for the next input

This loop happens in milliseconds, creating the seamless experience users expect from an AI coding assistant.

Architecture Explorer: The Source Tree

Claude Code's codebase spans over 1,563 files and 424K+ lines of code, organized into distinct layers:

  • utils/ (564 files) - Utility functions and helpers
  • components/ (389 files) - UI components and interfaces
  • commands/ (189 files) - Slash commands and user interactions
  • tools/ (184 files) - Built-in tools for file operations, execution, search, and more
  • services/ (130 files) - Backend services and integrations
  • hooks/ (104 files) - React hooks and state management
  • ink/ (96 files) - Terminal UI components using Ink
  • bridge/ (31 files) - Remote control and synchronization
  • constants/ (21 files) - Configuration and constants
  • skills/ (20 files) - Specialized capabilities and behaviors
  • cli/ (various) - Command-line interface components

Tool System: 35+ Built-in Capabilities

Claude Code comes equipped with an extensive toolkit that enables it to interact with your codebase, execute commands, and manage tasks. The tools are organized by function:

File Operations (6 tools)

  • FileRead - Read file contents
  • FileEdit - Edit existing files
  • FileWrite - Create new files
  • Glob - Pattern-based file searching
  • Grep - Text search within files
  • NotebookEdit - Edit notebook-style documents

Execution (3 tools)

  • Bash - Execute bash commands
  • PowerShell - Execute PowerShell commands
  • REPL - Interactive read-eval-print loop

Search & Fetch (3 tools)

  • WebFetch - Fetch web content
  • WebSearch - Perform web searches
  • ToolSearch - Search for available tools

Agents & Tasks (10 tools)

  • Agent - Spawn new agents
  • SendMessage - Send messages between agents
  • TaskCreate/Get/List/Update/Stop/Output - Task management
  • TeamCreate/Delete - Team management

Planning (4 tools)

  • EnterPlanMode/ExitPlanMode - Planning mode control
  • EnterWorktree/ExitWorktree - Git worktree management

MCP (4 tools)

  • mcp - Model Context Protocol
  • ListMcpResources/ReadMcpResource/McpAuth - MCP resource management

System (8 tools)

  • AskUserQuestion - Prompt user for input
  • TodoWrite - Write todo items
  • Skill - Skill management
  • Config - Configuration management
  • RemoteTrigger - Remote triggering

Experimental (4 tools)

  • Sleep - Delay execution
  • Brief - Brief mode
  • StructuredOutput - Structured output formatting
  • LSP - Language Server Protocol

Command Catalog: 79+ Slash Commands

The command system provides quick access to common operations through slash commands:

Setup & Config (12 commands)

  • /init, /login, /logout, /config, /permissions, /model, /theme, /terminal-setup, /doctor, /onboarding, /mcp, /hooks

Daily Workflow (24 commands)

  • /compact, /memory, /context, /plan, /resume, /session, /files, /add-dir, /copy, /export, /summary, /clear, /brief, /output-style, /color, /vim, /keybindings, /skills, /tasks, /agents, /fast, /effort, /extra-usage, /rate-limit-options

Code Review & Git (13 commands)

  • /review, /commit, /commit-push-pr, /diff, /pr_comments, /branch, /issue, /security-review, /autofix-pr, /share, /install-github-app, /install-slack-app, /tag

Debugging & Diagnostics (23 commands)

  • /status, /stats, /cost, /usage, /version, /feedback, /thinkback, /thinkback-play, /rewind, /ctx_viz, /debug-tool-call, /perf-issue, /heapdump, /ant-trace, /backfill-sessions, /break-cache, /bridge-kick, /mock-limits, /oauth-refresh, /reset-limits, /env, /bughunter, /passes

Advanced & Experimental (23 commands)

  • /advisor, /ultraplan, /bridge, /teleport, /voice, /desktop, /chrome, /mobile, /sandbox-toggle, /plugin, /reload-plugins, /remote-setup, /remote-env, /ide, /stickers, /good-claude, /btw, /upgrade, /release-notes, /privacy-settings, /help, /exit, /rename

Hidden Features: What's Coming Next

Digging through the source code reveals several features that are either feature-flagged, environment-gated, or simply commented out:

Buddy

A virtual pet that lives in your terminal. Species and rarity are derived from your account ID.

Kairos

Persistent mode with daily logs, memory consolidation between sessions, and autonomous background actions.

UltraPlan

Long planning sessions on Opus-class models, up to 30-minute execution windows.

Coordinator Mode

A lead agent breaks tasks apart, spawns parallel workers in isolated git worktrees, collects results.

Bridge Control

Control Claude Code from your phone or a browser. Full remote session with permission approvals.

Daemon Mode

Run sessions in the background with --bg. Uses tmux under the hood.

UDS Inbox

Sessions talk to each other over Unix domain sockets.

Auto-Dream

Between sessions, the AI reviews what happened and organizes what it learned.

These features suggest Anthropic is building toward a more persistent, autonomous coding assistant that can work across sessions and devices.

Why This Matters

Claude Code represents a significant evolution in AI-assisted development. Unlike traditional IDEs or even other AI coding tools, it's built as an agent-first system with deep tool integration and a sophisticated orchestration layer.

The architecture shows clear separation of concerns - the UI layer, the agent loop, the tool system, and the command interface all work together seamlessly. This modular design allows for rapid iteration and the addition of new capabilities without disrupting the core experience.

What's particularly interesting is the focus on persistence and multi-session capabilities. Features like Kairos and Auto-Dream suggest Anthropic is thinking beyond single-session interactions toward a more continuous coding experience where the AI maintains context across days or weeks.

For developers, this means a tool that can truly understand your codebase over time, maintain consistent coding patterns, and provide increasingly relevant assistance as it learns your preferences and workflows.

The extensive tool system also means Claude Code can interact with virtually any part of your development environment - from file operations to git management to external APIs. This makes it more than just a code generator; it's a full-fledged development partner.

As these hidden features roll out, we can expect Claude Code to become even more powerful, potentially blurring the lines between AI assistant and autonomous coding agent.

Comments

Loading comments...