Developer Tool

Invariant

Semantic code analysis for the AI era. Extract structural facts from any codebase, query them with Prolog, and catch what traditional linters miss — intent mismatches, orphaned functions, and architectural drift. All extracted facts are encrypted at rest.

Static analysis is stuck in the syntax era

Traditional linters check formatting and type errors. They don't understand what your code is supposed to do. When an AI agent writes a function called validate_email that actually deletes records, no linter will catch it. Invariant extracts semantic structure — modules, functions, dependencies, call graphs — into Prolog facts, then lets you query for things that matter: intent mismatches, untested public functions, architectural violations, and consequence analysis.


How It Works

Your Codebase (Python, Rust, TypeScript, Go, Elixir, Ruby)
tree-sitter AST parsing

Invariant CLI (local)

Structural fact extraction — modules, functions, calls, dependencies. Runs in milliseconds on your machine.

Conduit SDK (mTLS)

DataGrout Invariant (server)

LLM intent enrichment, Prolog-backed semantic queries, and cross-repo consequence analysis.

The CLI runs locally for speed — tree-sitter parsing extracts facts in milliseconds. Facts upload to DataGrout Invariant via the Conduit SDK with mTLS authentication and are encrypted at rest on the server. Server-side, LLMs enrich raw structure with intent classification, and Prolog enables queries no traditional tool can answer.


Capabilities

Multi-Language Parsing

Native tree-sitter grammars for Python, Rust, TypeScript, TSX, JavaScript, Go, Elixir, and Ruby. Extracts modules, functions, imports, calls, and visibility — including Ruby's private/protected modifiers — in milliseconds.

Prolog Fact Engine

Every code element becomes a queryable Prolog fact, encrypted at rest. Ask questions like "which public functions have no tests?" or "what breaks if we delete this module?"

Intent Analysis

LLM-powered enrichment classifies what each function is supposed to do. Detects mismatches between function names and actual behavior.

Diff Analysis

Compare before/after code against a stated goal. Get an alignment score, unexpected changes, and concerns — all structured and machine-readable.

Zero-Config mTLS

First run bootstraps a machine identity automatically. No API keys to manage — subsequent runs auto-authenticate via persisted mTLS certificates.

Gitignore-Aware

Respects .gitignore and .ignore files natively. No manual exclusion patterns needed.


See It In Action

# Initialize Invariant (one-time setup)
$ invariant init --url https://gateway.datagrout.ai/servers/{uuid}/mcp --token <token>

# Analyze your codebase
$ invariant lens
Analyzing 142 files...
  Repo:   my-project
  Commit: a1b2c3d4
  Functions: 847
  Facts:     3,291
  ↑ 142 files uploaded to Invariant

# Query for issues
$ invariant query orphans
[orphans] 12 results
  • module: auth.utils, function: hash_legacy, arity: 1
  • module: api.v1, function: deprecated_handler, arity: 2

From zero to semantic insights in three commands. The CLI handles identity bootstrap, file scanning, fact extraction, and server upload automatically.


Use Cases

AI Code Review

Validate AI-generated code against architectural invariants before merging. Catch intent mismatches, orphaned functions, and dependency violations automatically.

Consequence Analysis

Before deleting a module or refactoring an interface, query the fact base to understand downstream impact across your entire codebase.

Continuous Governance

Run Invariant in CI to enforce team conventions — no untested public functions, no circular dependencies, no functions exceeding complexity thresholds.


Composes With

Facts extracted by Invariant feed into Logic for persistent symbolic reasoning. Use Governor for session-aware continuous analysis. Combine with Prism for natural language queries over your codebase structure.