One Command Copies Your Entire Codebase Into AI Context

A quiet CLI has been sitting on one developer’s machine for a year, used daily, barely known outside his terminal. Yesterday the redesign shipped. The twist is in how it actually moves your code.

cxt grabs files and directories from your repo, wraps everything in XML tags with full file paths, and drops it into your clipboard as one clean block. Paste it into Claude, ChatGPT, or any web AI and the model gets proper codebase context in one shot. No tab-switching, no manual copying, no forgotten files.

That last part matters more than it sounds. Anyone who has spent ten minutes copy-pasting three separate files into a chat window, realized they forgot the config, gone back for it, and then wondered why the model’s answer doesn’t quite match the actual structure, knows the real tax here. It’s not one big interruption. It’s a dozen small ones that quietly kill your focus. A single command that grabs everything in one pass removes that entirely. You go from problem to answer without touching your mouse twice.

The XML wrapping is also worth calling out here. Most people just paste raw code. cxt wraps each file with its full path in structured tags, so the model actually knows what it’s looking at. Not just “here’s some code” but “here’s src/auth/middleware.rs, here’s src/auth/session.rs, here’s Cargo.toml.” That structure is doing real work. Models parse it better, reference the right file when they suggest edits, and hallucinate less on multi-file questions. The difference is subtle on a two-file paste. On a fifteen-file context drop, it’s night and day.

The redesign streams code directly into the clipboard instead of building it in memory first. On large repos, that’s the difference between instant and sluggish. Before the streaming rewrite, feeding a mid-sized Rust project into the tool could stall for a second or two while it assembled the full block in RAM. Now it pipes straight through. The first character hits the clipboard before the last file is read. On a repo with 40 or 50 files, you feel that immediately.

How to run it 🛠️

  1. Install: cargo install cxt (also on homebrew and AUR, see the README). If you’re on macOS and already using Homebrew, it’s a one-liner. Cargo takes slightly longer on a cold install but you only do it once.
  2. Run cxt src/ to grab a directory, or launch the interactive TUI picker with no args to select files visually 📂. The TUI is worth exploring at least once. It gives you a fuzzy-searchable file tree where you check boxes, hit enter, and the selection lands in your clipboard. Useful when you want two non-adjacent files from different subdirectories without typing a glob.
  3. Filter by language: cxt --lang rust src/ extracts only .rs files and Cargo.toml automatically. The language detection is not just extension-matching. For Rust it pulls the manifest. For Python it grabs pyproject.toml or requirements.txt alongside the .py files. Dependency context travels with the code.
  4. Paste into your AI tool. XML tags and file paths are already wrapped and ready 📋. Most interfaces handle large pastes fine. If you’re hitting a context limit, use --lang to narrow the selection rather than manually trimming.

Pro tip

The --lang flag is the sleeper feature here. In a mixed-language repo, cxt --lang bash * pulls only shell scripts. No Python config noise polluting a context window you’re using to debug a bash issue.

Take that further. If you’re debugging a specific subsystem, point cxt at the subdirectory and filter by language at the same time. Something like cxt --lang python agents/news-aggregator/src/ gives you exactly the Python files in that one module. Nothing else. That’s the context the model actually needs. Giving it more doesn’t help. It gives the model more room to anchor on the wrong thing.

The XML tagging with file paths is not just cosmetic. Structured context reduces hallucination and improves edit accuracy. Models parse it better than a raw wall of code. When you ask “update the retry logic in the extractor,” the model already knows which file that means. You’re not hoping it guesses right. The path is right there in the tag.

One more move worth knowing: cxt plays well with pipes. You can redirect output to a file instead of the clipboard if you want to inspect what’s going into the model before you paste it. cxt src/ > context.txt and then open it once to see the structure. Do that on a new repo and you’ll immediately see how the model is going to interpret your codebase. Fix the structure, then paste.

Grab it at github.com/vaibhav-mattoo/cxt. Star it if it earns a spot in your daily flow 🚀

Frequently Asked Questions

Q: Will cxt handle large codebases without slowing down or using tons of memory?

Yep. cxt streams directly to your clipboard with constant memory usage, no matter how big your project is. It’s been optimized to be 300x more memory-efficient and 4x faster than the naive approach of buffering everything in RAM, so it scales really well even with huge repositories.

Q: What’s the –lang flag, and when would I use it?

The –lang flag filters your context to just files from a specific programming language. So `cxt –lang rust src/` grabs only Rust files and Cargo.toml, or `cxt –lang bash *` gets just your scripts. Super handy in multi-language projects when you want to give the AI focused context about only the part you’re working on.

Q: How do the XML tags actually help my AI assistant understand my code?

The XML structure with file paths gives AI models clear context about where each code block comes from and how your project is organized. Most modern AI handles XML really well, so this makes their responses way more accurate and relevant to your actual codebase.

Q: What about binary files, images, and other non-code stuff in my project?

cxt automatically detects binary files with a fast pre-scan and skips them before reading, so you only get actual code in your clipboard, no bloat or unreadable content.

cxt: a CLI/TUI tool to aggregate your code files into a single clipboard ready block for web AI
by u/YboMa2 in PromptEngineering

Scroll to Top