KoskenDocs Open the app

How Kosken keeps a machine safe

The two processes on each machine, the signatures, the five gates, audit mode first, approvals and the audit trail.

5 min readUpdated on Español

On this page
  1. Decide in code, propose with models
  2. Two processes on each machine
  3. Signatures
  4. The five gates
  5. Audit mode first
  6. People and approvals
  7. Workspaces and keys
  8. The audit trail
  9. Read more

This page tells you which limits stop Kosken from doing harm on a machine. Each limit is in code or in the operating system. None depends on a model following a rule in a prompt. The whitepaper and the Security page give the full design.

Decide in code, propose with models

A model writes text: a severity, a cause, a report. Code decides whether an incident opens, closes, or needs approval, and whether a recipe runs. The model has no tool that closes an incident. Its diagnosis can end with conclude, which takes no action. An incident is resolved only after the check of the fix passes.

Two processes on each machine

The process that talks to Kosken over the network does not run commands. A second process runs them.

  • The agent (kosken-agent) runs as a user with no privileges. It reports facts and signals and receives orders. It never runs a command, and it has no listening port. It does not hold the signing keys.
  • The executor (kosken-exec) is a separate process that runs as root. Its unit sets PrivateNetwork=yes and RestrictAddressFamilies=AF_UNIX. It receives an order on a local socket from the agent. It verifies the signature of the order and of the recipe, runs the dry run, the steps and the verify step, and reports the result.

By default the executor has no network access. The host owner gives it network only for a need that requires it, such as a Proxmox node or a backup destination. Only a person on the host, as root, can do that, with kosken-agent enable <need>. Kosken cannot widen a host.

A compromised agent cannot make the executor run an unsigned recipe.

Signatures

  • Recipes. A recipe is a signed JSON document. Each step is a fixed list of arguments. No step is a shell string. Parameters have types and allowed values. A model selects a recipe and fills parameters. It cannot add a step. The executor stores a recipe only when its signature chain leads to a key built into its binary.
  • Orders. Each order is signed. Before it runs anything, the executor checks the signature, that the order is for this machine and this workspace, that the order has not expired, that it has not run the order before, and that the recipe and its parameters match. Any failure refuses the order and runs nothing.
  • Releases. The install and each update check the signature of the release manifest and the hash of each program.

The executor checks the precondition of the recipe again on the machine, with live facts, before it runs.

The five gates

Each proposal of a recipe goes through five gates. Gates 1, 2 and 4 are code. Gate 5 is a separate model call that can only veto. Gate 3 is a person. Each answer is allow, ask or deny, and each answer is written on the timeline of the incident.

  1. Gate 1 reads the effective mode of the machine. Audit mode denies.
  2. Gate 4 checks that the recipe is in the signed catalog, that the parameters have the right form, and that the machine is online. It also checks the precondition of the recipe against the facts that Kosken stores about the machine.
  3. The Guardian reads the rendered steps. Its rules and its model can raise the risk. They cannot lower it.
  4. Gate 2 reads the trust of the recipe on that machine.
  5. Gate 5 is a safety classifier. It reads the recipe and the machine, never the diagnosis.
  6. Gate 3 is the approval of a person. In live mode, a low-risk recipe with trust on that machine, with gate 5 passing, runs without a person. Any other case asks a person.

When the gates deny the action of a diagnosis, the incident goes to a person at once, with the recipe and the reason.

Audit mode first

Every machine starts in audit mode. Audit mode reads and reports. It changes nothing. You move a machine to shadow, then to live, when you trust what you saw. The effective mode is the lowest of the machine setting and the limits above it, and nothing raises it. See Modes.

People and approvals

  • A risk above low, a recipe with no trust on that machine, or a gate that cannot decide sends the request to a person.
  • A request that nobody answers expires and never runs.
  • By default, an approval at a high risk or above asks the person to confirm their identity again first.
  • Two-person approval is a choice of the workspace, and it is off by default. When it is on, a proposal of the model at or above the chosen risk needs a second person with write access. When the workspace has one writer, that person confirms their identity again. A change that a person asks for never needs a second person.

See Approvals and Second factor.

Workspaces and keys

Row-level security in the database separates workspaces. Each workspace has its own keys, derived with HKDF and sealed. You bring your own key for OpenAI, Anthropic or DeepSeek. Kosken does not issue model keys. The endpoints for model calls are fixed in code, and context is redacted before it leaves. See Your AI model key.

The audit trail

Each audit entry includes the hash of the previous entry. A signed anchor is written each day. If someone edits an old entry, verification fails. This detects tampering. It does not prevent a person with full database access from deleting the whole log and its anchors. See The audit log.

The executor also writes one line for each order that it sees to /var/lib/kosken/exec/audit.log on the machine, with a hash of the line before it. The administrator of the host can read what Kosken did without trusting Kosken. To print the file and check its chain:

sudo /usr/local/lib/kosken/current/kosken-agent log-audit

Read more

Something here does not match the app? Tell us