onto-agent
🌌 OntoAgent
The All-Knowing Code Brain & Architecture Contract Guard for AI Coding Agents
AI コーディングエージェント向けの全リポジトリ認知ナレッジグラフとアーキテクチャガバナンスエンジン。
📖 Why OntoAgent?
現代の Coding Agent が大規模なコードベースに直面するとき、通常3つの構造的な問題に遭遇します:
群盲象を撫でる:現在のファイルしか見えず、モジュールをまたぐ呼び出し元、API 契約、テスト依存関係が見えません。
長文脈幻覚:リポジトリ全体を Prompt に「力技で放り込み」、Token コストが高く、S/N 比が低く、モデルが重要な制約を見落としがちです。
破壊的変更の追跡が困難:コアクラスを変更しても、どの上流モジュール、テスト、インターフェースが一緒に壊れるかを素早く把握できません。
従来のアプローチ:
Naive Raw Text:全量をコンテキストに詰め込み、Token が膨大で構造化された位置特定がありません。
Vector-Chunk RAG:テキスト類似度でチャンク分割し、Token を圧縮できますが、AST レベルの依存関係、継承関係、契約セマンティクスが失われます。
OntoAgent の選択:
AST 静的解析 + 組み込み型グラフデータベース で全リポジトリの認知グラフを構築し、AI Agent がコードを変更する前に 呼び出し網、契約、テスト、爆発半径 を確認できるようにします。
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
ワンクリックで再現:
python benchmark/run_benchmark.py決定論的なコードフィクスチャに基づき、3つのコンテキスト構築戦略を比較:
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% |
結論:
OntoAgent は Naive Raw Text と比較して約 89.7% の Token 消費を削減します。
OntoAgent は Vector-Chunk RAG と比較して、重要依存関係の再現率、テスト/契約の再現率、爆発半径の特定において全面的に優れています。
完全なレポートは
benchmark/reports/benchmark_report.mdを参照してください。
🚀 Quickstart
1. インストール
pip install -e .[test]2. 全リポジトリをスキャン
onto-agent scan --path .3. 可視化ワークベンチを起動
python dashboard/api_server.py
# 打开 http://127.0.0.1:80004. MCP を設定
integrations/cursor_mcp.json を .cursor/mcp.json にコピーするか、Claude Desktop でマージします:
{
"mcpServers": {
"onto-agent": {
"command": "python",
"args": ["-m", "onto_agent.mcp"]
}
}
}5. DSH ネイティブプラグインをインストール
dsh plugin --profile web add ./integrations/dsh/onto-agent-plugin🧠 Agent Abilities
get_blast_radius(file_path)
任意のファイル/シンボルを変更する前に、以下を返します:
直接の呼び出し元
間接的に影響を受けるモジュール
下流の依存関係
関連する API 契約
実行が必要なテスト
check_architecture_compliance(strict=True)
チェック:
循環 import
レイヤーをまたぐ違反呼び出し
テストでカバーされていないコアクラス
get_smart_context(query_or_symbol)
リファクタリング/生成前の高 S/N 比コンテキストを生成:
定義、行数、Docstring
クラス/関数リスト
imports / callers
API 契約、関連テスト、関連ドキュメント
🔌 Ecosystem
エントリポイント | 方法 |
MCP |
|
DSH |
|
CLI |
|
REST |
|
Dashboard | React + Force Graph + Dagre 階層アーキテクチャ図 |
🗂️ 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
本プロジェクトは Apache-2.0 でオープンソース公開されています。
This server cannot be deployed
Maintenance
Related MCP Connectors
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Codebase intelligence for AI agents — dead code, blast radius, ownership.
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.
Related MCP Servers
- AlicenseBqualityCmaintenanceTransforms codebases into structural knowledge graphs for AI agents and developers, providing precise architectural awareness and dependency mapping.1537MIT
- AlicenseNot gradedqualityCmaintenanceProvides 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
- AlicenseNot gradedqualityDmaintenanceSupercharges AI coding agents with semantic code intelligence, providing pre-built knowledge graphs for surgical context, faster answers, and fewer tool calls.MIT
- AlicenseNot gradedqualityDmaintenanceProvides AI coding agents with persistent architectural memory of codebases, enabling impact analysis, test generation, and code generation with reduced token usage.MIT