SuperAPI AI Directory

ai-distiller

Extracts essential code structure from large codebases into an AI-digestible format so agents write code that correctly uses existing APIs.

Open website

About this tool

AI Distiller (aid) is an open-source tool for AI-assisted development. Its core function is "code distillation": extracting the most critical information needed for AI to write code from an entire project or specified modules—public APIs, type signatures, class hierarchies, etc.—while discarding method implementations and non-public structures, thereby compressing code volume to 5–20% of the original (typically compressing 90–98%), enabling large codebases to fit into an AI model's context window. The tool parses multiple languages via tree-sitter, with all syntax parsers built in and no external dependencies.

Main capabilities:

  • Smart filtering: controls visibility (public/protected/internal/private), content (comments, docstrings, implementations, imports), etc.; by default only outputs public API signatures and basic documentation.
  • Dependency-aware distillation: analyzes cross-file call graphs, including only code that is actually called, suitable for deep code analysis.
  • AI prompt generation: can generate specialized analysis prompts to pair with distilled code for AI-driven analysis, such as per-file deep analysis or multi-file documentation generation workflows; prompts can be output to the .aid/ directory for execution by AI agents such as Claude and Gemini.
  • Multiple output formats: text (default, ultra-compact), Markdown, JSON structured, JSONL, XML.
  • Smart summary output: displays compression efficiency and speed after distillation, supporting formats such as progress bars, stock ticker style, speed dashboard, mini sparkline, CI-friendly, and JSON.
  • Automatic project root detection: automatically searches upward for markers such as .aidrc, go.mod, package.json, .git, etc., and centralizes output to the <project root>/.aid/ directory.
  • Language support: full support for Python, Go, JavaScript, PHP, Ruby; Beta support for TypeScript, Java, C#, Rust, Kotlin, Swift, C++; future plans to support Zig, Scala, Clojure.
  • Performance: on an AMD Ryzen 7945HX, processing time is about 36–41ms when using 12 parallel workers, with a compression rate of 65–72%; supports -w 1 for serial or a custom number of workers. Performance may be limited for large projects with 50+ files; the language processors for C#, C++, and TypeScript havefundamental limitations.
  • MCP server: provides the NPM package @janreges/ai-distiller-mcp, which can be seamlessly integrated into MCP-supporting AI tools such as Claude and Cursor.

Usage:

  1. Installation: provides a one-line installation command for macOS/Linux/WSL and a Windows PowerShell installation command; the installer automatically detects the operating system and architecture, downloads the precompiled binary, and installs it to locations such as ~/.ai-distiller.
  2. Basic usage: run aid via the command line, specifying the project path, output format, filtering options, etc.
  3. Integration with AI tools: after installing the MCP server, it can be used in tools such as Claude Desktop; the distillation results can also be provided directly to AI agents.
  4. Prompt workflow: use the --ai-action parameter to generate analysis prompts, saving them to the .aid/ directory or outputting them via --stdout.

Applicable scenarios:

  • Large project development: helps AI tools correctly understand the existing APIs and architecture in a project, avoiding the generation of incompatible code.
  • Code refactoring and analysis: dependency-aware distillation can be used for impact analysis, code navigation, legacy system understanding, API analysis, etc.
  • Reducing AI costs: compresses large frameworks (such as Django at about 10 million tokens) to 256,000 tokens, reducing API call costs and enabling the entire framework to fit into a single conversation.
  • Documentation generation: combines prompts to generate multi-file documentation workflows.

Limitations:

  • The tool itself does not perform analysis; it only prepares optimized prompts for AI agents to execute.
  • The parsing capabilities and support for complex call patterns are limited for some languages (C#, C++, TypeScript).
  • Performance may degrade for large projects (50+ files).
  • By default it outputs only public interfaces, which may ignore some internal dependency details, but this can be configured via CLI options.