# formin/spec-kit-loop architecture

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

- Interactive diagram: https://gitdiagram.com/formin/spec-kit-loop
- Repository: https://github.com/formin/spec-kit-loop

## Overview

Loop Engineering is a Spec Kit extension that turns implementation into a bounded, reviewable agent loop. A human defines a contract, the maker iterates within its limits, an independent checker records criterion-level verdicts, and a guard requires comprehension-debt review and human sign-off before completion. Status reconstructs progress from durable Markdown state. The README documents these relationships and optional worktree isolation, memory, and allowed tools; no source excerpts were provided, so implementation-level calls cannot be verified.

Main entry points: [`commands/speckit.loop.run.md`](https://github.com/formin/spec-kit-loop/blob/main/commands/speckit.loop.run.md) (Run Maker), [`commands/speckit.loop.status.md`](https://github.com/formin/spec-kit-loop/blob/main/commands/speckit.loop.status.md) (Render Status), [`commands/speckit.loop.check.md`](https://github.com/formin/spec-kit-loop/blob/main/commands/speckit.loop.check.md) (Adversarial Check), [`commands/speckit.loop.guard.md`](https://github.com/formin/spec-kit-loop/blob/main/commands/speckit.loop.guard.md) (Guard Sign-off)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_commands["Loop Commands"]
  node_define["Define Contract"]
  node_run["Run Maker"]
  node_check["Adversarial Check"]
  node_guard["Guard Sign-off"]
  node_status["Render Status"]
end

subgraph group_state["Durable Loop State"]
  node_contract["Loop Contract"]
  node_iterations["Iteration Records"]
  node_verdicts["Checker Verdicts"]
  node_debt["Comprehension Debt"]
  node_signoffs["Sign-off Record"]
end

subgraph group_controls["Loop Controls"]
  node_worktree["Worktree Isolation"]
  node_memory["Durable Memory"]
  node_allowedtools["Allowed Tools"]
  node_extension["Spec Kit Extension<br/>[extension.yml]"]
end

node_human(("Engineer"))
node_maker(("Maker Agent"))
node_checker(("Independent Checker"))

node_human -->|"defines goal"| node_define
node_define -->|"writes contract"| node_contract
node_human -->|"starts iteration"| node_run
node_run -->|"follows criteria"| node_contract
node_run -->|"drives maker"| node_maker
node_run -->|"records iterations"| node_iterations
node_run -->|"carries decisions"| node_memory
node_run -->|"obeys allow-list"| node_allowedtools
node_run -.->|"may isolate"| node_worktree
node_human -->|"requests check"| node_check
node_check -->|"uses fresh session"| node_checker
node_check -->|"checks work"| node_iterations
node_check -->|"evaluates criteria"| node_contract
node_check -->|"records verdicts"| node_verdicts
node_human -->|"requests sign-off"| node_guard
node_guard -->|"requires passes"| node_verdicts
node_guard -->|"gates on debt"| node_debt
node_guard -->|"requires approval"| node_human
node_guard -->|"records approval"| node_signoffs
node_human -->|"requests status"| node_status
node_status -->|"reads state"| node_contract
node_status -->|"reads state"| node_iterations
node_status -->|"reads state"| node_verdicts
node_status -->|"reads state"| node_debt
node_status -->|"reads state"| node_signoffs
node_extension -->|"provides commands"| node_define

click node_define "https://github.com/formin/spec-kit-loop/blob/main/commands/speckit.loop.define.md"
click node_run "https://github.com/formin/spec-kit-loop/blob/main/commands/speckit.loop.run.md"
click node_check "https://github.com/formin/spec-kit-loop/blob/main/commands/speckit.loop.check.md"
click node_guard "https://github.com/formin/spec-kit-loop/blob/main/commands/speckit.loop.guard.md"
click node_status "https://github.com/formin/spec-kit-loop/blob/main/commands/speckit.loop.status.md"
click node_worktree "https://github.com/formin/spec-kit-loop/blob/main/config-template.yml"
click node_extension "https://github.com/formin/spec-kit-loop/blob/main/extension.yml"

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_define,node_run,node_check,node_guard,node_status toneBlue
class node_contract,node_iterations,node_verdicts,node_debt,node_signoffs toneAmber
class node_worktree,node_memory,node_allowedtools,node_extension toneMint
class node_human,node_maker,node_checker toneIndigo
```

## Components

### Loop Commands

- [Define Contract](https://github.com/formin/spec-kit-loop/blob/main/commands/speckit.loop.define.md): `commands/speckit.loop.define.md`
- [Run Maker](https://github.com/formin/spec-kit-loop/blob/main/commands/speckit.loop.run.md): `commands/speckit.loop.run.md`
- [Adversarial Check](https://github.com/formin/spec-kit-loop/blob/main/commands/speckit.loop.check.md): `commands/speckit.loop.check.md`
- [Guard Sign-off](https://github.com/formin/spec-kit-loop/blob/main/commands/speckit.loop.guard.md): `commands/speckit.loop.guard.md`
- [Render Status](https://github.com/formin/spec-kit-loop/blob/main/commands/speckit.loop.status.md): `commands/speckit.loop.status.md`

### Durable Loop State

- **Loop Contract**
- **Iteration Records**
- **Checker Verdicts**
- **Comprehension Debt**
- **Sign-off Record**

### Loop Controls

- [Worktree Isolation](https://github.com/formin/spec-kit-loop/blob/main/config-template.yml): `config-template.yml`
- **Durable Memory**
- **Allowed Tools**
- [Spec Kit Extension](https://github.com/formin/spec-kit-loop/blob/main/extension.yml): `extension.yml`

### Other components

- **Engineer**
- **Maker Agent**
- **Independent Checker**

## Connections

- Engineer → Define Contract: defines goal (evidence: `README.md`)
- Define Contract → Loop Contract: writes contract (evidence: `README.md`)
- Engineer → Run Maker: starts iteration (evidence: `README.md`)
- Run Maker → Loop Contract: follows criteria (evidence: `README.md`)
- Run Maker → Maker Agent: drives maker (evidence: `README.md`)
- Run Maker → Iteration Records: records iterations (evidence: `README.md`)
- Run Maker → Durable Memory: carries decisions (evidence: `README.md`)
- Run Maker → Allowed Tools: obeys allow-list (evidence: `README.md`)
- Run Maker → Worktree Isolation: may isolate (evidence: `README.md`)
- Engineer → Adversarial Check: requests check (evidence: `README.md`)
- Adversarial Check → Independent Checker: uses fresh session (evidence: `README.md`)
- Adversarial Check → Iteration Records: checks work (evidence: `README.md`)
- Adversarial Check → Loop Contract: evaluates criteria (evidence: `README.md`)
- Adversarial Check → Checker Verdicts: records verdicts (evidence: `README.md`)
- Engineer → Guard Sign-off: requests sign-off (evidence: `README.md`)
- Guard Sign-off → Checker Verdicts: requires passes (evidence: `README.md`)
- Guard Sign-off → Comprehension Debt: gates on debt (evidence: `README.md`)
- Guard Sign-off → Engineer: requires approval (evidence: `README.md`)
- Guard Sign-off → Sign-off Record: records approval (evidence: `README.md`)
- Engineer → Render Status: requests status (evidence: `README.md`)
- Render Status → Loop Contract: reads state (evidence: `README.md`)
- Render Status → Iteration Records: reads state (evidence: `README.md`)
- Render Status → Checker Verdicts: reads state (evidence: `README.md`)
- Render Status → Comprehension Debt: reads state (evidence: `README.md`)
- Render Status → Sign-off Record: reads state (evidence: `README.md`)
- Spec Kit Extension → Define Contract: provides commands (evidence: `README.md`)
