Releases: danlentz/clj-xref
Claude/Codex Integration and Other Refinements
This release turns clj-xref into a first-class tool for AI coding assistants. A new CLI, a /xref slash command for Claude Code, and a
CLAUDE.md project guidance snippet together let Claude query the cross-reference database during normal coding work — before changing a
signature, tracing flow, or estimating blast radius — instead of falling back to grep.
Install
deps.edn (works for both CLI and tool invocations):
{:aliases
{:xref {:extra-deps {com.github.danlentz/clj-xref {:mvn/version "0.1.1"}}
:main-opts ["-m" "clj-xref.cli"]
:ns-default clj-xref.tool}}}
Leiningen:
:plugins [[com.github.danlentz/clj-xref "0.1.1"]]
:dependencies [[com.github.danlentz/clj-xref "0.1.1"]]
Highlights
Claude Code integration
Two drop-in artifacts ship in doc/:
- https://github.com/danlentz/clj-xref/blob/v0.1.1/doc/claude-slash-command.md — copy into .claude/commands/xref.md to expose xref queries
as user-invocable slash commands (/xref who-calls, /xref unused, /xref graph, etc.). - https://github.com/danlentz/clj-xref/blob/v0.1.1/doc/claude-md-template.md — paste into your project's CLAUDE.md to teach Claude to use
xref proactively during coding work: before signature changes, before deletions, when tracing unfamiliar code, when estimating blast
radius.
Both wrap the same CLI and work with any AI assistant that can run shell commands.
New CLI
clj -M:xref init
clj -M:xref who-calls myapp.orders/process-payment
clj -M:xref calls-who myapp.web/handler
clj -M:xref unused
clj -M:xref ns-deps myapp.orders
clj -M:xref graph myapp.core/main
Auto-generates the database on first query. See clj -M:xref with no args for the full command list.
Other new features
- Derived queries on the query API — unused-vars, call-graph (transitive, bidirectional, depth-limited), apropos (regex search).
- clj-xref.graph — DOT/Graphviz output for namespace dependency graphs and call graphs.
- Incremental analysis — lein xref :only src/foo.clj or clj -T:xref generate :only '["src/foo.clj"]' re-analyzes specific files without a
full rebuild. - LLM token savings benchmark (lein measure-improvement) — compares whole-tree vs xref-guided context selection on your own source via the
Claude API.
Resilience & fixes
- Best-effort database generation. Real-world codebases with custom macros or incomplete classpaths trigger unavoidable clj-kondo errors.
The database is now always written best-effort; a warning goes to stderr. Previously, a single kondo error would produce no output at all. - Atomic EDN writes — temp file + rename, so interrupted writes can't leave a corrupt database behind.
- Fixed: symbols with leading @ (npm scoped packages like @tanstack/react-pacer) are normalized before serialization
(#1). - Fixed: TokenNode values that clj-kondo emits in :var-definitions :name for macros expanding to def no longer break EDN round-tripping
(#3).
Under the hood
- All formatted output now uses the https://github.com/danlentz/clj-format Hiccup DSL.
- clj-kondo bumped to 2026.01.19, clj-format bumped to 0.1.2.
- Source files adopted the clj-uuid section banner style.
Full changelog
See https://github.com/danlentz/clj-xref/blob/v0.1.1/CHANGELOG.md#011---2026-04-20 for the complete list of changes.