the ultimate context packer for your AI coding assistant. it scans your repo, ditches the junk, and bundles the good stuff into one perfect, clipboard-ready prompt.
โก Get Started โข โจ Key Features โข ๐ฎ Usage & Examples โข โ๏ธ Advanced Flags โข ๐ Comparison
repo-to-llm-context is the project manager your AI assistant wishes it had. Stop feeding your LLM random files and praying for a good answer. This tool acts like a pro developer, reading your entire project, intelligently selecting the most relevant files, and packaging them into a perfectly structured prompt so your AI can actually understand what the hell is going on.
|
Smart Filtering Ditches node_modules & junk |
Relevance Scoring Puts the important code first |
Clipboard Ready One command, ready to paste |
How it slaps:
- You:
cd my-project && context context: Scans, filters, scores, formats, and copies.- You:
Cmd+Vinto Claude/ChatGPT/Gemini. - LLM: "Ah, I see. A well-structured project. Here is your god-tier answer."
Manually prepping context is a vibe-killer. repo-to-llm-context makes other methods look ancient.
| โ The Old Way (Pain) | โ The `context` Way (Glory) |
|
|
We're not just concatenating files. We're building a high-signal, low-noise prompt with intelligent depth-first traversal that processes directories systematically, prioritizes README files, and prevents massive files from breaking your LLM's context window.
The context command will be available in your terminal after installation.
| Platform | Recommended Method | One-liner |
|---|---|---|
| ๐ macOS | Homebrew | brew install yigitkonur/context/context |
| ๐ช Windows | Scoop | scoop bucket add context https://github.com/yigitkonur/scoop-context && scoop install context |
| ๐ง Linux | Homebrew | brew install yigitkonur/context/context |
The cleanest, most native experience for Mac users.
# Add the tap and install (one-time setup)
brew tap yigitkonur/context
brew install yigitkonur/context/contextScoop is the developer's choice for Windows package management. No admin rights needed!
# First, install Scoop if you don't have it (one-time)
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
# Add the bucket and install
scoop bucket add context https://github.com/yigitkonur/scoop-context
scoop install contextIf you already have Python installed and prefer pipx:
# 1. Install pipx if you don't have it
python -m pip install --user pipx
python -m pipx ensurepath
# 2. Install the tool
pipx install repo-to-llm-contextHomebrew works great on Linux too!
# Install Homebrew for Linux (if not installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add the tap and install
brew tap yigitkonur/context
brew install yigitkonur/context/contextFor Linux users who prefer pipx over Homebrew:
# 1. Install pipx if you don't have it
python3 -m pip install --user pipx
python3 -m pipx ensurepath
# 2. Install the tool
pipx install repo-to-llm-contextโจ Zero Manual Setup: After installation, the
contextcommand should be ready to go. If not, just restart your terminal!
The workflow is dead simple.
1. Navigate to Your Project
cd /path/to/your/killer-app2. Run the Command
contextYour clipboard is now loaded with perfectly formatted Markdown.
3. Paste & Prompt Go to your favorite LLM and paste the context. Now you can ask the real questions.
You can now clone and analyze any public GitHub repository directly without downloading it locally!
Supported Formats:
owner/repo- Shorthand formatowner/repo@branch- Specific branchhttps://github.com/owner/repo- Full URLgithub.com/owner/repo- Short URL
Examples:
# Clone and scan a repository
context sindresorhus/is-online
# Scan specific branch
context facebook/react@main
# Full GitHub URL
context https://github.com/torvalds/linux
# With filtering options
context owner/repo --include "*.py" --preview
# Output to file instead of clipboard
context owner/repo --output analysis.mdThe tool automatically:
- Performs shallow clones for speed
- Manages temporary directories (auto-cleanup on exit)
- Shows GitHub source links in output
- Applies the same intelligent filtering to remote repositories
Got massive JSON files or generated code breaking your LLM context? We've got you covered.
- Skip large files entirely:
context --skip-large-files --max-file-chars 5000
- Truncate large files with smart preview:
context --truncate-large-files --max-file-chars 8000
- Custom limits for different projects:
context --max-file-chars 15000 --truncate-large-files
The tool shows exactly what it's doing:
INFO: Truncated response.json: 1,487,897 โ 10,075 chars
Success: 530,745 chars copied to clipboard
Don't want it on your clipboard? No problem.
- Save to a file:
context --output project_context.md
- Print directly to your terminal (for piping or peeking):
context --stdout
| Feature | What It Does | Why You Care |
|---|---|---|
๐ง Smart FilteringNo junk allowed |
Auto-excludes node_modules, venv, builds, .git, logs & more |
Stops you from wasting tokens on garbage |
๐ฏ Depth-First SortingPerfect file order |
Traverses directories systematically, README.md files first | Your LLM gets context in logical, hierarchical order |
๐ Large File ControlToken-aware sizing |
Skip or truncate files over configurable limits (default: 50K chars) | Never blow your LLM's context window again |
๐๏ธ Project TreeVisual context |
Includes a tree-style view of what's included |
The AI (and you) can see the project structure |
โ๏ธ Git-AwareRespects your repo |
Can read your .gitignore and check tracking status |
Context matches your actual source code |
๐ Clipboard ReadyCmd+C on steroids |
Copies the entire formatted output in one go | Zero manual work between terminal and AI |
๐ง Hyper-ConfigurableYou're the boss |
Flags to include/exclude anything you want | Fine-tune the context for any weird project |
๐ Privacy FirstNo path leaks |
Masks your local home directory path in the summary | Share your code, not your user folder |
๐ฏ Interactive ModeGuided setup |
Run --interactive for a step-by-step config wizard |
Perfect for first-time users or complex setups |
The defaults are great, but you can dial it in just right.
Expand for the full list of command-line flags
--include PATTERN: Glob pattern to force inclusion of files/directories that might be excluded (e.g.,--include "config/**.yaml").--exclude PATTERN: Glob pattern to add custom exclusions beyond the defaults (e.g.,--exclude "*.log").--include-only: A powerful mode that includes only files matching--includepatterns, excluding everything else.--exclude-extension EXT: Exclude all files with a specific extension (e.g.,--exclude-extension .tmp).--include-extension EXT: Force include files with an extension that is normally excluded by default.
--include-json: Include.json/.jsoncfiles.--include-yaml: Include.yaml/.ymlfiles.--include-xml: Include.xmlfiles.--include-html: Include.html/.htmfiles.--include-css: Include.cssfiles.--include-sql: Include.sqlfiles.--include-csv: Include.csv/.tsvfiles.--include-markdown: Include all Markdown files, not just the rootREADME.md.
--max-size SIZE: Exclude files larger than the specified size (e.g.,500k,10M). Default is2M.--max-file-chars N: Set maximum characters per file (default: 50,000). Works with skip/truncate options.--skip-large-files: Skip files that exceed the--max-file-charslimit entirely.--truncate-large-files: Keep large files but show only the first N characters with a truncation notice.--include-binary: Attempt to include files detected as binary (default is to exclude them).--max-depth N: Limit scanning to a maximum directory depth.
--no-gitignore: Ignore.gitignorerules and Git tracking status entirely.--gitignore-only: (Default) Use.gitignorerules for exclusion but don't filter based on Git tracking status.--use-git: Use both.gitignorerules and only include files that are tracked by Git.
--output FILE: Write output to a file instead of the clipboard.--stdout: Print the full output to the terminal.--no-clipboard: Disable automatic copying to the clipboard (useful when using--stdoutor--output).--preview: Show a summary of what would be included without processing files or generating output.--dry-run: Run the entire process but do not write any output to the clipboard, file, or stdout.--sort-alpha: Override the relevance-based sorting and sort files alphabetically instead.
--version: Display the current version and exit.--check-updates: Check for available updates.
| Method | The Pain ๐ฉ | The context Way ๐ |
|---|---|---|
| Manual Copy/Paste | You'll miss a file. You'll include junk. You'll hate your life. | One command. Perfect context. Every time. |
cat file1 file2 > out.txt |
Zero structure. No filtering. Still manual. Basically useless. | Auto-filters, adds a file tree, and formats beautifully. |
| Sharing a GitHub Link | LLM can't see local changes. Can't access private repos. | Works offline. Works on your latest, unpushed code. |
Simple tree command |
Shows structure but includes zero code content. | Gives you the full package: structure AND content. |
Want to hack on the code? Easy.
-
Clone the repo:
git clone https://github.com/yigitkonur/code-to-clipboard-for-llms.git cd code-to-clipboard-for-llms -
Set up a virtual environment and install in editable mode:
python3 -m venv venv source venv/bin/activate pip install -e .
Now, any change you make to
llmcontext.pywill be live on yourcontextcommand.
If you fork the repo, you can permanently change the default filters by editing the constants at the top of llmcontext.py.
Expand for troubleshooting tips
| Problem | Solution |
|---|---|
context: command not found |
Restart your terminal. 99% of the time, this is the fix. If not, run pipx ensurepath (for pipx) or check your PATH environment variable. |
| Clipboard isn't working | Linux users: You might need a clipboard utility. Run sudo apt install xclip or sudo pacman -S xclip. For any OS, you can always use --stdout or --output my_context.md to bypass the clipboard. |
.gitignore is ignored |
Make sure you have gitignore-parser installed. The tool uses .gitignore by default. Use --no-gitignore to disable. |
| Script errors out | Make sure you're on Python 3.8 or newer (python3 --version). |
Windows-specific issues:
| Problem | Solution |
|---|---|
| Scoop install fails | Make sure you've enabled script execution: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser |
context not recognized in PowerShell |
Close and reopen PowerShell, or run scoop reset context to refresh the shim. |
| Permission denied errors | Scoop installs to user directory, so admin rights shouldn't be needed. If using pipx, run PowerShell as Administrator. |
| Python not found (pipx method) | Download Python from python.org and ensure "Add Python to PATH" is checked during installation. |
Built with ๐ฅ because manually crafting LLM prompts is a soul-crushing waste of time.