# OpenWiki - Source Code Docs That Write (and Maintain) Themselves: A Hands-On Look.

> Source: <https://pub.towardsai.net/openwiki-source-code-docs-that-write-and-maintain-themselves-a-hands-on-look-fcec781e28e4?source=rss----98111c9905da---4>
> Published: 2026-07-09 13:01:01+00:00

Every engineer knows the feeling. You open a repo’s docs/ folder, read a confident paragraph about how authentication works, then discover in the code that half of it hasn't been true for eight months. Documentation doesn't fail because people can't write — it fails because keeping it in sync with the code is nobody's job, and so it rots.

I’ve been trying [ OpenWiki](https://github.com/langchain-ai/openwiki) [1], an open-source tool from LangChain that takes a genuinely different swing at this problem: instead of asking humans to keep docs current, it puts an AI agent in charge of

OpenWiki didn’t appear from nowhere. It’s LangChain’s implementation of a pattern Andrej Karpathy described as the **“LLM Wiki”** ([original gist](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f)) [2].

The core insight is a reaction against the usual RAG approach. With RAG, you chunk your documents, embed them, and retrieve fragments at query time. Karpathy’s argument: don’t retrieve fragments on demand — have the LLM *build and maintain a persistent, structured wiki* that compounds knowledge over time. A wiki gives both humans and agents a real map of the system, and it points them toward the right context instead of stuffing everything into one giant file.

OpenWiki applies that pattern specifically to **codebases**. It creates a wiki for your repo, wires that wiki into your coding agent, and keeps it updated as the code changes. (It shares this lineage with other tools in the space like DeepWiki and AutoWiki — the “auto-generate a living wiki from a repo” idea is having a moment.)

OpenWiki operates in three moves:

**1. Generate.** It reads your repository and produces a structured wiki — an architecture overview, domain concepts, the API surface, a frontend guide, operations/runbook notes. Crucially, this is *grounded in the actual source code*, not in a human’s fading memory of how the system used to work.

**2. Integrate.** Rather than dumping the entire wiki into your CLAUDE.md / AGENTS.md instruction file (which would bloat every agent's context), it adds a lightweight **reference** pointing at the openwiki/ directory. Agents — and humans — read the quickstart, then follow links to the sections they actually need. This "point, don't inline" design is the whole philosophy: keep the fixed context small, retrieve detail on demand.

**3. Maintain.** A CI job (a GitHub Action ships with the repo) re-runs OpenWiki on new commits. It looks at what landed since the last run, uses the git diffs to understand what changed, and updates the affected wiki pages. The docs update themselves as the code evolves, instead of rotting.

That third step is the part that actually matters. Generating docs once is easy — plenty of tools do it. Keeping them *current* without human discipline is the hard problem, and it’s the one OpenWiki is really built to solve.

Genuinely easy. It’s a CLI:

```
npm install -g openwikiopenwiki --init          # interactive: pick a model provider, paste an API key
```

Config lives in ~/.openwiki/.env. On first run it walks you through choosing an inference provider (OpenRouter, Anthropic, OpenAI, and others are supported) and dropping in an API key. Then you generate:

```
openwiki "Generate documentation for this repository"
```

It writes everything into an openwiki/ folder and adds the reference to your agent-instruction file. To refresh later:

```
openwiki --update
```

That’s the whole loop. No new platform to host, no database to stand up, no service to babysit — just a CLI and whichever LLM you point it at.

A few reasons this clicked for me:

It’s an early-stage tool (v0.x), and — as with anything that hands the wheel to an LLM — output quality tracks the capability of the model you give it. That’s not a footnote; it’s the whole ballgame, and it’s exactly where my first real run went sideways.

In **Part 2**, I’ll walk through pointing OpenWiki at an actual Spring Boot + Angular project: the run that crashed on one model, the one that sailed through on another, and what a “good quality docs” run actually costs.

*This is the first in a three-part series — Part 2 covers the real run and what quality docs cost; Part 3 covers generating diagrams and contributing a feature upstream.*

[1] LangChain, “OpenWiki — an open-source agent for repo documentation,” GitHub repository. Available: [https://github.com/langchain-ai/openwiki](https://github.com/langchain-ai/openwiki)

[2] A. Karpathy, “LLM Wiki,” GitHub Gist. Available: [https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f)

[OpenWiki - Source Code Docs That Write (and Maintain) Themselves: A Hands-On Look.](https://pub.towardsai.net/openwiki-source-code-docs-that-write-and-maintain-themselves-a-hands-on-look-fcec781e28e4) was originally published in [Towards AI](https://pub.towardsai.net) on Medium, where people are continuing the conversation by highlighting and responding to this story.
