# fareedkhan-dev/building-claude-from-scratch architecture

> Architecture diagram of the GitHub repository fareedkhan-dev/building-claude-from-scratch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fareedkhan-dev/building-claude-from-scratch
- Repository: https://github.com/fareedkhan-dev/building-claude-from-scratch

## Overview

This repository is an executable notebook reproducing an agentic harness on an open-source model, with a research-paper replication as its end-to-end task. The documented workflow combines reasoning, orchestration, tool-grounded execution, reliability, stateful memory, and verification to produce a mechanically graded result. The graph follows README-level relationships only: no notebook source excerpts were provided, so internal calls and data transfers cannot be verified.

Main entry points: [`claude_from_scratch.ipynb`](https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb) (End To End Run)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cognition["Cognition"]
  node_phase1["Cognitive Substrate"]
  node_phase5["Frontier Patterns"]
end

subgraph group_orchestration["Orchestration"]
  node_phase2["Reasoning Topology"]
  node_phase3["Tool Execution"]
  node_phase6["Stateful Orchestration"]
  node_phase8["End To End Run"]
  node_subagents["Specialist Subagents"]
  node_masterloop["Master Loop"]
end

subgraph group_reliability["Reliability"]
  node_phase4["Production Reliability"]
  node_budget["Budget Guard"]
end

subgraph group_grounding["Grounding And Trust"]
  node_phase7["Grounding And Evaluation"]
  node_verdict["Pytest Verdict"]
end

node_researcher(("Research Task"))
node_paper["Dengue Paper"]
node_dataset[("DATASUS Data")]
node_model["Open Model"]

node_researcher -->|"runs task"| node_phase8
node_paper -->|"replicates findings"| node_phase8
node_dataset -->|"grounds task"| node_phase8
node_model -->|"powers harness"| node_phase8
node_phase1 -->|"composes into"| node_phase8
node_phase2 -->|"composes into"| node_phase8
node_phase3 -->|"composes into"| node_phase8
node_phase4 -->|"composes into"| node_phase8
node_phase5 -->|"composes into"| node_phase8
node_phase6 -->|"composes into"| node_phase8
node_phase7 -->|"composes into"| node_phase8
node_phase8 -->|"includes"| node_subagents
node_phase8 -->|"orchestrates"| node_masterloop
node_phase8 -->|"meters steps"| node_budget
node_phase8 -->|"produces"| node_verdict

click node_phase1 "https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb"
click node_phase2 "https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb"
click node_phase3 "https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb"
click node_phase4 "https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb"
click node_phase5 "https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb"
click node_phase6 "https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb"
click node_phase7 "https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb"
click node_phase8 "https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb"
click node_subagents "https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb"
click node_masterloop "https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb"
click node_budget "https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb"
click node_verdict "https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_phase1,node_phase5 toneBlue
class node_phase2,node_phase3,node_phase6,node_phase8,node_subagents,node_masterloop,node_dataset toneAmber
class node_phase4,node_budget toneMint
class node_phase7,node_verdict,node_researcher toneRose
class node_paper,node_model toneIndigo
```

## Components

### Cognition

- [Cognitive Substrate](https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb): `claude_from_scratch.ipynb`
- [Frontier Patterns](https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb): `claude_from_scratch.ipynb`

### Orchestration

- [Reasoning Topology](https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb): `claude_from_scratch.ipynb`
- [Tool Execution](https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb): `claude_from_scratch.ipynb`
- [Stateful Orchestration](https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb): `claude_from_scratch.ipynb`
- [End To End Run](https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb): `claude_from_scratch.ipynb`
- [Specialist Subagents](https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb): `claude_from_scratch.ipynb`
- [Master Loop](https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb): `claude_from_scratch.ipynb`

### Reliability

- [Production Reliability](https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb): `claude_from_scratch.ipynb`
- [Budget Guard](https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb): `claude_from_scratch.ipynb`

### Grounding And Trust

- [Grounding And Evaluation](https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb): `claude_from_scratch.ipynb`
- [Pytest Verdict](https://github.com/fareedkhan-dev/building-claude-from-scratch/blob/main/claude_from_scratch.ipynb): `claude_from_scratch.ipynb`

### Other components

- **Research Task**
- **Dengue Paper**
- **DATASUS Data**
- **Open Model**

## Connections

- Research Task → End To End Run: runs task (evidence: `README.md`)
- Dengue Paper → End To End Run: replicates findings (evidence: `README.md`)
- DATASUS Data → End To End Run: grounds task (evidence: `README.md`)
- Open Model → End To End Run: powers harness (evidence: `README.md`)
- Cognitive Substrate → End To End Run: composes into (evidence: `README.md`)
- Reasoning Topology → End To End Run: composes into (evidence: `README.md`)
- Tool Execution → End To End Run: composes into (evidence: `README.md`)
- Production Reliability → End To End Run: composes into (evidence: `README.md`)
- Frontier Patterns → End To End Run: composes into (evidence: `README.md`)
- Stateful Orchestration → End To End Run: composes into (evidence: `README.md`)
- Grounding And Evaluation → End To End Run: composes into (evidence: `README.md`)
- End To End Run → Specialist Subagents: includes (evidence: `README.md`)
- End To End Run → Master Loop: orchestrates (evidence: `README.md`)
- End To End Run → Budget Guard: meters steps (evidence: `README.md`)
- End To End Run → Pytest Verdict: produces (evidence: `README.md`)
