Video in the works
TermiX knowledge base
Adding a document, then asking the chat a question it answers from it.

About the project
A small service that lets TermiX's AI chat answer questions about TermiX. Documents are split into pieces and stored in Pinecone, a search database that finds them by meaning, not just by matching words.
TermiX's AI chat needed to answer questions about TermiX itself: its features, its MCP servers, how things work. This service is its memory. Documents go in, are split into chunks and stored in Pinecone, so the chat can search them by meaning.
It's a small, focused service, but it sits on the path of chat messages, so speed and reliable deletes mattered.
How it works
Add
Send a document to the API.
Split
It's cut into sentence-aware chunks that overlap, each tagged with its document and position.
Store
Pinecone turns the text into vectors itself.
Search
A question returns the closest chunks, re-ranked in a second pass.
Answer
The chat backend puts the best match into the model's context, with a 5-minute cache.
Under the hood
- API
- Express and TypeScript: add, list, edit, delete and search.
- Vectors
- Pinecone, with built-in embeddings and reranking.
- Cache
- An LRU cache on the chat side.
What I did
- A REST API to add, list, edit, delete and search knowledge documents
- A sentence-aware chunker with overlap, that falls back to words for very long sentences
- Pinecone's built-in embeddings, so the service sends plain text
- A second reranking pass on search results
- Chunks tagged with their document and position, so a full document can be rebuilt in order
- Connected it to the TermiX chat backend, with a 5-minute cache for faster replies, and made MCP server info come from the knowledge base
What was new
- Chunking with overlap, and putting chunks back together in order
- Reranking search results for better answers
- Caching on the calling side to speed up chat
Problems I hit, and how I fixed them
The first version used the title as the ID, so documents with the same title merged.
Fix A unique document ID on every chunk.
Deleting chunks silently failed: search results carried the ID under a different field name.
Fix Use the right field, try each delete method, then search again to confirm.
The list endpoint reported the page size as the total.
Fix Count everything before paging.
The TermiX chatbot errored and knowledge lookups were slow.
Fix A cache for searches and document lookups.
Screenshots
Screenshots in the works
Real screens from TermiX knowledge base go here.