Skip to content

Latest commit

 

History

History
277 lines (205 loc) · 9.16 KB

rift_design_note_draft2.md

File metadata and controls

277 lines (205 loc) · 9.16 KB

Rift — Layer 3 Design Notes

Draft 2 — May 2026


Status of Draft 1 Open Questions

Draft 1 identified six unresolved design questions. All six are resolved here. This document supersedes Draft 1 on those questions. Draft 1 remains the authoritative reference for the foundational use case (Shelved Project Persistence) and the Continuum stack overview.


Q1 — What is the Rift Grammar?

Resolution: Three-layer grammar. v0.1 implements the Intent Layer only.

Rift has three internal layers, each with its own grammar:

Layer Constructs v0.1
Intent Layer intent, map, constraint, optimize ✅ In scope
Semantic Layer state, agent, system, behavior evolves, @priority v0.2+
Execution Layer @gpu, @quantum, @realtime, @atomic v0.3+

The Intent Layer is purely declarative. No operational escape hatches. No execution hints. No agent behavior. No system evolution rules.

Rift v0.1 is the Intent Layer and nothing else. Same discipline as Pi Script: scope is narrow, every construct has a direct use case, nothing speculative ships.


Q2 — How Does Rift Map Natural Language to Pi Script Constraints?

Resolution: The map construct is the translation primitive.

Rift's map block bridges human language to machine states:

map "I shelved [project]"     → project.state: dormant
map "let's revisit [project]" → project.state: active
map "I'm done with [project]" → project.state: closed

Once a declaration is mapped to a machine state, Rift generates the corresponding Pi Script constraint automatically. The developer never writes the Pi Script constraint by hand.

The mapping is the hard problem — and v0.1 keeps it simple. Maps are explicit string patterns with named captures ([project]). No NLP, no inference. Pattern matching only. Ambiguous declarations that match no map block produce a parse warning, not a silent failure.


Q3 — Who Owns Declared User State?

Resolution: Rift owns user-declared state. Pi Script owns system state. The boundary is clean.

State Type Example Owner
User intent "I shelved Veritas" Rift
System behavior "README not updated within 24h" Pi Script
Constraint monitoring "scope_flag must equal false" Pi Script
Generated constraints RespectShelfedProjects Pi Script (generated by Rift)

Rift tracks declared states and their lifecycle implications. Pi Script monitors system behavior against the constraints Rift generates. Neither layer reaches into the other's domain.

A Rift state declaration has three phases:

  1. Declared — user states intent ("I shelved Veritas")
  2. Active — constraint is live, Pi Script monitors
  3. Released — user rescinds or supersedes the declaration

Q4 — How Does Rift Handle Contradictory Declarations?

Resolution: Temporal precedence by default. @priority for explicit overrides.

Default rule: the most recent declaration wins.

// Monday
intent RespectShelfedProjects {
    when user declares: "I shelved [project]"
    treat: [project] as dormant
}

// Wednesday — supersedes Monday
intent ReactivateProject {
    when user declares: "let's revisit [project]"
    treat: [project] as active
    releases: RespectShelfedProjects for [project]
}

The releases keyword explicitly closes the prior constraint. Without releases, contradictory declarations stack — the inference engine resolves via @priority.

intent HardFreeze {
    when user declares: "freeze [project] permanently"
    treat: [project] as frozen
    @priority: critical          // cannot be overridden by lower-priority intents
}

@priority: critical means no subsequent declaration can release this constraint without an explicit override at the same priority level. This prevents accidental unlocking of high-stakes intent.


Q5 — Static or Dynamic Constraint Generation?

Resolution: v0.1 is static. v0.2 adds dynamic re-evaluation.

v0.1 — Static (compile-time):

  • Rift file is compiled to a Pi Script constraint set
  • Constraints are fixed at compile time
  • New declarations require a re-compile
  • Simple, auditable, no runtime surprises

v0.2 — Dynamic (runtime):

  • The Reflection phase feeds state back continuously
  • New user declarations trigger live constraint regeneration
  • Constraint set evolves without re-compiling
  • Requires the full multi-phase resolver

v0.1 makes the same tradeoff Pi Script made: correctness over capability. A static constraint set that is auditable and predictable is more valuable than a dynamic one that is powerful but opaque.


Q6 — What Triggers Rift Re-evaluation?

Resolution: Any new user declaration triggers re-evaluation. Event-driven, not session-bound.

In v0.1 (static): re-evaluation means re-compilation. The trigger is a new declaration added to the Rift file.

In v0.2 (dynamic): any of the following triggers a live re-evaluation:

  • New user declaration received
  • Declared state reaches its until condition
  • A monitored Pi Script constraint is violated (violation feeds back up)
  • Explicit @review annotation on a time window

Session boundaries do not trigger re-evaluation on their own. Intent persists across sessions by design — that is the entire point of Rift.


Rift v0.1 Grammar Specification (Draft)

// Rift v0.1 — Intent Layer only

// ─── Intent Block ──────────────────────────────────────────────────────────
intent IntentName {
    when user declares: "pattern with [capture]"
    treat: [capture] as state_value
    until: condition                          // optional
    enforce: behavioral_directive             // optional
    releases: OtherIntentName for [capture]   // optional
    generates: Pi Script constraint ConstraintName
    @priority: critical | high | medium       // optional
}

// ─── Map Block ─────────────────────────────────────────────────────────────
map "human phrase [capture]" → entity.field: value

// ─── Constraint Block (hand-written, no generator) ─────────────────────────
constraint ConstraintName {
    priority:     critical | high | medium
    rule:         condition
    on_violation: flag | escalate | freeze
}

Minimal valid Rift program

map "I shelved [project]"     → project.state: dormant
map "let's revisit [project]" → project.state: active

intent RespectShelfedProjects {
    when user declares: "I shelved [project]"
    treat: [project] as dormant
    until: user declares "let's revisit [project]"
    enforce: do not reference [project] unprompted
    generates: Pi Script constraint ShelvedProjectGuard
}

This is the minimum. One map, one intent, one generated constraint. The output of compiling this Rift program is a Pi Script .pi file containing ShelvedProjectGuard — ready for the Pi Script resolver to monitor.


The Full Continuum Loop (Updated)

User declares intent in natural language
        ↓
Rift maps declaration to machine state (map blocks)
        ↓
Rift generates Pi Script constraint set
        ↓
Pi Script monitors system behavior against constraints
        ↓
Violations produce auditable RESOLUTION TRACEs
        ↓
Humans review traces and decide what to do
        ↓
Decision feeds back as a new user declaration (Rift)

No existing tool covers this loop end-to-end. Continuum covers all six steps.


What Rift v0.1 Is Not

Rift v0.1 deliberately excludes:

Excluded Reason When
state with spectra/ranges Semantic Layer — v0.2 After v0.1 ships
agent objects Semantic Layer — v0.2 After v0.1 ships
system evolution rules Semantic Layer — v0.2 After v0.1 ships
@gpu, @quantum Execution Layer — v0.3 After v0.2 ships
Dynamic constraint generation Requires full resolver v0.2
NLP-based map matching Requires inference engine v0.2+
Quantum-native types Execution Layer v0.3+

The full Rift vision (all three layers, multi-agent, quantum substrates, self-hosting compiler in Rust/Zig with OCaml frontend) is the long-term architecture. v0.1 proves the core loop works with the simplest possible implementation.


Implementation Gate (Unchanged from Draft 1)

Rift v0.1 grammar work begins when:

  • Pi Script M5 dogfood is complete (30 days)
  • At least 3 real violations have been captured and traced

Current status as of Draft 2: Day 19 of 30. 2 deliberate violations captured (ScopeGuard, SpecAlignment). Gate opens approximately 2026-05-28.


Document Status

Field Value
Document version Draft 2
Layer Rift (Layer 3)
Stack Continuum
Status Design note — not for implementation
Supersedes Draft 1 open questions (Q1–Q6)
Depends on Pi Script v0.1 M5 dogfood complete
Next action Rift v0.1 grammar file (rift/rift_v01.lark) after gate opens

— End of Rift Draft 2 Design Note —