Comuvia SDK / Documentation

Developer reference · 0.1.0 alpha

Record source evidence

Keep a statement, its interpretation and corrections distinct.

Public alpha reference. Version 0.1.0 was published on PyPI on 2026-10-01; pin the version. Release status and verification

Use source-linked records when a research note, article or media claim needs an inspectable trail. The SDK preserves records; it does not extract articles, license source material or decide whether a claim is true.

Preserve the chain

For a paywalled article, you can retain permitted metadata and a source link without republishing the full article. This does not bypass the publisher's rights or make inaccessible source bytes independently verifiable. Record capture limitations and missing assets explicitly.

Run the narrative example

After installing the core and extracting the offline example bundle:

./.venv/Scripts/python.exe ./tutorial_a_narrative.py --fixtures ./fixtures/synthetic --work ./narrative-run

Use a fresh work directory. This is the SDK's supplied source-linked statement tutorial with fictional fixtures. It demonstrates preservation and named exclusions; it does not turn prose or extraction confidence into a scoreable probability.

Validate and verify separately

This fragment operates on your own record.json and permitted retained source bytes:

from pathlib import Path
import comuvia

record = comuvia.load_record(Path("record.json").read_bytes())
identity = comuvia.record_digest(record)
check = comuvia.verify(record, expected_digest=identity)
print(check.record_identity)
print(check.timestamp_assurance)

Recomputing a digest and comparing it to itself is a local consistency demonstration. For an integrity check across a handoff, use the previously retained expected digest from that handoff, not a newly recomputed replacement. Pass retained content and referenced records to verify when those checks apply. Inspect references and assurance fields as well as issues.

Store without overwriting

from comuvia import RecordStore

RecordStore.create("./evidence-store")
with RecordStore("./evidence-store", writer=True) as writer:
    # validated_records must be ordered with referenced records first.
    for record in validated_records:
        writer.append(record)

reader = RecordStore("./evidence-store")
print(reader.verify().ok)

The fragment assumes you already loaded validated_records; the downloadable tutorial supplies the complete workflow. Keep one writer per store. The current locking design is for a single machine, not a distributed database.

Correct the interpretation, keep the quotation

If an extractor misread a source, append a new interpretation revision naming its predecessor. Do not rewrite the source assertion to make the extraction look correct. If the publisher changes the source itself, retain a new snapshot with its own identity and explain how it relates to the previous one.

Extraction confidence remains useful for human review queues. It must never be fed into Brier scoring as the source's probability of an event.

Application checklist

  • Check your right to retain or redistribute the source bytes.
  • Record who made the assertion and who made the interpretation.
  • Retain missing assets, unknown timing and source caveats.
  • Append corrections and preserve references to prior revisions.
  • Share selected records and permitted content, rather than a raw live store.

Next: schemas and errors or evaluation eligibility.

For a plain-language walkthrough of media and statistical data, read Evidence and data quality.