Proven in day-to-day engineering workflows

CLI for high-signal code context

Context that fits in a single command.

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

Built for engineers, friendly to agents

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.

High-signal trees

Summarize any repository with per-directory stats, token estimates, and ignore rules applied. See structure, not just file counts.

Context-ready content

Stream exactly the files you care about, grouped and ordered with optional documentation, ready for reviews or prompt windows.

Callchain navigation

Follow behaviour across packages with ctx callchain and understand who calls what without juggling IDE tabs or grep scripts.

Docs-aware agents

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

Get started in minutes

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

Four commands, one mental model

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.

See the structure, not just the size

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.

  • Respects .gitignore and .ignore files at every directory level.
  • Streams output so large repositories stay responsive.
  • Generates Toon, JSON, or XML output for humans and automation.
# 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

Trace behaviour with call chains

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

Harvest real documentation, not guesswork

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

Where ctx fits best

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.