Manage with the CLI

The kojo binary that runs the server is also its client. Use it for work that belongs in a terminal or a pipeline: starting and following sessions, checking skill files before a push, and keeping the runtime config in a file. Every flag of every command is in the CLI reference; this page is the working subset.

Point the CLI at the server

The client commands talk to a running server over the HTTP API. They need its URL and an API token:

export KOJO_SERVER=https://kojo.example.com
export KOJO_TOKEN=...   # a token from server.auth.tokens in kojo.yaml

--server and --token do the same per command. A token carries one role, and a command fails with 403 when the role is too low: starting a session needs operator, exporting and applying the config needs admin.

Sessions

Start a piece of work and follow it until it ends:

kojo run --repo github/acme/api --skill build-feature --issue 415
kojo run --repo github/acme/api --issue 412 "fix this"
kojo run --repo github/acme/api --pr 418 --skill review-pr
kojo run --repo github/acme/api --skill security-audit --dry-run "audit the auth package"
kojo run --repo github/acme/api --plan --issue 416 "add CSV export"

Without --skill the orchestrator chooses the skill. --dry-run does the work but pushes and posts nothing, and prints the diff. --plan has the session write a plan and wait for the go-ahead before it changes code; the command prints the plan and stops there. --detach prints the session ID and returns.

Look at sessions afterwards:

kojo sessions list --repo github/acme/api --status failed
kojo sessions show <session>
kojo sessions logs <session> --follow
kojo sessions message <session> use the v2 client, not v1
kojo sessions cancel <session>
kojo sessions approve <session>
kojo sessions decline <session>

kojo sessions message corrects a session at work without cancelling it: its next model step reads the message as guidance. See Talking to a session at work. kojo sessions approve and decline answer the plan a session waits on; a message to it asks for a revised plan.

kojo sessions report <session> prints a link to the session’s shareable report, a read-only page for people without a dashboard account; --html report.html writes the page to a file instead.

kojo sessions logs prints the same replay the dashboard shows: orchestrator turns, subagents, tool calls, sandbox commands and the goal critic’s verdicts.

Campaigns

A campaign runs one task in many repositories. create prints the repositories, the ones it skipped and the most it can cost, and asks before anything runs:

kojo campaigns create --title "Logger v3" --task "Move from logger v2 to v3." --match 'github/acme/svc-*'
kojo campaigns show <campaign>
kojo campaigns continue <campaign>
kojo campaigns retry <campaign>
kojo campaigns cancel <campaign>

A campaign with a pilot pauses after its first repositories; look at their pull requests, then continue.

Limits

kojo limits prints every limit and what counts against it now: the install’s spend in the last 24 hours and this month, then one table each for teams, repositories, skills, people and triggers. A cell reads $1.50 of $4.00 (spent, then the limit) or 1 of 2 (running, then the cap). People are listed to the operator role and up; a viewer sees people: hidden. --json prints the server’s answer as it came.

kojo limits
kojo limits --json

set changes one entry and unset removes limits from it. Only the flags given change. A skill has no --max-running (a session’s skill is often not known until the orchestrator delegates) and a trigger has only --max-running:

kojo limits set team platform --per-day 50 --max-running 3
kojo limits set repo github/acme/api --per-month 300
kojo limits set skill fix-bug --per-day 20 --per-month 300
kojo limits set person default --per-day 10 --max-running 2
kojo limits set person alice@example.com --per-day 25
kojo limits set trigger eval --max-running 2
kojo limits set install --per-month 3000

kojo limits unset skill fix-bug --per-day
kojo limits unset person alice@example.com
kojo limits unset install --per-month

A person is an email or <surface>:<id> (github:alice, token:ci-nightly), or default for everyone without an entry of their own. A person’s entry replaces the default as a whole, so kojo limits set person bob@example.com with no flag exempts Bob from it, and the command says so. unset with no flag removes the whole entry.

Teams, repositories, skills, people and triggers are settings/limits, which needs the admin role. install is the daily and monthly budget of settings/models, which an operator can change; unset install never removes per_session_usd.

The command reads the object, changes the entry and writes it back naming the revision it read. When someone changed the object in between, nothing is written and the command fails with settings/limits changed since it was read: run the command again.

Skills

kojo skills list --repo github/acme/api
kojo skills validate .factory/skills

kojo skills list shows what a repository resolves to and the layer each skill comes from: the repository, the org, or built in. kojo skills validate checks skill directories without a server, so it fits a pre-commit hook or a CI job on the repository that holds them.

Run a skill against its eval fixtures and fail the job below a pass rate:

kojo eval fix-bug --min-pass-rate 0.8

See Evals.

Config as code

kojo config export writes every active runtime config object as one YAML document, and kojo config apply loads such a document. Together they keep the runtime config in a repository: export it once, review changes as pull requests, apply from CI.

flowchart LR
    S["Running kōjō"] -- "kojo config export" --> F["kojo-config.yaml in a repository"]
    F -- "pull request and review" --> M["Merged"]
    M -- "kojo config apply, from CI" --> S

Export

kojo config export writes every active object of every scope as one YAML document. It holds no secrets.

kojo config export -o kojo-config.yaml
Flag Meaning
-o, --output Write to this file instead of standard output
--factory Write one scope as .factory/ files into this directory instead of one document. See Moving a scope to git.
--scope With --factory: org or repo:<forge/owner/name>. With --pr: repo:<forge/owner/name>
--force With --factory: replace files whose content differs
--pr With --scope repo:<forge/owner/name>: kōjō opens a pull request on the repository that creates its .factory/factory.yaml and .factory/schedules.yaml, and nothing is written here. See Moving from the dashboard.

The document has a version (always 1) and a list of objects, each with scope, object and content. Its schema is config-export.schema.json.

version: 1
objects:
  - scope: org
    object: settings/activation
    content:
      require_eval: true
      min_eval_pass_rate: 0.7
      require_second_reviewer: false
  - scope: org
    object: settings/skills_source
    content:
      org: dashboard
      repo: git

Apply

kojo config apply loads such a document.

kojo config apply -i kojo-config.yaml --dry-run
kojo config apply -i kojo-config.yaml
Flag Meaning
-i, --input The document to apply. - reads standard input. Required.
--dry-run Show what would change without writing
  • Every object in the document is validated before anything is written. If one is invalid, nothing is applied.
  • An object that equals the active revision is left alone, so applying from CI is idempotent.
  • An object that differs becomes a new active revision with the message kojo config apply.
  • Objects that the document does not list are not touched. Apply never deletes.
  • Each listed object replaces the active one as a whole.
  • The guards of the API apply: enabling a repository needs a protected default branch, and the rbac object must keep an admin.
  • A repository’s merge policy or schedules that its default branch keeps in .factory/ becomes a pull request on the repository, not a revision, unless it equals the active revision: then it is left alone like any other object, and kōjō’s open pull request keeps its changes. Apply prints one line per pull request (opened, updated or unchanged, the object, the number and its link; with --dry-run, what it would do). The revisions are written first: when opening a pull request then fails, they stay, and applying again is idempotent.

Both commands talk to a running server (--server or KOJO_SERVER) and need a token with the admin role (--token or KOJO_TOKEN).

Validate kojo.yaml

kojo config validate checks the boot config, kojo.yaml, and nothing else: it expands ${VAR} references, applies defaults and reports every problem. It does not contact a server. To check a runtime config document, use kojo config apply --dry-run.

Check the deployment

kojo doctor --remote

--remote asks the running server to run its checks and prints the report: the database, the sandbox driver and its isolation, egress, the forges, branch protection on every enabled repository, the activation policy, budgets, the model providers and the model tiers. Without --remote the checks run from the local kojo.yaml.

What the CLI does not do

  • Roll back an object to an earlier revision. Use the dashboard or the HTTP API, or apply an older export.
  • Edit skill drafts. Drafts live in the Skills studio; a skill kept in git is edited in its repository.
  • Decide approvals. They happen in chat.
Scroll to move. + - zoom, 0 fit, Esc close.100%