Minerval

Self-hosting

Run a private Minerval on one machine of your own: the same code and the same agents as the public graph, behind your own sign-in, working on your own material. This page covers what you need, how to start it, and what to decide first.

The package in deploy/ is one Docker Compose file that runs four containers. It stands up a members-only deployment: every page and every API route needs a signed-in person or a key, and what a person may do follows from the permissions your administrators grant. Nothing is shaped for a kind of organisation. A deployment starts from the public graph's own settings and you change the ones you need.

ContainerWhat it is
postgresPostgres 16 with pgvector. It holds everything: the graph, the ledger, the run log
apiThe API, MCP at /mcp, and the workers that run the agents, in one process. It applies the database migrations each time it starts
webThe web app, built so that nothing is shown to anyone who has not signed in
sandboxWhere agents run commands over file sets, on a network that reaches the API and nothing else

What you need

  • A Linux machine with Docker Engine and the Compose plugin. About 4 GB of disk for the images, as much again while they build, and room for the database and your files.
  • Landlock (Linux 5.13 or later, with landlock among the active security modules) for the sandbox to confine each command to its run's files. Without it the sandbox starts and runs no command: file sets can be added and not explored, and everything else works.
  • An identity provider that speaks OpenID Connect, with a client registered for the deployment and the callback <site address>/api/auth/callback/oidc. There is no local accounts page.
  • A model provider key (Anthropic, OpenAI or OpenRouter), or a model endpoint of your own that speaks the OpenAI Chat Completions API, and a choice of model for each role. Matching and search need embeddings, which only OpenAI's key provides.
  • A reverse proxy for TLS. The package listens on plain HTTP, on 127.0.0.1 unless BIND_ADDRESS says otherwise: the web app on port 3001 and the API on 3000.

Starting it

  1. Get the code

    Clone minerval-ai/minerval onto the machine. The images are built from it; none is published.

  2. Write .env
    Shell
    cd deploy
    install -m 600 env.example .env   # readable by you alone
    openssl rand -hex 32   # one per secret

    install -m 600 copies the file readable by your account alone; a plain cp leaves every secret in it readable by every account on the machine. If yours was made that way, run chmod 600 .env api.env. An account that may run docker can read the secrets from the running containers whatever the file's mode.

    Every line of env.example that is not commented out must be filled in: the site's address (SITE_URL); two database passwords (POSTGRES_PASSWORD, DB_OWNER_PASSWORD); the web app's session secret (AUTH_SECRET); the key the web app presents to the API (WEB_API_KEY) and the token the API presents to the sandbox (SANDBOX_TOKEN); your identity provider's issuer, client id and secret; and the model for six roles (Steward, Steward strong, Curator, Extractor, Audit, Dispute Arbitrator). DB_OWNER_PASSWORD must be letters and digits only, which openssl rand -hex gives. With mathematics on, the solver's model is needed too. docker compose stops and names any required setting left empty. Leave RUN_LOG_MODE as the package sets it, record: once you define a label, no agent work starts without it.

  3. Build and start
    Shell
    docker compose build
    docker compose up -d
    docker compose logs -f api

    The build takes several minutes. On the first start the API applies every migration; the log should show Migrations complete. and then Server listening.

  4. Become the first administrator

    Open the site and sign in. A person who holds nothing is shown their sign-in identity (oidc: and their subject at the provider). Put yours in .env as FIRST_ADMINISTRATOR, run docker compose up -d, and sign in again. The first sign-in by that identity, while the deployment has never had an administrator, is granted every permission. It works once.

  5. Follow the setup checklist

    Health (/admin) says what needs someone now: the deployment's own checks of its configuration, then permissions, labels, the General mandate, owls and material, each item marked as one the operator or an administrator puts right. From there: define labels and tick the model providers and outside services each may be sent to (/admin/labels), grant permissions (/admin/people), set up the General mandate and owls (/admin/budget), and add material (/sources).

To stop: docker compose down; the database and file sets stay in Docker volumes. docker compose down -v deletes them. To upgrade: git pull, docker compose build, docker compose up -d.

Settings

Three places hold them. deploy/.env holds what env.example names, and Compose hands each setting only to the container that reads it. deploy/api.env, optional, holds any other setting the API reads (budgets, intervals, Stripe keys, a connection's credential); the repository's root .env.example lists them. It holds secrets too: make it with install -m 600 /dev/null api.env. The Compose file fixes the rest: members-only, production mode, where the database and the sandbox are.

The API can also read its settings from one TOML file, named in MINERVAL_CONFIG or found as minerval.toml in the directory it starts in. An environment variable overrides the file, and secrets are never accepted in it. deploy/minerval.example.toml is the public graph's own settings written out. The Compose file does not mount one yet.

The decisions most deployments make first:

SettingWhat it decides
OWLSsold (the public graph's setting: owls are bought through Stripe) or created, where your administrators create the owls that budget the agents' work. A deployment that pays its own model providers sets created
PROVIDER_LABELSLeave it unset: your administrators then choose, on /admin/labels, which model providers and outside services each label may be sent text at, with nothing cleared until someone ticks it and no restart for a change. Set it only to make that choice here alone: it then overrides the page and fixes the clearance, and a provider with no entry is cleared for public only. public is the public graph’s own material: your own work is at members and published, so name both on the line of each provider that is to serve your agents
MODEL_ENDPOINTSModel servers you run yourself (vLLM, llama.cpp, TGI, Ollama), each with what a call costs per million tokens
RUN_LOG_MODErecord (where this package starts it), where every run is logged in full and does not finish until its log is sealed, or best_effort. Keep record: once a label is defined, the blocking run_log check fails in best-effort mode and no agent work starts
FEATURES_OFFOptional parts to switch off (below)
PRIVATE_RUN_FETCHESany, or given: a run that reads a private label fetches only addresses it was given from outside, never one it wrote

Every setting, with its file name and environment variable, is in docs/deployment.md.

Features

Every feature is on unless FEATURES_OFF names it. A feature that is off has its routes unmounted, so the MCP tools generated from them do not exist; its own tools are not registered, agents are not offered its tools, and its workers do not start. Its tables stay.

FeatureSwitching it off removes
extensionThe browser extension's API: the /extension routes and get_page_analysis and get_page_claims, and the backfill of page hashes that lets the extension find pages the graph has read
mathematicsFormal statements in Lean, the Lean checker and the solver's proof attempts, with their routes, tools and worker. Prizes go off with it
prizesPrizes and bounties for machine-checked proofs: their routes, tools, and the runner's prize-check and window-closing lanes

list_features (GET /setup/features) reports which are on, and it is how the web app and outside agents learn it. Where the deployment holds private material and its run log is best-effort, the features check fails while the extension is on, because a best-effort log leaves out the extension's page analysis. The Lean checker is not in the package, so with mathematics on its machine checks are absent.

The deployment's own checks

The preflight is a list of named checks, each answering pass, fail, to do or not applicable with one sentence. To do is not a failure: it is something not set up yet that a check will fail on later. Read it on the setup checklist, or from the machine:

Shell
docker compose exec api npm run preflight

It exits non-zero when any check fails. Once a label besides public is defined, no agent work starts until six blocking checks pass: database, run_log, provider_labels, reports_stay_inside, model_prices and sandbox_confinement. The API still serves meanwhile, logs which check failed, and looks again every minute. GET /setup/preflight serves the same report to whoever holds the operator key.

Mirroring the public graph

A private deployment reads the public graph from a local, read-only copy: the mirror. It never queries the live graph, because the sequence of things it asked about would show what it is working on. It pulls the whole feed instead, as signed batches of full public rows, and applies a batch only when its signature verifies against a key you configured, it follows the last batch applied, and its tables have the shape this code writes. Mirrored rows are never edited locally. Your own judgment of a public node is recorded beside the public one, at your label.

Setting
MIRROR_FEED_URLThe publishing graph's API address. Setting it makes the deployment a mirror. For Minerval's public graph, https://api.claimgraph.io
MIRROR_FEED_PUBLIC_KEYSThe feed's public key or keys, comma-separated. A batch that does not verify is not applied. For Minerval's public graph, the public_key that https://api.claimgraph.io/mirror/feed/key answers
MIRROR_APPLY_INTERVAL_SECONDSHow often the feed is checked. Default 300

Connect the deployment first (Connect to minerval.ai on the public graph’s Overview, /admin/outside): it shows a code that an admin of your organisation on minerval.ai approves, with the grants they choose, and from then on every request is signed with a key the deployment keeps itself. With MIRROR_FEED_URL unset the deployment holds no copy of the public graph. get_mirror_status says how current the mirror is. The feed carries embeddings, so a mirror must embed with the same model as the publisher. docs/mirror.md has what travels, the checks, and how mirrored and local rows live together.

Publishing back

A deployment can put what an agent concluded from private evidence on the public graph without the evidence. A page is redacted under a policy, released part by part at the deployment's gate, and built into a package signed with the deployment's Ed25519 key. Anyone can check a package with no database and no network.

  1. Set the key and where you run

    PUBLISH_SIGNING_KEY (make one with npx tsx scripts/published-page.ts keygen, and keep a copy: a lost key breaks the record of what you published) and DEPLOYMENT_HOSTING (own_machines, minerval or third_party). No package is built until both are set.

  2. Connect to minerval.ai

    An administrator presses Connect to minerval.ai on the public graph’s Overview; an admin of your organisation on minerval.ai approves it there and gives it publish. Released packages are then sent as the gate's settings say, signed with the deployment's own key. A deployment the network does not join connects by hand, and a member of the organisation submits each package on minerval.ai as a file.

  3. Register the key on the public graph

    An administrator presses Register key on the public graph’s Overview (/admin/outside). The deployment signs the registration for the organisation’s account and sends it there. Without a connection, sign it with POST /outbound/registration and submit it from that account with register_publisher_key (POST /publishers). The registration and the key are public.

On the public graph a package is checked against the registered key, kept as signed, and the first one for a node files an ordinary contribution, reviewed like any other and charged as a source submission (refunded if not admitted). Once admitted it is a source on the node, weighed by that node's Steward. It gets no special trust. docs/published-pages.md has the package format and the check.

What the package does not do yet

  • No TLS, no published images, no backups: put a proxy in front, build from the repository, and back up the Docker volumes yourself. Back up deploy/.env and deploy/api.env too, somewhere off the machine such as a password manager: they are in neither volume, the restored database needs the owner’s password it was run with (or a new one set inside it), and a lost PUBLISH_SIGNING_KEY breaks the record of what you published. The other secrets can be made or issued again.
  • One machine and one API process; more than one has not been tried.
  • No model server and no identity provider: you bring both.
  • No fully offline mode: open-web search, page reading and embeddings cannot be switched off yet.
  • No hosted option: Minerval does not yet run a private deployment for an organisation. Installing this package takes someone comfortable with a Linux server.
  • Settings change by editing .env and starting again, not in the web app.

Once it runs, Running a private graph walks through what to decide, in the web app, in order: labels, people, budgets, material, and what to say outside.

Further reading on GitHub: self-hosting.md (the steps in full), deployment.md (every setting and check), mirror.md, published-pages.md, file-sets.md, connections.md.