โ† Back to Research

๐Ÿงฉ PSI โ€” Program Structure Interface

A program structure interface designed for AI coding agents โ€” exposing the structural semantics of codebases so agents can navigate, understand, and modify code with surgical precision.

The Problem

Current AI coding agents operate primarily on raw text โ€” they lack deep understanding of program structure. This leads to imprecise edits, broken references, and an inability to reason about complex codebases beyond the current file.

PSI bridges this gap by providing a structured interface that extracts and exposes function call graphs, data flow, type hierarchies, and symbol resolution โ€” giving agents the same structural awareness that experienced developers have.

๐Ÿงฉ

Core Capabilities

PSI provides a rich, queryable interface to the structural properties of any codebase.

๐ŸŒ

Call Graph Extraction

Build complete, cross-file function call graphs. Understand call chains, entry points, and dependency relationships across your entire project.

๐Ÿ”

Semantic Code Navigation

Navigate code by meaning โ€” go to definition, find all references, resolve imports, and traverse inheritance hierarchies programmatically.

๐Ÿค

Agent-Friendly API

A clean, tool-call compatible interface designed for LLM-based coding agents. Query structure, get context-aware code slices, and apply targeted edits.

๐Ÿ“Š

Data Flow Analysis

Track how data moves through your program โ€” from function parameters to return values, across modules and abstraction layers.

๐Ÿท๏ธ

Type Hierarchy Mapping

Extract and visualize class hierarchies, interface implementations, and generic type relationships for object-oriented and typed codebases.

๐Ÿงช

Multi-Language Support

Supports Python, JavaScript/TypeScript, Java, Go, and C/C++ with language-specific semantic analysis via tree-sitter and LSP integration.

How It Works

PSI integrates seamlessly into your AI agent's tool ecosystem.

1๏ธโƒฃ

Index the Codebase

PSI parses and indexes the target codebase, building an in-memory structural graph of all symbols, relationships, and scopes.

2๏ธโƒฃ

Query via Tool Calls

The agent queries PSI through structured tool calls โ€” "find callers of function X", "get class hierarchy of Y", "list all imports in module Z".

3๏ธโƒฃ

Precise Edits

With structural context, the agent makes precise, semantics-aware code modifications โ€” avoiding the "edit by text pattern" failures common in naive agents.