Ask Rusty content sources
Everything the assistant knows about the IBA is read from the CMS at the moment the question is asked. The one copy is the text of the PDF documents, indexed nightly so they can be searched — and even there, whether a member may see a document is still decided from the live CMS row.
That decision is what makes two things true:
- Adding or changing content needs no deploy. An FAQ written in the CMS is answerable on the next question.
- Retiring content takes effect immediately. Setting something to
closedremoves it from the very next answer. There is no index to fall out of date and no cache to expire.
Carried in every request, or fetched on demand
Content splits by shape, not by source. Small, whole-set material that benefits from being seen all at once is carried in every request; large material where only the relevant part is ever wanted sits behind a tool.
| Source | Carried every time | Fetched on demand |
|---|---|---|
| FAQs | The full text of every live FAQ | — |
| Skills | Every skill name, its id and its one-line summary | The full training breakdown, plus videos and tutorial PDF links; the tutorials’ text through search_documents |
| Tunnels | The whole list | — |
| Reference documents & guides | Title and link for everything in scope | Matching passages from the documents’ text (search_documents) |
| News | Headlines only | The article body |
| Site map | Every page, who it is for, whether this member can open it | — |
| Safety position | The IBA’s published safety copy | — |
The FAQ set is carried whole deliberately. It lets an answer draw on more than one FAQ at a time — “how do I keep my instructor rating current” pulls the quarterly safety meeting from one and the Trainer Level 3 evaluator from another, which a system retrieving a single best match would miss.
Skills go the other way. The one-line summaries are enough to know a skill exists and name it, but not to answer a progression question — those need the full breakdown, which is far too large to send every time.
Each listed skill carries its id so the assistant can fetch that breakdown in one step. Without it the assistant guessed an id, missed, and searched its way to the right skill, spending the tool calls it is allowed per question and sometimes running out before answering. The id is the same in every language; the member’s language decides which translation comes back. It is never shown to the member.
The status rule
Content is included when its status is not closed, rather than when it is
open.
This matters because there are three status values, not two. Featured is what
editors use for the content they consider most important — currently four FAQs
per language. Filtering on = 'open' would silently drop exactly the material
someone flagged as most important.
Document visibility
Reference documents are filed by editors into role-named categories, and those categories map to tiers. Guides have no such categories and take a single constant — instructor — matching how the site gates the Guides page.
Two rules govern what a member sees:
- Out of scope means absent. A document above a member’s tier is not listed, not named and not linked. There is no “mentioned but withheld” state.
- Unmapped means invisible to everyone. A category with no tier mapping resolves to nobody, including administrators, so a category added in the CMS must be mapped deliberately before its documents surface.
The practical shape of that: a signed-out visitor sees no reference documents at all, a current instructor sees 27, a trainer 36 — and the instructor’s set is always a strict subset of the trainer’s.
Reference materials are for staff only, by design. The Flyer category is empty, so flyers see none either, and treating signed-out visitors as flyers would change nothing. Both can still search every Flight Tutorial, because those belong to the public Flyer and Coach skills. A signed-out question such as “how do I become an instructor” therefore runs no document search: the answer is in staff-only material.
Document search
The assistant reads document contents through the search_documents tool
(TUN-854). It covers every reference material that is not closed and the
Flight Tutorial of every open skill, in English, Spanish and French.
What is indexed. A nightly cron, chatbot_ingest (03:30 UTC), downloads
each PDF, extracts its text, cleans it and splits it into passages of about
1,500 characters with their page numbers. They are stored in MySQL:
chatbot_documents holds one row per file, chatbot_document_chunks the
passages under a FULLTEXT index. A file is only re-processed when its bytes
change, so a quiet night writes nothing. Run it by hand with
npm run chatbot:ingest (locally) or the chatbot_ingest option in
crons.yml (production). Only one ingest runs at a time: a second one started
while another is running exits at once and logs {"skipped":"already running"}.
Two overlapping runs used to deadlock on the same document.
Visibility is not copied. The index stores text, not permissions. Every search joins back to the live CMS rows and applies the same rules as Document visibility above, so a document closed or moved to another category stops matching on the next question, not the next night. Tutorials follow their skill’s category.
How it answers. The tool returns up to six passages, at most two per document, each with a link that opens the PDF at its page. A passage must contain at least half the meaningful words of the search, which keeps out passages that share one rare word. The assistant is told to search in the document’s own words and to answer only from what comes back. If nothing matches, it names the document most likely to cover the question, links it, and says it could not find the answer there. It never fills the gap with a guess.
Known weakness. Keyword search struggles when every word in the question is common, such as “who can award the novice training objectives”. The right passage is found but can be outranked by others containing the same everyday words.
Why not vector search. TUN-888 compared keyword, vector (bge-m3) and hybrid search on the same 16 test questions. On the searches the assistant actually writes, all three found the right passage for 11 of the 16, so vectors were not added. The misses were in the search the assistant wrote, not in how it was ranked: it read AFF as “Affiliate” and did not recognise TO.
Abbreviations. The prompt carries a list of IBA abbreviations taken from the
manuals (GLOSSARY in constant/prompts.js), and tells the assistant to search
with the full term. The search cannot match a word shorter than three letters,
so “TO” or “SM” on its own finds nothing. With the list, “AFF block time” is
searched as “Accelerated Freefall block time” and finds the right passage.
Still not readable:
- Guides. They are YouTube videos, linked but not transcribed.
- A document whose download or extraction failed. It is recorded in
chatbot_documents.error_message, retried every night, and searchable once it succeeds. Missing translations show up here: the CMS can list a Spanish or French document whose file was never uploaded.
What is logged. Each answer records the documents search returned
(retrieved_doc_ids, retrieval_hit) and the documents the answer actually
linked (cited_doc_ids), so unanswered questions and unused documents can be
found from the query log.
Language
All content is stored per language and every query carries the member’s language, so a French member gets French FAQs, French skills and French documents, and searches only the French text. Tunnels are the same list everywhere and have no language of their own.