Skip to main content
Glama

ozagia

Ozma advanced graph integration agent. A live code graph for LLM coding agents: index a repository into typed nodes (files, symbols, tests, docs, imports, call edges), keep it current while the agent edits, and put it in the agent's path. MIT licensed.

Status: alpha. The library, the MCP server, the OpenCode capture plugin and the agent harnesses work; the Claude Code, Codex and Kiro hooks are implemented but untested against a live host. Measurements are in docs/results/; plans in docs/plans/; release sequencing and the current plan audit in docs/roadmap.md. A generated reference for this repository's own shape (layout, modules, docs, entry points and commands) is REPO_SHAPE.md, produced by ozagia overview (docs/repo_shape.md).

The Ozma protocol research is preserved here as a design basis for Ozagia's future model interfaces. Its historical drafts and implementation are reference material, not a claim of current protocol conformance.

Install

curl -fsSL https://ozagia.com/install | bash
cd /path/to/your/repo
ozagia                     # OpenCode's TUI with the ozagia graph in its path

The installer puts a self-contained ozagia (its own Python, with the tree-sitter parsers) and a pinned OpenCode release under ~/.ozagia, checks every download's sha256, and adds ~/.ozagia/bin to PATH. Linux (x64, arm64, glibc) and macOS (arm64, x64). ozagia self check --tui verifies the install; ozagia self upgrade and ozagia self uninstall manage it. See docs/install.md; releases are made as in docs/release.md.

Related MCP server: codegraph-mcp

What it does

  • Graph index: files, symbols, tests, docs, imports, git history and known failures as one graph snapshot, with project-specific nodes added by adapters.

  • Retrieval: ranked repo map (PageRank over references), fused lexical and graph code search, symbol-level callers, callees and impact, architecture summary. Optional language-server refinement (pyright, rust-analyzer).

  • Graph-addressed edits: Python symbol and AST ops, Rust/Lua CST ops, Markdown section ops, JSON path ops, HCL block/attribute ops and optional comment-preserving YAML path ops. Preview by default, base hash check, atomic write, backup. A diff is output only, never input.

  • Review: deterministic review of a commit range (ozagia-review) or of the whole repository (ozagia review-repo: import cycles, test gaps, dead symbols, stale doc references, security hygiene, ops sources, lock files), with stable finding ids and graph keys. No model calls.

  • Deep review: ozagia deep-review composes an offline-by-default, subject-based report across security, performance, failure modes, data structures, scalability, architecture, tests, dependencies, operations, docs/API and correctness; per-subject coverage, bounded evidence/ excerpts, findings.json, a manifest, baseline deltas and a caller-selected --fail-on gate. --profile change (alias review-change) is a compact HEAD~1..HEAD range preset; --range adds change-set review and --profile-report adds measured profile evidence. External scanners run only when named with --security-tool; --security-network is a separate opt-in, and per-tool provenance is recorded. Dependencies include local licence/version inventory, optional exact-version matching or OSV-style introduced/fixed ranges against an explicit local advisory file (range matching supports Node/Rust strict SemVer, v-prefixed Go and Python PEP 440; Ruby, Composer and Maven are exact-version only; Ruby matches only Bundler GEM source pins, not Git/path pins), and sbom.json with CVE state unknown. ozagia-status has a read-only reviews section. An optional --model-pass (requires --live and OZAGIA_EVAL_LIVE=1) writes advisory, unverified, role-mapped candidates to model-review.json under time/request/token/cost budgets, with optional Ocelot candidate clustering; candidates never block. (docs/deep_review.md)

  • Evals: a leakage-checked retrieval eval, a break/fix agent eval with selectable agent backends (OpenCode, Claude Code), and an index bench.

  • Profiles: ozagia profile reads existing cProfile, Speedscope/py-spy, Chrome/Node CPU, folded perf, OTLP trace/metric and Prometheus text artifacts; joins active frames to graph symbols, callers and impact; and reports hotspots, paths, service operations, metrics and baseline changes. ozagia profile run --allow-exec collects one explicitly approved cProfile, py-spy or Node run under the resource policy. Offline by default (docs/profiling.md).

Ways to use it

depth

how

status

Library

from ozagia.core.memory import DevMemory, build_index

works

MCP server

ozagia mcp: any MCP client (OpenCode, Claude Code, Cursor, ...) gets the graph tools next to its own

works

Engine surface

OZAGIA_SURFACE=engine: one stateful graph tool with compact rows, token budgets, known deltas and bounded fork-isolated background speculation with a thread fallback (docs/graph_engine.md)

new; no model-task gain measured

External tools

ozagia-toolchain, the daemon toolchain op, MCP dev_tools and a session-brief block: capability readiness and missing-tool diagnosis for documents/PDF/OCR/office, media, browser/research, data, ops, design and communication work; optional pdf/ocr/image/office/media/data extras; install previews with approval, network and sudo gates (docs/toolchain.md)

discovery only; never installs

OpenCode plugin

captures read/grep/glob/edit/write/shell and carries out their intent on the graph daemon; ozagia install opencode

works (OpenCode 2.3, live smoke runs)

Claude Code hooks

partial capture: graph context after each tool, git ref refusal; ozagia install claude

implemented, untested live

Codex hooks

graph context after shell commands and patches, git ref refusal, a session brief, the MCP server and an AGENTS.md section; ozagia install codex (docs/codex.md)

implemented, untested live

Kiro CLI hooks

git ref refusal, node-key reads answered from the graph, graph refresh after edits, a session brief, the MCP server; ozagia install kiro (docs/kiro.md)

implemented, untested live

Harness

ozagia agent: an OpenCode session with the daemon and plugin set up and torn down for you (docs/harness.md); python -m ozagia.harness.native: a small agent loop over any OpenAI-compatible API, with or without the graph (docs/native_loop.md)

implemented; the eval's live runs use the same pieces

Infrastructure

Opt-in source-only Terraform, Kubernetes and related infrastructure graph/context (docs/iac_context.md)

experimental, partial static analysis

SRE/IaC operations

Opt-in job waiting, nested command/network relays, ops receipts, supplied live-state snapshots, offline IaC checks and dry-run preflight (docs/sre_operations.md, docs/relay.md)

experimental; live paths default off

Workspace checks

ozagia-worktree, ozagia-resources, ozagia-files: worktree/branch drift and commit/merge/push policy, host/disk admission checks, created-file ledger and Markdown routing (docs/worktree.md, docs/resources.md, docs/files.md)

read-only; cleanup is dry-run

OpenCode GUI add-in

Graph, status and test-plan side panel plus commands, backed by a server RPC over the ozagia CLIs (docs/opencode_addin.md)

read-only; build/typecheck verified against OpenCode 2.3

Goals

ozagia goal: repo-level goals whose targets and criteria are graph keys, checked against the graph, the working tree and the test record; claimed by sessions, named in the daemon's after-edit lines and the session brief; ozagia goal from-review turns a review-repo finding into a goal that is met only after a later review no longer reports it (docs/goals.md)

new; no live harness runs yet

Python environments

ozagia env [--for PATH], MCP dev_environment: the project's interpreters (venvs, the source repo's venv for a worktree, lock-file tools, command docs, PATH), what each can import, and which one can run given files; used for the eval's check interpreter and the review's import findings (docs/environments.md)

new; probes interpreters only with python -I -c

Quick start (from source)

uv pip install -e '.[all]'          # or: pip install -e '.[all]'
cd /path/to/your/repo
ozagia index                        # builds or refreshes .ozagia/graph.json
ozagia-memory search "retry backoff"
ozagia-memory context "make the retry loop give up after five attempts"

Add .ozagia/ to the repository's .gitignore.

OpenCode with the graph in its path (needs opencode on PATH):

ozagia agent --prompt "make tests/test_retry.py pass" -m vllm/qwen3.8-27b
ozagia agent --clone --prompt-file task.txt   # in a throwaway clone of HEAD
ozagia agent                                  # the interactive TUI

Each session builds or refreshes the snapshot, starts the graph daemon, installs the plugin, runs OpenCode, and removes the plugin and stops the daemon afterwards, also on Ctrl-C. See docs/harness.md.

When OpenCode exposes its V2 session context hook, the plugin also uses the current request and recent conversation to retrieve a small, source-attributed graph hint before a model call. It omits hints when the snapshot cannot be verified as fresh. The hint is capped at 1,600 characters (an approximate, model-dependent token budget), and can recur on later model calls; its effect on total tokens and elapsed time depends on the task. Prompts and history are not written to the daemon journal. The hook is optional and falls back if the daemon or hook is unavailable.

MCP (OpenCode opencode.json):

{
  "mcp": {
    "ozagia": {
      "type": "local",
      "command": ["/path/to/venv/bin/python", "-m", "ozagia.integrations.mcp.server"],
      "environment": {"OZAGIA_ROOT": "/path/to/your/repo"}
    }
  }
}

Configuring a repository

Without configuration ozagia indexes the whole checkout, skipping the usual build and cache directories. A .ozagia.toml at the root narrows the source directories, sets the docs to index, extra import roots and skip names, and names adapters. The full schema is in src/ozagia/config.py.

[index]
source_dirs = ["src", "tools"]
test_dirs = ["tests"]
docs = ["README.md", "docs/**/*.md"]

[adapters]
modules = ["tools.my_adapter:register"]

An adapter is a register(registry) function that adds indexers (extra node and edge types), edit engines, MCP tools or graph queries. See src/ozagia/adapters.py. Ocelot's adapter (tools/ozagia_ocelot_adapter.py in https://github.com/ozmalabs/ocelot) is a worked example: it adds seed manifests and rules as graph nodes.

Research mode

Use ozagia-mcp --mode research --root /path/to/workspace for source-backed research graphs, or --mode combined to expose research and coding tools together. Coding mode remains the default. Research mode includes bibliography import/export, open-access artifact fetch with content hashes, PDF/TEI text extraction, BM25 and optional hybrid vector search, citation-graph traversal, citation-context candidates, evidence tables, screening decisions, manuscript bundles with citation checks, structured review plans with multi-model runs and reconciliation, steelman/red-team arguments, structured extraction with effect sizes, risk-of-bias/certainty appraisal, contradiction scanning, living-review alerts and a theory-competition ledger with graded compatibility and shared-evidence analysis. See research mode for setup, optional dependencies and model/Lean limitations, structured review for the review matrix, synthesis for extraction/appraisal/alerts, theory competition for rivals and evidence basis, paper review for the end-to-end structured review, PDF extraction for claim candidates, source formats for books, notes, websites and epistemic holdings, and external providers for the opt-in scraper boundary.

Origin

ozagia was extracted, with its history, from the Ocelot repository, where it was built as Ocelot's dev tooling. Most docs under docs/ still use Ocelot as the example repository, and docs/results/ holds the measurements made on Ocelot.

Development

See AGENTS.md.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables LLM agents to efficiently understand and navigate a codebase by providing semantic search over symbols and a reference graph, replacing expensive grep/glob calls with structured tools like definition lookup, caller/callee queries, and change-impact analysis.
      4
      MIT