Map the complete reference graph around a GitHub issue, pull request, or repository backlog before you start working on it.
xref follows text mentions and GitHub's structural links across repositories,
then classifies the graph so humans and coding agents can see related work,
duplicate pull requests, competing fixes, superseded work, and unresolved
follow-ups.
The crawl and classifications are deterministic. No model is required. An agent
is only used when you explicitly ask xref to group the graph by root cause.
xref is not published to a package registry yet. You need
Bun and an authenticated GitHub CLI.
gh repo clone vercel-labs/xref
cd xref
bun install --frozen-lockfile
bun linkThe xref command is now available on your PATH.
xref --helpTo update:
git pull --ff-only
bun install --frozen-lockfile
bun linkTrace one issue or pull request:
xref 260 --repo owner/repo
xref https://github.com/owner/repo/pull/260Survey several related items:
xref --seeds 64,246,281 --repo owner/repoSurvey all open issues with a label and rank them by discussion heat:
xref --label bug --repo owner/repo --prioritizeReconcile the whole open backlog, including repositories without labels:
xref reconcile --repo owner/repoInteractive terminals receive Markdown. Pipes and agents receive versioned JSON
by default. Use --format markdown|json to choose explicitly, and xref schema
to inspect the machine contract and local-write behavior.
Generate JSON and a self-contained HTML explorer:
xref 260 --repo owner/repo --json graph.json --html graph.html
open graph.html- Text mentions in issue and pull request bodies and comments
- GitHub cross-references, connected events, and closing references
- References across repositories
- Open pull requests that touch the same files
- Multiple pull requests competing to close the same issue
- Pull requests that may already be superseded by merged work
- Closing claims such as
fixes #123without a structural closing link - Open nodes ranked by comments, participants, reactions, inbound references, and time open
- Changes since the previous graph or repository reconciliation
Every node includes its current state, author, referrers, outgoing edges, and pull request metadata when available. Every edge records its source and attribution.
xref reconcile searches the open backlog, paginates seed discovery, crawls
reference-graph levels with bounded concurrency, and produces deterministic
actions such as:
verify-completedclose-supersededresolve-competingrepair-closing-linkreview-open-prkeep-linkedkeep-untracked
Evidence is structured as { code, summary, related }, so agents can branch on
stable reasons without parsing prose. Repository-keyed history reports new
items, action changes, resolved items, and coverage regressions or recoveries.
A graph relationship is evidence, not proof of working behavior. Close candidates still require verification against current code, acceptance criteria, and live behavior.
The command never mutates GitHub. It saves local repository history under
~/.xref/reconcile-owner-repo/ unless --no-snapshot is set.
Use graph mode as a preflight before an agent plans or implements one issue:
xref "$ISSUE_URL" --json /tmp/xref.json --no-snapshotUse reconcile mode for repository maintenance:
xref reconcile --repo owner/repo --format json --no-snapshotA factory can use the evidence to:
- Stop when another pull request already implements the issue.
- Route competing or overlapping work to review.
- Give an implementation agent the full issue and pull request neighborhood.
- Build a verification queue from stable reconcile actions.
- Re-run later and detect graph, action, or coverage changes.
The graph core is separate from GitHub access. The CLI uses an authenticated
gh process, while server integrations can use the HTTP transport with fetch
and a token.
Print a compact root-cause clustering task for the calling agent:
xref --seeds 64,246,281 --repo owner/repo --clusterFor unattended use, --cluster-run claude and --cluster-run codex can run the
same task through an installed headless agent.
The repository also includes an agent skill in skills/xref.
Copy or symlink it into your agent's skills directory after installing the CLI.
--html graph.html creates a single file with no server or build step. It
includes:
- A filterable graph grouped by connected component or agent-provided cluster
- Node evidence and typed relationships
- A cleanup checklist for superseded or competing work
- An Impact view that projects the visible blast radius of resolving a node
Impact is a projection from the current graph, not proof of causality. The explorer never changes GitHub.
Registry publishing is intentionally disabled for now. To use xref as a local
dependency, build this checkout and reference it from a workspace or file
dependency:
cd path/to/xref
bun install --frozen-lockfile
bun run build{
"dependencies": {
"@vercel-labs/xref": "file:../xref"
}
}import { classify, crawl, fileOverlaps, makeFetchNode, prioritize } from "@vercel-labs/xref";
import { httpTransport } from "@vercel-labs/xref/transport/http";
const repo = { owner: "owner", repo: "repo" };
const transport = httpTransport({ token: process.env.GITHUB_TOKEN! });
const { nodes } = await crawl(
[{ ...repo, number: 260 }],
{ maxDepth: 2, maxNodes: 80, hubThreshold: 12, primaryRepo: repo },
makeFetchNode(transport),
);
classify(nodes);
const priorities = prioritize(nodes, new Date());
const overlaps = fileOverlaps(nodes);Available entry points:
| Import | Requirements |
|---|---|
@vercel-labs/xref |
Runtime-agnostic graph core |
@vercel-labs/xref/transport/http |
fetch and a GitHub token |
@vercel-labs/xref/transport/shell |
An authenticated gh on PATH |
bun install --frozen-lockfile
bun run checkTo compare the shell and HTTP transports against a live repository:
bun run scripts/verify-transports.ts <number> <owner/repo> <depth>Apache-2.0