llm-min.txt: Min.js Style Compression of Tech Docs for LLM Context
llm-min converts technical documentation into compact Structured Knowledge Format manifests for AI coding assistants. Its multi-stage Gemini pipeline claims 90–95% typical token reduction while retaining APIs, relationships, and usage patterns.
llm-min.txt: Min.js Style Compression of Tech Docs for LLM Context
Author: marv1nnnnn | Published: Unknown | Generated: 2025-05-16 | Domain: github.com
Tags: ‘#llm’ ‘#documentation’ ‘#context-engineering’ ‘#gemini’ ‘#python’ ‘#developer-tools’
TLDR
llm-minis a Python tool that uses Gemini to transform library documentation into a compact, machine-oriented Structured Knowledge Format (SKF) file for use as LLM context. It targets the gap between rapidly changing software documentation and model knowledge cutoffs, preserving APIs, component relationships, and workflows while intentionally discarding explanatory prose. The project reports typical 90–95% token reductions—sometimes over 97%—with compressed outputs commonly around 10,000 tokens, though the format is explicitly lossy and code-generation performance has not yet been rigorously benchmarked.
Key Takeaways
- Structured, lossy technical reference: Output
llm-min.txtuses SKF/1.4 LA withDEFINITIONS(D),INTERACTIONS(I), andUSAGE_PATTERNS(U) sections; the generation-time glossary is omitted from the final file to save tokens. - Compression target: The project contrasts its approach with
llms.txtfiles that can exceed 800,000 tokens and claims 90–95% usual reduction from raw documentation, with some examples exceeding 97%. - Three-stage Gemini pipeline: It gathers documentation, chunks it, creates and merges a global entity glossary, generates definitions/interactions, then produces usage patterns with consistent cross-references.
- Multiple input modes: The CLI supports crawling a Python package (
--package), a documentation URL (--doc-url), or recursively processing local.md,.txt, and.rstfiles (--input-folder). - Operational constraints: The recommended default model is
gemini-2.5-flash-lite-preview-06-17, cited for its 1-million-token context window; generation can take minutes and is estimated at $0.01–$1.00 per moderate-size library. Smaller chunks may avoid GeminiMAX_TOKENSfailures. - Companion schema is required: Users should provide both
llm-min.txtandllm-min-guideline.mdto coding assistants so they can decode the SKF notation correctly.
Images & Media
- llms.txt token comparison — Illustrates the large token counts associated with
llms.txtdocumentation files. - llm-min.txt icon — Project icon used in the README’s introduction to the approach.
- Token Compression Comparison — Compares original
llm-full.txtdocumentation token counts with compressedllm-min.txtoutputs. - Demo — GIF demonstrating use of compressed documentation as context in an AI-powered IDE.
Referenced Links
- llms.txt — Community initiative for AI-oriented, up-to-date library reference files.
- Context7 — Service for dynamically delivering contextual documentation to AI tools.
- llm-min guideline — Schema and decoding guidance for SKF manifests.
- Google AI Studio API keys — Source for obtaining a Gemini API key.
- Google Cloud Gemini pricing — Current Gemini API pricing reference.
- Roocode — AI coding environment reportedly used to develop the project.
- Rooroo — The author’s custom Roocode configuration.