Skip to main content

ThoughtML

A plain-text language for reasoning you can check.

📖 Book  ·  ▶ Playground  ·  📁 Examples

docs playground CI license: MIT version

A ThoughtML reasoning graph: a passing test suite supports 'hotfix-is-safe' while a failing canary opposes it — and the mirror flags that it's held at 0.90 confidence though its own recorded evidence defeats it.


Prose is good at stating a conclusion and terrible at showing its shape. You can write three confident paragraphs that quietly contradict themselves, and no tool will say a word.

ThoughtML is a small language that fixes that. You write down what you believe and why — claims, evidence, who holds what, how confident, as of when — and it reads back a typed, dated, defeasible graph. Then it reads that graph a second time, mechanically, and tells you where your own structure disagrees with what you said.

It's a mirror, not an oracle. It shows you the conflict. It does not make the call.

Watch it catch a mistake

A hiring decision, written as ThoughtML:

focus strong-hire
  kind claim
  Alex is a strong hire.

focus aced-interview
  kind observation
  Aced the system-design round.

focus take-home-failed
  kind observation
  The take-home didn't run — tests were failing.

link aced-interview supports strong-hire
link take-home-failed opposes strong-hire

panel holds strong-hire
  confidence 0.9 assumed

This document is clean — zero errors, zero warnings. The syntax is perfect. And yet it's wrong, in a way no spell-checker or linter would ever catch. Run the mirror over it (thoughtml --audit):

"audit": {
  "conflicts": [
    {
      "kind": "confidence-vs-status",
      "severity": "error",
      "message": "`panel` asserts confidence 0.90 in `strong-hire`, but your own structure defeats it (argument status: out)"
    }
  ]
}

The panel is 90% sure of a claim its own recorded evidence defeats — it wrote down that the take-home failed, then made the offer anyway. Nothing about the text is malformed; the reasoning is. ThoughtML surfaces that gap and hands it back to you. (And that 0.9 labels itself assumed, not measured — provenance you can see.)

That's the whole idea in one screen.

▶  Try it live in your browser →
the real parser, compiled to WebAssembly — type on the left, watch the reasoning graph build on the right. No install.

Why now

For as long as reasoning has been expensive to produce, it made sense to trust it by default. That's changing. An AI agent can now emit pages of structured argument at no cost — which means the scarce, valuable thing is no longer producing reasoning but auditing it.

ThoughtML is built for that world. The agent (or you) writes the reasoning down in a form that's explicit enough to check; a human, another agent, or CI reads it back and catches where the confidence betrays the structure. The point was never to compute the answer. It's to make reasoning legible enough that its flaws can't hide.

Writing ThoughtML with an AI? The whole language travels inside the tool. Run thoughtml guide --full for the complete, source-derived spec (or read llms.txt) and paste it into a system prompt. thoughtml guide alone prints a one-screen tour; thoughtml guide <topic> looks up one section.

The concepts

  • Typed reasoning. A focus is an observation, claim, hypothesis, option, decision, goal, assumption, … — not just a box. Foci nest into thought-trees: a claim and the reasoning that hangs off it, as one unit.
  • Defeasible evidence. supports / opposes / undercuts form an argument graph; an opt-in grounded status reads every node as in / out / undecided. Purely structural relations (part-of, candidate-for) let you enumerate without silently inflating confidence.
  • Time is the spine. Beliefs are dated and ordered by valid-time. They can be revised, and a dead end can be abandoned — kept with its reason, not deleted. Redefining a focus never clobbers the first version; both are retained. Replay the whole thing as of any instant (--as-of, or the viewer's play button). Nothing is forgotten.
  • Honest numbers. One strength encoding — a numeric weight — and every authored number can declare its basis: measured / estimated / assumed.
  • The mirror. An opt-in conflict report flags where your structure disagrees with what you said: high confidence in a claim your own evidence defeats (confidence-vs-status), or the same focus defined two incompatible ways (definition-divergence). It reports; it does not decide.
  • Projects with provenance. Split long-running reasoning across imported .thml modules without losing the unified graph. Every compiled object retains its source file and line; imported conclusions can reveal their supporting module reasoning in place and collapse back into the project overview.

What's in the repo

ThoughtML is a language; this repo is its reference implementation. One parser is the single source of truth — everything else is that same parser wearing a different hat, so the browser, the CLI, and the exported file can never disagree.

ThoughtML pipeline: .thml source parses to a surface AST, desugars to a canonical model, and emits canonical JSON — then a second, mirror reading surfaces conflicts.

Piece What it is
Reference parser Rust: source → surface AST → canonical objects → JSON, with diagnostics. The source of truth for the language. crates/thoughtml
CLI toolchain The parser as git-style subcommands — check, fmt, explain, diff, stream — plus the mirror (--audit), the compute layer (--compute), as-of replay (--as-of), and standalone HTML export (--html). same crate
wasm build The same parser compiled for the web, so the playground and the CLI can't drift. crates/thoughtml-wasm
Playground Persistent multi-file editor + unified reasoning graph: a time-driven Viewer with replay and Follow narration, a node-link Structural view, source-aware Reasoning Cards, and standalone/project export. web · live ↗
The book Tutorial, complete language reference, the mirror, and practical guides. docs · live ↗
llms.txt The whole language in one file — embedded in the binary, so thoughtml guide --full prints it too. llms.txt
Example gallery 10 worked, strict-clean standalone documents plus a six-file Snake project — a concrete pour caught by its own evidence, a waterborne-outbreak investigation, two referees on one paper, a re-dated manuscript, a funding panel, an irrigation budget that computes itself, a wildfire evacuation call, and an import pair. examples

Install & run

You don't need any Rust to use the language — only to run the reference implementation.

Install the CLI — pick your ecosystem; all three ship the same binary, no Rust required:

pip install thoughtml          # Python
npm install -g thoughtml       # Node
cargo install thoughtml        # Rust

Prebuilt binaries for macOS, Linux, and Windows are attached to every release.

Run the toolchain — the bare thoughtml <file> still emits the canonical JSON model:

thoughtml guide                                       # the language itself, one screen (--full for all of it)
thoughtml examples/pour-the-slab.thml               # canonical JSON + diagnostics
thoughtml --audit examples/pour-the-slab.thml       # the mirror: where structure disagrees
thoughtml check --json doc.thml                         # diagnostics with stable codes + suggested fixes
thoughtml fmt -w doc.thml                               # format in the one canonical style
thoughtml explain doc.thml some-claim                   # why a node has its confidence / status
thoughtml diff before.thml after.thml                   # a semantic, belief-level diff
thoughtml --html -o record.html examples/grant-panel.thml   # bake to one interactive HTML file
thoughtml stream doc.thml                          # host a live view on this computer

thoughtml stream watches the entry document and its imported files, recompiles locally after settled edits, and gives you a live read-only link. It binds to 127.0.0.1 by default; add --lan to share with devices on a trusted local network. It uploads nothing, requires no account, and works only while that computer and command are running. Private links use secure random tokens; use thoughtml stream status and thoughtml stream stop, or --json --events for an agent-friendly lifecycle.

Full reference: The CLI ↗. Prefer not to install? Run any of it via cargo run -p thoughtml -- …, or just open the playground.

The playground is also a local multi-file editor: open a real .thoughtml/ directory, edit sibling imports in persistent tabs, save back to disk, search the project, and jump from diagnostics or graph nodes to compiler-provided source locations. It detects external agent edits and protects conflicts rather than silently overwriting them. Compilation runs in a worker and produces one unified graph without uploading the selected .thml files. The included six-file Snake project is a ready-made example.

In a unified project graph, imported conclusions stay compact. A subtle stacked-node mark indicates that more reasoning is available; select the node and use Expand reasoning in its floating card to reveal only the supporting ancestry from that module. Collapse reasoning returns to the overview without navigating away.

Hack on the playground locally:

cd web && npm install
npm run wasm    # build the parser to wasm (uses the rustup toolchain)
npm run dev

What you'd use it for

  • Decision records (ADRs) you can lint — the options, the evidence, and the open question that blocks sign-off, all checkable.
  • AI-agent reasoning a human or CI can audit — the agent emits its reasoning; the mirror catches where its confidence betrays its own structure. (guide ↗)
  • Design & code review of an argument — surface "you hold this at 0.9, but your own listed risk defeats it."
  • Incident postmortems as checkable causal graphs, and research / claim maps with provenance on every number.

More in Use cases ↗.

Status

v0.5.0 — correctness and coverage. A known field now either acts or says it cannot, instead of being silently dropped; a bare year on a date field is a date; the toolchain is tested on every platform it ships a binary for; and the mirror has been falsified — what it catches, and what it cannot see, are both written down. See STABILITY.md for what a future 1.0 would freeze.

v0.4.2 — follow-ups. Closes a gap in 0.4.1's stream exposure check, stops thoughtml fmt deleting comments, and fixes a wrong-answer bug in evidence propagation found by the new continuous fuzzing.

v0.4.1 — security release. Upgrade from 0.4.0 or earlier: a security audit found issues in the parser, the viewer, the thoughtml stream server, and the release pipeline, and there is no configuration workaround for most of them. Nothing in the language changed. Details are in CHANGELOG.md and the repository's security advisories.

v0.4.0 — connected reasoning. ThoughtML now scales from one document to a living project: persistent multi-file authoring, authoritative file/line provenance, a unified graph with inline reasoning drill-down, computer-hosted live streams for long-running agents, and self-contained snapshots. Semantic node shapes and one universal Reasoning Card keep the playground, stream, and standalone viewer visually and behaviorally aligned. The core language remains compatible with v0.3.0. The full trail is in CHANGELOG.md; the language and workflows are in the book. The surface may still move — hence 0.x, not 1.0. What 1.0 would freeze, and what it deliberately would not, is written down in STABILITY.md.

Contributing

Issues and ideas are welcome — open one here. The reference parser is the source of truth for the language and the docs are derived from it, so if the two ever disagree, that's a bug worth reporting. Maintainers preparing a tag should follow the complete release checklist.

License

MIT © 2026 Fatin Ishraq.

Release files for thoughtml 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for thoughtml 0.5.0
File
thoughtml-0.5.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
thoughtml-0.5.0-py3-none-manylinux_2_35_x86_64.whl Python 3 none Linux glibc 2.35+ x86-64 Details
thoughtml-0.5.0-py3-none-manylinux_2_35_aarch64.whl Python 3 none Linux glibc 2.35+ ARM64 Details
thoughtml-0.5.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details
thoughtml-0.5.0-py3-none-macosx_10_12_x86_64.whl Python 3 none macOS 10.12+ x86-64 Details

Total release size: 6.3 MB

Release files / thoughtml-0.5.0-py3-none-win_amd64.whl

Download URL thoughtml-0.5.0-py3-none-win_amd64.whl
Size 1.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
bf426eed74047f239a5390907524dc591b36ce6b4e3c6ccf670c719ac8f62c24
BLAKE2b-256 checksum
How to use checksums
c37c2714423a10cd02417ed378bd2a63f4994e25942022a3d10547fe1f8341c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / thoughtml-0.5.0-py3-none-manylinux_2_35_x86_64.whl

Download URL thoughtml-0.5.0-py3-none-manylinux_2_35_x86_64.whl
Size 1.3 MB
Tags Linux glibc 2.35+ x86-64 Python 3
SHA-256 checksum
How to use checksums
fa60d30b0f6e8daf7d97f7ac7bcd1515cbb2fe84f63611cdc1fa980af932c7e9
BLAKE2b-256 checksum
How to use checksums
f266f92264403a8260a22c0b30886b58afac656a1a77b762ac8895e2d7341a12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / thoughtml-0.5.0-py3-none-manylinux_2_35_aarch64.whl

Download URL thoughtml-0.5.0-py3-none-manylinux_2_35_aarch64.whl
Size 1.3 MB
Tags Linux glibc 2.35+ ARM64 Python 3
SHA-256 checksum
How to use checksums
c6c4caa0d11c9ea37c11907b61f32a4f880bf17d9fff7898ebb38d526e10adaf
BLAKE2b-256 checksum
How to use checksums
86933a9b0f04dcd5a825f8edb362f4d0affd871fff11e06f82d6aac89fa1520f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / thoughtml-0.5.0-py3-none-macosx_11_0_arm64.whl

Download URL thoughtml-0.5.0-py3-none-macosx_11_0_arm64.whl
Size 1.3 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0ad64d284359ee6744248907c02fbe87e3a91b71328107dbb5f1a2efe2055caf
BLAKE2b-256 checksum
How to use checksums
92e4b0d9b151e49bb556847b041bd91c7a006df36a6906aef85fb4526236c13d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release files / thoughtml-0.5.0-py3-none-macosx_10_12_x86_64.whl

Download URL thoughtml-0.5.0-py3-none-macosx_10_12_x86_64.whl
Size 1.3 MB
Tags Python 3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
9be9e65fef1608a7e4892d1793584b237bc5b6e0341731fca1b3fcaa444820dd
BLAKE2b-256 checksum
How to use checksums
516ca83c55f74284c66c693f5d33840bb1c780f72ea6391decb622468141a725
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

5 release files

0.4.2

5 release files

0.4.1

5 release files

0.4.0

5 release files

0.3.0

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page