k0rtexdocs Get started

Worker.

On this page

The machine-side half of k0rtex. It pairs with a server over HTTPS, connects outbound over SSH, and does what the server never does itself: clone and push repositories, prepare ticket checkouts, start agent processes and read a checkout into the workspace index.

It imports nothing from the server. The two share only k0rtex-protocol. The tool gateway’s machinery is k0rtex-codemode, a package that knows nothing of k0rtex.

Running it #

k0rtex run is the service: one process per data directory (~/.k0rtex-worker, or --data-dir). k0rtex service install puts it under launchd or systemd. It stops its agents on SIGTERM and rereads its settings on SIGHUP.

File in the data directory Holds
connection.json, identity The pairing with one server
worker.json This worker’s settings (below)
providers.json Command overrides per provider
control.sock The local control socket (in the temp directory when the path is too long)
logs/worker.log The log, rotated
repositories/, tickets/, runs/ Base clones, ticket checkouts, pre-run file records
Setting Default Meaning
max_sessions unset Run sessions at once. Unset leaves it to the capacity saved on the board.
provider_limits {} Run sessions at once per provider id
default_provider unset The provider for a run that names none. Unset: the first installed one by name.
max_background_jobs 2 Index and model requests at once
stop_grace 5 Seconds an agent gets after SIGTERM when it is stopped from here
log_level INFO

status, drain, resume, stop and config talk to the running service over the control socket; k0rtex tui (the tui extra) is the same in a terminal UI.

Layout #

Module Role
service.py Worker: the SSH connection, request dispatch, checkouts, limits
sessions.py SessionRegistry and AgentSession: one per agent process
harness/ One driver per transport: cli.py (JSON lines) and a2a.py (Agent2Agent)
gateway/ The tool gateway of a session: embeds k0rtex-codemode with the agents’ permissions and reports its calls
tap.py Follows a session’s events to show what it is doing
daemon.py Signals, logging, housekeeping around one Worker
control.py The control socket’s messages, server and client
service_install.py launchd and systemd
tui/ The Textual app; only k0rtex tui imports it

Providers #

A worker launches agents through a provider package found under the k0rtex.providers entry point; install one or more alongside it, for example k0rtex-worker[opencode,claude-code]. Each provider names the transport its harness is driven over. To change a provider’s command on this machine, write providers.json in the worker’s data directory:

json
{"opencode": {"command": "/opt/opencode/bin/opencode", "arguments": []}}

command replaces the provider’s program, and arguments come before the provider’s own.

The skills agents use ship with the worker in src/k0rtex_worker/skills; see the README there.

This page is backend/packages/worker/README.md in the k0rtex repository. Suggest a change.