_archive subproject
61 files
.Dev.Vars
# Copy to .dev.vars for local workerd (never commit .dev.vars). # Edge: wrangler secret put ANTHROPIC_API_KEY && wrangle…
.Gitignore
node_modules/ dist/ .wrangler/ .dev.vars *.log
0001 Init
-- LOOM 0001_init — 7 core tables + FTS5 + append-only enforcement. -- Identical on local workerd (--local) and edge D1 …
Ack Gate
/** * H3.1 — Observation acknowledgment gate (P1 feedback closure). * After tool results are re-injected, the NEXT ass…
Adapters
import { drizzle } from "drizzle-orm/d1"; import { memoryRecords, traceEvents } from "../db/schema"; import { withRetry …
Anthropic Client
import { withRetry } from "../lib/retry"; import { LoomError } from "../types/errors"; import type { AssistantBlock, Mod…
Budget Governor
import type { StageBudget } from "../types/contracts"; import type { Clock } from "./ports"; /** * H3.6 — Budget gover…
Conf Monitor
/** * H3.5 — Confidence EWMA monitor (P5). * Each assistant turn must carry <conf>0.NN</conf>. EWMA(alpha=0.4) below …
Contracts
/** * TypeScript mirrors of the 5 LOOM contracts (src/contracts/*.schema.json). * The JSON Schemas are the source of t…
Contracts.Test
import { describe, expect, test } from "bun:test"; import { parseContract, checkContract, isContractName } from "../src/…
Dispatch Envelope
{ "dispatch_id": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8", "stage_id": "stg_a1b2c3d4e5f6",…
Dispatch Envelope.Bad Dispatch Id
{ "dispatch_id": "not-a-sha256", "stage_id": "stg_a1b2c3d4e5f6", "goal_id": "goal_a1b2c3d4e5f6", "attempt": 1, …
Dispatch Envelope.Bad Reversibility
{ "dispatch_id": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8", "stage_id": "stg_a1b2c3d4e5f6",…
Dispatch Envelope.Schema
{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://leverageai.network/schemas/loom/dispatch-env…
Do
import { drizzle } from "drizzle-orm/d1"; import { goals } from "../db/schema"; import { parseContract } from "../lib/va…
Drizzle.Config
import type { Config } from "drizzle-kit"; /** * Drizzle is the typed query layer over D1 (src/db/schema.ts). * Migra…
Env
import type { DispatchEnvelope } from "./contracts"; /** Worker bindings — must match wrangler.jsonc exactly. */ export…
Errors
/** Typed error hierarchy — never throw bare Error, never swallow. */ export abstract class LoomError extends Error { …
Execution Trace
{ "event_id": "evt_a1b2c3d4e5f6", "dispatch_id": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",…
Execution Trace.Bad Conf
{ "event_id": "evt_a1b2c3d4e5f6", "dispatch_id": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",…
Execution Trace.Bad Kind
{ "event_id": "evt_a1b2c3d4e5f6", "dispatch_id": "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8",…
Execution Trace.Schema
{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://leverageai.network/schemas/loom/execution-tr…
Fakes
import type { AssistantBlock, BlobStore, Clock, HarnessDeps, MemorySink, ModelClient, ModelRequest, ModelTurn, ToolD…
Gates.Test
import { describe, expect, test } from "bun:test"; import { AckGate } from "../../src/execution/ack-gate"; import { Loop…
Goal State
{ "goal_id": "goal_a1b2c3d4e5f6", "original_spec": "Rebuild oregonsmbdirectory.com category pages with JSON-LD on As…
Goal State.Bad Id
{ "goal_id": "goal_TOOSHORT", "original_spec": "x", "spec_hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822c…
Goal State.Bad Status
{ "goal_id": "goal_a1b2c3d4e5f6", "original_spec": "x", "spec_hash": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b…
Goal State.Schema
{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://leverageai.network/schemas/loom/goal-state.j…
Harness
import { actionHash, canonicalJSON, newEventId, newMemoryId } from "../lib/ids"; import { parseContract } from "../lib/v…
Harness.Test
import { describe, expect, test } from "bun:test"; import { runDispatch } from "../../src/execution/harness"; import { m…