Skip to main content
Glama

🌌 OntoAgent

The All-Knowing Code Brain & Architecture Contract Guard for AI Coding Agents

A repository-wide cognitive knowledge graph and architecture governance engine for AI coding agents.

CI Python 3.10+ License: Apache-2.0 Embedded KΓΉzu DB MCP Supported DSH Compatible Benchmark


πŸ“– Why OntoAgent?

Modern coding agents face three structural problems when working with large codebases:

  1. Blind men and the elephant: They only see the current file, not cross-module callers, API contracts, and test dependencies.

  2. Long-context hallucination: "Brute-forcing" the entire repository into the Prompt costs a lot of tokens, has a low signal-to-noise ratio, and the model tends to ignore critical constraints.

  3. Destructive changes are hard to trace: Changing one core class makes it hard to quickly know which upstream modules, tests, and interfaces will break together.

Traditional approaches:

  • Naive Raw Text: Stuff everything into the context β€” huge token usage and no structured targeting.

  • Vector-Chunk RAG: Chunks by text similarity, compresses tokens, but loses AST-level dependencies, inheritance relationships, and contract semantics.

OntoAgent's choice:

Use AST static parsing + embedded graph database to build a repository-wide cognitive graph, so AI agents see the call network, contracts, tests, and blast radius before modifying code.


Related MCP server: code-intel

πŸ›οΈ Architecture Flow

graph TD
    subgraph Base["底座层"]
        Kuzu["KΓΉzu Embedded Graph DB"]
        AST["AST Parsers: Python / TypeScript / Markdown / JSON"]
    end

    subgraph Core["ζ ΈεΏƒεΌ•ζ“Ž"]
        Blast["Blast Radius Analyzer"]
        Context["Smart Context Extractor"]
        Compliance["Architecture Compliance Guard"]
        Scanner["Codebase Scanner & Entity Ingestion"]
    end

    subgraph Ecosystem["δΊ€δΊ’η”Ÿζ€"]
        MCP["MCP Server"]
        DSH["DSH / Cordis Plugin"]
        CLI["onto-agent CLI"]
        Dashboard["React 2D Canvas + Dagre Dashboard"]
    end

    AST --> Scanner
    Scanner --> Kuzu
    Kuzu --> Blast
    Kuzu --> Context
    Kuzu --> Compliance
    Blast --> MCP
    Context --> DSH
    Compliance --> CLI
    Scanner --> Dashboard

πŸ“Š Benchmark

Reproduce with one command:

python benchmark/run_benchmark.py

Based on deterministic code fixtures, comparing three context construction strategies:

Method

Tokens

Token Reduction

Critical Dep Recall

Test & Contract Recall

Blast Precision

Blast Recall

Blast F1

A. Naive Raw Text

1162

0.0%

100.0%

100.0%

50.0%

100.0%

66.7%

B. Vector-Chunk RAG

282

75.7%

0.0%

66.7%

60.0%

60.0%

60.0%

C. OntoAgent AST Graph

120

89.7%

100.0%

100.0%

100.0%

100.0%

100.0%

Conclusions:

  • OntoAgent reduces token consumption by about 89.7% compared to Naive Raw Text.

  • OntoAgent leads Vector-Chunk RAG across the board in critical dependency recall, test/contract recall, and blast radius targeting.

  • Full report: benchmark/reports/benchmark_report.md.


πŸš€ Quickstart

1. Install

pip install -e .[test]

2. Scan the entire repository

onto-agent scan --path .

3. Launch the visualization workbench

python dashboard/api_server.py
# 打开 http://127.0.0.1:8000

4. Configure MCP

Copy integrations/cursor_mcp.json to .cursor/mcp.json, or merge it in Claude Desktop:

{
  "mcpServers": {
    "onto-agent": {
      "command": "python",
      "args": ["-m", "onto_agent.mcp"]
    }
  }
}

5. Install the DSH native plugin

dsh plugin --profile web add ./integrations/dsh/onto-agent-plugin

🧠 Agent Abilities

get_blast_radius(file_path)

Before modifying any file/symbol, returns:

  • Direct callers

  • Indirectly affected modules

  • Downstream dependencies

  • Associated API contracts

  • Tests that must be run

check_architecture_compliance(strict=True)

Checks:

  • Circular imports

  • Cross-layer violation calls

  • Core classes not covered by tests

get_smart_context(query_or_symbol)

Generates high signal-to-noise context before refactoring/generation:

  • Definition, line numbers, Docstring

  • Class/function list

  • imports / callers

  • API contracts, related tests, related documentation


πŸ”Œ Ecosystem

Entry

Method

MCP

10 tools including onto_get_blast_radius, onto_check_architecture_compliance, onto_get_smart_context

DSH

integrations/dsh/onto-agent-plugin, native Cordis plugin

CLI

onto-agent blast-radius, onto-agent compliance, onto-agent context

REST

/api/blast_radius, /api/architecture/compliance, /api/smart_context

Dashboard

React + Force Graph + Dagre hierarchical architecture diagram


πŸ—‚οΈ Project Layout

src/onto_agent/
β”œβ”€β”€ engine/          # Scanner, ArchitectureGuard, Context, Steering, Reflection
β”œβ”€β”€ storage/         # KΓΉzu graph storage adapter
β”œβ”€β”€ mcp/             # MCP Server
β”œβ”€β”€ client/          # Python SDK
└── cli.py           # Unified CLI

dashboard/           # FastAPI + React workbench
benchmark/           # Reproducible Codex-for-Open benchmark
integrations/        # Cursor / Claude / Windsurf / DSH
docs/                # Design docs & tickets
tests/               # 48+ unit / integration tests

πŸ“š Documentation


πŸ“„ License

This project is open-sourced under Apache-2.0.

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

–Maintainers
–Response time
–Release cycle
1Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides semantic code search and code insights via a knowledge graph, enabling AI to understand, navigate, and modify complex projects with deep dependency and architecture analysis.
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Supercharges AI coding agents with semantic code intelligence, providing pre-built knowledge graphs for surgical context, faster answers, and fewer tool calls.
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables AI agents to query architecture context, data contracts, and blast radius to prevent cross-repo architectural breakage before merging.
    30
    Apache 2.0

View all related MCP servers

Related MCP Connectors

  • AI Agent with Architectural Memory. Impact analysis (free), tests and code from the graph (pro).

  • Give your AI agent a persistent map of your project's structure, dependencies, and bugs.

  • Shared, permission-aware company context for AI agents, with provenance, approvals and audit.

View all MCP Connectors

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/rinDBeans/onto-agent'

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