# apriorhythm/apriori-spec-development architecture

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

- Interactive diagram: https://gitdiagram.com/apriorhythm/apriori-spec-development
- Repository: https://github.com/apriorhythm/apriori-spec-development

## Overview

apriori is a zero-dependency CLI and agent-guided workflow for turning change specifications into test-bound, mechanically gated, archived specifications. The principal loop is change kickoff and spec authoring, scenario verification against tests, gate checks, then delta merge into the living spec store. The README documents additional hotfix, project-health, status, initialization, and upgrade capabilities. Source excerpts are limited, so subsystem links below follow the CLI dispatcher and documented behavior; they do not imply uninspected internal calls.

Main entry points: [`bin/apriori.js`](https://github.com/apriorhythm/apriori-spec-development/blob/main/bin/apriori.js) (CLI dispatcher), [`lib/spec-runner.js`](https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/spec-runner.js) (Scenario verification), [`lib/gate.js`](https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/gate.js) (Mechanical gate), [`lib/archive-merge.js`](https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/archive-merge.js) (Delta archive)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Change workflow"]
  node_cli["CLI dispatcher<br/>[apriori.js]"]
  node_change["Change kickoff<br/>[new.js]"]
  node_status["Workflow status<br/>[status.js]"]
  node_hotfix["Hotfix lane<br/>[hotfix.js]"]
end

subgraph group_assurance["Verification and gates"]
  node_verify["Scenario verification<br/>[spec-runner.js]"]
  node_gate["Mechanical gate<br/>[gate.js]"]
  node_check["Structural check<br/>[check.js]"]
end

subgraph group_specstore["Spec store"]
  node_archive["Delta archive<br/>[archive-merge.js]"]
  node_stamp["Store stamp<br/>[archive-merge.js]"]
end

subgraph group_project["Project setup"]
  node_doctor["Seam diagnostics<br/>[doctor.js]"]
  node_init["Project initialization<br/>[init.js]"]
  node_update["Tool-file update<br/>[update.js]"]
  node_config["Project configuration<br/>[config.js]"]
  node_resolver["Project resolution<br/>[resolve.js]"]
end

node_human(("Human / agent"))
node_tests["Project test command"]
node_living[("Living spec store")]

node_human -->|"runs commands"| node_cli
node_cli -->|"dispatches new"| node_change
node_cli -->|"dispatches status"| node_status
node_cli -->|"dispatches hotfix"| node_hotfix
node_cli -->|"dispatches verify"| node_verify
node_cli -->|"dispatches gate"| node_gate
node_cli -->|"dispatches check"| node_check
node_cli -->|"dispatches archive"| node_archive
node_cli -->|"dispatches stamp"| node_stamp
node_cli -->|"dispatches doctor"| node_doctor
node_cli -->|"dispatches init"| node_init
node_cli -->|"dispatches update"| node_update
node_verify -->|"runs test command"| node_tests
node_gate -->|"checks verification"| node_verify
node_archive -->|"merges delta"| node_living
node_stamp -->|"reads baseline"| node_living
node_doctor -->|"diagnoses seam"| node_resolver
node_init -->|"configures project"| node_config
node_update -->|"resolves settings"| node_config

click node_cli "https://github.com/apriorhythm/apriori-spec-development/blob/main/bin/apriori.js"
click node_change "https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/new.js"
click node_status "https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/status.js"
click node_hotfix "https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/hotfix.js"
click node_verify "https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/spec-runner.js"
click node_gate "https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/gate.js"
click node_check "https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/check.js"
click node_archive "https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/archive-merge.js"
click node_stamp "https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/archive-merge.js"
click node_doctor "https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/doctor.js"
click node_init "https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/init.js"
click node_update "https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/update.js"
click node_config "https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/config.js"
click node_resolver "https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/resolve.js"

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_cli,node_change,node_status,node_hotfix toneBlue
class node_verify,node_gate,node_check,node_living toneAmber
class node_archive,node_stamp toneMint
class node_doctor,node_init,node_update,node_config,node_resolver toneRose
class node_human,node_tests toneIndigo
```

## Components

### Change workflow

- [CLI dispatcher](https://github.com/apriorhythm/apriori-spec-development/blob/main/bin/apriori.js): `bin/apriori.js`
- [Change kickoff](https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/new.js): `lib/new.js`
- [Workflow status](https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/status.js): `lib/status.js`
- [Hotfix lane](https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/hotfix.js): `lib/hotfix.js`

### Verification and gates

- [Scenario verification](https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/spec-runner.js): `lib/spec-runner.js`
- [Mechanical gate](https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/gate.js): `lib/gate.js`
- [Structural check](https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/check.js): `lib/check.js`

### Spec store

- [Delta archive](https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/archive-merge.js): `lib/archive-merge.js`
- [Store stamp](https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/archive-merge.js): `lib/archive-merge.js`

### Project setup

- [Seam diagnostics](https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/doctor.js): `lib/doctor.js`
- [Project initialization](https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/init.js): `lib/init.js`
- [Tool-file update](https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/update.js): `lib/update.js`
- [Project configuration](https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/config.js): `lib/config.js`
- [Project resolution](https://github.com/apriorhythm/apriori-spec-development/blob/main/lib/resolve.js): `lib/resolve.js`

### Other components

- **Human / agent**
- **Project test command**
- **Living spec store**

## Connections

- Human / agent → CLI dispatcher: runs commands
- CLI dispatcher → Change kickoff: dispatches new
- CLI dispatcher → Workflow status: dispatches status
- CLI dispatcher → Hotfix lane: dispatches hotfix
- CLI dispatcher → Scenario verification: dispatches verify
- CLI dispatcher → Mechanical gate: dispatches gate
- CLI dispatcher → Structural check: dispatches check
- CLI dispatcher → Delta archive: dispatches archive
- CLI dispatcher → Store stamp: dispatches stamp
- CLI dispatcher → Seam diagnostics: dispatches doctor
- CLI dispatcher → Project initialization: dispatches init
- CLI dispatcher → Tool-file update: dispatches update
- Scenario verification → Project test command: runs test command
- Mechanical gate → Scenario verification: checks verification
- Delta archive → Living spec store: merges delta
- Store stamp → Living spec store: reads baseline
- Seam diagnostics → Project resolution: diagnoses seam
- Project initialization → Project configuration: configures project
- Tool-file update → Project configuration: resolves settings
