Back to work

Case Study · Developer Tooling

Forespec

A standalone, tool-agnostic engine that forces domain foresight before you build a feature, then verifies what actually got built against that foresight — so the expensive discoveries surface in week one, not month three.

StatusEarly build · v0.1.3
RoleSolo — design + engineering
EngineNode · ESM · adapter-based
SurfaceCLI · verifier · PR gate
Distributionnpm · GitHub Action
LicenseBUSL-1.1 · source-available

The failure isn't bad code. It's foresight arriving too late.

AI coding tools answer the literal ask. Nothing in the moment forces a stop to interrogate the non-obvious requirements of a feature. Depth is available but not automatic — and under time pressure it biases even harder toward “just answer it.”

You ask for a checkout. You don't know to ask for an atomic stock hold, so it isn't added. Months later, after Stripe is wired and taking real money, the race condition bites.

Now you're doing surgery on a live payment flow to retrofit something that would have been trivial to design in on day one. Forespec's job isn't more horsepower — it's making that interrogation forced, structured, and live.

Point → build → verify → remember — and the foresight stays alive the whole way.

01PointInterrogate the domain and emit a gotcha-aware spec — the decide-first questions + acceptance criteria, most-foundational pieces first.
02BuildYou — or your AI coder — build against that spec, dangerous and foundational pieces first.
03VerifyGrade what actually got built, flag what’s unsafe, and name the required backbone you haven’t reached yet.
04RememberEvery run writes to a local calibration store behind the pattern/instance wall — so the next run shows what moved and catches a regression before it compounds.

A prompt forgets and walks away after planning. The library compounds and the verifier keeps foresight live— that's the difference between a wrapper and an engine.

Five components, one spine.

01Interrogator

Refuses to just plan a feature. First interrogates what it touches, the non-obvious requirements, and the ordering that prevents rework — the forced foresight pass that can never be skipped.

02Plan Engine

Turns the interrogation into a sequenced plan with the dangerous, foundational pieces first — atomic hold before Stripe wiring, data-model shape before features built on it.

03Checkpoints

The unit of work is a feature with checkable completion criteria. Each gotcha becomes a concrete, verifiable checkpoint with a stable, namespaced id that is a permanent contract.

04Verifier

Reads the real repo and reconciles it against the checkpoints. A reasoning layer catches the fuzzy things; a deterministic assertion layer backstops what is mechanically checkable.

05Pattern Library

Every gotcha is saved as a transferable pattern, walled off from the never-leaves-the-project instance data. The pattern compounds across features and projects; the instance never travels.

The whole tool rests on one number: how often the grader lets a bad thing through.

0False-greens across 52 critical bad cases
≤2.9%Rule-of-three 95% upper bound on the miss rate
5Archetypes composed from one shared library
11Checkpoint domains in the shared library, authored once

A labeled good/bad fixture corpus measures the reasoning verifier's precision, recall, and — the one that matters — its false-green rate. Real grading runs against a validated bar with an ANTHROPIC_API_KEY; without one it falls back to a deterministic keyword baseline that is honest about notbeing a grader to trust. “Is the verifier trustworthy?” becomes a number, not a hope.

You don't have to take that on faith. forespec demo runs a zero-setup, no-API-key walkthrough of a graded run in about 20 seconds — rendered through the same code path as a live verify, against a bundled vulnerable-checkout example, so the demo can never drift from real output. The full CLI installs in one command: npx forespec.

One shared checkpoint library. Every archetype composes it.

ecommerce20 backbone + 7 design checkpoints — the domain the whole engine was validated against first.the standard
saas26 checkpoints, all but 3 reused from the library — only tenancy isolation, entitlement integrity, and subscription lifecycle are SaaS-specific.3 new · 23 reused
ai-app12 checkpoints, 5 AI-specific — prompt injection, output handling, tool-use safety, cost controls, and the data boundary — plus 7 reused from the library.5 new · 7 reused
baas10 checkpoints for Supabase / Firebase backends, 3 BaaS-specific — RLS enforced, the client trust boundary, and privileged-key exposure — plus 7 reused.3 new · 7 reused
portfolio14 checkpoints, 100% composed from the shared library — design, web, and the universal security/privacy set, with zero new authoring.100% reuse

Checkpoints are authored once in the library and composed per archetype. A fix to a shared checkpoint lifts every archetype at once, and each new archetype reuses instead of copies. The portfolio archetype is the proof: a whole standard with nothing new to author.

Pattern / instance wallTransferable patterns and never-leaves-the-project instance data live in physically separate stores from the first write — the legal and ethical line, not a later refactor.
Honesty mechanicEvery score reports its level, the gap to the next, and its basis. A score that can’t state its basis doesn’t ship. Trust the gap, not the number.
Stable, namespaced idsCheckpoint ids like payment.webhook_authenticity are permanent contracts. Archetypes are versioned; checkpoints are never silently renamed — that’s how calibration history survives.
Library + manifest compositionCheckpoints are defined once and composed per archetype as a manifest of { ref, severity }. Fix a shared checkpoint and every archetype improves at once.

Each phase ships real and stands alone. The pearl gets proven before the shell gets built.

P0Walking skeleton — the pipeline end-to-end on one real checkpointShipped
P1Full backbone verifier + deterministic assertion layerShipped
P2Calibration store + passive learning (the spine)Shipped
P3Design dimension — computed, defensible signals onlyShipped
P4The foresight ritual — plan-side, not just verify-sideShipped
P5Proficiency layer — person-aware explanation depthShipped
P6Deferred model-scored design experiments — earned against real data or cutPlanned
P7Reach beyond one machine — multi-user, wall intactPlanned

Build the architecture big.
Ship the v1 small.