onto-agent
🌌 OntoAgent
The All-Knowing Code Brain & Architecture Contract Guard for AI Coding Agents
Движок когнитивной графовой модели всего репозитория и управления архитектурой для ИИ-агентов программирования.
📖 Why OntoAgent?
Современные Coding Agent при работе с большими кодовыми базами обычно сталкиваются с тремя структурными проблемами:
Слепцы и слон: видят только текущий файл, но не видят межмодульных вызывающих, API-контрактов и тестовых зависимостей.
Галлюцинации длинного контекста: «насильно впихивают» весь репозиторий в Prompt — высокие затраты на Token, низкое соотношение сигнал/шум, модель легко игнорирует ключевые ограничения.
Разрушительные изменения трудно отследить: при изменении одного ключевого класса невозможно быстро узнать, какие вышестоящие модули, тесты и интерфейсы «взорвутся» вместе с ним.
Традиционные подходы:
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На основе детерминированных кодовых фикстур сравниваются три стратегии построения контекста:
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 снижает потребление Token примерно на 89,7% по сравнению с Naive Raw Text.
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)
Генерирует контекст с высоким соотношением сигнал/шум перед рефакторингом/генерацией:
Определение, номер строки, 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.1542MIT
- 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