kae3g 9515: Regenesis Demo - Make It Tactile
Status: Scaffolded | Implementation: In Progress
Goal: One-button demo showing the complete stack breathing
What Is Regenesis?
Regenesis (not genesis!) = Eternal return, continuous rebirth
Why "Re"?:
- Genesis = creation from nothing (singular, done once)
- Re-regenesis = regeneration from eternal specs (continuous, forever)
- Each build re-manifests the Platonic ideal (Nock spec)
- Like perennial plants: die back, regenerate from roots
Theologically: Not creation ex nihilo, but re-creation ex spec
Ecologically: Not planting seeds, but regenerating from living root systems (Helen Atthowe!)
Mathematically: Not inventing new math, but re-deriving from frozen axioms (Nock's 12 rules!)
The Regenesis Ritual
One command regenerates the entire valley:
bb regenesis
Or with the valley CLI (symlink):
./valley regenesis
What it does:
- Build: Compile Nostr relay (GraalVM native image OR JVM)
- Start: Boot fake Urbit ship (
-F zod
) - Serve: Launch ClojureScript frontend (shadow-cljs)
- Connect: Wire Nostr → Urbit → UI
- Send: Verified message through complete stack
- Measure: Record metrics (startup, latency, equivalence)
- Report: Write
var/reports/regenesis.json
- Announce: "The valley regenerates. Your first noun recomputes."
Dual-Runtime Verification
The demo exercises BOTH paths:
Fast Path (GraalVM - Phenotype)
bb regenesis:fast
# Measures:
# - Startup time (target: < 50ms)
# - Message latency (target: < 10ms)
# - Memory footprint (target: < 100MB)
This is the MUTABLE phenotype - optimized for today's world.
True Path (Nock - Genotype)
bb regenesis:true
# Measures:
# - Nock reduction steps
# - Equivalence to Clojure output
# - Verification coverage (%)
This is the IMMUTABLE genotype - eternal specification.
Verify Equivalence
bb regenesis:verify
# Checks:
# ✓ Fast output = True output (same noun!)
# ✓ All test vectors pass
# ✓ Reductions logged
The proof that they're the SAME computation - just different instantiations!
Proof Obligations
For each transformation, we maintain:
1. Equivalence Notes (.nock.md
)
Template:
# Equivalence Note: Nostr Event Filter
**Intent**: Filter Nostr events by kind (e.g., text notes only)
**Clojure path**:
\`\`\`clojure
(ns nostr.core
(:require [clojure.spec.alpha :as s]))
;; Spec for event
(s/def ::kind int?)
(s/def ::content string?)
(s/def ::event (s/keys :req-un [::kind ::content]))
;; Pure function
(defn filter-by-kind [events kind-target]
(filter #(= (:kind %) kind-target) events))
\`\`\`
**Nock form** (canonical reduction):
\`\`\`
; Input noun: [events-list kind-target]
; Output noun: [filtered-events-list]
; Nock formula (conceptual):
?[events target]
; Apply test to each event
; Keep events where (= kind target)
; Deterministic transformation
\`\`\`
**Claim**: The Clojure function and Nock reduction are semantically equivalent for all valid inputs.
**Evidence**:
- Test vectors: `var/golden/filter-by-kind/inputs.json`
- Expected outputs: `var/golden/filter-by-kind/outputs.json`
- Reductions log: `var/golden/filter-by-kind/reductions.log`
**Status**: ✅ Verified (100 random test cases passed)
2. Jet Notes (.jet.md
)
Template:
# Jet Note: Event Filter Optimization
**Purpose**: Fast path for `filter-by-kind` that preserves Nock semantics
**Nock expression** (from `filter-by-kind.nock.md`):
\`\`\`
?[events target] ; conceptual Nock reduction
\`\`\`
**Host jet** (optimized Clojure):
\`\`\`clojure
(defn filter-by-kind-jet [events kind-target]
;; Optimized with transducers
(into [] (filter #(= (:kind %) kind-target)) events))
\`\`\`
**Mapping**:
- Nock recursive reduction → Clojure transducer (O(n) same complexity)
- Deterministic: Same inputs → same outputs
- Verified: Cross-checked against golden nouns
**Performance**:
- Nock interpreter: ~1000ms (1000 events)
- Jet optimization: ~5ms (1000 events)
- **Speedup: 200x** (while preserving semantics!)
**Tests**: CI asserts jet output = Nock output for all golden test vectors
**Status**: ✅ Verified equivalence, deployed in production
Metrics Tracked
Written to var/reports/regenesis.json
:
{
"timestamp": "2025-10-10T22:30:00Z",
"regenesis": {
"fast_path": {
"startup_ms": 42,
"message_latency_ms": 8,
"memory_mb": 87
},
"true_path": {
"nock_reduction_steps": 15420,
"nock_eval_ms": 450,
"equivalence_coverage_pct": 73
},
"verification": {
"outputs_match": true,
"golden_vectors_passed": 100,
"golden_vectors_total": 100
}
}
}
These metrics get appended to docs/PROGRESS-SUMMARY.md
automatically!
The First Ritual (Onboarding)
For newcomers, the Regenesis ritual is initiation:
Step 1: Clone the Valley
git clone https://codeberg.org/kae3g/12025-10
cd 12025-10
Step 2: Run Regenesis
./valley regenesis
What happens:
- Builds everything (Nix ensures reproducibility)
- Starts all services (Nostr, Urbit, UI)
- Sends first message through complete stack
- You see it working (browser opens to UI)
- Metrics written (proof it ran!)
Step 3: Verify
bb regenesis:verify
# ✓ Fast path and true path produce same noun
# ✓ All golden test vectors pass
# ✓ Equivalence maintained
Output:
The valley regenerates.
Your first noun recomputes.
Fast path: 42ms startup, 8ms latency
True path: 15,420 reduction steps, equivalence ✓
Welcome, valley builder. 🌱🔷
This makes the abstract TACTILE - you FEEL Nock regenerating!
Clojure Spec Throughout
Every layer uses Spec for contracts and verification:
Why Spec?
- Runtime validation (catch errors early!)
- Generative testing (auto-generate test cases!)
- Self-documentation (specs are executable docs!)
- Verification (prove properties of code!)
Even the Regenesis script itself is spec'd!
;; From scripts/regenesis.bb
(s/def ::startup-ms pos-int?)
(s/def ::fast-path (s/keys :req-un [::startup-ms ::message-latency-ms ::memory-mb]))
(s/def ::report (s/keys :req-un [::timestamp ::regenesis]))
;; Validation built into script!
(when-not (s/valid? ::report report)
(throw (ex-info "Invalid metrics!" {:explain (s/explain-str ::report report)})))
Nostr Events
(require '[clojure.spec.alpha :as s])
;; Event structure
(s/def ::id string?)
(s/def ::pubkey string?)
(s/def ::created-at int?)
(s/def ::kind int?)
(s/def ::tags (s/coll-of vector?))
(s/def ::content string?)
(s/def ::sig string?)
(s/def ::event
(s/keys :req-un [::id ::pubkey ::created-at ::kind ::tags ::content ::sig]))
;; Validation
(defn valid-event? [event]
(s/valid? ::event event))
;; Generative testing
(require '[clojure.spec.gen.alpha :as gen])
(gen/sample (s/gen ::event) 10)
; Generates 10 random valid events for testing!
Nock Nouns
;; Noun spec (atom or cell)
(s/def ::atom nat-int?)
(s/def ::cell (s/tuple ::noun ::noun))
(s/def ::noun (s/or :atom ::atom :cell ::cell))
;; Formula spec (Nock opcodes 0-11)
(s/def ::opcode #{0 1 2 3 4 5 6 7 8 9 10 11})
(s/def ::formula (s/tuple ::opcode (s/* ::noun)))
;; Validation
(defn valid-noun? [n]
(s/valid? ::noun n))
API Contracts
;; Function spec
(s/fdef filter-by-kind
:args (s/cat :events (s/coll-of ::event)
:kind-target ::kind)
:ret (s/coll-of ::event)
:fn (fn [{:keys [args ret]}]
; Property: All returned events have target kind
(every? #(= (:kind %) (:kind-target args)) ret)))
;; This spec enables:
;; - Compile-time checking
;; - Generative testing
;; - Runtime validation
;; - Documentation!
Current Status
✅ Complete (Documentation)
- Essay 9517 written
- Architecture documented
- Code examples provided
- Three deployment tiers outlined
🚧 In Progress (Implementation)
- Nostr relay (Clojure + Spec)
- Babashka Nock interpreter
- ClojureScript frontend
- Equivalence notes
- Regenesis script
📋 Next Steps
- Implement Babashka Nock interpreter (12 rules!)
- Create first Nock Kata (compute
*[[42 17] 0 2]
) - Build Nostr relay with Spec contracts
- Wire Regenesis script
- Run and measure!
The Valley Theorem (Formal Statement)
Declared in docs/PROGRESS-SUMMARY.md
:
The Valley Theorem
For any computational intent ( I ) expressed in the high-level stack (Clojure, ClojureScript, Nostr, Urbit), there exists a path-preserving transformation ( \tau ) to the Nock base specification such that:
- Semantic Equivalence: ( \text{eval}{\text{Clojure}}(I) \equiv \text{eval}{\text{Nock}}(\tau(I)) )
- Environmental Independence: Equivalence holds under all perturbations (hardware changes, time, network)
- Verifiability: The transformation ( \tau ) is auditable and provable
Proof Strategy: Demonstrate equivalence through:
- Clojure Spec contracts (type-level properties)
- Golden test vectors (extensional equality)
- Nock reductions (intensional equality)
- Formal verification (Haskell → Liquid Haskell proofs)
This frames the entire project as a PROOF-SEEKING MISSION! 🔷
Links
- Main Essay: 9517-complete-stack-in-action.md
- Nock Spec: 9503-what-is-nock.md
- Mathematical Constitution: docs/MATHEMATICAL-CONSTITUTION.md
- TODO: docs/TODO.md
The valley regenerates. The proof unfolds. The cycle is eternal. 🔄🌱🔷
Copyright © 2025 kae3g | Dual-licensed under Apache-2.0 / MIT
Competitive technology in service of clarity and beauty