Skip to main content

NomosGuard

LLM produces evidence. Deterministic machinery decides.

NomosGuard is a deterministic security reasoning core: an append-only evidence ledger, a rule engine that derives threat/access paths from that evidence, and a fail-closed policy gate. Language models may read events and write structured claims with cited evidence, and may later explain decisions in human language — but a model never crosses the decision boundary. Every claim without reproducible evidence is discarded; every decision is hash-chained; the gate defaults to deny.

The name: nomos (νόμος) — Greek for rational law, order derived from reason rather than brute force (physis) — plus guard, the fail-closed gate that enforces it. Together: reasoning that decides, evidence that must prove itself.

Why deterministic core + probabilistic edge

A language model's confidence is not evidence — it is an assertion. This project treats it as such:

  • The LLM edge (top): reads raw events, configuration, CVE records, logs; emits structured claims (entities, relations, vulnerabilities, tool calls), each citing the exact evidence fragment (log line hash, config path, CVE ID) that supports it.
  • The deterministic core: an append-only, SHA-256 hash-chained ledger stores every claim; a rule engine derives attack/access paths (MulVAL-style logical inference — pure logic, no randomness, no model); a policy gate decides ALLOW / ALERT / BLOCK, fail-closed.
  • The LLM edge (bottom): explains the decision, drafts remediation suggestions, and proposes next analysis steps. It narrates; it never decides. If the explanation contradicts the evidence chain, the chain wins.

This is the same separation that makes a court work: a lawyer (the model) presents evidence, but the verdict comes from the rules of law (the core), and the transcript is tamper-evident.

Status

Early development — see VISION.md for the architecture, scope, and first-release boundary. The core (evidence ledger, rule engine, policy gate) is implemented with 51 passing tests and a reproducible demo scenario, real log ingestion, and a measured benchmark corpus.

Components

Module What it does
nomosguard.ledger Append-only SHA-256 hash-chained evidence ledger; rejects unevidenced claims; persistent (atomic save, full-chain-verify load)
nomosguard.rules Forward-chaining rule engine with unification; tool-call / CVE / policy extractors
nomosguard.gate Fail-closed policy gate: ALLOW / ALERT / BLOCK with full derivation chains
nomosguard.ingest.toolcall_jsonl Real tool-call JSONL ingestion: each claim cites sha256 of the raw source line
nomosguard.mcp_server MCP session layer: 5 tools (evidence_ingest, assert_claim, derive_paths, decide, explain)
nomosguard.mcp_stdio JSON-RPC stdio server (python -m nomosguard.mcp_stdio)
nomosguard.benchmark Attack-scenario corpus with measured recall / false-positive / fail-closed results
SKILL.md Agent behavioral contract: when to invoke the deterministic chain vs. narrate

Benchmark (measured, not asserted)

Run with python -m nomosguard.benchmark.run_suite_main --output DIR. The corpus is committed and deterministic; the expected outcomes are hand-derived from the facts, not produced by the engine. Latest run:

metric value
scenarios 6
recall 2/2 = 100%
false positives 0
fail-closed on incomplete evidence OK
all scenarios passed yes

What the corpus does NOT cover (stated honestly): real-world logs, evidence tampering inside the ledger (that is the ledger's own test suite's job), and any scenario requiring an LLM to judge.

Ingestion

python -m nomosguard.ingest.cli examples/sample_toolcalls.jsonl [--ledger PATH]

Every accepted record becomes a claim whose evidence field is sha256:<hex> of the raw log line — independently verifiable. Malformed records are rejected with line number and reason; duplicate lines are counted, never re-appended.

Module What it does
nomosguard.ledger Append-only SHA-256 hash-chained evidence ledger; rejects unevidenced claims
nomosguard.rules Forward-chaining rule engine (MulVAL-style) with tool-call / CVE / policy extractors
nomosguard.gate Fail-closed policy gate: ALLOW / ALERT / BLOCK with full derivation chains
nomosguard.mcp_server MCP session layer: 5 tools (evidence_ingest, assert_claim, derive_paths, decide, explain)
nomosguard.mcp_stdio JSON-RPC stdio server (python -m nomosguard.mcp_stdio)
SKILL.md Agent behavioral contract: when to invoke the deterministic chain vs. narrate

Run it

pip install -e .
python -m nomosguard.demo    # committed scenario: derivation + BLOCK
pytest tests/                # 51 tests incl. full stdio protocol
python -m nomosguard.benchmark.run_suite_main   # measured recall / false-positive

Use it from an MCP client

{"command": "python", "args": ["-m", "nomosguard.mcp_stdio"]}

The server never calls a model. Agents load SKILL.md for the behavioral contract: assert claims with evidence, derive paths, read the gate decision, explain it — never decide it.

License

Apache-2.0

Metadata

Release files for nomosguard 0.1.0

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

Source distribution (sdist)

Source distribution for nomosguard 0.1.0
File Size Uploaded
nomosguard-0.1.0.tar.gz 42.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nomosguard 0.1.0
File Interpreter ABI Platform
nomosguard-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 79.6 kB

Release files / nomosguard-0.1.0.tar.gz

Download URL nomosguard-0.1.0.tar.gz
Size 42.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0490fade07c3bf49302e4c8f1d128f28f7322c023e26f04325b6ffa3f302602f
BLAKE2b-256 checksum
How to use checksums
57262c5536ed3783c7113dc2d68bfc629ec28a87922925979a3171a564e7322a
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 Oct 9, 2026.

Transparency log

Release files / nomosguard-0.1.0-py3-none-any.whl

Download URL nomosguard-0.1.0-py3-none-any.whl
Size 37.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5897b59ba75300462d173f0a6b344ca76615aeaef2754634bf5a935bfa909ee
BLAKE2b-256 checksum
How to use checksums
e261cc68a14c0ee6c825ac3eb1abfb22e8b004af2b6c70ed00a05ae08b9fc0c8
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 Oct 9, 2026.

Transparency log

Release history Release notifications | RSS feed

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

This release

0.1.0 This release

2 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