A fast Rust based tool to serialize text-based files in a repository or directory for LLM consumption
A fast Rust based tool to serialize text-based files in a repository or directory for LLM consumption
yekA fast Rust based tool to serialize text-based files in a repository or directory for LLM consumption.[^1]
By default:
.gitignore rules to skip unwanted files.yek.yaml file.Yek يک means "One" in Farsi/Persian.
Consider having a simple repo like this:
.
├── README.md
├── src
│ ├── main.rs
│ └── utils.rs
└── tests
└── test.rs
Running yek in this directory will produce a single file and write it to the temp directory with the following content:
>>>> README.md
... content ...
>>>> tests/test.rs
... content ...
>>>> src/utils.rs
... content ...
>>>> src/main.rs
... content ...
[!NOTE]
yekwill prioritize more important files to come last in the output. This is useful for LLM consumption since LLMs tend to pay more attention to content that appears later in the context.
Choose the installation method for your platform:
curl -fsSL https://azimi.me/yek.sh | bash
For Windows (PowerShell):
irm https://azimi.me/yek.ps1 | iex
Build from Sourcegit clone https://github.com/mohsen1/yek
cd yek
cargo install --path .
yek has sensible defaults, you can simply run yek in a directory to serialize the entire repository. It will serialize all files in the repository and write them into a temporary file. The path to the file will be printed to the console.
Process current directory and write to temp directory:
yek
Pipe output to clipboard (macOS):
yek src/ | pbcopy
Cap the max output size to 128K tokens:
yek --tokens 128k
[!NOTE]
yekwill remove any files that won't fit in the capped context size. It will try to fit in more important files
yek --max-size 100KB --output-dir /tmp/yek src/
Process multiple directories:
yek src/ tests/
Process multiple files
yek file1.txt file2.txt file3.txt
Use glob patterns:
yek "src/**/*.ts"
yek "src/main.rs" "tests/*.rs" "docs/README.md"
[!NOTE] When using glob patterns, make sure to quote them to prevent shell expansion.
…
[input-paths]... - Files or directories to process. Supports glob patterns (quote them to prevent shell expansion)--no-config - Skip loading any configuration file--config-file <CONFIG_FILE> - Use a specific configuration file path instead of searching for default config files-V, --version - Print version information and exit--max-size <MAX_SIZE> - Maximum size limit per output (e.g., "10MB", "128K"). Used in byte mode--tokens <TOKENS> - Use token-based counting instead of bytes (e.g., "128k", "100"). Enables token mode--json - Output results in JSON format instead of text--debug - Enable debug logging for troubleshooting--line-numbers - Include line numbers in the output for each file--output-dir [<OUTPUT_DIR>] - Directory to write output files. If not specified and not streaming, uses temp directory--output-name [<OUTPUT_NAME>] - Specific filename for output. If specified, writes to current directory with this name--output-template [<OUTPUT_TEMPLATE>] - Template for formatting output. Use FILE_PATH and FILE_CONTENT placeholders--ignore-patterns <IGNORE_PATTERNS>... - Additional patterns to ignore (extends .gitignore and defaults)--unignore-patterns <UNIGNORE_PATTERNS>... - Patterns to override built-in ignore rules-t, --tree-header - Include a directory tree at the beginning of output (incompatible with JSON)--tree-only - Show only the directory tree structure without file contents (incompatible with JSON)You can place a file called yek.yaml at your project root or pass a custom path via --config-file. The configuration file allows you to:
Most CLI options can be configured in the config file. The following options can be set:
File Processing:
max_size - Size limit (same as --max-size)tokens - Token count limit (same as --tokens)ignore_patterns - Additional ignore patterns (same as --ignore-patterns)unignore_patterns - Override built-in ignores (same as --unignore-patterns)Output Configuration:
json - Enable JSON output (same as --json)debug - Enable debug mode (same as --debug)line_numbers - Include line numbers (same as --line-numbers)output_dir - Output directory (same as --output-dir)output_name - Output filename (same as --output-name)output_template - Output template (same as --output-template)tree_header - Include directory tree header (same as --tree-header)tree_only - Show only directory tree (same as --tree-only)Config-only Options:
priority_rules - File priority rules (config file only)binary_extensions - Additional binary file extensions (config file only)git_boost_max - Maximum Git-based priority boost (config file only)[!NOTE] Some CLI options like
--no-config,--config-file, and--versionare CLI-only and cannot be set in config files.
yek.yamlYou can also use yek.toml or yek.json instead of yek.yaml.
This is optional, you can configure the yek.yaml file at the root of your project.
…
yek is fast. It's written in Rust and does many things in parallel to speed up processing.
Here is a benchmark comparing it to Repomix serializing the Next.js project:
time yek
Executed in 5.19 secs fish external
usr time 2.85 secs 54.00 micros 2.85 secs
sys time 6.31 secs 629.00 micros 6.31 secs
time repomix
Executed in 22.24 mins fish external
usr time 21.99 mins 0.18 millis 21.99 mins
sys time 0.23 mins 1.72 millis 0.23 mins
yek is 230x faster than repomix.
See proposed features. I am open to accepting new feature requests. Please write a detailed proposal to discuss new features.
yek.[^1]: yek is not "blazingly" fast. It's just fast, as fast as your computer can be.
No open issues yet, or sync has not completed.