#loom-sprint-scaffold

147 files tagged loom-sprint-scaffold.

loom-sprint-scaffoldconfig

Wrangler

{ "$schema": "node_modules/wrangler/config-schema.json", "name": "loom", "main": "src/index.ts", "account_id": "…

{}66 lines2,002 bytes
loom-sprint-scaffoldconfig

Tsconfig

{ "compilerOptions": { "target": "ES2022", "module": "ES2022", "moduleResolution": "Bundler", "lib": […

{}23 lines608 bytes
loom-sprint-scaffolddoc

Readme

# LOOM — Multi-Loop Cybernetic Orchestrator Sprint 0 scaffold per **LOOM-SPEC-001**. Cybernetics in the harness, never …

MD60 lines3,623 bytes
loom-sprint-scaffoldconfig

Package

{ "name": "loom", "version": "0.1.0", "private": true, "description": "LOOM — Multi-Loop Cybernetic Orchestrator…

{}29 lines901 bytes
loom-sprint-scaffolddoc

2026 06 10 123000 Review Agent Logic Full

▐▛███▜▌ Claude Code v2.1.170 ▝▜█████▛▘ Fable 5 · Claude Pro ▘▘ ▝▝ ~/leverage-loops-projects/loom-sprint-scaffold…

TXT1,023 lines50,089 bytes
loom-sprint-scaffolddoc

2026 06 10 120524 Proceed This Is Where We Left Off

▐▛███▜▌ Claude Code v2.1.170 ▝▜█████▛▘ Fable 5 · Claude Pro ▘▘ ▝▝ ~/leverage-loops-projects/loom-sprint-scaffold…

TXT750 lines38,174 bytes
loom-sprint-scaffoldsource

Drizzle.Config

import type { Config } from "drizzle-kit"; /** * Drizzle is the typed query layer over D1 (src/db/schema.ts). * Migra…

TS16 lines550 bytes
loom-sprint-scaffoldsource

0001 Init

-- LOOM 0001_init — 7 core tables + FTS5 + append-only enforcement. -- Identical on local workerd (--local) and edge D1 …

SQL101 lines4,113 bytes
loom-sprint-scaffolddoc

Parity

# LOOM Parity Gate The parity gate ensures that the monitor decision path produces **byte-identical output** across con…

MD95 lines3,098 bytes
loom-sprint-scaffolddoc

Ship Summary Loom V1 2026 06 10

--- title: LOOM v1 Ship Summary category: ship-summary created: 2026-06-10 repo: /home/mikes/leverage-loops-projects/loo…

MD47 lines2,902 bytes
loom-sprint-scaffoldother

Metadata

SQLite format 3@ .~X …

·2 lines4,096 bytes
loom-sprint-scaffoldother

Metadata

�-_P3bv�e���ҷ��R�S%r �d�-_P3bv�e���ҷ��R�S%r �d������������…

·3 lines32,768 bytes
loom-sprint-scaffoldother

Metadata

7�-����ҷ��R�����T����ҷ��Ru5�i�u|SQLite format 3@ …

·6 lines8,272 bytes
loom-sprint-scaffoldother

Metadata

SQLite format 3@ .~X …

·2 lines4,096 bytes
loom-sprint-scaffoldother

Metadata

�-~E�o���i����޴5�0V? ��-~E�o���i����޴5�0V? �������������…

·1 lines32,768 bytes
loom-sprint-scaffoldother

Metadata

7�-��i����޴Эl�=t1�i����޴��/Z�ThMSQLite format 3@ …

·6 lines8,272 bytes
loom-sprint-scaffoldother

Metadata

SQLite format 3@ .~X …

·2 lines4,096 bytes
loom-sprint-scaffoldother

Metadata

�-��u�]��?<#�'����&�YY�-��u�]��?<#�'����&�YY������������…

·1 lines32,768 bytes
loom-sprint-scaffoldother

Metadata

7�-��?<#�'��#B�I20M�?<#�'��ь�SQLite format 3@ …

·6 lines8,272 bytes
loom-sprint-scaffoldother

Metadata

SQLite format 3@ .~X …

·2 lines4,096 bytes
loom-sprint-scaffoldother

Metadata

�-�a����*-��֊�H�����,�-�a����*-��֊�H�����,������������…

·1 lines32,768 bytes
loom-sprint-scaffoldother

Metadata

7�-�*-��֊�T�0=� �r*-��֊�QL��F'l�SQLite format 3@ …

·7 lines8,272 bytes
loom-sprint-scaffoldtest

Retry.Test

import { describe, expect, test } from "bun:test"; import { withRetry } from "../src/lib/retry"; import { RetryExhausted…

TS66 lines2,287 bytes
loom-sprint-scaffoldtest

Tsconfig

{ "extends": "../tsconfig.json", "compilerOptions": { "types": ["bun-types", "@cloudflare/workers-types"], "…

{}14 lines508 bytes
loom-sprint-scaffoldtest

Ids.Test

import { describe, expect, test } from "bun:test"; import { actionHash, canonicalJSON, dispatchId, newEventId, newGoalId…

TS47 lines1,923 bytes
loom-sprint-scaffoldtest

Contracts.Test

import { describe, expect, test } from "bun:test"; import { parseContract, checkContract, isContractName } from "../src/…

TS81 lines3,573 bytes
loom-sprint-scaffoldtest

Budget Governor.Test

/** * Tests for budget-governor (H3.6). * * Proves: * - all 3 hard cap types (calls, tokens, wallclock) are enforced…

TS190 lines6,388 bytes
loom-sprint-scaffoldtest

Reinjector.Test

/** * Tests for reinjector (H3.4). * * Proves: * - normalizeObservation truncates content exceeding obs_cap_tokens …

TS167 lines5,612 bytes
loom-sprint-scaffoldtest

Model Client.Test

/** * Tests for model-client (H3.0). * * Proves: * - createAnthropicModelCaller returns a callable ModelCaller * - …

TS349 lines10,934 bytes
loom-sprint-scaffoldtest

Reversibility Gate.Test

/** * Tests for reversibility-gate (H3.3). * * Proves: * - allowlist lookup accepts allowed tools and denies unknown…

TS203 lines6,855 bytes
loom-sprint-scaffoldtest

Conf Monitor.Test

/** * Tests for conf-monitor (H3.5). * * Proves: * - extractConf finds trailing JSON line `{"conf": 0.8}` in assista…

TS159 lines5,452 bytes
loom-sprint-scaffoldtest

Harness.Test

/** * Integration tests for harness (runStage). * * Proves every StageTermination kind is reachable: * DONE | GATE_R…

TS612 lines20,705 bytes
loom-sprint-scaffoldtest

Preflight.Test

/** * Tests for preflight (H3.7). * * Proves: * - clean files (no markers) pass * - every marker (TODO, FIXME, <<<<…

TS133 lines4,732 bytes
loom-sprint-scaffoldtest

Ack Gate.Test

/** * Tests for ack-gate (H3.1). * * Proves: * - wrapResult produces deterministic hex hash from tool result * - ch…

TS162 lines5,577 bytes
loom-sprint-scaffoldtest

Loop Detector.Test

/** * Tests for loop-detector (H3.2). * * Proves: * - the identical action halts at exactly the 3rd occurrence (not …

TS152 lines5,256 bytes
loom-sprint-scaffoldtest

Dataset Emitter.Test

/** * Tests for H5.6 — Dataset Emitter. * * Proves: * - extractDatasetTuples extracts (failure_pattern, root_cause…

TS245 lines8,772 bytes
loom-sprint-scaffoldtest

Fixtures

/** * Synthetic trace corpus for Loop 5 synthesis tests. * ~50 enriched trace events covering failures, successes, rep…

TS264 lines11,826 bytes
loom-sprint-scaffoldtest

Failure Clusterer.Test

/** * Tests for H5.1 — Failure Clusterer. * * Proves: * - normalizeErrorSignature strips ids, paths, numbers deter…

TS200 lines7,278 bytes
loom-sprint-scaffoldtest

Skill Proposer.Test

/** * Tests for H5.2 — Skill Proposer. * * Proves: * - extractSuccessfulSequences groups tool calls by dispatch *…

TS206 lines7,692 bytes
loom-sprint-scaffoldtest

Registry Updater.Test

/** * Tests for H5.3 — Registry Updater. * * Proves: * - computeModeStats groups correctly by (model, harnessProfi…

TS208 lines7,132 bytes
loom-sprint-scaffoldtest

Report.Test

/** * Integration test for the full synthesis report pipeline. * * Proves: * - Synthetic trace corpus → determinis…

TS184 lines6,142 bytes
loom-sprint-scaffoldtest

Entropy Monitors.Test

/** * Tests for H5.4 — Entropy Monitors. * * Proves: * - Shannon entropy computed correctly with natural log (hand…

TS191 lines6,905 bytes
loom-sprint-scaffoldtest

Isolation.Test

/** * Isolation test for src/synthesis/. * * Enforces at the grep level: * 1. No import from src/orchestrator/, sr…

TS132 lines4,331 bytes
loom-sprint-scaffoldtest

Revision Governor.Test

/** * Tests for H5.5 — Revision Governor. * * Proves: * - Caps proposals at maxSkillProposals (default 5) * - N…

TS170 lines5,880 bytes
loom-sprint-scaffoldtest

Mode Registry.Test

/** * Tests for ModeRegistry (H2.1). * * Proves: * - unknown variety_class → highest-capability mode + variety_defic…

TS198 lines6,916 bytes
loom-sprint-scaffoldtest

Envelope Compiler.Test

/** * Tests for EnvelopeCompiler (H2.2 + H2.3). * * Proves: * - compiled envelope validates against dispatch-envelop…

TS262 lines10,508 bytes
loom-sprint-scaffoldtest

Probe Planner.Test

/** * Tests for ProbePlanner (H2.5). * * Proves: * - api_integration + no behavior model → probe prepended (recovera…

TS197 lines7,246 bytes
loom-sprint-scaffoldtest

Dlq Escalator.Test

/** * Tests for DlqEscalator (H2.4). * * Proves: * - DLQ letter → escalation POST with correct payload (goal_id, sta…

TS151 lines5,483 bytes
loom-sprint-scaffoldtest

Context Assembler.Test

/** * ContextAssembler tests (H4.1). * * Proves: * - Budget NEVER exceeded: table-driven over budgets {0, tiny, ex…

TS245 lines8,542 bytes
loom-sprint-scaffoldtest

Compactor.Test

/** * Compactor tests (H4.5). * * Proves: * - Compactor output records all validate against memory-record.schema.j…

TS178 lines6,156 bytes
loom-sprint-scaffoldtest

Scope Wall.Test

/** * ScopeWall tests (H4.3). * * Proves: * - Same-scope read works (constructor requires scope) * - Cross-scop…

TS266 lines8,984 bytes
loom-sprint-scaffoldtest

Helpers

/** * Test helpers for memory module tests. * * Provides: * - FakeD1: in-memory SQLite (bun:sqlite) implementing D…

TS324 lines10,577 bytes
loom-sprint-scaffoldtest

Pointer Hierarchy.Test

/** * PointerHierarchy tests (H4.4). * * Proves: * - memory_expand round-trips: put full text in fake BlobStore → …

TS188 lines6,753 bytes
loom-sprint-scaffoldtest

Promotion Engine.Test

/** * PromotionEngine tests (H4.2). * * Proves: * - Promotion fires at EXACTLY m_promote distinct traces (not m-1;…

TS212 lines9,720 bytes
loom-sprint-scaffoldtest

Semantic Index.Test

/** * SemanticIndex contract test suite. * * Shared tests run against BOTH Fts5Index (with fake D1/SQLite) and * Vec…

TS238 lines9,598 bytes
loom-sprint-scaffoldtest

No Silent Failure.Test

/** * No-Silent-Failure Invariant Walk. * * For EVERY terminated (non-DONE) stage across all golden runs + chaos runs…

TS249 lines9,793 bytes
loom-sprint-scaffoldtest

Chaos.Test

/** * Chaos Tests — fault injection, one scenario per test. * * Five scenarios: * 1. dropped-tool-result — ack gat…

TS253 lines10,016 bytes
loom-sprint-scaffoldtest

Golden.Test

/** * E2E Golden Goal Tests. * * Runs all three golden goals end-to-end through all LOOM loops. * Each asserts: * …

TS50 lines2,037 bytes
loom-sprint-scaffoldtest

Chaos Scenarios

/** * Shared chaos scenario runners used by both chaos.test.ts and * no-silent-failure.test.ts. Lives outside *.test.t…

TS76 lines2,999 bytes
loom-sprint-scaffoldtest

Golden Runner

/** * E2E Golden Runner — in-process composition root for LOOM integration tests. * * Wires Loop 1 (CheckpointEngine,…

TS423 lines15,811 bytes
loom-sprint-scaffoldtest

Index

/** Barrel for golden goal scripts. */ export { script as codegenScript, assert as assertCodegen } from "./codegen"; ex…

TS6 lines299 bytes
loom-sprint-scaffoldtest

Research

/** * Golden goal: research — mid-goal failing stage drives fail_streak to m=3 → REFORMULATE → recovers → completes. *…

TS152 lines5,484 bytes
loom-sprint-scaffoldtest

Codegen

/** * Golden goal: codegen — multi-stage code-generation goal. * * All stages pass done-criteria; the goal completes …

TS82 lines2,789 bytes
loom-sprint-scaffoldtest

Data Pipeline

/** * Golden goal: data_pipeline — destructive step requires approval token (mint → verify path). * * Stages: * 1.…

TS138 lines4,961 bytes
loom-sprint-scaffoldtest

Fakes

/** * Shared fake implementations for LOOM E2E tests. * * Consolidates patterns from: * tests/orchestrator/checkpo…

TS384 lines13,629 bytes
loom-sprint-scaffoldtest

Dispatch Envelope

{ "dispatch_id": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8", "stage_id": "stg_a1b2c3d4e5f6",…

{}17 lines895 bytes
loom-sprint-scaffoldtest

Goal State

{ "goal_id": "goal_a1b2c3d4e5f6", "original_spec": "Rebuild oregonsmbdirectory.com category pages with JSON-LD on As…

{}20 lines869 bytes
loom-sprint-scaffoldtest

Execution Trace

{ "event_id": "evt_a1b2c3d4e5f6", "dispatch_id": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",…

{}23 lines689 bytes
loom-sprint-scaffoldtest

Memory Record

{ "record_id": "mem_a1b2c3d4e5f6", "scope": "execution", "level": "semantic", "topic": "astro-jsonld-phantom-bug…

{}19 lines661 bytes
loom-sprint-scaffoldtest

Stage Spec

{ "stage_id": "stg_a1b2c3d4e5f6", "goal_id": "goal_a1b2c3d4e5f6", "objective": "Generate JSON-LD LocalBusiness sch…

{}18 lines784 bytes
loom-sprint-scaffoldtest

Dispatch Envelope.Bad Reversibility

{ "dispatch_id": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8", "stage_id": "stg_a1b2c3d4e5f6",…

{}12 lines434 bytes
loom-sprint-scaffoldtest

Memory Record.Bad Scope

{ "record_id": "mem_a1b2c3d4e5f6", "scope": "global", "level": "semantic", "topic": "t", "summary": "s", "cr…

{}9 lines156 bytes
loom-sprint-scaffoldtest

Goal State.Bad Status

{ "goal_id": "goal_a1b2c3d4e5f6", "original_spec": "x", "spec_hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b…

{}11 lines429 bytes
loom-sprint-scaffoldtest

Stage Spec.Bad Predicate Kind

{ "stage_id": "stg_a1b2c3d4e5f6", "goal_id": "goal_a1b2c3d4e5f6", "objective": "Done criterion uses a non-machine-…

{}13 lines413 bytes
loom-sprint-scaffoldtest

Goal State.Bad Id

{ "goal_id": "goal_TOOSHORT", "original_spec": "x", "spec_hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822c…

{}11 lines425 bytes
loom-sprint-scaffoldtest

Dispatch Envelope.Bad Dispatch Id

{ "dispatch_id": "not-a-sha256", "stage_id": "stg_a1b2c3d4e5f6", "goal_id": "goal_a1b2c3d4e5f6", "attempt": 1, …

{}12 lines336 bytes
loom-sprint-scaffoldtest

Memory Record.Extra Prop

{ "record_id": "mem_a1b2c3d4e5f6", "scope": "execution", "level": "semantic", "topic": "t", "summary": "s", …

{}10 lines184 bytes
loom-sprint-scaffoldtest

Stage Spec.Empty Done

{ "stage_id": "stg_a1b2c3d4e5f6", "goal_id": "goal_a1b2c3d4e5f6", "objective": "Stage with no verifiable completio…

{}11 lines351 bytes
loom-sprint-scaffoldtest

Execution Trace.Bad Kind

{ "event_id": "evt_a1b2c3d4e5f6", "dispatch_id": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",…

{}8 lines189 bytes
loom-sprint-scaffoldtest

Execution Trace.Bad Conf

{ "event_id": "evt_a1b2c3d4e5f6", "dispatch_id": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",…

{}9 lines205 bytes
loom-sprint-scaffoldtest

Escalation Ledger.Test

/** * Tests for EscalationLedger (H1.4). * * Proves: * - fail_streak increment/reset * - escalation records append-…

TS110 lines3,728 bytes
loom-sprint-scaffoldtest

Drift Sentinel.Test

/** * Tests for DriftSentinel (H1.6). * * Proves: * - single spike does NOT raise sustained drift * - sustained div…

TS146 lines4,522 bytes
loom-sprint-scaffoldtest

Predicates.Test

/** * Tests for predicate evaluators (H1.1). * All six kinds: pass + fail cases each. * Injects a scripted PredicateR…

TS120 lines5,367 bytes
loom-sprint-scaffoldtest

Checkpoint.Test

/** * Tests for CheckpointEngine (H1.1 + H1.4). * * Proves: * - scripted fake stage results drive fail_streak to EXA…

TS386 lines13,178 bytes
loom-sprint-scaffoldtest

Decomposer.Test

/** * Tests for decomposer (H1.3). * * Proves: * - rejects non-machine-evaluable done_criteria with the specific vio…

TS182 lines6,299 bytes
loom-sprint-scaffoldtest

Token Mint.Test

/** * Tests for TokenMint (H1.5). * * Proves: * - mint → Loop 3 verify passes (round-trip) * - expired tokens fail …

TS180 lines5,795 bytes
loom-sprint-scaffoldsource

Parity Check

#!/usr/bin/env bun /** * Parity Check — byte-stable decision log for LOOM monitor decision path. * * Replays a script…

TS170 lines6,075 bytes
loom-sprint-scaffoldsource

Approve Skills

#!/usr/bin/env bun /** * Approval CLI for skill proposals. * * This is OPERATOR TOOLING — a bun script, NOT workerd c…

TS233 lines7,435 bytes
loom-sprint-scaffoldsource

Index

import { drizzle } from "drizzle-orm/d1"; import { dispatches, traceEvents } from "./db/schema"; import { checkContract,…

TS269 lines10,644 bytes
loom-sprint-scaffoldconfig

Stage Spec.Schema

{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://leverageai.network/schemas/loom/stage-spec.j…

{}54 lines2,051 bytes
loom-sprint-scaffoldconfig

Dispatch Envelope.Schema

{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://leverageai.network/schemas/loom/dispatch-env…

{}56 lines2,207 bytes
loom-sprint-scaffoldconfig

Memory Record.Schema

{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://leverageai.network/schemas/loom/memory-recor…

{}31 lines1,480 bytes
loom-sprint-scaffoldconfig

Goal State.Schema

{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://leverageai.network/schemas/loom/goal-state.j…

{}82 lines3,193 bytes
loom-sprint-scaffoldconfig

Execution Trace.Schema

{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://leverageai.network/schemas/loom/execution-tr…

{}48 lines2,004 bytes
loom-sprint-scaffoldsource

Loop Detector

/** * H3.2 — Loop Detector: actionHash(tool, args) via src/lib/ids.ts; * ring buffer W=10; ≥3 identical in window → HA…

TS96 lines2,531 bytes
loom-sprint-scaffoldsource

Preflight

/** * H3.7 — Preflight: before any recoverable|destructive action, scan a provided * list of staged file contents for …

TS84 lines2,426 bytes
loom-sprint-scaffoldsource

Budget Governor

/** * H3.6 — Budget Governor: hard caps B_tokens / B_calls / B_wallclock_ms from * the envelope. Breach → graceful sus…

TS142 lines3,640 bytes
loom-sprint-scaffoldsource

Conf Monitor

/** * H3.5 — Confidence Monitor: every assistant turn must include conf ∈ [0,1] * (schema-enforced; extract from a tra…

TS108 lines3,011 bytes
loom-sprint-scaffoldsource

Reinjector

/** * H3.4 — Reinjector: normalize observations. Truncate to per-tool obs_cap_tokens * from the envelope; store full t…

TS98 lines2,802 bytes
loom-sprint-scaffoldsource

Reversibility Gate

/** * H3.3 — Reversibility Gate: every tool call checked against the envelope * allowlist. Each allowlist entry has re…

TS136 lines3,886 bytes
loom-sprint-scaffoldsource

Model Client

/** * H3.0 — Fetch-based Anthropic Messages API client. * workerd-compatible: plain fetch, NO node SDK, no node:* impo…

TS93 lines2,958 bytes
loom-sprint-scaffoldsource

Ack Gate

/** * H3.1 — Ack Gate: wrap every tool result with obs_hash; enforce that the * NEXT assistant turn begins with `<ack …

TS94 lines2,810 bytes
loom-sprint-scaffoldsource

Harness

/** * H3 — Harness: runStage(envelope, modelCaller, deps): Promise<StageResult> * composing all monitors around the to…

TS357 lines13,236 bytes
loom-sprint-scaffoldsource

Index

/** * Loop 5 — Synthesis batch glue. * * Thin scheduled() handler that wires injectables from the worker's Env * int…

TS294 lines9,742 bytes
loom-sprint-scaffoldsource

Entropy Monitors

/** * H5.4 — Entropy Monitors. * * Queries entropy H(q) (dispatch outcome entropy) and H(s) (source/variety_class * …

TS177 lines5,757 bytes
loom-sprint-scaffoldsource

Registry Updater

/** * H5.3 — Registry Updater. * * Recomputes mode_registry success_n / fail_n / avg_cost_tokens per * (mode, variet…

TS153 lines4,797 bytes
loom-sprint-scaffoldsource

Dataset Emitter

/** * H5.6 — Dataset Emitter. * * Exports (failure_pattern, root_cause_signature, successful_intervention) * tuples …

TS185 lines6,010 bytes
loom-sprint-scaffoldsource

Report

/** * Synthesis Report Assembler. * * Orchestrates all Loop 5 monitors (H5.1–H5.6) into a single SynthesisReport: * …

TS227 lines7,181 bytes
loom-sprint-scaffoldsource

Revision Governor

/** * H5.5 — Revision Governor. * * Hard caps on skill proposals per window (tunable, default 5). * Tunable-paramete…

TS109 lines3,687 bytes
loom-sprint-scaffoldsource

Skill Proposer

/** * H5.2 — Skill Proposer. * * Detects recurring successful sub-sequences across ≥ N distinct goals * (tunable, de…

TS239 lines7,685 bytes
loom-sprint-scaffoldsource

Failure Clusterer

/** * H5.1 — Failure Clusterer. * * Groups trace failures by (tool, normalized error signature, variety_class). * Er…

TS181 lines6,193 bytes
loom-sprint-scaffoldsource

Index

/** * Loop 2 dispatcher — thin worker-side barrel + concrete wire-ups. * * All logic lives in src/dispatcher/core/ (p…

TS120 lines4,364 bytes
loom-sprint-scaffoldsource

Registry Seed

/** * Seed data for the mode_registry D1 table. * * Three modes covering the spec's default model set, with typed see…

TS146 lines4,376 bytes
loom-sprint-scaffoldsource

Mode Registry

/** * H2.1 — D1-backed mode registry. * * selectMode(variety_class) picks the mode with highest success rate for that…

TS87 lines3,002 bytes
loom-sprint-scaffoldsource

Types

/** * Injectable interfaces for the Loop 2 dispatcher core. * * Every dependency is an interface so tests inject fake…

TS100 lines3,297 bytes
loom-sprint-scaffoldsource

Envelope Compiler

/** * H2.2 + H2.3 — Envelope Compiler. * * compile(stage, mode, opts): DispatchEnvelope * - Tool allowlist: only the…

TS130 lines4,998 bytes
loom-sprint-scaffoldsource

Probe Planner

/** * H2.5 — Probe Planner. * * For stages with variety_class === "api_integration" AND no management-scope * behavi…

TS129 lines4,290 bytes
loom-sprint-scaffoldsource

Dlq Escalator

/** * H2.4 — DLQ Escalator. * * Converts a dead letter into a Loop 1 escalation: * - builds typed escalation payload…

TS94 lines3,061 bytes
loom-sprint-scaffoldsource

Index

/** * Loop 4 — Memory Service: thin worker shell. * * Factory: pick VectorizeIndex when env.SEMANTIC binding present,…

TS259 lines8,844 bytes
loom-sprint-scaffoldsource

Pointer Hierarchy

/** * H4.4 — Pointer Hierarchy. * * topic → summary → episodic_ref (R2 key). * * memoryExpand(record_id): resolve e…

TS119 lines3,691 bytes
loom-sprint-scaffoldsource

Promotion Engine

/** * H4.2 — Promotion Engine. * * episodic → semantic: when a pattern recurs across ≥ m_promote distinct traces. * …

TS198 lines6,260 bytes
loom-sprint-scaffoldsource

Scope Wall

/** * H4.3 — Scope Wall. * * All reads/writes carry a required scope. Default read path filters to the * caller's sc…

TS117 lines3,264 bytes
loom-sprint-scaffoldsource

Semantic Index

/** * H4.6 — SemanticIndex: search abstraction with two implementations. * * VectorizeIndex — wraps Cloudflare Vecto…

TS161 lines5,866 bytes
loom-sprint-scaffoldsource

Compactor

/** * H4.5 — Compactor: summarize raw working context into semantic MemoryRecords. * * compactStage(goal_id, stage_id…

TS208 lines6,662 bytes
loom-sprint-scaffoldsource

Context Assembler

/** * H4.1 — Context Assembler. * * assembleContext({scope, goal_id, query, token_budget}): * 1. Query SemanticIndex…

TS229 lines8,047 bytes
loom-sprint-scaffoldsource

Index

/** Barrel — import all LOOM types from "@/types" or relative "../types". */ export * from "./contracts"; export * from …

TS8 lines241 bytes
loom-sprint-scaffoldsource

Env

import type { DispatchEnvelope } from "./contracts"; /** Worker bindings — must match wrangler.jsonc exactly. */ export…

TS13 lines339 bytes
loom-sprint-scaffoldsource

Contracts

/** * TypeScript mirrors of the 5 LOOM contracts (src/contracts/*.schema.json). * The JSON Schemas are the source of t…

TS241 lines6,845 bytes
loom-sprint-scaffoldsource

Errors

/** Typed error hierarchy — never throw bare Error, never swallow. */ export abstract class LoomError extends Error { …

TS67 lines2,492 bytes
loom-sprint-scaffoldsource

Synthesis

/** * Loop 5 synthesis types — report shapes, interfaces, contract-style types. * * All Loop 5 outputs are typed here…

TS177 lines5,430 bytes
loom-sprint-scaffoldsource

Execution

/** * Execution harness types — Loop 3: model client, monitors, stage result. * All new execution types go here; barre…

TS119 lines4,106 bytes
loom-sprint-scaffoldsource

Memory

/** * Memory service types — Loop 4. * * Injectables: BlobStore, SemanticIndex, Clock, TokenCounter. * D1DatabaseLik…

TS138 lines4,025 bytes
loom-sprint-scaffoldsource

Schema

import { sqliteTable, text, integer, index } from "drizzle-orm/sqlite-core"; /** * 7-table D1 schema — mirrors LOOM-SP…

TS108 lines3,990 bytes
loom-sprint-scaffoldsource

Retry

import { RetryExhaustedError } from "../types/errors"; /** * Exponential backoff with FULL jitter (HC-6): delay = rand…

TS45 lines1,583 bytes
loom-sprint-scaffoldsource

Ids

/** * Identity + hashing primitives shared by every loop. * Web Crypto only — identical behavior on workerd and Bun (H…

TS58 lines2,060 bytes
loom-sprint-scaffoldsource

Logger

/** * Structured logger. The single sanctioned sink for log output — * bare console.log in logic paths is a lint-level…

TS37 lines1,354 bytes
loom-sprint-scaffoldsource

Hmac

/** * HMAC utilities shared by Loop 1 (token-mint) and Loop 3 (reversibility-gate). * WebCrypto only — workerd-compati…

TS77 lines2,257 bytes
loom-sprint-scaffoldsource

Validate

import { Ajv, type ValidateFunction } from "ajv"; import addFormats from "ajv-formats"; import { ContractViolationError …

TS67 lines2,858 bytes
loom-sprint-scaffoldsource

Do

import { drizzle } from "drizzle-orm/d1"; import { goals } from "../db/schema"; import { parseContract } from "../lib/va…

TS435 lines16,278 bytes
loom-sprint-scaffoldsource

Types

/** * Injectable interfaces for LOOM Loop 1 orchestration core. * Every dependency is an interface so tests can inject…

TS101 lines3,889 bytes
loom-sprint-scaffoldsource

Predicates

/** * H1.1 — Predicate evaluators for the six machine-evaluable predicate kinds. * * Each takes a Predicate spec + an…

TS109 lines3,011 bytes
loom-sprint-scaffoldsource

Escalation Ledger

/** * H1.4 — Escalation ledger for per-stage fail_streak persistence and * escalation records. Append-only records are…

TS115 lines3,562 bytes
loom-sprint-scaffoldsource

Index

/** * Barrel — all core orchestration classes and types. */ export { type PredicateEvaluation, evaluatePredicate, eva…

TS11 lines727 bytes
loom-sprint-scaffoldsource

Drift Sentinel

/** * H1.6 — Drift Sentinel: embed last N stage summaries, compare cosine distance * against the original_spec embeddi…

TS137 lines4,012 bytes
loom-sprint-scaffoldsource

Checkpoint

/** * H1.1 + H1.4 — The alarm-tick sequence: assemble current GoalState, * evaluate active stage done-criteria predica…

TS299 lines9,633 bytes
loom-sprint-scaffoldsource

Decomposer

/** * H1.3 — Decompose a goal spec into a sequence of StageSpec[] via a single * model call. Each StageSpec is validat…

TS230 lines8,248 bytes
loom-sprint-scaffoldsource

Token Mint

/** * H1.5 — HMAC single-use, stage-scoped, TTL'd approval tokens for destructive * actions. WebCrypto only. * * Tok…

TS208 lines6,815 bytes