[KongchangAI]
· 3 min read· 1,607 words

LLM Wiki in Practice: Teaching Agents to Understand Enterprise Business Code

LLM Wiki in Practice: Teaching Agents to Understand Enterprise Business Code

Let an LLM read business code to auto-generate a traceable Wiki knowledge base, exposed to agents via MCP.

To solve the pain point that enterprise agents lack written business-rule documentation and business staff won't help map it out, the article proposes using LLM Wiki to let an LLM read the business codebase directly, reverse-engineering business rules from constants, conditionals, and state transitions, and generating Markdown knowledge pages and a Claim evidence chain with source line-number provenance. It uses structured full-text retrieval rather than vector retrieval, complementing rather than replacing RAG. Artifacts are exposed via MCP as Search and Read tools, usable by any MCP-supporting agent; Open Wiki is fully open source and self-hostable.

Title

LLM Wiki in Practice: Teaching Agents to Understand Enterprise Business Code

Meta Description

A Bilibili creator demonstrates LLM Wiki in action: letting an LLM read enterprise business code directly, automatically generating a structured knowledge base with an evidence chain, then exposing it to agents via MCP—solving the last-mile problem of agents that don't understand business rules.

Article Content

When enterprises want to deploy LLMs into their business lines, the biggest headache isn't model capability—it's that agents simply don't understand the business. During a livestream, a Bilibili creator raised a real-world scenario: an order customer-service agent had been built, but its answer accuracy was poor—because enterprise business rules, boundaries, and processes mostly live in people's heads with no written documentation, and business staff won't cooperate in mapping them out. He offered a solution using LLM Wiki: let the LLM read the business code directly, automatically generate a structured knowledge base, and then expose it to agents via MCP.

Where agent deployment gets stuck: business knowledge without text

The creator simulated an order customer-service business line, deliberately providing no text documentation at all—only the database table schema and the order management backend code. This reproduces the real situation many FDEs (Forward Deployed Engineers) face: they can get the data and the code, but not the business rules documentation.

Is my order shipped out normally?

If an agent doesn't know the rule "an order outbound task can run at most 5 times; exceeding that means failure," it cannot accurately diagnose order issues. In the original code, this rule is just a constant value of 5 with no comment explaining it. The traditional approach is to organize business staff to map it out into documentation line by line, but the creator said bluntly, "nobody will cooperate with you." LLM Wiki's approach is to bypass this bottleneck: since the business system already implements business logic in code, let the LLM read the code and reverse-engineer the business rules from it.

FDE (Forward Deployed Engineer, also called front-line delivery engineer) is a common role in recent years in enterprise software and AI deployment. It refers to engineers stationed on-site at the customer, directly interfacing with the business side, and responsible for adapting general product capabilities to specific business scenarios. Unlike traditional pre-sales or implementation consultants, FDEs usually need both engineering implementation skills and business understanding—they must be able to read code, modify configurations, and build integrations, as well as map business processes and identify rule boundaries. In agent deployment projects, FDEs are often the first to touch customer data and codebases, and therefore the first to encounter the knowledge gap of "code but no docs, and an uncooperative business side"—exactly the real situation this article's case reproduces.

What LLM Wiki is: turning code into a knowledge asset

LLM Wiki uses an LLM to read a codebase or document repository, producing a set of interlinked Markdown knowledge pages with source-code provenance, maintainable as the data source changes. What it solves isn't answering questions—it's generating a version-controlled, reviewable asset that agents can retrieve from.

Various code for order query and order management

It is fundamentally different from RAG: RAG does vector retrieval (sparse, dense, even graph databases), whereas Wiki does only structured full-text retrieval, querying layer by layer by section, with every fact traceable to a specific line number in the original file. The creator emphasized that "Wiki is not the same as RAG, nor does it replace RAG"—they serve different purposes. For scenarios like business rules and processes where the data volume is small, structured full-text retrieval is sufficient and lower-cost.

RAG (Retrieval-Augmented Generation) is a technical paradigm in which an LLM first retrieves external knowledge before answering, then injects the retrieval results as context into the generation process. Its retrieval layer commonly includes sparse retrieval (e.g., BM25 keyword matching), dense retrieval (semantic similarity based on vector embeddings), and graph database retrieval (using entity-relationship graphs). RAG excels at recall over massive, heterogeneous, open-domain knowledge, but its retrieval results are usually scattered fragments with coarse provenance granularity, and the vectorization process adds cost and update burden. The Wiki described in the article uses structured full-text retrieval, locating content layer by layer through section hierarchy—essentially organizing knowledge into a document tree with a table of contents. It sacrifices some semantic generalization in exchange for higher traceability and lower maintenance cost, making it better suited to scenarios like business rules that are limited in scale and demand accuracy and provenance.

Repository construction workflow: whitelist plus prompts

Building a Wiki repository requires providing two things. First, the data source—the core code files of the business line. Second, a whitelist configuration (open wiki eclog) that only reads directories and files within the whitelist. At the same time, you must provide a prompt requiring the model to "read the current value from the actual source code, not guess from old pages or text descriptions."

Then what are all these things of mine?

The model reads key nodes in the code—constant definitions, conditional checks, state transitions—and then translates them into natural-language business descriptions. For example, upon reading MAX_TASK_COUNT = 5, combined with the subsequent conditional logic, it concludes "an order outbound task can run at most 5 times; exceeding the limit means failure"; upon reading the snapshot limit check, it concludes "reaching the snapshot limit means failure; otherwise it enters waiting"; upon reading the state advancement logic, it concludes "the order only continues to advance on success; on failure the order stays in process state."

The generated artifacts include topic pages (index files with searchable sections), Claims evidence files, and evidence-chain reference files. Each Claim records a piece of business understanding and annotates the source file and line-number range, achieving traceability. In the case study, the creator generated 106 Claims and 122 evidence references.

Exposing tools via MCP: agents connect to the knowledge base

Once the repository is built, two tools are exposed to agents via MCP (Model Context Protocol): Search for retrieval and Read for reading the original evidence files. MCP is a universal invocation protocol between agents and tools; any agent that supports MCP can connect to this knowledge base.

Agents can operate my computer

The creator explained MCP with an analogy of operating a computer: encapsulate file reading and file writing as tools, expose them under a unified protocol, and agents developed by different companies can all call them. Agents use Search to find business understanding in the Wiki repository and Read to trace back the evidence chain, thereby understanding the entire business line without relying on human-written documentation.

MCP (Model Context Protocol) is an open protocol proposed and open-sourced by Anthropic to standardize how LLM applications connect to external tools and data sources. It uses a client-server architecture: an MCP server encapsulates capabilities such as file read/write, database queries, and API calls as tools with names and parameter descriptions, while an MCP client (i.e., the agent runtime) discovers and invokes these tools according to the protocol. Compared with each agent defining its own plugin interface, MCP's value lies in decoupling—a tool provider only needs to implement once, and any agent supporting the protocol can reuse it. The Search and Read in the article are exactly two typical MCP tools: the former handles semantic location, the latter handles evidence tracing, and together they enable an agent to achieve business understanding without human documentation.

Solution selection and boundaries

The creator mentioned several Wiki implementation options: Open Wiki is fully open source and self-hostable; it can read local repositories to generate Markdown and Claims and provide MCP retrieval, and can connect to any agent. Deep Wiki offers a hosted SaaS service but is not fully open source, and domestic enterprises, given the sensitivity of their business data, will most likely not adopt it. There is also Google Code Wiki. If you don't want to use an off-the-shelf solution, you can also build your own knowledge base on RAG, but that requires more code.

To be clear, this solution is suitable for knowledge of modest size such as business rules, processes, and boundaries. If an enterprise has multiple business lines, even if their logic is similar but with key distinguishing points, it should build separate Wiki repositories and expose different tools for isolation. Updating and maintaining the repository after the data source changes is precisely the maintainability that Wiki is designed for—and this is its core value compared with one-off documentation cleanup.

One-line Summary

Let an LLM read business code to automatically generate a traceable Wiki knowledge base, then expose it to agents via MCP—bypassing the bottleneck of missing business documentation.

Paragraph Summary

The article addresses the pain point that when enterprises deploy agents, business rules live in people's heads, lack written documentation, and business staff won't cooperate in mapping them out. It proposes using LLM Wiki to let the LLM read the business codebase directly, reverse-engineering business rules from constant definitions, conditional checks, and state transitions, and generating Markdown knowledge pages and a Claim evidence chain with source-code line-number provenance. The solution uses structured full-text retrieval rather than vector retrieval; it differs from RAG in purpose and does not replace it, making it better suited to business-rule scenarios of limited scale. Construction requires configuring a data-source whitelist and prompts, and the artifacts are exposed through MCP as two tools, Search and Read, which any MCP-supporting agent can connect to. For solution selection, Open Wiki is fully open source and self-hostable, suitable for data-sensitive enterprises; the article also emphasizes that multiple business lines should be isolated into separate repositories and that the repository can be maintained after data source changes.

#LLM Wiki#MCP#AI agents#business code#knowledge base#RAG
Share:

Related articles