Other

93 files

pi-cyberneticsource

Dispatch Scanner

import { Agent } from "@earendil-works/pi-agent-core"; import { getModel } from "@earendil-works/pi-ai"; import { Type }…

TS114 lines3,693 bytes
pi-cyberneticsource

Dispatch Scanner V2

import { Agent } from "@earendil-works/pi-agent-core"; import { getModel } from "@earendil-works/pi-ai"; import { Type }…

TS99 lines3,846 bytes
pi-cyberneticsource

Dispatch Scanner V3

import { Agent } from "@earendil-works/pi-agent-core"; import { getModel } from "@earendil-works/pi-ai"; import { Type }…

TS99 lines3,833 bytes
pi-cyberneticsource

Analyze Batches

import { Agent } from "@earendil-works/pi-agent-core"; import { getModel } from "@earendil-works/pi-ai"; import { Type }…

TS139 lines5,068 bytes
pi-cyberneticsource

Pretooluse Gate Guard

#!/usr/bin/env python3 """pretooluse_gate_guard.py — Claude Code PreToolUse hook enforcing N15. Blocks Edit/Write/Multi…

PY105 lines3,779 bytes
pi-cyberneticsource

Register Pretooluse

#!/usr/bin/env python3 """register_pretooluse.py — safely register the gate guard in .claude/settings.json. Discipline …

PY80 lines3,193 bytes
pi-cyberneticsource

Pre Commit Gate Guard

#!/usr/bin/env python3 """pre_commit_gate_guard.py — git pre-commit enforcement of N15 (layer 3). Rules: 1. Any stage…

PY126 lines4,956 bytes
pi-cyberneticother

Pre Commit

#!/usr/bin/env bash # Versioned pre-commit shim (installed via `git config core.hooksPath .githooks`). # All logic lives…

·5 lines254 bytes
pi-cyberneticsource

Gate Integrity

/** * gate-integrity.ts — Layer 1 runtime enforcement (A13 / N15 / N16). * * Verifies a spec's pinned gate reference …

TS137 lines5,182 bytes
pi-cyberneticsource

Spec Lint Gates

#!/usr/bin/env python3 """spec_lint_gates.py — lint dispatch specs for gate governance (N16 + fidelity). Checks, per sp…

PY149 lines6,453 bytes
pi-cyberneticsource

Gate Manifest

#!/usr/bin/env python3 """gate_manifest.py — single hashing authority for the gate governance system. Every component (…

PY264 lines10,973 bytes
pi-cyberneticsource

Cut Gate Version

#!/usr/bin/env python3 """cut_gate_version.py — the ONLY sanctioned way a gate pack changes (N15/N17). Creates gates/v<…

PY154 lines6,863 bytes
loom-buildersource

Index

console.log("Hello via Bun!");

TS1 lines30 bytes
loom-buildersource

Pre Commit Gate Guard

#!/usr/bin/env python3 """pre_commit_gate_guard.py — git pre-commit enforcement of N15 (layer 3). Rules: 1. Any stage…

PY126 lines4,956 bytes
loom-builderother

Pre Commit

#!/usr/bin/env bash # Versioned pre-commit shim (installed via `git config core.hooksPath .githooks`). # All logic lives…

·5 lines254 bytes
loom-buildersource

Pretooluse Gate Guard

#!/usr/bin/env python3 """pretooluse_gate_guard.py — Claude Code PreToolUse hook enforcing N15. Blocks Edit/Write/Multi…

PY105 lines3,779 bytes
loom-builder-solsource

Index

console.log("Hello via Bun!");

TS1 lines30 bytes
loom-builder-solother

Locked

# LOCKED marker — this version directory is immutable. # To make changes, copy v1.1.0/ to v1.2.0/ and edit the new direc…

·4 lines211 bytes
loom-builder-solother

Locked

# LOCKED marker — this version directory is immutable. # To make changes, copy v1.0.0/ to v1.1.0/ and edit the new direc…

·4 lines211 bytes
loom-builder-solother

Locked

# LOCKED marker — this version directory is immutable. # To make changes, copy v1.1.0/ to v1.2.0/ and edit the new direc…

·4 lines211 bytes
loom-builder-solsource

Pre Commit Gate Guard

#!/usr/bin/env python3 """pre_commit_gate_guard.py — git pre-commit enforcement of N15 (layer 3). Rules: 1. Any stage…

PY126 lines4,956 bytes
loom-builder-solother

Pre Commit

#!/usr/bin/env bash # Versioned pre-commit shim (installed via `git config core.hooksPath .githooks`). # All logic lives…

·5 lines254 bytes
loom-builder-solsource

Pretooluse Gate Guard

#!/usr/bin/env python3 """pretooluse_gate_guard.py — Claude Code PreToolUse hook enforcing N15. Blocks Edit/Write/Multi…

PY105 lines3,779 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-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-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-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