What is ContextCraft?
ContextCraft prepares repository code as task-relevant context for language models, fitting the result within a token budget. It runs locally in a repository and outputs structured Markdown in the terminal. Its pipeline analyzes code structure and local dependencies, then chooses how much detail to include for different files. It is intended for developers who want to give a model useful codebase context without feeding it every file in full.
ContextCraft Features:
Task-Relevant Ranking: ContextCraft scores files using local dependency relationships, personalized PageRank, and lexical signals to prioritize material related to the task.
Syntax-Aware Parsing: Tree-sitter parsing captures declarations and structural outlines so the pipeline can represent code by its syntax.
Multiple Detail Levels: Files can be represented as full source, skeletons, signatures, or paths, with different levels of detail across the repository.
Token-Budget Allocation: The pipeline selects detail according to utility per token, formats the context, and recounts the complete output against the limit.
Secret Redaction: During scanning, ContextCraft redacts recognized secrets and skips ineligible files such as images.
Local Markdown Output: The tool runs in a local repository, requires uv for the displayed setup, and prints the resulting context as Markdown in the terminal.
ContextCraft Benefits:
Less Context Noise: Prioritizing task-related files helps a language model focus on relevant repository material instead of receiving a broad, undifferentiated file dump.
Preserve Important Logic: Keeping full source for central code while using lighter representations elsewhere can retain implementation detail where it matters.
Stay Within Limits: Budget-aware selection makes it easier to prepare repository context that fits a chosen token ceiling.
See Code Relationships: Including structural outlines and relevant paths gives readers a clearer view of how important parts of a codebase connect.
Reduce Exposure Risk: Redacting recognized secrets can lower the chance that those values appear in context prepared for a language model.
Use Cases:
Investigate Authentication Bugs: Prepare context for a language model to examine authentication code and the related files in a repository.
Ask Repository Questions: Create a focused codebase artifact before asking a model how a function, package, or set of files works.
Fit a Large Codebase: Select useful context from a repository whose complete source would exceed the token budget for a model session.
Trace Local Dependencies: Prioritize files connected to a task when investigating how related modules or packages work together.
Prepare Code for Review: Give a model full source for central logic while retaining signatures, structure, or paths for less critical files.

