polysemic.systems
Metabolism

Digest

The seam layer. Most AI outages live on one boundary: probabilistic output meeting deterministic infrastructure. Digest sits on that seam and makes it a place of digestion instead of rupture.

$ cargo run --quiet -p digest-poc -- demo

Repair, don't throw — and never silently

Fences, surrounding prose, single quotes, Python literals, bare keys, trailing commas: the everyday mess of model output, fixed by named passes. Every fix is an entry in the Repair ledger. Silent repair is just a different kind of lying — your logs see exactly what was done to the text before you trusted it.

  • Six ordered repair passes, string-aware, structure-safe
  • Strict parse attempted first: clean output pays no tax
  • Ledger entries are typed — audit, alert, or reject on any of them

Ambiguity becomes a question, not a coin flip

When a quantity field says "2 or 3", classical code throws and a guesser flips a coin. Digest reads the string for what it actually holds — one meaning, a hedge, or several — and responds in kind: coerce, resolve, or ask.

The result type makes the guarantee structural: there is no state where you receive a value you can't trust.

  • "42" → coerced, with a named record
  • "~5", "about 5" → hedge resolved, with the original kept
  • "2 or 3", "2-3" → a Question with candidates
  • "a few" → an open Question, honestly posed
  • Numbers that would round or underflow are rejected, never silently changed
  • Answers apply only to questioned paths and live in a separate answer ledger

Extra meaning is kept, not refused

Your schema legislates the fields it names — it does not outlaw what it doesn't. Unknown keys pass through untouched, because the model saying more than you asked for is information, not error. The polysemy clause, in code.

Sample several times, commit once

For high-stakes calls, reconcile() digests multiple samples and treats the model's variance as polysemy, not noise: unanimity resolves; a tie becomes a question. A field-wise majority commits the majority reading — repetition standing in for confidence, not truth — with every dissenting sample retained as evidence. An empty sample set is rejected.

  • Unanimity fast-path; field-level majority for objects
  • No majority → Clarify, never a silent pick
  • Per-sample digestions returned for full audit

Retire the 3:12 AM SyntaxError.

Digest is open source, dependency-free, and drops onto the seam you already have. The strict parser inside is the measuring stick; the repairs are the mercy.