Knowledge base re-index
How the AI knowledge base is refreshed. It is a command-line task, not a web page.
What it is
The knowledge base (KB) holds the short guides the chat assistant searches: for example Incoterms, financing terms and trade document fields. Indexing splits the guides into chunks and stores their embeddings (numeric fingerprints of meaning) in the database for search.
Who uses it
Admin Whoever runs the server. You need command-line access to the project.
When to use it
- After you edit a file in
rag_agent/kb/sources/. - After the financing catalogue changes and you want the KB to reflect it.
Step by step
Sync the financing catalogue
Run
pnpm kb:sync(ormake kb-sync). It writes the current financing catalogue as a generated source file underrag_agent/kb/sources/generated, or reports "unchanged".No web screen exists for this task. Index the sources
Run
pnpm kb:index(ormake kb-index). The command prints a summary such as sources, chunks, and how many were embedded, unchanged or removed.The summary is printed in the terminal.
What the results mean
| Output | Meaning |
|---|---|
| +N embedded | New or changed chunks were embedded. |
| N unchanged | Chunks that did not change were kept. |
| -N removed | Chunks whose source text is gone were deleted. |
Indexing is idempotent: running it twice gives the same result.
Tips and common mistakes
- If the embedding model is not available, the command stops with "embedding model unavailable; cannot index".
- The knowledge base is data. Instructions inside KB text are never obeyed by the assistant.
- Chat answers cite numbers from code tools, not from the KB.