kojo

module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2026 License: Apache-2.0

README

kōjō 工場

A software factory you run yourself.

Agents that triage issues, fix bugs, build features, review pull requests and audit security,
each in a sandbox, checked against what your repository says "done" means, published as a pull request.

CI Latest release Docs Go version

Quick start · Concepts · Skills · Security model · Deploy · kojo.yaml

工場 (kōjō): a factory. Work comes in, goes through stations that each do one thing, is inspected against a standard, and leaves with a record of how it was made.

kōjō runs in your own infrastructure as one Go binary plus Postgres, works with any model, and keeps the definition of "done" as code in your repositories. A mention on an issue, a message in chat or a schedule starts a session. An orchestrator hands the work to skills, each run by a subagent in its own sandbox. A goal critic checks the result against the skill's goals, and a merge policy decides how far it goes: a draft pull request by default.

How it works

flowchart TD
  req["Issue · pull request · chat message<br/>CLI · MCP · schedule"] --> orch[Orchestrator]
  orch --> sub["Skill subagent<br/>fresh context per skill"]
  sub <-->|every command| sandbox[("Sandbox<br/>deny-all egress")]
  sandbox -->|allowlisted hosts only| proxy["kojo-proxy<br/>adds credentials on the way out"]
  sub --> critic[Goal critic]
  critic -. "rejected: try again" .-> sub
  critic --> policy[Merge policy]
  policy --> pr["Pull request<br/>draft by default"]

The core holds the credentials and never runs a repository command. Everything a repository or a model wants to run happens in the sandbox, which reaches the network only through kojo-proxy: it allows the hosts a skill names and adds credentials on the way out, so no secret is ever inside. Pushes are made by the core, through the forge's API, to kojo/* branches.


Every session is recorded step by step: what was asked, what each subagent ran, what the critic decided, and what it cost.

Works with

Code platforms GitHub (App), GitLab, Forgejo and Gitea, Bitbucket Cloud
Chat Slack, Mattermost, Discord, Microsoft Teams
Trackers Linear, Jira Cloud, Asana: a ticket assigned to kōjō, labelled for it or mentioning it starts work on the repository the ticket maps to, and the result comes back to 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 project or service maps to, which ends in a draft pull request a person reviews
Clients The kojo CLI, MCP for editors and coding agents, the HTTP API, the dashboard
Models Anthropic, OpenAI, Google Gemini (API key or Vertex AI), Azure OpenAI and Microsoft Foundry, Amazon Bedrock, OpenRouter, Ollama, or any OpenAI-compatible gateway such as hikyaku
Sandboxes Docker Sandboxes (sbx) on one VM, Kubernetes Agent Sandbox with gVisor or Kata, E2B; plain Docker for development
Deploy A Helm chart, or docker compose plus the binary on one VM

Quick start

Kubernetes, with sandboxes through Agent Sandbox:

helm install kojo oci://ghcr.io/xavidop/charts/kojo -f values.yaml

One VM, with sandboxes through Docker Sandboxes:

curl -fsSL https://xavidop.github.io/kojo/install.sh | sh    # the kojo binary, checksum checked
docker compose -f deploy/compose/docker-compose.yml up -d    # Postgres with pgvector
kojo setup github --public-url https://kojo.example.com      # registers the GitHub App
kojo serve -f kojo.yaml
kojo doctor --remote                                         # isolation, egress, permissions, branch protection

Then mention the bot on an issue: @kojo fix this. The quick start goes from the binary to a first draft pull request, and the install guide covers both paths with a sample kojo.yaml.

To check your own skills on every pull request that changes them, add the GitHub Action uses: xavidop/kojo@v0: it validates them, runs their evals and comments the pass rate (Skills CI).

Try it from a checkout, with no cloud account and no model key
git clone https://github.com/xavidop/kojo && cd kojo
make build
make eval          # every skill against its fixtures, in real sandboxes, on recorded model responses
make dev-sbx       # Postgres, a throwaway Forgejo, Slack and Sentry mocks and kōjō on http://localhost:8080
make e2e           # issue → draft pull request, Slack mention → reply, live config change → rollback,
                   # a campaign over four repositories, a Sentry alert → draft pull request, config export

Then comment @kojo-bot fix this on the demo repository's issue in Forgejo (http://localhost:3000), or use the CLI:

export KOJO_SERVER=http://localhost:8080 KOJO_TOKEN=dev-admin-token-not-a-secret
kojo run --repo forgejo/kojo-dev/demo --issue 1 "fix this"
kojo sessions list

make dev-kind brings up the Kubernetes stack on kind instead, with gVisor and Cilium. See Development.

Commands
Command What it does
kojo serve Runs the server: dashboard, API, webhooks, chat, MCP, workers and scheduler
kojo proxy Runs the egress and credential proxy as its own process (Kubernetes)
kojo migrate Applies pending database migrations
kojo run Starts a session and follows it
kojo sessions Lists, shows, follows, messages and cancels sessions
kojo eval Runs a skill against its eval fixtures, or on issues a repository already fixed (--history)
kojo config Exports and applies the runtime config, validates kojo.yaml
kojo skills Lists the skills in use, validates skill files
kojo mcp Serves the Model Context Protocol on stdio, for editors and coding agents
kojo doctor Checks that the deployment is safe and complete
kojo setup Creates the GitHub App, the Slack app manifest, the Teams app package or the Discord invite kōjō acts through
kojo schema Prints the JSON Schemas of kojo.yaml and the .factory/ files
kojo version Prints the version

Exit codes: 0 ok, 1 the thing asked for failed (a session, an eval, a doctor check), 2 usage or configuration, 3 infrastructure. The CLI reference has every flag.

Documentation

Start Build Run
Quick start Skills Deploy
Concepts Built-in skills Managing kōjō
Install Evals Observability
Security model Merge policy Sandboxes
Surfaces Memory CLI reference
Models Linked repositories kojo.yaml reference

The design document explains the reasoning behind kōjō; CLAUDE.md records where the build departs from it.

Contributing

Contributions are welcome: see CONTRIBUTING.md. Commits follow Conventional Commits and are signed off (DCO); there is no CLA. Report security issues through SECURITY.md.

License

Apache-2.0

Directories

Path Synopsis
cmd
kojo command
Command kojo is kōjō: the server, the egress proxy and the CLI in one binary.
Command kojo is kōjō: the server, the egress proxy and the CLI in one binary.
Package evals embeds the eval fixtures: small repositories with a seeded problem, one directory per case under fixtures/<skill>/<case>/, with the issues and pull requests a skill reads in case.yaml when it reads the forge.
Package evals embeds the eval fixtures: small repositories with a seeded problem, one directory per case under fixtures/<skill>/<case>/, with the issues and pull requests a skill reads in case.yaml when it reads the forge.
internal
app
Package app assembles kōjō from its deployment config: the store, the day-2 config manager, the model gateway, the sandbox driver and its proxy, the surfaces, the engine and the HTTP server.
Package app assembles kōjō from its deployment config: the store, the day-2 config manager, the model gateway, the sandbox driver and its proxy, the surfaces, the engine and the HTTP server.
cli
Package cli is the kojo command line: the server and the proxy, the commands that drive a running server (run, sessions, eval, config), and the ones that work on files (doctor, setup, skills validate, schema).
Package cli is the kojo command line: the server and the proxy, the commands that drive a running server (run, sessions, eval, config), and the ones that work on files (doctor, setup, skills validate, schema).
client
Package client is the HTTP client of kōjō's API.
Package client is the HTTP client of kōjō's API.
config
Package config holds kōjō's two kinds of configuration.
Package config holds kōjō's two kinds of configuration.
core
Package core is the factory itself: the orchestrator that delegates to skill subagents, the goal critic that checks their work, the merge policy that decides what happens to a change, and the scheduler.
Package core is the factory itself: the orchestrator that delegates to skill subagents, the goal critic that checks their work, the merge policy that decides what happens to a change, and the scheduler.
dashboard
Package dashboard is kōjō's web UI and its API, served by the same binary as everything else.
Package dashboard is kōjō's web UI and its API, served by the same binary as everything else.
doctor
Package doctor checks that a kōjō deployment is safe and complete: the database, the sandbox driver and its isolation, that egress is really blocked, the replicas of a remote kojo-proxy, the forges and their branch protection, chat, the model gateway, budgets, sign-in and the activation gate.
Package doctor checks that a kōjō deployment is safe and complete: the database, the sandbox driver and its isolation, that egress is really blocked, the replicas of a remote kojo-proxy, the forges and their branch protection, chat, the model gateway, budgets, sign-in and the activation gate.
eval
Package eval runs skills against fixture repositories (design §10).
Package eval runs skills against fixture repositories (design §10).
models
Package models is kōjō's model gateway client.
Package models is kōjō's model gateway client.
models/modelstest
Package modelstest fakes the HTTP APIs of the cloud model providers the embedded gateway calls: Azure OpenAI's v1 API, Amazon Bedrock's Converse and InvokeModel, and Vertex AI's generateContent with a Google OAuth token endpoint.
Package modelstest fakes the HTTP APIs of the cloud model providers the embedded gateway calls: Azure OpenAI's v1 API, Amazon Bedrock's Converse and InvokeModel, and Vertex AI's generateContent with a Google OAuth token endpoint.
proxy
Package proxy is kojo-proxy: the egress proxy every sandbox must go through.
Package proxy is kojo-proxy: the egress proxy every sandbox must go through.
report
Package report makes shareable session reports: a read-only, redacted page of one session that anyone with its link can open without signing in to the dashboard.
Package report makes shareable session reports: a read-only, redacted page of one session that anyone with its link can open without signing in to the dashboard.
sandbox
Package sandbox defines the driver interface the core uses to run untrusted code (repo code, model-written code) away from its own credentials.
Package sandbox defines the driver interface the core uses to run untrusted code (repo code, model-written code) away from its own credentials.
sandbox/docker
Package docker is the sandbox driver that runs each sandbox as a plain Docker container.
Package docker is the sandbox driver that runs each sandbox as a plain Docker container.
sandbox/e2b
Package e2b is the sandbox driver for E2B-compatible services: E2B Cloud, a self-hosted E2B, and CubeSandbox, which serves the same API.
Package e2b is the sandbox driver for E2B-compatible services: E2B Cloud, a self-hosted E2B, and CubeSandbox, which serves the same API.
sandbox/e2b/e2btest
Package e2btest is an in-process E2B-compatible service for tests: the control API and envd behind one HTTP server, as far as the e2b driver uses them (see internal/sandbox/e2b/api.go).
Package e2btest is an in-process E2B-compatible service for tests: the control API and envd behind one HTTP server, as far as the e2b driver uses them (see internal/sandbox/e2b/api.go).
sandbox/fake
Package fake is the sandbox driver unit tests use.
Package fake is the sandbox driver unit tests use.
sandbox/k8s
Package k8s is the sandbox driver for Kubernetes Agent Sandbox (kubernetes-sigs/agent-sandbox): one claim per session, isolated by the cluster's Kata or gVisor RuntimeClass.
Package k8s is the sandbox driver for Kubernetes Agent Sandbox (kubernetes-sigs/agent-sandbox): one claim per session, isolated by the cluster's Kata or gVisor RuntimeClass.
sandbox/sbx
Package sbx is the sandbox driver for Docker Sandboxes: one microVM per session, each with its own kernel and a private Docker daemon.
Package sbx is the sandbox driver for Docker Sandboxes: one microVM per session, each with its own kernel and a private Docker daemon.
skills
Package skills loads factory-as-code: the .factory/ files of a repository, the org's skills, and the built-in skills, layered in that order.
Package skills loads factory-as-code: the .factory/ files of a repository, the org's skills, and the built-in skills, layered in that order.
store
Package store is kōjō's persistence: the job queue, sessions and their checkpoints, the audit log, day-2 config revisions, skill drafts, team memory, eval results and the proposals kōjō makes for its own skills.
Package store is kōjō's persistence: the job queue, sessions and their checkpoints, the audit log, day-2 config revisions, skill drafts, team memory, eval results and the proposals kōjō makes for its own skills.
store/memory
Package memory is an in-process store.Store for unit tests and for `kojo eval --local`.
Package memory is an in-process store.Store for unit tests and for `kojo eval --local`.
store/postgres
Package postgres is kōjō's production store: one Postgres database holds the queue (FOR UPDATE SKIP LOCKED), sessions and checkpoints (JSONB), team memory (pgvector, with a full-text fallback), the append-only audit log, config revisions (hot reload through LISTEN/NOTIFY) and everything else.
Package postgres is kōjō's production store: one Postgres database holds the queue (FOR UPDATE SKIP LOCKED), sessions and checkpoints (JSONB), team memory (pgvector, with a full-text fallback), the append-only audit log, config revisions (hot reload through LISTEN/NOTIFY) and everything else.
store/storetest
Package storetest is the behaviour every store.Store must have.
Package storetest is the behaviour every store.Store must have.
surfaces/alerts
Package alerts is the interface every source of production alerts implements: an error tracker (Sentry) whose alert rule fires starts a session that reproduces and fixes the error on the repository the alert's project maps to.
Package alerts is the interface every source of production alerts implements: an error tracker (Sentry) whose alert rule fires starts a session that reproduces and fixes the error on the repository the alert's project maps to.
surfaces/alerts/alertstest
Package alertstest is an in-memory alert source for the core's and the app's tests, as trackertest is for issue trackers.
Package alertstest is an in-memory alert source for the core's and the app's tests, as trackertest is for issue trackers.
surfaces/asana
Package asana is Asana as an issue tracker: webhooks established with the X-Hook-Secret handshake and signed with X-Hook-Signature, and the REST API reached with the token of the Asana user or service account kōjō acts as.
Package asana is Asana as an issue tracker: webhooks established with the X-Hook-Secret handshake and signed with X-Hook-Signature, and the REST API reached with the token of the Asana user or service account kōjō acts as.
surfaces/bitbucket
Package bitbucket is the forge adapter for Bitbucket Cloud (api.bitbucket.org/2.0).
Package bitbucket is the forge adapter for Bitbucket Cloud (api.bitbucket.org/2.0).
surfaces/chat
Package chat is the interface every chat surface implements: Slack, Microsoft Teams, Discord and Mattermost.
Package chat is the interface every chat surface implements: Slack, Microsoft Teams, Discord and Mattermost.
surfaces/datadog
Package datadog is Datadog Error Tracking as a source of production alerts.
Package datadog is Datadog Error Tracking as a source of production alerts.
surfaces/discord
Package discord is the Discord chat adapter: mentions and direct messages in, replies and approval buttons out.
Package discord is the Discord chat adapter: mentions and direct messages in, replies and approval buttons out.
surfaces/forge
Package forge is the interface the core uses to talk to a code forge (GitHub, GitLab, Forgejo/Gitea, Bitbucket Cloud).
Package forge is the interface the core uses to talk to a code forge (GitHub, GitLab, Forgejo/Gitea, Bitbucket Cloud).
surfaces/forge/forgetest
Package forgetest is an in-memory forge.Forge for the core's unit tests and for dev stacks that run without a real forge.
Package forgetest is an in-memory forge.Forge for the core's unit tests and for dev stacks that run without a real forge.
surfaces/forgejo
Package forgejo is the forge adapter for Forgejo and Gitea, which share one API (config.Forgejo.BaseURL is the instance root).
Package forgejo is the forge adapter for Forgejo and Gitea, which share one API (config.Forgejo.BaseURL is the instance root).
surfaces/github
Package github is the forge adapter for GitHub: github.com, GitHub Enterprise Cloud with data residency (api.<tenant>.ghe.com) and GitHub Enterprise Server (config.GitHub.BaseURL, https://ghe.example.com/api/v3).
Package github is the forge adapter for GitHub: github.com, GitHub Enterprise Cloud with data residency (api.<tenant>.ghe.com) and GitHub Enterprise Server (config.GitHub.BaseURL, https://ghe.example.com/api/v3).
surfaces/gitlab
Package gitlab is the forge adapter for GitLab: gitlab.com or a self-managed instance (config.GitLab.BaseURL).
Package gitlab is the forge adapter for GitLab: gitlab.com or a self-managed instance (config.GitLab.BaseURL).
surfaces/jira
Package jira is Jira Cloud as an issue tracker: webhooks signed with the webhook's secret (X-Hub-Signature), and the REST API v3 reached with the API token of the Atlassian account kōjō acts as.
Package jira is Jira Cloud as an issue tracker: webhooks signed with the webhook's secret (X-Hub-Signature), and the REST API v3 reached with the API token of the Atlassian account kōjō acts as.
surfaces/linear
Package linear is the Linear issue tracker: webhooks signed with HMAC (Linear-Signature), and the GraphQL API reached with the personal API key of the Linear user kōjō acts as.
Package linear is the Linear issue tracker: webhooks signed with HMAC (Linear-Signature), and the GraphQL API reached with the personal API key of the Linear user kōjō acts as.
surfaces/mattermost
Package mattermost is the Mattermost chat adapter: mentions and direct messages in, threaded replies and approval buttons out.
Package mattermost is the Mattermost chat adapter: mentions and direct messages in, threaded replies and approval buttons out.
surfaces/mcp
Package mcp exposes the factory to editors and other coding agents over the Model Context Protocol: start a session, follow it and read its result, and everything else the dashboard and the CLI do (skills and drafts, runtime config and its history, schedules, evals, memory, the audit log, doctor).
Package mcp exposes the factory to editors and other coding agents over the Model Context Protocol: start a session, follow it and read its result, and everything else the dashboard and the CLI do (skills and drafts, runtime config and its history, schedules, evals, memory, the audit log, doctor).
surfaces/sentry
Package sentry is Sentry as a source of production alerts: an issue alert rule whose action is kōjō's internal integration sends a webhook signed with the integration's Client Secret, and kōjō reads the alert's issue through Sentry's API with a token of the same integration.
Package sentry is Sentry as a source of production alerts: an issue alert rule whose action is kōjō's internal integration sends a webhook signed with the integration's Client Secret, and kōjō reads the alert's issue through Sentry's API with a token of the same integration.
surfaces/slack
Package slack is the Slack chat adapter: mentions and DMs in, threaded replies and approval buttons out.
Package slack is the Slack chat adapter: mentions and DMs in, threaded replies and approval buttons out.
surfaces/teams
Package teams is the Microsoft Teams chat adapter: personal messages and mentions in, threaded replies and approval cards out.
Package teams is the Microsoft Teams chat adapter: personal messages and mentions in, threaded replies and approval cards out.
surfaces/tracker
Package tracker is the interface every issue tracker implements: Linear, Jira Cloud and Asana.
Package tracker is the interface every issue tracker implements: Linear, Jira Cloud and Asana.
surfaces/tracker/trackertest
Package trackertest is an in-memory issue tracker for the core's tests, as forgetest is for forges.
Package trackertest is an in-memory issue tracker for the core's tests, as forgetest is for forges.
version
Package version holds the build's version, set by the linker at release time (see .goreleaser.yaml).
Package version holds the build's version, set by the linker at release time (see .goreleaser.yaml).
Package schemas embeds the JSON Schemas of kōjō's files: kojo.yaml and the .factory/ files of a repository.
Package schemas embeds the JSON Schemas of kōjō's files: kojo.yaml and the .factory/ files of a repository.
examples
Package examples holds the example kojo.yaml files of the configuration reference.
Package examples holds the example kojo.yaml files of the configuration reference.
gen command
Command gen writes the JSON Schemas of kōjō's files from the Go structs that load them, and the configuration reference page of the docs site.
Command gen writes the JSON Schemas of kōjō's files from the Go structs that load them, and the configuration reference page of the docs site.
Package builtin embeds the official skills: every skill kōjō ships lives in this directory, in the public repository, in the same .factory/ format a repository uses for its own.
Package builtin embeds the official skills: every skill kōjō ships lives in this directory, in the public repository, in the same .factory/ format a repository uses for its own.
test
conformance
Package conformance is the one test suite every sandbox driver must pass (design §11.3).
Package conformance is the one test suite every sandbox driver must pass (design §11.3).
dashdev command
Command dashdev serves the dashboard against an in-memory store filled with demo data, with no Postgres, no forge, no sandbox and no model keys.
Command dashdev serves the dashboard against an in-memory store filled with demo data, with no Postgres, no forge, no sandbox and no model keys.
discordmock
Package discordmock is a stand-in for Discord, for tests.
Package discordmock is a stand-in for Discord, for tests.
e2e
Package e2e holds the end-to-end scenarios: whole flows through a running kōjō, its forge, its chat surface and its alert source, asserted on from the outside.
Package e2e holds the end-to-end scenarios: whole flows through a running kōjō, its forge, its chat surface and its alert source, asserted on from the outside.
sentrymock
Package sentrymock is a fake of the part of Sentry's web API that kōjō reads (internal/surfaces/sentry): an organization and its issues.
Package sentrymock is a fake of the part of Sentry's web API that kōjō reads (internal/surfaces/sentry): an organization and its issues.
sentrymock/cmd/sentrymock command
Command sentrymock serves the fake Sentry API of package sentrymock: the alerts.sentry.base_url of the development stacks (make dev-sbx, make dev-kind).
Command sentrymock serves the fake Sentry API of package sentrymock: the alerts.sentry.base_url of the development stacks (make dev-sbx, make dev-kind).
slackmock
Package slackmock is a stand-in for Slack, for tests and the local dev stacks.
Package slackmock is a stand-in for Slack, for tests and the local dev stacks.
slackmock/cmd/slackmock command
Command slackmock runs the Slack mock as a process, for the local dev stacks: kōjō's chat.slack.api_url points at http://<listen>/api/, and the mock delivers mentions, DMs and button clicks to kōjō when its control API (/mock/...) is called.
Command slackmock runs the Slack mock as a process, for the local dev stacks: kōjō's chat.slack.api_url points at http://<listen>/api/, and the mock delivers mentions, DMs and button clicks to kōjō when its control API (/mock/...) is called.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL