@viniraioli/pi-codegraph

Pi coding agent extension that wires codegraph (tree-sitter knowledge graph) as an MCP sidecar and injects usage instructions into the system prompt

Packages

Package details

extension

Install @viniraioli/pi-codegraph from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@viniraioli/pi-codegraph
Package
@viniraioli/pi-codegraph
Version
0.1.3
Published
Jun 9, 2026
Downloads
not available
Author
viniraioli
License
MIT
Types
extension
Size
12 KB
Dependencies
1 dependency · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./extensions"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-codegraph

A pi coding agent extension that wires codegraph as an MCP sidecar and injects structured usage instructions into the system prompt.

What it does

When a project has a .codegraph/ index anywhere above the current working directory, this extension:

  1. Spawns codegraph serve --mcp --path <project-root> as a sidecar process
  2. Registers all codegraph tools returned by tools/list directly in the session
  3. Injects a ## CodeGraph section into the base system prompt via APPEND_SYSTEM.md so the instructions are present from session startup — not just on the first agent turn

If the project has no .codegraph/ directory the extension is a no-op.

Requirements

  • codegraph CLI must be on $PATH
  • A .codegraph/ index must exist in the project root (run codegraph init -i to build one)

Install

As a pi package

/add npm:@viniraioli/pi-codegraph

Manual (git)

/add https://github.com/SeanPedersen/pi-codegraph

Building the index

codegraph init -i        # initial index build

The file watcher keeps the index current while pi is running.

This package follows the current CodeGraph MCP surface, so broad structural questions should go to codegraph_explore first.