CodeNFacts
CodeHub
Home

All Categories


Sign In
Agentic coding, in your terminal

Claude Code reads your codebase and does the work.

It's an agentic coding tool that understands your project, edits files, runs commands, and manages your git workflow - through plain language, from the terminal, your IDE, a desktop app, or the browser.

$curl -fsSL https://claude.ai/install.sh | bash

macOS, Linux, WSL — see below for Windows, Homebrew & package managers

~/checkout-app — claude
~/claude-code$cat about.md

Not a chat panel bolted onto your editor.

Claude Code is an AI‑powered coding assistant that helps you build features, fix bugs, and automate development tasks by working across multiple files and tools directly — not just describing changes for you to make yourself. Because it runs from the command line, it takes real action: it edits files, runs terminal commands, and creates git commits on your behalf.

Understands
Your entire codebase, not just the open file
Acts
Edits, runs commands, commits — directly
Everywhere
Terminal, IDE, desktop app, and the web
~/claude-code$features --list

What it actually does, day to day.

Reads your whole codebase

Claude Code explores files, follows imports, and builds an understanding of your project's structure before it touches anything — the same way a new engineer would read around before making a change.

Works directly in git

It stages changes, writes commit messages, creates branches, and opens pull requests. In CI, it can review PRs and triage issues automatically via GitHub Actions or GitLab CI/CD.

Connects to your tools via MCP

The Model Context Protocol is an open standard for wiring AI tools to external systems. Through MCP, Claude Code can read a doc in Drive, update a Jira ticket, or use tooling your team built in‑house.

Remembers your standards

A CLAUDE.md file in your project root is read at the start of every session — coding conventions, architecture decisions, review checklists. Claude Code also builds its own auto memory of things like build commands as it works.

Runs agent teams

Spawn multiple agents that work on different parts of a task at once, coordinated by a lead agent that assigns subtasks and merges the results — useful for large, parallelizable changes.

Runs on a schedule

Routines run on Anthropic-managed infrastructure so they keep going even when your laptop is closed — morning PR reviews, overnight CI failure triage, weekly dependency audits.

~/claude-code$ps --agent-loop

How it works under the hood.

Every agentic tool, Claude Code included, runs some version of the same loop. The engineering is in making each stage reliable at scale.

01

Gather context

Read the relevant files, search the codebase, check CLAUDE.md and prior memory — build up only the context this step actually needs.

02

Decide the next action

The model reasons about the goal and picks one tool call: edit a file, run a command, search, or ask a clarifying question.

03

Act, in a sandbox

The tool executes with real but scoped permissions — a file edit, a shell command, a git operation — and returns its result as plain text or structured output.

04

Verify

Run tests, a linter, a type checker, or re-read the diff. A loop that can check its own work is what separates an agent from an autocomplete.

05

Repeat or stop

If the goal isn't met, the result feeds back in as new context and the loop continues. If it is, the agent reports what it did and stops.

~/claude-code$man build-an-agent

How to build an agent like Claude Code.

You don't need to reverse-engineer it from scratch — Anthropic's Agent SDK exposes the same tool-use and orchestration foundation Claude Code itself runs on. But understanding the pieces makes every layer above them make more sense, whether you use the SDK or write your own loop.

The six things every capable agent needs

A capable model

You need a model that can hold a plan across many steps, call tools reliably, and reason about its own output well enough to know when something's wrong.

A small set of sharp tools

Read file, edit file, run command, search — a handful of composable primitives beats dozens of narrow ones. Claude Code's own toolset is deliberately small.

Persistent, addressable memory

Long tasks outgrow a context window. CLAUDE.md-style project files plus a running auto-memory of learnings let the agent pick up where it left off without re-deriving everything.

Real permission boundaries

Decide up front what the agent can do without asking — read files, run tests — versus what needs a human nod, like pushing to main or deleting data.

A ground-truth feedback signal

Tests passing, a linter's exit code, a type checker — something outside the model's own judgment that tells the loop whether the last action actually worked.

Context management

Summarize or discard stale context, keep only what's relevant to the current step, and hand off cleanly to sub-agents for isolated chunks of work.

The loop in code

Strip away the product polish and this is the shape of it: give the model tools, let it call them, feed the results back, and stop when it stops asking for more.

agent-loop.ts
// A minimal agent loop — the same shape Claude Code runs at scale.
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();

const tools = [
  {
    name: "read_file",
    description: "Read a file's contents",
    input_schema: {
      type: "object",
      properties: { path: { type: "string" } },
      required: ["path"],
    },
  },
  {
    name: "edit_file",
    description: "Replace text in a file",
    input_schema: {
      type: "object",
      properties: {
        path: { type: "string" },
        find: { type: "string" },
        replace: { type: "string" },
      },
      required: ["path", "find", "replace"],
    },
  },
  {
    name: "run_command",
    description: "Run a shell command and return its output",
    input_schema: {
      type: "object",
      properties: { command: { type: "string" } },
      required: ["command"],
    },
  },
];

let messages = [{ role: "user", content: "Fix the failing test in totals.ts" }];

while (true) {
  const response = await client.messages.create({
    model: "claude-sonnet-5",
    max_tokens: 2048,
    tools,
    messages,
  });

  messages.push({ role: "assistant", content: response.content });

  const toolCalls = response.content.filter((b) => b.type === "tool_use");
  if (toolCalls.length === 0) break; // agent is done — no more actions to take

  const results = await Promise.all(
    toolCalls.map(async (call) => ({
      type: "tool_result",
      tool_use_id: call.id,
      content: await runToolWithPermissionCheck(call), // your sandboxed executor
    }))
  );

  messages.push({ role: "user", content: results });
}

Design principles worth stealing

Start narrower than feels useful

A tight loop with three reliable tools beats a sprawling one with twenty flaky ones. Add tools when the agent demonstrably needs them, not up front.

Make failures loud and structured

A tool that fails silently teaches the model nothing. Return errors as clear text the model can reason about and recover from on the next step.

Keep humans in the loop where it matters

Auto-approve low-risk, reversible actions like reading files or running a local test suite. Ask before anything destructive, external, or hard to undo.

Let the agent verify itself

Wire in tests, linters, and type checks as tools the agent can call, not just something a human runs afterward — that's what closes the loop.

Design for long tasks, not single turns

Compact context as it grows, persist what matters between sessions, and split large goals across coordinated sub-agents rather than one overloaded context window.

Want the shortcut? The Agent SDK gives you Claude Code's own tools, permission system, and orchestration as a library, so you can build a fully custom agent — your own tools, your own approval flow — without writing the loop yourself.

~/claude-code$where --am-i

One engine, every surface.

CLAUDE.md files, settings, and MCP servers work the same way wherever you start a session.

Terminal

The full CLI. Edit files, run commands, manage the whole project from the command line.

VS Code & JetBrains

Inline diffs, @-mentions, plan review, and conversation history inside your editor.

Desktop app

Review diffs visually, run sessions side by side, schedule recurring tasks.

Web & mobile

Kick off long-running tasks from claude.ai/code or the Claude app — no local setup.

~/claude-code$install --all-platforms

Get it running.

macOS / Linux / WSL
curl -fsSL https://claude.ai/install.sh | bash
Windows PowerShell
irm https://claude.ai/install.ps1 | iex
Homebrew
brew install --cask claude-code
WinGet
winget install Anthropic.ClaudeCode

Also installable via apt, dnf, or apk on Debian, Fedora, RHEL, and Alpine. After installing, run claude inside any project directory. Setting an ANTHROPIC_API_KEY environment variable skips the login prompt in favor of key approval. Native installs update automatically; Homebrew and WinGet installs need a manual upgrade periodically.

~/claude-code$man faq

Common questions.

No — the difference is that it takes direct action. It edits files, runs commands, and creates git commits itself rather than only describing what to do, and it verifies its own work by running tests as it goes.

Yes. Beyond the terminal, there are extensions for VS Code and JetBrains IDEs, a desktop app, and a web version at claude.ai/code — CLAUDE.md files, settings, and MCP servers work the same way across all of them.

A markdown file in your project root that Claude Code reads at the start of every session — coding standards, architecture notes, preferred libraries, review checklists. It also keeps its own auto memory of things it learns while working.

Yes — via routines that run on Anthropic-managed infrastructure on a schedule, or by piping it into CI with the -p flag for scripted, non-interactive runs.

It doesn't have to be — the Agent SDK exposes the same tools and orchestration Claude Code itself is built on, so you can build a fully custom agent with your own permission model on top of the same foundation.

cd your-project && claude

Point it at a real project and give it a real task — that's the fastest way to understand what it can do.

Read the full docs