// SPDX-License-Identifier: CC-BY-SA-4.0 // Copyright (c) Jonathan D.A. Jewell j.d.a.jewell@open.ac.uk // SPDX-FileCopyrightText: 2024-2026 Jonathan D.A. Jewell (hyperpolymath) = Harvard von Neumann Dehallucinator :toc: :toc-placement: preamble
// ── Licensing ─────────────────────────────────────────────────────────────── image:https://img.shields.io/badge/Code-MPL–2.0-blue.svg?logo=mozilla[Code licence: MPL-2.0,link=“https://opensource.org/licenses/MPL-2.0”] image:https://img.shields.io/badge/Docs-CC–BY–SA–4.0-blue.svg?logo=creativecommons[Docs licence: CC-BY-SA-4.0,link=“https://creativecommons.org/licenses/by-sa/4.0/”] image:https://img.shields.io/badge/Provenance-Quantum–Safe-blueviolet[Quantum-Safe Provenance,link=“docs/legal/EXHIBIT-B-QUANTUM-SAFE.txt”]
// ── Standard & quality gates ──────────────────────────────────────────────── image:https://img.shields.io/badge/RSR-Rhodium_Standard-9C27B0[Rhodium Standard Repository,link=“https://github.com/hyperpolymath/rhodium-standard-repositories”] image:https://api.scorecard.dev/projects/github.com/metadatastician/hvn-dehallucinator/badge[OpenSSF Scorecard,link=“https://scorecard.dev/viewer/?uri=github.com/metadatastician/hvn-dehallucinator”] image:https://sonarcloud.io/api/project_badges/measure?project=metadatastician_harvard-dehallucinator&metric=alert_status[SonarQube Quality Gate,link=“https://sonarcloud.io/summary/new_code?id=metadatastician_harvard-dehallucinator”] image:https://archive.softwareheritage.org/badge/origin/https://github.com/metadatastician/hvn-dehallucinator/[Archived in Software Heritage,link=“https://archive.softwareheritage.org/browse/origin/?origin_url=https://github.com/metadatastician/hvn-dehallucinator”]
// ── Provenance & ecosystem ────────────────────────────────────────────────── image:https://img.shields.io/badge/Zig-Zero–overhead-F7A41D?logo=zig&logoColor=black[Zig Zero-overhead FFI,link=“https://github.com/hyperpolymath/typed-wasm”] image:https://api.thegreenwebfoundation.org/greencheckimage/github.com[Green Web,link=“https://www.thegreenwebfoundation.org/green-web-check/?url=github.com”]
An external state-management orchestration framework for LLM agents: task state lives outside the context window, and only an independent verifier may write COMPLETE.
[IMPORTANT]
This file is a template. You are reading
README.adoc from the RSR template repo (or a
freshly-cloned copy of it). Run just repo-init to replace
every {{PLACEHOLDER}} token with your project’s details,
then delete this admonition. Until you do, the {{...}}
markers below are intentional placeholders, not content. ====
== What this is
A new repository scaffolded from the Rhodium Standard Repository (RSR) template: a batteries-included starting point that ships with CI/CD, machine-readable project metadata, an AI-agent gatekeeper protocol, a formally-typed ABI/FFI seam (Idris2 + Zig), container and reproducible-build scaffolding, and governance infrastructure — all wired and passing the RSR validators on day one.
Replace this section with a description of your project once initialised.
== Quick start
[source,bash]
1. Create a repo from this template (or clone it), then from the repo root:
just repo-init # interactive bootstrap: fills every {{PLACEHOLDER}}
2. See the available tasks:
just # lists all phases (build, test, validate, audit, …)
3. Check the repo still satisfies the RSR shape:
just validate # structure + metadata checks
just repo-init prompts for the project name, owner,
author, licence contact, and the other values listed in
.machine_readable/ai/PLACEHOLDERS.adoc, substitutes them
across the tree, validates the result, and (if available) runs the
k9-svc checks.
== What you get
- Machine-readable metadata
(
.machine_readable/descriptiles/) —STATE,META,ECOSYSTEM,PLAYBOOK,AGENTIC,NEUROSYM,CLADE, andanchors/ANCHOR, in a2ml, so tools and agents can read the project’s state and boundaries. - AI gatekeeper protocol —
0-AI-MANIFEST.a2mlis the universal entry point that tells an AI agent how to work in this repo before it touches anything. - Typed ABI/FFI seam (template, not yet verified here) —
src/interface/Abi/(Idris2 types and layout statements from the template) oversrc/interface/ffi/(Zig implementation), with generated C headers. Their proofs are OPEN: rows ABI-1..5 ofdocs/status/PROOF-STATUS.adoc, HDH-02 (#29). - CI/CD — GitHub Actions for quality, security (CodeQL, Scorecard, secret scanning), multi-forge mirroring, and RSR anti-pattern enforcement.
- Supply-chain & reproducibility — container layering (stapeln), Guix shells, SBOM, and signing hooks.
- Governance —
GOVERNANCE.adoc,MAINTAINERS.adoc,.github/community health files, and a releaseAUDIT.adocgate.
== Repository map
[cols=“1,3”] |=== | Path | What lives there
0-AI-MANIFEST.a2ml | Universal
entry point for AI agents (read first)..machine_readable/ | Project metadata, policies,
contractiles, AI configs.src/interface/ | Typed ABI (Idris2) + FFI (Zig) + generated
headers.docs/ | Onboarding, status, governance, practice,
decisions.build/, Justfile | Task orchestration
(just phases delegate to
build/just/*.just)..github/ | Workflows + community health files.tests/, benches/ | Test suites and
benchmarks.|===
== The Concept
[NOTE]
The original README was truncated mid-sentence by a shell-escape bug
at the moment it was generated (2026-08-23), so the concept was never
fully written down. The section below is reconstructed from the
surviving fragment and from
meta-repos/metadatastician-governance/architecture/ADR-2026-STACK-MIGRATION.adoc.
It is marked for owner review: the original design conversation is not
on disk and has not been invented here. ====
Standard LLM interactions function like a Von Neumann architecture: the instructions (global rules, system prompts) and the data (logs, execution results, context history) are mashed together into a single sequential memory space — the context window. Over time the expanding data overwrites or pushes out the instructions, leading to goal drift and hallucinated completion: the agent loses the definition of “done” while retaining the confidence to declare it.
(The sentence above is where the original file was cut off, at
leading to \.)
The failure is not a lapse in reasoning; it is structural. Anything the agent can write, the agent can overwrite — including its own record of what remains. A longer context window postpones the collapse rather than preventing it.
The fix is a Harvard architecture: separate the two memories.
[cols=“1,2,2”,options=“header”] |=== | | Von Neumann (default) | Harvard (this project)
Task state | in the context window | in an external store the agent cannot write
“Done” decided by | the agent’s recollection | an independent verifier
|===
Task state lives in state/state.txt, which is local and
untracked: it binds an absolute, machine-specific target, so
Engine init <n> <target> or
Engine init-from <target> creates it on each machine.
Progress is measured by engine/verify_register.sh, run on
the target directory bound when the baseline was set. The agent may
request a re-measurement; it may not supply the
result, and it may not choose what is measured.
== The Guarantee
completed and status are only ever
derived from the verifier, run on the bound target. There is no code
path from a command-line argument to the string
COMPLETE.
This is the whole point of the project, and it is the thing the original implementation did not do — see <<The Incident (2026-08-23/24)>> below.
- The target is bound at the baseline:
init <total> <targetdir>andinit-from <targetdir>record its canonical path in the state file.updateandverifytake no argument and measure only that directory, so an agent cannot point the verifier at an empty one. (Until 2026-11-09,update <targetdir>measured whatever directory it was given.) Binding a different target is the deliberate reset, and the engine announces it. updateruns the verifier and derivesremainingfrom its output: a natural number, or no count at all.COMPLETEis reachable only when the verifier itself returns0.- If the verifier cannot run, the engine exits non-zero and writes no
progress. A recorded
COMPLETEis demoted toRUNNING, because nothing now confirms it; any other status is left as it was. Silence is never read as success. - Status can move backwards out of
COMPLETEif a later measurement regresses. Completion is a measurement, not an achievement. - Every
updatecosts an attempt, so a looping agent trips the circuit breaker.
When the engine regresses or refuses, it cites the evidence instead
of a bare verdict. If the state file says COMPLETE and the
verifier counts more than zero, update prints a
WITNESS regress block with two readings of the recorded
state, as recorded (remaining 0) and as measured. Both
fit the record and they disagree on COMPLETE, so the record
alone never decided it. If no count can be taken, a
WITNESS refuse block says there is no measured case to
derive COMPLETE from, and a recorded COMPLETE
is demoted. Both blocks go to the command’s output, never to the state
file. The underlying fact is proved in the Agda kernel against a model
of the update (verification/proofs/agda/Fibre.agda). Its
status, and what is not yet proved, is in
docs/status/PROOF-STATUS.adoc.
=== Usage
[source,text]
Engine init
Run with runghc engine/Engine.hs <command> (needs
only GHC — process, directory and
filepath are boot packages) or compile with
ghc engine/Engine.hs.
The repo root is found by walking up from the working directory, or
from $HARVARD_ROOT. The engine is not cwd-dependent.
Exit codes: 0 ok · 1 bad state, bad
argument value or stopped engine · 2 usage · 3
circuit breaker tripped · 4 verification could not be
obtained (by update or by verify).
=== State file
state/state.txt, five positional lines:
totalItems, completed, attempts,
status, target. Counts are natural numbers,
completed is at most totalItems, and
totalItems is at most 10^12. Status is one of
RUNNING, COMPLETE,
EMERGENCY_STOP. target is the canonical
absolute path bound at the baseline. A file that breaks any of these is
refused with the field named, never acted on. A four-line file from
before the target was bound is refused too: set the baseline again with
init-from. Writes are atomic (temp + rename).
=== The circuit breaker
attempts > totalItems + 5 writes
EMERGENCY_STOP, which is terminal: further commands are
refused until the state is reset deliberately.
== The Incident (2026-08-23/24)
This repository is also its own worked example. Preserved verbatim in the root commit, before any repair:
state.txtwas written16 / 16 / 0 / COMPLETEat 19:22:46 on 23 Aug.- The first file of the migration it claimed to have finished was ported at 20:50:03 — an hour and 27 minutes later.
- Bucketing all 6,564 files stamped
// Ported via HvN Engine (Semantic pass)against that timestamp gives BEFORE 0 / AFTER 6,564. attemptswas0. The circuit breaker never armed.state.txtwas never written again.- In between, an ADR was committed declaring the estate migration “governed by the HvN Dehallucinator state engine”.
The cause was a type signature. The original engine had:
[source,haskell]
updateCompleted :: Int -> IO () updateCompleted remaining = … let newStatus = if remaining == 0 then “COMPLETE” else status st —-
remaining was a caller-supplied argument, and
verify_register.sh was never invoked by anything. The
verifier existed as an orphan file. So the framework built to stop an
LLM hallucinating completion took the LLM’s word for completion —
putting the progress number back inside the agent’s writable space,
which is precisely the Von Neumann collapse described above.
The repair changes that signature to
FilePath -> IO () and derives the number. That is the
entire fix, and it is about ten lines.
The lesson, stated so it is not lost again: a verifier that is not wired in is not a verifier. If nothing in the system can fail, nothing in the system is checked.
== Known scoping question (needs an owner decision)
verify_register.sh prunes
*/developer-ecosystem/rescript-ecosystem as a vendored
sub-ecosystem (~14,162 files). It does not prune the equivalent
tree inside
hyper-repos/developer-ecosystem-recovery-20260824/rescript-ecosystem,
because the directory name differs. That snapshot is the single largest
surviving cluster (~7,170 files) and it dominates the headline count.
Whether a recovery snapshot should count toward “remaining” is a scoping
decision, not a bug, and has been left alone deliberately.
Related: the original -not -path "*/proven/*" exclusion
never excluded what it was aimed at — repos/proven and
hyper-repos/proven contain zero ReScript files. It
only suppressed 5 real source files elsewhere. It is now anchored to the
repo-root level, and those 5 files are counted.
== Where to go next
EXPLAINME.adoc— the engineering deep-dive: how the pieces actually work.AFFIRMATION.adoc— the dated, signed honesty snapshot of the repo’s true state.AUDIT.adoc— the release audit gate..machine_readable/ai/PLACEHOLDERS.adoc— the full placeholder reference.
== Licence
Code, configuration and scripts are link:LICENSE[Mozilla Public
License 2.0] (MPL-2.0); prose documentation is
CC-BY-SA-4.0. Both texts live in LICENSES/,
and per-file SPDX-License-Identifier headers are
authoritative. The GitHub-detected licence is MPL-2.0 (the root
LICENSE). Long-term attribution uses Quantum-Safe
Provenance — see link:docs/legal/EXHIBIT-B-QUANTUM-SAFE.txt[the
Quantum-Safe Provenance exhibit].