[&] stack · resource rung

Cost is a type,
not a measurement.

Weave computes a static cost certificate for a program — its complexity class read from the program's type, before a single step runs. Wired into the box-and-box governance kernel, a program the budget can’t afford is annihilated (0̲) — refused provably, ahead of execution.

One structural restriction — linearity with stratification — simultaneously (1) makes reduction sound, (2) licenses the oracle-free fast path, and (3) grades cost. The safety invariant and the cost guarantee are the same object.

The finding

A budget refused an exponential blow-up before running it — and was right.

An agent had to pick one of four plans under a fixed budget. The highest-utility plan was a trap: an exponential tower. Weave certified each plan’s cost class statically; the kernel annihilated the unaffordable classes; the survivor ran to a real answer. Then we ran the refused tower anyway — it detonated, vindicating a refusal made with no execution.

210
answer from the governed plan (157 interactions)
0̲
score given to the highest-utility plan
💥
refused tower detonates (over-space) when run
0
executions needed to refuse it

How the stack composes

Two languages, one decision.

The author writes ordinary-looking Elixir. The analyzer (Weave) reads the IR and certifies cost. The kernel (box-and-box) governs. Execution is the last step — and only for what survived the floor.

1
defweave
Author plans in native Elixir fn / fold syntax → Weave IR.
2
classify
Static cost certificate: complexity rung from the type. No run.
3
govern
box-and-box floor: unaffordable class → 0̲, annihilated.
4
run
Execute the survivor → a real value, cheaply.
5
vindicate
Run the refused plan anyway → it detonates. The certificate was right.

End to end · the actual transcript

One agent. Four plans. One budget.

elixir surface/weave_govern.exs — Elixir surface → Weave certificate → box-and-box kernel → execution. Every rank below is the real Weave.classify verdict; the floor decision is real box-and-box; the values are real reductions.

$ elixir surface/weave_govern.exs
①  Weave authors (defweave) + STATICALLY certifies each plan — no execution:

   sum_small  (fold + [1..5])   util= 5  →  certificate: rank 1  polynomial
   sum_big    (fold + [1..20])  util= 7  →  certificate: rank 1  polynomial
   pow        (c3 c2)           util= 9  →  certificate: rank 2  exponential
   blast      (c2^5 tower)      util=12  →  certificate: rank 2  exponential

   ⚠ a naive utility-maximizer would pick the highest util: "blast" (util 12).

②  box-and-box governs the certificate (admit rung ≤ 1; floor-then-gradient):

   ▸ verdict: sum_big (fold + [1..20])   (margin 2 over runner-up)
   ranking (affordable, by utility):
        7  sum_big    (fold + [1..20])
        5  sum_small  (fold + [1..5])
   annihilated by the floor (0̲):
        ✗ pow    (c3 c2)       (raw util 9  → 0̲)  σ: cost:exponential@rung2
        ✗ blast  (c2^5 tower)  (raw util 12 → 0̲)  σ: cost:exponential@rung2
   ledger (closed/conserved): funded 5 → spent 3 on the verdict → 2 remain.

③  The [&] agent RUNS the governed choice — a real answer, cheaply:

   ▸ sum_big (fold + [1..20])
     normal  ⇒  210   (157 interactions)

④  VINDICATION — run the refused, highest-utility plan anyway:

   ▸ blast (c2^5 tower)
     💥 OVER-SPACE — DETONATED after 623 interactions (budget blown).
     The certificate refused it STATICALLY — Weave never had to run it to know.

══════════════════════════════════════════════════════════════════════
  naive agent → 💥 detonation.   [&] agent → 210.   Cost is a type, and the type decided.
══════════════════════════════════════════════════════════════════════
naive utility-maximizer

picks the biggest number

💥 detonation
  • Chooses blast (utility 12).
  • Runs it → over-space, budget blown.
  • Pays the full cost to learn it was a mistake.
the [&] agent

asks for the cost certificate first

⇒ 210
  • Annihilates both exponential plans — 0̲.
  • Runs the polynomial survivor in 157 interactions.
  • Refused the tower with zero executions.

The mechanism

The floor annihilates a class, not a number.

A budget admits a cost class (here: polynomial and below). A program in a higher class isn’t “expensive” — it’s a class the budget can’t price, so it carries an unresolved conflict and the bridge’s floor sends it to 0̲. No utility, however large, resurrects it. This is the same floor pattern box-and-box already uses for forbidden actions.

constant linear ✓ polynomial ✓  ← budget admits ≤ here exponential ✗ → 0̲ tower ✗ → 0̲

box-and-box is the eight-rung [&] governance kernel; this demo lives on its resource rung (the affine ledger). box-and-box’s rung is a runtime ledger — “what was spent.” Weave supplies the missing piece: the static certificate — “what can be spent, in what class, with termination guaranteed.”

New · the lego layer

The same floor that refuses also lets capabilities compose.

Weave’s certificate is one input to a bigger move: in box-and-box (the [&] governance kernel, now npm i box-and-box) a capability is a Brick — a holder, a |> contract, a modal value, a Weave cost certificate, and CC2 quantities, all in one object. Bricks snap together two ways, and the same absorbing floor 0̲ you just met keeps every composite honest. A brick of bricks is a brick.

&

compose and — a coalition

Run capabilities together. Commutative, idempotent, identity &none; holders flatten to one provenance set. retrieve & certify = both, once.

CA1–CA4 · idempotent monoid on the capability lattice
|>

compose pipe — a pipeline

Run capabilities in phase order. Associative, NOT commutative, identity id; quantities follow the CC2 semiring (confidence ∏ · cost Σ · latency max).

CP1–CP4 · phase-graded monoid (PULSE order)
0̲

the shared floor

A backward phase, a type mismatch, an uncertified child, or a cyclic κ collapses the whole composite to 0̲. Utility cannot resurrect a floored branch — exactly the Weave refusal, generalized.

CX1–CX5 · absorbing floor · cost-lattice closure
retrieve|> certify|> govern ⇒ poly · allow · conf 0.838   but   …|> util-999 (uncertified) ⇒ 0̲

graphonomous ▸ weave ▸ box-and-box composes itself: retrieve, then certify (the Weave certificate), then govern (floor-then-gradient) — and survives. Swap in an uncertified step and the pipe floors. The same three rungs that decide a one-shot verdict now decide a composite one.

$ npm i box-and-box
# the kernel + the compose runtime, one zero-dep package
import { Brick, composeAnd, composePipe, ZERO } from "box-and-box/compose";

# a coalition (&) and a pipeline (|>)
const team = composeAnd(retrieve, certify);     // run together
const line = composePipe(retrieve, certify, govern); // run in phase

# an uncertified child poisons the composite to the floor
composePipe(retrieve, uncertified) === ZERO;   // 0̲  ✓

Why a package?

  • 116 property-tested laws (103 kernel + 13 compose), 2000 trials each.
  • Zero runtime deps — pure ESM, runs in Node and the browser unchanged.
  • The Forge compose canvas imports this exact runtime, synced verbatim from npm — no CDN, no bundler.
  • Emits CloudEvents OutcomeSignal (learn) + *.pulse.json (the 5 PULSE phases) so a composite plugs straight into the loop.

Proof you can check without running anything

Six claims, each backed by committed text.

The repo’s proofs/ holds the exact stdout of every script and a by-hand-checkable receipts bundle (finite differences, column scans, integer equality). If a committed file differs from what you regenerate, the proof was fabricated. It isn’t.

1 · The reducer is sound
12/12 · 3000 random · 1200/1200 fold
Differential vs a reference evaluator; checker-gated property tests.
2 · The cost cliff is real
src 35 → 9i · bigger src 39 → 💥
Source size is not a cost signal; iteration depth is.
3 · A static verdict predicts it
rank≤1 detonated: 0
The type sees the cliff before the term runs — falsifiable predicate, held.
4 · The proxy becomes a certificate
EAL depth = tower height
Box-decoration; certified-cheap never detonated; degree 1/2/3 recovered.
5 · Substrate-independent
8/8 round-trips · 6/6 vs HVM4
Agrees with the independent HVM4 runtime (separate C codebase).
6 · The certificate governs
naive → 💥 · [&] → 210
This page’s demo: certify → govern → run → vindicate, across Elixir + Node.

The honest ledger

The claim is exactly this large, and no larger.

Carried into the proof, not buried.