High-signal trees
Summarize any repository with per-directory stats, token estimates, and ignore rules applied. See structure, not just file counts.
CLI for high-signal code context
ctx walks your repository once and streams a focused view of the files, call chains, and docs that actually matter. Ship features faster, debug with confidence, and give your AI tools clean, repeatable context instead of screenshots and paste dumps.
go install github.com/tyemirov/ctx@latest
Why ctx
ctx is a small Go binary designed to be the context generator for your day-to-day work. It understands directory trees, call chains, documentation, and token budgets so you do not have to maintain ad-hoc scripts or huge copy-paste buffers when pairing with an LLM.
Summarize any repository with per-directory stats, token estimates, and ignore rules applied. See structure, not just file counts.
Stream exactly the files you care about, grouped and ordered with optional documentation, ready for reviews or prompt windows.
Follow behaviour across packages with ctx callchain and understand who calls what without juggling IDE tabs or grep scripts.
Use ctx doc to pull real documentation for your dependencies and feed both code and docs into your AI workflows in a single pass.
Getting started
ctx is a self-contained Go binary that fits next to your editor, issue tracker, and agent stack. Install it once, commit a couple of commands to your repo, and every engineer and agent gets the same trustworthy view of the codebase.
Use it interactively when exploring an unfamiliar system, or script it in CI to capture a high-signal snapshot for difficult regressions, releases, and incident reviews.
Core capabilities
ctx is intentionally small. Each command focuses on a single kind of context, and all of them share the same ignore rules, output formats, and documentation settings.
Use ctx tree to summarize repositories, filter generated noise, and get per-directory token estimates. Ideal for onboarding, pull request reviews, and “what even is this repo?” moments.
# High-signal tree view
ctx tree projectA projectB -e dist --tokens
# Stream the files that matter
ctx content internal/cli internal/commands \
--doc --format toon --tokens
Follow the flow of a feature across packages with ctx callchain. See callers, callees, and documentation in one streaming view that fits comfortably in a prompt window.
# Follow GetContentData and its callers
ctx callchain github.com/tyemirov/ctx/internal/commands.GetContentData \
--depth 2 --doc --format toon
Run ctx doc to collect READMEs and external docs for your Go, JavaScript, and Python dependencies. Bundle them alongside your code so humans and agents always see the “why”, not just the “what”.
# Discover and snapshot dependency docs
ctx doc discover . --ecosystems go,js,python \
--output-dir docs/dependencies
Workflows
ctx is designed to live next to your editor, issue tracker, and agent stack. You decide how much context to collect; ctx keeps it consistent and reproducible.
Attach a ctx snapshot to tricky pull requests so reviewers see the surrounding call chains, related files, and docs without leaving the diff.
Commit a small script that runs your go-to ctx commands. New engineers run one command and get a guided tour of the repo structure, key flows, and external docs in minutes.
Make ctx the front door for any AI system that needs to understand your codebase. It collects high-signal context; your agents focus on reasoning.