PAiRSA code graph for people who review what AI writes, and for the agents that write it.
PAiRS parses your workspace into a queryable code graph (symbols, calls, imports, type hierarchy) and turns it into views that answer a reviewer's questions: what did the assistant just change, where is this project fragile, and what is this class really? Everything runs locally, from the graph, with no model tokens. The same graph is served to Copilot, Claude Code and any MCP client, so the agent and you look at one picture. Supported languages: C, C++, Python, JavaScript, TypeScript, Java, Go, Ruby, Dart, Rust, CSS, HTML, GDScript. All GIFs below are filmed in a real VS Code window on a small demo shop. The edits and clicks are scripted (no model was involved); everything PAiRS shows is its real output. Highlights1. Live Changes: follow an assistant's work as structure, not as diffs
An assistant writes code faster than you can read a diff. PAiRS: Open Live Changes shows what happened to the structure of the program since you last looked:
The ranking follows fixed rules, not an understanding of the code: a flipped condition counts as a detail. How it decides. 2. Project map: where the project is fragile, at a glance
PAiRS: Show Module Map draws the modules as columns ordered by dependency layer, grouped into detected subsystems, with cycles (amber), drift across subsystem boundaries (red) and the edges to cut to break a cycle. Colour by paints the same map with what the graph alone cannot tell:
Click a module for its card: risk score and why, size, fan-in/out, test share, churn, hotspot files and anti-patterns. The same ranking is a command for agents and CI:
Git history is read only in a trusted workspace and cached per commit in 3. Design patterns and anti-patterns
PAiRS reads design intent from the structure it already has (members, inheritance, has-a relations):
They show where you already look: as stereotypes in PAiRS: Export Diagram class diagrams (Mermaid), in 4. Safe, atomic renameThe one thing most agent code-search tools do not do: PAiRS can write. 5. One graph for every agentThe same tools (§4) are Copilot agent-mode tools, a Claude Code skill, an MCP server for Cursor, Codex, Gemini CLI and others, and 0. 60-second quickstart
Every command prints compact prose by default (cheapest for agents and humans); 1. Installing the VS Code extensionRequirements: VS Code 1.101 or newer. Nothing else to install — the extension bundles its parsers and runs the CLI on VS Code's own runtime, so no separate Node.js is needed. Works on Windows, macOS and Linux (one platform-independent package).
The index lives in On activation PAiRS also puts a Footprint. The package is ~1.6 MB. Grammars load lazily per language and are released after a minute of inactivity, caches are dropped when idle, unchanged files are skipped on re-index, and edits are debounced and applied incrementally. Privacy. Everything runs locally: no network requests, no telemetry. Source code never leaves your machine through PAiRS (what an agent does with a tool's answer is up to that agent). A multi-root workspace gets one independent index per folder. 2. Using it in VS Code
The GIF walks the features on a small demo project ( Commands (Command Palette →
|
| Command | What it does |
|---|---|
| PAiRS: Re-index Workspace | Incremental re-index (also runs automatically on activation and on every file save/create/delete). |
| PAiRS: Rebuild Index From Scratch | Drops the SQLite store and reparses everything. Use this if the index looks stale or corrupted — a plain re-index short-circuits unchanged files and can't recover from a broken store. |
| PAiRS: Find Symbol | Quick-pick search by symbol name (bare or qualified, e.g. login or AuthService::login); jumps to its definition. |
| PAiRS: Show Module Map | The project map (Highlights §2): subsystems, layers, cycles and drift, coloured by risk, churn, tests or anti-patterns; click a module for its card, Enter to reveal it. |
| PAiRS: Open Live Changes | Structural changes since you last looked (Highlights §1). |
| PAiRS: Export Diagram | Class diagram, call graph or module map as Mermaid, in a new document. |
Hover insight
Hover any function, type or variable in an indexed file and PAiRS adds a short section under the language's usual hover. What it shows depends on what you're hovering:
- Functions and methods: callers (each link jumps to the call site) and callees.
- Classes, structs, interfaces, traits and enums: what the type extends or implements, its subtypes, what uses it, and its members.
- Variables, fields and constants: the declared type, plus what reads and what writes it.
Each row lists the first few matches, and files you opened recently come first. Click a name to jump to it, or +N more… / peek all to open the full list in a peek view. Only verified (resolved) references are listed by default. It adds to VS Code's built-in hover and doesn't change any keybinding or Go to Definition. Turn it off with pairs.hover.enabled (see §5).
Relations window
The Relations window is a call diagram in the bottom panel, much like Source Insight's Relation Window. It's off by default: run PAiRS: Show Relations Window or set pairs.relations.enabled. It draws the symbol under the cursor in the middle, with what depends on it on the left and what it depends on on the right. Arrows always point from the dependent to the dependency:
| You click a… | Left | Right |
|---|---|---|
| function or method | callers | callees |
| class, interface, struct or enum | subtypes and users | supertypes |
| variable, field or constant | readers and writers | its type |
| module | importers | imports |
- Following the cursor. The diagram follows the cursor as you click or move around the code, but not while you type. Follow / Pinned freezes the current diagram.
- Navigating. Click a box to jump there: the call site for a caller, the declaration otherwise. Double-click a box to center the diagram on it. +N expands a node another level, +N more… lists the rest, and ‹ › (or Alt+←/→) moves through the history.
- Reading it. Connectors are colored by relation: calls, extends/implements, uses, reads, writes, type. Recursion is marked ↻, test-only users are dimmed and listed last, and fuzzy matches (off by default) are dashed.
- View controls. The depth buttons set how many levels each side shows. Ctrl+wheel zooms and dragging pans.
- Hover. While the window is visible, it replaces the PAiRS hover section. Close the panel and the hover comes back.
Nothing runs while the window is hidden. Each diagram takes a few batched index queries, typically under 100 ms.
Status bar
Bottom-right shows pairs <N> sym · <P>% fuzzy — total indexed symbols and the percentage resolved by fuzzy (name-only) matching rather than a verified reference. Lower fuzzy % means more reliable impact/who_calls results. Hover for a breakdown (files, symbols, edges, unresolved references); click to trigger a re-index.
Copilot agent-mode tools
PAiRS registers its analysis functions as native VS Code Language Model Tools, so GitHub Copilot in agent mode can call them directly (no MCP server needed) — find_symbol, get_symbol, outline, grep_symbols, context_pack, impact, diff_impact, hierarchy, who_calls, call_path, class_info, file_deps, module_map, analyze, rename_symbol. See §4 for what each does. In untrusted workspaces (Workspace Trust restricted mode) diff_impact is disabled because it runs git; everything else works.
Each tool can be turned off individually with pairs.disabledTools (§5). The registration path is covered by automated tests (src/adapters/vscode/lmTools.test.ts): every pairs_* tool is registered, disabled tools are skipped, and invoking pairs_find_symbol returns the definition as text. We have not verified the Copilot Chat UI itself (the tool picker under Configure Tools) because it needs a signed-in Copilot account.
Claude Code integration
On activation, PAiRS installs a Claude Code skill (SKILL.md) so Claude Code drives the same functionality through the pairs CLI. By default it goes to ~/.claude/skills/pairs/ (setting pairs.skillLocation: user | workspace | off) and is rewritten only when its content changes, so worktrees stay clean.
Live Changes, caller counts and diagrams
- PAiRS: Open Live Changes: see Highlights §1. Worktree watching needs a trusted workspace and starts when the panel is first opened (
pairs.liveView.worktrees,pairs.liveView.maxWorktrees); a session closes afterpairs.liveView.agentIdleSecondsof quiet. - Declarations show how many callers and subtypes they have; click to list them (
pairs.codeLens.enabled). - PAiRS: Export Diagram writes a class diagram (with likely patterns and anti-patterns as stereotypes), call graph or module map as Mermaid.
MCP server (Claude Code, Cursor, Codex, Gemini CLI, etc.)
For any MCP-capable client, pairs mcp runs PAiRS as a standalone MCP server over stdio. It exposes every tool in §4 automatically (find_symbol, outline, impact, rename_symbol, …) with the same descriptions and JSON Schemas the VS Code Language Model Tools use, backed by the same .pairs/index.db store. It indexes the workspace on startup, then keeps the index fresh in the background for the life of the session (the same watch machinery as pairs watch).
Claude Code:
claude mcp add pairs -- pairs mcp
Generic mcpServers config (Cursor, Codex, Gemini CLI, or any other MCP client's config file):
{
"mcpServers": {
"pairs": {
"command": "pairs",
"args": ["mcp"]
}
}
}
Pass --root <dir> if the server should index a workspace other than its own cwd, e.g. "args": ["mcp", "--root", "/path/to/repo"].
PreToolUse hook (nudge Claude Code off grep and onto the graph). Run pairs setup claude once from your workspace root: it idempotently merges a PreToolUse hook into .claude/settings.json (preserves everything else already there — other hooks, permissions, etc. — and running it again is a no-op). After that, whenever Claude Code is about to run Grep, or a Bash command that's a plain grep/rg call, for a pattern that matches an indexed symbol, the hook adds a short note to the tool call with the symbol's definition site(s) and a one-line tip to use pairs who_calls/impact instead — without blocking or altering the grep itself. It fails open by design: any error, a missing index, or a non-identifier pattern (e.g. a regex) all just produce no output and exit 0, exactly as if the hook weren't installed. It never re-indexes and opens .pairs/index.db read-only, so it adds no meaningful latency.
3. Using the pairs CLI
The extension bundles a CLI (dist/cli.js) for terminal use, CI pipelines, and Claude Code. If you have the repo/npm package rather than just the .vsix, it's exposed as the pairs binary. Commands work from any subdirectory or git worktree: the root is the nearest ancestor containing .pairs/index.db or .git (override with --root or PAIRS_ROOT). A linked worktree is seeded from the main worktree's index on first use.
pairs <command> [args]
| Command | Usage | Description |
|---|---|---|
index |
pairs index [--rebuild] |
Full index (or full rebuild with --rebuild, dropping the store first). Prints a JSON report. |
stats |
pairs stats [--json] |
Index size and resolution quality (files, symbols, edges, fuzzy rate): two lines of prose, or JSON with --json. |
find (via query) |
pairs query '<sql>' |
Raw read-only SQL against the graph schema (File, Symbol, Edge, PendingRef) for anything not covered by a dedicated command. |
watch |
pairs watch |
Indexes once, then watches the workspace and incrementally re-indexes on save. Ctrl-C to stop. |
mcp |
pairs mcp [--root <dir>] |
Runs PAiRS as an MCP server over stdio for any MCP-capable client (Claude Code, Cursor, Codex, Gemini CLI, …) — see §2. |
files |
pairs files [pattern] [--paths] [--naked] |
Lists/searches indexed non-source filenames (a glob like *.txt or Pic*.svg). --paths also matches against full paths. |
read |
pairs read <path> [startLine] [endLine] |
Prints a file, or a 1-indexed inclusive line range. Out-of-range values clamp rather than error. |
setup claude |
pairs setup claude |
Idempotently wires the PreToolUse hook (see §2) into .claude/settings.json, merging with whatever's already there. Safe to re-run. |
hook pretooluse |
pairs hook pretooluse |
The PreToolUse hook body itself (reads Claude Code's hook JSON from stdin). You don't run this directly — pairs setup claude wires it in. |
Every tool below (find_symbol through context_pack) is also a subcommand: pairs <tool> [args]. Output is compact prose by default — the same text Copilot's Language Model Tools return (see §4). Pass --json for compact, slimmed JSON (no internal ids; default-valued fields omitted) to pipe into jq or a script, or --pretty for indented JSON. --naked is accepted and ignored (it was the old opt-in for prose). pairs query always prints JSON, compact unless --pretty.
Lists are bounded (default 20–25 rows) and end with … +N more (pass limit=M); re-run with --limit M / --offset N. Every tool input field is a --flag (also --kebab-case / --flag=value; booleans --flag / --no-flag / --flag false; lists comma-separated; --kind, --lang, --regex are shorthands for kinds, langs, isRegex), unknown flags are rejected with the valid list, and pairs <tool> --help / pairs --help print usage generated from the tool schemas. An empty index answers with one line telling you to run pairs index.
4. Reference: agent tools / CLI commands
These are the same operations, exposed as VS Code Language Model Tools (Copilot, prose output) or CLI subcommands (Claude Code / scripts / CI; prose by default, --json for structured output):
| Tool | Purpose |
|---|---|
brief |
One-shot orientation of the whole indexed workspace: languages/size, detected subsystems (with hub symbols and dependency layer), likely entry points, cycle/drift counts, and 3 suggested next commands — entirely derived from the index, no LLM summarization. Call this first, once per session, instead of open-ended grep/Read exploration. Capped at ~6,000 characters. CLI: pairs brief [--write] [--naked] — --write also saves the prose to .pairs/BRIEF.md. |
find_symbol |
Locate a symbol's definition(s) by name. Pass preview: true (CLI: --preview) to inline each hit's doc line and first body lines — usually removes the follow-up Read. |
get_symbol |
Full declaration (signature, doc, span, members) without reading the whole file. |
outline |
A file's symbols in order — its structural shape. |
grep_symbols |
Search names/qualified names/signatures/doc text by substring or regex (CLI: --regex) — for "I don't know the exact symbol name" instead of grep-and-Read. |
context_pack |
One bundle for a symbol or file (CLI: --path <file> for the latter): definition, direct callers, direct callees, type hierarchy, and enclosing module boundary — replaces several separate calls when you need broad context fast. |
impact |
Everything that transitively depends on a symbol ("blast radius"). Call before changing/removing it. Pass kinds: ["CALLS"] (CLI: --kinds CALLS,READS) to slice by edge type. |
diff_impact |
Blast radius of the current change: maps the git diff's changed line ranges to the symbols containing them, then walks all of their dependants in one merged pass. Use instead of reading the diff and calling impact per changed function — a dependant reached from several changed symbols appears once, tagged with how many reach it. Defaults to the working tree; --rev main...HEAD for a range, --staged for the index. Changed lines inside no symbol (imports, module-level code, unindexed files) are listed separately, never silently dropped. |
hierarchy |
Type ancestors (extends/implements) and descendants. |
who_calls |
Direct callers or callees, one hop. |
call_path |
Compact call structure: callers of a symbol up to depth levels as an indented tree (a file path only where it changes, ~ = fuzzy, ^ = already listed), or with from the shortest entry-to-target call paths. CLI: pairs call_path X [--from Entry] [--depth N]. |
class_info |
A type in one call: ancestors, subtypes, members, users (grouped by file), likely design patterns and anti-patterns. CLI: pairs class_info T. |
file_deps |
File-level importers or imports, optionally transitive. |
module_map |
Subsystems, cycles, layers, fan-in/fan-out, and drift; pass a boundary to see exactly what one module uses from another. |
analyze |
Workspace-wide: dead_code, fan_out, cycles, test_gap, anti_patterns (god class, long method/params, type cycles, deep inheritance, hubs, likely feature envy/data class/refused bequest; thresholds: DEFAULT_THRESHOLDS in antiPatterns.ts), risk (modules ranked by git churn, test share, cycles, fan-in and anti-patterns, with the reasons). |
class_diagram |
Types of a file, folder or around one type as a Mermaid class diagram, with likely design patterns and anti-patterns as stereotypes. |
rename_symbol |
The headline feature. Renames a symbol and every reference site the graph can verify — callers, readers, writers, implementers — in one atomic pass. Aborts untouched if any site can't be matched safely, or if the new name is already declared in the same file/impl block — re-index and retry, or pick another name. A fuzzy (name-only, unverified) reference site is excluded by default; pass includeFuzzy to include it anyway. Same-named symbols in other files are reported, not blocked. No built-in undo; revert via git. |
5. Configuration
Settings (VS Code Settings → search "PAiRS"):
pairs.disabledTools— array of tool names (e.g.["analyze"]) to skip registering as Copilot Language Model Tools.pairs.skillLocation— where the Claude Code skill is written:user(default,~/.claude/skills/pairs/),workspace(each folder's.claude/skills/pairs/) oroff.pairs.hover.enabled(defaulttrue): turns the hover insight section on or off. Takes effect immediately, with no reload.pairs.hover.maxItems(default5, range 1–20): how many related symbols each row lists before the rest go behind "+N more…".pairs.hover.includeFuzzy(defaultfalse): also lists name-only (fuzzy) matches, marked with?.pairs.relations.enabled(defaultfalse): shows the Relations window in the panel. PAiRS: Show Relations Window turns it on.pairs.relations.depth(default2, range 1–6): how many levels each side of the diagram starts with. The window's depth buttons change it for the session.pairs.relations.maxPerNode(default12, range 3–50): how many related symbols a node shows before the rest go behind "+N more…".
Not indexed: .gitignored paths, dot-directories, node_modules and other build/vendor directories, and nested git repositories.
6. Troubleshooting
"PAiRS: ... command not found" Run Developer: Reload Window. Check Help → Toggle Developer Tools → Console for activation errors.
Index looks stale or wrong Run PAiRS: Rebuild Index From Scratch (a plain re-index skips unchanged files and can't self-heal a corrupted store).
pairs is not found in a terminal
Make sure ~/.local/bin (%LOCALAPPDATA%\Pairs\bin on Windows) is on PATH, then open a new terminal. The launcher is rewritten on every activation.
Node version errors when building/running from source
The store uses Node's built-in node:sqlite, which requires Node ≥ 22.
Still stuck? Open an issue with the PAiRS version, your OS and the output of pairs stats.
7. Building from source
Requires Node ≥ 22.
npm ci
npm run build # minified bundles → dist/, grammars → dist/grammars (npm run build:dev for unminified)
npm run check # typecheck + lint + tests
npm run package # → pairs-<version>.vsix
npm run install:vscode # build + test + package + code --install-extension, end to end
npm run link-cli # optional: put the dev `pairs` on PATH (npm run unlink-cli to remove)
Tests inside VS Code. npm run test:vscode downloads VS Code into .vscode-test/ and runs test/vscode/ against the built extension, on a temporary workspace and home directory (on a headless Linux machine, prefix it with xvfb-run -a). To run them from the Testing view, install the recommended Extension Test Runner (ms-vscode.extension-test-runner) and run npm run build first; the unit tests appear there through the Vitest extension. npm run record-demo -- live|map|patterns re-records the Highlights GIFs (Linux, needs Xvfb, ffmpeg and python3). It builds the demo shop from scripts/demo/project.js (with a git history), runs scripts/demo/<scene>.js as a VS Code extension test and films the window; webview clicks go through XTest (scripts/demo/xinput.py), with the map's click plan in PAIRS_DEMO_PLAN.
npx vscode-test --label copilot-simulation runs a second VS Code test where no Copilot is driven: a simulated coding assistant types a new class and then changes login in the demo workspace, and the tests check what PAiRS reports (added, changed, removed, and the unchanged caller of a changed function). bash scripts/record-live-view-test.sh films that run into the GIF below (Linux, needs Xvfb and ffmpeg).

The first build compiles the GDScript grammar to wasm (no prebuilt exists), which downloads a small toolchain once and caches the result. See CONTRIBUTING.
License: MIT | Changelog: CHANGELOG.md | GitHub: thalesomilas/PAiRS



