Phase graph — the working model creativity inherits [Concept]
Source path: knowledge-base/diagrams/concepts/phase-graph.md
# Phase graph — the working model creativity inherits `[Concept]`
The **Phase Reasoning Graph** (PRG; **Phase Graph** in compact UI copy) is the *descriptive* layer of graph
thinking: a mined working model of the world's meta-machinery — its patterns, conventions,
attractors, agents, rules, pressures, and landmarks. It answers *"how does this world WORK?"* where
the coordination plan answers *"how do we navigate it across arcs?"* and the per-arc CRG answers
*"how does this arc reason inside it?"* ([reasoning-graph-engine](../flows/reasoning-graph-engine.md)).
**Opt-in at exactly one lever**: the operator generates a graph and sets it current; every creative
surface then inherits it uniformly, and with no active graph every surface renders nothing.
```mermaid
flowchart TB
Gen["**generatePhaseGraph**<br/>mined from domain context<br/>(optional seed: a prior graph · optional guidance)"]
Gen -->|"immutable once stored"| Store[("domain.phaseGraphs<br/>+ currentPhaseGraphId (the ONE opt-in lever)")]
Store -->|"getActivePhaseGraph<br/>(none active → '' everywhere)"| Embed
subgraph Embed["buildActivePhaseSection — SELF-EMBEDDED by each engine fn, per scope"]
direction TB
D["descriptive data block<br/><mode> — 7 node types with temporal stance"]
A["scope-tailored application directive<br/><mode-application> — same semantics everywhere"]
D --- A
end
Embed --> S1["expand · arc-direction"]
Embed --> S2["reasoning-arc · reasoning-plan"]
Embed --> S3["scene-structure · scene-plan · scene-prose"]
Embed --> S4["perspective · variables (Present + Reading cohort)"]
Store -.->|"arc.phaseGraphId pins the model<br/>the arc was generated under"| Arcs[("arcs — reference-counted GC")]
X["Position monitor · Opinion — evidence surfaces,<br/>DECLINED by decision (readout purity)"]
Embed x--x X
```
**Invariants**
- **Descriptive, never prescriptive.** The PRG states what the machinery *is*; the coordination plan
and CRG decide what to *do* with it. Node types carry temporal stance (a `pressure` accumulates, an
`attractor` pulls, a `landmark` anchors) and downstream prompts read the stance, not just the label.
- **One opt-in lever, uniform reach.** Every embedding surface calls `buildActivePhaseSection` itself
(the engine self-embeds — never a caller-threaded parameter), so UI and headless callers can never
diverge. `phase-coverage-guard.test.ts` pins the exact surface map and the declared scopes.
- **Evidence surfaces are excluded by decision.** The Position monitor and Opinion selection trace
evidence; pre-embedding a creativity substrate there would bias the read toward the model's own
priors. The exclusion is pinned in the guard — changing it is a product decision, not an edit.
- **Immutable + pinned, refreshed by hand.** A graph is never edited; regeneration mints a new one
(optionally seeded by the old). Arcs pin the graph they were generated under (`arc.phaseGraphId`),
and a coordination plan pins the model its backward induction reasoned under
(`plan.phaseGraphId`); unreferenced graphs are pruned. There is **no automatic refresh** — but the
decay is no longer silent: the plan view runs a pure staleness read
(`coordinationPlanPhaseDrift`) and tells the author when the active model has moved past the
plan. The author decides; nothing regenerates itself.
- **Rupture is named, never silent.** Higher-priority inputs may break a phase rule; every scope's
directive requires marking the rupture (a chaos node, a superseding delta, named subtext) so a
deliberate break never reads as drift.
**Where it lives:** `src/lib/engine/ai/phase-graph.ts` (generation + the embed helper),
`src/lib/engine/prompts/phase/` (data block · scope directives · hierarchy entries),
`src/lib/core/graph/phase-graph.ts` (active pointer · reference counting · GC),
`src/__tests__/phase-coverage-guard.test.ts` (the pinned surface map). Siblings:
[reasoning-graph-engine](../flows/reasoning-graph-engine.md) ·
[projection-anatomy](projection-anatomy.md).
Open on GitHubRaw Markdown source