Crespo – Tree-sitter AST blueprints instead of raw code for LLMs logo

Crespo – Tree-sitter AST blueprints instead of raw code for LLMs

Free
FreeFree tier
Type
Open Source

About Crespo – Tree-sitter AST blueprints instead of raw code for LLMs

Crespo is an open-source command-line tool that generates compact XML blueprints of code repositories using Tree-sitter AST parsing. Instead of concatenating raw source files, Crespo extracts only structural elements (imports, classes, functions, module connections) to create a lightweight representation optimized for large language models. This approach dramatically reduces token consumption while preserving the relationships between files, enabling LLMs to understand codebases more effectively without hitting context limits. Crespo supports 10 programming languages, respects .gitignore rules, and offers three modes: structure (AST skeleton), summary (AI-generated one-line descriptions per file using a Groq API key), and concat (full source with secrets redacted). It can analyze local directories or GitHub repositories directly, and is installable via pip.

Key Features

Tree-sitter AST parsing extracts structural code elements (imports, classes, functions, structs, enums)
Generates compact XML blueprints optimized for LLM context windows
Three operation modes: structure (AST skeleton), summary (AI descriptions per file, requires Groq key), concat (full source with secrets redacted)
Supports 10 languages: Python, JavaScript, TypeScript, JSX, TSX, Rust, Go, Java, C, C++
Respects .gitignore to skip irrelevant files and directories
Can analyze local directories or GitHub repositories directly via --git flag
Custom output filename option (--output)
Secrets redaction in concat mode to prevent exposing sensitive data
No regex dependency; Tree-sitter handles edge cases robustly

Pros & Cons

Pros
  • Dramatically reduces token usage compared to raw code concatenation
  • Preserves structural relationships between files (imports, dependencies)
  • Open source and free to use (MIT license implied from public repo)
  • Easy installation via pip
  • Multi-language support covering popular programming languages
  • Respects existing .gitignore files to avoid unnecessary bloat
  • Provides multiple modes for different use cases (structure, summary, concat)
  • Handles edge cases reliably through Tree-sitter parsing (no regex failures)
Cons
  • Summary mode requires a Groq API key, adding a dependency on an external service
  • Only supports 10 languages; other languages are not parseable
  • Structure mode does not include actual code logic, only structural skeletons
  • Concat mode may still produce large output for very large repos despite redactions
  • New tool with limited community adoption and documentation (as of initial release)

Best For

Providing structured codebase context to LLMs for assisted coding or code reviewReducing token consumption when working with large repositories in AI-powered chat interfacesGenerating AI-friendly documentation of code architecture and dependenciesEnabling LLMs to understand file relationships without full source uploadsAutomating code analysis and summarisation for continuous integration pipelines

FAQ

What is Crespo?
Crespo is a CLI tool that uses Tree-sitter AST parsing to create compact XML blueprints of code repositories, optimized for providing context to large language models while using fewer tokens.
How does Crespo reduce token usage?
Instead of concatenating raw source files, Crespo extracts only the structural parts of the code (imports, classes, functions, etc.) and packs them into a small XML file, eliminating redundant whitespace, comments, and implementation details.
What modes does Crespo support?
Crespo has three modes: 'structure' (default) outputs an AST skeleton with imports, classes, and functions; 'summary' adds one-line AI-generated descriptions per file (requires a Groq key); 'concat' outputs full source code with secrets redacted in structured XML.
What programming languages does Crespo support?
Crespo supports Python, JavaScript, TypeScript, JSX, TSX, Rust, Go, Java, C, and C++.
How do I install Crespo?
Crespo can be installed via pip: `pip install crespo`.
Can Crespo analyze remote GitHub repositories?
Yes, use the --git flag followed by the repository URL: `crespo --git https://github.com/user/repo`.
Does Crespo respect .gitignore?
Yes, the file walker respects .gitignore rules and also skips test directories and build artifacts by default.
Is Crespo free?
Yes, Crespo is open source and free to use. There is no pricing for the tool itself; the summary mode requires a Groq API key which may have its own pricing.