Sub topic 1
What a Terminal Coding Agent Is
A terminal coding agent is a language-model application that works inside your shell. It can inspect a repository, edit files, run commands, and report observations. Claude Code, Codex CLI, and Copilot CLI use this general model.
Prerequisites
You should be comfortable with a shell, basic Git commands, npm, and your project's test command. You should also understand that an agent can change files or run commands with your permissions.
How the Agent Loop Works
The agent repeats a simple loop:
- The model chooses an action from your request and the available tools.
- The tool reads files, edits code, or runs a shell command.
- The agent observes the result.
- The model decides whether to continue, revise its plan, or stop.
A request such as “fix the failing test” may therefore involve searching for the test, reading related code, editing a file, running the test, and inspecting the failure.
The Tools an Agent Can Call
Typical built-in tools include:
| Tool | Purpose |
|---|---|
| File search and read | Find and understand repository code |
| File edit | Apply a proposed change |
| Shell | Run tests, builds, formatters, and Git |
| Search | Find symbols, text, or references |
The model does not directly “know” that a change works. It must call a test or build command and inspect the output.
Installing and Signing In
Each tool is distributed as an npm package. Install it, authenticate when prompted, then start it from your project directory.
npm install -g @anthropic-ai/claude-code
npm install -g @openai/codex
npm install -g @github/copilot
cd my-project
claude
codex
copilotThe exact sign-in flow depends on the provider. Do not place API keys in repository files or shell history.
Working in an Interactive Session
Begin with a specific goal and state constraints. For example: “Explain the failing test, make the smallest fix, and run the focused test. Do not edit generated files.” Review proposed commands and changes before approving them.
Context, History, and Focus
The context window is the information available to the model in one turn or session. Long conversations and unrelated files consume that space. Keep a session focused, summarize decisions, and start a new session when the task changes. Use Git commits or a branch to preserve reliable history.
Exercise
Why should an agent run tests after editing a file?
Show answer
The model needs an observation from the test command to check whether its change works and to discover regressions.