How is the wiki structure (table of contents) determined?
Prompt/agent that proposes sections and pages; inputs used (file tree, README); output format.
Verdict
OpenDeepWiki is the best fit if the table of contents should grow with the codebase. Choose RepoWiki or deepwiki-rs if you want the same layout on every run.
An LLM plans the TOC. deepwiki-open makes one plain completion call with the filtered file list and README. It asks for <wiki_structure> XML with 4 to 6 pages, or 8 to 12 in comprehensive mode. The model cannot open any file. An argument-order bug turns request exclusions into inclusions for this step. OpenDeepWiki runs a catalog agent on a capped tree, the README (up to 4,000 characters), key files and entry points. It can make 4 confirming tool calls and then writes nested JSON with WriteCatalog. Page count is not fixed: one large repository got 61 pages, against 12 from deepwiki-open on the same code. openDeepWiki (Go) chains toc_editor and toc_checker, which explore the checkout and return strict YAML chapters with outlines and hints. It starts automatically when a repository is added. Titles are in Chinese, and API and database chapters are separate manual actions.
The layout is fixed in code. deepwiki-rs always writes overview, architecture, workflow and boundary pages, plus a database page when database code is detected. The only dynamic part is one deep_exploration page per domain that a research agent finds. RepoWiki always builds Overview, Architecture, Knowledge Cards, one page per module, Reading Guide, Dependencies and Symbol Index. A module is just the top-level directory, or the second level under src/, lib/, pkg/, internal/ or app/. readmeX writes a fixed eight-entry MkDocs navigation with Chinese labels. Only its API section grows, with one page per filtered Python symbol.
The source tree is the TOC. RepoAgent plans nothing. It writes one Markdown file per .py file, with headings nested by AST containment.
Pick: OpenDeepWiki for catalogs that scale with repo size. Pick: RepoWiki or deepwiki-rs for a predictable page set and cost. Pick: RepoAgent when you want API reference, not concept pages.
Per-project answers
AsyncFuncAI/deepwiki-open
answeredThe wiki structure (table of contents) is determined by an LLM call. In api/services/wiki/tasks.py, _determine_structure() (line 315) orchestrates the process. First it reads the cloned repo's file tree and README via read_repo_file_tree() in structure.py (line 20), which returns sorted file paths filtered through iterate_files() plus the README content. The repo's default branch is detected with git rev-parse --abbrev-ref HEAD (line 51).
These inputs are fed into build_structure_prompt() in prompts.py (line 213). The prompt constructs an XML schema asking the LLM to output a <wiki_structure> block containing a title, description, and individual <page> elements — each with an id, title, importance (high/medium/low), related pages, and a list of <file_path> citations. For "comprehensive" wikis, it also includes <sections> grouping pages and supporting nested subsections (line 135-185); "concise" omits sections and targets 4-6 pages instead of 8-12 (line 187-209).
The LLM's raw XML response is parsed by parse_wiki_structure() in structure.py (line 179). This function is robust: it strips markdown fences, escapes bare & characters, handles truncated responses (missing </wiki_structure>) by salvaging complete blocks, and falls back to regex-based extraction if strict xml.etree.ElementTree parsing fails. The result is a WikiStructureModel containing WikiPage and WikiSection objects (schemas in api/schemas/wiki.py).
AIDotNet/OpenDeepWiki
answeredThe wiki structure (table of contents) is generated by an LLM agent using the catalog-generator prompt (src/OpenDeepWiki/prompts/catalog-generator.md). WikiGenerator.GenerateCatalogAsync() (src/OpenDeepWiki/Services/Wiki/WikiGenerator.cs:245) is the entry point. It first calls CollectRepositoryContextAsync() to gather the project's directory tree (TOON format), README content, key files, and entry points. Then it loads the catalog-generator prompt template, creates a GitTool (for source exploration), a CatalogTool (wrapping CatalogStorage to write the catalog), and a DocumentSourceToolBudget that limits source tool calls to the configured MaxCatalogSourceToolCalls (default 4). The AI agent is instructed to design a DeepWiki-style information architecture — top-level topic domains with independently readable deep-dive leaf pages — not a file/class listing.
Inputs. The agent receives a runtime context containing the directory tree, README content, key files, entry points, and project type. It uses the tools sparingly for confirmation reads/greps before writing the catalog.
Output format. The catalog is JSON via the WriteCatalog tool (CatalogTool.WriteAsync), following:
{"items": [{"title": "...", "path": "lowercase-hyphen-path", "order": N, "children": []}]}
Each leaf node gets a DocFileId pointing to generated content. Parent nodes are navigation groupings only.
Design rules. The prompt (line 25–75) emphasizes right-sized coverage (no fixed counts), no over-compression (many independent systems must not be hidden inside few chapters), verifying via source tools first, and never fabricating entries. Page titles should be in the runtime target language. The CatalogStorage class (src/OpenDeepWiki/Services/Wiki/CatalogStorage.cs:12) persists the catalog to DocCatalog entities in the database, keyed by BranchLanguageId. Parent-child relationships are tracked via ParentId and an Order field.
sopaco/deepwiki-rs
answeredThe document structure is hardcoded, not LLM-proposed. The DocTree in src/generator/outlet/mod.rs defines five fixed document slots matching the six compose agents: Overview, Architecture, Workflow, Boundary, and Database (plus dynamic Key Modules Insight entries). The DocTree::new() constructor creates entries mapping each AgentType to a localized filename via target_language.get_doc_filename(). The DocumentationComposer.execute() method (src/generator/compose/mod.rs) runs six editors in a fixed sequence: OverviewEditor, ArchitectureEditor, WorkflowEditor, KeyModulesInsightEditor, BoundaryEditor, and optionally DatabaseEditor.
The KeyModulesInsightEditor is the only dynamic case: it reads the KeyModulesInsight research output (a list of KeyModuleReport objects, one per domain), spawns one KeyModuleInsightEditor per domain, runs them concurrently (bounded by max_parallels), and inserts each result into the DocTree under deep_exploration/<domain_name>.md.
Research agents (system context, domain modules, architecture, workflow, boundary, database) also produce structured output with agent-defined schemas like DomainModulesReport, SystemContextReport, BoundaryAnalysisReport, etc. These feed into the document editors but do not control the TOC structure.
The output format is Markdown with Mermaid diagrams (system context diagrams, flowcharts, sequence diagrams). Editors emit instructions in their system prompts about ASCII-only node IDs and standard diagram headers.
OpenBMB/RepoAgent
answeredThe wiki/documentation structure is not determined by an LLM prompt or agent. Instead, it is derived deterministically from the filesystem and AST analysis:
File tree walk:
FileHandler.generate_overall_structure()walks the target repo directory tree, respecting.gitignore, and collects every.pyfile that is not ignored (file_handler.py:258-305). The result is a plain dict keyed by relative file path.AST-based object extraction: Each
.pyfile is parsed withast.parse(), and everyFunctionDef,ClassDef, andAsyncFunctionDefis extracted with start/end line numbers, parameter lists, and source code (file_handler.py:176-215).Tree construction:
MetaInfo.from_project_hierarchy_json()(doc_meta_info.py:871-1019) assembles the flat dict into a nested tree:- File paths are split on
/to build directory nodes (_dir, _file, _repo types) - Objects within each file are placed using line-number containment: if object A's lines contain object B's lines, B becomes A's child in the tree (
doc_meta_info.py:954-998) - Object types are assigned:
ClassDef→_class,FunctionDefnested in a class →_class_function,FunctionDefin a function →_sub_function, regular →_function(doc_meta_info.py:999-1014)
- File paths are split on
Reference relationships: After the tree is built,
MetaInfo.parse_reference()(doc_meta_info.py:500-615) uses Jedi (jedi.Script.get_references()) to find all bidirectional call/reference relationships between objects across files. These populatereference_who(who this object calls) andwho_reference_me(who calls this object) on eachDocItemnode.Task scheduling: A topology-based
TaskManager(multi_task_dispatch.py) sorts objects so that callees are documented before callers, usingreference_whoas dependencies (doc_meta_info.py:617-696). Circular references are handled via a best-effort fallback (doc_meta_info.py:637-676).GitBook display: The
display/book_tools/scripts copy the generated markdown docs into a GitBook-compatible folder and auto-generate aSUMMARY.md(table of contents) by recursively scanning the markdown directory structure (display/book_tools/generate_summary_from_book.py). The TOC mirrors the filesystem hierarchy of the markdown docs, which in turn mirrors the original repo structure.
There is no LLM deciding section names or page layouts — the structure is purely code-driven.
aibox22/readmeX
answeredThe wiki structure is not LLM-driven — it is hardcoded. WebsiteGenerator._create_mkdocs_config() (website_core.py:2174-2251) produces an mkdocs.yml with a fixed navigation array:
nav:
- {首页: 'index.md'}
- {安装: 'installation.md'}
- {使用说明: 'usage.md'}
- {API文档: 'api/index.md'}
- {示例: 'examples.md'}
- {架构: 'architecture.md'}
- {贡献指南: 'contributing.md'}
- {更新日志: 'changelog.md'}
This 8-page structure is always the same regardless of the project. The API docs sub-section expands dynamically because _generate_api_documentation() (website_core.py:347-377) generates one .md file per valuable function/class (filtered by APIDocumentationFilter which skips tests, private symbols, trivial helpers, and low-value files), each saved as api/{module}/{name}.md. The input to the generator is the project_analysis dict built by _analyze_project() (website_core.py:286-327), which contains structure (text tree), functions, classes, modules, dependencies, entry_points, and git_info — all extracted via filesystem traversal and AST parsing. The static nature is deliberate: the progress tracker pre-defines self.stages with those exact 10 stages (website_core.py:38-49) and _generate_pages_in_parallel() (website_core.py:208-255) maps each stage to its generator function explicitly.
he-yufeng/RepoWiki
answeredThe wiki structure (pages and sidebar) is determined entirely by the WikiBuilder.build() method (src/repowiki/core/wiki_builder.py:42-108), which assembles pages from the structured output of the LLM analysis pipeline. It works in this order:
- Index/Overview — from
ProjectOverview(LLM-generated), always present (wiki_builder.py:54-58). - Architecture — from
ArchitectureDiagram(LLM-generated), only ifarchitecture_typeis non-empty (wiki_builder.py:60-65). - Knowledge Cards — one compact card per module, computed from
ModuleDocdata without an extra LLM call; only if any module exists (wiki_builder.py:69-72). - Module pages — one per module; modules are derived from the file tree by
_group_into_modules()in the Analyzer (src/repowiki/core/analyzer.py:147-164), which groups files by their top-level directory (or second-level if undersrc//lib/pkg/internal/app). The LLM returns oneModuleDocJSON per group with purpose, files, relationships, and concepts (analyzer.py:199-245). - Reading Guide — from
ReadingGuide(LLM-generated), only if steps exist (wiki_builder.py:88-92). - Dependencies — a Mermaid diagram of inter-module imports from
DependencyGraph, plus PageRank core files, entry points, cycles, and isolated files (wiki_builder.py:94-99). - Symbol Index — every
key_symbolsentry across all module files, grouped by kind then by module; only if any symbols were documented (wiki_builder.py:101-105).
The sidebar is a linear list with a collapsible "Modules" group containing child items. The LLM never proposes page names or hierarchy — the structure is fixed by the builder; the LLM fills the content slots.
weibaohui/openDeepWiki
answeredThe wiki table of contents is determined by an LLM agent — not by statically parsing the file tree. Triggered via POST /api/repositories/:id/directory-analyze, it creates a TocWrite task that invokes the TocWriter (toc.go). The writer builds a sequential agent pipeline of two sub-agents: toc_editor (analyzes the repo and proposes topics) then toc_checker (validates and corrects the list). The agent prompt passes the local repo path and asks it to identify the project type, tech stack, and generate a structured task list. The agent outputs must be strict YAML with two fields: dirs (array of objects with title, sort_order, outline, and hint) and analysis_summary. Each generated dir creates a DocWrite sub-task. Evidence (hints) from the TOC analysis — such as file locations, aspect details, and source references — are saved to the TaskHint repo and later fed to page-generation agents as context cues. The output YAML is parsed via parseDirList(), which does YAML extraction and unmarshalling against the DirMakerGenerationResult struct.
← How is retrieval (RAG) implemented? · How are individual pages generated? →