World model

Loka

A neuro-symbolic world model. Two systems sharing one query language: an RDF-star triplestore (explicit memory, exact answers) plus a transformer trained on the same triples (implicit memory, plausible answers). Generated facts write back into the store as RDF-star annotations with propositionInferredFrom citation edges.

Engine in Rust Apache 2.0 RDF-star · SPARQL+ · SPARQL-star v0.4.0 — World-model release
Install Loka World-model deep dive GitHub repo

AI Agent?

Loka is serverless by default — open a .sdb file, no daemon, no config. Install, configure, and query entirely from the command line. The agent installer (loka install-agent) walks an LLM through configuration via structured Markdown prompts. Start here: the GitHub repo's README documents the engine and the model series; CLAUDE.md is the canonical context file for agent assistants.

Agent Setup Guide

What's inside the engine

🔗 Vectors Are Triples

Vector embeddings are stored as RDF triples and indexed by HNSW. Not a sidecar — a first-class part of the graph. One query language for both.

🔍 Hybrid SPARQL

VECTOR_SIMILAR and VECTOR_SCORE extend standard SPARQL. Traverse the graph, jump into vector space, come back — all in one query.

📦 Serverless by Default

Like SQLite for graph+vector data. Open a .sdb file, query it. No daemon, no config. Server mode is opt-in when you need HTTP access.

RDF-star Native

Triples about triples, natively. Annotate edges with confidence scores, embeddings, provenance — no reification hacks.

Lean & Fast

SPO/POS/OSP indexes on interned u64 IDs. HNSW with cosine/euclidean/dot product. No bloat, no ORMs, no magic.

🌐 Standards Compatible

A superset of RDF 1.2 and SPARQL 1.1. Any valid standard query works. Extensions add what the standards can't express.

✂️ Cascade-Retraction

Remove a node and every model-generated inference that transitively cited it disappears — bounded to provenance edges, real→real is never a dependency. Preview-by-default; commit explicitly. How it works →

A Superset, Not a Fork

Everything the W3C standards do, plus what they can't.

Data Model

RDF 1.2: triple terms in object position only

+ Loka: triple terms in any position (RDF-star)

+ Native vector literals (loka:f32vec)

+ HNSW index per vector predicate

Query Language

SPARQL 1.1: SELECT, FILTER, OPTIONAL, UNION...

+ VECTOR_SIMILAR() — ANN search in graph patterns

+ VECTOR_SCORE() — similarity ranking in ORDER BY

+ ef:= and k:= query hints for HNSW tuning

Graph + Vector in One Query

Find academic papers similar to a query vector that cite papers by a specific author:

PREFIX ex: <http://example.org/>

SELECT ?paper ?title WHERE {
  # Jump into vector space: find similar papers
  VECTOR_SIMILAR(?paper ex:hasEmbedding
    "0.23 -0.11 0.87 ..."^^loka:f32vec, 0.85)

  # Back to graph: filter by citation chain
  ?paper ex:cites ?cited .
  ?cited ex:author <http://example.org/Vaswani> .
  ?paper ex:title ?title .
} ORDER BY DESC(VECTOR_SCORE(?paper ex:hasEmbedding
    "0.23 -0.11 0.87 ..."^^loka:f32vec))
LIMIT 10

Install Loka

The Windows installer asks whether you want the database alone, or the database plus the inference model it ships with. Pick the model and Loka is wired for generative queries on first run; skip it and you have a pure triplestore.

Windows installer

x86_64 · .exe · arrives with v0.4.1

Download installer

Windows (zip)

x86_64 · loka.exe, no installer

Download .zip

macOS

Apple Silicon (ARM64)

Download .tar.gz

macOS

Intel (x64)

Download .tar.gz

Linux

x86_64

Download .tar.gz

From Source

Any platform with Rust

cargo install --git https://github.com/EmmaLeonhart/Loka loka-cli

File format: .sdb — a superset of RDF containing triples + HNSW vector indexes.
Query directly (no server needed): loka query "SELECT * WHERE { ?s ?p ?o } LIMIT 10"  |  Optional server: loka serve --port 3030

loka.emmaleonhart.com · built on the shared kit — branding