lume

16 — Phase 3 plan (Stage 3: ownership, effects with handlers, structured concurrency, verification)

Phase 2 delivered Lume’s compile-time metaprogramming (comptime, hygienic quasiquote macros), exact data engine (decimal(p, s), table[T], compile-time checked query), single-binary tooling (lume build|run|test|fmt|doc|pkg|agent|evolve), and the self-evolution governance loop (use lcaas, use levolve), all keeping the stage 2 == stage 3 self-host fixpoint and the Zero-C steady state bit-identical in CI.

Phase 3 (Stage 3 in docs/04-roadmap.md) brings systems-grade memory safety without a garbage collector, effect handlers without function coloring, fearless structured concurrency, and machine-checked contract verification (lume prove v0) to the self-hosted compiler.

Entry gate: Phase 3 implementation begins only after the Stage 2 exit-criterion application (examples/apps/inventory/) and the remaining Track F items (F3c Hindley–Milner core inference and F4 front-end unification) are merged and green on main.

Every Phase 3 brick obeys the project’s non-negotiable rules:

  1. AI-first (P1–P6): Every new check emits a stable diagnostic code, structured JSON in lcaas/lume agent, and a deterministic fix-it suggestion.
  2. Superior to the reference language: Rust-grade safety with from-clause region ergonomics (no 'a lifetime noise in 95% of signatures), Koka-style Perceus in-place reuse + effect handlers, Erlang-style supervision with static Send/Sync guarantees, and Dafny/SPARK-style counterexamples on failed contracts.
  3. Self-host & Zero-C invariant: Every brick lands as a green PR with positive and negative conformance tests while keeping make bootstrap (stage2 == stage3) and make zero-c green.

Tracks and bricks

O — Ownership, borrowing, regions, and memory tiers (§6) — Complete


K — Effect system, algebraic handlers, and Perceus reuse (§8.2, DONE)


S — Structured concurrency, channels, and supervised actors (§10, DONE)


V — Contract verification (lume prove v0 and LAWS P34, §9, DONE)

A — AI-native authoring: holes, totality, and provenance (the AI-first multiplier, DONE)

Priority: not deferred. Lume exists so an AI can author correct code faster; A1–A3 are the features that most directly serve that mission, so they run early and in parallel with O/K/S/V, not after. Each is driven by the compiler-as-a-service (lcaas) and lume agent, machine-first.


Execution order & dependencies

Phase 2 Exit (F3c + F4 + examples/apps/inventory/)
   │
   ├──► Track O (O1 ──► O2 ──► O3 ──► O4)
   │       │
   │       ├──► Track K (K1 ──► K2 ──► K3 Perceus reuse)
   │       │
   │       └──► Track S (S1 ──► S2 ──► S3 actors + logical time)
   │
   ├──► Track V (V1 ──► V2 lume prove v0 ──► V3 LAWS + evolve gate)
   │                            │
   └──► Track A (A1 holes ║ A2 total ║ A3 provenance)  ← AI-first, runs EARLY in parallel, not deferred
                                │
                                ▼
             Stage 3 Capstone (examples/apps/job_server/)

Stage 3 Exit Criterion (docs/04-roadmap.md line 122, DONE ✅)

Implemented in examples/apps/job_server/ (lume.toml, lume.lock, protocol.src, engine.src, workers.src, main.src, expected_output.txt) — a complete concurrent service + worker pool + supervised actor job system with zero unsafe, exercising: