Trim
Minimizes codebase context for LLM prompts using AST-guided parsing, semantic ranking, and a two-pass token budget allocator.
Trim is a fast, zero-config CLI tool and MCP server designed to shrink local codebases into high-density prompt payloads for Large Language Models. Instead of dumping whole files or chopping tokens blindly, Trim leverages Tree-Sitter to parse code into abstract syntax tree (AST) units, semantically ranks them against user intent and a true AST call graph, and intelligently packs the most relevant code into the token budget. It employs a 3-tier degradation engine (Full, Compact, Skeleton) to maximize content without syntax truncation, all while ensuring zero credential leaks through built-in secret scanning and redaction.