โ† Back to ConceptsVerified: 2026-07-30
Claude Code ArchitectureClaude Code: The Terminal Agent

Claude Code Architecture

Claude Code runs locally, right inside your project folder. Unlike an editor's autocomplete, it doesn't just suggest a line and wait - it runs in a loop: search the code, propose an edit, run the tests, fix what breaks. You stay in one terminal window instead of juggling an editor, a browser tab, and a test runner.

bash โ€” claude-code-sessionmolsen@agenticoutputs:~/workspace$ claudeClaude Code v0.x.xInitializing project search index... Done (124 files mapped)Claude > Fix verification schema in src/auth.ts and verify๐Ÿ” grep_search("password" in src/auth.ts) โ†’ found 1 match (line 42)โœ๏ธ replace_file_content(src/auth.ts, L42-45) โ†’ applied editโš™๏ธ run_command("npm run test") โ†’ executing test suite...โœ“ PASS src/auth.test.ts (14 tests passed, 0 failed in 1.4s)โœ“ git statusโ†’ staged 1 changeClaude > Created commit 9636a90: "Validate request password length limits"Claude >

A real session: Claude reads the files, edits the code, runs the tests, and commits - all without leaving this window.

01The Agentic Loop

Claude Code works in a four-step loop: scan, plan, execute, correct.

01 / Scan

Indexing

Claude Code maps your project's files and finds the code that matters using fast search, the same way you'd grep for a function name.

02 / Plan

Proposal

It reads the target code and drafts the exact edit. You see the plan before anything gets written to disk.

03 / Run

Execution

It runs your build, tests, and linters to check the change actually works - not just that it looks right.

04 / Loop

Correction

If a test fails, it reads the error, fixes the code, and re-runs the tests - looping until they pass.

02Command Reference

How slash commands structure agent workflows.

A slash command is a shortcut for a task you'd otherwise have to explain in a full sentence every time. Type /commit instead of describing what a good commit message looks like.

/commit

Write Git Commit

Reads your staged changes and writes a clear commit message. You approve it before it lands.

/pr

Draft Pull Request

Compares your branch against main and writes the PR description - what changed, and why.

/bug

Diagnose Issue

Starts an investigation into a reported bug - tracing the call path to find where it breaks.

03Developer Empowerment

Why working in the terminal beats an IDE sidebar.

Example

No More Tab-Switching

You describe the bug, Claude reads the file and fixes it - without a browser tab or an IDE panel in between.

Example

Bulk Migrations

Ask it to convert 50 tests from Jest to Vitest. It does the mechanical work; you review the diff.

Example

Follow-Ups Without Repeating Yourself

Because it remembers the session, you can say "also allow numbers in that field" without re-pasting the file.

Example

You Approve, It Executes

You decide what to build and review every diff. Claude handles the typing.

04Safety & Sandbox Controls

Two habits that keep a terminal-running agent safe.

Execution Safety

Command Confirmation

Claude Code asks before running write commands or bash calls. You read the command before you approve it.

Review proposed commands before hitting enter.
Version Control

Clean Git Tree Baseline

Start with a clean git index. If Claude breaks something, `git reset --hard` gets you back instantly.

Commit or stash before launching the agent.

"The terminal is no longer just a shell. It is the agent's workspace."

01

Start clean. Git is your rollback if the agent takes a wrong turn.

02

Read before you approve. Don't authorize a command you haven't looked at.