# OpenWiki — AI-Maintained Documentation CLI by LangChain > A command-line tool by LangChain that uses AI agents to automatically write and maintain documentation for your codebase. ## Install Save in your project root: # OpenWiki — AI-Maintained Documentation CLI by LangChain ## Quick Use ```bash npm install -g openwiki cd your-project # Generate documentation for your codebase openwiki init openwiki generate # Update docs after code changes openwiki update ``` ## Introduction OpenWiki is an open-source CLI tool from LangChain that automates the creation and maintenance of codebase documentation. It analyzes your source code, generates structured documentation in Markdown, and keeps it in sync as code evolves — replacing the manual burden of writing and updating docs with an AI-driven workflow. ## What OpenWiki Does - Scans your codebase to understand module boundaries, public APIs, and architectural patterns - Generates structured Markdown documentation covering modules, functions, and data flows - Detects code changes and incrementally updates affected documentation sections - Produces a navigable wiki structure suitable for GitHub wikis, MkDocs, or static site generators - Integrates with AI coding agents as a skill for documentation-on-demand workflows ## Architecture Overview OpenWiki is a TypeScript CLI that combines static analysis with LLM-powered content generation. It first builds a code graph by parsing source files using language-aware parsers, identifying exports, dependencies, and call relationships. This graph is then fed to an LLM as structured context, which generates documentation for each module. Incremental updates diff the current code graph against the last documented state and re-generate only changed sections. ## Self-Hosting & Configuration - Install globally via npm or use npx for one-off runs - Configure documentation scope, output directory, and language in openwiki.config.json - Set your preferred LLM provider and API key as environment variables - Customize output templates for different documentation styles - Run in CI to automatically update docs on every push ## Key Features - Incremental documentation updates that re-generate only what changed - Language-aware parsing for TypeScript, Python, Go, Rust, and more - Structured output compatible with GitHub wikis, MkDocs, and Docusaurus - Agent skill mode for on-demand documentation within coding sessions - Configurable depth and detail level per module or directory ## Comparison with Similar Tools - **TypeDoc / JSDoc** — generate API docs from code comments; OpenWiki writes prose documentation from code structure - **Mintlify** — AI-powered docs platform (SaaS); OpenWiki is a local CLI with no vendor dependency - **DeepWiki** — turns repos into wikis; OpenWiki focuses on incremental maintenance rather than one-shot generation - **Docusaurus** — a static documentation framework; OpenWiki generates the content, Docusaurus renders it ## FAQ **Q: Does OpenWiki require an LLM API key?** A: Yes. It uses an LLM to generate documentation content. You configure your preferred provider (OpenAI, Anthropic, etc.) via environment variables. **Q: Can it document private/internal code?** A: Yes. All analysis runs locally. Only the code context sent to the LLM leaves your machine, and you control what gets included. **Q: How does incremental update work?** A: OpenWiki tracks a hash of each documented code unit. On update, it re-parses the codebase, identifies changed units, and regenerates only their documentation. **Q: Which languages are supported?** A: TypeScript, JavaScript, Python, Go, Rust, and Java have first-class parser support. Other languages get basic file-level documentation. ## Sources - https://github.com/langchain-ai/openwiki - https://github.com/langchain-ai/openwiki/blob/main/README.md --- Source: https://tokrepo.com/en/workflows/asset-804ba131 Author: AI Open Source