> ## Documentation Index
> Fetch the complete documentation index at: https://cisco-ea52c096.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# How It Works

> Understand the agentic loop, tool system, and runtime that power Claude Code.

Claude Code is an interactive CLI assistant that runs in your terminal. When you send a message, Claude doesn't just reply with text — it plans a sequence of steps, uses tools to read and modify your codebase, and iterates until the task is complete.

## The agentic loop

Every interaction follows the same cycle:

<Steps>
  <Step title="You send a message">
    You type a request in the terminal REPL. Claude receives your message along with context about your project.
  </Step>

  <Step title="Claude plans">
    Claude decides what steps are needed — which files to read, which commands to run, and in what order.
  </Step>

  <Step title="Claude uses tools">
    Claude invokes tools one at a time (or in parallel when safe) to carry out each step. Each tool call is logged in your terminal as it happens.
  </Step>

  <Step title="Claude responds">
    Once the task is complete, Claude gives you a final response. If a tool call requires your approval, the loop pauses and waits for your input before continuing.
  </Step>
</Steps>

This loop can run for many turns within a single request. Claude continues invoking tools until it reaches a final answer or encounters something that needs your input.

## The tool system

Claude has access to a set of tools that let it interact with your filesystem, shell, and the web. Each tool is a discrete module with its own input schema and permission model.

<CardGroup cols={2}>
  <Card title="Shell execution" icon="terminal">
    **BashTool** runs shell commands in your working directory.
  </Card>

  <Card title="File operations" icon="file">
    **FileReadTool**, **FileWriteTool**, and **FileEditTool** read, create, and partially modify files. FileEditTool performs string replacements rather than full rewrites.
  </Card>

  <Card title="Code search" icon="magnifying-glass">
    **GlobTool** matches files by pattern. **GrepTool** searches file contents using [ripgrep](https://github.com/BurntSushi/ripgrep).
  </Card>

  <Card title="Web access" icon="globe">
    **WebFetchTool** retrieves URL content. **WebSearchTool** runs web searches.
  </Card>

  <Card title="Language intelligence" icon="code">
    **LSPTool** integrates with Language Server Protocol to provide language-aware context such as type information and symbol resolution.
  </Card>

  <Card title="Sub-agents" icon="robot">
    **AgentTool** spawns sub-agents to work on subtasks in parallel. **TeamCreateTool** and **TeamDeleteTool** manage groups of agents working together.
  </Card>

  <Card title="Notebooks" icon="book">
    **NotebookEditTool** reads and edits Jupyter notebooks.
  </Card>

  <Card title="MCP tools" icon="plug">
    **MCPTool** invokes tools exposed by connected Model Context Protocol servers.
  </Card>
</CardGroup>

Additional tools handle task tracking (`TaskCreateTool`, `TaskUpdateTool`), plan mode (`EnterPlanModeTool`, `ExitPlanModeTool`), git worktree isolation (`EnterWorktreeTool`, `ExitWorktreeTool`), and scheduled triggers (`CronCreateTool`).

## The REPL model

Claude Code runs as an interactive REPL (Read-Eval-Print Loop) in your terminal. Each session maintains a conversation history, and you can continue building on previous messages within the same session. The UI is built with [React](https://react.dev) and [Ink](https://github.com/vadimdemedes/ink), which renders interactive components directly in your terminal — including permission prompts, file diffs, and progress indicators.

You can also use slash commands (prefixed with `/`) to trigger specific actions like `/commit`, `/review`, `/memory`, and `/diff`. Type `/` to see the full list of available commands.

## How Claude understands your codebase

Before Claude makes changes, it gathers context. Depending on what you ask, it may:

* Read specific files with **FileReadTool**
* Search for patterns across your codebase with **GrepTool** or **GlobTool**
* Run shell commands to inspect the environment (e.g., `git log`, `ls`)
* Use **LSPTool** to resolve types and symbols at a language level
* Load your `CLAUDE.md` project instructions (if present) at startup

Claude builds up an understanding of your project incrementally within the session, reading only what it needs for the task at hand.

## Runtime and API

Claude Code runs on the [Bun](https://bun.sh) JavaScript runtime and communicates with Claude via the [Anthropic API](https://docs.anthropic.com). Responses stream in real time as Claude works, and token usage is tracked automatically. Run `/cost` at any point to see how many tokens the current session has consumed.

<Note>
  Claude Code uses your Anthropic API credentials. Run `/login` to authenticate, or set the `ANTHROPIC_API_KEY` environment variable before starting a session.
</Note>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.