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.
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.
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
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.
Related Solutions
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.
Related Solutions
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.
Related Solutions
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.
Related Solutions
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.
Related Solutions
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.
Related Solutions
Invariant Gets Smarter With Other DataGrout Tools
Combine Invariant with the rest of the DataGrout platform to build fully autonomous code intelligence pipelines.
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.
โฆ Zero-touch code review gates for every PR
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.
โฆ Codebase knowledge that survives between sessions
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.
โฆ Always-on code health without burning tokens
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.
โฆ Human-readable code intelligence from structured facts
Integrate Invariant in Minutes
One import. Auth, retries, and error handling all handled by the 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
