Loreguard
┌────────────────────────────────────────────────────────────────────────────────┐
│ │
│ ██╗ ██████╗ ██████╗ ███████╗ ██████╗ ██╗ ██╗ █████╗ ██████╗ ██████╗ │
│ ██║ ██╔═══██╗██╔══██╗██╔════╝ ██╔════╝ ██║ ██║██╔══██╗██╔══██╗██╔══██╗ │
│ ██║ ██║ ██║██████╔╝█████╗ ██║ ███╗██║ ██║███████║██████╔╝██║ ██║ │
│ ██║ ██║ ██║██╔══██╗██╔══╝ ██║ ██║██║ ██║██╔══██║██╔══██╗██║ ██║ │
│ ███████╗╚██████╔╝██║ ██║███████╗ ╚██████╔╝╚██████╔╝██║ ██║██║ ██║██████╔╝ │
│ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═════╝ │
│ │
│ Local inference for your game NPCs │
│ loreguard.com │
│ │
└────────────────────────────────────────────────────────────────────────────────┘
AI-Powered NPCs using your own hardware (your servers or your player's hardware) Loreguard CLI connects the LLM Inference to the Loreguard NPC system.
How It Works
┌─────────────────┐ wss://api.loreguard.com ┌─────────────────┐
│ Your Game │◄────────────────────────────► │ Loreguard API │
│ (NPC Dialog) │ │ (Backend) │
└─────────────────┘ └────────┬────────┘
│
│ Routes inference
│ to your worker
▼
┌─────────────────┐
│ Loreguard CLI │◄── You run this
│ (This repo) │
└────────┬────────┘
│
│ Local inference
▼
┌─────────────────┐
│ llama.cpp │
│ (Your GPU/CPU) │
└─────────────────┘
Installation
Linux / macOS
pip install loreguard-cli
Windows
Download loreguard.exe from Releases.
Or install via pip if you have Python:
pip install loreguard-cli
From Source
git clone https://github.com/beyond-logic-labs/loreguard-cli
cd loreguard-cli
pip install -e .
Quick Start
Interactive Mode (no arguments)
loreguard
The wizard guides you through:
- Authentication - Enter your worker token
- Model Selection - Choose or download a model
- Running - Starts llama-server and connects to backend
Headless Mode (with arguments)
loreguard --token lg_worker_xxx --model /path/to/model.gguf
Or auto-download a supported model:
loreguard --token lg_worker_xxx --model-id qwen3-4b-instruct
Environment variables:
export LOREGUARD_TOKEN=lg_worker_xxx
export LOREGUARD_MODEL=/path/to/model.gguf
loreguard
Chat Mode (test NPC pipeline)
Test your NPC chat without running a local model:
loreguard --chat --token lg_worker_xxx
This connects directly to the Loreguard API to:
- List your registered NPCs
- Select one to chat with
- See verification status and latency
Supported Models
Works with any .gguf model. Tested with the following model families:
- Qwen - Recommended for best quality/speed balance
- Llama - Meta's open models
- GPT - GPT-style open models
- RNJ - Specialized models
- Violet Lotus - Community fine-tunes
Use any model with --model /path/to/model.gguf.
Concurrency (multi-slot)
A capable GPU can serve several NPC conversations at once. Two env vars control this:
LOREGUARD_PARALLEL_SLOTS(default1) — number of concurrent conversation slots (llama-server -np). Each slot holds one conversation's KV cache. Recommended on a 16 GB GPU:8(≈10is the ceiling at ~4k-token sessions, ~8at ~8k). Start at4and raise as you confirm VRAM (nvidia-smi) and throughput headroom. Don't over-provision — MoE models (e.g. Gemma) lose throughput when-npgreatly exceeds real active concurrency.LOREGUARD_KV_CACHE_TYPE(defaultq8_0) — KV cache quantization. Keepq8_0; lower bit widths produce gibberish on Gemma.
export LOREGUARD_PARALLEL_SLOTS=8
export LOREGUARD_KV_CACHE_TYPE=q8_0
loreguard --token lg_worker_xxx --model-id gemma-3-27b
A slot serves one conversation per turn. Size LOREGUARD_PARALLEL_SLOTS at or above your expected peak
concurrency: when all slots are busy, the engine waits briefly and then fails the extra turn (a clean
error the game can retry) rather than corrupting a live conversation. Background memory passes borrow a
free slot transiently and are skipped under saturation. Full benchmarks and sizing rationale: ADR-0035.
Use Cases
For Game Developers (Testing & Development)
Use Loreguard CLI during development to test NPC dialogs with your own hardware:
# Start the worker
loreguard-cli --token $YOUR_DEV_TOKEN --model-id qwen3-4b-instruct
# Your game connects to Loreguard API
# NPC inference requests are routed to your local worker
For Players (Coming Soon)
Note: Player distribution support is in development. Currently, players would need their own Loreguard account and token.
We're working on a Game Keys system that will allow:
- Developers to register their game and get a Game API Key
- Players to run the CLI without needing a Loreguard account
- Automatic worker provisioning scoped to each game
Interested in early access? Contact us at loreguard.com
Requirements
- RAM: 8GB minimum (16GB+ for larger models)
- GPU: Optional but recommended (NVIDIA CUDA or Apple Silicon)
- Disk: 2-6GB depending on model
- Python: 3.10+ (if installing from source)
Get Your Token
- Go to loreguard.com/developers
- Create a worker token
- Use it with
--tokenorLOREGUARD_TOKEN
Development
git clone https://github.com/beyond-logic-labs/loreguard-cli
cd loreguard-cli
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
# Run interactive wizard
python -m src.wizard
# Run headless CLI
python -m src.cli --help
# Run tests
pytest
License
MIT
See THIRD_PARTY_NOTICES.md for attribution and licenses of the machine learning models downloaded during setup.
Metadata
Release files for loreguard-cli 0.21.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| loreguard_cli-0.21.0.tar.gz | 351.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| loreguard_cli-0.21.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 529.2 kB
Release files / loreguard_cli-0.21.0.tar.gz
| Download URL | loreguard_cli-0.21.0.tar.gz |
|---|---|
| Size | 351.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4422d1da2e0bc92f546b9aa8c8caa5a5f2f8a97063f121b79c7c90b692832072
|
|
BLAKE2b-256 checksum How to use checksums |
54e48b244c21d0b3058110b91f24a06b9fd9fa0ca9502e30149a88486e16c5c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 18, 2026.
Transparency logRelease files / loreguard_cli-0.21.0-py3-none-any.whl
| Download URL | loreguard_cli-0.21.0-py3-none-any.whl |
|---|---|
| Size | 177.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6a16713e0e56f25e69060e7cf4ea0ca95b80645b9fa79cea6e7384defda49569
|
|
BLAKE2b-256 checksum How to use checksums |
65e5fc4ee6f1c8a92189f921c01c336d1cd39407b2832d62f8abc6b323137172
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 18, 2026.
Transparency log