Skip to content

Agent integrations

xmsadik edited this page Nov 29, 2026 · 1 revision

An integration is a small set of hook entries (or, for OpenCode, a plugin) in the agent's own configuration. The agent calls Kotilo's hook helper on its events, and Kotilo turns them into states, permission cards, timeline entries and usage.

Installing

Open Settings → Agents → Agent integrations. Each agent card shows its avatar, whether its program is on PATH, the hook state (not installed, installed and up to date, needs an update, settings file can't be read), the path of the settings file and Install / Repair / Uninstall.

Settings, Agents: integration cards for Claude Code and Codex CLI

What the installer promises, for every agent:

  • Backup first. It writes <file>.kotilo-backup-<timestamp> next to the real file before changing anything, and shows the path.
  • Keeps your content. Your own settings, other tools' hooks for the same events and unrelated keys stay as they are.
  • Idempotent. Installing again, or Repair after a Kotilo update, replaces only Kotilo's own entries. Uninstall removes only Kotilo's entries.
  • Refuses what it doesn't understand. If the file is not valid JSON or has an unexpected shape, nothing is written and the card says so.

Every entry calls %LOCALAPPDATA%\kotilo\hub\bin\kotilo-hook.exe. The helper always exits silently, so it can never break an agent, even when Kotilo is closed. Prompt and response text is removed before anything is sent; only its length is kept.

A card can also explain why installed hooks stay silent:

  • The agent runs new hooks only after you approve them (Codex): approve the Kotilo hooks in /hooks. Kotilo never approves them for you.
  • Hooks only run in folders you trusted in Gemini.
  • Hooks are disabled in the agent's settings (Gemini hooksConfig.enabled, Qwen disableAllHooks, Droid hooksDisabled).

Supported agents

Agent Integration writes to Permission card keys Usage data Notes
Claude Code ~/.claude/settings.json 1 · 2 (always) · Esc From its transcripts Plan limits through the optional status line helper (below)
Codex CLI ~/.codex/hooks.json y · p (always, when offered) · Esc From its session files, with plan limits Approve the hooks in /hooks; no "waiting for input" signal
GitHub Copilot CLI ~/.copilot/hooks/ (its own file) 1 · Esc Tokens only after a clean /exit; no cost No plan limits
Gemini CLI ~/.gemini/settings.json 1 · Esc From its chat recordings Hooks run only in trusted folders
Qwen Code ~/.qwen/settings.json 1 · 2 (always) · Esc From its chat recordings
Factory Droid ~/.factory/hooks.json none yet: answer in the terminal From its session settings A change applies from its next session
OpenCode a plugin in ~/.config/opencode/plugins/ Enter · Esc From its database Restart OpenCode after installing
Cursor CLI ~/.cursor/hooks.json y · n No data Permission prompts are recognised on the screen, without details
Plain shells nothing PowerShell, cmd, Git Bash, WSL: working/idle from terminal activity

Gemini CLI, Qwen Code, Factory Droid and Cursor CLI support was built from their documentation and has not been checked against a live install yet. Agents change their hooks and keys; if something stops working, use Answer in terminal and please open an issue.

Claude Code plan limits

Claude Code reports its 5-hour and weekly limits only to its status line. To show them in Kotilo, turn on Settings → Agents → Claude Code → Show plan limits (status line).

  • Kotilo points Claude's status line at a small helper. The limits then appear on Overview, Mission control, the agent header and the tray.
  • Claude's status line itself gets a short 5h … · wk … · cache … summary. The cache part shows the session's prompt cache hit ratio and how long the cache stays warm (cache 93% (4m), later cold).
  • If you already have your own status line command, it keeps running and its output stays first. Turning the switch off restores it.
  • Pro and Max plans only, after the session's first reply.

Custom agents

Any other agent CLI can be added without code. In Settings → Agents choose Add custom agent. The wizard has five steps:

  1. Name: an id (lowercase letters, digits and -), a display name, an avatar letter and colour.
  2. Launch: the command New agent runs, its arguments, and the executable names that recognise the agent in a terminal.
  3. Permission keys (optional): what the card sends for Allow once, Always allow and Deny. A character (y, 1), a named key (Enter, Esc, Tab, Space, arrows), Ctrl+<letter>, or several separated by spaces (Down Enter).
  4. Screen rules (optional): a regular expression over the last lines of the agent's screen sets a state while it matches (needs permission, waiting for input, working or done), for prompts the agent doesn't report itself.
  5. Connect: the commands the agent, or a wrapper script, runs to report its state.

The custom agent wizard, step 4: screen rules with a pattern and a state

The definition is saved as %APPDATA%\kotilo\adapters\<id>\adapter.json. Edit and Delete on its card change or remove it; Reload definitions picks up a hand-edited file. A definition with an error is listed with the error and ignored until it is fixed.

Agent Integration Protocol

A custom agent reports its state with the hook helper that ships with Kotilo:

kotilo-hook --agent <id> --event <event> [--session <id>] [--json <payload>]
Event Meaning
session-start A session started (cwd in the payload sets the project)
working The agent works on a turn
waiting-permission It needs permission (tool, command or path appear on the card)
waiting-input It waits for your answer
done The turn finished
error The turn failed (kind: usageLimit, rateLimit, overloaded, auth, api)
session-end The session ended
usage Token counts (model, inputTokens, outputTokens, optional cachedTokens, costUsd)

Inside a Kotilo terminal the helper links the events to that tab. It never prints anything and always succeeds; when the background service is down it keeps the event and delivers it later. A program can also post the same events to the background service directly. The full specification is in docs/agent-protocol.md.

Clone this wiki locally