Project Context Combiner is a lightweight Python utility that recursively scans your project folder and merges all relevant source files into a single structured text file, ready to paste into an AI chat or share with a collaborator.
It automatically:
- Skips media files (images, audio, video)
- Skips large files (> 1 MB) and large folders (> 3 MB)
- Preserves file paths above each code block for context
- Copies the entire combined content to your clipboard
- Deletes the temporary output file automatically
✅ Perfect for AI code assistance — provides full project context in one paste
✅ Clean & lightweight — no heavy dependencies (only pyperclip
)
✅ Structure-preserving — easy for AI or humans to understand code location
✅ No manual zipping — one command and you're done
❌ Without this | 💥 Issue |
---|---|
Sending single files to AI | Loses project-wide context |
Manual zipping & explaining structure | Time-consuming |
Including large/binary files | Bloats the output & wastes tokens |
No clipboard integration | Requires manual copy-paste |
✅ Feature | 🚀 Benefit |
---|---|
Recursively scans the project folder | Captures all relevant code |
Skips media, config, lock files | Keeps output clean |
File path comments above each block | Maintains structure |
Size filters for files & folders | Avoids bloat |
Auto-copy to clipboard | Ready for AI chat instantly |
Auto-delete temporary file | No leftover junk |
pip install pyperclip
python combine_files.py <directory_path> <output_filename>
Example:
python combine_files.py ./myproject combined_code
After running:
- The combined code will be copied to your clipboard
- The temporary
.txt
file will be deleted automatically
# /path/to/project/app/main.py
print("Hello world")
# /path/to/project/utils/helpers.py
def add(a, b):
return a + b
This structure helps AI or reviewers instantly know where each piece of code lives.
Component | Details |
---|---|
Language | Python 3+ |
Dependencies | pyperclip |
Usage Scope | Any text/code-based project |
Output Format | Single .txt (clipboard + temp file) |
MIT — free to use, modify, and integrate.
⭐ If this tool saved you time — star it on GitHub and share it with fellow developers!