๐Ÿงฌ Speckl

Judgement Transport for AI-Generated Code
Specify โ†’ Verify โ†’ Generate โ†’ Prove. Every artifact traceable to its origin.

๐Ÿ“‹ The Problem

AI code generators produce outputs at machine speed โ€” but they can't explain why they made a decision. For regulated industries (medical devices, aerospace, critical infrastructure), that's disqualifying. NIST SA-11 and the EU Cyber Resilience Act both require human-in-the-loop oversight for automated outputs.

Speckl is judgement transport: it bridges the gap between "the AI says X is correct" and "here is a verifiable chain of evidence proving X is correct." It's the compliance layer for AI-generated code.

โš™๏ธ The Pipeline

๐Ÿ“
SpeckDL
Human-authored spec with constraints
โ†’
๐Ÿ”
Z3 Verify
SMT solver checks invariants
โ†’
โšก
Codegen
TypeScript / Rust from verified spec
โ†’
๐Ÿ”—
Provenance
Immutable trace from spec to code

๐ŸŸข Live Demo: RetryHandler

Here's a real Speck for an exponential-backoff retry handler, running through the reference agent.

Step 1 โ€” SpeckDL Specification

// RetryHandler.speck โ€” Exponential backoff with constraint verification speck RetryHandler { input: { operation: Operation, maxRetries: Nat, initialDelay: Real } output: { success: Bool, attemptCount: Nat, totalDelay: Real } // Invariants โ€” must always hold constraint: maxRetries <= 10 constraint: initialDelay > 0 constraint: totalDelay == sum(delays) constraint: totalDelay <= 30s constraint: backoff(delay(n)) == delay(n-1) * 2 // Verification conditions verify: always(implies(attempt > 1, delay > 0)) verify: always(implies(attemptCount == maxRetries + 1, not success)) // Design provenance + traceability derives from FaultHandler satisfies RESILIENCE-REQ-01 author: Scott Scoble review: manual }

Step 2 โ€” Agent Output (Run Live)

$ speckl run RetryHandler.speck ๐Ÿงฌ Processing Speck: RetryHandler Constraints: 8 Verify conditions: 2 โ”Œโ”€ Verification Phase โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Task task-1: success โ”‚ โ”‚ Z3 result: sat โ”‚ โ”‚ All constraints verified โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”Œโ”€ Codegen Phase โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Task task-2: success โ”‚ โ”‚ Generated typescript code (27 lines) โ”‚ โ”‚ Interface + constraint guards emitted โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โœ… Result: success | Duration: 1ms

Step 3 โ€” Generated TypeScript

/** Generated from Speck: RetryHandler */ export interface RetryHandlerInput { operation: Operation; maxRetries: number; initialDelay: number; maxDelay: number; } export type RetryHandlerOutput = { success: boolean; finalResult: string; attemptCount: number; totalDelay: number; }; export function retryhandler(input: RetryHandlerInput): RetryHandlerOutput { // Constraint checks (runtime guards) // constraint: maxRetries <= 10 // assert(maxRetries <= 10, "c1"); // constraint: maxRetries >= 0 // assert(maxRetries >= 0, "c2"); // constraint: initialDelay > 0 // assert(initialDelay > 0, "c3"); // constraint: maxDelay >= initialDelay // assert(maxDelay >= initialDelay, "c4"); // constraint: totalDelay == sum(delays) // assert(totalDelay == sum(delays), "c5"); // constraint: totalDelay <= 30s // assert(totalDelay <= 30s, "c6"); // constraint: backoff(delay(n)) == delay(n-1) * 2 // assert(backoff(delay(n)) == delay(n-1) * 2, "c7"); // constraint: delay(n) <= maxDelay // assert(delay(n) <= maxDelay, "c8"); // Implementation โ€” compiled from verified DST throw new Error("RetryHandler: implementation pending DST compilation"); }

Step 4 โ€” Provenance Graph (Dark Provenance)

speck:RetryHandler โ†’ z3:task-1 verified_by Z3 4.12.5
speck:RetryHandler โ†’ code:task-2 generated_from speckl-codegen
Every derivation is recorded. Every artifact is traceable. This is your compliance audit trail.

๐Ÿค– Agent Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Orchestrator โ”‚ โ”‚ Accepts Specks, decomposes tasks โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Team Lead โ”‚ โ”‚ Team Lead โ”‚ โ”‚ Verification โ”‚ โ”‚ Codegen โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Z3 SME โ”‚ โ”‚ TypeScript SME โ”‚ โ”‚ (verify) โ”‚ โ”‚ (emit) โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ // Tiered agents with TillDone condition-based task tracking // Every SME records provenance edges for full traceability

๐Ÿ“œ Compliance Mapping

NIST SA-11: Developer Testing and Evaluation โ€” requires human review of automated outputs

EU Cyber Resilience Act: Reporting obligations from Sept 11, 2026 โ€” requires SBOM + compliance evidence

FDA Software as Medical Device (SaMD): IEC 62304 โ€” requires traceability from requirements to code

Speckl maps directly to these requirements:

RequirementSpeckl Feature
Human-in-the-loop reviewmanual review flag + sign-off provenance
SBOM generationBOM block โ†’ CycloneDX / SPDX export
TraceabilityDark Provenance graph โ€” every derivation recorded
Constraint verificationZ3 SMT solver โ€” mathematical proof of correctness

๐Ÿ“Š Current Status

5
Example Specks
3
Compilation Targets (PROV-O, CycloneDX, SPDX)
9
Validation Checks
v0.3
Validator CLI
MIT
License
$0
Cost to Run

๐Ÿš€ Ready to bring compliance to your AI-generated code?

Open standard โ€” github | codeberg mirror | speckl.scoble.me

Consulting, pilots, and speaking: scott@scoble.me