Plan first

Before a session changes code, it can write a plan and wait for a person to approve it. Turning down a bad plan costs one planning call; turning down a bad pull request costs a whole session. This page is for admins who decide when sessions plan, and for maintainers who answer plans.

When a session plans

A session plans when one of these asks for it:

What asks How
The request kojo run --plan, "plan": true in POST /api/v1/sessions, or plan in MCP’s kojo_run.
A label The issue or pull request the request is about has the label kojo:plan, or the label settings/plan names. kōjō reads the labels once per session, when it is about to run the first skill that changes code.
settings/plan mode: skills plans before the skills it lists; mode: always before every skill that changes code. The default is off: only a request or a label asks for a plan.

kōjō never guesses from the text of a request whether it wants a plan.

The default is off so that installing a new version changes nothing: sessions that ran on their own before, including scheduled ones and ones started from the API, keep doing so. Turn it on for the skills that make large changes, for example mode: skills with skills: [build-feature].

Only a skill that can change the workspace waits for a plan. These never plan:

  • A skill that cannot change the workspace (its goals set no_changes, or it has no tool that writes). Read-only skills that the orchestrator runs before the first skill that changes code run without waiting.
  • A request from someone who may not change code. Such a request only reaches read-only skills, so there is nothing to approve: it runs as it always did, without a plan and without waiting. See Who may trigger what.
  • A dry run (skill tests, evals), a follow-up on one of kōjō’s own pull requests (the pull request is already under review), a feedback session, a skill proposal, and a request without a repository.

POST /api/v1/sessions refuses plan together with dry_run.

When in the session

The plan comes after the orchestrator chose a skill that changes code and before that skill runs. When the orchestrator’s turn names several skills, the plan comes before any of them runs, and once the plan is approved the whole turn runs. A request that names its skill (--skill, a schedule, an automatic trigger) plans before that skill. A session plans once: after the go-ahead, later skills run without another plan.

What the plan holds

One model call on the strong tier reads the repository and writes the plan. It has only tools that read: read_file, list_files, search, memory_search, get_issue, and get_pr and get_pr_diff for a pull request. It sees the request (inside the same fence as any text from outside), the task the orchestrator wrote for the skill, the skill’s instructions and the names of its checks, the repository’s AGENTS.md and team memory. It hands in:

Part What it says
Approach How the work will go
Files likely to change Paths
Risks What could break, and what a reviewer should look at
Tests The tests the work will add or run
Not part of this work What it leaves alone

kōjō adds a rough cost when it has one: the median cost of up to ten recent sessions that ran the same skill (read from the audit log; dry runs are left out), and the per-session budget the session stops at.

The planning call has at most 16 model turns. Its calls are steps of the session, under a plan step in the replay, and count in the session’s cost and against its budgets like any other call. The plan records what writing it cost (cost_usd).

Where it is posted

The request came from The plan is posted Answer with
A mention on an issue or pull request As a comment there A comment that mentions kōjō and says only go, or the dashboard, the API, MCP, the CLI
A chat thread As a question with Approve and Deny buttons in the thread The buttons, go in the thread, or the dashboard, the API, MCP, the CLI
The API, the CLI, MCP, a schedule Nowhere: it is on the session’s page in the dashboard and in the session’s result The dashboard, the API, MCP, the CLI

From the dashboard, the API, MCP and the CLI:

Approve Decline
The Approve button on the session’s page The Decline button
POST /api/v1/sessions/{id}/plan/approve POST /api/v1/sessions/{id}/plan/decline
kojo_plan_approve kojo_plan_decline
kojo sessions approve <session> kojo sessions decline <session>

kojo run --plan stops following the session when the plan is posted, prints it, and says how to answer.

The go command

A message approves the plan when its whole text, leaving out mentions of the bot (@kojo, Slack’s <@U…>, Teams’ <at>…</at>), is the word go, in any case, with an optional ! or . after it. @kojo go, @kojo GO! and go in the chat thread approve it. go ahead, @kojo go, but keep the header or **go** do not: they ask for a revised plan. kōjō reads no other wording as a decision.

A go on the issue, pull request or thread of a session whose plan already closed (declined, expired, or the session ended) is answered with what became of the plan, and starts nothing.

go is the only wording kōjō acts on: a message never cancels a session, and nothing but the single word go approves a plan.

Who may answer

Only someone who could have started the work answers its plan:

  • On a forge: a mention from someone with the repository’s trigger_permission. Anyone else’s mention is rejected, as any mention of theirs is, with nothing posted and a request.reject entry in the audit log. The plan keeps waiting.
  • In chat: someone with the operator or admin role, for the buttons and for messages in the thread. A click from anyone else changes nothing and is answered with the role it needs.
  • The dashboard, the API, MCP and the CLI: the operator role.

Revisions

Any other message from someone who may answer asks for a revised plan: a mention on the issue or pull request, a message in the chat thread, or kojo sessions message (POST /api/v1/sessions/{id}/messages, kojo_session_message). The message is stored with the session’s messages and answered where it was written. kōjō then writes the plan again from the previous plan and the message, posts the revised plan, and waits again. The message also goes to the work as guidance, like any message to a session at work, within the same limits (4000 characters, 20 messages per session).

A session writes at most max_revisions revised plans (default 3). A further request declines the plan, in kōjō’s name, and the session ends without changing anything. A webhook or chat event delivered twice asks for one revision, not two.

The deadline

The plan waits as long as the merge policy’s approval_timeout (default 2 hours), counted from when each plan or revised plan is posted. Without an answer by then, nothing is changed: the session ends with the outcome plan_expired and says so where the request came from. A declined plan ends with plan_declined. Neither session fails. An answer after the deadline is told it came too late and changes nothing.

The deadline is in Postgres, so a session waiting on a plan survives a restart: any replica picks it up when someone answers or when the deadline passes.

The sandbox while the plan waits

The planning call reads the repository in a sandbox like the one the skill would get. When the plan is posted, kōjō destroys that sandbox: a session waiting on its plan holds none. After the go-ahead, the work starts in a new sandbox, from a fresh clone of the repository as it is then.

When skills that ran before the plan already changed the workspace, kōjō keeps the sandbox instead, since it holds their work. The plan’s deadline then also closes 30 minutes before the sandbox reaches the end of its life (sandbox.ttl), as the merge policy’s question to open a pull request does.

After the go-ahead

The session goes on where it stopped. kōjō says where the request came from that the work starts. Each skill that changes code gets the approved plan with its task, inside the fence that marks text a model must not take as instructions, with the instruction to follow it and to say in its report where the work showed it was wrong.

The approved plan is kept in the session’s result (result.plan), shown on the session’s page, and written into the pull request’s description under “Plan”, with who approved it and after how many revisions.

Audit

Action When
plan.ask A plan or a revised plan was posted
plan.decide A plan was approved, declined or sent back for a revision through go, a message, the dashboard, the API, MCP or the CLI
approval.decide A plan was approved or declined with a chat button
approval.expire The plan’s deadline passed without an answer
approval.late Someone answered after the deadline
session.message A message asked for a revised plan
Scroll to move. + - zoom, 0 fit, Esc close.100%