Diagrams
πΊοΈ Diagrams β Module 0.1: What Is a Harness?
01
Diagram 1 β The Three-Layer Harness Architecture
Mermaid (flowchart)
flowchart TB
subgraph WORLD[" World "]
direction TB
FS[(Filesystem)]
NET[(Network / APIs)]
SHELL[(Shell / OS)]
HUMAN((Human))
end
subgraph SAFETY[" π Safety Layer "]
direction LR
PERMS[Permission Flags]
SANDBOX[Sandbox / Isolation]
STOPS[Stop Conditions]
TRUST[Trust Boundaries]
end
subgraph TOOLS[" π§ Tool Layer "]
direction LR
REG[Tool Registry]
DISPATCH[Tool Dispatcher]
SCHEMA[Schema Validator]
EXEC[Tool Executor]
end
subgraph LOOP[" π Loop Layer "]
direction TB
CTX[Context Manager]
CALL[Model Call]
PARSE[Response Parser]
UPDATE[Context Update]
end
MODEL((" π§ Model\n~1.6%"))
WORLD --> SAFETY
SAFETY --> TOOLS
TOOLS --> LOOP
LOOP <--> MODEL
EXEC --> WORLD
PERMS --> EXEC
style WORLD fill:#1a1a2e,stroke:#4a4a8a,color:#a0a0d0
style SAFETY fill:#2d1515,stroke:#8a2020,color:#d0a0a0
style TOOLS fill:#152d15,stroke:#208a20,color:#a0d0a0
style LOOP fill:#15152d,stroke:#20208a,color:#a0a0d0
style MODEL fill:#2d2d00,stroke:#8a8a00,color:#d0d00002
Diagram 2 β The Thickness Spectrum
Mermaid (quadrantChart / custom flowchart)
flowchart LR
subgraph THIN[" β Thin "]
PI["Pi\n4 tools\n<1k tokens\n~1,200 LOC"]
end
subgraph MEDIUM_THIN[" Thin-Medium "]
AIDER["Aider\n~8 tools\n~2k tokens\n~25k LOC"]
end
subgraph MEDIUM[" Medium "]
CODEX["Codex CLI\n~10 tools\n~3k tokens\nRust"]
GEMINI["Gemini CLI\n~12 tools\n~4k tokens\nGo"]
OC["OpenCode\n~15 tools\n~5k tokens\nTS"]
end
subgraph THICK_MEDIUM[" Medium-Thick "]
OMO["oh-my-opencode\n~20 tools (meta)\n~8k tokens\nSubagent hierarchy"]
end
subgraph THICK[" Thick β "]
CC["Claude Code\n40+ tools\n~40k tokens\n40 permission flags"]
NEMO["NemoClaw\n40+ tools\n~40k tokens\nExternal governance"]
end
PI --> AIDER --> CODEX --> GEMINI --> OC --> OMO --> CC --> NEMO
style THIN fill:#0d1b2a,stroke:#1b4f72,color:#85c1e9
style MEDIUM_THIN fill:#0d1b2a,stroke:#1b6fa8,color:#85c1e9
style MEDIUM fill:#0d2818,stroke:#1e8449,color:#82e0aa
style THICK_MEDIUM fill:#2a1810,stroke:#a04000,color:#f0a868
style THICK fill:#2a0d0d,stroke:#a00000,color:#f0808003
Diagram 3 β Convergent Evolution: Four Independent Teams, One Architecture
Mermaid (sequence diagram)
sequenceDiagram
participant Anthropic as Anthropic<br/>(Claude Code / Pi)
participant OpenAI as OpenAI<br/>(Codex CLI / Agents SDK)
participant Google as Google DeepMind<br/>(Gemini CLI)
participant OSS as Open Source<br/>(Aider / oh-my-opencode)
Note over Anthropic,OSS: 2022-2023 β Independent R&D
Anthropic->>Anthropic: Build ReAct loop + tool registry
OpenAI->>OpenAI: Build function calling + execution loop
Google->>Google: Build Gemini tool use + agent loop
OSS->>OSS: Build git-first loop + tool interface
Note over Anthropic,OSS: 2024 β Public releases reveal convergence
Anthropic-->>OpenAI: Same structure: loop + tools + safety
OpenAI-->>Google: Same structure: loop + tools + safety
Google-->>OSS: Same structure: loop + tools + safety
Note over Anthropic,OSS: 2025-2026 β Differentiation is in THICKNESS, not STRUCTURE
Anthropic->>Anthropic: Claude Code: 40 flags, ~40k token prompt
OpenAI->>OpenAI: Agents SDK: 7 sandbox providers, handoffs
Google->>Google: Gemini CLI: Rate-limit architecture, model-lock tradeoffs
OSS->>OSS: oh-my-opencode: Meta-harness, subagent hierarchy
Note over Anthropic,OSS: Conclusion: The 3-layer architecture is the invariant.<br/>Thickness is the variable. Learn the invariant first.04
Diagram 4 β Harness Component Map (draw.io XML)
draw.io XML
draw.io XML (click to expand)
<?xml version="1.0" encoding="UTF-8"?>
<mxGraphModel dx="1422" dy="762" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1169" pageHeight="827" math="0" shadow="0">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- TITLE -->
<mxCell id="2" value="Production Harness Component Map" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=18;fontStyle=1;fontColor=#FFFFFF;" vertex="1" parent="1">
<mxGeometry x="200" y="20" width="760" height="40" as="geometry" />
</mxCell>
<!-- BACKGROUND -->
<mxCell id="3" value="" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#1a1a2e;strokeColor=#4a4a8a;" vertex="1" parent="1">
<mxGeometry x="40" y="80" width="1080" height="700" as="geometry" />
</mxCell>
<!-- WORLD BOX -->
<mxCell id="10" value="World" style="text;html=1;strokeColor=#4a4a8a;fillColor=#0d0d1f;align=center;verticalAlign=top;whiteSpace=wrap;rounded=1;fontSize=14;fontStyle=1;fontColor=#a0a0ff;" vertex="1" parent="1">
<mxGeometry x="60" y="100" width="200" height="260" as="geometry" />
</mxCell>
<mxCell id="11" value="Filesystem" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#152015;strokeColor=#207a20;fontColor=#80c080;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="80" y="140" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="12" value="Network / APIs" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#152015;strokeColor=#207a20;fontColor=#80c080;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="80" y="195" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="13" value="Shell / OS" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#152015;strokeColor=#207a20;fontColor=#80c080;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="80" y="250" width="160" height="40" as="geometry" />
</mxCell>
<mxCell id="14" value="Human" style="ellipse;whiteSpace=wrap;html=1;fillColor=#2d1515;strokeColor=#8a2020;fontColor=#d09090;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="100" y="305" width="120" height="40" as="geometry" />
</mxCell>
<!-- SAFETY BOX -->
<mxCell id="20" value="Safety Layer" style="text;html=1;strokeColor=#8a2020;fillColor=#1f0a0a;align=center;verticalAlign=top;whiteSpace=wrap;rounded=1;fontSize=14;fontStyle=1;fontColor=#d08080;" vertex="1" parent="1">
<mxGeometry x="280" y="100" width="200" height="260" as="geometry" />
</mxCell>
<mxCell id="21" value="Permission Flags" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#2d1515;strokeColor=#8a2020;fontColor=#d09090;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="295" y="140" width="170" height="40" as="geometry" />
</mxCell>
<mxCell id="22" value="Sandbox / Isolation" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#2d1515;strokeColor=#8a2020;fontColor=#d09090;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="295" y="195" width="170" height="40" as="geometry" />
</mxCell>
<mxCell id="23" value="Stop Conditions" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#2d1515;strokeColor=#8a2020;fontColor=#d09090;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="295" y="250" width="170" height="40" as="geometry" />
</mxCell>
<mxCell id="24" value="Trust Boundaries" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#2d1515;strokeColor=#8a2020;fontColor=#d09090;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="295" y="305" width="170" height="40" as="geometry" />
</mxCell>
<!-- TOOL BOX -->
<mxCell id="30" value="Tool Layer" style="text;html=1;strokeColor=#207a20;fillColor=#0a1f0a;align=center;verticalAlign=top;whiteSpace=wrap;rounded=1;fontSize=14;fontStyle=1;fontColor=#80d080;" vertex="1" parent="1">
<mxGeometry x="500" y="100" width="200" height="260" as="geometry" />
</mxCell>
<mxCell id="31" value="Tool Registry" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#152d15;strokeColor=#208a20;fontColor=#80d080;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="515" y="140" width="170" height="40" as="geometry" />
</mxCell>
<mxCell id="32" value="Schema Validator" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#152d15;strokeColor=#208a20;fontColor=#80d080;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="515" y="195" width="170" height="40" as="geometry" />
</mxCell>
<mxCell id="33" value="Tool Dispatcher" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#152d15;strokeColor=#208a20;fontColor=#80d080;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="515" y="250" width="170" height="40" as="geometry" />
</mxCell>
<mxCell id="34" value="Tool Executor" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#152d15;strokeColor=#208a20;fontColor=#80d080;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="515" y="305" width="170" height="40" as="geometry" />
</mxCell>
<!-- LOOP BOX -->
<mxCell id="40" value="Loop Layer" style="text;html=1;strokeColor=#20208a;fillColor=#0a0a1f;align=center;verticalAlign=top;whiteSpace=wrap;rounded=1;fontSize=14;fontStyle=1;fontColor=#80a0ff;" vertex="1" parent="1">
<mxGeometry x="720" y="100" width="200" height="260" as="geometry" />
</mxCell>
<mxCell id="41" value="Context Manager" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#15152d;strokeColor=#20208a;fontColor=#80a0d0;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="735" y="140" width="170" height="40" as="geometry" />
</mxCell>
<mxCell id="42" value="Model Call" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#15152d;strokeColor=#20208a;fontColor=#80a0d0;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="735" y="195" width="170" height="40" as="geometry" />
</mxCell>
<mxCell id="43" value="Response Parser" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#15152d;strokeColor=#20208a;fontColor=#80a0d0;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="735" y="250" width="170" height="40" as="geometry" />
</mxCell>
<mxCell id="44" value="Context Updater" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#15152d;strokeColor=#20208a;fontColor=#80a0d0;fontSize=11;" vertex="1" parent="1">
<mxGeometry x="735" y="305" width="170" height="40" as="geometry" />
</mxCell>
<!-- MODEL -->
<mxCell id="50" value="Language Model
(~1.6% of system)" style="ellipse;whiteSpace=wrap;html=1;fillColor=#2d2d00;strokeColor=#8a8a00;fontColor=#d0d000;fontSize=13;fontStyle=1;" vertex="1" parent="1">
<mxGeometry x="940" y="180" width="160" height="80" as="geometry" />
</mxCell>
<!-- ARROWS: World to Safety -->
<mxCell id="60" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;strokeColor=#4a4a8a;fontColor=#a0a0d0;" edge="1" parent="1" source="12" target="22">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- ARROWS: Safety to Tools -->
<mxCell id="61" style="edgeStyle=orthogonalEdgeStyle;rounded=0;strokeColor=#8a4040;fontColor=#d09090;" edge="1" parent="1" source="21" target="31">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- ARROWS: Tools to Loop -->
<mxCell id="62" style="edgeStyle=orthogonalEdgeStyle;rounded=0;strokeColor=#408a40;fontColor=#80d080;" edge="1" parent="1" source="33" target="43">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- ARROWS: Loop to Model -->
<mxCell id="63" style="edgeStyle=orthogonalEdgeStyle;rounded=0;strokeColor=#4040aa;fontColor=#8080d0;" edge="1" parent="1" source="42" target="50">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<!-- LEGEND -->
<mxCell id="70" value="Reading: Model calls pass LEFT through layers. World results pass RIGHT.
The model never touches the World directly β every action is mediated by Loop β Tools β Safety." style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;fontSize=11;fontColor=#a0a0c0;" vertex="1" parent="1">
<mxGeometry x="60" y="640" width="1080" height="60" as="geometry" />
</mxCell>
</root>
</mxGraphModel>05
Diagram 5 β The ReAct Loop (Mermaid sequence)
Mermaid (sequence diagram)
sequenceDiagram
participant H as Harness<br/>(Loop Controller)
participant M as Model<br/>(LLM API)
participant T as Tool<br/>(Executor)
H->>M: [System prompt]<br/>[Tool definitions]<br/>[Conversation history]<br/>[User: "refactor auth.ts"]
Note over M: Thinks: I should read the file first.
M-->>H: tool_use: read_file({path: "src/auth.ts"})
H->>T: read_file("src/auth.ts")
T-->>H: {content: "...248 lines of TS...", tokens: 1840}
H->>M: [Same context +]<br/>tool_result: {content: "...248 lines..."}
Note over M: Thinks: The function is too long.<br/>I'll extract the validation logic.
M-->>H: tool_use: write_file({path: "src/auth.ts", content: "..."})
H->>T: write_file(...)
T-->>H: {status: "ok", bytes_written: 3420}
H->>M: [Same context +]<br/>tool_result: {status: "ok"}
Note over M: Task complete. No more tool calls needed.
M-->>H: stop_reason: "end_turn"<br/>content: "I've refactored auth.ts..."
H->>H: Loop exits. Return final content to user.06
Diagram 6 β The Harness Loop as a Runnable n8n Workflow
n8n importable workflow JSON (primary visual) + node-graph reference
Harness Loop β Module 0.1 Reference
Import this workflow: n8n β Workflows β Import from File. Hover nodes for details.