Install
This page is the install reference: what kōjō needs, the three ways to install it, and the first-run steps in order. It is for whoever operates the install.
- The quick start is the short version: one machine, GitHub, a first session, without the explanations.
- Deploy goes deeper into each path: TLS, backups, high availability, upgrades.
- To build kōjō from source or run it without a forge account or a model key, see Development.
Prerequisites
Postgres
Postgres is the only service kōjō depends on. The queue, the sessions, team memory, the audit log, the schedules and the runtime configuration live in it.
- The compose install and the Helm chart both run
pgvector/pgvector:0.8.7-pg17: Postgres 17 with the pgvector extension. The repository tests against that image. The code states no minimum Postgres version. - The
vectorextension (pgvector) is optional. The migrations runCREATE EXTENSION IF NOT EXISTS vector; when that fails, team memory uses Postgres full-text search only, andkojo migrateandkojo doctorsay so. For embeddings, the database user must be allowed to create the extension, or it must exist already. - Configure the connection as
database.urlinkojo.yaml.
A sandbox driver
Every session runs repository code and model-written code in a sandbox. sandbox.driver in kojo.yaml selects how.
| Driver | Where | Needs |
|---|---|---|
sbx |
one host | Docker Sandboxes (sbx) on the same host as kōjō, hardware virtualization, sbx login and sbx policy init deny-all |
k8s |
Kubernetes | Kubernetes Agent Sandbox v1.0.12, a RuntimeClass that isolates (kata or gvisor), a CNI that enforces NetworkPolicy |
e2b |
an E2B-compatible service (E2B Cloud, a self-hosted E2B, CubeSandbox) | an API key, a template, and a kojo-proxy the service’s sandboxes can connect to. See e2b. |
docker |
development | a Docker daemon, and dev: true in kojo.yaml |
The docker driver starts plain containers and is for development only.
Sandboxes describes the drivers and the egress proxy.
A sandbox image
A skill’s kit can name its image. The built-in skills name none, so their sandboxes start from sandbox.image in kojo.yaml, and from ghcr.io/xavidop/kojo-toolchain:<version> when that is not set (latest for a development build). With the e2b driver an image is a template of the service, and the default is sandbox.e2b.template. The toolchain image is a Debian with git, make, a C compiler, Python, Node.js and Go, and a non-root user agent; its Dockerfile is deploy/toolchain/Dockerfile.
Each release publishes that image for linux/amd64 and linux/arm64 at its own version, so the default resolves without configuration. To use your own, set sandbox.image. kojo doctor creates a test sandbox from the same image, so it reports an image that cannot be pulled.
A model provider
kojo.yaml must define the model tiers fast and strong. With models.gateway: embedded, kōjō calls the provider itself and reads its key from the environment (ANTHROPIC_API_KEY, OPENAI_API_KEY, GEMINI_API_KEY, OPENROUTER_API_KEY, AZURE_OPENAI_API_KEY); Vertex AI, Bedrock, and Azure without a key take the cloud’s credentials instead; Ollama needs no key. models.gateway can instead be the URL of an OpenAI-compatible gateway. Set a budget (models.budgets): kojo doctor fails an install without a spend cap. kōjō ships no price table, so set a price per tier, or the budgets cannot bound that tier. See Models.
A public URL and a sign-in method
server.public_urlis how forges, Slack and browsers reach kōjō. Forges deliver webhooks to it, so they must be able to reach it. Slack in socket mode needs no inbound connection.- kōjō refuses to start without a sign-in method: OIDC (
server.auth.oidc) or at least one API token (server.auth.tokens, 16 characters or more). API tokens work for the CLI, the API and MCP. Signing in to the dashboard in a browser needs OIDC.
Ways to install
| Path | Sandboxes | Use it when |
|---|---|---|
| Docker Compose on one VM | sbx |
you have one host with hardware virtualization |
| Helm | k8s |
you run Kubernetes |
| The binary | any, e2b included |
you run the processes yourself, or only need the CLI |
One version tag covers the binary, the image ghcr.io/xavidop/kojo, the sandbox toolchain image and the Helm chart.
Docker Compose on one VM
On one VM, Postgres runs in a container and kōjō runs on the host. The sbx CLI talks to the sandbox daemon of the host it runs on, and nothing supports driving it from inside a container, so kojo serve runs on the host, next to sbx. The compose file holds what does belong in a container: the database.
flowchart LR
forge["Forge: GitHub, GitLab, Forgejo or Bitbucket"]
models["Model provider"]
subgraph host["One host"]
tls["TLS reverse proxy"]
kojo["kojo serve"]
pg[("Postgres, in Docker Compose")]
vm["Docker Sandboxes: one microVM per session"]
sproxy["Proxy of Docker Sandboxes"]
end
out["Allowlisted hosts"]
forge -- "webhooks" --> tls --> kojo
kojo -- "comments, commits, pull requests" --> forge
kojo -- "model calls" --> models
kojo --> pg
kojo -- "sbx CLI" --> vm
vm -- "all traffic" --> sproxy
sproxy --> out
kōjō holds the forge credentials and the provider keys. It calls the model provider, and it makes the commits, comments and pull requests through the forge’s API. A sandbox holds a clone of the repository and reaches the network only through the proxy of Docker Sandboxes, which lets through the hosts a skill’s kit allows and sets the clone credential on requests to the forge. kojo-proxy is not used on this path.
The install is the directory deploy/compose of the repository:
| File | What it is |
|---|---|
docker-compose.yml |
One service, postgres: Postgres with pgvector, published on 127.0.0.1:5432. |
kojo.yaml |
The deployment config kōjō reads. It names secrets as ${VARIABLES} and holds none. |
.env.example |
Copy it to .env and fill it in. Docker Compose and the kōjō process both read it. |
initdb/10-vector.sql |
Creates the vector extension when Postgres first initializes its data directory. |
Get the binary and the files
The installer downloads the binary and, with --compose-dir, these files of the same release, plus the systemd unit kojo.service:
curl -fsSL https://xavidop.github.io/kojo/install.sh | sh -s -- --compose-dir kojo
cd kojo
cp .env.example .env && chmod 600 .env
Edit .env. Keep to plain NAME=value lines, without quotes:
| Variable | Meaning |
|---|---|
POSTGRES_PASSWORD |
Password of the Postgres in the compose file. kojo.yaml puts it into the database URL: letters and digits only. |
POSTGRES_PORT |
Loopback port Postgres is published on. Default 5432. Change it in the database URL of kojo.yaml too. |
KOJO_PUBLIC_URL |
server.public_url. |
KOJO_SESSION_SECRET |
Signs the dashboard’s session cookie. Generate it with openssl rand -hex 32. |
KOJO_ADMIN_TOKEN |
The admin API token of kojo.yaml, for the CLI. At least 16 characters. |
ANTHROPIC_API_KEY |
The key of the provider your tiers use. OPENAI_API_KEY, GEMINI_API_KEY and OPENROUTER_API_KEY work the same way. |
Then edit kojo.yaml: the sign-in method, the forges, Slack and the model tiers. The blocks for OIDC, GitHub and Slack are commented out; a commented block does not ask for its variables. As shipped, kōjō binds 127.0.0.1:8080 and expects a TLS reverse proxy in front of it.
Start it
Prepare sbx once, as the user that will run kōjō:
sbx login
sbx policy init deny-all
Start Postgres, load .env into the shell, check the config, and start kōjō:
docker compose up -d
set -a; . ./.env; set +a
kojo config validate -f kojo.yaml
kojo serve -f kojo.yaml
kojo serve applies the database migrations when it starts and stays in the foreground. From a second terminal on the same host, with .env loaded:
curl -fsS http://127.0.0.1:8080/readyz
kojo doctor --remote --token "$KOJO_ADMIN_TOKEN"
To run kōjō as a service instead, use the systemd unit deploy/systemd/kojo.service; its header lists the install commands. Single VM with Compose covers it, with TLS and backups.
Helm
The chart charts/kojo installs kōjō (kojo serve, two replicas by default), kojo-proxy (kojo proxy, two replicas by default), the RBAC of the k8s driver, the NetworkPolicy that locks sandbox pods down to the proxy, and by default a bundled Postgres with pgvector. It needs Kubernetes 1.25 or later.
flowchart LR
forge["Forge"]
models["Model provider"]
subgraph cluster["Kubernetes cluster"]
ing["Ingress or HTTPRoute"]
kojo["kojo serve, two replicas"]
pg[("Postgres with pgvector")]
asb["Agent Sandbox"]
pods["Sandbox pods, on Kata or gVisor"]
proxy["kojo-proxy, two replicas"]
end
out["Allowlisted hosts"]
forge -- "webhooks" --> ing --> kojo
kojo -- "comments, commits, pull requests" --> forge
kojo -- "model calls" --> models
kojo --> pg
kojo -- "sandbox claims" --> asb --> pods
kojo -- "allowlists and credentials" --> proxy
pods -- "NetworkPolicy: the proxy only" --> proxy
proxy --> out
The pieces are the same as on one VM, with two differences: sandboxes are pods that Kubernetes Agent Sandbox starts, and their only way out is kojo-proxy, which kōjō gives each session’s allowlist and credentials.
The cluster needs three things the chart does not install by default:
- Kubernetes Agent Sandbox v1.0.12. Set
agentSandbox.install=true, or install that release yourself. - A RuntimeClass that isolates.
sandbox.runtimeClassNameiskataby default; set it togvisoron nodes that cannot run VMs. The chart installs no runtime. - A CNI that enforces NetworkPolicy. Without one the sandbox egress policy exists but does nothing.
Install from the OCI registry, with the provider key in a Secret you create. KOJO_VERSION is a released version without the v:
export KOJO_VERSION=X.Y.Z
kubectl create namespace kojo
kubectl -n kojo create secret generic kojo-env --from-literal=ANTHROPIC_API_KEY=...
helm install kojo oci://ghcr.io/xavidop/charts/kojo --version "$KOJO_VERSION" -n kojo \
--set agentSandbox.install=true \
--set secrets.existingSecret=kojo-env
Or from the chart repository, which carries the same chart:
helm repo add kojo https://xavidop.github.io/kojo
helm repo update
helm install kojo kojo/kojo -n kojo --create-namespace
Your part of kojo.yaml goes into the config value; secrets come from secrets.existingSecret. While config sets no sign-in method, the chart adds an admin API token named bootstrap:
kubectl -n kojo get secret kojo-generated -o jsonpath='{.data.KOJO_BOOTSTRAP_TOKEN}' | base64 -d
kubectl -n kojo port-forward svc/kojo 8080:8080
Kubernetes with Helm has the values, the proxy, RBAC, the network policies and the database options.
The binary
kojo is one statically linked binary for Linux, macOS and Windows on amd64 and arm64. The same binary is the server, the egress proxy and the CLI.
install.sh
curl -fsSL https://xavidop.github.io/kojo/install.sh | sh
The script, for Linux and macOS:
- Picks the release (the latest, or
--version) and the archive for this OS and CPU:kojo_<version>_<os>_<arch>.tar.gz. - Downloads the archive and the release’s
checksums.txt, and stops unless the archive’s SHA-256 is the one listed. - When
cosignis installed, also verifies thatchecksums.txtwas signed by the release workflow ofgithub.com/xavidop/kojo. Withoutcosignit says that the signature was not checked. - Installs the binary into
/usr/local/bin, withsudowhen that needs it, or into~/.local/binwhen it cannot write there. It runskojo versionto check that the binary starts. - With
--compose-dir DIR, downloads the single-VM install of the same release intoDIR:docker-compose.yml,kojo.yaml,.env.example,initdb/10-vector.sqland the systemd unitkojo.service. Files that exist are kept.
It installs neither Docker nor Docker Sandboxes. It checks for sbx, /dev/kvm and docker and prints Docker’s install instructions for what is missing.
| Option | Environment variable | Default | Meaning |
|---|---|---|---|
--version vX.Y.Z |
KOJO_VERSION |
the latest release | The release to install. |
--dir DIR |
KOJO_INSTALL_DIR |
/usr/local/bin |
Where the binary goes. |
--compose-dir DIR |
KOJO_COMPOSE_DIR |
not set | Also fetch the compose install into DIR. |
--base-url URL |
KOJO_DOWNLOAD_URL |
the GitHub Release | A mirror of the release’s files. |
-h, --help |
Print the usage. |
curl -fsSL https://xavidop.github.io/kojo/install.sh | sh -s -- --version vX.Y.Z --dir "$HOME/bin"
Other packages
Each release also publishes, from .goreleaser.yaml:
| Artifact | How to get it |
|---|---|
Archives kojo_<version>_<os>_<arch>.tar.gz (.zip on Windows) |
the GitHub Release; they hold the binary, the licences and the shell completions |
.deb, .rpm and .apk packages |
the GitHub Release; there is no package repository, so download the file for your distribution |
| Homebrew cask (macOS) | brew install xavidop/tap/kojo |
| Scoop manifest (Windows) | scoop bucket add xavidop https://github.com/xavidop/scoop-bucket, then scoop install kojo |
| Container image | ghcr.io/xavidop/kojo:<version> and latest, for linux/amd64 and linux/arm64 |
| Sandbox toolchain image | ghcr.io/xavidop/kojo-toolchain:<version> and latest, for linux/amd64 and linux/arm64; built by the Release workflow, not by GoReleaser |
checksums.txt is signed with Sigstore. To verify a download by hand:
cosign verify-blob --certificate checksums.txt.pem --signature checksums.txt.sig \
--certificate-identity-regexp 'https://github.com/xavidop/kojo/' \
--certificate-oidc-issuer https://token.actions.githubusercontent.com checksums.txt
sha256sum -c checksums.txt --ignore-missing
First run
The steps below are the same for every install. Commands that read kojo.yaml need the variables it names: on one VM, load .env first (set -a; . ./.env; set +a); on Kubernetes, run them in the pod with kubectl -n kojo exec deploy/kojo --, where the file is /etc/kojo/kojo.yaml.
Migrate the database
kojo serve applies pending migrations when it starts, so a new install needs no separate step. Replicas that start together take turns on a Postgres advisory lock. To apply them yourself, before a rollout for example:
kojo migrate -f kojo.yaml
It prints the number of migrations applied and exits.
Create the GitHub App
kojo setup github registers the GitHub App kōjō acts as, through GitHub’s manifest flow. It needs no kojo.yaml and no running server, so you can run it on your workstation and copy the two files it writes.
kojo setup github --public-url https://kojo.example.com --org acme
- The command serves a page on a loopback port and prints its address. It does not open a browser: open the address yourself, in a browser on the same machine.
- The page sends the app’s manifest to GitHub: the name (
kojounless you pass--name; app names are unique on a GitHub instance), the webhook URL<public-url>/webhooks/github, the permissions and the events. - You review and confirm the app on GitHub. Without
--orgit is created in your user account. - GitHub redirects back to the command with a one-time code, which the command exchanges for the app’s ID, private key and webhook secret. It waits up to 10 minutes.
- It writes
github-app.pemandgithub-app.env(GITHUB_APP_ID,GITHUB_WEBHOOK_SECRET) into the directorysecrets, readable only by you, and prints their absolute paths, theforges.githubblock forkojo.yamlwith the absolute path of the key, and the address where the app is installed on repositories. No secret is printed.--outnames another directory.
The app asks for these permissions:
| Permission | Level | Used for |
|---|---|---|
metadata |
read | repositories, collaborators, rulesets |
contents |
write | reading files, committing to kojo/* branches and to the branch of a person’s pull request when they ask |
issues |
write | reading issues, commenting |
pull_requests |
write | opening, editing, commenting on and merging pull requests |
checks, statuses |
read | the state of a commit |
administration |
read | classic branch protection |
Afterwards:
-
Add
GITHUB_APP_IDandGITHUB_WEBHOOK_SECRETto the environment:.envon one VM, your Secret on Kubernetes. -
Put the key where
forges.github.private_key_filepoints, readable by the user kōjō runs as and by nobody else. The shippedkojo.yamlexpects/etc/kojo/secrets/github-app.pem. -
Uncomment the block in
kojo.yamland restart kōjō:forges: github: app_id: "${GITHUB_APP_ID}" private_key_file: /etc/kojo/secrets/github-app.pem webhook_secret: "${GITHUB_WEBHOOK_SECRET}" -
Install the app on the repositories kōjō should work on, at the address the command printed.
GitLab and Forgejo use an access token instead of an app, and Bitbucket Cloud the API token of a bot account; see GitLab, Forgejo and Bitbucket. None of them has an installation token, so the token kōjō hands the proxy for clones is the configured one: it can write, and kojo-proxy sets it only on requests that cannot.
Create the Slack app
kojo setup slack prints the manifest of the Slack app. It creates nothing itself.
kojo setup slack -o slack-manifest.yaml
-
At
https://api.slack.com/apps, choose Create New App, From a manifest, and paste the manifest. -
Install the app to your workspace.
-
Put its tokens in the environment and add the block to
kojo.yaml:chat: slack: mode: socket bot_token: "${SLACK_BOT_TOKEN}" app_token: "${SLACK_APP_TOKEN}" -
Give the people who may approve pull requests and merges the
operatorrole: approvals in Slack are checked against it.
Socket mode, the default, needs no public ingress. For HTTP mode pass --mode http --public-url https://kojo.example.com and configure signing_secret instead of app_token.
Enable a repository
kōjō only works on repositories that are enabled. Webhooks from any other repository are answered and dropped, and kojo run is refused, a dry run included.
Protect the default branch of a repository before you enable it. kōjō refuses to enable a repository whose default branch is not protected, in the dashboard and through kojo config apply alike, with a message that names the branch. Draft pull requests are a safeguard only where nothing can be pushed past them. dev: true skips this check.
The list is the runtime config object repos. It starts empty. Each entry is a repository ID, forge/owner/name:
| Key | Default | Meaning |
|---|---|---|
enabled |
false |
The factory works on this repository. |
skills |
all | Limit the repository to these skills. |
auto |
none | Run a skill on a forge event without a mention: issue_opened, pr_opened, pr_updated, check_failed. Any other key is rejected. |
allow_auto_merge |
false |
Let the repository use the auto_merge policy. Only an admin sets it. |
Change it in the dashboard under Settings, Repositories, or from the CLI with an admin token. Export the current state, edit the repos object, apply:
export KOJO_SERVER=https://kojo.example.com
export KOJO_TOKEN=... # an admin API token
kojo config export -o kojo-state.yaml
The repos object in that file, with one repository enabled:
version: 1
objects:
- scope: org
object: repos
content:
repos:
github/acme/api:
enabled: true
auto:
pr_opened: review-pr
kojo config apply -i kojo-state.yaml --dry-run
kojo config apply -i kojo-state.yaml
apply only touches the objects in the file, and each change is a new revision that can be rolled back. Managing kōjō covers the dashboard, revisions and roles.
kojo doctor checks every enabled repository again: it fails one whose default branch is no longer protected, and one where kōjō cannot read user permissions. On Forgejo, Gitea and Bitbucket the bot account must be an admin of the repository for that; without it no mention can be authorized.
Run kojo doctor
kojo doctor checks the install and exits 1 when a check fails. Run it after every change to the install.
When the server runs on the same host, ask it:
kojo doctor --remote --token "$KOJO_ADMIN_TOKEN"
Without --remote, kojo doctor -f kojo.yaml builds the checks from the local config in its own process. On Kubernetes that is how the chart’s notes run it, inside the pod.
The dashboard’s Doctor page, under Records, runs the same checks on the server for anyone with the operator role.
Each line is a status (ok, warn, FAIL or skip), the name of the check and a detail. The last line counts them. These are the checks and what each prints when it passes:
| Check | Passes with |
|---|---|
mode |
production mode. It fails while dev: true is set. |
database |
reachable, migrations applied |
team memory |
pgvector is available. Without pgvector it is a warning. |
sandbox driver |
the driver, its version and a detail |
sandbox isolation |
the isolation level. A driver that shares the host’s kernel fails. |
sandbox egress |
sandboxes have no route out except the proxy |
egress probe |
a sandbox with an empty allowlist could not reach example.com, through the proxy or around it |
kojo-proxy |
N replicas; this server remembers M sandbox policies, when the proxy is remote. One replica is a warning. |
kojo-proxy <address> |
instance <id>, ready, holds N sandbox policies, all M of this server's among them, one line per replica of a remote proxy. A replica that does not answer, signs with another CA than the others, answers for several replicas behind one address, or is ready but lacks policies or deletes of this server fails. One that is not ready yet is a warning: it takes no sandbox traffic. Only the running server remembers policies, so ask it (--remote, or the dashboard) to compare them; a local kojo doctor remembers none. |
forge <name> |
reachable, permissions sufficient |
trigger permissions <repo> |
user permissions are readable |
branch protection <repo> |
the default branch is protected, with its required checks and reviews |
skill activation |
an eval at N% is required. Without a required eval it is a warning. |
budgets |
per session $X, per day $Y, per month $Z. No per-session or per-day cap fails (a monthly cap alone does not bound a runaway day); a tier without a price is a warning. |
model provider <name> |
where the credentials came from, and <model> answers. One line per provider a tier, a fallback or the embedder uses. |
model tier <tier> |
<provider>/<model> answers |
chat <name> |
tokens work |
dashboard sign-in |
OIDC with <issuer>. API tokens without OIDC are a warning. |
session reports |
links are signed with a key derived from server.auth.session_secret. Without a session secret it is a warning: no link to a shareable report is made. |
Other lines appear only when something is off: sandbox docker (sandboxes cannot run their own Docker daemon), repositories (none is enabled yet), forges (none is configured), dashboard admins (nobody has the admin role), public URL (not https) and network policies (the Helm chart’s NetworkPolicies are off).
The egress probe creates a real sandbox with an empty allowlist and tries to reach example.com through the proxy and around it. --skip-probe leaves it out.
A run without failures ends like this and exits 0. Warnings do not change the exit code:
12 ok, 2 warning(s), 0 failed, 0 skipped
A first install usually has warnings: skill activation until an eval is required, budgets until every tier has a price, and dashboard sign-in until OIDC is configured.
Verify with a first session
Start a session from the CLI on an enabled repository, with a token that has the operator role or more:
export KOJO_SERVER=https://kojo.example.com
export KOJO_TOKEN=...
kojo run --repo github/acme/api --issue 412 "fix this"
kojo run prints the session’s steps as they happen, then the summary, the goal critic’s report and the pull request. Code changes come back as a draft pull request unless the repository’s merge policy says otherwise. --dry-run does the work and pushes nothing.
A mention does the same from the forge: @kojo fix this in a comment on an issue, where kojo is the name of your GitHub App or the login of the bot account. That path also proves that webhooks arrive.
The quick start walks through asking for work, with more kinds of requests, and following the session to the pull request.
Next steps
- Deploy: TLS, backups, high availability, upgrades and secrets.
- Skills: what the factory can do and how to change it.
- Merge policy: drafts, approvals and auto-merge.
- CLI reference: every command and flag.