Surfaces

A surface is a place where a request reaches kōjō and where the answer goes back. There are five kinds:

  • Code platforms: GitHub, GitLab, Forgejo or Gitea, and Bitbucket Cloud, where the code lives and, except on Bitbucket, the issues. A webhook brings kōjō the mentions in issues and pull requests, and the events (a new issue, a new or updated pull request, a failed check) that can run a configured skill without a mention. kōjō answers in comments and opens pull requests there.
  • Chat platforms: Slack, Mattermost, Discord and Microsoft Teams. People ask in a direct message or with a mention, kōjō answers in the conversation, and asks there for approvals.
  • Issue trackers: Linear, Jira Cloud and Asana. A ticket assigned to kōjō’s account, labelled for it, or a comment that mentions it starts work on the repository the ticket maps to. kōjō answers in comments on the ticket, and the pull request it opens names the ticket.
  • Error tracking: Sentry and Datadog Error Tracking. An alert rule or monitor that fires for an error in production starts a session on the repository the error’s project or service maps to, which ends in a draft pull request kōjō never merges. Nothing is answered in the error tracker; the outcome can go to a chat channel.
  • Tools: the CLI and MCP. They call kōjō’s API with an API token, can name the skill to run and make a dry run, and can follow, message and cancel a session.

This page compares the surfaces of each kind and covers the CLI and MCP. Each code platform, chat platform, issue tracker and error tracker has its own page with its setup, listed at the end of this page. The rules for whose requests may change code are on Who may trigger what.

Square chutes carrying parcels and round tubes carrying envelopes all feed one orange intake hopper on a conveyor. Square chutes carrying parcels and round tubes carrying envelopes all feed one orange intake hopper on a conveyor.
Issues and pull requests from code platforms, messages from chat platforms, and calls from the CLI and MCP all go through the same intake and the same queue.

From a request to a session

Every surface ends in the same intake: a request is checked, queued as a session, and picked up by a worker. The surface a session came from is recorded on it as github, gitlab, forgejo, bitbucket, slack, mattermost, discord, teams, linear, jira, asana, cli, mcp, dashboard or schedule.

What each kind of request passes on the way to the queue:

flowchart LR
    W["Forge webhook"] --> V["Signature or token verified"]
    V --> T["Trigger rules: permission, automatic skill"]
    SL["Chat DM or mention"] --> RO["Sender's role in kōjō looked up"]
    TK["Tracker webhook"] --> TV["Signature verified"]
    TV --> TR["Person's role in kōjō looked up"]
    TR --> TM{"Ticket maps to one repository?"}
    TM -- no --> NT["Said on the ticket, nothing queued"]
    API["CLI, dashboard, MCP"] --> OP["API: operator role required"]
    SC["Schedule that is due"] --> SUB
    T --> SUB{"Repository of the request enabled?"}
    RO --> SUB
    TM -- yes --> SUB
    OP --> SUB
    SUB -- no --> RJ["Rejected"]
    SUB -- "yes, or no repository" --> Q["Request stored, session queued"]
    Q --> WK["A worker claims the session"]

The dashboard can also start sessions, and schedules start them on a timer. See Managing kōjō and Schedules.

A mention on the issue or pull request a session is working on, or a message in its chat thread, does not start another session when it comes from someone who may trigger work: it goes to that session as a message, which its next model step reads. See Talking to a session at work.

Two rules apply to every surface:

  • A repository is named forge/owner/name, for example github/acme/api or gitlab/group/subgroup/project.
  • A request for a repository that is not enabled is rejected, dry runs included. Enable repositories in the dashboard under Settings → Repositories. Enabling is refused unless the repository’s default branch is protected on the forge; dev: true skips that check.

Code platforms

A code platform reaches kōjō with a webhook, and kōjō answers on the issue or pull request the request came from.

Surface Inbound Authentication of the caller Answer goes to
GitHub POST /webhooks/github HMAC-SHA256 of the body (X-Hub-Signature-256) Comment on the issue or pull request
GitLab POST /webhooks/gitlab Secret token (X-Gitlab-Token) Comment on the issue or merge request
Forgejo, Gitea POST /webhooks/forgejo HMAC-SHA256 of the body (X-Forgejo-Signature or X-Gitea-Signature) Comment on the issue or pull request
Bitbucket POST /webhooks/bitbucket HMAC-SHA256 of the body (X-Hub-Signature) Comment on the pull request

The webhook paths are below server.public_url. A forge’s webhook route exists only when that forge is configured under forges in kojo.yaml. All keys are listed in the kojo.yaml reference.

Feature GitHub GitLab Forgejo Bitbucket
Start a session with free text Mention Mention Mention Mention, in a pull request
Automatic triggers (new issue, new or updated PR, failed check) Yes Yes Yes New or updated PR, failed build (no issues)
Name the exact skill to run Automatic triggers only Automatic triggers only Automatic triggers only Automatic triggers only
Dry run (nothing pushed or posted) No No No No
Interim replies while working Comment Comment Comment Comment
Approval buttons No No No No
Create a schedule in conversation No No No No
Reload .factory/ on push to the default branch Yes Yes Yes Yes
Follow steps live No No No No
Cancel a session No No No No
Short-lived clone credentials, scoped to one repository Yes No No No
Clone credentials a sandbox can only fetch with Yes Yes, at kojo-proxy or sbx’s proxy Yes, at kojo-proxy or sbx’s proxy Yes, at kojo-proxy or sbx’s proxy
Needs inbound access from the internet Yes Yes (from the GitLab instance) Yes (from the Forgejo instance) Yes (from Bitbucket Cloud)

Webhook responses

The same responses apply to every forge:

Status Meaning
401 The signature or token does not verify.
202 The delivery was accepted, ignored, or rejected by the trigger rules. The body says which. A forge does not retry or disable the hook for an event kōjō has no use for.
400 The payload could not be decoded.
413 The body is larger than 25 MiB or could not be read, for example because it did not arrive within 30 seconds.
500 The event could not be handled, for example because the forge API did not answer.
503 kōjō is already reading or handling 64 deliveries. The answer comes at once, with Retry-After. Not every forge sends a refused delivery again by itself; its webhook settings list recent deliveries and can redeliver one.

Redeliveries are de-duplicated by the forge’s delivery ID.

Chat platforms

People talk to kōjō on a chat platform by direct message or by mentioning the bot. kōjō answers in the conversation and asks there for approvals with buttons.

Surface Inbound Authentication of the caller Answer goes to
Slack Socket Mode, or POST /slack/events and POST /slack/interactive Slack request signature (http mode), app-level token (socket mode) Reply in the thread
Mattermost A WebSocket kōjō opens to the server; POST /mattermost/actions for button clicks Bot token on the WebSocket; a signature kōjō put on the button Reply in the thread
Discord The Discord gateway, a WebSocket kōjō opens Bot token Reply to the message
Microsoft Teams POST /teams/messages Bot Framework token on every request, checked against Microsoft’s published keys Reply in the thread

The Slack, Mattermost and Teams paths are below server.public_url. The Slack routes exist only in http mode, and the Mattermost and Teams routes only when that surface is configured under chat. All keys are listed in the kojo.yaml reference.

Feature Slack Mattermost Discord Teams
Start a session with free text DM or mention DM or mention DM or mention Personal chat or mention
Name the exact skill to run No No No No
Dry run (nothing pushed or posted) No No No No
Interim replies while working Thread reply Thread reply Reply to the message Thread reply
Message a session at work Mention in its thread, or reply in a DM thread Mention in its thread, or reply in a DM thread Reply to the message that started it or to kōjō’s answer Mention in its channel thread
Approval buttons Yes Yes Yes Yes
Create a schedule in conversation Yes Yes Yes Yes
Follow steps live No No No No
Cancel a session No No No No
Needs inbound access from the internet Only in http mode No; the Mattermost server must reach kōjō for button clicks No Yes

Approvals need a chat thread to ask in. A session that has none falls back to the more conservative outcome. The merge policy page has the rules.

Issue trackers

Teams that track work in an issue tracker hand it to kōjō there: by assigning a ticket to kōjō’s account, by adding a label kojo.yaml names, or with a comment that mentions kōjō. The ticket becomes a request on the repository the repos object maps it to, and kōjō answers on the ticket.

Surface Inbound Authentication of the caller Answer goes to
Linear POST /webhooks/linear Hex HMAC-SHA256 of the body (Linear-Signature), and a webhookTimestamp within a minute Comment on the issue
Jira Cloud POST /webhooks/jira sha256= and the hex HMAC-SHA256 of the body (X-Hub-Signature) Comment on the issue
Asana POST /webhooks/asana Hex HMAC-SHA256 of the body (X-Hook-Signature), keyed with a secret from the webhook’s handshake Comment on the task

The paths are below server.public_url. A tracker’s route exists only when it is configured under trackers in kojo.yaml. All keys are listed in the kojo.yaml reference.

Feature Linear Jira Asana
Start a session Assign the issue to kōjō, add a configured label, or mention kōjō in a comment Assign the issue to kōjō, add a configured label, or mention kōjō in a comment Assign the task to kōjō, or mention kōjō in a comment
Which repository repos.<id>.tickets: the team’s key or a project, and optionally a label repos.<id>.tickets: the project’s key, and optionally a label repos.<id>.tickets: the project’s ID, and optionally a tag
How a person gets a role The email Linear reports, or users users: account ID to email users: user ID to email
The pull request names the ticket Key in the title, Fixes or Refs with the key, and a link Key in the title, and a link The task’s URL in the description
Move the ticket as the session goes status: a workflow state of the team status: the transition to a status status: a section of the project
Interim replies while working Comment Comment Comment
Message a session at work Comment that mentions kōjō Comment that mentions kōjō Comment that mentions kōjō
Name the exact skill to run No No No
Dry run (nothing pushed or posted) No No No
Approval buttons No No No
Needs inbound access from the internet Yes Yes Yes

A ticket that maps to no enabled repository, or to several, starts nothing, and kōjō says so on the ticket. A ticket that already has a session at work does not start another when it is assigned or labelled again; a comment that mentions kōjō from someone with the operator role goes to that session as a message. A ticket’s session has no chat thread, so an approval the merge policy would ask for in chat takes the more careful outcome. A ticket’s text is not known to be public, so its session gets no shareable report, and the report of a confidential skill is never posted on a ticket.

kōjō answers a tracker’s delivery with 200 when it handled, ignored or turned it down, 401 when the signature does not verify, 413 when the body is larger than 25 MiB or did not arrive within 30 seconds, 500 when it could not handle it, and 503 when 64 deliveries are already being read or handled, which each of them retries. The same change delivered twice is handled once.

Error tracking

Teams that run Sentry or Datadog hear of an error in production before anyone files an issue. A Sentry issue alert rule whose action is kōjō’s internal integration, or a Datadog Error Tracking monitor that notifies kōjō’s webhook, sends kōjō the error each time it fires, and the session reproduces it and fixes it in the repository the repos object maps the error’s project or service to.

Surface Inbound Authentication of the caller Answer goes to
Sentry POST /webhooks/sentry Hex HMAC-SHA256 of the body (Sentry-Hook-Signature), keyed with the integration’s Client Secret A chat channel, when the mapping names one (notify); nothing is posted in Sentry
Datadog POST /webhooks/datadog A secret of at least 32 bytes in X-Kojo-Webhook-Secret, from a hidden custom variable of the webhook (Datadog signs nothing) A chat channel, when the mapping names one (notify); nothing is posted in Datadog

The path is below server.public_url, and a route exists only when its source (alerts.sentry, alerts.datadog) is configured in kojo.yaml.

  • Which repository: repos.<id>.alerts, by the Sentry project’s slug or the Datadog service’s name, and optionally the environment. An alert that maps to no enabled repository, or to several, starts nothing.
  • What it may do: an entry in fix mode (the default) lets the session change code; its pull request is always a draft that kōjō never merges, whatever the merge policy, because whoever can make the application fail chooses the error’s message. An entry in report mode runs a read-only session.
  • What the model sees: the error, its stack trace and the source lines of the application’s frames, as data inside the fence. The user, the request, breadcrumbs and other personal data of an event (on Datadog, a sample’s RUM session, trace and event) are never read.
  • Repeated alerts: one session at a time and one open pull request per issue, three sessions per issue, and max_per_day per mapping (default 10).

kōjō answers a delivery as soon as it is verified, since Sentry allows one second (Datadog fifteen): 200 when it accepted, ignored or dropped it, 401 when the signature or the secret does not verify, 400 when it cannot read the alert, 413 when the body is larger than 25 MiB (64 KiB for Datadog, whose secret header is checked before the body is read) or did not arrive within 30 seconds, and 503 when 64 deliveries are already being read or handled. A Datadog alert carries IDs only, so kōjō reads its issue before answering, for at most 8 seconds, and answers 503 when Datadog’s API failed in a way that may pass, for Datadog to send the delivery again.

Tools

The CLI and MCP call kōjō’s API with an API token.

Surface Inbound Authentication of the caller Answer goes to
CLI /api/v1 on the server API token The terminal
MCP kojo mcp on stdio, or /mcp on the server API token The tool result
Feature CLI MCP
Start a session with free text kojo run kojo_run
Name the exact skill to run --skill skill
Dry run (nothing pushed or posted) --dry-run dry_run
Plan first, and answer the plan --plan, kojo sessions approve, decline plan, kojo_plan_approve, kojo_plan_decline
Interim replies while working With --issue or --pr: comment With number: comment
Approval buttons No No
Create a schedule in conversation No kojo_schedule_propose, then kojo_config_put
Follow steps live Yes kojo_session_steps
Cancel a session Yes kojo_cancel
Needs inbound access from the internet No No

A session started from the CLI or MCP with an issue or pull request number posts its final answer as a comment on that issue or pull request, unless it is a dry run.

CLI

The CLI talks to a running server over its API. Point it at the server and give it an API token:

export KOJO_SERVER=https://kojo.example.com
export KOJO_TOKEN=<an API token>

Start a session and follow it until it ends:

kojo run --repo github/acme/api --issue 412 "fix this"
kojo run --repo github/acme/api --skill build-feature --issue 415
kojo run --repo github/acme/api --skill security-audit --dry-run "audit the auth package"
kojo run --repo github/acme/api --pr 418 --skill review-pr

Without --skill the orchestrator decides which skills to run. --dry-run does the work but pushes and posts nothing, and prints the diff. --detach prints the session ID and returns.

A request that names an issue or pull request by number and gives no title, such as kojo run --issue 415 with a skill and no text, gets that issue’s title from the forge. The title names the session and the pull request it opens. The same holds for MCP and the API.

Look at sessions afterwards:

kojo sessions list --repo github/acme/api --status running
kojo sessions show <session>
kojo sessions logs <session> --follow
kojo sessions cancel <session>

API tokens are static and come from server.auth.tokens in kojo.yaml. A token must be at least 16 characters long. Its role is viewer, skill:edit, operator or admin, and defaults to operator.

server:
  public_url: https://kojo.example.com
  auth:
    tokens:
      - name: ci
        token: ${KOJO_CI_TOKEN}
        role: operator

Every command, flag and exit code is in the CLI reference.

MCP

kōjō exposes the factory to editors and other coding agents over the Model Context Protocol, over stdio (kojo mcp) and over streamable HTTP at <public_url>/mcp. Every tool is one call to kōjō’s API with the caller’s API token, so an MCP client can do exactly what that token’s role allows.

The tools cover more than starting work: sessions (kojo_run, kojo_session, kojo_sessions, kojo_session_steps, kojo_cancel), skills and drafts, the runtime config with its history and rollback, schedules, evals, team memory, the audit log and doctor. Manage with MCP has the connection settings and the full list with the role each tool needs.

A session started with kojo_run is trusted in the same way as one started with kojo run: the API only lets a token with the operator role or higher start one.

Who may trigger what

kōjō decides who may trigger what before anything is queued. Every request is marked trusted or untrusted, and that mark follows the session to its end. The rules cover every kind of surface. Who may trigger what has them per trigger, with what an untrusted session may do, how to run a skill on a forge event without a mention, how forge permissions map, and kōjō’s own roles.

Platform pages

Code platforms:

  • GitHub: the GitHub App, its permissions and webhook events, and clone tokens.
  • GitLab: gitlab.com and self-managed GitLab, with an access token and a webhook.
  • Forgejo and Gitea: a bot user that administers each repository, its token and a webhook.
  • Bitbucket: Bitbucket Cloud, with a bot account that administers each repository, its API token and a webhook.

Chat platforms:

  • Slack: socket or http mode, the app manifest, approvals and schedules in a thread.
  • Mattermost: a bot account over the server’s WebSocket, and signed approval buttons.
  • Discord: a bot on the gateway for one server, with kōjō roles mapped from the server’s roles.
  • Microsoft Teams: an Azure Bot registration, the Teams app package, and other clouds.

Issue trackers:

  • Linear: a Linear user with an API key, a signed webhook, and teams or projects mapped to repositories.
  • Jira: an Atlassian account with an API token, a webhook with a secret, and projects mapped to repositories.
  • Asana: a user or service account with a token, webhooks per project with their handshake, and projects mapped to repositories.

Error tracking:

  • Sentry: an internal integration whose alert rule action sends errors to kōjō, projects mapped to repositories, draft pull requests and report mode.
  • Datadog: an Error Tracking monitor that notifies kōjō’s webhook, the secret header, services mapped to repositories, and what differs from Sentry.

For every kind:

  • Who may trigger what: trust per trigger, automatic triggers, forge permissions and kōjō’s roles.
Scroll to move. + - zoom, 0 fit, Esc close.100%