A commercial-grade RLM harness/runtime that helps “avoid the rot” and “trust the answer” by:
- Treating long prompts and large corpora as an external environment (not model tokens).
- Providing a persistent REPL environment the model can use to inspect/search/read.
- Supporting recursive sub-LLM calls over snippets with async + batching.
- Indexing a 1,000+ document library using SQLite FTS5 with incremental reindexing.
Default backend config matches Mistral CLI, but the engine is CLI-agnostic and stdin-first.
export LLM_CMD="mistral"
export LLM_ARGS_TEMPLATE='chat --model {model} --stdin --output {format}'
export LLM_MODEL="devstral"
export LLM_OUTPUT="text" # or "json"bun run quidoris-engine.ts --task "Find the retention policy and summarize it." --library-dir ./docsbun run quidoris-engine.ts --task "Answer using the context." --context-file ./big.txtInstead of pasting an ever-growing history + all documents into the model input, the engine:
- Maintains documents externally (disk + SQLite index).
- Lets the model search and read slices as needed.
- Encourages batched/async subcalls over selected evidence.
- Requires an explicit
FINAL(...)orFINAL_VAR(...)to finish.
## ASCIIFlow-style diagram (Unicode box drawing)
```text
┌──────────────┐ ┌───────────────────────────┐
│ User Task │ ──────── task ───────▶ │ Quidoris Engine │ ───────▶ ┌──────────────────────────┐
└──────────────┘ │ (orchestrator/runtime) │ │ Final Answer + │
└───────────┬───────┬───────┘ │ Completion Phrase │
│ │ └──────────────────────────┘
scan + incremental │ │ stdin prompt
index (FTS5) │ │ async/batched subcalls
▼ ▼
┌────────────────┐ ┌──────────────────────────┐
│ rlm_index.sqlite │ │ LLM Backend │
│ FTS5 + metadata │ │ (CLI-agnostic) │
└───────┬────────┘ └──────────┬───────────────┘
▲ │
search/read │ │ outputs REPL code blocks
│ │ + FINAL(...)
│ ▼
┌───────┴─────────────────────────────────────────┐
│ Environment (REPL) │
│ context + doc library │
└───────────────────────┬─────────────────────────┘
│
evidence snippets (to Engine)
bun run quidoris-engine.ts --task "..." [--library-dir ./docs] [--context-file ./big.txt | --context-stdin] [--reindex]LLM_CMD(defaultmistral)LLM_ARGS_TEMPLATE(defaultchat --model {model} --stdin --output {format})LLM_MODEL(defaultdevstral)LLM_SUBMODEL(default =LLM_MODEL)LLM_OUTPUT(textorjson, defaulttext)
MAX_STEPS(default30)MAX_RECURSION_DEPTH(default1)MAX_SUBCALL_CONCURRENCY(default6)CLI_TIMEOUT_MS(default180000)REPL_TIMEOUT_MS(default2000)REPL_OUTPUT_TRUNC_CHARS(default8000)COMPLETION_PHRASE(defaultRLM TASK COMPLETE)
INDEX_PATH(default./rlm_index.sqlite)LIBRARY_EXTS(default.txt,.md,.json,.yaml,.yml,.csv,.log)LIBRARY_MAX_FILES(default5000)LIBRARY_MAX_FILE_BYTES(default5000000)CHUNK_BYTES(default16384)
- Use any Hugging Face model/endpoint by wrapping it in a CLI that reads from stdin and prints to stdout,
then set
LLM_CMD+LLM_ARGS_TEMPLATEaccordingly. - UI can be added as a separate package (see next step).
The REPL uses Node vm. It is not a hardened sandbox. Run with trusted models and inputs.
A lightweight local web UI lives in ./ui.
cd ui
bun install
bun run devThe UI proxies /v1/* to http://127.0.0.1:8787 (see ui/vite.config.ts).
Note: The UI expects the daemon API to be running. If you haven’t implemented the daemon yet, the Login page will show a helpful message.
The browser can’t spawn local processes, so the UI is served by a tiny local launcher that can start the daemon.
- Build the UI
cd ui
bun install
bun run build- Start the launcher (serves UI + proxies
/v1/*to the daemon)
cd ..
bun run ui:launchNow open http://127.0.0.1:5173.
- Clicking Enter the Engine calls
POST /__launcher/daemon/startwhich spawnsbun run quidoris-engine.ts daemonif needed. - The UI then logs in and routes to
/app.