Building and Operating a CLI-Based LLM Coding Assistant
anthropic · Tech · 2025 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.4 (schema v2)
Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.
Problem
Domain: CLI coding agents
Anthropic needed Claude Code to expose powerful coding-agent capabilities through a terminal-native interface that power users could compose, automate, and supervise safely.
Constraints:
- The product intentionally avoids heavy IDE scaffolding and exposes raw model capability.
- File edits, tests, bash commands, and web fetches require permission controls.
- Long sessions need compaction and simple memory primitives.
- Terminal UI rendering has cross-terminal compatibility challenges.
Architecture
Claude Code is a Unix-utility-like CLI agent with raw access to Claude in the terminal. It can read files, run commands, edit code with permission gates, compose through tmux and non-interactive mode, use simple memory/compaction primitives, render through React Ink, compile/test with Bun, and rely on humans for review and high-stakes decisions.
Diagram confidence: explicit (topology described by the source).
flowchart LR human-reviewer[Human Reviewer] --> terminal-cli[Terminal CLI] terminal-cli --> claude-agent[Claude Agent] terminal-cli --> react-ink-renderer[React Ink Renderer] claude-agent --> file-system[File System] claude-agent --> bash-tool[Bash Tool] claude-agent --> compaction[Compaction] permission-system[Permission System] --> claude-agent[Claude Agent] permission-system --> human-reviewer[Human Reviewer] bash-tool --> permission-system[Permission System]
Components
| Component | Role | Interacts with |
|---|---|---|
Terminal CLI |
Primary user interface and composable Unix-style surface. | Claude Agent, Permission System, React Ink Renderer |
Claude Agent |
Model-driven coding agent with file, command, and coding capabilities. | Terminal CLI, File System, Bash Tool, Compaction |
Permission System |
Controls file edits, tests, bash commands, and allow/deny lists. | Claude Agent, Human Reviewer |
File System |
Project files that Claude can read and, when allowed, edit. | Claude Agent |
Bash Tool |
Command execution surface with higher safety risk than reads. | Claude Agent, Permission System |
Compaction |
Summarizes prior conversation/tool history to manage long sessions. | Claude Agent |
React Ink Renderer |
Terminal UI renderer built on React translated to ANSI output. | Terminal CLI |
Human Reviewer |
Reviews, corrects, and remains responsible for merged code. | Terminal CLI, Permission System, Claude Agent |
Data flow
A user invokes Claude Code in a terminal, grants or denies tool permissions, lets the agent inspect files and run commands, optionally composes multiple sessions through tmux or non-interactive mode, and reviews resulting code changes before merge.
Why this architecture
Anthropic intentionally made Claude Code a bare-bones Unix utility to maximize composability and raw model access. The team favors simple primitives like markdown memory and model-written summaries, while adding permissions where tool use can cause real harm.
Models used: Claude · Sonnet 3.7 · Claude Code
Scale
- The article reports average spend around $6 per active user per day.“Currently, we're seeing costs around like $6 per day. per active user. And so it's like, it does come out to a bit higher over the course of a month in Cursor.”article, stated
- Some Anthropic users spend thousands of dollars per day on automation.“there's some people at Anthropic that have been racking up like thousands of dollars a day with this kind of automation.”article, stated
- Claude Code reportedly writes around 80 to 90 percent of its own code.“I won't leave it to quad because I have really strong opinions and it's easier to just do it and experiment than it is to explain it to quad. So yeah, I think that nets out to maybe like 80, 90% quad written code overall. Yeah.”article, stated
- Boris reports about 2x personal productivity, with some users seeing much higher lift.“But anecdotally for me, it's probably 2x my productivity. My God. So I'm just like, I'm an engineer that codes all day, every day. Yeah. For me, it's probably 2x.”article, stated
Alternatives considered (roads not taken)
Build an IDE-like, broad-market coding product.
Rejected because: Anthropic intentionally chose an earlier-curve terminal product rather than another Cursor/Windsurf-style tool.
Build complex memory architecture.
Rejected because: ClaudeMD used a simple auto-read markdown file as the smallest useful memory primitive.
Build tmux-style parallel workflow management into Claude Code.
Rejected because: The CLI can be composed with existing tools rather than owning every workflow.
Patterns
tool-use-orchestration (coding agent)
Claude Code uses terminal tools, file reads, file edits, tests, bash, web fetch, and non-interactive mode under user permissions.
human-in-the-loop-gate (safety)
Humans review merged code and approve dangerous actions, especially bash and file writes.
safety-policy-enforcement (permissions)
The permission system lets users allow-list or deny-list actions and gate edits/tests/commands.
context-compaction (long sessions)
Claude Code asks Claude to summarize previous messages to compact long sessions.
agent-memory (project memory)
ClaudeMD is a markdown file auto-loaded into context from root, child, or home directories.
Tradeoffs
Product surface
Chose Bare terminal utility over Polished IDE-style product.
Rationale: Raw access and composability fit power users and fast learning about agent use.
Memory design
Chose Markdown file and model summarization over Complex external memory architecture.
Rationale: The team repeatedly chose the simplest useful building block.
Automation safety
Chose Permission gates and human review over Fully autonomous command execution.
Rationale: Some workflows are safe to auto-accept, but bash and broad file changes still need oversight.
Gotchas (what bit them)
Permissionless file writes can silently go wrong.
Root cause: The model may misunderstand the task or follow prompt-injected content from fetched URLs.
Resolution: Gate edits and catch wrong paths early through permission prompts and human review.
Bash commands carry higher safety risk than file reads.
Root cause: Shell commands can be destructive, and LLM systems are nondeterministic.
Resolution: Keep humans in the loop and use explicit tool permissions.
Terminal UI implementation has platform quirks.
Root cause: ANSI behavior varies by terminal and lacks the consistency of modern browser UIs.
Resolution: Use React Ink while accounting for cross-terminal differences.
Compaction can lose original intent.
Root cause: Long conversations and repeated compaction can weaken early instructions.
Resolution: Improve effective context handling and keep the agent on track through summaries and review.
Evaluation
Claude Code's evaluation is described through internal adoption, self-use, cost/productivity signals, human review, and observed failure modes that feed model training and product improvements.
Metrics: Internal daily usage · Percentage of Claude Code-authored code · Average daily cost · Productivity lift · Human review outcomes
Outcomes
- Claude Code became a terminal-native coding agent used internally and externally.
- The article reports roughly 80-90% of Claude Code's code was written by Claude Code.
- Boris reports about 2x personal productivity and average user spend around $6 per active user per day.
The source reports average daily spend, thousands-of-dollars-per-day power automation, 80-90% self-authored code, and 2x anecdotal productivity for one engineer.