files-to-prompt  by simonw

CLI tool for LLM prompt construction

created 1 year ago
2,152 stars

Top 21.4% on sourcepulse

GitHubView on GitHub
Project Summary

This tool concatenates files from a directory into a single prompt for Large Language Models (LLMs), aiding users in providing comprehensive context. It's designed for developers and researchers working with LLMs who need to efficiently bundle codebases or documentation.

How It Works

The tool recursively traverses specified directories, optionally filtering by file extension, including hidden files, and respecting .gitignore patterns. It outputs file contents, prefixed by their relative paths, separated by ---. Special formatting options include Claude XML and Markdown fenced code blocks for LLM-specific prompt structuring.

Quick Start & Requirements

Highlighted Details

  • Supports filtering by multiple extensions (-e).
  • Includes options to include hidden files (--include-hidden) and ignore specific patterns (--ignore).
  • Offers output formats for Claude XML (--cxml) and Markdown (--markdown).
  • Can read file paths from stdin, supporting NUL-separated input (--null) for filenames with spaces.

Maintenance & Community

  • Developed by Simon Willison.
  • Development can be followed via the GitHub repository.

Licensing & Compatibility

  • Licensed under the MIT License.
  • Permissive license suitable for commercial use and integration into closed-source projects.

Limitations & Caveats

The tool's primary function is file concatenation; it does not perform semantic analysis or intelligent summarization of the content. Large numbers of files or very large files may result in prompts exceeding LLM context window limits.

Health Check
Last commit

5 months ago

Responsiveness

1+ week

Pull Requests (30d)
4
Issues (30d)
4
Star History
522 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.