A powerful script that generates a clean, LLM-optimized
.txtfile of your entire project. Ideal for AI prompt engineering, documentation, and audits.
π Purpose
This script was designed to generate a unified .txt file that includes:
- A clean project tree structure
- The full contents of all relevant source files
This format follows the llm_txt methodology, optimized for input into Large Language Models (LLMs) like GPT. It's perfect for use in AI agents, prompt chaining, code analysis, or retrieval-augmented generation.
π Example Output (llm_txt.txt)
\------------------------ PROJECT TREE ------------------------
.
βββ README.md
\------------------------ ./README.md ------------------------
# LLM\_TXT Generator
...
π What is `llm_txt` format?
The llm_txt format is a flat, readable structure used for giving LLMs a complete overview of a project:
β All files concatenated into one file β No binary or noisy files β Each section clearly marked β Tree structure as top-level context
This enables better comprehension by LLMs β especially when used for reasoning, debugging, or interpreting entire codebases.
βοΈ How It Works
- Removes old
llm_txt.txt - Generates a tree overview of the project
- Finds all relevant files based on include/exclude rules
- Concatenates all contents into
llm_txt.txt
π οΈ Usage
Run the script from your terminal:
bash llm_txt.sh
β οΈ Make sure you havetreeinstalled:
sudo apt install treeπ« What Gets Excluded?
Directories:
.git.vscode
Files:
llm_txt.txt.gitignore,kubeconfig- The script itself (
llm_txt.sh)
You can customize the excluded paths in the script.
π€ Author
Chris Engelhard π§ chris@chrisengelhard.nl π www.chrisengelhard.nl π’ Digi4Care
πͺͺ License
This project is licensed under the MIT License.
π‘ Ideas or Contributions?
Suggestions are welcome!