Skip to main content

Static call graph traversal for Python codebases

Project description

Decoder: GPS Navigation for Codebases

Inspired by debuggers, decoder is a static call graph analysis tool for Python. It maps how your code connects, tracing those connections from the routing layer to service layer and across the codebase, without the runtime execution a debugger would require.

Unlike grep, which matches text, decoder traces a symbol's call chain and shows what calls it and what it calls. It also tracks conditionals, loops, and try/except blocks, so you see the full nested context of your methods or functions.

Under the hood, decoder parses the Python Abstract Syntax Tree (AST) to generate a relational graph, persisted in a local SQLite index (.decoder/index.db).

Interfaces:

  • For AI: An MCP server that exposes the codebase's topology, allowing LLMs to perform targeted graph traversals rather than iterative grep and file reads, significantly reducing token consumption and latency

  • For engineers: A CLI and VS Code extension that enables interactive trace exploration

decoder-mcp

VS Code extension coming soon - preview available with manual install

MCP Server

cd your-project
pip install mcp-server-decoder
decoder index .
claude mcp add decoder -- mcp-server-decoder

Verify it's connected. In Claude, run:

/mcp
# then, "MCP Status"

You should see decoder listed with its available tools.

Tools Available

Tool Parameters Description
decoder_callers name Find what calls a function
decoder_callees name Find what a function calls
decoder_trace name, max_depth? Trace full call tree
decoder_find query, type? Search for symbols
decoder_stats - View index statistics

CLI

Install:

pip install decoder-graph

Index your codebase:

decoder index .

Trace a function or method in your code:

decoder trace create_todo

Example output:

Call tree for create_todo
routes/todos.py:34

Callees:
└─ validate_request [if request.data] routes/todos.py:12
└─ TodoService.create services/todo.py:45
   └─ TodoRepository.save [in try] repositories/todo.py:23
      └─ Session.add db/session.py:67

VS Code Extension (Preview)

Decoder includes a VS Code extension for interactive call graph exploration. The extension is currently in preview and will be published to the VS Code Marketplace soon.

decoder-vsc-demo

Installation (Preview)

Download the .vsix from Releases, then:

code --install-extension decoder.vsix

Usage

Before using the extension, index your codebase:

decoder index .

Then in VS Code:

  • Right-click any function to:
    • Show Callers
    • Show Callees
    • Trace Call Tree
  • Explore call trees in the Decoder sidebar
  • Step through execution paths using the Trace Player

Features

  • Show Callers / Callees
  • Hierarchical Call Tree View
  • Trace Player with Code Highlighting
  • Playback Controls (Play, Pause, Step)

Configuration

{
  "decoder.pythonPath": "python",
  "decoder.playSpeed": 1500
}

Execution Context Detection

Decoder annotates calls with execution context, helping you understand why a call happens.

Annotation Meaning
[if condition] Inside an if/else block
[in loop] Inside a for/while loop
[in try] Inside a try block
[in except] Inside an exception handler

Contributing

Contributions are welcome, please see CONTRIBUTING.md for guidelines.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

decoder_graph-0.1.0.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

decoder_graph-0.1.0-py3-none-any.whl (34.8 kB view details)

Uploaded Python 3

File details

Details for the file decoder_graph-0.1.0.tar.gz.

File metadata

  • Download URL: decoder_graph-0.1.0.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for decoder_graph-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0a36c6d948510a9529817cabb79ccabfbaa5c01a44ce8b0ef58fb089cf570434
MD5 05d10312343dbe2bd65209579f88af37
BLAKE2b-256 74f2389b89db08504ec9789eeb7536d3fe6dac5554fb8232584881b0634ef902

See more details on using hashes here.

File details

Details for the file decoder_graph-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: decoder_graph-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 34.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for decoder_graph-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 422bad76e07377dfa2ada2f1d415d64afa813fbd10e58ada47458334ef110c1a
MD5 28a8f293b3c9d5cb468dc069b24f9909
BLAKE2b-256 b1dbabc72997a1aa9dac4dc13b526040ba548c5a645d0bee7c52e6a23f446ec4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page