stacklit

module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: MIT

README

Stacklit

A committed map of your codebase, built for AI coding agents.

CI Release npm version npm downloads Go reference MIT license

stacklit init in a terminal

Stacklit parses your repo with tree-sitter and writes stacklit.json: modules, exports, dependency edges and hints. Commit it, and an agent reads a few hundred tokens instead of rediscovering the layout every session. Free and MIT, no paid tier. One Go binary, local and deterministic, no LLM, and the CLI makes no network calls. (The map page can load language icons from thesvg.org; STACKLIT_MAP_ICONS=off removes that.)

Install

npx stacklit init                                   # scan, write the index, open the map
stacklit setup                                      # wire up the assistants it detects
git add stacklit.json && git commit -m "add stacklit index"

Also: brew install glincker/tap/stacklit, npm install -g stacklit, go install github.com/glincker/stacklit/cmd/stacklit@latest, or a binary from Releases.

See it

Visual map of a repo Copy-ready prompts for an agent Flow steps through a codebase

Output

stacklit derive prints a compact map for a prompt (gin v1.10.0, 137 tokens, module list trimmed here):

gin | go | 8 modules | 19,537 lines | Gin, GitHub Actions, net/http
test: go test ./... | env: PORT

modules:
  binding             binding | depends: bytesconv, json
  internal/bytesconv  bytesconv | depended-by: binding, render, root
  render              render | depends: bytesconv, json
  root                root package | depends: binding, bytesconv, json, render
do-not-touch: .github/

stacklit query returns a token-budgeted slice of the symbol graph (output trimmed here):

$ stacklit query "how is the symbol graph built" --budget 600
internal/cli/graphcmds.go
  50-63 func buildSymbolGraph(root string, includeTests ...bool) (*graph.SymGraph, error)
      calls BuildSymbols E0.95
internal/graph/resolve.go
  955-961 func BuildSymbols(root string, files []string, eo ExtractOptions) *SymGraph

What you get

Index stacklit.json, a Mermaid diagram (DEPENDENCIES.md by default, set with output.mermaid) and an interactive stacklit.html map
Languages 48 languages and formats indexed; symbol graph for 20 (list)
Queries query, explain, impact, path, hubs, slice, each with a hard --budget
MCP stacklit serve: 15 tools, or --profile minimal for 4 (about 230 tokens of schema)
Hooks git post-commit refresh; optional Claude Code hook that points a grepped identifier to its definition
CI export (graphml, cypher, dot, mermaid and more), check architecture rules, status freshness, merge-graphs, a GitHub Action
Deterministic same repo, same bytes. A committed index only changes when the code does
Privacy no telemetry, no upload. The map loads language logos from thesvg.org unless STACKLIT_MAP_ICONS=off (details)

Assistants

Claude Code  Cursor  Codex  Gemini CLI  GitHub Copilot  Windsurf  Zed  Amp

stacklit setup --list shows all 26 targets, including Aider, Cline, Continue, OpenCode, Roo Code, Kiro and a generic AGENTS.md. Anything else can read stacklit.json directly.

Benchmark

Three pinned repos, 30 navigation tasks, no model calls, tokens as bytes / 4. The index is 2,524 to 16,126 tokens and the derived map 137 to 1,372. This does not show a token saving over grep: when the exact symbol is known, grep is cheaper, and the grep and read baseline found the answer on 30 of 30 tasks against 27 for the map path. What it shows is cheap orientation. Method, misses and limits: bench/RESULTS.md.

Docs

Usage | Languages | FAQ | Privacy | Architecture | Comparison | Roadmap | Changelog | Agent skill | Brand kit

Contributing: .github/CONTRIBUTING.md. Security reports: .github/SECURITY.md. Questions: Discussions.

MIT. See LICENSE.

Directories

Path Synopsis
Command bench measures stacklit against several baselines on pinned public repos.
Command bench measures stacklit against several baselines on pinned public repos.
agent-ab command
Command agent-ab runs real agent sessions twice per task, once without and once with Stacklit configured, and compares the usage Claude Code reports.
Command agent-ab runs real agent sessions twice per task, once without and once with Stacklit configured, and compares the usage Claude Code reports.
cmd
stacklit command
internal
cache
Package cache persists parse results between runs, keyed by a hash of each file's path and content, so regeneration only re-parses what changed.
Package cache persists parse results between runs, keyed by a hash of each file's path and content, so regeneration only re-parses what changed.
check
Package check evaluates architecture rules from .stacklitrc.json against the module graph: forbidden edges, cycles, fan-in and fan-out limits, orphans.
Package check evaluates architecture rules from .stacklitrc.json against the module graph: forbidden edges, cycles, fan-in and fan-out limits, orphans.
cli
doctor
Package doctor diagnoses a repo's stacklit setup: config, hooks, index freshness, skipped files and parse failures.
Package doctor diagnoses a repo's stacklit setup: config, hooks, index freshness, skipped files and parse failures.
export
Package export renders the module graph and the symbol graph into formats other tools read: GraphML, Cypher, JSON, DOT, Mermaid, an Obsidian vault and a token-budgeted markdown wiki.
Package export renders the module graph and the symbol graph into formats other tools read: GraphML, Cypher, JSON, DOT, Mermaid, an Obsidian vault and a token-budgeted markdown wiki.
fsutil
Package fsutil holds small filesystem helpers shared across stacklit.
Package fsutil holds small filesystem helpers shared across stacklit.
git
ingest
Package ingest adds non-code context (docs, API specs, SQL schemas and ownership) to a sidecar file, stacklit.context.json.
Package ingest adds non-code context (docs, API specs, SQL schemas and ownership) to a sidecar file, stacklit.context.json.
mcp
merge
Package merge combines symbol graphs from several repositories into one and links repositories that depend on each other through manifest names.
Package merge combines symbol graphs from several repositories into one and links repositories that depend on each other through manifest names.
monorepo
Package monorepo detects monorepo/workspace boundaries and reports the repo type along with resolved workspace paths.
Package monorepo detects monorepo/workspace boundaries and reports the repo type along with resolved workspace paths.
scip
Package scip reads the parts of a SCIP index that stacklit needs (documents, occurrences, symbol names) with a small hand-written protobuf decoder, so no protobuf dependency is added.
Package scip reads the parts of a SCIP index that stacklit needs (documents, occurrences, symbol names) with a small hand-written protobuf decoder, so no protobuf dependency is added.
session
Package session holds the per-worktree plumbing shared by the session hooks: root resolution, a state directory, an advisory lock, a pending queue for debounced refreshes and the structure hash.
Package session holds the per-worktree plumbing shared by the session hooks: root resolution, a state directory, an advisory lock, a pending queue for debounced refreshes and the structure hash.
setup
Package setup wires stacklit into AI coding assistants.
Package setup wires stacklit into AI coding assistants.
stats
Package stats keeps an opt-in, local-only usage log.
Package stats keeps an opt-in, local-only usage log.
walker
Package walker provides a gitignore-aware file walker that returns all source files worth indexing from a given root directory.
Package walker provides a gitignore-aware file walker that returns all source files worth indexing from a given root directory.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL