Skip to content

The model

~/.kyotoagent/config.toml names the current provider and a table per provider. Each table is an OpenAI-compatible server: a base_url, a model, and an optional api_key_env.

provider = "office"
title_model = "google/gemini-3.8-flash"
yolo = false
[providers.office]
base_url = "https://openrouter.ai/api/v1"
model = "openai/gpt-4o"
api_key_env = "OPENROUTER_API_KEY"
[providers.local]
base_url = "http://127.0.0.1:11434/v1"
model = "qwen2.5-coder"
[projects.kyotoagent]
path = "/work/kyotoagent"
yolo = true

title_model is the model that names a new session. When omitted or set to google/gemini-3.8-flash, it follows the provider: Grok uses grok-4.6 with low reasoning effort, Codex uses gpt-6-luna, OpenCode uses deepseek-v4.1-flash, and OpenRouter uses google/gemini-3.8-flash. Set another model ID to override that choice. An empty string leaves the directory name. Title requests keep the session’s model and effort unchanged.

base_url is the OpenAI-compatible root. The client appends /chat/completions, so the file never spells that path out. The local table above is Ollama’s root. A llama.cpp server is http://127.0.0.1:8080/v1. Omit api_key_env when the server has no auth.

Keys

api_key_env is the name of an environment variable, never the key itself, so the secret stays in the environment and the file stays safe to read.

  • When the name is set and the variable holds something, the request carries Authorization: Bearer.
  • When it is left out, or the variable is unset or empty, no Authorization header goes out at all, so a local server is not asked for a key it does not want.

Subscription providers

Start kyotoagent serve, open kyotoagent, then press Ctrl-K and choose Providers. Select Grok, Codex, OpenCode Go, or OpenCode Zen and approve the device code at the URL shown. The selected server saves the credentials and uses that provider for new turns.

For OpenCode, choose your workspace in the browser. Go uses your subscription; Zen uses pay-as-you-go credits. Kyoto stores their workspace-scoped credentials separately, refreshes them automatically, and leaves existing API-key providers unchanged. Choose a model from Kyoto’s model picker after signing in. The picker loads OpenCode’s live model lists, model metadata, and workspace configuration. Kyoto routes coding models through Chat Completions, Responses, Anthropic Messages, or Gemini according to their advertised API.

Managing providers

  • kyotoagent provider prints the current id, its base_url, and its model.
  • kyotoagent provider use <id> selects a table already in the file.
  • kyotoagent provider add <id> --base-url <url> --model <model> [--api-key-env <name>] inserts a table and selects it.

Changing provider is picked up on the next turn; serve does not need to restart.

kyotoagent provider add opencode asks for an API key and writes opencode-auth.json next to config.toml, mode 0600. The table is kind opencode, Zen at opencode.ai/zen/v1, and model kimi-k2.7-code. --model replaces that model. --api-key-env stores the variable name and skips the key file. The key is not written into config.toml.

A file that still has top-level base_url and model loads as it did. That is the current provider when provider and [providers] are absent.

Background compaction

Set the top-level background_compaction boolean to prepare context summaries while the agent continues working. It is off by default:

background_compaction = true

Preparation starts at 85% of the automatic compaction threshold once context usage reaches at least 64,000 tokens. With the default compact_percent = 85 and a 200,000-token window, preparation can start around 144,500 tokens; the summary is applied when compaction is needed around 170,000 tokens. Preparation can also run between turns.

Kyoto holds the prepared summary in memory without changing the active transcript. At compaction time it checks the model configuration, instructions, history, and remaining context space, then applies the summary with subsequent events preserved. If preparation is still running, compaction waits for it. Failed or stale preparation falls back to ordinary compaction. Manual /compact, provider context-overflow recovery, and cancellation discard held preparation.

Prepared summaries are lost on server restart. Summary requests can cost tokens even when their results are never used.

Command sandbox

sandbox is a top-level boolean, off by default on every operating system:

sandbox = false

With false, commands, background tasks, closeout checks, and command hooks run directly with the server user’s permissions. They can modify files that user can write. Permission prompts and the direct file tools’ operator-config write guards remain enabled; this setting does not enable yolo mode.

Set sandbox = true to opt into Linux Bubblewrap protection. It requires a working /usr/bin/bwrap and host namespace permissions. Explicitly enabling it on an unsupported host returns an error rather than running unprotected. The setting is read for each new turn and applies to child-agent turns too.

Projects and approval defaults

A [projects.<id>] table names a folder a new session can start in. path is required. name is optional and falls back to the id. The id is lowercase letters, digits, and dashes, the same rule as a provider id. Ctrl-T asks serve for that list. With no projects, Ctrl-T still asks this directory or a git worktree of the current directory.

yolo on the file is the default for a new session. A project can set its own yolo. When that key is present, the new session uses it. When the key is absent, the session uses the file default. Leave both out and the session starts off. A later edit to the file leaves sessions that already exist as they are. Ctrl-Y, /yolo, and POST /v1/sessions/:id/yolo change the live session. true answers an open permission once. false leaves that card waiting and does not forget paths already allowed for the session.

Project closeout fallback

Set a project’s closeout to a YAML file path to use it when the workspace has neither .kyotoagent/closeout.yaml nor .agents/closeout.yaml. A repository closeout file takes precedence, including a file with an empty items list. Relative configuration paths start at the configured project directory. For a fallback outside the project, imports and skills start beside its YAML file.

[projects.kyotoagent]
path = "/work/kyotoagent"
closeout = "/shared/closeout.yaml"

Closeout 0.1 imports resolve depth-first and prefix check IDs with their as namespace, such as quality/tests. Nested import paths start at the policy root. An item, setup step, or field Kyoto does not understand is skipped. Known checks still load, so a newer policy does not stop startup. Review checks name a SKILL.md, an independence requirement, and a failOn severity. run_closeout launches a fresh reviewer session and retains its findings. Set its model argument to a different available model when differentModel is required. Kyoto evaluates the findings and independence before allowing finish or PR creation.

The app and TUI label each check as required or not required for the current turn. A check becomes required when the turn touches a workspace path matching its paths. Omitting paths makes any workspace write require that check. Read-only turns show “Not required; won’t run” and finish without checks. Required checks must pass before Kyoto finishes the turn or runs gh pr create. Hiding the closeout pane changes its visibility while checks remain required. Further workspace writes invalidate their passes.

Matching setup steps run in order before the check. A failed setup stops the remaining steps and the check. Commands use their exec arguments and timeoutSeconds directly. The app and TUI show output as the command runs; each new attempt starts with an empty log.

The entry policy can bound failed attempts:

retry:
maxFailedAttemptsPerItem: 5
scope: task

Both fields are required. The limit is between 1 and 100000. Use task to keep the limit across commits and sessions, or candidate to count failures for the same base and head. Public policies without retry have no failure limit. Imported policies cannot set it. When a check reaches its retry limit, Kyoto offers “Stop” or “Accept failed closeout for this session”. Explicit acceptance allows completion and PR creation and skips further closeout checks in that session. Kyoto records the acceptance alongside the original failures. Use /closeout enable to restore checks with a fresh retry budget for that session. Earlier failures and transcripts stay recorded.

Goal runs use their persisted goal ID. Ordinary sessions default to their session ID. To share a retry budget across sessions, supply the same ID with kyoto new --task <id> or taskId when creating a session through the API. A task ID must be nonblank and at most 256 bytes. Kyoto retains the retry records under its server root and serializes attempts sharing a repository. Failed review findings count; invalid, stale, and independence results do not.

Add maxFailedReviewAttempts to the entry policy’s retry block to give reviews both a total failed-round cap and a per-location budget. The cap must be between 1 and 100000 and at least maxFailedAttemptsPerItem. Commands and setup still use maxFailedAttemptsPerItem. Reviews stop when the total cap is reached or a location appears in that many failed rounds. Locations are trimmed and up to two trailing numeric line/column segments are removed. Only findings meeting failOn count, once per location per round. Passes do not reset the counts. get_closeout reports the remaining total review budget and per-location counts separately. These review budgets survive re-enabling checks. An exhausted review stays blocked and needs operator intervention rather than session acceptance. Commands and setup still offer session acceptance when they reach their own limit.

The request

Chat Completions providers receive streaming requests at /chat/completions. Kyoto assembles text and tool calls from the stream before executing tools. Servers that return a single JSON completion are also supported. Providers using the Responses API follow their configured protocol.

A transport failure or an unsuccessful reply reaches the turn loop as an error. The session log records the result of the turn.

Fast mode

OpenAI names this service_tier. Kyoto reads tier names from strings or objects with an id in service_tiers, supported_service_tiers, and capabilities.service_tier. Codex also advertises additional_speed_tiers. priority is normalized to fast, so both provider names enable the same switch.

/fast, /fast on, and /fast off switch the current session. The command palette lists it as Service tier. A model that does not list fast refuses the switch. An enabled session sends service_tier: "priority" on its chat completion or Responses request. fast is the session-facing name; priority is the API tier. Title and rewrite requests stay on the default tier. A new session starts off. A subagent keeps the parent’s tier.