LLM Wiki on Steroids
A product knowledge base that knows where its knowledge comes from
Starting point: product information across many channels
Product information is spread across documents, chats, tickets and people's heads, and it is often incomplete or contradictory. Agents generate further content from it, and other agents build on that content. After a few rounds it is unclear which information is original, which is derived, and whether it is still correct. This is a form of AI poisoning.
An example question and its answer with sources
A question that sales and presales ask regularly: "Can our product read the tax number from an invoice automatically?"
Yes. The feature "document intake" recognises incoming invoices automatically and extracts the tax number. The tax number is set by the system from the recognised document, not entered by the user. Available since release R, in module M.
Sources: ticket ABC-123 (acceptance criteria, closed on 3 March), commit 4f2a… (extraction of the tax number), screenshot of the invoice screen of 12 April.
Use cases: questions, channels and agents
The knowledge base has to answer these groups of questions:
- Product questions. "Since which release do we support Z?" Sales, presales, support and product management ask such questions again and again, often the same one for the tenth time in a week.
- Customer questions. "Which customers have licensed module M?" or "Does customer X use feature Y?".
- Support questions and support tickets. How does a function work, what does it require, and is there a known bug that explains what the customer sees?
- Consequences of customisation. Customers can replace predefined standard fields with their own custom fields. If a customer replaces standard field X with a custom field, which features stop working?
- RFPs. A request for proposal is a long questionnaire in which a prospective customer asks what the product can do. Most of its functional questions are product questions, only many of them at once and under time pressure.
Channels
These questions reach the knowledge base through different channels: a product questions channel in Teams or Slack, a chatbot inside the application, an agent that fills in RFP questionnaires, an agent that drafts answers to support tickets in the ticket system, and the wiki itself, where people look things up.
Agents
Behind these channels, two kinds of agents work with the knowledge base:
- Extraction agents fill it. They read the sources, create and update the entries of the ontology, write the feature descriptions and record where each statement comes from and when. They run at regular intervals and whenever a source changes.
- Query agents answer the questions from the channels. They work from the knowledge base, not from the raw sources, use tested queries for the frequent kinds of questions and answer with sources. If they cannot answer with high confidence, they say so.
What the query agents cannot answer becomes work for the extraction agents, as described further below.
Information atoms as the basis of the knowledge base
Atoms
The knowledge base is built from the smallest pieces of information that are reliable by construction, and not from what people have written about the product. I call these pieces information atoms.
For software, these atoms are:
- The code. It is the most precise description of what has actually been built.
- The tickets in Jira and other ticket and product planning tools. They say what was planned, decided and delivered.
- The application itself. An agent clicks through the app and links what it finds with the tickets and the code.
Further sources
Around these atoms there are further sources:
- The CRM, for commercial information: which customer has licensed what.
- Data analyses, for example revenue per customer.
- Questions that have already been answered. They are useful but unreliable: they may be outdated or wrong, and they are often the kind of derived content that causes the problem.
Principles
Two principles apply.
First, every piece of information carries where it comes from and when. For example: "this statement comes from ticket ABC-123, revision of 3 March" or "from commit 4f2a…, merged on 12 April".
Second, the atoms reference each other where possible. The code carries references to the tickets it implements or touches. This makes the link between code and ticket a recorded fact that no LLM has to infer.
The LLM wiki idea and the role of the LLM
LLM wiki
The idea borrows from the LLM wiki: agents regularly build up a central knowledge base and keep extending it, instead of answering every question from scratch against the raw sources.
Role of the LLM
An LLM can categorise, recognise that a ticket, a piece of code and a screen are about the same thing, and recognise the terms of a domain and how they relate. A full-text index or a semantic search cannot do that.
The ontology: types, relations, descriptions and indexes
Basic ontology
The knowledge base is organised around an ontology. A basic ontology is given up front, with types such as initiative, release, feature, customer and the fields of the data model, and the relations between them: a release contains features, an initiative groups features, a customer licenses something, code implements a ticket, a feature depends on a field.
Extensions
Agents fill this ontology from the sources. They also propose extensions when they come across concepts that do not fit the existing types. A person decides whether such an extension is adopted.
Descriptions
Each node also has a description, which makes the knowledge base a wiki. A feature page explains what the feature does and can include screenshots. Agents write these descriptions from the atoms, so they are LLM-derived knowledge and carry their sources.
Terms
The terms of the ontology must be defined precisely. "Customer uses feature" can mean three different things: the customer has licensed it, it is enabled for the customer, or the customer actually uses it. If the ontology does not keep these apart, the system may answer for one meaning when the question was about another.
Indexes
The ontology is indexed in three ways: a structured index for types and relations, a full-text index for words and names, and a semantic index for meaning and synonyms. The extraction agents use these indexes as well: before creating an entry, an agent searches semantically for an existing entry that describes the same thing and extends it instead of creating a duplicate. For code, a semantic index of the code base can be used in addition.
Architecture overview: query layer, knowledge base, extraction and sources
Architecture overview: query layer, knowledge base, extraction and sources
Building feature descriptions from planning, code and the application
By "feature" I mean a function of the product as users and customers understand it, such as "incoming invoices are recognised automatically", not a ticket type in a planning tool.
References from the ontology to the sources
Reading the code base, the tickets and their history for every question would be too slow and too expensive, and it would not fit into a context window. The nodes of the ontology therefore point to the artefacts they are based on, such as files, functions, commits and tickets, and an agent reads them only when it needs a detail.
The planning chain from discovery item to epic
Ideal chain
A product discovery item describes a customer problem, the related use cases and metrics such as reach (how many users are affected) and impact. Features are derived from it where that makes sense, and the epics of the development teams hang below the features. An epic is a larger work package made up of tickets.
Epics without features
Many epics are not linked to any feature. In that case the epic serves as the feature in the knowledge base, which records the fallback and can list all epics without a feature.
Planned and delivered
The discovery item says why a feature exists and for whom. It describes an intention, so the feature description keeps planned use cases apart from delivered ones, which are backed by the code and the application.
From tickets to code
Overview
The sources, what they contribute and how they are linked:
| Source | What it contributes | How it is linked |
|---|---|---|
| Discovery item | Why the feature exists and for whom. This is an intention, not proof of what was built. | Linked to the feature. |
| Feature or epic | What was meant to be delivered. It groups the tickets. | The epic hangs below the feature, or replaces it where there is no feature. |
| Ticket | A single change, with acceptance criteria, status and release. | Belongs to an epic. |
| Git history | Which code changes belong to which ticket. | The ticket ID in the commit message. |
| Code (today's state) | What exists today: screens, API endpoints, backend logic and fields. | Found via the commits. |
| Screen live discovery | An agent clicks through the running application and records which screens and workflows exist and what they look like, with screenshots. | Matched to the code via the route of the screen and its UI texts. |
From planning to code: how the sources are connected to a feature node
Steps
- The ticket ID in every commit message connects the tickets with the code. This yields all code changes that belong to a feature. It is a plain lookup and needs no LLM.
- The changed files are only clues, because the code has evolved since. The agent therefore goes from the changed places into today's code.
- To find its way, it uses an architecture description that an agent has written once beforehand: where the routes of the screens, the API, the data model, the UI texts and the permission checks are defined. It is renewed when the architecture changes.
- With it, the agent finds for each feature the chain from the screen to the API endpoint, the backend code and the fields this code reads and writes, and stores this chain as references on the feature node.
- Screen live discovery matches the screens of the running application to the screens in the code via route and UI texts, and attaches screenshots to the feature. Screens that exist in the code but cannot be reached become visible.
Structure of the feature description
Structure and sources
From this material an agent writes the feature description with a fixed structure: what the feature is, who uses it, how it is used, what it requires (module, licence, configuration) and what its limits are. Every statement cites its source.
Capabilities
The agent also names the capabilities of the feature in the language of the domain, with common synonyms. Customers ask whether the product "recognises invoices", while internally the feature may be called "document intake". The capabilities let the semantic search find the feature for such a question.
Answering questions from the features
Aim
Most questions should be answered from the ontology, without reading code at question time. Descriptions and capabilities therefore have to be written at the level at which customers ask, and the relations have to cover what the questions are about.
Example: product question
During extraction, the agent checks in the code whether the tax number is filled in automatically, and records this capability in the description of the document intake feature. When sales asks about it, the semantic search finds the feature through this capability, together with its sources, its release and its module.
Example: custom fields
Standard fields are nodes of the ontology, and every feature records which of them it depends on. Which features stop working when standard field X is replaced by a custom field is then a query along these relations, without an agent.
Handling questions that cannot be answered yet
Log of uncertain answers
If a query agent cannot answer a question with high confidence, it marks its answer as uncertain and logs the question with its preliminary results: the features found, their sources and what was missing.
Research
The extraction agent works through this log regularly, researches the question in the code, the tickets and the application, and proposes additions to the ontology, such as a missing capability, a missing relation or a new type. A person reviews them before they are adopted.
Domain experts
If the sources cannot settle a question, it goes to a domain expert. The answer is adopted with the expert's name and the date as its source.
Adoption
Adopted additions carry their sources and are marked as stale when the code or tickets they rest on change. In this way the knowledge base grows along the questions that are actually asked.
Storage and inference: rules, requirements and options
This chapter describes what the storage has to do, without committing to a database. The central concept is the rule.
Rules and what they are used for
Definition
A rule states: if these facts hold, then this fact holds as well. For example: if a customer has licensed module M and feature F belongs to module M, then feature F is available to the customer.
Reason
Many answers are not stored as a single fact but follow from combining facts. A rule defines this combination once, instead of in every query or anew by an LLM for every question, and every derived fact can name the facts and the rule it comes from.
Uses
- Deriving facts, as in the example.
- Checking consistency, for example a closed ticket that no code references.
- Answering questions without an agent, for example which customers are affected by bug X, or whether customer K had feature F on 1 March.
Requirements for the storage
- Provenance on every fact. Every fact and every relation is stored with its source and its point in time.
- Three kinds of knowledge. Every piece of information is an atom taken from a source, a fact derived by a rule, or a fact derived by an LLM. This makes visible whether something is original, derived deterministically, or derived by a model.
- Derived facts stay current. When an atom changes, everything derived from it must follow. A derived fact can have several justifications: if a customer gets a feature through two modules, losing one licence must not remove it. LLM-derived facts are marked as stale when their source changes and are extracted again.
- Permissions all the way to the answer. The access rights from the sources are enforced in every query, so that a support agent answering customer A never reveals information about customer B.
- An extensible ontology. Adopting a new type or relation must not require rebuilding the system.
Options for describing, storing and querying the ontology
Four decisions have to be made, each with several options.
1. How is the ontology described?
- JSON Schema is well suited to checking whether an agent has produced a valid entry, but it cannot express rules.
- Datalog is a logic language in which facts and rules have the same form, so the ontology and the rules can be written together.
- OWL, the standard language for ontologies in the semantic web, is strong at class hierarchies and inheritance. A product domain needs neither, so OWL adds complexity here without benefit.
Which of these fits depends on whether the description is only written down or also executed. The next chapter describes one concrete choice.
2. How is it stored?
- A real schema has one table per type. Queries are simple and the database checks the data, but every new type is a change to the database schema.
- A metamodel stores everything in a few generic tables: one for nodes, one for relations, one for attributes. A new type can be used immediately, but queries become more cumbersome, and the database can check less.
- A graph database stores nodes and edges directly, so queries along paths are short.
The choice depends above all on one question: must a new type that has been approved be usable immediately, or is it enough to introduce it with the next release as a schema change?
3. Where do the rules run, and are derived facts stored?
Computed at query time, a derived fact is always current, but every query pays for the computation and there is nothing to attach provenance to. Stored, it is fast to read and carries its provenance, but it has to be updated whenever its inputs change.
- Rules directly in the database, written as database queries or through an extension that understands a rule language. Usually they are computed at query time.
- A backend, a separate software layer that evaluates the rules, stores the derived facts with their provenance, and controls when what is recomputed. This gives full control, but keeping derived facts current is your own code.
- A specialised rule database, which stores derived facts and updates them automatically when facts are added or deleted. This covers the requirement that derived facts stay current without own code, at the price of a second system with its own data model and query language.
A graph database without rules does not answer this question. Its paths are short to write, but the logic of a rule then has to be written into every query again.
4. How are questions asked?
- Fixed queries in a backend, offered for example through an interface similar to GraphQL. They cover the frequent kinds of questions, are tested, and enforce permissions.
- A general query language, such as SQL, Datalog or Cypher, for everything the fixed queries do not cover.
- Free queries generated by an LLM, only as a fallback for unknown questions, and marked as less reliable.
An implementation in Postgres
This chapter describes one concrete and pragmatic way to build the knowledge base, using only Postgres and established extensions.
Definition
The whole ontology is defined in a single JSON file: the types, their attributes, the relations between them, the rules and the queries. Everything that makes up the knowledge base is thus in one place, can be reviewed as a whole, and is versioned like code.
Generator
A generator turns this definition into the database:
- Tables. The generator adds the mandatory columns to every table automatically: the source, the kind of knowledge (atom, derived by a rule, derived by an LLM, or stated by a person), the point in time and the period of validity. It also adds the row level security policies. This way no table can be created without provenance and permissions.
- Rules. Every rule becomes a view. Where its results should be stored, it becomes a materialized view that is recomputed after every extraction run. Every rule view returns the IDs of the rows it is derived from, so every derived fact can say where it comes from. The generator checks this before it creates the view.
- Queries. Every query, such as "does customer K have feature X?", also becomes a view.
The three indexes are ordinary indexes, the built-in full-text search and the pgvector extension.
Answering a question
The query agent maps a question to one of the defined queries and calls it with parameters. The rules have already been evaluated at that point, either by Postgres while reading the view or after the last extraction run.
Datalog
In this approach Datalog would neither be executed nor used to ask questions. It would only be a notation for the definition, and that would require maintaining a parser and a translator to SQL without any benefit over writing the rules in SQL directly.
Why this implementation fits the use cases
Tested queries instead of queries written by the LLM
The questions in the use cases recur in a small number of forms, so the agent only needs a set of tested queries and does not write its own. Questions that none of them cover go into the log. If such a question recurs, a query is added to the definition, reviewed and tested.
Permissions per query and per row
Because every query is a defined view, permissions can be granted per query: a support role may ask whether a customer has a feature, but not see the revenue per customer. In addition, row level security decides which rows a user may see at all, so a support agent working for customer A never sees data about customer B, whichever query it uses.
Access for people and agents
For people
People use a wiki interface. Every customer, feature, release and initiative has a page with its description, screenshots, relations and sources, and many questions are answered by navigating.
For agents
Agents get the defined queries as tools, together with the full-text and the semantic search, and use them to answer product questions, fill in RFPs and respond to support tickets. They call the defined queries with parameters and do not write their own. Where no query fits, the question goes into the log.
Business value for the company and its customers
Operational excellence
A company that has such a knowledge base can show its customers and investors that it practises operational excellence. The knowledge about its own product is no longer scattered across dozens of channels. It is in one place, built from reliable sources, and every statement says where it comes from. The knowledge base also shows where the company's own processes have gaps, for example epics that are not linked to any feature, or questions that could not be answered.
Efficiency
The work that eats hours today, such as answering the same product question for the tenth time, filling in RFPs or researching support tickets, is largely done by agents. People only step in where the sources do not settle a question. This makes the company more efficient than competitors who still search their channels by hand, or who let agents generate new content from generated content.
Customer benefit
The direct benefit for customers is better and faster answers. They are faster, because an agent answers a question or a section of an RFP without anyone having to research it first. They are better, because every answer says where it comes from, and because the knowledge base says so when it is uncertain, instead of guessing.
Open challenges
Ticket IDs in commits
The link from code to tickets rests on every commit naming its ticket. Where teams have not done this consistently, older code cannot be assigned to tickets deterministically. For that code only a semantic assignment by an LLM remains, and it has to be marked as LLM-derived.
Ontology changes
When a type is split or a relation is renamed, the existing rows have to be migrated, and feature descriptions that use the old terms have to be written again by the extraction agents.
Permissions of derived facts
A derived fact combines facts that can have different access rights, for example the licence data of a customer and general product data. A rule view has to apply the strictest rights of its inputs. Otherwise the derived fact reveals what its input facts would hide.
Large features
A feature can span hundreds of tickets and commits, far more than fits into the context window of an LLM. The extraction agent has to summarise them in pieces and merge the pieces into one description, and contradictions between the pieces have to be reported instead of being smoothed over.
Review effort
Every extension of the ontology and every new rule or query goes through a person. If the agents propose many changes, the review becomes the bottleneck.
Conclusion
Today, product information is spread across many channels, and agents generate more and more of it from content that other agents generated. For the invoice question, sales can instead point to the ticket, the extraction code and the screen. If the evidence is incomplete, the answer says what is missing, and an extraction agent follows up.