Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Example gallery

The reference implementation ships a corpus of twenty example documents in examples/. Every one parses strict-clean (zero errors, zero warnings) under default options — a test enforces it. They double as the playground’s example tray.

Open any of them in the playground to see the graph, or run thoughtml <file> (add --compute for the second reading, --audit for the mirror). The set is designed to span the language: many kinds and relations, both mirror conflicts, the temporal layer, the compute layer, profiles, and imports — across engineering, ops, medicine, science, business, product, security, and AI-agent scenarios.

Start here

ExampleWhat it teaches
ship-the-hotfix.thmlA clean document the mirror still flags — the confidence-vs-status conflict. The flagship demo.
triage-742.thmlThe canonical minimal document: noticed → question → suspects → hold-until. The smallest complete piece of reasoning.
weekend-plan.thmlThe plainest shape: a goal, two options, and the pick — proof it reads naturally for low-stakes reasoning.

Arguments and decisions

ExampleWhat it teaches
pr-feedback.thmlundercuts (attack an inference) versus opposes (attack a claim) — the two distinct ways to push back.
hiring-panel.thmlSeveral interviewers on one call: shared evidence, different confidence, because, per-stance notes.
choose-datastore.thmlAn ADR as a graph: options weighed, one rejected and kept abandoned, a blocking benchmark (until), the question settled.
differential-dx.thmlA clinician’s differential: competing hypotheses, candidate-for proposals versus the answers that resolves.
moderation-decision.thmlAn AI moderation call emitted for a human to audit — the confidence and evidence made inspectable.

Time and memory

ExampleWhat it teaches
launch-readiness.thmlA belief revised twice as evidence lands; earlier versions superseded, not erased. Replay with --as-of.
assistant-memory.thmlAn assistant’s evolving memory: noticed, infers-from sources, remembers, revises, an unknown (?).
merge-conflict-beliefs.thmlThe second mirror conflict: two agents define one focus two ways — definition-divergence, kept losslessly.

Causes, collections, and everyday reasoning

ExampleWhat it teaches
prod-outage.thmlA postmortem as an acyclic causes/enables/prevents graph, with nested scopes and -by attribution.
roadmap-priorities.thmlpart-of for grouping (not evidence), and a question that contains its candidate options as a thought-tree.
bad-oyster.thmlEveryday causal reasoning: suspects a cause and asks the question that would settle it.
replication-study.thmlWeighing a scientific claim: a critique that undercuts a failed replication, with measured/estimated bases.

The compute layer

ExampleWhat it teaches
cloud-bill.thmlA cost model that computes itself: = formulas over line items with full unit-checking (USD/hour × hour = USD).
ship-or-hold.thmlThe whole compute layer in one decision: formula payoffs, a probability borrowed from derived confidence, EV ranking, and a what-if that flips it.

Dialects and modularity (advanced)

ExampleWhat it teaches
threat-model.thmlA profile declaring a security dialect — custom threat/control kinds, mitigates/aggravates relations, likelihood/severity fields, a flags posture.
control-library.thmlA minimal importable library — the building block the rollout imports.
compliance-rollout.thmlimport … as and namespaced cross-document references. Run as a project with its library.

A walkthrough: ship-the-hotfix.thml

The most instructive example is the smallest interesting one:

focus hotfix-is-safe
  kind claim
  The payments hotfix is safe to ship to production now.

focus suite-is-green
  kind observation
  The full unit and integration suite passed on the release branch.

focus canary-errored
  kind observation
  The 5% canary threw a spike of HTTP 500s on checkout within ten minutes.

link suite-is-green supports hotfix-is-safe
link canary-errored opposes hotfix-is-safe

oncall holds hotfix-is-safe
  confidence 0.9 assumed
  note Shipping — the suite is green and the release window closes at 17:00.

Read it through the mirror:

  • Argument status. canary-errored has no attackers → in. It opposes hotfix-is-safe, so hotfix-is-safeout (defeated by its own recorded counter-evidence, even though a passing suite supports it).
  • Conflict. The on-call holds the now-out claim at 0.9 (≥ 0.66) → a confidence-vs-status error.
  • Provenance. That 0.9 is assumed — the mirror shows not just how sure the engineer is, but on what footing.

The document is structurally clean. The mirror surfaces the contradiction the form can’t — and leaves the call to you. That’s ThoughtML in one screen.