context-creator
Turn your entire codebase into context.
context-creator transforms your entire git repository into a single, LLM-optimized Markdown file—intelligently compressed and prioritized—so you can feed it directly into Gemini’s(or any LLM) long-context window for fast, high-level insights and deep architectural understanding.
Quick Start
# Ask about improving your local project
# Ask about architectural patterns in a remote repo
# Save the formatted Markdown to a file
Common Use Cases
# Architecture Review
# Onboarding New Developers
# Implementing Features
# Security Audit
Why context-creator?
Gemini’s Long Context
Stop pasting small snippets. Feed your entire codebase to Gemini in one go and ask big-picture questions.
Blazing Fast
Built in Rust with parallel processing,
context-creatoris dramatically faster at contexting large repositories.
Smart Token Management
It’s more than a
cat.context-creatorrespects.gitignore, prioritizes critical files via.contextkeep, and trims intelligently based on token budgets.
Give Claude Code Superpowers
Claude already excels at precise work. Teach it to use
context-creator, and it gains a satellite-level view of your entire codebase—unlocking deeper context, better answers, and faster development cycles.
Installation
1. Install context-creator
# Using Cargo
Prerequisite: Ensure you have the Gemini CLI or Codex installed and configured.
2. Install Gemini CLI (Required for piping)
More Usage Examples
# Save to file for later use
# Process specific directories (positional arguments)
# Process specific directories (explicit include flags)
# Process files matching glob patterns (QUOTE patterns to prevent shell expansion)
# Process specific file types across all directories
# Combine prompt with include patterns for targeted analysis
# Use ignore patterns to exclude unwanted files
# Combine prompt with ignore patterns
# Process with token limit
Glob Patterns
Both --include and --ignore flags support powerful glob patterns for precise file filtering:
Supported Pattern Syntax
- *- matches any characters except- /
- ?- matches any single character except- /
- **- recursive directory matching
- [abc]- character sets and ranges- [a-z]
- {a,b}- brace expansion (alternatives)
- [!abc]- negated character sets
Pattern Examples
# Include patterns
# Ignore patterns
# Combined patterns
⚠️ Important: Shell Expansion Prevention
Always quote your glob patterns to prevent shell expansion:
# ✅ CORRECT - quoted pattern
# ❌ WRONG - shell may expand before reaching application
Configuration
Fine-tune how context-creator processes your repository:
- .contextignore: Exclude non-essential files and folders (e.g.,- node_modules/,- target/).
- .contextkeep: Prioritize critical files (e.g.,- src/main.rs,- Cargo.toml). This ensures the most important code is included when you're near the token limit.
- .context-creator.toml: For advanced configuration like setting default token limits and priority weights.
.contextignore
Exclude files from processing:
# Dependencies
node_modules/
target/
vendor/
# Build artifacts
dist/
build/
*.pyc
# Sensitive files
.env
secrets/
.contextkeep
Prioritize important files:
# Core functionality
src/main.*
src/core/**/*.rs
# Important configs
Cargo.toml
package.json
Configuration File (.context-creator.toml)
[]
 = 150000
 = true
[]
 = 2000000
 = 1500000
[[]]
 = "src/**/*.rs"
 = 100
[[]]
 = "tests/**/*.rs"
 = 50
Token Limits Configuration
context-creator now supports LLM-specific token limits via the [tokens] section in your configuration file. This feature provides smart defaults when using the --prompt flag:
Token Limit Precedence:
- Explicit CLI (--max-tokens 500000) - Always takes precedence
- Config Token Limits ([tokens]section) - Used when prompts are provided
- Config Defaults ([defaults].max_tokens) - Used for non-prompt operations
- Hard-coded Defaults (1,000,000 tokens) - Fallback for prompts when no config
# Example: Configure different limits per LLM
[]
 = 2000000    # 2M tokens for Gemini
 = 1500000     # 1.5M tokens for Codex
[]
 = 150000  # For non-prompt operations
Usage Examples:
# Uses config token limits (2M for Gemini, with prompt reservation)
# Explicit override (500K total, with prompt reservation)
# Uses config defaults (150K for file output, no reservation needed)
Smart Prompt Token Reservation
When using prompts, context-creator automatically reserves tokens for:
- Prompt tokens (measured using tiktoken)
- Safety buffer (1000 tokens for LLM response)
This ensures the total input (prompt + codebase context) fits within the LLM's context window:
# Example: 2M token limit with 50-token prompt
# Available for codebase: 2,000,000 - 50 - 1,000 = 1,998,950 tokens