Skip to main content

Deterministic reasoning runtime for AI agents, built on CLIPS via clipspy

Project description

Fathom

A modern Python-first expert system runtime built on CLIPS. Define rules in YAML. Evaluate in microseconds. Zero hallucinations.

PyPI License: MIT Python 3.14+

Current version: 0.3.1

License: MIT

Language: Python 3.14+ (primary), Go and TypeScript SDKs in progress

Package Manager: uv

Maintained by: Kraken Networks


Why Fathom?

Every AI agent framework lets agents decide what to do by guessing. For most tasks, that's fine.

For some tasks, guessing is unacceptable:

  • Policy enforcement — "Is this agent allowed to do this?" can't be a maybe.
  • Data routing — "Which databases should this query hit?" can't hallucinate a source.
  • Compliance — "Did this fleet operate within NIST 800-53 controls?" needs a provable answer.
  • Classification — "What clearance level does this data require?" is not a prompt engineering problem.

Fathom provides deterministic, explainable, auditable reasoning using CLIPS — a battle-tested expert system — wrapped in a modern Python library with YAML-first rule authoring.

Install

uv add fathom-rules

Quick Start

from fathom import Engine

engine = Engine()
engine.load_templates("templates/")
engine.load_rules("rules/")

engine.assert_fact("agent", {
    "id": "agent-alpha",
    "clearance": "secret",
    "purpose": "threat-analysis",
    "session_id": "sess-001",
})

engine.assert_fact("data_request", {
    "agent_id": "agent-alpha",
    "target": "hr_records",
    "classification": "top-secret",
    "action": "read",
})

result = engine.evaluate()
print(result.decision)       # "deny"
print(result.reason)         # "Agent clearance 'secret' insufficient for 'top-secret' data"
print(result.duration_us)    # 47

See the Getting Started guide for a full walkthrough.

What Ships Today

Phase 1–3 of the roadmap are complete; Phase 4 is in progress. See design.md for the full roadmap with status.

Core runtime (Python)

  • YAML compiler for templates, rules, modules, and functions
  • Forward-chaining evaluation with rule + module traces
  • Working memory persistence across evaluations within a session
  • Classification-aware operators (below, meets_or_exceeds, dominates, compartments)
  • Temporal operators (count_exceeds, rate_exceeds, changed_within, last_n, distinct_count, sequence_detected)
  • Rule-assertion actions (then.assert + bind) and user-defined Python functions (Engine.register_function)
  • Structured JSON audit log with append-only sinks
  • Ed25519 attestation service for signed evaluation results
  • Fleet reasoning with Redis and Postgres backends for shared working memory

Integrations

  • FastAPI REST server with bearer-token auth and rule-path jailing
  • gRPC server with bearer-token auth (see protos/fathom.proto)
  • MCP tool server (FathomMCPServer) for agent discovery
  • LangChain adapter callback handler
  • CLIfathom validate, fathom test, fathom bench, fathom info, fathom repl
  • Docker sidecar (Debian slim + uv)
  • Prometheus metrics export (/metrics endpoint)

Rule packs

  • fathom-owasp-agentic — OWASP Agentic Top 10 mitigations
  • fathom-nist-800-53 — Access control, audit, information flow
  • fathom-hipaa — PHI handling, minimum necessary, breach triggers
  • fathom-cmmc — CMMC Level 2+ controls

SDKs (in progress)

  • fathom-go — hand-written REST client (packages/fathom-go/); gRPC regeneration blocked on a go_package path fix
  • fathom-ts@fathom-rules/sdk v0.1.0 (packages/fathom-ts/); OpenAPI-generated client pending
  • fathom-editor — React visual rule editor (packages/fathom-editor/); stub

Core Primitives

Primitive Purpose CLIPS Construct
Templates Define fact schemas with typed slots deftemplate
Facts Typed instances asserted into working memory working memory
Rules Pattern-matching logic with conditions and actions defrule
Modules Namespace rules with controlled execution order defmodule
Functions Reusable logic for conditions and actions deffunction

Key Differentiator: Working Memory

Unlike stateless policy engines (OPA, Cedar), Fathom maintains working memory across evaluations within a session:

  • Cumulative reasoning — "This agent accessed PII from 3 sources — deny the 4th."
  • Temporal patterns — "Denial rate spiked 400% in 10 minutes — escalate."
  • Cross-fact inference — "Agent A passed data to Agent B, who is requesting external access — violation."

Integration Shapes

As a library

from fathom import Engine
engine = Engine.from_rules("rules/")
result = engine.evaluate()

As a REST sidecar

docker run -p 8080:8080 -v ./rules:/rules kraken/fathom:latest
curl -H "Authorization: Bearer $TOKEN" -X POST localhost:8080/v1/evaluate \
  -d '{"facts": [...], "ruleset": "access-control"}'

As a gRPC sidecar

# protos/fathom.proto — regenerate Go/TS clients from the proto
grpcurl -H "authorization: Bearer $TOKEN" \
  -d '{"facts": [...]}' localhost:50051 fathom.v1.Fathom/Evaluate

As an MCP tool

from fathom.integrations.mcp_server import FathomMCPServer
server = FathomMCPServer(engine)
server.serve()

Documentation

Docs live under docs/ and build with MkDocs Material (Diátaxis information architecture).

Entry points:

Performance Targets

Operation Target
Single rule evaluation < 100µs
100-rule evaluation < 500µs
Fact assertion < 10µs
YAML compilation < 50ms

Related Projects

  • Bosun — Agent governance built on Fathom (fleet analysis, compliance attestation)
  • Nautilus — Intelligent data broker built on Fathom (multi-source routing, classification-aware scoping)

Development

git clone https://github.com/KrakenNet/fathom.git
cd fathom
uv sync
uv run pytest           # 1361 tests
uv run mkdocs serve     # docs preview

Run the live REST server locally:

uv run uvicorn fathom.integrations.rest:app --reload

See CHANGELOG.md for release notes.

License

MIT — see LICENSE for details.


Maintained by Kraken Networks · krakennetworks.com · krakn.ai

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fathom_rules-0.3.1.tar.gz (504.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fathom_rules-0.3.1-py3-none-any.whl (86.1 kB view details)

Uploaded Python 3

File details

Details for the file fathom_rules-0.3.1.tar.gz.

File metadata

  • Download URL: fathom_rules-0.3.1.tar.gz
  • Upload date:
  • Size: 504.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fathom_rules-0.3.1.tar.gz
Algorithm Hash digest
SHA256 9c38d85042de7f4369905adfc774c0be4012c8344a05200e9d364bc6e6a00279
MD5 299df3259d899a5fc141c7822da14c43
BLAKE2b-256 5ca925e315307f07817ccabebc0c48b4bfce573916ad8aee205b3fd0d065348c

See more details on using hashes here.

Provenance

The following attestation bundles were made for fathom_rules-0.3.1.tar.gz:

Publisher: pypi-publish.yml on KrakenNet/fathom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fathom_rules-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: fathom_rules-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 86.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fathom_rules-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 270827f51b4ad0d3e236d711bc222fa7250529a5744d0cc01b779db6709e1245
MD5 f289e76b3f1330be223fd9e456cff613
BLAKE2b-256 06488600a865db739ddf55b7369ad9ca2ce9a2308b039ee3dc40f28bcb6d6451

See more details on using hashes here.

Provenance

The following attestation bundles were made for fathom_rules-0.3.1-py3-none-any.whl:

Publisher: pypi-publish.yml on KrakenNet/fathom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page