MeridiansMeridians

The Program loop [Concept]

Source path: knowledge-base/diagrams/concepts/program-loop.md

# The Program loop `[Concept]`

The Program is the autonomous machine loop that keeps an expert's three [layers of opinion](three-layers.md) current: **Research → Opinion → Merge → Position**. It runs daily from schedules (manual or autopilot).

```mermaid
flowchart LR
    W["**Research**<br/>research cycles +<br/>projection monitors"]
    O["**Opinion**<br/>select material<br/>belief movement"]
    T["**Merge**<br/>autonomously fold<br/>streams + notes into canon"]
    P["**Position**<br/>compose the<br/>forward read"]

    W --> O --> T --> P
    P -.->|"next run"| W

    W -.->|"emits"| Stories(["Stories — editorial feed"])
    O -.-> Stories
    T -.-> Stories
    P -.-> Stories
    Stories -.->|"the human judges;<br/>a tap stages a Directive"| T
```

- **Research** combines research cycles and Position monitors on shared run infrastructure.
- **Opinion** selects material belief movement — not a generic summary.
- **Merge** folds durable model change on the domain's cadence; a mature Stream (and any ready Notes) fold into canon through one **Merge**.
- **Position** composes a self-updating forward read (Graph → Reading → Position), applies **Signals** that reposition it on evidence, and surfaces notable shifts. A Position's forward **read** is never marked true or false — what gets graded is the **committed consequence** the read opens (see [PIVOT](../../knowledge/foundations/PIVOT.md)).

**Invariants**

- Events project into **Stories**; Stories never become a second source of truth.
- Research admits each independently written **Article** once. Recaptures and copies are run-audit data,
  not evidence or Stories; several independent sources reporting the same event remain several Articles.
- A Story action stages a typed **Directive** (`staged → reserved → applied | stale | superseded | cancelled`) that fires on a *later* run — it never pretends work completed at tap time. Merging is **autonomous** (a directive here is a pre-window outcome *designation*, applied on the next fold, then cleared — no approval); a **Position** proposal still awaits the operator's judgment (`pending`) before it establishes.
- The human loop is **configure + steer + judge, not maintain**: the machine keeps the read current and folds canon on cadence; the human sets the cadence/switches, designates outcomes before a merge, and judges each Position.

**Where it lives:** `lib/core/program/`, `lib/server/program/`, `lib/server/ops/handlers/`, `types/domain/program.ts`. The run mechanics are in [flows/story-pipeline](../flows/story-pipeline.md); the scheduler wiring in [flows/engine-pipeline](../flows/engine-pipeline.md). *(Code namespace moved `loop/` → `program/`; op ids + the `domain.loop` record field keep the historical name.)*
Open on GitHub

Raw Markdown source