# shareai-lab/learn-claude-code architecture

> Architecture diagram of the GitHub repository shareai-lab/learn-claude-code, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shareai-lab/learn-claude-code
- Repository: https://github.com/shareai-lab/learn-claude-code

## Overview

Learn Claude Code is an educational site and companion collection of progressively richer Python harness examples, not a deployed agent service. A learner opens a versioned lesson, then explores its explanation, runnable simulation, source, and architecture deep dive; the repository’s examples teach the agent loop and harness capabilities such as tools, permissions, knowledge loading, context management, and coordination. The version page-to-client relationship and the client’s rendered panels are visible in excerpts. Other example-to-capability relationships are based on README descriptions or are left unverified where implementation excerpts are absent.

Main entry points: [`s01_agent_loop/code.py`](https://github.com/shareai-lab/learn-claude-code/blob/main/s01_agent_loop/code.py) (Agent loop), [`s02_tool_use/code.py`](https://github.com/shareai-lab/learn-claude-code/blob/main/s02_tool_use/code.py) (Tool execution), [`s10_task_system/code.py`](https://github.com/shareai-lab/learn-claude-code/blob/main/s10_task_system/code.py) (Persistent tasks), [`s15_integrated_harness/code.py`](https://github.com/shareai-lab/learn-claude-code/blob/main/s15_integrated_harness/code.py) (Integrated harness)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Learning site"]
  node_version_page["Version lesson<br/>[page.tsx]"]
  node_lesson_client["Lesson panels<br/>[client.tsx]"]
  node_diff_page["Version diff<br/>[diff-content.tsx]"]
  node_simulator["Loop simulator"]
end

subgraph group_harness["Harness examples"]
  node_agent_loop["Agent loop<br/>[code.py]"]
  node_tool_use["Tool execution<br/>[code.py]"]
  node_permissions["Permission boundaries<br/>[code.py]"]
  node_hooks["Lifecycle hooks<br/>[code.py]"]
  node_skills["On-demand skills<br/>[code.py]"]
  node_context["Context compaction<br/>[code.py]"]
  node_memory["Agent memory<br/>[code.py]"]
end

subgraph group_coordination["Agent coordination"]
  node_tasks["Persistent tasks<br/>[code.py]"]
  node_background["Background work<br/>[code.py]"]
  node_teams["Agent teams<br/>[code.py]"]
end

subgraph group_runtime["Runtime extensions"]
  node_mcp["MCP plugins<br/>[code.py]"]
  node_integrated["Integrated harness<br/>[code.py]"]
  node_workflow["Workflow runtime<br/>[code.py]"]
  node_goals["Goal loop<br/>[code.py]"]
end

node_learner(("Learner"))

node_learner -->|"opens lesson"| node_version_page
node_version_page -->|"renders"| node_lesson_client
node_lesson_client -->|"renders simulator"| node_simulator
node_learner -.->|"opens comparison"| node_diff_page
node_learner -.->|"studies example"| node_agent_loop
node_agent_loop -.->|"adds tools"| node_tool_use
node_tool_use -.->|"adds boundaries"| node_permissions
node_agent_loop -.->|"extends harness"| node_hooks
node_agent_loop -.->|"loads knowledge"| node_skills
node_agent_loop -.->|"manages context"| node_context
node_context -.->|"extends continuity"| node_memory
node_agent_loop -.->|"persists goals"| node_tasks
node_tasks -.->|"adds async work"| node_background
node_tasks -.->|"coordinates agents"| node_teams
node_tool_use -.->|"adds integrations"| node_mcp
node_agent_loop -.->|"combines mechanisms"| node_integrated
node_integrated -.->|"adds workflows"| node_workflow
node_integrated -.->|"extends autonomy"| node_goals

click node_version_page "https://github.com/shareai-lab/learn-claude-code/blob/main/web/src/app/%5Blocale%5D/(learn)/%5Bversion%5D/page.tsx"
click node_lesson_client "https://github.com/shareai-lab/learn-claude-code/blob/main/web/src/app/%5Blocale%5D/(learn)/%5Bversion%5D/client.tsx"
click node_diff_page "https://github.com/shareai-lab/learn-claude-code/blob/main/web/src/app/%5Blocale%5D/(learn)/%5Bversion%5D/diff/diff-content.tsx"
click node_simulator "https://github.com/shareai-lab/learn-claude-code/blob/main/web/src/components/simulator/agent-loop-simulator.tsx"
click node_agent_loop "https://github.com/shareai-lab/learn-claude-code/blob/main/s01_agent_loop/code.py"
click node_tool_use "https://github.com/shareai-lab/learn-claude-code/blob/main/s02_tool_use/code.py"
click node_permissions "https://github.com/shareai-lab/learn-claude-code/blob/main/s03_permission/code.py"
click node_hooks "https://github.com/shareai-lab/learn-claude-code/blob/main/s04_hooks/code.py"
click node_skills "https://github.com/shareai-lab/learn-claude-code/blob/main/s07_skill_loading/code.py"
click node_context "https://github.com/shareai-lab/learn-claude-code/blob/main/s08_context_compact/code.py"
click node_memory "https://github.com/shareai-lab/learn-claude-code/blob/main/s09_memory/code.py"
click node_tasks "https://github.com/shareai-lab/learn-claude-code/blob/main/s10_task_system/code.py"
click node_background "https://github.com/shareai-lab/learn-claude-code/blob/main/s11_background_tasks/code.py"
click node_teams "https://github.com/shareai-lab/learn-claude-code/blob/main/s13_agent_teams/code.py"
click node_mcp "https://github.com/shareai-lab/learn-claude-code/blob/main/s14_mcp_plugin/code.py"
click node_integrated "https://github.com/shareai-lab/learn-claude-code/blob/main/s15_integrated_harness/code.py"
click node_workflow "https://github.com/shareai-lab/learn-claude-code/blob/main/s16_workflow_runtime/code.py"
click node_goals "https://github.com/shareai-lab/learn-claude-code/blob/main/s17_goal_loop/code.py"

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_version_page,node_lesson_client,node_diff_page,node_simulator toneBlue
class node_agent_loop,node_tool_use,node_permissions,node_hooks,node_skills,node_context,node_memory toneAmber
class node_tasks,node_background,node_teams toneMint
class node_mcp,node_integrated,node_workflow,node_goals toneRose
class node_learner toneIndigo
```

## Components

### Learning site

- [Version lesson](https://github.com/shareai-lab/learn-claude-code/blob/main/web/src/app/%5Blocale%5D/(learn)/%5Bversion%5D/page.tsx): `web/src/app/[locale]/(learn)/[version]/page.tsx`
- [Lesson panels](https://github.com/shareai-lab/learn-claude-code/blob/main/web/src/app/%5Blocale%5D/(learn)/%5Bversion%5D/client.tsx): `web/src/app/[locale]/(learn)/[version]/client.tsx`
- [Version diff](https://github.com/shareai-lab/learn-claude-code/blob/main/web/src/app/%5Blocale%5D/(learn)/%5Bversion%5D/diff/diff-content.tsx): `web/src/app/[locale]/(learn)/[version]/diff/diff-content.tsx`
- [Loop simulator](https://github.com/shareai-lab/learn-claude-code/blob/main/web/src/components/simulator/agent-loop-simulator.tsx): `web/src/components/simulator/agent-loop-simulator.tsx`

### Harness examples

- [Agent loop](https://github.com/shareai-lab/learn-claude-code/blob/main/s01_agent_loop/code.py): `s01_agent_loop/code.py`
- [Tool execution](https://github.com/shareai-lab/learn-claude-code/blob/main/s02_tool_use/code.py): `s02_tool_use/code.py`
- [Permission boundaries](https://github.com/shareai-lab/learn-claude-code/blob/main/s03_permission/code.py): `s03_permission/code.py`
- [Lifecycle hooks](https://github.com/shareai-lab/learn-claude-code/blob/main/s04_hooks/code.py): `s04_hooks/code.py`
- [On-demand skills](https://github.com/shareai-lab/learn-claude-code/blob/main/s07_skill_loading/code.py): `s07_skill_loading/code.py`
- [Context compaction](https://github.com/shareai-lab/learn-claude-code/blob/main/s08_context_compact/code.py): `s08_context_compact/code.py`
- [Agent memory](https://github.com/shareai-lab/learn-claude-code/blob/main/s09_memory/code.py): `s09_memory/code.py`

### Agent coordination

- [Persistent tasks](https://github.com/shareai-lab/learn-claude-code/blob/main/s10_task_system/code.py): `s10_task_system/code.py`
- [Background work](https://github.com/shareai-lab/learn-claude-code/blob/main/s11_background_tasks/code.py): `s11_background_tasks/code.py`
- [Agent teams](https://github.com/shareai-lab/learn-claude-code/blob/main/s13_agent_teams/code.py): `s13_agent_teams/code.py`

### Runtime extensions

- [MCP plugins](https://github.com/shareai-lab/learn-claude-code/blob/main/s14_mcp_plugin/code.py): `s14_mcp_plugin/code.py`
- [Integrated harness](https://github.com/shareai-lab/learn-claude-code/blob/main/s15_integrated_harness/code.py): `s15_integrated_harness/code.py`
- [Workflow runtime](https://github.com/shareai-lab/learn-claude-code/blob/main/s16_workflow_runtime/code.py): `s16_workflow_runtime/code.py`
- [Goal loop](https://github.com/shareai-lab/learn-claude-code/blob/main/s17_goal_loop/code.py): `s17_goal_loop/code.py`

### Other components

- **Learner**

## Connections

- Learner → Version lesson: opens lesson (evidence: `web/src/app/[locale]/(learn)/[version]/page.tsx`)
- Version lesson → Lesson panels: renders (evidence: `web/src/app/[locale]/(learn)/[version]/page.tsx`)
- Lesson panels → Loop simulator: renders simulator (evidence: `web/src/app/[locale]/(learn)/[version]/client.tsx`)
- Learner → Version diff: opens comparison
- Learner → Agent loop: studies example (evidence: `README.md`)
- Agent loop → Tool execution: adds tools (evidence: `README.md`)
- Tool execution → Permission boundaries: adds boundaries (evidence: `README.md`)
- Agent loop → Lifecycle hooks: extends harness
- Agent loop → On-demand skills: loads knowledge (evidence: `README.md`)
- Agent loop → Context compaction: manages context (evidence: `README.md`)
- Context compaction → Agent memory: extends continuity
- Agent loop → Persistent tasks: persists goals (evidence: `README.md`)
- Persistent tasks → Background work: adds async work
- Persistent tasks → Agent teams: coordinates agents
- Tool execution → MCP plugins: adds integrations
- Agent loop → Integrated harness: combines mechanisms
- Integrated harness → Workflow runtime: adds workflows
- Integrated harness → Goal loop: extends autonomy
