Aggregate files and directories quickly into a single clipboard-ready context block, tuned for feeding code to AI assistants.
cxt_video.mp4
Install script (all platforms)
curl -sSfL https://raw.githubusercontent.com/vaibhav-mattoo/cxt/main/install.sh | shIf prompted, add ~/.local/bin to your PATH: export PATH="$HOME/.local/bin:$PATH"
Cargo
cargo install cxtHomebrew (macOS / Linux)
brew tap vaibhav-mattoo/cxt && brew install cxtAUR (Arch Linux)
yay -S cxt # or: paru -S cxtFrom source
git clone https://github.com/vaibhav-mattoo/cxt.git
cd cxt && cargo install --path .# for tui (recommended)
cxt
# or cli
cxt src/ README.md # aggregate paths → clipboard# Explicit paths (shell globs are expanded automatically)
cxt src/ tests/ README.md Cargo.toml
# any newline-delimited list of paths
fd -e rs | cxt
git diff --name-only HEAD | cxt
cat file_list.txt | cxt
# Interactive TUI picker
cxt
cxt --tui
# Single image copies the image itself to clipboard (not its path)
cxt screenshot.pngcxt src/ # clipboard (default)
cxt -p src/ # stdout + clipboard
cxt -w context.xml src/ # write to file
cxt -w snapshot.gz --compress src/ # write gzip-compressed file
# Decompress: gunzip snapshot.gz
# View: zcat snapshot.gz | lesscxt --format xml src/ # default : XML with <file path="…"> tags
cxt --format markdown src/ # Markdown with ## headings and fenced code blocksXML (default)
<context>
<file path="/abs/path/to/main.rs">
fn main() { … }
</file>
</context>Markdown
## File: src/main.rs
```rust
fn main() { … }
### Path headers
```bash
cxt src/ # absolute paths (default)
cxt -r src/ # relative to current directory
cxt -n src/ # no headers, raw content only
cxt --hidden src/ # include hidden / dot files
Language and extension filters
cxt --lang rust src/ # Rust files only → rs, toml
cxt --lang python . # Python files only → py, pyi, pyw
cxt --lang js --lang ts src/ # multiple languages
cxt --ext rs,toml src/ # specific extensions
cxt --lang rust --ext md src/ # combine --lang and --ext
cxt --lang help # list all supported languages and their extensionsSupported languages include: rust, python, javascript, typescript, go, java, c, cpp, csharp, ruby, swift, kotlin, shell, html, css, sql, markdown, yaml, json, toml, nix, terraform, graphql, dockerfile, and more.
Ignore paths and glob patterns (-i is repeatable)
cxt -i target/ src/ # ignore exact path
cxt -i "*.min.js" src/ # ignore by filename glob
cxt -i "**/__pycache__" . # ignore by path glob
cxt -i node_modules/ -i "*.lock" . # combine multiple ignores
Binary files are detected automatically and skipped with a warning.
Launch with cxt or cxt --tui to browse and select files interactively.
| Key | Action |
|---|---|
↑ / ↓ / j / k |
Move cursor |
→ / l / Enter |
Expand directory |
← / h / Backspace |
Collapse / go to parent directory |
Space |
Select / unselect file or directory |
/ or ctrl-f |
Enter fuzzy search |
? |
Toggle keybinding help overlay |
r |
Toggle relative path headers |
n |
Toggle no path headers |
c |
Confirm selection → copy to clipboard |
q / Ctrl-c |
Quit |
| Flag | Description |
|---|---|
-p, --print |
Print to stdout (also copies to clipboard) |
-w, --write <FILE> |
Write output to a file |
--compress |
Gzip-compress output, requires --write |
--format <xml|markdown> |
Output format (default: xml) |
-r, --relative |
Use relative paths in headers |
-n, --no-path |
Omit file path headers |
--hidden |
Include hidden / dot files |
-i, --ignore <PATH> |
Ignore a path or glob pattern, repeatable |
--ext <EXT[,EXT…]> |
Include only files with these extensions, repeatable |
--lang <LANG[,LANG…]> |
Include only files for this language, repeatable |
--no-sort |
Non-deterministic output order (faster for large trees) |
-t, --tui |
Launch interactive TUI file picker |
curl -sSfL https://raw.githubusercontent.com/vaibhav-mattoo/cxt/main/uninstall.sh | shFor package manager installs, use the respective remove command (cargo uninstall cxt, brew uninstall cxt, yay -R cxt).
MIT : see LICENSE.