HarperZ9/coherence-membraneExplainer, built from commit da82781All repository explainers

Coherence Membrane

Give an agent observations of files, images and screens that it can re-check.

What it does for you

An agent that edits a file or reads a screen needs a record of what it saw. Coherence Membrane turns files, images, sound, structured data and screen captures into observations with exact hashes and fingerprints, compares later observations against a baseline you authorised, and answers MATCH, DRIFT or UNVERIFIABLE. For logical, arithmetic and graph claims it runs a deterministic checker, so the model proposes and the checker decides.

Source: README.md at da82781 (version 0.2.0 alpha)

Watch

Re-derive it. Don't take it on trust. (2 min 5 s, narrated, captioned). Coherence Membrane keeps a record an agent can re-check, and two independent implementations re-derive the same corpus. Transcript, sources and recall questions.

Video walkthrough: coming with the next release.

How it works, one step at a time

Scroll, or use the step buttons. The panel follows the README's worked example on a small JSON document and two logic claims. Every line is output from coherence-membrane at commit da82781.

  1. 01

    Observe a document

    Observe the JSON document {"a": 1, "b": 2}. The structured-data perceiver records the SHA-256 of the exact bytes and of a canonical form with keys sorted and spacing normalised, along with its type and key count.

    Source: src/coherence_membrane, StructuredDataOrgan

  2. 02

    Pin it, then check what comes later

    Pin that observation as the authorised baseline. Later observations are checked on a ladder: same bytes first, then same canonical form, then perceptual distance where a fingerprint exists. Pick each later document in the panel.

    The same keys in a different order with different spacing are a MATCH on the canonical rung. A changed value is a DRIFT. A broken document is a DRIFT too, and the check says it cannot measure how far.

    Source: src/coherence_membrane/baseline.py

  3. 03

    A claim gets a certificate

    Logic claims go to a deterministic checker. Modus ponens, if A and A implies B then B, is verified: its negation is unsatisfiable. Affirming the consequent, if B and A implies B then A, is refuted, and the certificate gives the counterexample: A false, B true.

    Source: src/coherence_membrane/propositional.py

  4. 04

    A receipt needs its anchor

    emit_receipt wraps an observation in a witness receipt with an anchor you can pin or sign out of band. Verified against the pinned anchor it is VALID. Verified with no anchor it is UNVERIFIABLE: the receipt alone cannot vouch for itself.

    Source: src/coherence_membrane, emit_receipt and verify_receipt

  5. 05

    Two implementations, one corpus

    A frozen corpus of 16 cases is re-derived value for value by the Python reference and by a Node.js core that shares no code with it. Both pass all 16.

    Source: conformance/run.py, impl/js

Walkthrough

Install it, run it once, then use the main feature. Each command below is real, and so is its output.

  1. Install

    Install from a checkout. Python 3.10 or newer; this tree is the 0.2.0 alpha.

    $ git clone https://github.com/HarperZ9/coherence-membrane && cd coherence-membrane
    $ python -m pip install -e ".[test]"
    $ python -m coherence_membrane selftest
  2. First run: observe a document

    In Python, observe a small JSON document. The observation records exact and canonical hashes.

    >>> StructuredDataOrgan().observe(b'{"a": 1, "b": 2}')
    identity_sha256   d8497d9d82770a70...
    canonical_sha256  43258cff783fe703...
    top_level_type    object
    key_count         2
  3. Check a claim

    A logic claim goes to a deterministic checker. A refutation carries its counterexample.

    claim: ((B & (A -> B)) -> A)
    oracle    propositional-dpll-v1
    evidence  counterexample A = 0, B = 1
  4. Run the conformance corpus

    Re-derive the 16-case corpus in Python, then in the independent Node.js core.

    $ python conformance/run.py
    {"cases": 16, "passed": 16, "failed": 0, "corpus_sha256": "0748fc1adef9753d..."}

Output from coherence-membrane at da82781 on Windows with Python 3.12 and Node 25. The class names in code use the word organ; this page calls them perceivers.

What it does not do

Source: README.md at da82781, "Install" and "Quickstart"

Check what stuck

Answer each one in your head before you open it.

Why is { "b": 2, "a": 1 } a MATCH against { "a": 1, "b": 2 }?

Their canonical forms are equal, so the ladder matches on its second rung.

What does the refutation of affirming the consequent carry?

A counterexample: A false and B true.

Why is a receipt UNVERIFIABLE without an anchor?

Nothing outside the receipt vouches for it until you pin or sign its anchor.