Most articles about Claude Code stop at "install the CLI, post a diff." Drop it into a real team and you quickly see: the core architecture of a top-tier AI coding tool is never just the Agent process in your terminal — it is how Diff, Fact, Context, and Workflow divide labor and close the loop inside the Cloud Mac AI Stack.
This is the L6-Q02 pillar map (L6-Q02): using Claude Code as the entry point to draw the full Stack architecture, five-module onboarding order, and system closed loop. For the operational handbook see L6-Q01 complete handbook; for permission gates see L3 decision opener — this article is the map only.
Architecture in one sentence
Claude Code produces Diff; GitHub Runner produces Fact. MCP extends Context, Ollama is optional Inference, OpenHands orchestrates Workflow — all running on Cloud Mac (L0).
Claude Code itself: the 10% breakdown (the other 90% is the Stack)
Architecture · Claude Code kernel
Define Claude Code on its own first, then where it sits. It is a terminal coding Agent, not an IDE plugin:
Single Agent loop (may iterate) Read CLAUDE.md + repo context │ ▼ Plan (which files, which commands) │ ▼ Execute (Write / Edit / Bash / optional MCP Tool) │ ▼ Verify (your test / lint) │ └──► Output Diff (git-auditable changes)
- Boundaries —
CLAUDE.mdand permission policy define what it may touch; see handbook · project boundaries - Extended senses — MCP wires GitHub Issues, CodeGraph, APIs into Context; see MCP triple-connect hub
- vs Cursor — in-editor completion vs cross-file + shell Agent; see vs Cursor
That is L3 only. The "core architecture" organizations actually trust is the Stack map below.
Cloud Mac AI Stack full map (responsibility layers)
This is the site's unified L0–L5 model — return here when reading any topic article. Important: these are responsibility layers, not runtime call order.
Stack ≠ call order
Claude Code does not depend on Ollama. MCP sits above L3 on the diagram because Context serves coding — not because MCP must boot before the CLI. Deployment order is in § onboarding order.
Outputs: Inference · Diff · Fact · Context · Workflow
┌──────────────┐
│ OpenHands │ L5 · Workflow (did the whole request finish?)
└──────┬───────┘
│
┌──────▼───────┐
│ MCP │ L4 · Context (what can the Agent see?)
└──────┬───────┘
│
┌──────▼───────┐
│ Claude Code │ L3 · Diff (what changed this round?) ← entry
└──────┬───────┘
│
┌──────▼───────┐
│ Ollama │ L2 · Inference (optional · local private compute)
└──────┬───────┘
│
┌──────▼───────┐
│ GitHub Runner│ L1 · Fact (will the org trust it?)
└──────┬───────┘
│
┌──────▼───────┐
│ Cloud Mac │ L0 · infrastructure (24/7 macOS node)
└──────────────┘
L0 holds compute, L1 holds Fact — only then Diff, Context, and Workflow. However strong Claude Code is, without L1, Diff is just local experimentation.
Five modules (+ foundation): roles and outputs
Architecture · module reference
| Layer | Module | Output | Question it answers | Deep dive |
|---|---|---|---|---|
| L0 | Cloud Mac | Foundation | Where does macOS / Apple Silicon come from? | Buy vs rent |
| L1 | GitHub Runner | Fact | Who runs xcodebuild / tests after push? | Execution engine |
| L2 | Ollama | Inference | Need local embedding / small models? | Private inference layer |
| L3 | Claude Code | Diff | Who edits code, runs shell, loops tests? | Complete handbook |
| L4 | MCP | Context | How do Issues / graph / API reach the Agent? | Triple-connect hub |
| L5 | OpenHands | Workflow | Can a full request run unattended? | Agent platform |
Workflow (L5) and Fact (L1): OpenHands repeatedly consumes Context, produces Diff, and validates with Fact during a task — not "CI only after Workflow finishes." See OpenHands · output relationships.
Recommended onboarding order: Fact before Diff
Architecture · deployment path
The hype order is usually: Claude Code first → MCP next → CI as an afterthought. We recommend this deployment sequence (different from diagram layer order):
① Cloud Mac (L0 foundation)
│ Always-on macOS · SSH · egress IP
▼
② GitHub Runner (L1 · Fact)
│ push → repeatable green/red · workspace isolation
▼
③ Ollama (L2 · Inference, optional)
│ local embedding / small models · mind L1/L3 memory
▼
④ Claude Code (L3 · Diff)
│ CLAUDE.md · permissions · day-one trial
▼
⑤ MCP (L4 · Context)
│ GitHub / CodeGraph / Fetch · least privilege
▼
⑥ OpenHands (L5 · Workflow)
│ multi-step issues · agent loop · stacks on L3
▼
⑦ System closed loop
delegate → Diff → PR → Runner Fact → review → merge
- ① L0 — Without a 24/7 macOS node, Runner and Agent fight for laptop RAM; see buy vs rent
- ② L1 — Give the org trustworthy Fact first; isolation: one job one workspace
- ③ L2 — Optional; on the same host as Claude Code and Runner see parallel scheduling
- ④–⑥ — Stack AI after Fact is stable; handbook: L6-Q01
- ⑦ Closed loop — next section
System closed loop: from Claude Code delegation to green PR
The last piece of "core architecture" is how data flows back — the Agent cannot live in an isolated terminal:
Human in the loop · L3 Developer ──delegates──► Claude Code (+ MCP Context) │ │ Diff (commit) ▼ feature branch / PR │ Machine acceptance · L1 ▼ GitHub Runner (Fact) xcodebuild / test / lint │ ├── red ──► feedback to Agent (Diff ↔ Fact) │ └── green ──► human review ──► merge Optional · L5 OpenHands clears issue queue overnight ──► same PR + Runner loop
Three hard requirements for a working loop: Runner and Agent environment isolation, PR must pass CI, production secrets never in Agent shell. Production checklist: L6-Q01 · production-grade.
Site-wide link hub: jump by layer
This article is the Stack series map page. Pick an entry by your current blocker:
| You need to… | Read |
|---|---|
| Decide on Cloud Mac / how to rent | L0 buy vs rent · M4/M5 sizing |
| CI queue / is Runner worth it | L1 queue & TCO · L1 execution engine |
| Swap / Ollama on same host as Agent | L2 parallel scheduling |
| Install Claude Code / production workflow | L6-Q01 handbook · L3 permission decision |
| Wire MCP / CodeGraph | L4 hub · MCP install guide |
| Unattended multi-step tasks | L5 OpenHands |
FAQ
What is Claude Code's core architecture? Terminal Agent loop producing Diff; production-grade also needs CLAUDE.md, MCP Context, and independent Runner Fact.
Must I install Ollama before Claude Code? No. L2 is optional; the diagram shows responsibility layers, not call order.
How is this different from the L6-Q01 handbook? Q01 is the operational spine (install→CI); Q02 is the Stack full map (this article).
Can OpenHands replace Claude Code? No. L5 orchestrates Workflow; L3 pairs to produce Diff — use them stacked.
- L6-Q01 · Claude Code complete handbook
- L1 · GitHub Runner execution engine
- L4 · MCP triple-connect hub
ZavCloud
Follow the map — start with one Cloud Mac
L0 foundation → L1 Runner → L3 Claude Code. Native macOS — trial the full closed loop in onboarding order.
View Cloud Mac plans