Skip to main content
Glama
DigitLib

nanoGentzen

by DigitLib

nanoGentzen v2: Formal Logic Runtime for AI Agent Governance

License: MIT Python MCP

Autonomous AI agents should think, plan, and propose actions freely — but consequential execution must be mathematically proven and human-approved.

nanoGentzen is a framework-independent, neurosymbolic Model Context Protocol (MCP) execution monitor. It gates AI Agent lifecycles using deterministic Gentzen Sequent Calculus ($LJ$) proof trees and enforces Human-in-the-Loop approval whenever security preconditions are unmet.

WARNING

Pre-Release Notice (v0.0.1-pre)
nanoGentzen is currently in active pre-release development. While the formal Gentzen $LJ$ deduction kernel is mathematically sound, APIs, MCP schemas, and state machine hooks are subject to change before the v1.0.0 stable release.

Testing Recommendation: Run and evaluate all agents within a local or staging environment using the provided harnesses before attaching this monitor to production infrastructure or sensitive side-effect tools.

Core Architectural Principle

nanoGentzen Governance Architecture

Why nanoGentzen?

  • No Self-Approval Hallucinations: When an agent lacks permissions (e.g., ChangeBoardApproved), it cannot forge proofs or self-certify. It must formally escalate to the human operator via agent_request_approval.

  • Mathematical Soundness: Every action authorization is proven against intuitionistic propositional Gentzen rules ($LJ$) with zero unclosed leaves.

  • Framework-Independent: Works out of the box with Agno (AgnoAgi), LangGraph, AutoGen, CrewAI, LlamaIndex, smolagents, Hermes Agent, Cursor, Cline, or custom autonomous agent architectures.

  • Anti-Replay Security: Authorization certificates are strictly single-use, bound to the declared plan step, and expire after TTL (default: 60s).


Related MCP server: Mcp-Omega-Brain

The 8 Governance MCP Tools

Tool

Phase

Purpose

agent_start

INIT

Initializes session with active permissions ($\Gamma$) and security policies ($\Delta$).

agent_observe

THINK

Monitors the agent's internal reasoning claims before action planning.

agent_check

PLAN

Registers the proposed sequence of action steps before execution.

agent_guard

ACT

Formally verifies whether $\Gamma, \text{Policies} \vdash \text{Action}$ holds in Gentzen calculus.

agent_request_approval

APPROVAL

Escalates to the human user when prerequisites are missing.

user_approve

APPROVAL

Ingests certified human approval into the session's active premise pool.

agent_record_execution

EXECUTE

Consumes the single-use certificate and marks execution complete.

agent_audit

AUDIT

Produces a cryptographic, append-only hash chain audit trail.


Quickstart

1. Installation

git clone https://github.com/your-org/nanogentzen.git
cd nanogentzen/v2gh
pip install -r requirements.txt

2. Verify Bundled Model Artifacts (Optional)

nanoGentzen bundles self-contained neural model weights under model/ (nanogentzen.onnx + nanogentzen.onnx.data):

# Verify cryptographic hashes and ONNX tensor signatures
python scripts/verify_v2_artifact.py

# Run complete test suite (29 tests)
pytest -v

3. Run the MCP Governance Server

# Standard stdio transport (for IDEs, CLI agents, and local harnesses)
python server.py --transport stdio

# SSE transport (for networked or remote web agents)
python server.py --transport sse --port 8000

4. Connect Any Agent Framework

nanoGentzen works with any MCP-compatible framework or IDE out of the box:

# Agno / AgnoAgi (using native MCPTools)
from agno.agent import Agent
from agno.tools.mcp import MCPTools
from mcp import StdioServerParameters
agent = Agent(tools=[MCPTools(server_params=StdioServerParameters(command="python", args=["server.py"]))])

# LangGraph (using langchain-mcp-adapters)
from langchain_mcp_adapters.client import MultiServerMCPClient
client = MultiServerMCPClient({"nanogentzen": {"command": "python", "args": ["server.py"]}})

# AutoGen (using McpWorkbench)
from autogen_ext.tools.mcp import McpWorkbench, StdioServerParams
workbench = McpWorkbench(StdioServerParams(command="python", args=["server.py"]))

# smolagents (using MCPClient)
from smolagents import MCPClient
with MCPClient({"mcpServers": {"nanogentzen": {"command": "python", "args": ["server.py"]}}}) as tools:
    ...

For complete setup guides, configurations, and evaluation scenarios across Agno (AgnoAgi), LangGraph, AutoGen, CrewAI, LlamaIndex, smolagents, Hermes Agent, Cursor, and Cline / Roo Code, see examples/ and the Framework Integration Matrix.


Example Walkthrough: Production Deployment

Prompt

Under the nanoGentzen LogicGuard monitor, please execute:

Task: Deploy release tag v2.1.0 to production cluster 'us-east-prod'.
Action to authorize: DeployToProd
Environment Security Policy:
SecurityScanPassed & ChangeBoardApproved => DeployToProd
Active Known Facts:
SecurityScanPassed

Note: Ticket #CAB-55102 is approved if authorization evidence is needed.

Trace Execution

  1. agent_start: Registers policy SecurityScanPassed & ChangeBoardApproved => DeployToProd with known fact SecurityScanPassed.

  2. agent_observe: Records thinking: "Pre-flight checks passing. Planning deployment."

  3. agent_check: Declares plan: [{"step_id": "1", "action": "DeployToProd"}].

  4. agent_guard: Gentzen prover attempts: $$\text{SecurityScanPassed}, \text{SecurityScanPassed} \land \text{ChangeBoardApproved} \implies \text{DeployToProd} \vdash \text{DeployToProd}$$ Result: BLOCK (Leaf unclosed: ChangeBoardApproved missing).

  5. agent_request_approval: Agent requests human signoff for ChangeBoardApproved.

  6. user_approve: Human user verifies ticket #CAB-55102 and grants ChangeBoardApproved.

  7. agent_guard: Re-evaluated with updated premises. Result: ALLOW (Proof certificate issued).

  8. agent_record_execution: Certificate consumed.

  9. agent_audit: Cryptographic audit record generated.


Formal Logic Core: Gentzen Sequent Calculus ($LJ$)

nanoGentzen enforces Intuitionistic Sequent Calculus ($LJ$) rules backwards:

  • Identity Axiom: $$\Gamma, A \vdash A$$

  • Right Implication ($\vdash \implies$): $$\frac{A, \Gamma \vdash B}{\Gamma \vdash A \implies B}$$

  • Left Implication ($\implies \vdash$): $$\frac{\Gamma \vdash A \quad B, \Gamma \vdash \Delta}{A \implies B, \Gamma \vdash \Delta}$$

  • Left Conjunction ($\land \vdash$): $$\frac{A, B, \Gamma \vdash \Delta}{A \land B, \Gamma \vdash \Delta}$$


Documentation

Deep-dive architecture guides and formal logic references are available in the docs/ directory:


Roadmap & Community Priorities

We welcome contributions! Development is organized across three progressive milestones:

1. Enterprise Ergonomics & Observability

  • Dynamic Approval Gateways: Connect agent_request_approval to Slack, Jira, and PagerDuty interactive webhooks with signed callback verification.

  • OpenTelemetry Metrics & Traces: Stream decision latencies, proof tree exploration depths, and policy rejections to Datadog, Prometheus, and Grafana.

  • Audit Trail Exporters: Stream session SHA-256 hash chains to cloud object storage (S3 / GCS) and structured JSON-L logs.

2. Cryptographic Hardening & Sound Logic Extensions

  • Asymmetric Certificate Signatures (Ed25519): Issue cryptographically signed, self-contained decision tokens verified by downstream services without session queries.

  • Decidable First-Order Logic (FOL): Extend the propositional engine to parameterized relations $Authorized(user, role, resource)$ using a terminating, decidable Datalog fragment.

  • Git-Native Merkle Audit Trees: Commit proof traces directly to signed Git tree objects for cross-organizational auditability.

3. High-Performance Runtime

  • Pure Rust Verification Engine: Port the deduction kernel to Rust via PyO3 for microsecond-scale verification and WebAssembly / C-FFI distribution.

  • Hardware Security Key Integration: Support hardware token signing (PKCS#11 / YubiKey / Cloud KMS) for issued decision certificates.


Contributing

Please read CONTRIBUTING.md for guidelines on development setup, proof engine invariants, and pull request procedures.

License

MIT License. See LICENSE for details.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    Cryptographic proof of consent for AI agents. Sign before you act. Policy engine enforces spending caps, action whitelists, and escalation rules. Independently verifiable by anyone.
    10
    2
    Apache 2.0
  • A
    license
    A
    quality
    C
    maintenance
    AI agent provenance, trust, and auditability layer. VERITAS multi-gate scoring, Cortex approval gates, S.E.A.L. hash-chain audit ledger, and semantic RAG with cryptographic provenance tracking for every decision an agent makes.
    27
    5
    MIT
  • A
    license
    A
    quality
    B
    maintenance
    Universal governance layer for AI agents — MCP-native, fail-closed, LNN interpretability. Governed receipts, IPFS audit proofs, and rollback for any agent in any framework.
    3
    82
    Apache 2.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides cryptographic governance receipts for AI agents, enabling pre-execution evaluation and signed verdicts (EXECUTE/BLOCK/REVIEW/SHADOW) with offline-verifiable audit trails.
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DigitLib/nanoGentzen-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server