Claude Code¶
Anthropic's terminal-native coding agent. Used extensively by mitchell-hashimoto on ghostty during the 2025 Zed session.
Usage patterns surfaced¶
- Auto-modeling under Claude MAX plan. Alternates between Opus and Sonnet automatically; Hashimoto's Ghostty work in the session was on Claude 4 Opus.
- Custom slash commands. He maintains a GitHub-issue-triage slash command that pulls an issue by number and asks the model to explain the cause + propose a path without fixing. Good for batch triage of 5+ issues.
- System prompt toggles. For Ghostty he disables Claude's self-verification (it can't build the Mac app or read screenshots, so "success" reports are noise).
- Dangerous/YOLO mode. Auto-approve-everything mode exists; he deliberately avoids it during interactive sessions, preferring manual jujutsu snapshots between steps.
Strengths / weaknesses observed¶
- Great at Swift, refactors, renames, restructures ("almost no notes").
- Poor at Zig (low training representation) — often produces code that only compiles after hand-porting from a Python/C/Rust draft.
- Poor at preserving unusual data-structure invariants (fixed-page linked lists, 16-bit offsets) — tends to rewrite for textbook readability at the cost of performance.
Architecture (reverse-engineered by Zoneraich, Dec 2025 — unofficial, not endorsed by Anthropic)¶
Source: jared-zoneraich-claude-code-works-2026. All items below are jared-zoneraich's read from public artifacts (leaked system prompt, Codex OSS diffing, dogfooding) — treat as confidence: medium.
The master loop¶
At the core sits a roughly four-line master loop (Zoneraich cites the internal name nO): while tool calls exist, execute them, feed results back to the model, repeat; when empty, ask the user. Single-threaded, synchronous, no DAG. This is the structural reason Claude Code rides model improvements directly — see claude-code-master-loop.
Tool surface¶
Small, deliberately human-shaped. read (with token limits), edit (uses unified diffs, not full rewrites — smaller context, fewer mistakes), grep/glob (deliberately used instead of RAG/vector retrieval — "grep is how a human would do it"), bash (the load-bearing one — see bash-as-universal-tool), web_fetch/web_search (punted to a cheaper sub-model), TodoWrite (see claude-code-todo-tool), and task (sub-agent spawn).
Plan / to-do tool¶
TodoWrite emits a structured plan (id hash, title, status, optional evidence blob) on the first turn. Enforcement is prompt-level only — one-task-at-a-time, mark-complete, resume-in-progress-first — relying on 2025-era instruction following. Doubles as UX ("you can see progress") and crash resumability.
Sub-agent spawning¶
The task tool is the sub-agent entrypoint. Call signature: description (user-facing label) + prompt (freeform string → main agent literally prompts its child). Sub-agent has its own context window, runs to completion (parallelisable), returns only results to the parent — classic subagent-architecture discipline. Default archetypes Zoneraich surfaces: researcher, docs-reader, test-runner, code-reviewer, explore. Zoneraich notes the child-prompt is a freeform string today and would benefit from being a structured object.
Context compaction (H2A)¶
Async I/O buffer (H2A) decouples terminal/reasoning streams. At ~92% context fill, the loop summarises head+tail, drops the middle, and continues. Long-term memory is offloaded to disk via bash (markdown notes written + re-read). See context-compaction; alternative designs (Amp's handoff, Cursor Composer's distilled model) are contrasted.
Skills¶
Lazy-loaded extendable system prompts, addressable by a short description. Intended to be auto-invoked by the main loop on matching tasks; in practice selection is flaky and users often invoke manually. See claude-code-skills.
Slash commands¶
Persistent user-authored prompt templates bound to /name (Hashimoto's GitHub-issue-triage above is the canonical example). Overlap with skills, but slash commands are explicitly user-triggered — a deterministic escape hatch when skill auto-selection fails.
System prompt¶
Leaked version (Zoneraich references a public mirror; the prompt file actually lives on-disk on the user machine, per audience correction) contains: "concise output, no preamble, prefer tools over prose, match existing style, no new comments, run independent operations in parallel, read before editing, quote paths with spaces, think/think hard/think harder/ultrathink thinking-budget triggers." Most of it reads as dogfooding artefacts — "someone at Anthropic said 'if only it did this a little less'".
Sandboxing & permissions¶
The most code-heavy subsystem. Bash prefixes are routed through a gating pipeline; web_fetch is isolated inside a sub-agent to contain prompt-injection from the open web; URL allow-lists are enforced. YOLO mode exists (off by default), and some team members of Zoneraich's have "dropped all their local databases" via YOLO — a recurring cautionary tale.
Related¶
- mitchell-hashimoto · ghostty · agentic-engineering · vibe-coding · andrej-karpathy · mitchell-hashimoto-zed-agentic-2025
- Architecture-section cross-links: jared-zoneraich · promptlayer · claude-code-master-loop · claude-code-todo-tool · claude-code-skills · bash-as-universal-tool · context-compaction · subagent-architecture · agent-smell · jared-zoneraich-claude-code-works-2026