← Back to Home

OpenWiki: Auto-Generate & Maintain Agent Documentation for Your Codebase

OpenWiki: Auto-Generate & Maintain Agent Documentation for Your Codebase

Every developer using AI coding agents has run into the same problem: agents lack context about your codebase. They don't know the architecture, the naming conventions, the testing patterns, or the deployment workflow. You end up repeating yourself in every prompt, or worse — the agent generates code that doesn't fit your project's patterns.

OpenWiki by LangChain solves this. It's a CLI tool that reads your codebase, generates comprehensive documentation, and writes it into AGENTS.md or CLAUDE.md files — exactly where your coding agent looks for context. And with its GitHub Actions integration, it keeps that documentation up-to-date automatically.

Why OpenWiki Is Trending

OpenWiki hit 3,500+ GitHub stars within two weeks of its release in June 2026. Several factors explain its rapid adoption:

  • Agent-first documentation — Instead of writing docs for humans, OpenWiki writes docs for agents. The output is structured for how Claude Code, Codex, Cursor, and other coding agents consume context.
  • Zero-config CI/CD — A one-file GitHub Actions workflow keeps documentation fresh daily, opening PRs with updates. No manual maintenance.
  • Multi-provider support — Works with OpenAI, Anthropic, OpenRouter, Fireworks, and Baseten. Bring your own model.
  • LangChain pedigree — Built by the team behind the most popular LLM framework, giving it instant credibility and a mature toolchain (LangGraph, LangSmith).

Architecture Overview

OpenWiki Architecture

OpenWiki's architecture follows a simple but effective pipeline:

  1. CLI Entry Point — The openwiki command (TypeScript, built with Ink/React for interactive TUI) accepts --init, --update, --print, or free-form prompts
  2. Agent Engine — Powered by LangChain + LangGraph, it uses a structured agent that reads repository files, analyzes code structure, and generates documentation
  3. LLM Integration — Supports OpenAI, Anthropic, OpenRouter, Fireworks, and Baseten models. Configurable model ID via OPENWIKI_MODEL_ID env var
  4. Documentation Output — Writes to openwiki/ directory by default, injects references into AGENTS.md / CLAUDE.md for automatic agent context
  5. CI/CD Integration — A scheduled GitHub Actions workflow runs openwiki --update daily and opens a PR with documentation changes

Prerequisites

  • Node.js 18+ (recommended: 22)
  • npm or pnpm
  • An API key for any supported LLM provider (OpenAI, Anthropic, OpenRouter, etc.)
  • A Git repository (local or hosted on GitHub for CI/CD)

Installation

Install OpenWiki globally via npm:

npm install -g openwiki

Verify the installation:

openwiki --help

Quick Start: Generate Documentation

Navigate to your project repository and initialize OpenWiki:

cd /path/to/your/project
openwiki --init

The first run will prompt you to:

  1. Select an inference provider (OpenAI, Anthropic, OpenRouter, Fireworks, or Baseten)
  2. Enter your API key
  3. Choose a model (or specify a custom model ID)
  4. Optionally set up LangSmith tracing

After configuration, OpenWiki scans your codebase and generates documentation in the openwiki/ directory. It also creates or updates AGENTS.md (or CLAUDE.md) with a reference line like:

For comprehensive documentation about this codebase, check the openwiki/ directory.

One-Shot Mode

For non-interactive use (e.g., scripts), use the --print flag:

openwiki -p "Summarize the architecture of this project"

Update Existing Documentation

When your codebase changes, refresh the wiki:

openwiki --update

This re-scans the repository and updates only the changed sections.

CI/CD: Automatic Documentation Updates

To keep documentation fresh without manual work, add the OpenWiki GitHub Action to your repository.

Create .github/workflows/openwiki-update.yml:

name: OpenWiki Update

on:
  workflow_dispatch:
  schedule:
    - cron: "0 8 * * *"

permissions:
  contents: write

jobs:
  update:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4
        with:
          persist-credentials: true

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "22"

      - name: Install OpenWiki
        run: npm install --global openwiki

      - name: Run OpenWiki
        run: openwiki --update --print
        env:
          OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
          OPENWIKI_MODEL_ID: z-ai/glm-5.2
          LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY }}

      - name: Create OpenWiki update pull request
        uses: peter-evans/create-pull-request@v7
        with:
          add-paths: openwiki
          branch: openwiki/update
          commit-message: "docs: update OpenWiki"
          title: "docs: update OpenWiki"
          body: |
            Automated OpenWiki documentation update.
            This PR was generated by the scheduled OpenWiki workflow.

Then add your API key as a repository secret (OPENROUTER_API_KEY in this example). The workflow runs daily at 08:00 UTC and opens a PR with any documentation changes.

Configuration Options

OpenWiki stores its configuration in ~/.openwiki/.env:

Variable Description Example
OPENWIKI_MODEL_ID Model identifier anthropic/claude-sonnet-4-20250514
LANGSMITH_API_KEY LangSmith tracing key (optional) lsv2_...

Supported providers: OpenRouter, Fireworks, Baseten, OpenAI, Anthropic

You can override the model per-run via environment variable:

OPENWIKI_MODEL_ID="openai/gpt-5.1" openwiki --update --print

Comparison: OpenWiki vs Other Doc Tools

  • OpenWiki — Agent-first. Output is structured for Claude Code, Codex, and Cursor. Injects into AGENTS.md/CLAUDE.md. Daily CI/CD updates.
  • Mintlify / ReadMe — Human-first documentation portals. Requires manual updates or API pushes. No agent context integration.
  • Docusaurus / Nextra — Static site generators for docs. Great for human readers but agents can't consume them without crawling.
  • Sphinx / JSDoc — Language-specific API doc generators. Produce reference docs, not architectural overviews or conventions.
  • AI context files (hand-written CLAUDE.md) — Manual. Gets stale. OpenWiki automates this exact pattern.

Verification Checklist

After running OpenWiki, confirm:

  • openwiki/ directory exists with generated documentation files
  • AGENTS.md (or CLAUDE.md) contains a reference to openwiki/
  • Documentation accurately describes the project's architecture (read a few files to validate)
  • The GitHub Action workflow file is committed and the first run succeeds
  • Generated docs are markdown-formatted and readable

Resources

← Retour à l'Accueil

OpenWiki : Générez et Maintenez Automatiquement la Documentation Agent de Votre Codebase

OpenWiki : Générez et Maintenez Automatiquement la Documentation Agent de Votre Codebase

Chaque développeur utilisant des agents IA de codage a rencontré le même problème : les agents manquent de contexte sur votre codebase. Ils ne connaissent pas l'architecture, les conventions de nommage, les patterns de test ou le workflow de déploiement. Vous finissez par vous répéter dans chaque prompt — ou pire, l'agent génère du code qui ne correspond pas aux patterns de votre projet.

OpenWiki par LangChain résout ce problème. C'est un outil CLI qui lit votre codebase, génère une documentation complète et l'écrit dans les fichiers AGENTS.md ou CLAUDE.md — exactement là où votre agent de codage cherche du contexte. Et grâce à son intégration GitHub Actions, il maintient cette documentation à jour automatiquement.

Pourquoi OpenWiki Devient Tendance

OpenWiki a atteint plus de 3 500 étoiles GitHub en deux semaines après sa sortie en juin 2026. Plusieurs facteurs expliquent cette adoption rapide :

  • Documentation orientée agent — Au lieu d'écrire des docs pour les humains, OpenWiki écrit des docs pour les agents. La sortie est structurée pour la façon dont Claude Code, Codex, Cursor et autres agents de codage consomment le contexte.
  • CI/CD zéro configuration — Un workflow GitHub Actions d'un seul fichier maintient la documentation à jour quotidiennement, en ouvrant des PRs avec les mises à jour.
  • Support multi-fournisseur — Fonctionne avec OpenAI, Anthropic, OpenRouter, Fireworks et Baseten. Apportez votre propre modèle.
  • Provenance LangChain — Construit par l'équipe derrière le framework LLM le plus populaire, ce qui lui donne une crédibilité instantanée et une chaîne d'outils mature (LangGraph, LangSmith).

Architecture

Architecture OpenWiki

L'architecture d'OpenWiki suit un pipeline simple mais efficace :

  1. Point d'entrée CLI — La commande openwiki (TypeScript, construite avec Ink/React pour TUI interactive) accepte --init, --update, --print ou des prompts libres
  2. Moteur Agent — Propulsé par LangChain + LangGraph, il utilise un agent structuré qui lit les fichiers du dépôt, analyse la structure du code et génère la documentation
  3. Intégration LLM — Supporte les modèles OpenAI, Anthropic, OpenRouter, Fireworks et Baseten. ID de modèle configurable via la variable d'environnement OPENWIKI_MODEL_ID
  4. Sortie de documentation — Écrit dans le répertoire openwiki/ par défaut, injecte des références dans AGENTS.md / CLAUDE.md pour le contexte automatique des agents
  5. Intégration CI/CD — Un workflow GitHub Actions planifié exécute openwiki --update quotidiennement et ouvre une PR avec les changements de documentation

Prérequis

  • Node.js 18+ (recommandé : 22)
  • npm ou pnpm
  • Une clé API pour un fournisseur LLM supporté (OpenAI, Anthropic, OpenRouter, etc.)
  • Un dépôt Git (local ou hébergé sur GitHub pour CI/CD)

Installation

Installez OpenWiki globalement via npm :

npm install -g openwiki

Vérifiez l'installation :

openwiki --help

Démarrage Rapide : Générer la Documentation

Naviguez vers votre dépôt de projet et initialisez OpenWiki :

cd /chemin/vers/votre/projet
openwiki --init

Le premier lancement vous demandera de :

  1. Sélectionner un fournisseur d'inférence (OpenAI, Anthropic, OpenRouter, Fireworks ou Baseten)
  2. Entrer votre clé API
  3. Choisir un modèle (ou spécifier un ID de modèle personnalisé)
  4. Configurer optionnellement le tracing LangSmith

Après configuration, OpenWiki scanne votre codebase et génère la documentation dans le répertoire openwiki/. Il crée ou met également à jour AGENTS.md (ou CLAUDE.md) avec une ligne de référence comme :

For comprehensive documentation about this codebase, check the openwiki/ directory.

Mode Ponctuel

Pour une utilisation non interactive (par exemple, scripts), utilisez l'option --print :

openwiki -p "Résume l'architecture de ce projet"

Mettre à Jour la Documentation Existante

Lorsque votre codebase change, actualisez le wiki :

openwiki --update

Cela re-scanne le dépôt et met à jour uniquement les sections modifiées.

CI/CD : Mises à Jour Automatiques de la Documentation

Pour garder la documentation fraîche sans travail manuel, ajoutez l'action GitHub OpenWiki à votre dépôt.

Créez .github/workflows/openwiki-update.yml :

name: OpenWiki Update

on:
  workflow_dispatch:
  schedule:
    - cron: "0 8 * * *"

permissions:
  contents: write

jobs:
  update:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository
        uses: actions/checkout@v4
        with:
          persist-credentials: true

      - name: Set up Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "22"

      - name: Install OpenWiki
        run: npm install --global openwiki

      - name: Run OpenWiki
        run: openwiki --update --print
        env:
          OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
          OPENWIKI_MODEL_ID: z-ai/glm-5.2
          LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY }}

      - name: Create OpenWiki update pull request
        uses: peter-evans/create-pull-request@v7
        with:
          add-paths: openwiki
          branch: openwiki/update
          commit-message: "docs: update OpenWiki"
          title: "docs: update OpenWiki"
          body: |
            Automated OpenWiki documentation update.
            This PR was generated by the scheduled OpenWiki workflow.

Ajoutez ensuite votre clé API comme secret de dépôt (OPENROUTER_API_KEY dans cet exemple). Le workflow s'exécute quotidiennement à 08:00 UTC et ouvre une PR avec les changements de documentation.

Options de Configuration

OpenWiki stocke sa configuration dans ~/.openwiki/.env :

Variable Description Exemple
OPENWIKI_MODEL_ID Identifiant du modèle anthropic/claude-sonnet-4-20250514
LANGSMITH_API_KEY Clé de tracing LangSmith (optionnelle) lsv2_...

Fournisseurs supportés : OpenRouter, Fireworks, Baseten, OpenAI, Anthropic

Vous pouvez remplacer le modèle par exécution via une variable d'environnement :

OPENWIKI_MODEL_ID="openai/gpt-5.1" openwiki --update --print

Comparaison : OpenWiki vs Autres Outils de Documentation

  • OpenWiki — Orienté agent. La sortie est structurée pour Claude Code, Codex et Cursor. Injection dans AGENTS.md/CLAUDE.md. Mises à jour CI/CD quotidiennes.
  • Mintlify / ReadMe — Portails de documentation orientés humains. Nécessitent des mises à jour manuelles ou des pushes API. Pas d'intégration de contexte agent.
  • Docusaurus / Nextra — Générateurs de sites statiques pour docs. Super pour les lecteurs humains mais les agents ne peuvent pas les consommer sans crawling.
  • Sphinx / JSDoc — Générateurs de doc API spécifiques à un langage. Produisent des docs de référence, pas des aperçus architecturaux ou des conventions.
  • Fichiers de contexte IA (CLAUDE.md écrits à la main) — Manuel. Devient obsolète. OpenWiki automatise exactement ce pattern.

Liste de Vérification

Après avoir exécuté OpenWiki, confirmez :

  • Le répertoire openwiki/ existe avec les fichiers de documentation générés
  • AGENTS.md (ou CLAUDE.md) contient une référence vers openwiki/
  • La documentation décrit précisément l'architecture du projet (lisez quelques fichiers pour valider)
  • Le fichier de workflow GitHub Action est committé et la première exécution réussit
  • Les docs générées sont formatées en markdown et lisibles

Ressources