A .nomos file becomes a verdict with a proof tree in four stages. Everything is deterministic except the fact resolver — which is why the fact resolver carries confidence, authority, and a path to human review.
Every box below links to the actual file in the repository. Nomos is ~15% new code; the rest stands on the shoulders of permissively-licensed OSS — see the stack at the bottom of this page.
contract.nomos
Human-written rules, types, facts, queries.
view source ↗tokens.ts
Chevrotain token definitions — 22 keywords + literals + punctuation.
view source ↗parser.ts
CST parser + visitor → typed AST.
view source ↗checker.ts
Name resolution, symbol table, diagnostics.
view source ↗llm/resolve.ts
Calls OpenRouter for every extract<T>. JSON Schema derived from TypeRef. Self-rated confidence.
view source ↗evaluator.ts
Expression evaluator + rule engine. Temporal validity, is-predicates, binary ops.
view source ↗evaluator.ts · evaluate()
Priority → specificity (lex specialis) → recency (lex posterior) → declaration order. Every tiebreak carries a human-readable summary.
view source ↗EvalResult
Value, winning rule, defeated rules, authorities, per-rule traces.
view source ↗The user writes Nomos source + supplies facts via JSON or by pointing at source documents the LLM will read.
Lex → Parse → Check → Resolve facts (via LLM if any). The fact resolver is the only non-deterministic stage.
A Value + a proof tree. The proof tree names every rule, requirement, authority, and fact used — auditable end to end.
The same core compiles to multiple surfaces. One parser, one evaluator, one source of truth — used from a terminal, a browser, a proxy, an editor, or an agent.
nomos run
/play
nomos-api.dashable.dev
skills/nomos-reason
packages/vscode
Nomos is not built from scratch. The field has fifty years of work; we extend it. Every tool below is permissively licensed and battle-tested somewhere that matters.
Why Nomos exists, and what makes its wedge defensible after fifty years of rules-as-code attempts.
ContextCatala, OpenFisca, Blawx, Kowalski's British Nationality Act, and the others. What we borrow, what we leave.
Build logEvery slice, shipped in public. Nomos is built in the open, commit by commit.