Epitech · 3rd year · Group project
Sensai
An offline AI copilot for investigative journalists that sources every claim.
- Python
- Ollama
- RAG
- SQLite
- MCP
- Period
- Oct – Nov 2026
- Team
- Team project, with Manmohit509 and Alexandre Rousselle
- Code
- View the code
The project
A journalist receives a leak of 5,000 internal documents. Nothing can go to the cloud without putting the source at risk.
Sensai runs entirely on an air-gapped machine. It indexes the documents, answers questions and ties every claim to the exact document and passage it comes from.
My part
- ReAct reasoning loops, readable step by step
- Semantic cache
- Prompt versioning and prompt optimisation
- Automated evaluation and hallucination detection
- Logging and monitoring
- Model tools
What was hard
- Everything runs offline, so on small local models, which cite their sources less reliably and make things up more easily.
- Checking every sentence of an answer against the documents, without delaying the answer itself.
- Moving forward as three people on the same codebase, each on their own branches, without breaking the others’ work.
What I learned
- An agent’s reasoning has to be readable: each step says what it knows, what is missing and what it will check next.
- Measuring before optimising a prompt: each version is dated and evaluated on the same questions.
- Checking with code first whatever can be checked, such as amounts, dates and names, before asking a model.
Try it.
My features, on video
The six features I built, recorded for the project defence.
What I built
ReAct reasoningMy feature
Sensai reasons step by step: what it knows, what is missing, which document or tool to check. Every step can be read again.
Semantic cacheMy feature
A question close to one already asked gets the same answer, without calling the model again.
Prompt optimisationMy feature
The best answers become examples shown to the model for the next questions.
Prompt versioningMy feature
Each change to the system prompt is a dated version that can be compared, measured and rolled back.
Hallucination detectionMy feature
Each generated statement is checked against the source documents. Anything unsupported is flagged.
Logging and monitoringMy feature
Every message is logged with its prompt, tools, time and tokens. /stats sums it all up.
How Sensai finds the right passage
Document search, from indexing to the sourced answer.
Step 1SQLite
Indexing
PDFs, emails, spreadsheets: the text is split into passages of about 1,200 characters, embedded with Ollama.
Step 2cosinus + BM25
Hybrid search
The 30 closest passages by meaning and the 30 best by keywords, merged by their ranks.
Step 3cross-encoder
Reranking
A second model reads the question and each passage together, and scores its relevance from 0 to 1.
Step 4
Threshold
Below the threshold, a passage never reaches the model. If nothing passes, Sensai says the documents do not answer.
Step 5
Sourced answer
Every claim points to the exact document and passage it comes from.
The rest of Sensai
The features built by my teammates, to see the whole product.
Agents
Multi-agent orchestration
Human in the loop
Personas
Document search
Document search
Advanced RAG
Memory
Sessions and profile
Token budget and compression
Structured memory
Living document
Tools
MCP servers
Code execution
Web search
File access
Structured outputs
Evaluation and safety
Guardrails
Adversarial testing
Experience
Web interface
Branches and interruption
Export and public link
Questions to the user
Scheduled tasks