lx turns a pile of files into one prompt you can paste into an LLM.
Point it at a directory and it walks the tree, honours your ignore files, leaves binaries alone, and prints the result as Markdown, XML, HTML, or plain text. It adds a token estimate so you know what you're about to spend.
Install · Everyday use · Where files come from · Stream processing · Configuration
go install github.com/rasros/lx/cmd/lx@latestOr grab a pre-built binary:
curl -fsSL https://raw.github.com/rasros/lx/main/install.sh | bashThe clipboard flag (-c) needs xclip (X11) or wl-clipboard (Wayland) on Linux; macOS and Windows already have what they
need.
The common case is "bundle this project and put it on my clipboard":
lx -cWith no arguments lx starts from the current directory, but you can name any paths you like:
lx src/ docs/It respects .gitignore, .ignore, and .lxignore, skips hidden files, and drops binaries, so you usually get
sensible output without asking for it.
Get your bearings first. -t prints just the directory tree; -T prints the tree and the files under it:
lx -t src/Skip the bodies. -u and -Y extract function signatures and type definitions instead of full source, which is
often all a model needs to reason about a codebase:
lx -u -Y src/Narrow things down with include/exclude globs. Here, Python without the tests:
lx -i "*.py" -e "*test*" src/Since lx reads paths from stdin, it composes with whatever you already use to pick files:
git diff --name-only main | lx -c # everything you changed
fd -t f | fzf -m --preview 'lx -n 20 {}' | lx -c # pick interactivelyAttach a prompt and pipe it straight into a tool like llm:
lx -p "Explain this project structure" src/ | llm
lx -p "Refactor this to use contexts:" main.goWithout -c or -o, output goes to stdout.
Local paths are the default, but they aren't the only option.
A URL can sit anywhere a path can:
lx https://example.com/config.yaml src/Short repository URLs are pulled down as archives, so you can bundle a project you haven't cloned. GitHub, GitLab, Bitbucket, and Codeberg all work:
lx github.com/owner/repo
lx https://gitlab.com/owner/repo/-/tree/devLocal archives expand with -Z (zip, tar, 7z, rar, and friends):
lx -Z archive.zipAnd -D pulls readable text out of PDFs, Word docs, spreadsheets, and slide decks that would otherwise be skipped as
binary:
lx -D docs/Markdown is the default. The rest are one flag each:
lx --xml . # XML, handy for models that like tags
lx --html src/ docs/ # a standalone HTML page
lx --bare file.txt # plain text, almost no wrappingReusable prompts live in ~/.config/lx/prompts (override with $LX_PROMPTS_DIR or --prompts-dir). Reference them by
path, filename, or any unambiguous basename. An ambiguous name just prints the candidates so you can be more specific.
lx -P refactor src/
lx -P go/test src/foo.go -c
lx -P plan -P comments docs/ src/ # stack as many as you want
lx --list-promptsrasros/prompts is an example library to start from.
Use -s to label groups of files, which also become section names in XML output:
lx -s "Code under test" src/database/users \
-s "Test fixtures" src/tests/fixturesThis is the one idea worth understanding: lx reads arguments left to right, and an option applies to the files that
come after it.
lx --tail 50 app.log -l src/That takes the last 50 lines of app.log, then src/ with line numbers: two different treatments in one command. When
an option (or -s) appears after a file, lx opens a fresh section and resets the per-section options, so settings
don't leak from one group into the next:
lx --tail 50 app.log \
-u src/ \
-i "*.md" docs/The tail of a log, code skeletons from src/, and the Markdown under docs/, each on its own terms.
Drop a ~/.config/lx/config.yaml to change the defaults; anything you leave out keeps its built-in value.
output_mode: "copy" # stdout | copy
output_format: "xml" # markdown | xml | html | bare
prompts_dir: "~/Workspaces/prompts"Two ready-made profiles ship with the repo: default_config.yaml and
xml_config.yaml. Point at one for a single run with -y, or set $LX_CONFIG to make it the
default:
lx -y xml_config.yaml src/CONFIG.md has the full reference, including template context and helpers.
skills/lx/SKILL.md teaches coding agents to reach for lx when they explore a codebase. Symlink
it wherever your agent looks for skills:
ln -s "$(pwd)/skills/lx" ~/.claude/skills/lx
ln -s "$(pwd)/skills/lx" ~/.config/opencode/skills/lx