folder2md4llms¶
Convert a folder and its contents into a single Markdown file for use as LLM context. It walks a directory, formats each file, converts common documents to text, describes binary files, and can condense code to fit a token or character budget.
Quick start¶
# Install (macOS)
brew install henriqueslab/formulas/folder2md4llms
# Or any platform
pipx install folder2md4llms
# Convert the current directory to output.md
folder2md .
# Fit the output to a token budget (enables smart condensing)
folder2md . --limit 80000t
The package is folder2md4llms; the command is folder2md.
What it does¶
- Single-file output. One Markdown file with a directory tree, optional stats, and the contents of each processed file.
- Smart condensing. With
--limit, code is condensed to signatures and docstrings to fit a token or character budget instead of being truncated. - Document conversion. PDF, DOCX, XLSX, PPTX, and notebooks are converted to text (
convert_docs, on by default). - Binary descriptions. Images, archives, and other binaries get a short description rather than raw bytes (
describe_binaries, on by default). - Filtering. Respects
.gitignoreand a.folder2md_ignorefile you can scaffold with--init-ignore. - Parallel processing. Files are processed concurrently (
max_workers, default 4).