Code Reducer
A lightweight, high-performance command-line tool written in Go that automatically generates developer-friendly documentation wikis for extensive repositories using local LLMs via Ollama.
Key Features
Recursive synthesis & incremental cachingHierarchical Map-Reduce Pipeline
Recursively breaks codebase synthesis into structured Map and Reduce phases to document arbitrary repo sizes within strict context limits.
Private & Local LLMs
Zero cloud dependencies or API costs. Leverages local Ollama instances (e.g. ornith:9b, gemma4:26b) to keep code private.
Customizable & Multilingual
Tailor extraction steps, synthesis prompts, Mermaid diagram rules, and output language (--language) directly via .code-reducer.yaml.
Enterprise Security Sandbox
Hardened filesystem guards featuring bottom-up symlink traversal checks, atomic process locking, and TOCTOU-safe atomic file writing.
Smart Incremental Updates
Uses SHA256 file hashing, fact-diff short-circuiting, and top-level summary checks to skip redundant directory and global re-synthesis.
BM25 Search & Deterministic Wiki
Built-in search and read CLI commands with source-path boosting, plus automatic Mermaid sanitization, link repair, and index generation.
Resource Efficiency & VRAM Footprint
Optimized for local consumer GPUsDesigned specifically for developer workstations and local GPU acceleration, Code-Reducer operates efficiently within consumer hardware constraints. Operating with a 15,000 token context window (15K) under Ollama, VRAM consumption remains stable at approximately 6.5 GB:

Documentation
Architecture, caching & CLI referenceExplore the documentation guides below to learn more about Code-Reducer's design, configuration, and workflows:
Architecture & Map-Reduce Engine
Deep dive into DirNode prefix trees, context-budgeted chunking, deterministic wiki finalization, and pure-Go BM25 section search.
Incremental Updates & Caching
Learn how SHA256 state tracking, fact-level short-circuiting, bottom-up propagation, and steps_hash invalidation minimize LLM calls.
Security Sandbox & Concurrency
Understand SafeResolve traversal guards, atomic process locking with O_EXCL, and TOCTOU symlink protection.
Configuration & Prompts
Complete reference for .code-reducer.yaml, 4-tier config resolution, language & quickstart_prompt settings, and extraction pipelines.
CLI Commands & Setup Wizard
Guide to setup, init, update, search, and read subcommands, persistent flags, and interactive setup flows.
Performance & VRAM Usage
VRAM benchmarking, context window budgeting metrics, multi-pass reduction throughput, and hardware recommendations.
Installation & Building
Step-by-step instructions for building Code-Reducer from source using Go 1.26+, binary installation, and Ollama integration.