Tutorial

Local AI Coding Agents

What a local AI coding agent really is, why local does not mean offline, how Claude Code and Codex CLI compare, and a safe path to your first project.

AI-assisted draft, human-reviewed before publication.

A local AI coding agent is a program that runs in your computer’s terminal, reads the files in a project folder, and can edit them or run commands on your behalf — with an AI model doing the reasoning. Claude Code and Codex CLI are the two best-known examples, and this guide explains what they are, what “local” actually means, how to choose between them, and how to practice safely on a first project.

It assumes no prior terminal experience beyond the ability to open one.

What a local AI coding agent is

A chatbot answers one message at a time in a text box. A coding agent works in a loop: you state a goal, it reads the project, plans steps, edits files, runs builds or tests, reads the errors, and tries again until the goal is met or it gets stuck. (For the deeper conceptual difference between chatbots and agents, see AI Agents vs Chatbots.)

The “local” part means three concrete things:

  • The program itself runs on your machine, in your terminal.
  • It reads and writes files directly in your project folder — no copy-pasting code into a website.
  • It can execute local commands such as npm run build when you permit it.

A typical interaction looks like this:

Please change the homepage title to "Learn Web4" and check whether the build still passes.

The agent finds the right file, proposes or makes the edit, runs the build, and reports the result. You review the change before accepting it.

”Local” does not mean offline

This is the most common misunderstanding, and it is worth being precise about it.

With Claude Code and Codex CLI, the tool runs locally but the model does not. Your code is read on your machine, then the relevant parts are sent over the internet to a cloud API — Anthropic’s or OpenAI’s — where the model generates a response. The response comes back, and the local tool applies edits or runs commands.

+------------------+        HTTPS         +-----------------------+
|  Your computer   |  ----------------->  |  Cloud API            |
|  terminal agent  |   code + prompt      |  (Claude / OpenAI     |
|  reads + edits   |  <-----------------  |   model does the      |
|  local files     |   instructions       |   thinking)           |
+------------------+                      +-----------------------+

Practical consequences:

  • You need an internet connection and an account. Neither tool is a free, offline code generator.
  • Your code leaves your machine and goes to the model provider’s servers. For a personal learning project this is usually fine; for an employer’s proprietary codebase, check the policy first. Both providers document their data handling in their docs — read it before pointing an agent at sensitive code.
  • “Local” is about where the work happens (your files, your terminal), not about where the thinking happens.

Fully offline coding agents do exist — tools that run open-weight models on your own hardware — but they are a different category with much heavier setup, and they are not what Claude Code or Codex CLI are.

The two tools, briefly

Claude Code

Claude Code is Anthropic’s terminal coding agent. You cd into a project folder, run claude, and talk to it about the code: ask it to explain a file, edit a component, fix a build error, or plan a larger change in steps.

Current recommended install on macOS/Linux (Official requirement — see the setup docs):

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

It requires a paid Claude plan or an Anthropic Console account with API billing; there is no free tier for normal use.

For the full walkthrough — prerequisites, install, first run, login, verification — use the Claude Code Installation Guide. Those steps are intentionally not repeated here.

Codex CLI

Codex CLI is OpenAI’s terminal coding agent. Running codex in a project folder opens a session where it can read code, propose changes, and — with your approval — edit files and run commands.

Current install options (Official requirement — see the docs and GitHub repository):

# Option 1: install script
curl -fsSL https://chatgpt.com/codex/install.sh | sh

# Option 2: npm
npm install -g @openai/codex

# Option 3: Homebrew
brew install --cask codex

Two facts worth knowing: Codex CLI has been rewritten in Rust, so it no longer needs a Node.js runtime to run (npm is just one distribution channel), and it requires a paid ChatGPT plan or an OpenAI API key.

Full install and first-run steps live in the Codex CLI Installation Guide.

Which tool should a beginner pick?

Both tools do the same core job, and the workflow you learn on one transfers to the other. The real decision is usually about which account you already have, not about features.

CriterionClaude CodeCodex CLIOther local agents (Aider, Continue, open-source CLIs)
Ecosystem / modelAnthropic’s Claude modelsOpenAI’s models (GPT family, codex variants)Varies — many let you pick a model or provider
Pricing modelPaid Claude subscription or Anthropic API billingPaid ChatGPT subscription or OpenAI API keyTool often free; you still pay for model API access
InterfaceTerminal, conversational agent loopTerminal, conversational agent loop with approval modesMixed — terminal, IDE extensions, or both
Runs without Node.jsYes (native installer)Yes (Rust binary; npm optional)Varies
Best fit if…You already pay for ClaudeYou already pay for ChatGPT or have API creditsYou want model flexibility or local/offline models

Decision advice in one sentence: pick the tool that matches the subscription you already have, install it, and start practicing — switching later costs almost nothing because the skills (reading diffs, scoping requests, reviewing output) are the same.

If you have neither subscription, compare the current plan prices on the providers’ sites before committing; both change their packaging from time to time.

A beginner path that works

This path goes from zero to a first small project. Each step is small on purpose.

Step 1: Install one tool

One, not both. Follow the Claude Code Installation Guide or the Codex CLI Installation Guide, then come back here.

Step 2: Open a project

In the terminal, move into a project folder:

cd my-first-website

If you ever lose track of where you are, pwd prints the current path.

Step 3: Ask the agent to read before it writes

The first request in any project should be read-only:

Please read this project first. Tell me what framework it uses, where the pages are, and where the content files are. Do not modify any files yet.

You get a map of the project, and you get to see whether the agent’s understanding matches reality before it touches anything.

Step 4: Make one small change

Please rewrite the homepage subtitle so it fits Web4 learners better. Only change the necessary files and tell me what you changed.

Small changes are reviewable. Read the diff, ask why it chose that approach, and check that the build still passes.

Step 5: Build a personal website

Once steps 1–4 feel comfortable, apply them to a real first project: a simple personal site with an introduction, a skills list, a project showcase, and contact information. The full practice project is in Build a Personal Website with AI.

Failure scenario: the sweeping change with no Git

This is the most common way a first session goes wrong, and it is worth walking through before it happens to you.

You ask for something broad — “redesign the site and clean up the code.” The agent edits fifteen files across the project. The build now fails with an error you do not recognize. You ask the agent to fix it; it changes more files, some of which were fine. After three rounds of this, the site is worse than when you started, the agent has lost track of its own earlier edits, and you have no way back to the working version — because the folder was never a Git repository, so there is no history to restore. Nothing here is recoverable except by hand.

The prevention habit costs two commands:

# Inside the project folder, before the first agent session:
git init
git add . && git commit -m "working state before AI session"

Now every agent edit is reversible. After each accepted change, commit again. If a session goes sideways:

git status            # what changed?
git diff              # show the actual edits
git checkout -- .     # discard everything since the last commit

Git is not optional tooling for agent-assisted coding; it is the undo system the whole workflow depends on.

Safety habits worth keeping

  • Read before write. First request in any unfamiliar project: explain the structure, modify nothing.
  • One small goal per request. “Rewrite the homepage subtitle” is a good request. “Build me a business site with SEO, an admin panel, and payments” is how the failure scenario above starts.
  • Read the diff before accepting. Both tools show you what they want to change. If you cannot tell what an edit does, ask the agent to explain it before approving.
  • Commit after every accepted change. Small commits mean small, cheap reversals.
  • Check the result, not just the diff. Run the build. Open the page, including on a phone-sized viewport.

Honest limits

Local coding agents are genuinely useful, but a few limits shape what you should expect (Editorial interpretation, based on documented behavior and common usage):

  • Cost is real and ongoing. Both tools require a paid plan or metered API access. Heavy sessions — large refactors, long debugging loops — consume subscription allowances or API credits faster than casual chatting does. Check your provider’s usage page after the first few sessions so the consumption rate is not a surprise.
  • Context windows are finite. An agent cannot hold an entire large repository in mind at once. It reads what it judges relevant, which means it can miss a file that matters. In small projects this rarely bites; in large ones it is a constant background risk.
  • Mistakes scale with repository size. On a fresh personal site, agents are reliable. On a large, unfamiliar codebase with unusual conventions, they make more wrong assumptions, edit the wrong abstraction, or “fix” a symptom instead of the cause. This is another reason the Git habit above is non-negotiable.
  • They do not know what they cannot see. An agent does not know your hosting setup, your browser support requirements, or why a weird-looking line exists, unless that context is in the repository or you say it.

None of these are reasons to avoid the tools. They are reasons to keep goals small, diffs reviewed, and version control on.

Where to go next

Further reading

FAQ

Does a local AI coding agent work without the internet?

Usually no. Local means the tool runs in your terminal and reads and edits files on your machine, but the model itself typically runs in a cloud API from Anthropic or OpenAI, so an internet connection and a paid account or API key are required for normal use.

Which should I install first, Claude Code or Codex CLI?

Pick the one that matches the account you already pay for. If you have a Claude subscription, start with Claude Code; if you have a ChatGPT subscription or an OpenAI API key, start with Codex CLI. The workflow you learn transfers between them.

Do I need to know Git before using an AI coding agent?

You do not need to master Git, but you should run your practice inside a Git repository and know two commands: git status to see what changed and git checkout -- . to discard changes. Without version control, a bad agent edit can be impossible to undo.

Changelog

  • : Rewritten as a hub guide: updated Claude Code and Codex CLI install facts, added a tool decision table, a no-Git failure scenario, and an honest limits section; recategorized to Tutorial.
  • : Initial publication.