1.3 KiB
Posthog Matrix Terminal
A cookie-authenticated chat UI in front of a local llama.cpp server, styled like a Matrix terminal. Backend is FastAPI; frontend is plain HTML/CSS and ES6 module JS — no build step.
System Requirements
- python
- uv
- make
Setup
Install the python requirements
uv sync
Copy the .env.example and system_prompt.example.md
Then run the container:
make docker-run
Open your favourite browser to http://localhost:8000
The 0.8B model is the default — it runs on CPU with no GPU needed.
Lint
uv run ruff check .
uv run ruff format .
Docker
To build just the app image standalone (e.g. to run against a remote llama.cpp server):
docker build -t matrix-terminal .
docker run -p 8000:8000 --env-file .env -v ./persona:/app/persona:ro matrix-terminal
The image is a multi-stage build (uv sync --frozen --no-dev in a builder stage, app code copied onto a fresh
python:3.13-slim) and runs as a non-root user — no compiler toolchain or dev dependencies (ruff, etc.) ship in the
final image, which is distroless.
Persona
The system_prompt.md is sent as the system message on every request and is never committed or baked into the Docker
image. The template's hard rules cover the basics.