# ronininc/kingmaker architecture

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

- Interactive diagram: https://gitdiagram.com/ronininc/kingmaker
- Repository: https://github.com/ronininc/kingmaker
- Video tour (about a minute): https://gitdiagram.com/ronininc/kingmaker/video

## Overview

Kingmaker is a headless, voice-driven Mac agent: a person states a requirement and quality metric, the governed runtime routes and attempts the work, and results are checked against that metric before presentation. The README also documents model sizing and acquisition, knowledge grounding, code review, approvals, local vault custody, fleet sharing, and sealed outputs. Paths associate documented responsibilities with matching repository modules; source was sampled only for selected runtime, contract, and Armor modules, so the broader connections below rely on README statements rather than claims of inspected call sites.

Main entry points: [`lib/decision-router.mjs`](https://github.com/ronininc/kingmaker/blob/main/lib/decision-router.mjs) (Seeker Router), [`lib/execution-loop.mjs`](https://github.com/ronininc/kingmaker/blob/main/lib/execution-loop.mjs) (Core Loop), [`lib/brain-library.mjs`](https://github.com/ronininc/kingmaker/blob/main/lib/brain-library.mjs) (Brain Library), [`app/Kingmaker.swift`](https://github.com/ronininc/kingmaker/blob/main/app/Kingmaker.swift) (Kingmaker Shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Voice and Governance"]
  node_shell["Kingmaker Shell<br/>[Kingmaker.swift]"]
  node_voice["Voice Runtime<br/>[voice.mjs]"]
  node_seeker["Seeker Router"]
  node_approval["Approval Gate"]
end

subgraph group_capability["Work and Capability"]
  node_coreloop["Core Loop<br/>[execution-loop.mjs]"]
  node_oracle["Oracle Metric"]
  node_pipelines["Pipelines and Daemons<br/>[automaton.mjs]"]
  node_hands["Hands of Horus"]
end

subgraph group_knowledge["Models and Knowledge"]
  node_brain["Brain Library<br/>[brain-library.mjs]"]
  node_knowledge["Knowledge Library<br/>[knowledge.mjs]"]
  node_hunter["Weight Hunter<br/>[weight-hunter.mjs]"]
  node_abliterator["Bliterator"]
end

subgraph group_trust["Trust and Sharing"]
  node_rea["REA Review<br/>[rea.mjs]"]
  node_vault[("Vault Custody<br/>[keys.mjs]")]
  node_armor["Scripture Armor<br/>[scan.mjs]"]
  node_seal["Creation Seal<br/>[armor-bundle.mjs]"]
  node_fleet["Fleet Learning<br/>[fleet-learning.mjs]"]
end

node_owner(("Owner"))

node_owner -->|"states requirement"| node_voice
node_voice -->|"activates"| node_shell
node_shell -->|"routes through"| node_seeker
node_seeker -->|"holds gates"| node_approval
node_seeker -->|"routes work"| node_coreloop
node_coreloop -->|"measures against"| node_oracle
node_coreloop -->|"runs as"| node_pipelines
node_pipelines -.->|"dispatches clicking"| node_hands
node_seeker -->|"draws from"| node_brain
node_brain -->|"includes"| node_knowledge
node_seeker -->|"fits chosen weight"| node_hunter
node_hunter -->|"proves equivalent"| node_brain
node_brain -->|"may produce weights"| node_abliterator
node_seeker -->|"reviews outside code"| node_rea
node_rea -->|"scans entrants"| node_armor
node_approval -->|"authorizes job access"| node_vault
node_armor -->|"scans entrants"| node_vault
node_coreloop -->|"seals creations"| node_seal
node_coreloop -->|"shares opted-in learning"| node_fleet

click node_shell "https://github.com/ronininc/kingmaker/blob/main/app/Kingmaker.swift"
click node_voice "https://github.com/ronininc/kingmaker/blob/main/lib/voice.mjs"
click node_seeker "https://github.com/ronininc/kingmaker/blob/main/lib/decision-router.mjs"
click node_approval "https://github.com/ronininc/kingmaker/blob/main/lib/permission-gate.mjs"
click node_coreloop "https://github.com/ronininc/kingmaker/blob/main/lib/execution-loop.mjs"
click node_oracle "https://github.com/ronininc/kingmaker/blob/main/lib/model-pin-registry.mjs"
click node_pipelines "https://github.com/ronininc/kingmaker/blob/main/lib/automaton.mjs"
click node_brain "https://github.com/ronininc/kingmaker/blob/main/lib/brain-library.mjs"
click node_knowledge "https://github.com/ronininc/kingmaker/blob/main/lib/knowledge.mjs"
click node_hunter "https://github.com/ronininc/kingmaker/blob/main/lib/weight-hunter.mjs"
click node_abliterator "https://github.com/ronininc/kingmaker/blob/main/lib/abliterate-model.mjs"
click node_rea "https://github.com/ronininc/kingmaker/blob/main/lib/rea.mjs"
click node_vault "https://github.com/ronininc/kingmaker/blob/main/lib/keys.mjs"
click node_armor "https://github.com/ronininc/kingmaker/blob/main/scripture-armor/scan.mjs"
click node_seal "https://github.com/ronininc/kingmaker/blob/main/lib/armor-bundle.mjs"
click node_fleet "https://github.com/ronininc/kingmaker/blob/main/lib/fleet-learning.mjs"

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_shell,node_voice,node_seeker,node_approval toneBlue
class node_coreloop,node_oracle,node_pipelines,node_hands toneAmber
class node_brain,node_knowledge,node_hunter,node_abliterator toneMint
class node_rea,node_vault,node_armor,node_seal,node_fleet toneRose
class node_owner toneIndigo
```

## Components

### Voice and Governance

- [Kingmaker Shell](https://github.com/ronininc/kingmaker/blob/main/app/Kingmaker.swift): `app/Kingmaker.swift`
- [Voice Runtime](https://github.com/ronininc/kingmaker/blob/main/lib/voice.mjs): `lib/voice.mjs`
- [Seeker Router](https://github.com/ronininc/kingmaker/blob/main/lib/decision-router.mjs): `lib/decision-router.mjs`
- [Approval Gate](https://github.com/ronininc/kingmaker/blob/main/lib/permission-gate.mjs): `lib/permission-gate.mjs`

### Work and Capability

- [Core Loop](https://github.com/ronininc/kingmaker/blob/main/lib/execution-loop.mjs): `lib/execution-loop.mjs`
- [Oracle Metric](https://github.com/ronininc/kingmaker/blob/main/lib/model-pin-registry.mjs): `lib/model-pin-registry.mjs`
- [Pipelines and Daemons](https://github.com/ronininc/kingmaker/blob/main/lib/automaton.mjs): `lib/automaton.mjs`
- **Hands of Horus**

### Models and Knowledge

- [Brain Library](https://github.com/ronininc/kingmaker/blob/main/lib/brain-library.mjs): `lib/brain-library.mjs`
- [Knowledge Library](https://github.com/ronininc/kingmaker/blob/main/lib/knowledge.mjs): `lib/knowledge.mjs`
- [Weight Hunter](https://github.com/ronininc/kingmaker/blob/main/lib/weight-hunter.mjs): `lib/weight-hunter.mjs`
- [Bliterator](https://github.com/ronininc/kingmaker/blob/main/lib/abliterate-model.mjs): `lib/abliterate-model.mjs`

### Trust and Sharing

- [REA Review](https://github.com/ronininc/kingmaker/blob/main/lib/rea.mjs): `lib/rea.mjs`
- [Vault Custody](https://github.com/ronininc/kingmaker/blob/main/lib/keys.mjs): `lib/keys.mjs`
- [Scripture Armor](https://github.com/ronininc/kingmaker/blob/main/scripture-armor/scan.mjs): `scripture-armor/scan.mjs`
- [Creation Seal](https://github.com/ronininc/kingmaker/blob/main/lib/armor-bundle.mjs): `lib/armor-bundle.mjs`
- [Fleet Learning](https://github.com/ronininc/kingmaker/blob/main/lib/fleet-learning.mjs): `lib/fleet-learning.mjs`

### Other components

- **Owner**

## Connections

- Owner → Voice Runtime: states requirement (evidence: `README.md`)
- Voice Runtime → Kingmaker Shell: activates (evidence: `README.md`)
- Kingmaker Shell → Seeker Router: routes through (evidence: `README.md`)
- Seeker Router → Approval Gate: holds gates (evidence: `README.md`)
- Seeker Router → Core Loop: routes work (evidence: `README.md`)
- Core Loop → Oracle Metric: measures against (evidence: `README.md`)
- Core Loop → Pipelines and Daemons: runs as (evidence: `README.md`)
- Pipelines and Daemons → Hands of Horus: dispatches clicking
- Seeker Router → Brain Library: draws from (evidence: `README.md`)
- Brain Library → Knowledge Library: includes (evidence: `README.md`)
- Seeker Router → Weight Hunter: fits chosen weight (evidence: `README.md`)
- Weight Hunter → Brain Library: proves equivalent (evidence: `README.md`)
- Brain Library → Bliterator: may produce weights (evidence: `README.md`)
- Seeker Router → REA Review: reviews outside code (evidence: `README.md`)
- REA Review → Scripture Armor: scans entrants (evidence: `README.md`)
- Approval Gate → Vault Custody: authorizes job access (evidence: `README.md`)
- Scripture Armor → Vault Custody: scans entrants (evidence: `README.md`)
- Core Loop → Creation Seal: seals creations (evidence: `README.md`)
- Core Loop → Fleet Learning: shares opted-in learning (evidence: `README.md`)
