A Clean Architecture-based RAG assistant for answering questions about the Hytale server codebase. It retrieves relevant Java code snippets from a vector database, injects them as context, and generates expert responses via LLM.
Supports two interfaces:
- Discord bot (
!hycommand to ask questions,!clearcommand to reset conversation) - Interactive CLI
Multi-turn conversations with automatic history trimming are supported in both.
If you are interested, consider joining this discord server or adding the dicord bot to your own server.
- Instant answers from the official, actual game codebase
- Helps debug common modding issues (cites paths/line numbers with precision)
- Clean Architecture structure for maintainability and extensibility
- Python 3.10+
- Local Qdrant instance (http://localhost:6333)
- OpenAI client-compatible API key
- (Optional) Discord bot token
- uv (for dependency management)
- VineFlower (for decompiling the Hytale JAR)
- Repomix (for merging the decompiled codebase into a single file)
The assistant requires a processed version of the Hytale server codebase. Start with the official Hytale server JAR:
- Purchase and download Hytale (available from the official website or launcher).
- Locate the server JAR file (typically in the Hytale installation directory, e.g.,
hytale_server.jar). - Decompile the JAR into a standalone folder using VineFlower:
- Download VineFlower (a Java decompiler) from its official repository or site.
- Run:
java -jar vineflower.jar hytale_server.jar output_folder
- Use Repomix to merge the decompiled codebase into a single XML file:
- Install Repomix
- Run:
repomix pack output_folder repomix-output.xml(this creates a merged representation suitable for chunking).
- Process the Repomix output with the provided scripts:
- Run
chunking.pyonrepomix-output.xmlto generatecode_chunks/chunks.jsonl. - Run
embedding.pyon the chunks to compute embeddings and upsert to Qdrant. - (Optional) Use
qdrant_export.py/qdrant_import.pyfor backups/restores.
- Run
This prepares the vector database for retrieval.
- Clone the repository
- Install uv (if not already:
curl -LsSf https://astral.sh/uv/install.sh | sh) - Sync dependencies:
uv sync - Set environment variables in a
.envfile or your shell:
XAI_API_KEY=any_onpenai_compatible_api_key #you can edit for a different provider in the configuration file.
DISCORD_TOKEN=your_discord_bot_token # Only needed for Discord mode
OPENAI_API_KEY=any_onpenai_compatible_api_key #this is for the fallback model, you can also use a different provider- Ensure Qdrant is running and the codebase collection is indexed (use the scripts in
scripts/if needed, or check section above)
Use the unified entry point:
# Discord bot
uv run main.py discord
# Interactive CLI
uv run main.py cliPrepare a dataset of questions and ansers, one question/answer per line in two different files. Then, run
uv run eval_ragas.pyFor faithfulness and correctness.
Feel free to open issues or PRs. The project emphasizes clean separation of concerns—keep delivery mechanisms thin and push rules inward. Enjoy exploring the Hytale codebase!