Skip to content

RayverAimar/pyxus

Repository files navigation

Pyxus

Python Code Intelligence Engine

Give your AI agents a complete understanding of any Python codebase — in seconds.

CI Python 3.12+ License: MIT Code style: ruff MCP

Pyxus interactive graph explorer — modules, classes, functions and call edges

Pyxus builds a knowledge graph of your Python codebase — every class, function, method call, import, and inheritance chain — and exposes it to AI agents via MCP. Your LLM stops guessing and starts knowing how the code connects.

100 files in ~1.2s | 70-85% call resolution without type hints | 317 tests

The Problem

AI agents read files one at a time. They grep, they guess. But they don't see how code connects — so they miss callers, break dependencies, and write incomplete refactors.

The Solution

pyxus analyze /path/to/project   # Build the graph once
pyxus serve                       # Expose it to your AI agent

Now your agent has instant answers:

You: "What breaks if I change UserService?"

Agent → context("UserService")
  Called by: auth.views.register(), signals.on_user_created(), admin.bulk_create()
  Methods: create(), update(), delete()
  Extends: BaseService
  Risk: HIGH — used in auth pipeline

Installation

git clone https://github.com/RayverAimar/pyxus.git
cd pyxus && uv sync
uv sync --extra ui    # Optional: enables `pyxus ui`

MCP Tools

Tool What it does
context(name) Everything about a symbol: callers, callees, imports, inheritance
impact(target) Blast radius: what depends on this and what breaks
search(query) Find symbols by name with relevance ranking
imports() Module dependency graph and circular import detection

Add to Claude Code (~/.claude/mcp_servers.json):

{
  "pyxus": {
    "command": "pyxus",
    "args": ["serve"]
  }
}

CLI

pyxus analyze <path>    # Full analysis: symbols, imports, hierarchy, calls
pyxus imports <path>    # Fast: import dependencies + circular detection
pyxus status <path>     # Index metadata
pyxus clean <path>      # Delete .pyxus/ index
pyxus serve             # Start MCP server
pyxus ui [path]         # Launch interactive web UI

Import Analysis

A fast mode that maps module dependencies and catches circular imports — useful for understanding coupling and untangling dependency chains before refactoring:

pyxus imports /path/to/project
  Modules: 47
  Dependencies: 128

  Circular imports detected: 1
    config → utils → helpers → config

Know which modules are tightly coupled, which are isolated, and where the dependency cycles live — before your agent touches a single line.

Web UI

An interactive graph visualization for exploring your codebase visually:

pyxus ui /path/to/project         # Opens browser at localhost:8420
pyxus ui --port 9000              # Custom port
pyxus ui --dev                    # API only (for frontend development)

Search symbols, inspect dependencies, trace impact paths, and spot circular imports — all from the browser. Built with React, Sigma.js, and Tailwind CSS.

Requires the ui extra: uv sync --extra ui

What It Resolves

Pyxus tracks what objects each variable points to across function boundaries — no type hints needed:

def get_service():
    return Service()

s = get_service()   # Pyxus knows s is a Service
s.process()         # Resolves to Service.process

Constructor returns, parameter bridging, return type chains, MRO inheritance, callable attributes, super() resolution, and closure propagation — all resolved statically.

Development

uv sync                              # Install
uv run pytest -x -q                  # 279 tests, ~1.5s
uv run ruff check . && uv run ruff format .

License

MIT

About

Python Code Intelligence Engine — static analysis knowledge graph exposed via MCP for AI agents

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors