demonstration 5 of 11 · ledger.html
Facts as RDF/OWL triples
The ledger is the memory itself, opened up. Every row is a triple. Every triple names its source and its trust tier, and every term in it is a link you can follow.
What it demonstrates
A chatbot that cites its sources has to have something to cite. This page is that something: the whole fact store, browsable.
It opens on a dashboard. A total fact count, a bar splitting those facts three ways by who says so, an average degree for the graph, a contradiction count, and the most common predicates. Under that sits the ledger proper, one row per triple.
Three filters run down the left. Who says so, splitting taught from corpus from entailed. What kind of fact, splitting is-a from has from can from the rest. And when it was learned.
A chat dock sits in the page. Teach it something there and the whole dashboard redraws off the real post-teach graph, so you can watch a number move because you said a sentence.
Chat you can replayChat you can replay
The dock takes the same sentences the chat page does, against the same engine. These exchanges come from the browser test that drives this page.
Teach a fact through the dock. The total fact count goes up by one and the focus card moves to the new term.
tmct> blue is a peg the reply comes back flagged as taught, and its text says it remembered the fact tmct> what is a blue blue is a kind of peg
Asserted in test-e2e/pages-ledger-teach.test.mjs: the reply is checked for taught: true, the fact-total tile is checked to have gone up by exactly one, and the focus term is checked to be blue. The read-back's exact phrasing comes from the predicate table in src/services/ledger-viz.mjs.
Ask about something nobody taught it. The ledger's own focus stays where it was, because nothing new grounded.
tmct> what is a quokka no claim comes back, and the ledger focus stays where it was
Asserted in test-e2e/pages-ledger-teach.test.mjs, which checks the reply fabricates no claim and the focus term is untouched. The refusal's exact wording depends on the lane; the test asserts the absence of an answer rather than a fixed string, so we quote it that way rather than inventing one.
The dock ingests documents too. Paste text and it reports what grounded and what it skipped.
ingest: 3 sentences read, 2 grounded, 1 skipped LEDGER.terms now carries "zorblex"
Asserted in test-e2e/pages-ledger-teach.test.mjs, which checks the ingest status line and the new term in the ledger's term list.
What it looks like
The dashboard strip, the predicate breakdown, and the taught rows for one term.
peg.What it works out
The shape of a fact. Every row is subject, predicate, object. Predicates carry their vocabulary prefix, so you can see which standard a row belongs to: rdfs:subClassOf and rdf:type come from RDF Schema, and mgx: predicates are tmct's own.
- peg-a rdf:type peg
- disk-1 mgx:rest-on disk-2
- poodle rdfs:subClassOf dog
Who says so. Every fact carries a provenance tag as a string. teach:chat:<session>@<timestamp> means you typed it. ace:chat:... means you typed it and the controlled English parser read it. corpus:conceptnet /r/IsA names a corpus row and the relation it came from. entailed:<rule> means the engine derived it, and names the rule.
How far to trust it. The tag is parsed into a source kind, and each kind has a prior. Operator 1.0, taught 0.95, provider 0.9, corpus 0.7, curated reference 0.6, live reference 0.5, extracted 0.45, optimistic extract 0.35, entailed 0.3. The page buckets a row into one of three tiers off that number.
What it derives. Entailed facts are the ones the engine worked out rather than read. They are stored like any other fact and tagged with the rule that made them, so an entailed row is never mistaken for something you said. They also score lowest, because they rest on premises rather than on a source.
What it retrieves. The focus card computes a digest for a term: a short paragraph composed from that term's own facts, with the sources listed underneath and the raw rows one click away. The minimap walks two hops out from the focus and draws what it finds.
How it is builtHow it is built
src/services/ledger-viz.mjs holds two halves. computeLedgerData is a pure function from a memory payload to rows, terms, edges, contradictions and statistics. renderLedgerHtml turns that into a self-contained page.
The payload comes from scripts/build-demo-memory.mjs, which builds it by actually running teach turns through the engine. The grandfather chain from the README, a set of animal facts with real ConceptNet provenance, and the Tower of Hanoi rules imported from data/games/hanoi-3.txt.
The same page shape is what tmct viz writes on the command line. The deployed copy adds one thing: a browser bundle, so the dock can teach as well as answer. The command line's own output stays the lighter query-only page.
Fact rows are read through src/adapters/memory/core.mjs. Digests are composed by src/adapters/corpus/digest-bank.mjs against a table of sentence structures, read once at build time so no parser ships to the browser.
Related work
The data model follows published standards rather than inventing one. These are the ones it follows.
- W3C, OWL 2 Web Ontology Language Primer, Recommendation, 11 December 2012, with the Profiles note.The class and property vocabulary the labels come from.
- W3C, RDF 1.1 Semantics, Recommendation, 25 February 2014.The triple itself, and what it means to say one. RDF 1.2 reached Candidate Recommendation on 7 April 2026 and reclassifies reification.
- W3C, PROV-O: The PROV Ontology, Recommendation, 30 April 2013.The provenance vocabulary. Where a fact came from is modelled, not annotated.
- W3C, SKOS Reference, Recommendation, 18 August 2009.The concept scheme vocabulary.
- Green, Karvounarakis and Tannen, “Provenance Semirings”, PODS 2007.How provenance composes when one derived fact rests on several sources.
- Jensen et al., “A Consensus Glossary of Temporal Database Concepts”, SIGMOD Record 23(1), 1994.The vocabulary behind the when-learned axis.
- Doyle, “A Truth Maintenance System”, Artificial Intelligence 12(3), 1979.What has to happen to a derived fact when a premise is retracted.
- Artz and Gil, “A survey of trust in computer science and the Semantic Web”, Journal of Web Semantics 5(2), 2007.Candidate literature for the trust tiers. The repository names it as a survey it has read, not as a model it has adopted.
Credits and further reading
The standards above are the credit list. A few more pointers.
- OWL 2 Primer and RDF 1.1 Semantics, the two documents that define what a row on this page means.
- PROV-O, for the provenance model.
- SEON
code.owl, 2012/02, the ontology behind tmct's code-graph classes. - README, “Standards and bibliography”, for the full reference list.