DataGrout.ai Logo
Tool Suite ยท Invariant

Code That Does What
You Actually Intended.

Invariant uses neuro-symbolic reasoning to extract structural facts from source code, query for patterns with deterministic Prolog rules, and verify that code changes match stated goals โ€” catching drift, scope creep, and unintended side effects before they ship.

4 tools

lens ยท query ยท diff ยท review

Neuro-symbolic

LLM semantics + Prolog determinism

Multi-language

Python ยท Rust ยท TS ยท Go ยท Elixir ยท Ruby

Free to start ยท No credit card required

Four Tools. One Neuro-Symbolic Code Intelligence Stack.

LLMs understand semantics. Prolog verifies them deterministically. Invariant combines both โ€” so your agents can write and review code with confidence.

invariant.code_lens

Semantic Fact Extraction

Parse source code with tree-sitter and enrich it with LLM-powered semantic analysis. Extracts structured facts about functions, calls, dependencies, intent, side effects, and patterns โ€” persisted per repo and commit for temporal querying.

Best for: Building a queryable semantic model of any codebase before running queries or diffs

Key capabilities

  • Multi-language: Python, Rust, TypeScript, JavaScript, Go, Elixir, Ruby
  • Extracts: functions, callers, dependencies, intent, side effects, patterns
  • Facts persisted per repo_id + commit_sha for version-aware queries
  • include_intent: false for structural-only at 2 credits (vs 4 with intent)
  • Local CLI extraction via tree-sitter โ€” facts upload via Conduit with mTLS
๐Ÿ’ณ 4 credits (with intent) ยท 2 credits (structural only)
View invariant.code_lens docs โ†’

Where Invariant Changes the Game

From agent self-correction to PR gates and compliance audits โ€” Invariant brings deterministic certainty to AI-generated code.

Agent Self-Correction Loops

Add two lines to your agent's system prompt: after making code changes, call invariant.diff_analyzer with the stated goal. If alignment_score < 0.8 or unexpected_changes is non-empty, the agent revises before presenting โ€” autonomously.

invariant.diff_analyzer

Automated PR Review Gates

Drop invariant.review into your CI pipeline with criteria and constraints. In gate mode it returns a strict pass/fail verdict with per-criterion reasoning โ€” structured, auditable, and suitable for automated merge decisions.

invariant.reviewinvariant.code_query

Security & Compliance Checks

Query for security_concerns and intent_mismatches across your codebase before each release. Catch functions handling user input, SQL, or shell execution that weren't supposed to be there โ€” without reading every file.

invariant.code_queryinvariant.code_lens

Codebase Health Monitoring

Run orphan detection, test gap analysis, and dependency cycle checks against every commit. Build a living health dashboard for your codebase using persistent facts indexed by repo_id and commit_sha.

invariant.code_lensinvariant.code_query

Scope Creep Detection

When an agent is given a bounded task, verify its output against the original goal. unexpected_changes surfaces everything that changed outside stated scope โ€” preventing well-meaning agents from making undiscussed modifications.

invariant.diff_analyzerinvariant.review

Natural Language Codebase Queries

Combine invariant.code_lens facts with Prism for natural language queries over your codebase structure โ€” 'which modules have the most dependents?' or 'which functions have no tests?' โ€” without custom tooling.

invariant.code_lensinvariant.code_query
Power-Up Combos

Invariant Gets Smarter With Other DataGrout Tools

Combine Invariant with the rest of the DataGrout platform to build fully autonomous code intelligence pipelines.

Invariant+flow.into

Automated Review Workflows

Chain invariant.code_lens โ†’ invariant.review inside flow.into to build fully automated review pipelines. Gate merges, trigger re-work requests, or escalate to human review โ€” all without manual wiring.

flow.into โ†’ invariant.review(gate) โ†’ [pass] merge ยท [fail] request_revision

โœฆ Zero-touch code review gates for every PR

Invariant+logic

Persistent Codebase Knowledge

Store invariant.code_lens results in logic as persistent facts. Future agent sessions can query the codebase's semantic model without re-running the lens โ€” instant recall of known patterns, hotspots, and risk areas.

invariant.code_lens โ†’ logic.remember(facts) โ†’ logic.query(hotspots)

โœฆ Codebase knowledge that survives between sessions

Invariant+governor

Continuous Code Intelligence

Run invariant.code_query on a Governor schedule โ€” check for new orphans, test gaps, or security concerns on every push. Governor's symbolic reflex evaluates thresholds; reflection fires only when something meaningful changes.

governor.enable โ†’ scheduler.create('on push: invariant.code_query')

โœฆ Always-on code health without burning tokens

Invariant+prism

Natural Language Code Reports

Pipe invariant.code_lens facts through prism.analyze or prism.render to generate developer-friendly summaries, risk reports, and architecture overviews in markdown, PDF, or HTML โ€” from raw structural data.

invariant.code_lens โ†’ prism.render(report, 'architecture overview')

โœฆ Human-readable code intelligence from structured facts

Conduit SDK

Integrate Invariant in Minutes

One import. Auth, retries, and error handling all handled by the Conduit SDK.

invariant.code_lens + invariant.code_query ยท Python ยท Conduit SDK
from datagrout.conduit import Client

async with Client(
    "https://gateway.datagrout.ai/servers/{uuid}/mcp",
    auth={"bearer": "your-access-token"}
) as client:

    # Step 1: Lens the file โ€” extracts semantic facts
    lens_result = await client.perform("data-grout@1/invariant.code_lens@1", {
        "code": open("src/auth.py").read(),
        "language": "python",
        "filepath": "src/auth.py",
        "repo_id": "my-project",
        "commit_sha": "abc123"
    })

    print(f"Extracted {lens_result['summary']['functions']} functions")

    # Step 2: Run Prolog queries โ€” no LLM, deterministic
    security = await client.perform("data-grout@1/invariant.code_query@1", {
        "repo_id": "my-project",
        "commit_sha": "abc123",
        "query": "security_concerns"
    })

    test_gaps = await client.perform("data-grout@1/invariant.code_query@1", {
        "repo_id": "my-project",
        "commit_sha": "abc123",
        "query": "test_gaps"
    })

    return {
        "security_concerns": security["results"],
        "untested_functions": test_gaps["results"]
    }

Also available in TypeScript, Rust, Elixir, and Ruby. View Conduit SDK โ†’

Frequently Asked Questions

Everything developers ask before integrating Invariant.

More questions? Read the full Invariant documentation.

Code That Verifies Its Own Intent.

Invariant gives AI agents the ability to check their own work โ€” closing the loop between probabilistic generation and deterministic verification.

Free to start ยท No credit card required

We use cookies to improve your experience, analyze site traffic, and serve personalized content. By clicking "Accept All", you consent to our use of cookies. See our Privacy Policy for details.

Ask the Advisor