# peacebitcreativestudio/form architecture

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

- Interactive diagram: https://gitdiagram.com/peacebitcreativestudio/form
- Repository: https://github.com/peacebitcreativestudio/form

## Overview

FORM is a structured reasoning framework with a small local conversational runtime. A user turn is formatted with the framework rules and preserved cycle memory, sent to a local Ollama model, then its response is returned and any JSON memory block is appended for later turns. The README also describes broader reasoning principles, but the available source shows only this runtime loop. Notably, runtime.py loads form_v0_1.json, which is absent from the tree, so no link to the present JSON files is asserted.

Main entry points: [`runtime.py`](https://github.com/peacebitcreativestudio/form/blob/main/runtime.py) (Turn runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Local runtime"]
  node_runtime["Turn runtime<br/>[runtime.py]"]
  node_prompt["Prompt builder<br/>[runtime.py]"]
  node_memory[("Cycle memory<br/>[runtime.py]")]
end

subgraph group_framework["FORM framework"]
  node_spec["FORM specification<br/>[FORMUPDATE.json]"]
end

node_user(("User"))
node_ollama["Ollama model"]

node_user -->|"submits turn"| node_runtime
node_runtime -->|"builds prompt"| node_prompt
node_prompt -->|"includes state"| node_memory
node_runtime -->|"sends messages"| node_ollama
node_ollama -->|"returns response"| node_runtime
node_runtime -->|"extracts JSON"| node_memory
node_runtime -->|"returns output"| node_user

click node_runtime "https://github.com/peacebitcreativestudio/form/blob/main/runtime.py"
click node_prompt "https://github.com/peacebitcreativestudio/form/blob/main/runtime.py"
click node_memory "https://github.com/peacebitcreativestudio/form/blob/main/runtime.py"
click node_spec "https://github.com/peacebitcreativestudio/form/blob/main/FORMUPDATE.json"

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_runtime,node_prompt,node_memory,node_user toneBlue
class node_spec toneAmber
class node_ollama toneIndigo
```

## Components

### Local runtime

- [Turn runtime](https://github.com/peacebitcreativestudio/form/blob/main/runtime.py): `runtime.py`
- [Prompt builder](https://github.com/peacebitcreativestudio/form/blob/main/runtime.py): `runtime.py`
- [Cycle memory](https://github.com/peacebitcreativestudio/form/blob/main/runtime.py): `runtime.py`

### FORM framework

- [FORM specification](https://github.com/peacebitcreativestudio/form/blob/main/FORMUPDATE.json): `FORMUPDATE.json`

### Other components

- **User**
- **Ollama model**

## Connections

- User → Turn runtime: submits turn (evidence: `runtime.py`)
- Turn runtime → Prompt builder: builds prompt (evidence: `runtime.py`)
- Prompt builder → Cycle memory: includes state (evidence: `runtime.py`)
- Turn runtime → Ollama model: sends messages (evidence: `runtime.py`)
- Ollama model → Turn runtime: returns response (evidence: `runtime.py`)
- Turn runtime → Cycle memory: extracts JSON (evidence: `runtime.py`)
- Turn runtime → User: returns output (evidence: `runtime.py`)
