# jonmarkgo/15mincodingagent architecture

> Architecture diagram of the GitHub repository jonmarkgo/15mincodingagent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jonmarkgo/15mincodingagent
- Repository: https://github.com/jonmarkgo/15mincodingagent

## Overview

This repository is a small, offline-first Ruby coding-agent tutorial. Its main workflow builds a task and tool descriptions, asks an OpenAI-compatible model for tool calls, checks and dispatches those calls, runs tools in a workspace, and returns results until the model finishes. Separate examples demonstrate plain chat and hallucination checking; the skills and build variants extend the agent loop. The README documents capabilities beyond the sampled code, so those are represented only where their paths and relationships are supported.

Main entry points: [`steps/06_loop.rb`](https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/06_loop.rb) (Agent loop), [`steps/01_ask.rb`](https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/01_ask.rb) (Inference client), [`steps/07_skills.rb`](https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/07_skills.rb) (Skills), [`steps/hallucinate.rb`](https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/hallucinate.rb) (Reality check)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent["Agent workflow"]
  node_inference["Inference client<br/>[01_ask.rb]"]
  node_prompt["Prompt and tools<br/>[03_describe.rb]"]
  node_dispatcher["Tool dispatcher<br/>[04_act.rb]"]
  node_guardrails["Guardrails<br/>[05_guardrails.rb]"]
  node_loop["Agent loop<br/>[06_loop.rb]"]
end

subgraph group_tools["Workspace tools"]
  node_workspace[("Workspace files<br/>[02_tools.rb]")]
  node_workspace_tools["File and shell tools<br/>[02_tools.rb]"]
end

subgraph group_examples["Agent examples"]
  node_skills["Skills<br/>[07_skills.rb]"]
  node_build["Interactive builder<br/>[build.rb]"]
  node_chat["Chat example<br/>[chat.rb]"]
  node_hallucinate["Reality check<br/>[hallucinate.rb]"]
end

subgraph group_services["External services"]
  node_ollama{{"Model server"}}
end

node_user(("User"))

node_user -->|"gives task"| node_loop
node_loop -->|"builds context"| node_prompt
node_prompt -->|"lists files"| node_workspace_tools
node_loop -->|"sends messages"| node_inference
node_inference -->|"HTTP request"| node_ollama
node_ollama -->|"returns reply"| node_inference
node_loop -->|"passes tool call"| node_guardrails
node_guardrails -->|"approves dispatch"| node_dispatcher
node_dispatcher -->|"dispatches tool"| node_workspace_tools
node_workspace_tools -->|"reads and writes"| node_workspace
node_loop -->|"returns tool results"| node_inference
node_user -->|"requests changes"| node_build
node_build -->|"runs agent"| node_loop
node_user -->|"requests task"| node_skills
node_skills -->|"starts agent"| node_loop
node_skills -->|"reads skill files"| node_workspace
node_user -->|"asks question"| node_chat
node_chat -->|"sends question"| node_inference
node_user -->|"requests prediction"| node_hallucinate
node_hallucinate -->|"asks without tools"| node_inference
node_hallucinate -->|"runs reality check"| node_workspace

click node_workspace "https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/02_tools.rb"
click node_inference "https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/01_ask.rb"
click node_prompt "https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/03_describe.rb"
click node_dispatcher "https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/04_act.rb"
click node_guardrails "https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/05_guardrails.rb"
click node_loop "https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/06_loop.rb"
click node_workspace_tools "https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/02_tools.rb"
click node_skills "https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/07_skills.rb"
click node_build "https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/build.rb"
click node_chat "https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/chat.rb"
click node_hallucinate "https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/hallucinate.rb"

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_inference,node_prompt,node_dispatcher,node_guardrails,node_loop,node_user toneBlue
class node_workspace,node_workspace_tools toneAmber
class node_skills,node_build,node_chat,node_hallucinate toneMint
class node_ollama toneRose
```

## Components

### Agent workflow

- [Inference client](https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/01_ask.rb): `steps/01_ask.rb`
- [Prompt and tools](https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/03_describe.rb): `steps/03_describe.rb`
- [Tool dispatcher](https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/04_act.rb): `steps/04_act.rb`
- [Guardrails](https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/05_guardrails.rb): `steps/05_guardrails.rb`
- [Agent loop](https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/06_loop.rb): `steps/06_loop.rb`

### Workspace tools

- [Workspace files](https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/02_tools.rb): `steps/02_tools.rb`
- [File and shell tools](https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/02_tools.rb): `steps/02_tools.rb`

### Agent examples

- [Skills](https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/07_skills.rb): `steps/07_skills.rb`
- [Interactive builder](https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/build.rb): `steps/build.rb`
- [Chat example](https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/chat.rb): `steps/chat.rb`
- [Reality check](https://github.com/jonmarkgo/15mincodingagent/blob/main/steps/hallucinate.rb): `steps/hallucinate.rb`

### External services

- **Model server**

### Other components

- **User**

## Connections

- User → Agent loop: gives task (evidence: `steps/06_loop.rb`)
- Agent loop → Prompt and tools: builds context (evidence: `steps/06_loop.rb`)
- Prompt and tools → File and shell tools: lists files (evidence: `steps/03_describe.rb`)
- Agent loop → Inference client: sends messages (evidence: `steps/06_loop.rb`)
- Inference client → Model server: HTTP request (evidence: `steps/01_ask.rb`)
- Model server → Inference client: returns reply (evidence: `steps/01_ask.rb`)
- Agent loop → Guardrails: passes tool call (evidence: `steps/06_loop.rb`)
- Guardrails → Tool dispatcher: approves dispatch (evidence: `steps/05_guardrails.rb`)
- Tool dispatcher → File and shell tools: dispatches tool (evidence: `steps/04_act.rb`)
- File and shell tools → Workspace files: reads and writes (evidence: `steps/02_tools.rb`)
- Agent loop → Inference client: returns tool results (evidence: `steps/06_loop.rb`)
- User → Interactive builder: requests changes (evidence: `steps/build.rb`)
- Interactive builder → Agent loop: runs agent (evidence: `steps/build.rb`)
- User → Skills: requests task (evidence: `steps/07_skills.rb`)
- Skills → Agent loop: starts agent (evidence: `steps/07_skills.rb`)
- Skills → Workspace files: reads skill files (evidence: `steps/07_skills.rb`)
- User → Chat example: asks question (evidence: `steps/chat.rb`)
- Chat example → Inference client: sends question (evidence: `steps/chat.rb`)
- User → Reality check: requests prediction (evidence: `steps/hallucinate.rb`)
- Reality check → Inference client: asks without tools (evidence: `steps/hallucinate.rb`)
- Reality check → Workspace files: runs reality check (evidence: `steps/hallucinate.rb`)
