Technical overview of the Retrieval-Augmented Generation (RAG) system built for S.T.A.L.K.E.R. OP-2.2.
I am César Blanc, a Data Engineer/Scientist passionate about Artificial Intelligence, processing complex datasets and creating models based on real-world use cases. I am currently looking for a job as a Data Scientist. Check out my LinkedIn page with my resume for more information and my Email if you want to contact me
S.T.A.L.K.E.R. OP-2.2 is notoriously known as one of the most complex and data-dense modifications in the S.T.A.L.K.E.R. community. It's an esoteric and obscure mod featuring thousands of interlocked quests, items, coordinates, and hidden mechanics spread across unstructured community wikis and raw spreadsheets. Since I love both the base game and the mod, and since it's impossible to play without spending hours on the wiki, I came up with the idea of creating a personal assistant to help me and other players to beat the game. All data used in this projet comes from this community wiki.
I am in no way affiliated with the holder of the S.T.A.L.K.E.R. license GSC Game World, the creators of the mod OP-2.2 or the OP-2 fandom wiki OP-2 fandom wiki. This is a standalone fan project which I use for my portfolio and as a personal assistant.
The system is not just a standard semantic search engine. The LLM acts as an autonomous agent capable of deciding which tool to use: it queries the Qdrant Vector Database for unstructured narrative data (quest guides, tactics...), queries the PostgreSQL Database for exact numerical statistics (weapon damage, armor carry-weight...) and search in the NetworkX Graph for quest routing and pathfinding. This hybrid approach eliminates hallucinations on critical data points.
To overcome the limitations of traditional linear RAG pipelines (such as truncation on massive wiki tables or inaccurate answers because they were unverified and rushed), the agent has been migrated from a simple single-pass execution to a cyclical StateGraph using LangGraph:
Initially, preserving conversation history caused memory leaks and `400 Bad Request` crashes due to the LLM returning massive internal metadata blocks. I implemented a strict memory middleware that intercepts the LLM's raw output, extracts only the sanitized user-facing text, and dynamically truncates the context window to a rolling 10-message limit. This guarantees server stability and drastically reduces API token costs.
A RAG system based on a fan-driven wiki must be up to date. To prevent outdated information and ensure synchronization with the ever-evolving community data, I engineered a fully automated data pipeline:
For a RAG system to be trustworthy, traceability is mandatory. I utilized Few-Shot Prompt Engineering to strictly enforce source citations. The agent is hardcoded to dynamically generate Markdown links pointing exactly to the originating Wiki page URL or the specific Google Sheet / Database table used for its answer. This way, the user can verify the information and understand how the RAG generates its answers.
The FastAPI backend is built for production readiness, featuring:
Instead of relying on heavy modern frameworks (React/Vue), the frontend was deliberately built using vanilla HTML/CSS/JavaScript. It relies on a single external dependency (`marked.js`) to parse Markdown in real-time. This decision was made because I wanted to create a Minimum Viable Product and prioritizing backend complexity and data delivery over frontend overhead. Also, I like the raw look, which reminds me of the interface of S.T.A.L.K.E.R. PDAs.