Skip to main content
Glama

🌌 OntoAgent

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

AI 코딩 에이전트를 위한 전(全) 저장소 인지 지식 그래프 및 아키텍처 거버넌스 엔진.

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


📖 Why OntoAgent?

현대 Coding Agent는 대규모 코드베이스를 다룰 때 일반적으로 세 가지 구조적 문제에 직면합니다:

  1. 장님 코끼리 만지기: 현재 파일만 보고, 모듈 간 호출자, API 계약 및 테스트 의존성을 볼 수 없습니다.

  2. 긴 컨텍스트 환각: 전체 저장소를 Prompt에 "무작정" 넣으면 Token 비용이 높고 신호 대 잡음비가 낮아 모델이 핵심 제약 조건을 쉽게 놓칩니다.

  3. 파괴적 변경의 추적이 어려움: 핵심 클래스를 수정할 때 어떤 업스트림 모듈, 테스트 및 인터페이스가 함께 폭발할지 빠르게 알 수 없습니다.

기존 방식:

  • 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는 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:8000

4. 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

onto_get_blast_radius, onto_check_architecture_compliance, onto_get_smart_context 등 10개 도구

DSH

integrations/dsh/onto-agent-plugin, Cordis 네이티브 플러그인

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 계층 아키텍처 다이어그램


🗂️ 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 라이선스로 오픈소스입니다.

Related MCP Connectors

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
    D
    maintenance
    Supercharges AI coding agents with semantic code intelligence, providing pre-built knowledge graphs for surgical context, faster answers, and fewer tool calls.
    MIT