Getting started
Requirements
- Python 3.11 or newer.
- No third-party runtime packages. The reference core uses the standard library.
Run the demo
git clone https://github.com/HugoXK/lares.git
cd lares
python3 -m lares demo
demo runs the end-to-end reference flow: compile a card, retrieve memories, compose a grounded draft, critique it, select proactive candidates, and advance the Lar's state. Everything is deterministic and offline.
python3 -m lares ask "Do you remember Miso?"
python3 -m lares bench
make test
Start the service
python3 -m pip install -e .
lares serve --port 8787
# http://127.0.0.1:8787/
Without installing:
LARES_DATABASE_URL=memory python3 -m lares serve --port 8787
curl -s http://127.0.0.1:8787/health
The default bind is loopback. A non-loopback host requires auth or an explicit --allow-unauthenticated-public.
Open the lararium
The console is served by the service itself:
python3 -m lares serve --port 8787
# http://127.0.0.1:8787/
Characters sit in wall niches around one room. Opening a niche turns it into the room for that character: the conversation, the memories with their branch and provenance, the relationship state, and a relic ribbon where a memory can be pinned, corrected or rolled back.
When LARES_TOKEN is set, a same-origin deployment can inject the bearer token at its proxy and the browser never sees it. Otherwise the page asks once and keeps the token in the tab.
Docker and Postgres
docker compose up --build
# http://localhost:8787/health
The image runs as a non-root user, stores data in /data, and healthchecks /health.
python3 -m pip install -e ".[postgres]"
export LARES_DATABASE_URL=postgresql://lares:lares@127.0.0.1:5432/lares
python3 -m lares db migrate
python3 -m lares serve --port 8787
Connect a model
The deterministic gateway is the default. Point Lares at any OpenAI-compatible chat-completions endpoint to generate real prose:
LARES_MODEL_BASE_URL=https://api.deepseek.com/v1 \
LARES_MODEL_API_KEY=... \
LARES_MODEL_NAME=deepseek-chat \
python3 -m lares serve --port 8787
Retries, a secondary provider, and embeddings are configured separately. Embeddings default to a deterministic local projection; setting LARES_EMBEDDING_* sends memory text to that provider, so treat it as a subprocessor.
Command map
| Command | What it does |
|---|---|
lares demo |
End-to-end reference flow, no model required. |
lares ask "<query>" |
Show the relics and the draft a query would receive. |
lares bench |
Run CompanionBench v0 + v1; non-zero on regression. |
lares serve |
Run the HTTP API. |
lares schedule --once |
One proactive scheduling pass. |
lares worker --interval 5 |
Process durable jobs. |
lares maintain |
Decay, consolidate, backfill embeddings, prune. |
lares db check / db migrate |
Schema version and migrations. |
lares usage report --tenant ... |
Aggregate ledger spend. |
Next
- Memory: why a rollback never leaks a future.
- Persona and proactivity: what keeps the voice stable.