Getting started

Install, start a server, make a table, and run your first agent, in about ten minutes.

Ten minutes from nothing to an agent's change waiting for your review.

Prefer to let a coding agent do this? Paste the prompt from Set up with an AI agent into Claude Code or Codex and answer its questions.

1. Install

Forkbase is one binary, forkbase. Agents' worlds need the Chronos engine, chronos, beside it.

From a release (macOS and Linux, x86-64 and ARM):

shell
curl -fsSL https://github.com/2090-labs/forkbase/releases/latest/download/install.sh | FORKBASE_ENGINE=1 sh

FORKBASE_ENGINE=1 also installs the engine. Without it you get Forkbase alone: everything works except agents.

With Docker: see Self-hosting.

From source (Rust 1.90+, Node 20+ for the dashboard):

shell
git clone https://github.com/2090-labs/forkbase && cd forkbase
(cd dashboard && npm ci && npm run build)      # the dashboard is built into the binary
cargo build --profile dist -p forkbase          # target/dist/forkbase

Get the engine from the Chronos releases and put chronos on your PATH (or set FORKBASE_CHRONOS_BIN).

2. Pick a database mode

postgreschronos
Your data lives ina Postgres 16+ you run (local, RDS, Neon, Supabase...)the bundled Chronos engine
Use it whenyou have a Postgres, or want to keep your usual toolsyou're starting fresh and want the fewest moving parts
Agents' worldsthe engine attaches to your Postgresnative

Not sure? Start in chronos mode on your laptop. See Concepts for the details.

3. Start it

shell
mkdir myapp && cd myapp

# over your Postgres
forkbase init --db postgres --database-url postgres://user:pass@127.0.0.1:5432/app
# or on the engine
forkbase init --db chronos

forkbase start

init writes forkbase.toml and makes a data folder, .forkbase/, with the server's secrets. start runs the migrations, starts the engine (chronos mode, or postgres mode once an agent runs) and serves on http://127.0.0.1:8000.

In another terminal:

shell
forkbase status    # {"status": "ok", ...}
forkbase keys      # {"anon": "...", "service_role": "..."}
  • anon is safe in a browser or a phone app. It can do only what row-level security lets anonymous and signed-in people do.
  • service_role bypasses row-level security. Keep it on your servers. Never ship it to a browser.

Open http://127.0.0.1:8000/dashboard/ and sign in with the service_role key.

4. Make a table

In the dashboard's SQL editor, or with psql:

SQL
create table tickets (
  id bigint generated always as identity primary key,
  title text not null,
  status text not null default 'open',
  updated_at timestamptz not null default now()
);
insert into tickets (title, status) values ('Login broken', 'open'), ('Old bug', 'closed'), ('Typo', 'closed');

grant select on tickets to anon, authenticated;
alter table tickets enable row level security;
create policy read_all on tickets for select using (true);

Where to connect psql: your Postgres URL in postgres mode. In chronos mode postgres://app:<engine_token>@127.0.0.1:54329/main?sslmode=require, where <engine_token> is engine_token in the data folder's secrets.json (jq -r .engine_token data/secrets.json; keep it secret).

Read it over REST:

shell
export URL=http://127.0.0.1:8000 ANON=<anon key> SERVICE=<service_role key>
curl "$URL/rest/v1/tickets?select=id,title&status=eq.open" -H "apikey: $ANON"

supabase-js works too: createClient(URL, ANON).from('tickets').select().

5. Run an agent

An agent is a name, a merge policy and a token. Make one with the service key:

shell
curl -X POST $URL/agents/v1/agents -H "apikey: $SERVICE" -H "authorization: Bearer $SERVICE" \
  -H "content-type: application/json" -d '{"name": "cleanup", "policy": "careful"}'
# {"id": "...", "name": "cleanup", "policy": "careful", "token": "fba_..."}

Give it a policy: make policies/careful.toml beside forkbase.toml, then restart Forkbase.

TOML
max_rows = 50       # more rows than this: a person reviews it
max_deletes = 0     # any delete: a person reviews it

Now the agent starts a run, works in its world, and proposes:

shell
AGENT=fba_...
curl -X POST $URL/agents/v1/runs -H "authorization: Bearer $AGENT" \
  -H "content-type: application/json" -d '{"intent": "delete closed tickets"}'
# {"id": "run_...", "token": "fbr_...", "database_url": "postgres://...", ...}

RUN=run_... RUNTOKEN=fbr_...
curl -X POST $URL/agents/v1/runs/$RUN/sql -H "authorization: Bearer $RUNTOKEN" \
  -H "content-type: application/json" -d '{"sql": "delete from tickets where status = $1", "params": ["closed"]}'
curl $URL/agents/v1/runs/$RUN/changes -H "authorization: Bearer $RUNTOKEN"     # 2 rows deleted, in the world only
curl -X POST $URL/agents/v1/runs/$RUN/propose -H "authorization: Bearer $RUNTOKEN"
# 202 {"status": "held", "reasons": [...]}   the policy allows 0 deletes

Your tickets table still has all three rows. Open Dashboard, Agents, Approvals: the run is there with the two rows it would delete. Approve it and they go; reject it and nothing happened. If you approve and change your mind, Undo puts the rows back.

The same in TypeScript:

TypeScript
import { createClient } from "@chronosdb/forkbase";
const fb = createClient("http://127.0.0.1:8000", process.env.FORKBASE_AGENT_TOKEN!);
const { outcome } = await fb.agents.withRun("delete closed tickets", (run) =>
  run.sql("delete from tickets where status = $1", ["closed"]),
);
console.log(outcome.status); // "held"

Next

  • Concepts: the model behind runs, policies and undo.
  • Agents: every policy rule, approvals by Slack and email, webhooks.
  • MCP: connect Claude or Cursor to the same database, as one agent.
  • Self-hosting: put it on a server.

Something wrong or missing? Edit this page on GitHub or open an issue.

Getting started · Forkbase