King Klown Logo
King Klown& KOA

Deterministic Pipeline (SCAN-PLAN-EXECUTE)

Architectural Lineage (Credits):
SwarmCraft is an architectural fork and deep rewrite of the multi-agent swarm engine created by Mojomast in mojomast/swarmussy.
SwarmCraft’s deterministic “Architect-style” layering is also derived from the meta-structure of Abstract Wiki Architect (AWA).
Full details: Credits & Lineage

POWERED BY GROK

SwarmCraft runs a strict, repeatable control loop that transforms explicit project state into prose:

SCAN → PLAN → EXECUTE

This loop is designed to be:


0) Glossary


1) Cycle Overview

1.1 SCAN

Recompute reality from disk and refresh runtime state.

Outputs:

1.2 PLAN

Select one target Part and one action.

Outputs:

1.3 EXECUTE

Run one persona on one Part, then persist results via tools.

Outputs:


2) SCAN (Normative)

2.1 Inputs

SCAN reads:

2.2 Responsibilities

SCAN MUST:

  1. Enumerate expected Parts from outline.json.
  2. Verify presence of each Part’s manuscript file.
  3. Compute per-part metrics:
    • word count
    • last modified time
    • status
  4. Respect locks:
    • never downgrade a LOCKED part
    • never infer unlocks automatically
  5. Validate integrity:
    • missing parts
    • missing beats keys (fill with empty strings in UI projection)
    • schema mismatch between template threads and outline beats
  6. Optionally ingest changed prose into RAG memory.
  7. Atomically write the updated data/matrix.json.

A scanner SHOULD classify a Part as:

Matrix semantics: Central Matrix


3) PLAN (Normative)

3.1 Inputs

PLAN reads:

Absent overrides, the Architect SHOULD prioritize:

  1. Any Part with REVISION_NEEDED
  2. The earliest Part with EMPTY
  3. The earliest Part with DRAFTING
  4. Optional: any Part failing integrity checks (continuity, constraints, missing sections)

3.3 Hard constraints

PLAN MUST NOT select:

3.4 Plan output shape

The plan MUST specify:

The orchestrator persists the plan into matrix.active_task.


4) EXECUTE (Normative)

EXECUTE performs exactly one scoped operation on exactly one Part.

4.1 Prompt hydration (Part slice)

Before invoking a persona, the orchestrator MUST hydrate a Part slice:

Details: Orchestration Slice-by-Slice Prompt Hydration

4.2 Narrator execution (DRAFT / REVISE)

If action is DRAFT or REVISE:

4.3 Editor execution (REVIEW)

If action is REVIEW:

4.4 Tool safety

All modifications MUST go through the guarded tool layer (file ops + state updates). No persona may mutate project files directly.


5) Atomicity, Concurrency, and Restart Safety

5.1 Atomic step rule

One loop iteration = one atomic action:

5.2 No concurrent writers

Only one worker persona may write at a time for the active project.

5.3 Crash recovery

On restart:


6) Observability and Control

Dashboard: Dashboard TUI Reference