New CLI Tool Compresses 1.3M-Line Codebases to 1,500 Lines for LLM Queries
A developer tool called CodeShrink uses Tree-sitter abstract syntax trees to compress large codebases into query-relevant code snippets for use with large language models. Unlike embedding-based RAG systems or full-repo dumps, CodeShrink parses code into symbols such as functions, classes, and types, then ranks them against a user query using name, path, and signature matching. The tool supports seven programming languages including TypeScript, Python, Rust, and Go, and expands query terms using static semantic mappings to catch common synonyms. In benchmark tests, it reduced the Next.js repository from 1.29 million lines of code to roughly 1,500 lines in under three seconds. For smaller repositories in the 10,000–100,000 line range, the compression completes in under 100 milliseconds on Apple Silicon hardware.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in