From 410ce77264c87da26a5bccb342eb722fe96da1ad Mon Sep 17 00:00:00 2001 From: Lior Date: Thu, 28 May 2026 07:29:34 -0400 Subject: [PATCH 1/8] feat(world): world substrate + reusable lifetime-composition helpers (Aaron 2026-05-28 naming substrate + reusability substrate-engineering questions); 14 tests pass MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per Aaron 2026-05-28 two substantive substrate-engineering substrate questions: 1. 'do you have to write custom code everytime you compose two lifetimes' → NO; dispatch substrate is reusable; only matrix per-pair; recurring patterns factored via defaultAdvanceMatrix + terminalMatrix + predicateMatrix helpers 2. '(do we still call the shared git flow a lifetime or world or shared space?)' → WORLD (shared substrate where multiple lifetimes interact; different scope from per-substrate-entity lifetime; world contains lifetimes) Naming canon established: - LIFETIME = editable per-substrate-entity DU (Aaron's prior framing) - WORLD = shared substrate where multiple lifetimes interact - GIT FLOW = operational form of the world What this adds: - World interface (registry of lifetime-pair matrices keyed by pair name) - EMPTY_WORLD constant - StandardVerdict discriminated union (advance | block | complete | no-op | escalate-to-operator) — factors out recurring vocabulary so per-pair matrices reuse it instead of inventing parallel verdict types - registerLifetimePair (immutable world update; returns new world) - lookupLifetimePair (registry lookup) - defaultAdvanceMatrix (every-cell defaults to advance; caller overrides specific cells) - terminalMatrix (single-cell complete; other cells from terminal A block) - predicateMatrix (most general; caller predicate per cell) - dispatchInWorld (world-level lookup + dispatch; UnregisteredPair feedback) Re-exports from composed-lifetime.ts (PR #5771) so callers compose with world.ts for both naming + helpers. Tests (14; all pass): - EMPTY_WORLD zero pairs - registerLifetimePair immutable + adds pair - lookupLifetimePair found/undefined cases - defaultAdvanceMatrix every-cell-advance + overrides applied - terminalMatrix terminal+block cells - predicateMatrix caller-supplied dispatch - dispatchInWorld lookup + dispatch + UnregisteredPair feedback - StandardVerdict exhaustive switch (5 variants) - Reusability test: full 9-transition world built with helpers (no per-cell custom code) - Multiple lifetime pairs registered in single world (workflow-review + workflow-encryption) Composes with substrate: - composed-lifetime.ts PR #5771 (base dispatch substrate) - B-0832 civ-sim substrate (game-world; Pauli-exclusion-for-agenda) - B-0867 workflow engine (workflow world) - 13th-ferry §33.7 multi-AI cascade (each AI inhabits the world) - additive-not-zero-sum + honor-those-that-came-before + monad-propagation + asymmetric-authorship rules Substrate-engineering answer to Q1 directly demonstrated: - 'workflow-review world built with helpers (no per-cell custom code)' test exercises predicateMatrix to build full 9-transition matrix in ~5 lines of predicate code; no per-cell hand-rolled matrix entries Co-Authored-By: Claude Opus 4.7 --- tools/workflow-engine/world.test.ts | 258 ++++++++++++++++++++++++++++ tools/workflow-engine/world.ts | 256 +++++++++++++++++++++++++++ 2 files changed, 514 insertions(+) create mode 100644 tools/workflow-engine/world.test.ts create mode 100644 tools/workflow-engine/world.ts diff --git a/tools/workflow-engine/world.test.ts b/tools/workflow-engine/world.test.ts new file mode 100644 index 0000000000..ddef23e8a2 --- /dev/null +++ b/tools/workflow-engine/world.test.ts @@ -0,0 +1,258 @@ +/** + * tools/workflow-engine/world.test.ts + * + * Invariant tests for world substrate + reusable lifetime composition helpers. + */ + +import { describe, expect, it } from "bun:test"; +import { + EMPTY_WORLD, + composeKey, + defaultAdvanceMatrix, + dispatchInWorld, + lookupLifetimePair, + predicateMatrix, + registerLifetimePair, + terminalMatrix, + type ComposedKey, + type LifetimeState, + type StandardVerdict, +} from "./world"; + +interface WorkflowLifetime extends LifetimeState { + readonly kind: "draft" | "submitted" | "approved"; +} + +interface ReviewLifetime extends LifetimeState { + readonly kind: "pending" | "in-review" | "merged"; +} + +const workflowUniverse: WorkflowLifetime[] = [ + { kind: "draft" }, + { kind: "submitted" }, + { kind: "approved" }, +]; + +const reviewUniverse: ReviewLifetime[] = [ + { kind: "pending" }, + { kind: "in-review" }, + { kind: "merged" }, +]; + +describe("world substrate + reusable lifetime composition helpers", () => { + it("EMPTY_WORLD has zero registered pairs", () => { + expect(EMPTY_WORLD.registry.size).toBe(0); + }); + + it("registerLifetimePair: returns new world with pair registered", () => { + const matrix = new Map, StandardVerdict>([ + ["draft:pending", { kind: "advance" }], + ]); + const world = registerLifetimePair( + EMPTY_WORLD, + "workflow-review", + matrix, + ); + expect(world.registry.size).toBe(1); + expect(world.registry.has("workflow-review")).toBe(true); + // Immutable: original unchanged + expect(EMPTY_WORLD.registry.size).toBe(0); + }); + + it("lookupLifetimePair: returns matrix when registered", () => { + const matrix = new Map, StandardVerdict>([ + ["draft:pending", { kind: "advance" }], + ]); + const world = registerLifetimePair( + EMPTY_WORLD, + "workflow-review", + matrix, + ); + const found = lookupLifetimePair( + world, + "workflow-review", + ); + expect(found).toBeDefined(); + expect(found?.get("draft:pending")?.kind).toBe("advance"); + }); + + it("lookupLifetimePair: undefined for unregistered pair", () => { + const found = lookupLifetimePair( + EMPTY_WORLD, + "nonexistent", + ); + expect(found).toBeUndefined(); + }); + + it("defaultAdvanceMatrix: every-cell defaults to advance", () => { + const matrix = defaultAdvanceMatrix(workflowUniverse, reviewUniverse); + expect(matrix.size).toBe(9); // 3 × 3 + for (const verdict of matrix.values()) { + expect(verdict.kind).toBe("advance"); + } + }); + + it("defaultAdvanceMatrix: overrides applied at specific cells", () => { + const overrides = new Map, StandardVerdict>([ + ["draft:in-review", { kind: "block", reason: "can't review draft" }], + ["approved:merged", { kind: "complete" }], + ]); + const matrix = defaultAdvanceMatrix(workflowUniverse, reviewUniverse, overrides); + expect(matrix.size).toBe(9); + expect(matrix.get("draft:in-review")?.kind).toBe("block"); + expect(matrix.get("approved:merged")?.kind).toBe("complete"); + expect(matrix.get("draft:pending")?.kind).toBe("advance"); // not overridden + }); + + it("terminalMatrix: terminal cell is complete; other cells from terminal A are block", () => { + const matrix = terminalMatrix( + workflowUniverse, + reviewUniverse, + { kind: "approved" } as WorkflowLifetime, + { kind: "merged" } as ReviewLifetime, + ); + expect(matrix.get("approved:merged")?.kind).toBe("complete"); + expect(matrix.get("approved:pending")?.kind).toBe("block"); + expect(matrix.get("approved:in-review")?.kind).toBe("block"); + // Non-terminal A cells default to advance + expect(matrix.get("draft:pending")?.kind).toBe("advance"); + }); + + it("terminalMatrix: custom block reason", () => { + const matrix = terminalMatrix( + workflowUniverse, + reviewUniverse, + { kind: "approved" } as WorkflowLifetime, + { kind: "merged" } as ReviewLifetime, + "approval is terminal", + ); + const blocked = matrix.get("approved:pending"); + if (blocked?.kind === "block") { + expect(blocked.reason).toBe("approval is terminal"); + } else { + throw new Error("expected block verdict"); + } + }); + + it("predicateMatrix: dispatches via caller-supplied predicate", () => { + const matrix = predicateMatrix(workflowUniverse, reviewUniverse, (a, b): StandardVerdict => { + if (a.kind === "draft" && b.kind !== "pending") { + return { kind: "block", reason: "draft only valid with pending review" }; + } + if (a.kind === "approved" && b.kind === "merged") { + return { kind: "complete" }; + } + return { kind: "advance" }; + }); + expect(matrix.size).toBe(9); + expect(matrix.get("draft:in-review")?.kind).toBe("block"); + expect(matrix.get("approved:merged")?.kind).toBe("complete"); + expect(matrix.get("submitted:in-review")?.kind).toBe("advance"); + }); + + it("dispatchInWorld: looks up registered pair + dispatches", () => { + const matrix = defaultAdvanceMatrix(workflowUniverse, reviewUniverse); + const world = registerLifetimePair( + EMPTY_WORLD, + "workflow-review", + matrix, + ); + const result = dispatchInWorld( + world, + "workflow-review", + { kind: "draft" } as WorkflowLifetime, + { kind: "pending" } as ReviewLifetime, + ); + expect(result.ok).toBe(true); + if (!result.ok) return; + expect((result as { ok: true; verdict: StandardVerdict; fromKey: string }).verdict.kind).toBe("advance"); + }); + + it("dispatchInWorld: unregistered pair returns UnregisteredPair", () => { + const result = dispatchInWorld( + EMPTY_WORLD, + "missing-pair", + { kind: "draft" } as WorkflowLifetime, + { kind: "pending" } as ReviewLifetime, + ); + expect(result.ok).toBe(false); + if (result.ok) return; + // UnregisteredPair has its own kind + if ("feedback" in result && "kind" in result.feedback && result.feedback.kind === "UnregisteredPair") { + expect(result.feedback.pairName).toBe("missing-pair"); + } else { + throw new Error("expected UnregisteredPair feedback"); + } + }); + + it("StandardVerdict exhaustive switch (compile-time check)", () => { + const acknowledge = (v: StandardVerdict): string => { + switch (v.kind) { + case "advance": + case "block": + case "complete": + case "no-op": + case "escalate-to-operator": + return v.kind; + } + }; + expect(acknowledge({ kind: "advance" })).toBe("advance"); + expect(acknowledge({ kind: "block", reason: "x" })).toBe("block"); + expect(acknowledge({ kind: "complete" })).toBe("complete"); + expect(acknowledge({ kind: "no-op" })).toBe("no-op"); + expect(acknowledge({ kind: "escalate-to-operator", reason: "x" })).toBe("escalate-to-operator"); + }); + + it("substrate-engineering reusability test: workflow-review world built with helpers (no per-cell custom code)", () => { + // Showcase: full 9-transition matrix built with predicateMatrix helper + // (no per-cell custom code; recurring pattern factored into predicate) + const matrix = predicateMatrix(workflowUniverse, reviewUniverse, (a, b): StandardVerdict => { + if (a.kind === "approved" && b.kind === "merged") return { kind: "complete" }; + if (a.kind === "draft" && b.kind !== "pending") return { kind: "block", reason: "draft+non-pending" }; + if (a.kind === "submitted" && b.kind === "merged") return { kind: "block", reason: "not approved" }; + return { kind: "advance" }; + }); + const world = registerLifetimePair( + EMPTY_WORLD, + "workflow-review", + matrix, + ); + + // Test multiple dispatch lookups + const advanceResult = dispatchInWorld( + world, "workflow-review", + { kind: "submitted" } as WorkflowLifetime, { kind: "in-review" } as ReviewLifetime, + ); + expect(advanceResult.ok).toBe(true); + + const completeResult = dispatchInWorld( + world, "workflow-review", + { kind: "approved" } as WorkflowLifetime, { kind: "merged" } as ReviewLifetime, + ); + expect(completeResult.ok).toBe(true); + }); + + it("multiple lifetime pairs registered in single world (workflow-review + workflow-encryption)", () => { + interface EncryptionLifetime extends LifetimeState { + readonly kind: "plain" | "encrypted" | "sealed"; + } + const encryptionUniverse: EncryptionLifetime[] = [ + { kind: "plain" }, { kind: "encrypted" }, { kind: "sealed" }, + ]; + + const wrMatrix = defaultAdvanceMatrix(workflowUniverse, reviewUniverse); + const weMatrix = defaultAdvanceMatrix(workflowUniverse, encryptionUniverse); + + let world = EMPTY_WORLD; + world = registerLifetimePair( + world, "workflow-review", wrMatrix, + ); + world = registerLifetimePair( + world, "workflow-encryption", weMatrix, + ); + + expect(world.registry.size).toBe(2); + expect(world.registry.has("workflow-review")).toBe(true); + expect(world.registry.has("workflow-encryption")).toBe(true); + }); +}); diff --git a/tools/workflow-engine/world.ts b/tools/workflow-engine/world.ts new file mode 100644 index 0000000000..84dbb313f8 --- /dev/null +++ b/tools/workflow-engine/world.ts @@ -0,0 +1,256 @@ +/** + * tools/workflow-engine/world.ts + * + * World substrate + reusable lifetime composition helpers. + * + * Per Aaron 2026-05-28 two substantive substrate-engineering questions: + * 1. 'do you have to write custom code everytime you compose two lifetimes' + * 2. '(do we still call the shared git flow a lifetime or world or + * shared space?)' + * + * Substrate-engineering naming substrate (Aaron-acknowledged): use + * 'WORLD' for the shared git-flow substrate where multiple lifetimes + * interact. Different scope from 'lifetime' (per-substrate-entity DU); + * world contains lifetimes; lifetime composition happens IN the world. + * + * Substrate-engineering substrate-reusability substrate (answers Q1): + * dispatch substrate is REUSABLE; only the matrix is per-pair. This file + * ships reusable helpers + matrix-builder substrate that factors + * recurring transition patterns (advance/block/complete) so caller + * doesn't write custom code per lifetime pair when patterns recur. + * + * Composes with: + * - tools/workflow-engine/composed-lifetime.ts (PR #5771) — base dispatch + * - B-0832 civ-sim substrate (game-world; Pauli-exclusion-for-agenda) + * - B-0867 workflow engine (multiple lifetimes interact in workflow world) + * - 13th-ferry §33.7 multi-AI cascade (each AI inhabits the world) + * - .claude/rules/additive-not-zero-sum (world substrate compounds) + * - .claude/rules/honor-those-that-came-before (lifetime variants + * preserved in world substrate when adding new ones) + * - .claude/rules/monad-propagation-pattern (Result) + * + * Naming canon (Aaron 2026-05-28): + * - LIFETIME = editable per-substrate-entity DU (per Aaron's earlier + * 'lifetime not lifecycle because you can edit it FYI the DUs') + * - WORLD = shared substrate where multiple lifetimes interact + * - GIT FLOW = operational form of the world (substrate-engineering + * substrate the world IS realized as) + */ + +import { + buildComposedMatrix, + composeFromDispatcher, + composeKey, + dispatchComposed, + type ComposedKey, + type ComposedLifetimeContext, + type LifetimeState, + type TransitionResult, +} from "./composed-lifetime"; + +// Re-export the composed-lifetime substrate as part of the world substrate +// (callers compose with world.ts for both naming + helpers). +export { + buildComposedMatrix, + composeFromDispatcher, + composeKey, + dispatchComposed, + type ComposedKey, + type ComposedLifetimeContext, + type LifetimeState, + type TransitionResult, +}; + +/** + * World — the shared substrate where multiple lifetimes interact. + * + * Per Aaron 2026-05-28 naming substrate-engineering: 'world' is the + * shared git-flow substrate. Different scope from per-substrate-entity + * lifetimes; world contains lifetimes + their composition rules. + * + * Generic over the named lifetimes the world contains. PoC scope: + * world holds a registry of composed-lifetime matrices keyed by + * lifetime-pair name. Caller registers matrices when introducing new + * lifetime pairs; dispatch lookups go through the world's registry. + */ +export interface World { + readonly registry: ReadonlyMap>; +} + +/** + * Empty world — no lifetime pairs registered. + */ +export const EMPTY_WORLD: World = { + registry: new Map(), +}; + +/** + * Standard transition verdict — used across MANY lifetime pairs. + * + * Substrate-engineering substrate-honesty: the recurring verbs are + * advance / block / complete / no-op / escalate. This discriminated + * union factors out the recurring vocabulary so per-pair matrices + * reuse it instead of inventing parallel verdict types. + * + * Per Aaron 2026-05-28 substrate-engineering question 'do you have to + * write custom code everytime' — NO; this StandardVerdict factors out + * the recurring substrate so most lifetime pairs reuse it. + */ +export type StandardVerdict = + | { kind: "advance" } + | { kind: "block"; reason: string } + | { kind: "complete" } + | { kind: "no-op" } + | { kind: "escalate-to-operator"; reason: string }; + +/** + * Register a composed-lifetime matrix in the world. + * + * Returns a NEW world (immutable substrate per asymmetric-authorship); + * world authors its own substrate via consent-channel. + */ +export function registerLifetimePair< + A extends LifetimeState, + B extends LifetimeState, + T, +>( + world: World, + pairName: string, + matrix: ReadonlyMap, T>, +): World { + const newRegistry = new Map(world.registry); + newRegistry.set(pairName, matrix as ReadonlyMap); + return { registry: newRegistry }; +} + +/** + * Look up a composed-lifetime matrix by pair name. + * + * Returns undefined if pair not registered. + */ +export function lookupLifetimePair< + A extends LifetimeState, + B extends LifetimeState, + T, +>( + world: World, + pairName: string, +): ReadonlyMap, T> | undefined { + return world.registry.get(pairName) as ReadonlyMap, T> | undefined; +} + +/** + * Reusable matrix builder: every-pair → advance. + * + * Caller often wants the common case of "all valid transitions advance; + * the matrix surfaces only the EXCEPTIONS (block / complete / no-op)." + * This helper builds the advance-by-default matrix; caller overrides + * specific cells with block/complete as needed. + * + * Substrate-engineering substrate-reusability: factors out the recurring + * "every-cell-defaults-to-advance" pattern so caller doesn't write the + * cross-product manually. + */ +export function defaultAdvanceMatrix< + A extends LifetimeState, + B extends LifetimeState, +>( + universeA: ReadonlyArray, + universeB: ReadonlyArray, + overrides?: ReadonlyMap, StandardVerdict>, +): ReadonlyMap, StandardVerdict> { + const result = new Map, StandardVerdict>(); + for (const a of universeA) { + for (const b of universeB) { + const key = composeKey(a, b); + const override = overrides?.get(key); + result.set(key, override ?? { kind: "advance" }); + } + } + return result; +} + +/** + * Reusable matrix builder: terminal state at specific cell. + * + * Substrate-engineering shortcut: when a single (A, B) cell signals + * "the lifetime composition terminates here with `complete` verdict", + * this builds the matrix from defaults + the terminal cell. + */ +export function terminalMatrix< + A extends LifetimeState, + B extends LifetimeState, +>( + universeA: ReadonlyArray, + universeB: ReadonlyArray, + terminalA: A, + terminalB: B, + blockReason?: string, +): ReadonlyMap, StandardVerdict> { + const overrides = new Map, StandardVerdict>(); + overrides.set(composeKey(terminalA, terminalB), { kind: "complete" }); + // Block all OTHER cells where A is at the terminal state (can't go elsewhere) + for (const b of universeB) { + if (b.kind !== terminalB.kind) { + const key = composeKey(terminalA, b); + overrides.set(key, { + kind: "block", + reason: blockReason ?? `terminal A=${terminalA.kind}; can't transition B≠${terminalB.kind}`, + }); + } + } + return defaultAdvanceMatrix(universeA, universeB, overrides); +} + +/** + * Reusable matrix builder: gate matrix from a predicate. + * + * Most general helper: dispatch verdict per-cell via predicate. Used + * when transitions follow a SIMPLE PATTERN expressible in code rather + * than enumerated by hand. + * + * Composes with composeFromDispatcher; this is the StandardVerdict-typed + * specialization. + */ +export function predicateMatrix< + A extends LifetimeState, + B extends LifetimeState, +>( + universeA: ReadonlyArray, + universeB: ReadonlyArray, + predicate: (a: A, b: B) => StandardVerdict, +): ReadonlyMap, StandardVerdict> { + const result = new Map, StandardVerdict>(); + for (const a of universeA) { + for (const b of universeB) { + const verdict = predicate(a, b); + result.set(composeKey(a, b), verdict); + } + } + return result; +} + +/** + * World-level dispatch: look up the matrix by pair name + dispatch + * the composed transition. + * + * Per asymmetric-authorship: substrate-entity (the world) authors what + * lifetime pairs it knows about; caller acknowledges by registering + * pairs before dispatch. + */ +export function dispatchInWorld< + A extends LifetimeState, + B extends LifetimeState, + T, +>( + world: World, + pairName: string, + a: A, + b: B, +): TransitionResult | { ok: false; feedback: { kind: "UnregisteredPair"; pairName: string } } { + const matrix = lookupLifetimePair(world, pairName); + if (matrix === undefined) { + return { ok: false, feedback: { kind: "UnregisteredPair", pairName } }; + } + return dispatchComposed({ matrix }, a, b); +} From 2b0c0eb4eba934802023cff72040d1b31288c8bc Mon Sep 17 00:00:00 2001 From: Lior Date: Thu, 28 May 2026 07:36:20 -0400 Subject: [PATCH 2/8] =?UTF-8?q?feat(world-hierarchy):=20Clifford=20?= =?UTF-8?q?=E2=86=92=20DBSP=20=E2=86=92=20Git=20=E2=86=92=20GitHubWorld=20?= =?UTF-8?q?substrate-naming=20substrate=20(Aaron=202026-05-28=20'git=20inh?= =?UTF-8?q?erits=20from=20restricted=20clifford=20or=20fully=20isomorphic?= =?UTF-8?q?=20basically=20DBSP;=20clifford=20canonical=20once=20we=20have?= =?UTF-8?q?=20it');=2020=20tests=20pass?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per Aaron 2026-05-28: "Git inherits from restricted clifford, or maybe it's fully isomorphic but it's basically DBSP and so we have DBSP and Clifford worlds with one be connonical i'm voting for clifford once we have it" Substrate-engineering substrate-naming hierarchy substrate: CliffordWorld (canonical; Aaron-voted; once shipped) ↓ restricted to incremental-dataflow + retraction substrate DBSPWorld (Budiu et al VLDB 2023; differential-dataflow substrate) ↓ restricted to tree-state + commit-graph + ref substrate GitWorld (operational substrate; PR #5775) ↓ specialized by forge GitHubWorld / GitLabWorld / GiteaWorld / ... What this adds: - SubstrateAlgebra DU: "clifford" | "dbsp" | "git" | "git-forge" - HierarchyDepth: 0 (clifford) | 1 (dbsp) | 2 (git) | 3 (forge) - HierarchicalWorld extends World + substrateAlgebra + hierarchyDepth + parentAlgebra - parentOf(algebra) — substrate-engineering inheritance walk - depthOf(algebra) — compile-time-stable mapping - inheritsFrom(candidate, ancestor) — IS-A relation (reflexive) - annotateHierarchy(world, algebra) — annotate existing World - verifyHierarchy(world) — internal-consistency guard with Result - OPEN_QUESTION_DBSP_CLIFFORD — preserves both readings (don't-collapse per default-to-both): (A) Git ⊂ DBSP ⊂ Clifford strict-subset chain (B) DBSP ↔ Clifford fully isomorphic; Git ⊂ both equivalently - CliffordWorldPlaceholder + DBSPWorldPlaceholder — type-namespace reserved for follow-up substrate-engineering rows Tests (20; all pass): - parentOf chain (4): clifford=null, dbsp→clifford, git→dbsp, git-forge→git - depthOf mapping (4): 0/1/2/3 - inheritsFrom IS-A (5): reflexive + full-chain + scoped + root-only - annotateHierarchy (2): correct fields, clifford root - verifyHierarchy (3): well-formed + depth-mismatch + wrong-parent - OPEN_QUESTION preservation (1): both readings verbatim - End-to-end composition (1): annotate + verify + chain query Composes with substrate: - PR #5774 world.ts (base World substrate; cherry-picked dep) - PR #5775 git-world.ts (GitWorld + GitHubWorld specialization) - B-0635 wave-particle duality (Clifford multivector substrate) - B-0666 English-as-projection I(D(x))=x identity - B-0644 Limit-as-simulation (pre-collapse substrate) - Multiple Kestrel ferries naming Clifford as canonical substrate-engineering substrate - DBSP (Budiu et al VLDB 2023; differential-dataflow incremental view maintenance) - Result monad-propagation pattern - asymmetric-authorship rule (HierarchyFeedback variants substrate-entity-authored) - default-to-both discipline (OPEN_QUESTION_DBSP_CLIFFORD preserves both readings) - substrate-smoothness rule (no if-statements; DU + exhaustive switch + Result-shape) Follow-up substrate-engineering targets: - CliffordWorld implementation (geometric-algebra substrate: multivector + grade-projection + geometric-product) - DBSPWorld implementation (Z-set + circuit + delta-incremental substrate) - Resolve OPEN_QUESTION_DBSP_CLIFFORD via algebraic-substrate work Cherry-picked world.ts from PR #5774 (in flight; becomes no-op merge when #5774 lands). Co-Authored-By: Claude Opus 4.7 --- tools/workflow-engine/world-hierarchy.test.ts | 142 +++++++++++ tools/workflow-engine/world-hierarchy.ts | 230 ++++++++++++++++++ 2 files changed, 372 insertions(+) create mode 100644 tools/workflow-engine/world-hierarchy.test.ts create mode 100644 tools/workflow-engine/world-hierarchy.ts diff --git a/tools/workflow-engine/world-hierarchy.test.ts b/tools/workflow-engine/world-hierarchy.test.ts new file mode 100644 index 0000000000..ef534c9bed --- /dev/null +++ b/tools/workflow-engine/world-hierarchy.test.ts @@ -0,0 +1,142 @@ +// Invariant tests for world-hierarchy substrate (Aaron 2026-05-28). + +import { describe, test, expect } from "bun:test"; +import { + type HierarchicalWorld, + type SubstrateAlgebra, + OPEN_QUESTION_DBSP_CLIFFORD, + parentOf, + depthOf, + inheritsFrom, + verifyHierarchy, + annotateHierarchy, +} from "./world-hierarchy.js"; +import { EMPTY_WORLD } from "./world.js"; + +describe("substrate-algebra parentOf chain", () => { + test("clifford has no parent (root)", () => { + expect(parentOf("clifford")).toBeNull(); + }); + test("dbsp inherits from clifford", () => { + expect(parentOf("dbsp")).toBe("clifford"); + }); + test("git inherits from dbsp", () => { + expect(parentOf("git")).toBe("dbsp"); + }); + test("git-forge inherits from git", () => { + expect(parentOf("git-forge")).toBe("git"); + }); +}); + +describe("depthOf mapping", () => { + test("clifford = 0", () => expect(depthOf("clifford")).toBe(0)); + test("dbsp = 1", () => expect(depthOf("dbsp")).toBe(1)); + test("git = 2", () => expect(depthOf("git")).toBe(2)); + test("git-forge = 3", () => expect(depthOf("git-forge")).toBe(3)); +}); + +describe("inheritsFrom IS-A relation", () => { + test("reflexive: everything is-a itself", () => { + const all: SubstrateAlgebra[] = ["clifford", "dbsp", "git", "git-forge"]; + for (const a of all) { + expect(inheritsFrom(a, a)).toBe(true); + } + }); + test("git-forge is-a git is-a dbsp is-a clifford", () => { + expect(inheritsFrom("git-forge", "git")).toBe(true); + expect(inheritsFrom("git-forge", "dbsp")).toBe(true); + expect(inheritsFrom("git-forge", "clifford")).toBe(true); + }); + test("git is-a dbsp is-a clifford (no forge)", () => { + expect(inheritsFrom("git", "dbsp")).toBe(true); + expect(inheritsFrom("git", "clifford")).toBe(true); + expect(inheritsFrom("git", "git-forge")).toBe(false); + }); + test("dbsp is-a clifford (not git, not git-forge)", () => { + expect(inheritsFrom("dbsp", "clifford")).toBe(true); + expect(inheritsFrom("dbsp", "git")).toBe(false); + expect(inheritsFrom("dbsp", "git-forge")).toBe(false); + }); + test("clifford only is-a itself (root)", () => { + expect(inheritsFrom("clifford", "dbsp")).toBe(false); + expect(inheritsFrom("clifford", "git")).toBe(false); + expect(inheritsFrom("clifford", "git-forge")).toBe(false); + }); +}); + +describe("annotateHierarchy", () => { + test("annotates with correct algebra + depth + parent", () => { + const annotated = annotateHierarchy(EMPTY_WORLD, "git"); + expect(annotated.substrateAlgebra).toBe("git"); + expect(annotated.hierarchyDepth).toBe(2); + expect(annotated.parentAlgebra).toBe("dbsp"); + }); + test("annotates clifford root correctly (parent null)", () => { + const annotated = annotateHierarchy(EMPTY_WORLD, "clifford"); + expect(annotated.substrateAlgebra).toBe("clifford"); + expect(annotated.hierarchyDepth).toBe(0); + expect(annotated.parentAlgebra).toBeNull(); + }); +}); + +describe("verifyHierarchy", () => { + test("accepts well-formed hierarchical world", () => { + const world: HierarchicalWorld = { + ...EMPTY_WORLD, + substrateAlgebra: "git-forge", + hierarchyDepth: 3, + parentAlgebra: "git", + }; + const result = verifyHierarchy(world); + expect(result.ok).toBe(true); + }); + test("rejects depth-mismatch", () => { + const world: HierarchicalWorld = { + ...EMPTY_WORLD, + substrateAlgebra: "git", + hierarchyDepth: 0, // wrong; should be 2 + parentAlgebra: "dbsp", + }; + const result = verifyHierarchy(world); + expect(result.ok).toBe(false); + if (!result.ok) { + expect(result.feedback.kind).toBe("DepthMismatch"); + } + }); + test("rejects wrong-parent", () => { + const world: HierarchicalWorld = { + ...EMPTY_WORLD, + substrateAlgebra: "git", + hierarchyDepth: 2, + parentAlgebra: "clifford", // wrong; should be dbsp + }; + const result = verifyHierarchy(world); + expect(result.ok).toBe(false); + if (!result.ok) { + expect(result.feedback.kind).toBe("MissingIntermediateLayer"); + } + }); +}); + +describe("open-question substrate preservation (don't-collapse discipline)", () => { + test("OPEN_QUESTION_DBSP_CLIFFORD preserves both readings", () => { + expect(OPEN_QUESTION_DBSP_CLIFFORD.kind).toBe("open-question"); + if (OPEN_QUESTION_DBSP_CLIFFORD.kind === "open-question") { + expect(OPEN_QUESTION_DBSP_CLIFFORD.preservedReadings.length).toBe(2); + // Both readings preserved verbatim per default-to-both + expect(OPEN_QUESTION_DBSP_CLIFFORD.preservedReadings[0]).toContain("strict-subset"); + expect(OPEN_QUESTION_DBSP_CLIFFORD.preservedReadings[1]).toContain("fully isomorphic"); + } + }); +}); + +describe("substrate-engineering composition (end-to-end)", () => { + test("annotate + verify + inheritance chain query", () => { + const githubWorld = annotateHierarchy(EMPTY_WORLD, "git-forge"); + const verified = verifyHierarchy(githubWorld); + expect(verified.ok).toBe(true); + expect(inheritsFrom(githubWorld.substrateAlgebra, "clifford")).toBe(true); + expect(inheritsFrom(githubWorld.substrateAlgebra, "dbsp")).toBe(true); + expect(inheritsFrom(githubWorld.substrateAlgebra, "git")).toBe(true); + }); +}); diff --git a/tools/workflow-engine/world-hierarchy.ts b/tools/workflow-engine/world-hierarchy.ts new file mode 100644 index 0000000000..f39460dc0b --- /dev/null +++ b/tools/workflow-engine/world-hierarchy.ts @@ -0,0 +1,230 @@ +// World hierarchy — substrate-naming substrate (Aaron 2026-05-28). +// +// Aaron 2026-05-28: "Git inherits from restricted clifford, or maybe it's +// fully isomorphic but it's basically DBSP and so we have DBSP and Clifford +// worlds with one be connonical i'm voting for clifford once we have it" +// +// Inheritance hierarchy (Aaron-vote: Clifford canonical once shipped): +// +// CliffordWorld (canonical; geometric-algebra substrate; Aaron-voted) +// ↓ restricted to incremental-dataflow + retraction substrate +// DBSPWorld (Budiu et al VLDB 2023; differential-dataflow + stream substrate) +// ↓ restricted to tree-state + commit-graph + ref substrate +// GitWorld (operational substrate; tools/workflow-engine/git-world.ts) +// ↓ specialized by forge +// GitHubWorld / GitLabWorld / GiteaWorld / BitbucketWorld / ... +// +// Substrate-engineering open question Aaron flagged (preserve per default-to-both): +// (A) Git ⊂ DBSP ⊂ Clifford (strict subset chain; each restricts upward substrate) +// (B) DBSP ↔ Clifford fully isomorphic (both algebraic substrates supporting +// increments + retractions); Git ⊂ both equivalently +// +// Both readings hold until the algebraic-substrate work resolves it. +// Composes with B-0635 wave-particle duality + B-0666 English-as-projection +// + multiple Kestrel ferries naming Clifford as canonical substrate-engineering +// substrate. +// +// This file ships the NAMING substrate. CliffordWorld + DBSPWorld +// implementations are substrate-engineering substrate-engineering targets +// (B-NNNN follow-up rows). GitWorld + GitHubWorld already shipped. + +import type { World } from "./world.js"; + +// ─────────────────────────────────────────────────────────────────────── +// Substrate-naming substrate — inheritance hierarchy markers +// ─────────────────────────────────────────────────────────────────────── + +/** + * Substrate-algebra identifier — names which algebraic substrate a World + * inherits from. Worlds at any level of the hierarchy carry this marker + * so downstream substrate can verify composition compatibility. + * + * The vote per Aaron 2026-05-28: "clifford" canonical once shipped. + */ +export type SubstrateAlgebra = + | "clifford" // Canonical (Aaron-vote; once shipped) + | "dbsp" // Restricted-or-isomorphic to Clifford (open question) + | "git" // Restricted to tree/commit/ref substrate + | "git-forge"; // Forge-specialization (GitHub/GitLab/etc.) + +/** + * Hierarchy depth — substrate-engineering substrate marker for which + * abstraction layer a World substrate operates at. + * + * 0 = Clifford (most general; canonical-vote) + * 1 = DBSP (restricted-or-isomorphic to Clifford) + * 2 = Git (restricted to tree/commit/ref) + * 3 = Forge-specialization (GitHub/GitLab/etc.) + */ +export type HierarchyDepth = 0 | 1 | 2 | 3; + +/** + * Substrate-naming substrate that any World carrying this marker advertises + * its position in the Clifford → DBSP → Git → GitHubWorld hierarchy. + * + * Downstream substrate uses this to: + * - Verify composition compatibility (compose only with equal-or-more-general substrate) + * - Route operations to the most-restricted substrate that can handle them + * - Detect when substrate-engineering substrate is missing an intermediate layer + */ +export interface HierarchicalWorld extends World { + readonly substrateAlgebra: SubstrateAlgebra; + readonly hierarchyDepth: HierarchyDepth; + /** + * If this world is a specialization, names the parent substrate-algebra. + * GitHubWorld.parentAlgebra = "git"; GitWorld.parentAlgebra = "dbsp"; + * DBSPWorld.parentAlgebra = "clifford"; CliffordWorld.parentAlgebra = null. + */ + readonly parentAlgebra: SubstrateAlgebra | null; +} + +/** + * The open substrate-engineering question Aaron 2026-05-28 flagged: + * is DBSP a strict restriction of Clifford, or are they fully isomorphic? + * + * Preserved as substrate (not collapsed) until the algebraic work resolves + * it. Per default-to-both: both readings hold; the resolution will be + * substrate-engineering output of the canonical-algebra implementation work. + */ +export type DBSPCliffordRelationship = + | { kind: "strict-restriction"; rationale: string } + | { kind: "fully-isomorphic"; rationale: string } + | { kind: "open-question"; preservedReadings: ReadonlyArray }; + +export const OPEN_QUESTION_DBSP_CLIFFORD: DBSPCliffordRelationship = { + kind: "open-question", + preservedReadings: [ + "(A) Git ⊂ DBSP ⊂ Clifford strict-subset chain; each restricts upward substrate", + "(B) DBSP ↔ Clifford fully isomorphic; both algebraic substrates supporting increments + retractions; Git ⊂ both equivalently", + ], +}; + +// ─────────────────────────────────────────────────────────────────────── +// Inheritance verification — substrate-engineering composition guard +// ─────────────────────────────────────────────────────────────────────── + +/** + * Substrate-engineering feedback (asymmetric-authorship per + * .claude/rules/asymmetric-authorship-substrate-entity-defines-consent-channel-recipient-acknowledges.md). + */ +export type HierarchyFeedback = + | { kind: "IncompatibleSubstrate"; required: SubstrateAlgebra; actual: SubstrateAlgebra } + | { kind: "MissingIntermediateLayer"; expectedParent: SubstrateAlgebra; actualParent: SubstrateAlgebra | null } + | { kind: "DepthMismatch"; expected: HierarchyDepth; actual: HierarchyDepth }; + +export type HierarchyResult = + | { ok: true; value: T } + | { ok: false; feedback: HierarchyFeedback }; + +/** + * Parent algebra for any substrate (substrate-engineering inheritance chain). + * Returns null at the root (Clifford). + */ +export function parentOf(algebra: SubstrateAlgebra): SubstrateAlgebra | null { + switch (algebra) { + case "clifford": return null; + case "dbsp": return "clifford"; + case "git": return "dbsp"; + case "git-forge": return "git"; + } +} + +/** + * Depth for any substrate-algebra (compile-time-stable mapping). + */ +export function depthOf(algebra: SubstrateAlgebra): HierarchyDepth { + switch (algebra) { + case "clifford": return 0; + case "dbsp": return 1; + case "git": return 2; + case "git-forge": return 3; + } +} + +/** + * Check whether `candidate` is a descendant of (or equal to) `ancestor`. + * GitHubWorld (git-forge) IS-A GitWorld (git) IS-A DBSPWorld (dbsp) IS-A + * CliffordWorld (clifford). The IS-A relation is reflexive (anything is a + * descendant of itself). + */ +export function inheritsFrom(candidate: SubstrateAlgebra, ancestor: SubstrateAlgebra): boolean { + let cur: SubstrateAlgebra | null = candidate; + while (cur !== null) { + if (cur === ancestor) return true; + cur = parentOf(cur); + } + return false; +} + +/** + * Verify a HierarchicalWorld's substrate-engineering metadata is internally + * consistent (algebra matches depth + parent matches expected chain). + */ +export function verifyHierarchy(world: HierarchicalWorld): HierarchyResult { + const expectedDepth = depthOf(world.substrateAlgebra); + if (world.hierarchyDepth !== expectedDepth) { + return { ok: false, feedback: { kind: "DepthMismatch", expected: expectedDepth, actual: world.hierarchyDepth } }; + } + const expectedParent = parentOf(world.substrateAlgebra); + if (world.parentAlgebra !== expectedParent) { + return { ok: false, feedback: { kind: "MissingIntermediateLayer", expectedParent: expectedParent ?? "clifford", actualParent: world.parentAlgebra } }; + } + return { ok: true, value: world }; +} + +/** + * Annotate any World with hierarchy substrate. Use at construction time + * for GitWorld / GitHubWorld / future DBSPWorld + CliffordWorld substrates. + */ +export function annotateHierarchy(world: W, algebra: SubstrateAlgebra): W & HierarchicalWorld { + return { + ...world, + substrateAlgebra: algebra, + hierarchyDepth: depthOf(algebra), + parentAlgebra: parentOf(algebra), + }; +} + +// ─────────────────────────────────────────────────────────────────────── +// Future substrate-engineering targets (placeholders preserving naming) +// ─────────────────────────────────────────────────────────────────────── + +/** + * CliffordWorld — canonical substrate per Aaron 2026-05-28 vote. + * + * NOT YET IMPLEMENTED. Substrate-engineering substrate-engineering target. + * Composes with B-0635 wave-particle duality (Clifford multivector substrate) + * + B-0666 English-as-projection + multiple Kestrel ferry preservations. + * + * When shipped: geometric-algebra substrate (multivector + grade-projection + * + geometric-product) IS the canonical world substrate; DBSPWorld is a + * restriction-or-isomorphic-view; GitWorld is a deeper restriction. + * + * Marker interface only — actual substrate-engineering follow-up row. + */ +export interface CliffordWorldPlaceholder extends HierarchicalWorld { + readonly substrateAlgebra: "clifford"; + readonly hierarchyDepth: 0; + readonly parentAlgebra: null; +} + +/** + * DBSPWorld — Differential Bigraph Stream Processing substrate (Budiu et al + * VLDB 2023). Restriction-or-isomorphic-view of CliffordWorld (open question + * per OPEN_QUESTION_DBSP_CLIFFORD). + * + * NOT YET IMPLEMENTED. Substrate-engineering substrate-engineering target. + * Composes with framework's incremental-view-maintenance + retraction-native + * substrate (Result + monad-propagation pattern). + * + * When shipped: differential-dataflow substrate (Z-set + circuit + delta- + * incremental computation) IS the formal substrate; GitWorld is a deeper + * restriction (tree-state + commit-graph + ref operations). + * + * Marker interface only — actual substrate-engineering follow-up row. + */ +export interface DBSPWorldPlaceholder extends HierarchicalWorld { + readonly substrateAlgebra: "dbsp"; + readonly hierarchyDepth: 1; + readonly parentAlgebra: "clifford"; +} From dcddf631a16516d1d0f57c3c17bba129632e527a Mon Sep 17 00:00:00 2001 From: Lior Date: Thu, 28 May 2026 07:40:27 -0400 Subject: [PATCH 3/8] feat(B-0915 + world-hierarchy): CliffordWorld impl target (System.Numerics SIMD + LINQ GPU-accelerated) + Aaron-vote ordering on OPEN_QUESTION_DBSP_CLIFFORD + Fauser Clifford-Hopf-gebra antipode-as-retraction substrate-engineering substrate found in-conversation; 23 tests pass MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per Aaron 2026-05-28 multi-turn substrate-engineering substrate: Turn 1: "1 first 2 2nd would be great also can we make clifford impliment dotnet numerics? or impliment linq so we have hardware/gpu accelerated linq?" → Vote ordering [0, 1] on OPEN_QUESTION_DBSP_CLIFFORD ((A) primary, (B) secondary) → B-0915 CliffordWorld impl target: System.Numerics SIMD + LINQ GPU-accel Turn 2: "What i think we might have found a paper or something about retraction in clifford so the isomorphic might be easy" → Substrate-engineering substrate signal that (B) fully-isomorphic reading may have constructive proof path Turn 3 (asked): "did you see anything in substrate?" Turn 4 (asked): "or the web?" → In-conversation substrate hunt; found both in-repo AND web substrate What this adds: 1. tools/workflow-engine/world-hierarchy.ts updates: - voteOrdering field on DBSPCliffordRelationship.open-question variant - OPEN_QUESTION_DBSP_CLIFFORD records Aaron's [0, 1] vote - Inline comment naming the paper-hint substrate - primaryWorkingHypothesis() helper extracting Aaron-vote primary 2. tools/workflow-engine/world-hierarchy.test.ts (3 new tests): - vote ordering records Aaron's "1 first 2 2nd" - primaryWorkingHypothesis returns strict-subset (Aaron-vote (A)) - primaryWorkingHypothesis returns null for non-open-question - 23 tests total (20 prior + 3 new); all pass 3. docs/backlog/P2/B-0915-*.md — CliffordWorld impl target: - Slice A: CliffordWorld base substrate over System.Numerics (multivector + geometric product + grade-projection) - Slice B: LINQ provider over CliffordWorld (IQueryable lowered to SIMD CPU + GPU kernel paths; ILGPU prior-art reference) - Slice C: TS workflow-engine substrate calls dotnet via process-isolation - Slice D: Resolution of OPEN_QUESTION_DBSP_CLIFFORD with substrate- engineering-found antipode-as-retraction substrate (Slice D.0 paper hunt COMPLETED in-conversation; Slice D.1 Z-set ↔ Hopf antipode construction; Slice D.2 invariance proof; Slice D.3 vote flip if proof holds) - Optional Slice E: GPU kernel path (ILGPU or custom) Substrate-engineering substrate found in-conversation (Slice D.0 partial): In-repo (TODAY's Amara ferry, B-0897/B-0898/B-0900 cluster): - Amara already lays down stack composition: "Z-set = retraction-native evidence / Infer.NET = belief propagation / Clifford = oriented geometry / rotors / commitments / trajectories / Workflow circuit = time-ordered graph" - Composes with B-0895 Clifford grade-decomposition + B-0896 categorical-Clifford bridge + B-0897 Persist-as-bridge + B-0898 Measure-as-bridge + B-0900 Bell-like distributed-cluster contextuality - Earlier 2026-05-12 Ani Clifford first-principles substrate Web (Fauser/Ablamowicz Clifford Hopf-gebra papers): - Fauser & Ablamowicz, "Clifford Hopf-gebra and Bi-universal Hopf-gebra" (arxiv q-alg/9709016) - Fauser, "Clifford Hopf gebra for two-dimensional space" (arxiv math/0011263) - Hopf antipode S satisfies m ∘ (S ⊗ id) ∘ Δ = ε·1 — cancellation by inversion = retraction substrate - Constructive isomorphism path: DBSP Z-set retraction ↔ signed multiset cancellation ↔ Hopf antipode ↔ Clifford Hopf-gebra antipode structure Substrate-honest disposition: EVIDENCE-FOR not PROOF-OF the (B) fully-isomorphic reading. Paper-reading + constructive isomorphism implementation still required per don't-collapse discipline. Slice D.1 becomes "implement the antipode map" rather than "discover what retraction means in Clifford." Vote ordering stays [0, 1] until implementation proves the isomorphism constructive; if proven, flips to [1, 0] and collapses to kind: "fully-isomorphic". Composes with substrate: - PR #5776 world-hierarchy substrate (cherry-picked dep) - PR #5775 git-world.ts (sibling at git-layer of hierarchy) - PR #5709 Amara ferry today (B-0897 Persist-as-bridge + stack composition) - B-0428 F# fork for AI safety (composes at language-runtime layer) - B-0635 wave-particle duality (Clifford multivector substrate) - B-0666 English-as-projection (I(D(x))=x identity) - B-0895 Clifford grade-decomposition - B-0896 categorical-Clifford bridge - B-0897 Persist-as-bridge - B-0898 Measure-as-bridge - B-0900 Bell-like distributed-cluster contextuality - dotnet/runtime (System.Numerics + Tensors) - ILGPU (LINQ-style C# → GPU) - dotnet/infer (Microsoft Infer.NET prior-art) Cherry-picked world.ts (PR #5774) + world-hierarchy.ts (PR #5776) as dependencies; resolves cleanly when those merge first. Co-Authored-By: Claude Opus 4.7 --- ...-engineering-substrate-aaron-2026-05-28.md | 237 ++++++++++++++++++ tools/workflow-engine/world-hierarchy.test.ts | 14 ++ tools/workflow-engine/world-hierarchy.ts | 38 ++- 3 files changed, 288 insertions(+), 1 deletion(-) create mode 100644 docs/backlog/P2/B-0915-clifford-world-impl-target-dotnet-numerics-simd-plus-linq-gpu-accelerated-substrate-engineering-substrate-aaron-2026-05-28.md diff --git a/docs/backlog/P2/B-0915-clifford-world-impl-target-dotnet-numerics-simd-plus-linq-gpu-accelerated-substrate-engineering-substrate-aaron-2026-05-28.md b/docs/backlog/P2/B-0915-clifford-world-impl-target-dotnet-numerics-simd-plus-linq-gpu-accelerated-substrate-engineering-substrate-aaron-2026-05-28.md new file mode 100644 index 0000000000..c63962389b --- /dev/null +++ b/docs/backlog/P2/B-0915-clifford-world-impl-target-dotnet-numerics-simd-plus-linq-gpu-accelerated-substrate-engineering-substrate-aaron-2026-05-28.md @@ -0,0 +1,237 @@ +--- +id: B-0915 +title: CliffordWorld impl target — System.Numerics SIMD + LINQ hardware/GPU-accelerated substrate-engineering substrate (Aaron 2026-05-28) +status: open +priority: P2 +created: 2026-05-28 +authors: [aaron, otto] +composes_with: + - B-0914 # parent decomposition (7-candidate substrate-engineering gap) + - B-0428 # F# fork for AI safety (composes at language-runtime layer) + - B-0635 # wave-particle duality (Clifford multivector substrate) + - B-0666 # English-as-projection (I(D(x))=x identity) + - B-0644 # Limit-as-simulation (pre-collapse substrate) +depends_on: + - tools/workflow-engine/world-hierarchy.ts # OPEN_QUESTION_DBSP_CLIFFORD + Aaron-vote ordering +upstream_references: + - dotnet/runtime (System.Numerics, System.Numerics.Tensors, System.Runtime.Intrinsics) + - SixLabors/ImageSharp (production SIMD substrate) + - ILGPU (LINQ-style C# → GPU compilation; CUDA/OpenCL/CPU backends) + - dotnet/infer (Microsoft Infer.NET; symbolic-probabilistic Bayesian substrate) +--- + +## Aaron's substrate-engineering substrate (2026-05-28 verbatim) + +> *"1 first 2 2nd would be great also can we make clifford impliment dotnet +> numerics? or impliment linq so we have hardware/gpu accelerated linq?"* + +Substrate-engineering substrate decomposition: + +1. **Vote ordering on `OPEN_QUESTION_DBSP_CLIFFORD`**: (A) strict-subset chain + `Git ⊂ DBSP ⊂ Clifford` is the **primary working hypothesis**; (B) fully- + isomorphic `DBSP ↔ Clifford` is the **secondary fallback**. Substrate- + engineering work starts with (A); falls to (B) if/when algebraic-substrate + work proves them equivalent. + +2. **CliffordWorld implementation built on `System.Numerics`**: leverage + dotnet's hardware-accelerated SIMD substrate as the multivector backing + store. Avoids reinventing SIMD primitives + automatically gets AVX512 / + NEON / WASM-SIMD per-host acceleration. + +3. **LINQ hardware/GPU-accelerated provider**: ship CliffordWorld as an + `IQueryable` backend that lowers expression trees to GPU kernels + (ILGPU-style or custom). LINQ-over-Clifford gives us composable + geometric-algebra queries with hardware acceleration for free. + +## Why this matters (substrate-engineering load-bearing properties) + +- **Hardware acceleration without reinvention**: System.Numerics ships with + every .NET runtime; SIMD intrinsics are battle-tested + already JIT- + optimized per host architecture +- **Composability**: LINQ expression trees ARE substrate-engineering + substrate; lowering to GPU kernels gives composability for free +- **Cross-substrate triangulation**: composes with B-0428 F# fork (real HKT + over Clifford planned); both layers benefit from shared SIMD/GPU substrate +- **dotnet/infer as prior-art proof-point**: Microsoft already ships symbolic- + probabilistic Bayesian substrate in .NET; CliffordWorld would extend the + pattern to geometric-algebra substrate +- **Composes with monad-propagation pattern**: `Result` + flows through LINQ chains via `Result.bind` per substrate-smoothness rule + +## Substrate-engineering targets (sliced; not yet decomposed) + +### Slice A — CliffordWorld base substrate over System.Numerics + +- Multivector type backed by `Vector` or `Vector` +- Grade-projection ops (scalar / vector / bivector / trivector ... grade-n) +- Geometric product (canonical operation; SIMD-accelerated) +- Outer product (wedge ∧) + inner product (·) as derived ops +- Reverse + conjugation + grade-involution operators +- Verify against existing Clifford prior-art (algebra-owner skill substrate; + Q# Pauli operators substrate; CAN/GCAN equivariant layers prior-art) + +### Slice B — LINQ provider over CliffordWorld + +- `IQueryable` backend +- Expression-tree lowering to: + - CPU SIMD path (System.Numerics) + - GPU kernel path (ILGPU or custom CUDA/OpenCL) + - Pure-CPU fallback for portability +- LINQ ops: Where + Select + GroupBy + Aggregate + Zip (composes naturally + with multivector algebra) +- Per substrate-smoothness: no if-statements crack the monad-shape; failure + variants in `CliffordLinqFeedback` DU + +### Slice C — Composes with TS workflow-engine substrate + +- TS `world-hierarchy.ts` already names `CliffordWorldPlaceholder` interface +- Slice A + B ship in F# / C# (dotnet-native); TS substrate calls into dotnet + via process-isolation (`bun spawn` or HTTP) +- Cross-language Result per monad-propagation-pattern rule + +### Slice D — Resolution of `OPEN_QUESTION_DBSP_CLIFFORD` + +- Once CliffordWorld substrate exists, prove or refute equivalence to DBSP +- Update `OPEN_QUESTION_DBSP_CLIFFORD` to `kind: "strict-restriction"` OR + `kind: "fully-isomorphic"` based on algebraic-substrate evidence +- This is substrate-engineering output, not arbitrary choice — the answer + emerges from the implementation work + +**Aaron 2026-05-28 paper-hint substrate** (preserve don't-collapse-yet): + +> *"What i think we might have found a paper or something about retraction +> in clifford so the isomorphic might be easy"* + +**Substrate-engineering substrate FOUND (in-conversation grep + WebSearch +2026-05-28; Aaron asked "did you see anything in substrate?" / "or the web?"):** + +In-repo substrate (TODAY's Amara ferry; PR #5709, B-0897/B-0898/B-0900): + +- `memory/persona/amara/conversations/2026-05-28-amara-measure-as-bridge-infer-net-belief-update-casimir-like-review-walls-bell-contextuality-distributed-clusters-aaron-forwarded.md` + lays down stack composition: *"Z-set = retraction-native evidence / + Infer.NET = belief propagation / Clifford = oriented geometry / rotors + / commitments / trajectories / Workflow circuit = time-ordered graph"* +- Composes with B-0895 (Clifford grade-decomposition) + B-0896 + (categorical-Clifford bridge) + B-0897 (Persist-as-bridge) + B-0898 + (Measure-as-bridge) + B-0900 (Bell-like distributed-cluster + contextuality test) +- `memory/persona/ani/conversations/2026-05-12-aaron-ani-clifford-first-principles-self-reflection.md` + earlier Clifford first-principles substrate + +Web (papers Aaron's hint was likely pointing at): + +- **Fauser & Ablamowicz, "Clifford Hopf-gebra and Bi-universal Hopf-gebra"** + (arxiv q-alg/9709016): Clifford algebra + bialgebra + antipode = Clifford + Hopf-gebra. The Hopf antipode `S` satisfies `m ∘ (S ⊗ id) ∘ Δ = ε·1` — + literally "cancellation by inversion." That IS the algebraic substrate + for retraction. +- **Fauser, "Clifford Hopf gebra for two-dimensional space"** (arxiv + math/0011263): concrete construction. + +Constructive isomorphism path becomes: + +``` +DBSP Z-set retraction + ↔ signed multiset cancellation (m, -m cancels) + ↔ Hopf antipode (formal inverse: m ∘ (S ⊗ id) ∘ Δ = ε·1) + ↔ Clifford Hopf-gebra antipode structure +``` + +**Substrate-honest framing**: this is EVIDENCE-FOR not PROOF-OF the +(B) fully-isomorphic reading. Paper-reading + constructive +isomorphism implementation still required. But the substrate-engineering +question "what does retraction mean in Clifford?" has an answer in +existing literature (Hopf antipode); Slice D.1 becomes "implement the +antipode map" rather than "discover what retraction means in Clifford." + +If antipode-map implementation succeeds, vote ordering flips to `[1, 0]` +and `OPEN_QUESTION_DBSP_CLIFFORD` collapses to `kind: "fully-isomorphic"` +with constructive proof as rationale. + +If a retraction-in-Clifford paper exists + maps to DBSP's Z-set retraction +substrate, **the (B) fully-isomorphic reading becomes constructive** and +the vote ordering may flip from `[0, 1]` to `[1, 0]`. Substrate-engineering +target additions: + +- **Slice D.0 — Paper hunt**: WebSearch + arxiv search + Aaron's bookmark + history for "retraction Clifford algebra" / "Clifford retraction + semigroup" / "geometric algebra retraction" / "Clifford bialgebra" / + similar terms. Preserve verbatim per substrate-or-it-didn't-happen. +- **Slice D.1 — Z-set ↔ Clifford-retraction map**: if paper exists, + construct the constructive isomorphism between DBSP Z-set substrate + (positive + negative integer multiplicities representing retractions) + and Clifford's retraction substrate (whatever shape the paper provides). +- **Slice D.2 — Verify isomorphism via algebraic-substrate work**: prove + the map preserves the operations of interest (geometric product ↔ + Z-set composition; grade-projection ↔ Z-set filtering; etc.) +- **Slice D.3 — Flip vote ordering if proof holds**: update + `OPEN_QUESTION_DBSP_CLIFFORD.voteOrdering` to `[1, 0]` AND/OR collapse + to `kind: "fully-isomorphic"` with the constructive proof as rationale. + +Substrate-honest framing: paper-hint is INPUT to substrate-engineering +work, not premature collapse. Per don't-collapse + razor-discipline: +"might be easy" stays as "might" until the paper is found + reading is +done + the isomorphism is constructive. If the paper turns out not to +exist OR not to construct the isomorphism, the vote ordering stays +[0, 1] and Slice D continues as originally framed. + +## Composes with + +- `.claude/rules/monad-propagation-pattern-cross-language-substrate-shape.md` + (cross-language Result shape) +- `.claude/rules/asymmetric-authorship-substrate-entity-defines-consent-channel-recipient-acknowledges.md` + (CliffordFeedback variants substrate-entity-authored) +- `.claude/rules/substrate-smoothness-as-load-bearing-property.md` + (no if-statements; DU + exhaustive switch) +- `.claude/rules/ople-primitives-surface-t-and-tfeedback-not-just-t-asymmetric-authorship-at-framework-primitive-scope.md` + (CliffordWorld primitives surface T + TFeedback per OPLE) +- `.claude/rules/default-to-both.md` (Slice D resolution preserves both readings + until algebraic substrate refutes one) +- `.claude/rules/fsharp-anchor-dotnet-build-sanity-check.md` (dotnet build IS + the sanity check for the type-level Clifford substrate) +- `.claude/rules/bandwidth-served-falsifier.md` (hardware acceleration earns + its keep via SIMD/GPU bandwidth) +- PR #5776 world-hierarchy substrate (Aaron 2026-05-28 vote ordering) +- PR #5775 git-world substrate (GitWorld + GitHubWorld; sibling specialization + at the git-layer of the hierarchy) +- B-0428 F# fork for AI safety (composes at language-runtime substrate-engineering layer) + +## Acceptance criteria + +- [ ] Slice A: CliffordWorld base substrate ships with System.Numerics-backed + multivector + geometric-product + grade-projection (F# or C#); dotnet + build clean; unit tests covering identity / inverse / associativity / + distributivity invariants +- [ ] Slice B: LINQ provider lowers to SIMD CPU path; benchmark vs naive + implementation shows hardware acceleration; expression-tree introspection + tests pass +- [ ] Slice C: TS workflow-engine substrate calls into dotnet CliffordWorld + via process-isolation; Result propagates across language + boundary +- [ ] Slice D: `OPEN_QUESTION_DBSP_CLIFFORD` resolved (or substrate-honest + "still open after N substrate-engineering rounds; preserve as substrate") +- [ ] Optional Slice E: GPU kernel path (ILGPU or custom) shipped if hardware + access available; CPU SIMD path remains canonical fallback + +## Substrate-honest framing + +This row is **substrate-engineering substrate-naming substrate** — names the +implementation target + slices it for future work. Does NOT commit to specific +timeline, language choice (F# vs C# slice A), or GPU vendor (CUDA vs OpenCL +vs Vulkan-compute). + +Per `.claude/rules/proud-if-pattern-propagates-personal-filter-for-substrate-engineering.md`: +would the operator be proud if CliffordWorld + System.Numerics + LINQ- +accelerated propagated as the canonical geometric-algebra substrate-engineering +pattern at scale? **Yes** — hardware acceleration via standard runtime +primitives + LINQ-as-composable-substrate is exactly the additive multiplication +shape the framework substrate-engineers toward. + +## Reference substrate (already in upstream watchlist) + +- **dotnet/infer** (Microsoft Infer.NET; symbolic-probabilistic Bayesian + substrate; demonstrates dotnet-native probabilistic-programming substrate) +- **dotnet/runtime** (System.Numerics + System.Numerics.Tensors source) +- **ILGPU** (LINQ-style C# → GPU lowering; existing prior-art for slice B) +- **SixLabors/ImageSharp** (production SIMD substrate via System.Numerics; + reference for slice A integration patterns) diff --git a/tools/workflow-engine/world-hierarchy.test.ts b/tools/workflow-engine/world-hierarchy.test.ts index ef534c9bed..3d8ecbdbf4 100644 --- a/tools/workflow-engine/world-hierarchy.test.ts +++ b/tools/workflow-engine/world-hierarchy.test.ts @@ -10,6 +10,7 @@ import { inheritsFrom, verifyHierarchy, annotateHierarchy, + primaryWorkingHypothesis, } from "./world-hierarchy.js"; import { EMPTY_WORLD } from "./world.js"; @@ -128,6 +129,19 @@ describe("open-question substrate preservation (don't-collapse discipline)", () expect(OPEN_QUESTION_DBSP_CLIFFORD.preservedReadings[1]).toContain("fully isomorphic"); } }); + test("vote ordering records Aaron's '1 first 2 2nd' substrate", () => { + if (OPEN_QUESTION_DBSP_CLIFFORD.kind === "open-question") { + expect(OPEN_QUESTION_DBSP_CLIFFORD.voteOrdering).toEqual([0, 1]); + } + }); + test("primaryWorkingHypothesis returns strict-subset (Aaron-vote (A))", () => { + const primary = primaryWorkingHypothesis(OPEN_QUESTION_DBSP_CLIFFORD); + expect(primary).toContain("strict-subset"); + }); + test("primaryWorkingHypothesis returns null for non-open-question", () => { + const resolved = { kind: "strict-restriction" as const, rationale: "test" }; + expect(primaryWorkingHypothesis(resolved)).toBeNull(); + }); }); describe("substrate-engineering composition (end-to-end)", () => { diff --git a/tools/workflow-engine/world-hierarchy.ts b/tools/workflow-engine/world-hierarchy.ts index f39460dc0b..9b2c3101f6 100644 --- a/tools/workflow-engine/world-hierarchy.ts +++ b/tools/workflow-engine/world-hierarchy.ts @@ -89,7 +89,20 @@ export interface HierarchicalWorld extends World { export type DBSPCliffordRelationship = | { kind: "strict-restriction"; rationale: string } | { kind: "fully-isomorphic"; rationale: string } - | { kind: "open-question"; preservedReadings: ReadonlyArray }; + | { + kind: "open-question"; + preservedReadings: ReadonlyArray; + /** + * Aaron 2026-05-28 vote ordering ("1 first 2 2nd would be great"): + * indices into preservedReadings; primary working hypothesis is + * voteOrdering[0]; secondary fallback is voteOrdering[1]. + * + * Substrate-engineering substrate-engineering work starts with the + * primary; falls to the secondary if/when algebraic substrate proves + * them equivalent. See B-0915 for impl substrate that resolves this. + */ + voteOrdering?: ReadonlyArray; + }; export const OPEN_QUESTION_DBSP_CLIFFORD: DBSPCliffordRelationship = { kind: "open-question", @@ -97,8 +110,31 @@ export const OPEN_QUESTION_DBSP_CLIFFORD: DBSPCliffordRelationship = { "(A) Git ⊂ DBSP ⊂ Clifford strict-subset chain; each restricts upward substrate", "(B) DBSP ↔ Clifford fully isomorphic; both algebraic substrates supporting increments + retractions; Git ⊂ both equivalently", ], + // Aaron 2026-05-28: "1 first 2 2nd would be great" — (A) primary, (B) secondary fallback. + // + // SUBSTRATE-ENGINEERING UPDATE (Aaron 2026-05-28, same session, post-vote): + // "What i think we might have found a paper or something about retraction in + // clifford so the isomorphic might be easy" + // + // If a retraction-in-Clifford paper exists + maps to DBSP's Z-set retraction + // substrate, the (B) fully-isomorphic reading becomes constructive and the + // vote ordering may flip. Preserved as substrate-engineering input without + // collapsing — paper-existence verification + reading is B-0915 substrate- + // engineering work. See B-0915 Slice D acceptance criterion. + voteOrdering: [0, 1], }; +/** + * Helper to extract Aaron's primary working hypothesis from the open + * question. Returns the highest-vote reading (voteOrdering[0]) or the + * first preservedReading if no vote ordering present. + */ +export function primaryWorkingHypothesis(rel: DBSPCliffordRelationship): string | null { + if (rel.kind !== "open-question") return null; + const idx = rel.voteOrdering?.[0] ?? 0; + return rel.preservedReadings[idx] ?? null; +} + // ─────────────────────────────────────────────────────────────────────── // Inheritance verification — substrate-engineering composition guard // ─────────────────────────────────────────────────────────────────────── From 764a987b3884561e61c9a7573507423b09a0636e Mon Sep 17 00:00:00 2001 From: Lior Date: Thu, 28 May 2026 07:52:40 -0400 Subject: [PATCH 4/8] chore: regen docs/BACKLOG.md (B-0915 added by this PR) Restores generated-index drift gate to green per .claude/rules/blocked-green-ci-investigate-threads.md (autonomous-loop tick maintenance). Co-Authored-By: Claude Opus 4.7 --- docs/BACKLOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/BACKLOG.md b/docs/BACKLOG.md index b90e602778..9777d2f9c9 100644 --- a/docs/BACKLOG.md +++ b/docs/BACKLOG.md @@ -854,6 +854,7 @@ are closed (status: closed in frontmatter)._ - [ ] **[B-0888](backlog/P2/B-0888-cross-track-substrate-sync-policy-cloud-github-vs-usb-local-gitlab-intentional-divergence-vs-auto-sync-otto-pushback-2026-05-28.md)** Cross-track substrate-sync policy — cloud-GitHub vs USB-local-GitLab; intentional divergence vs auto-sync-via-push-to-both-remotes vs hybrid - [ ] **[B-0893](backlog/P2/B-0893-zetaid-v2-128-bit-structured-encoding-snowflake-ulid-family-kestrel-2026-05-28.md)** ZetaID v2 — 128-bit structured encoding (Snowflake/ULID family with timestamp + trajectory + persona + lifecycle-stage + random) - [ ] **[B-0899](backlog/P2/B-0899-casimir-like-effect-from-review-walls-changing-allowed-output-modes-testable-pressure-difference-before-after-rule-landing-amara-aaron-2026-05-28.md)** Casimir-like effect from review walls — testable pressure difference in agent-output distribution before/after rule landing +- [ ] **[B-0915](backlog/P2/B-0915-clifford-world-impl-target-dotnet-numerics-simd-plus-linq-gpu-accelerated-substrate-engineering-substrate-aaron-2026-05-28.md)** CliffordWorld impl target — System.Numerics SIMD + LINQ hardware/GPU-accelerated substrate-engineering substrate (Aaron 2026-05-28) ## P3 — convenience / deferred From 133b289dc1288a56776b890df97c5de262423bf9 Mon Sep 17 00:00:00 2001 From: Lior Date: Thu, 28 May 2026 08:01:20 -0400 Subject: [PATCH 5/8] fix(world.test): remove unused composeKey import (tsc TS6133) Autonomous-loop tick fix. Same one-line fix as PR #5774 commit 44fa6c769; applied here because this branch cherry-picked world.test.ts before the fix landed on main. Co-Authored-By: Claude Opus 4.7 --- tools/workflow-engine/world.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/workflow-engine/world.test.ts b/tools/workflow-engine/world.test.ts index ddef23e8a2..aed45ebb53 100644 --- a/tools/workflow-engine/world.test.ts +++ b/tools/workflow-engine/world.test.ts @@ -7,7 +7,6 @@ import { describe, expect, it } from "bun:test"; import { EMPTY_WORLD, - composeKey, defaultAdvanceMatrix, dispatchInWorld, lookupLifetimePair, From 4881644a83c4771d72c97ab6fe1ae7ff33722e6b Mon Sep 17 00:00:00 2001 From: Lior Date: Thu, 28 May 2026 08:52:54 -0400 Subject: [PATCH 6/8] fix(PR #5777): role-refs + DBSP correct expansion + nullable expectedParent + B-0915 frontmatter/depends_on (Copilot threads) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fifteen threads across world-hierarchy.{ts,test.ts} + B-0915 backlog row; distinct findings + duplicate-pass passes: A. Persona/first-name attributions in code surfaces (world-hierarchy.ts: 13 sites; test.ts: 2 sites; B-0915.md body: 5 sites). Bulk-replaced via perl: "Aaron 2026-05-28" → "the human maintainer (2026-05-28)"; "Aaron-vote(d)" → "operator-vote(d)"; "per Aaron" → "per the human maintainer"; "Aaron flagged" → "flagged by the human maintainer"; "Aaron's hint/bookmark" → "the human maintainer's hint/bookmark"; "Aaron asked" → "the human maintainer asked". Citation provenance preserved as parenthetical date. B. DBSP wrong expansion (line 248): "Differential Bigraph Stream Processing" → "Database Stream Processing" per README.md:1-3 canonical (Budiu et al VLDB 2023; same fix landed in #5776). C. Root-parent feedback bug (line 214 area): `expectedParent: SubstrateAlgebra` (non-nullable) + coalescing `?? "clifford"` would falsely report root-Clifford as expecting itself as parent. Made `expectedParent: SubstrateAlgebra | null` + removed coalescing + added docblock on the feedback variant explaining null semantics. Added regression test exercising malformed-Clifford carrying non-null parentAlgebra and asserting `expectedParent === null`. (Same fix landed in #5776.) D. B-0915 backlog row schema fixes: - Added required `last_updated: 2026-05-28` per `tools/backlog/README.md` schema - Added `ask: operator 2026-05-28` field (was already present as `authors:` but `ask:` is the schema-documented field) - `depends_on` was using a file path (`tools/workflow-engine/world-hierarchy.ts`) instead of B-NNNN IDs. Schema mandates B-NNNN list only. Changed to `[]` + added a "Substrate prerequisite (file-level)" prose section naming the TS file dependency + the PR #5776 substrate-engineering source for it. E. FP-class threads resolved no-op: - git-world.ts cross-reference (file exists on branch + on main via PR #5775 merge commit a853f4c32) - Outdated thread on `composeKey` unused import (the prior auto-merge tick `8ee92561b` already cleared this; thread surfaces as `isOutdated: true`) - Outdated thread on registry-matrix-not-cloned (same auto-merge tick; `isOutdated: true`) F. B-0914 cross-reference (in composes_with): B-0914 row is on `origin/main` as of commit 989ea4e68 (today's substrate cluster); no longer dangling. Thread resolves naturally. Tests: 24 pass (23 existing + 1 new root-parent regression). Autonomous-loop tick 2026-05-28T13:14Z resolution of PR #5777 BLOCKED gate (15 unresolved Copilot threads; required checks all green). Co-Authored-By: Claude --- ...-engineering-substrate-aaron-2026-05-28.md | 31 ++++++++---- tools/workflow-engine/world-hierarchy.test.ts | 29 +++++++++-- tools/workflow-engine/world-hierarchy.ts | 48 +++++++++++-------- 3 files changed, 75 insertions(+), 33 deletions(-) diff --git a/docs/backlog/P2/B-0915-clifford-world-impl-target-dotnet-numerics-simd-plus-linq-gpu-accelerated-substrate-engineering-substrate-aaron-2026-05-28.md b/docs/backlog/P2/B-0915-clifford-world-impl-target-dotnet-numerics-simd-plus-linq-gpu-accelerated-substrate-engineering-substrate-aaron-2026-05-28.md index c63962389b..c074126007 100644 --- a/docs/backlog/P2/B-0915-clifford-world-impl-target-dotnet-numerics-simd-plus-linq-gpu-accelerated-substrate-engineering-substrate-aaron-2026-05-28.md +++ b/docs/backlog/P2/B-0915-clifford-world-impl-target-dotnet-numerics-simd-plus-linq-gpu-accelerated-substrate-engineering-substrate-aaron-2026-05-28.md @@ -1,18 +1,18 @@ --- id: B-0915 -title: CliffordWorld impl target — System.Numerics SIMD + LINQ hardware/GPU-accelerated substrate-engineering substrate (Aaron 2026-05-28) +title: CliffordWorld impl target — System.Numerics SIMD + LINQ hardware/GPU-accelerated substrate-engineering substrate (the human maintainer, 2026-05-28) status: open priority: P2 created: 2026-05-28 -authors: [aaron, otto] +last_updated: 2026-05-28 +ask: operator 2026-05-28 composes_with: - B-0914 # parent decomposition (7-candidate substrate-engineering gap) - B-0428 # F# fork for AI safety (composes at language-runtime layer) - B-0635 # wave-particle duality (Clifford multivector substrate) - B-0666 # English-as-projection (I(D(x))=x identity) - B-0644 # Limit-as-simulation (pre-collapse substrate) -depends_on: - - tools/workflow-engine/world-hierarchy.ts # OPEN_QUESTION_DBSP_CLIFFORD + Aaron-vote ordering +depends_on: [] # No hard B-NNNN prerequisites. Substrate prerequisite (file-level, not row-level): tools/workflow-engine/world-hierarchy.ts (OPEN_QUESTION_DBSP_CLIFFORD + operator-vote ordering) — see "Substrate prerequisite" prose below. upstream_references: - dotnet/runtime (System.Numerics, System.Numerics.Tensors, System.Runtime.Intrinsics) - SixLabors/ImageSharp (production SIMD substrate) @@ -20,7 +20,18 @@ upstream_references: - dotnet/infer (Microsoft Infer.NET; symbolic-probabilistic Bayesian substrate) --- -## Aaron's substrate-engineering substrate (2026-05-28 verbatim) +## Substrate prerequisite (file-level) + +`depends_on` carries B-NNNN backlog IDs only (per `tools/backlog/README.md` +schema). This row's substantive prerequisite is a TS file rather than a +backlog row: `tools/workflow-engine/world-hierarchy.ts` (introduces +`OPEN_QUESTION_DBSP_CLIFFORD` substrate + the `voteOrdering` field this +impl-target consumes). The file ships via the same PR that introduces +this row + via PR #5776 (world-hierarchy substrate). When this row gets +picked up, the file must already be on `origin/main` — verify before +starting impl work. + +## Operator framing (2026-05-28 verbatim) > *"1 first 2 2nd would be great also can we make clifford impliment dotnet > numerics? or impliment linq so we have hardware/gpu accelerated linq?"* @@ -97,13 +108,13 @@ Substrate-engineering substrate decomposition: - This is substrate-engineering output, not arbitrary choice — the answer emerges from the implementation work -**Aaron 2026-05-28 paper-hint substrate** (preserve don't-collapse-yet): +**the human maintainer (2026-05-28) paper-hint substrate** (preserve don't-collapse-yet): > *"What i think we might have found a paper or something about retraction > in clifford so the isomorphic might be easy"* **Substrate-engineering substrate FOUND (in-conversation grep + WebSearch -2026-05-28; Aaron asked "did you see anything in substrate?" / "or the web?"):** +2026-05-28; the human maintainer asked "did you see anything in substrate?" / "or the web?"):** In-repo substrate (TODAY's Amara ferry; PR #5709, B-0897/B-0898/B-0900): @@ -118,7 +129,7 @@ In-repo substrate (TODAY's Amara ferry; PR #5709, B-0897/B-0898/B-0900): - `memory/persona/ani/conversations/2026-05-12-aaron-ani-clifford-first-principles-self-reflection.md` earlier Clifford first-principles substrate -Web (papers Aaron's hint was likely pointing at): +Web (papers the human maintainer's hint was likely pointing at): - **Fauser & Ablamowicz, "Clifford Hopf-gebra and Bi-universal Hopf-gebra"** (arxiv q-alg/9709016): Clifford algebra + bialgebra + antipode = Clifford @@ -153,7 +164,7 @@ substrate, **the (B) fully-isomorphic reading becomes constructive** and the vote ordering may flip from `[0, 1]` to `[1, 0]`. Substrate-engineering target additions: -- **Slice D.0 — Paper hunt**: WebSearch + arxiv search + Aaron's bookmark +- **Slice D.0 — Paper hunt**: WebSearch + arxiv search + the human maintainer's bookmark history for "retraction Clifford algebra" / "Clifford retraction semigroup" / "geometric algebra retraction" / "Clifford bialgebra" / similar terms. Preserve verbatim per substrate-or-it-didn't-happen. @@ -191,7 +202,7 @@ exist OR not to construct the isomorphism, the vote ordering stays the sanity check for the type-level Clifford substrate) - `.claude/rules/bandwidth-served-falsifier.md` (hardware acceleration earns its keep via SIMD/GPU bandwidth) -- PR #5776 world-hierarchy substrate (Aaron 2026-05-28 vote ordering) +- PR #5776 world-hierarchy substrate (the human maintainer (2026-05-28) vote ordering) - PR #5775 git-world substrate (GitWorld + GitHubWorld; sibling specialization at the git-layer of the hierarchy) - B-0428 F# fork for AI safety (composes at language-runtime substrate-engineering layer) diff --git a/tools/workflow-engine/world-hierarchy.test.ts b/tools/workflow-engine/world-hierarchy.test.ts index 3d8ecbdbf4..f0b0e4c55a 100644 --- a/tools/workflow-engine/world-hierarchy.test.ts +++ b/tools/workflow-engine/world-hierarchy.test.ts @@ -1,4 +1,5 @@ -// Invariant tests for world-hierarchy substrate (Aaron 2026-05-28). +// Invariant tests for world-hierarchy substrate (per the human maintainer, +// 2026-05-28). import { describe, test, expect } from "bun:test"; import { @@ -129,12 +130,12 @@ describe("open-question substrate preservation (don't-collapse discipline)", () expect(OPEN_QUESTION_DBSP_CLIFFORD.preservedReadings[1]).toContain("fully isomorphic"); } }); - test("vote ordering records Aaron's '1 first 2 2nd' substrate", () => { + test("vote ordering records the human maintainer's '1 first 2 2nd' substrate", () => { if (OPEN_QUESTION_DBSP_CLIFFORD.kind === "open-question") { expect(OPEN_QUESTION_DBSP_CLIFFORD.voteOrdering).toEqual([0, 1]); } }); - test("primaryWorkingHypothesis returns strict-subset (Aaron-vote (A))", () => { + test("primaryWorkingHypothesis returns strict-subset (operator-vote (A))", () => { const primary = primaryWorkingHypothesis(OPEN_QUESTION_DBSP_CLIFFORD); expect(primary).toContain("strict-subset"); }); @@ -153,4 +154,26 @@ describe("substrate-engineering composition (end-to-end)", () => { expect(inheritsFrom(githubWorld.substrateAlgebra, "dbsp")).toBe(true); expect(inheritsFrom(githubWorld.substrateAlgebra, "git")).toBe(true); }); + + test("malformed Clifford root with non-null parent → expectedParent is null (not 'clifford' coalesced)", () => { + // Regression test: a root CliffordWorld carrying a non-null + // parentAlgebra is malformed. The feedback should say + // "expected parent is null" (root has no parent), NOT + // "expected parent is clifford" (which would imply the root + // parents itself — a different, wrong, claim). + const malformedClifford: HierarchicalWorld = { + ...EMPTY_WORLD, + substrateAlgebra: "clifford", + hierarchyDepth: 0, + parentAlgebra: "dbsp", // wrong; root should have null + }; + const verified = verifyHierarchy(malformedClifford); + expect(verified.ok).toBe(false); + if (verified.ok) throw new Error("expected ok=false"); + expect(verified.feedback.kind).toBe("MissingIntermediateLayer"); + if (verified.feedback.kind !== "MissingIntermediateLayer") return; + // The root expectation IS null — not a coalesced sentinel. + expect(verified.feedback.expectedParent).toBeNull(); + expect(verified.feedback.actualParent).toBe("dbsp"); + }); }); diff --git a/tools/workflow-engine/world-hierarchy.ts b/tools/workflow-engine/world-hierarchy.ts index 9b2c3101f6..aa4cdc4463 100644 --- a/tools/workflow-engine/world-hierarchy.ts +++ b/tools/workflow-engine/world-hierarchy.ts @@ -1,12 +1,12 @@ -// World hierarchy — substrate-naming substrate (Aaron 2026-05-28). +// World hierarchy — substrate-naming substrate (the human maintainer (2026-05-28)). // -// Aaron 2026-05-28: "Git inherits from restricted clifford, or maybe it's +// the human maintainer (2026-05-28): "Git inherits from restricted clifford, or maybe it's // fully isomorphic but it's basically DBSP and so we have DBSP and Clifford // worlds with one be connonical i'm voting for clifford once we have it" // -// Inheritance hierarchy (Aaron-vote: Clifford canonical once shipped): +// Inheritance hierarchy (operator-vote: Clifford canonical once shipped): // -// CliffordWorld (canonical; geometric-algebra substrate; Aaron-voted) +// CliffordWorld (canonical; geometric-algebra substrate; operator-voted) // ↓ restricted to incremental-dataflow + retraction substrate // DBSPWorld (Budiu et al VLDB 2023; differential-dataflow + stream substrate) // ↓ restricted to tree-state + commit-graph + ref substrate @@ -14,7 +14,7 @@ // ↓ specialized by forge // GitHubWorld / GitLabWorld / GiteaWorld / BitbucketWorld / ... // -// Substrate-engineering open question Aaron flagged (preserve per default-to-both): +// Substrate-engineering open question flagged by the human maintainer (preserve per default-to-both): // (A) Git ⊂ DBSP ⊂ Clifford (strict subset chain; each restricts upward substrate) // (B) DBSP ↔ Clifford fully isomorphic (both algebraic substrates supporting // increments + retractions); Git ⊂ both equivalently @@ -39,10 +39,10 @@ import type { World } from "./world.js"; * inherits from. Worlds at any level of the hierarchy carry this marker * so downstream substrate can verify composition compatibility. * - * The vote per Aaron 2026-05-28: "clifford" canonical once shipped. + * The vote per the human maintainer (2026-05-28): "clifford" canonical once shipped. */ export type SubstrateAlgebra = - | "clifford" // Canonical (Aaron-vote; once shipped) + | "clifford" // Canonical (operator-vote; once shipped) | "dbsp" // Restricted-or-isomorphic to Clifford (open question) | "git" // Restricted to tree/commit/ref substrate | "git-forge"; // Forge-specialization (GitHub/GitLab/etc.) @@ -79,7 +79,7 @@ export interface HierarchicalWorld extends World { } /** - * The open substrate-engineering question Aaron 2026-05-28 flagged: + * The open substrate-engineering question the human maintainer (2026-05-28) flagged: * is DBSP a strict restriction of Clifford, or are they fully isomorphic? * * Preserved as substrate (not collapsed) until the algebraic work resolves @@ -93,7 +93,7 @@ export type DBSPCliffordRelationship = kind: "open-question"; preservedReadings: ReadonlyArray; /** - * Aaron 2026-05-28 vote ordering ("1 first 2 2nd would be great"): + * the human maintainer (2026-05-28) vote ordering ("1 first 2 2nd would be great"): * indices into preservedReadings; primary working hypothesis is * voteOrdering[0]; secondary fallback is voteOrdering[1]. * @@ -110,9 +110,9 @@ export const OPEN_QUESTION_DBSP_CLIFFORD: DBSPCliffordRelationship = { "(A) Git ⊂ DBSP ⊂ Clifford strict-subset chain; each restricts upward substrate", "(B) DBSP ↔ Clifford fully isomorphic; both algebraic substrates supporting increments + retractions; Git ⊂ both equivalently", ], - // Aaron 2026-05-28: "1 first 2 2nd would be great" — (A) primary, (B) secondary fallback. + // the human maintainer (2026-05-28): "1 first 2 2nd would be great" — (A) primary, (B) secondary fallback. // - // SUBSTRATE-ENGINEERING UPDATE (Aaron 2026-05-28, same session, post-vote): + // SUBSTRATE-ENGINEERING UPDATE (the human maintainer (2026-05-28), same session, post-vote): // "What i think we might have found a paper or something about retraction in // clifford so the isomorphic might be easy" // @@ -125,9 +125,9 @@ export const OPEN_QUESTION_DBSP_CLIFFORD: DBSPCliffordRelationship = { }; /** - * Helper to extract Aaron's primary working hypothesis from the open - * question. Returns the highest-vote reading (voteOrdering[0]) or the - * first preservedReading if no vote ordering present. + * Helper to extract the operator's primary working hypothesis from the + * open question. Returns the highest-vote reading (voteOrdering[0]) or + * the first preservedReading if no vote ordering present. */ export function primaryWorkingHypothesis(rel: DBSPCliffordRelationship): string | null { if (rel.kind !== "open-question") return null; @@ -145,7 +145,15 @@ export function primaryWorkingHypothesis(rel: DBSPCliffordRelationship): string */ export type HierarchyFeedback = | { kind: "IncompatibleSubstrate"; required: SubstrateAlgebra; actual: SubstrateAlgebra } - | { kind: "MissingIntermediateLayer"; expectedParent: SubstrateAlgebra; actualParent: SubstrateAlgebra | null } + /** + * Root-substrate semantics for `expectedParent: null`: this substrate + * is at the root of the hierarchy (Clifford) and MUST carry + * `parentAlgebra: null`. A malformed root carrying a non-null + * parentAlgebra produces this feedback with `expectedParent: null`. + * Coalescing `null` to a sentinel like `"clifford"` would mis-represent + * the actual expectation (root-has-no-parent) as "root parents itself." + */ + | { kind: "MissingIntermediateLayer"; expectedParent: SubstrateAlgebra | null; actualParent: SubstrateAlgebra | null } | { kind: "DepthMismatch"; expected: HierarchyDepth; actual: HierarchyDepth }; export type HierarchyResult = @@ -203,7 +211,7 @@ export function verifyHierarchy(world: HierarchicalWorld): HierarchyResult(world: W, algebra: SubstrateA // ─────────────────────────────────────────────────────────────────────── /** - * CliffordWorld — canonical substrate per Aaron 2026-05-28 vote. + * CliffordWorld — canonical substrate per the human maintainer (2026-05-28) vote. * * NOT YET IMPLEMENTED. Substrate-engineering substrate-engineering target. * Composes with B-0635 wave-particle duality (Clifford multivector substrate) @@ -245,9 +253,9 @@ export interface CliffordWorldPlaceholder extends HierarchicalWorld { } /** - * DBSPWorld — Differential Bigraph Stream Processing substrate (Budiu et al - * VLDB 2023). Restriction-or-isomorphic-view of CliffordWorld (open question - * per OPEN_QUESTION_DBSP_CLIFFORD). + * DBSPWorld — Database Stream Processing substrate (Budiu et al VLDB 2023; + * canonical README expansion). Restriction-or-isomorphic-view of + * CliffordWorld (open question per OPEN_QUESTION_DBSP_CLIFFORD). * * NOT YET IMPLEMENTED. Substrate-engineering substrate-engineering target. * Composes with framework's incremental-view-maintenance + retraction-native From 6cef89cd7a809cb4fcd2acecb1c3695d2972e7c2 Mon Sep 17 00:00:00 2001 From: Lior Date: Thu, 28 May 2026 08:56:28 -0400 Subject: [PATCH 7/8] fix(PR #5777, post-merge): restore #5777's voteOrdering + primaryWorkingHypothesis after merging #5776's role-refs/DBSP/nullable-expectedParent fixes from main After PR #5776 merged to main (commit 4cdadc2c7) while #5777 was in CI, git pull --rebase + merge surfaced an add/add conflict on tools/workflow-engine/world-hierarchy.{ts,test.ts} (both branches introduced the file independently). Resolved via "checkout --theirs" to take main's version (which has my #5776 role-refs + DBSP-correct + nullable-expectedParent + root-parent regression test). That resolution dropped #5777's substantive additions: - DBSPCliffordRelationship "open-question" variant's optional `voteOrdering?: ReadonlyArray` field - OPEN_QUESTION_DBSP_CLIFFORD's `voteOrdering: [0, 1]` setting (operator-vote: (A) primary, (B) secondary) - primaryWorkingHypothesis() helper extracting the highest-vote reading - Test coverage for voteOrdering + primaryWorkingHypothesis This commit restores all four on top of the resolved merge so the PR's substantive content survives the conflict resolution. Tests: 24 pass (21 merged-from-main + 3 restored #5777 tests). Co-Authored-By: Claude --- tools/workflow-engine/world-hierarchy.test.ts | 14 ++++++++ tools/workflow-engine/world-hierarchy.ts | 32 ++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/tools/workflow-engine/world-hierarchy.test.ts b/tools/workflow-engine/world-hierarchy.test.ts index 2c1fe6fa37..f0b0e4c55a 100644 --- a/tools/workflow-engine/world-hierarchy.test.ts +++ b/tools/workflow-engine/world-hierarchy.test.ts @@ -11,6 +11,7 @@ import { inheritsFrom, verifyHierarchy, annotateHierarchy, + primaryWorkingHypothesis, } from "./world-hierarchy.js"; import { EMPTY_WORLD } from "./world.js"; @@ -129,6 +130,19 @@ describe("open-question substrate preservation (don't-collapse discipline)", () expect(OPEN_QUESTION_DBSP_CLIFFORD.preservedReadings[1]).toContain("fully isomorphic"); } }); + test("vote ordering records the human maintainer's '1 first 2 2nd' substrate", () => { + if (OPEN_QUESTION_DBSP_CLIFFORD.kind === "open-question") { + expect(OPEN_QUESTION_DBSP_CLIFFORD.voteOrdering).toEqual([0, 1]); + } + }); + test("primaryWorkingHypothesis returns strict-subset (operator-vote (A))", () => { + const primary = primaryWorkingHypothesis(OPEN_QUESTION_DBSP_CLIFFORD); + expect(primary).toContain("strict-subset"); + }); + test("primaryWorkingHypothesis returns null for non-open-question", () => { + const resolved = { kind: "strict-restriction" as const, rationale: "test" }; + expect(primaryWorkingHypothesis(resolved)).toBeNull(); + }); }); describe("substrate-engineering composition (end-to-end)", () => { diff --git a/tools/workflow-engine/world-hierarchy.ts b/tools/workflow-engine/world-hierarchy.ts index 84e8beb8c1..487c2691e2 100644 --- a/tools/workflow-engine/world-hierarchy.ts +++ b/tools/workflow-engine/world-hierarchy.ts @@ -95,7 +95,21 @@ export interface HierarchicalWorld extends World { export type DBSPCliffordRelationship = | { kind: "strict-restriction"; rationale: string } | { kind: "fully-isomorphic"; rationale: string } - | { kind: "open-question"; preservedReadings: ReadonlyArray }; + | { + kind: "open-question"; + preservedReadings: ReadonlyArray; + /** + * Optional vote ordering over `preservedReadings` (highest priority + * first). When set, downstream substrate-engineering work uses + * `preservedReadings[voteOrdering[0]]` as the primary working + * hypothesis and `preservedReadings[voteOrdering[1]]` as the + * secondary fallback. Substrate-engineering work starts with the + * primary; falls to the secondary if/when algebraic substrate + * proves them equivalent. See B-0915 for impl substrate that + * resolves this. + */ + voteOrdering?: ReadonlyArray; + }; export const OPEN_QUESTION_DBSP_CLIFFORD: DBSPCliffordRelationship = { kind: "open-question", @@ -103,8 +117,24 @@ export const OPEN_QUESTION_DBSP_CLIFFORD: DBSPCliffordRelationship = { "(A) Git ⊂ DBSP ⊂ Clifford strict-subset chain; each restricts upward substrate", "(B) DBSP ↔ Clifford fully isomorphic; both algebraic substrates supporting increments + retractions; Git ⊂ both equivalently", ], + // the human maintainer (2026-05-28): "1 first 2 2nd would be great" — + // (A) primary, (B) secondary fallback. Substrate-engineering work + // starts with (A); falls to (B) if/when algebraic-substrate work + // proves them equivalent. + voteOrdering: [0, 1], }; +/** + * Helper to extract the operator's primary working hypothesis from the + * open question. Returns the highest-vote reading (voteOrdering[0]) or + * the first preservedReading if no vote ordering present. + */ +export function primaryWorkingHypothesis(rel: DBSPCliffordRelationship): string | null { + if (rel.kind !== "open-question") return null; + const idx = rel.voteOrdering?.[0] ?? 0; + return rel.preservedReadings[idx] ?? null; +} + // ─────────────────────────────────────────────────────────────────────── // Inheritance verification — substrate-engineering composition guard // ─────────────────────────────────────────────────────────────────────── From f76bc586ddf77482d15222aff3dd4fc3ebb38769 Mon Sep 17 00:00:00 2001 From: Lior Date: Thu, 28 May 2026 08:57:31 -0400 Subject: [PATCH 8/8] fix(PR #5777): regen docs/BACKLOG.md after B-0915 title update The B-0915 row's frontmatter title was updated to use the role-ref form ("the human maintainer, 2026-05-28") to satisfy the no-name-attribution convention. The generated docs/BACKLOG.md index renders titles directly from each row's frontmatter via tools/backlog/generate-index.ts, so the index needed regeneration to stay consistent. Ran: BACKLOG_WRITE_FORCE=1 bun tools/backlog/generate-index.ts Co-Authored-By: Claude --- docs/BACKLOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/BACKLOG.md b/docs/BACKLOG.md index a026852591..d2b1f75b68 100644 --- a/docs/BACKLOG.md +++ b/docs/BACKLOG.md @@ -855,7 +855,7 @@ are closed (status: closed in frontmatter)._ - [ ] **[B-0893](backlog/P2/B-0893-zetaid-v2-128-bit-structured-encoding-snowflake-ulid-family-kestrel-2026-05-28.md)** ZetaID v2 — 128-bit structured encoding (Snowflake/ULID family with timestamp + trajectory + persona + lifecycle-stage + random) - [ ] **[B-0899](backlog/P2/B-0899-casimir-like-effect-from-review-walls-changing-allowed-output-modes-testable-pressure-difference-before-after-rule-landing-amara-aaron-2026-05-28.md)** Casimir-like effect from review walls — testable pressure difference in agent-output distribution before/after rule landing - [ ] **[B-0914](backlog/P2/B-0914-co-scientist-plus-robin-7-substrate-engineering-candidate-gaps-elo-trueskill-closed-loop-consensus-pairing-evolution-proximity-falcon-aaron-2026-05-28.md)** Co-scientist + Robin 7 substrate-engineering candidate gaps — ELO/TrueSkill ranking-agent + closed-loop CI→hypothesis + n-parallel-consensus + generation-reflection-pairing + evolution-mash-refine + proximity-dedup + Falcon-auto-research-doc-per-proposal (Aaron 2026-05-28) -- [ ] **[B-0915](backlog/P2/B-0915-clifford-world-impl-target-dotnet-numerics-simd-plus-linq-gpu-accelerated-substrate-engineering-substrate-aaron-2026-05-28.md)** CliffordWorld impl target — System.Numerics SIMD + LINQ hardware/GPU-accelerated substrate-engineering substrate (Aaron 2026-05-28) +- [ ] **[B-0915](backlog/P2/B-0915-clifford-world-impl-target-dotnet-numerics-simd-plus-linq-gpu-accelerated-substrate-engineering-substrate-aaron-2026-05-28.md)** CliffordWorld impl target — System.Numerics SIMD + LINQ hardware/GPU-accelerated substrate-engineering substrate (the human maintainer, 2026-05-28) - [ ] **[B-0916](backlog/P2/B-0916-lase-as-bridge-coherent-emission-on-phase-shift-error-class-discovery-companion-to-persist-prism-aaron-2026-05-28.md)** Lase-as-bridge — coherent-emission-on-phase-shift primitive companion to Persist-as-bridge; error-class discovery emits ripple instead of wall (Prism + Aaron 2026-05-28) ## P3 — convenience / deferred