Development

These pages are for people who change kōjō itself: how to build it, what is where, how to run it locally, which tests exist and what each needs. Contributing covers the rules for a pull request.

This page covers the build, the make targets, the repository layout, the generated schemas, the docs site, lint and releases. Two pages cover the rest:

  • Local stacks: the whole factory on your machine, with a throwaway Forgejo, Slack and Sentry mocks and mock models; a first session, live models, the kind stack.
  • Testing: the test layers and what each needs, the fakes and mocks, and the model recordings the mock provider replays.

The local stacks are also the way to watch a session without a forge account or a model key. To install kōjō and use it, start at the quick start.

Build from source

kōjō is one Go module, github.com/xavidop/kojo, and one binary, cmd/kojo. go.mod asks for Go 1.27.4. The build needs no C compiler: it runs with CGO_ENABLED=0.

git clone https://github.com/xavidop/kojo
cd kojo
make build
./bin/kojo version

make build runs go build ./... and writes bin/kojo. A build from source reports the version dev, with the commit and the build time.

To use a source build for an install, copy it onto the host’s PATH:

sudo install -m 0755 bin/kojo /usr/local/bin/kojo

The files of the single-VM install are in deploy/compose (docker-compose.yml, kojo.yaml, .env.example, initdb/), and the systemd unit is deploy/systemd/kojo.service. make docker and make toolchain build the two images locally, tagged dev. Docker Sandboxes pulls a sandbox’s base image from a registry, so with the sbx driver sandbox.image must name an image that a registry serves.

Make targets

make help lists the targets. make all is what CI runs on every pull request.

Target What it does Needs
all fmt, vet, check-claims, schema-check, test and lint, in that order Go, golangci-lint, python3
build go build ./... and writes bin/kojo Go
test go test ./...: unit tests, the surfaces against fakes, driver conformance on the fake driver Go
race go test -race ./... Go
vet go vet ./... with the default build and with -tags integration, and go vet -tags e2e ./test/e2e/... Go
lint golangci-lint run golangci-lint v2
lint-integration golangci-lint run --build-tags integration, then the same with --build-tags e2e on ./test/e2e/... golangci-lint v2
fmt Fails and lists the files that are not gofmt-clean. It rewrites nothing. Go
tidy go mod tidy Go
vuln govulncheck, skipping the IDs in .github/govulncheck-ignore govulncheck
check-claims Fails when the README or the docs name a kojo command that does not exist, or leave one undocumented Go, python3
schema Regenerates schemas/*.json and the config reference page from the Go structs Go
schema-check Fails when the committed schemas or the config reference page differ from what make schema generates Go
integration go test -tags integration ./... against a throwaway Postgres with pgvector Go, Docker
conformance The driver conformance suite on the fake driver, or DRIVER=docker, k8s or sbx for a real one Go, jq, and the driver’s backend
e2e The end-to-end scenarios of test/e2e against the running local stack (scripts/e2e.sh) Go, jq, a stack started with make dev-sbx or make dev-kind
eval Builds bin/kojo, then runs kojo eval --all --local -f evals/kojo.eval.yaml on recorded model responses; SKILL=<name> limits it to one skill, EVAL_ARGS adds flags Go, Docker
record Runs the same evals against the live model with KOJO_LIVE_MODELS=1 and KOJO_RECORD=1, and writes its answers under out/recordings/evals/recorded/ Go, Docker, ANTHROPIC_API_KEY
dev-sbx The local stack on docker compose (scripts/dev-sbx.sh) Docker, curl, jq, Go
dev-kind The local stack on kind (scripts/dev-kind.sh) Docker, kind, kubectl, helm, Go, jq
dev-down Stops both local stacks and deletes their data Docker, kind
helm-lint helm lint --strict and helm template with the defaults and every values file under charts/kojo/ci, checks the vendored Agent Sandbox release, and validates the kojo.yaml the chart renders with the binary helm, Go
helm-test Installs the chart on a kind cluster with chart-testing (scripts/helm-test.sh) Docker, kind, Go
docker Builds the image locally as ghcr.io/xavidop/kojo:dev from a Linux build of the binary Docker, Go
toolchain Builds the sandbox toolchain image locally as ghcr.io/xavidop/kojo-toolchain:dev and smoke-tests it (scripts/toolchain-build.sh) Docker
site-dev Runs the docs site dev server Node 26 through nvm
site-build Builds the docs site Node 26 through nvm
site-linkcheck Builds the docs site and fails on a broken internal link Node 26 through nvm
notices Regenerates THIRD_PARTY_LICENSES.csv and THIRD_PARTY_NOTICES.md go-licenses, git
clean Removes dist, bin, completions, site/dist, site/.astro, .kojo and out

Repository layout

Path What it holds
cmd/kojo The binary’s main. It calls internal/cli.
internal/ All Go code. kōjō is an application, not a library.
skills/ The built-in skills, embedded in the binary. Each is a SKILL.md, a goals.yaml and a kit.yaml.
evals/ The eval fixtures (evals/fixtures/<skill>/<case>/), embedded in the binary, and the two configs make eval and make record run with.
schemas/ The JSON Schemas of kojo.yaml and the .factory/ files, and schemas/gen, which generates them.
charts/kojo The Helm chart.
deploy/compose The single-VM install and its development overlay.
deploy/systemd A systemd unit for kojo serve on the host.
deploy/toolchain The Dockerfile of ghcr.io/xavidop/kojo-toolchain, the image a sandbox runs when a skill’s kit names none.
test/ conformance (the suite every sandbox driver must pass), e2e (the end-to-end scenarios), security (the adversarial tests), kind (the kind cluster), slackmock (the Slack mock), sentrymock (the Sentry mock), dashdev (the dashboard on demo data).
testdata/recordings The recorded model responses the mock provider replays.
site/ The Astro documentation site. site/public/install.sh is the installer.
scripts/, .github/scripts/ What the Makefile and CI call.
docs/design.md The design document. Where the build differs, CLAUDE.md records it.

The packages under internal/:

Package What it is
app Assembles kōjō from kojo.yaml: store, config manager, model gateway, sandbox driver, proxy, surfaces, engine, HTTP server.
cli The cobra command tree. The commands are thin wrappers around app and client.
client The HTTP client of kōjō’s API, used by the CLI’s remote commands and the MCP server.
config Both configurations: kojo.yaml (boot.go, load.go) and the runtime config objects stored as revisions (runtime.go, manager.go).
core The factory: engine and workers, session state machine, orchestrator, subagents and their tools, goal critic, merge policy, intake, scheduler.
dashboard The API under /api/v1 and the embedded web UI (web/, plain ES modules, no build step).
doctor The checks of kojo doctor.
eval Runs skills against the fixture repositories.
models The model gateway on Genkit Go, the mock provider and the recorder. Nothing else imports Genkit. models/modelstest fakes the cloud providers’ APIs for tests.
proxy kojo-proxy: the egress proxy that allowlists hosts and sets credentials.
sandbox The driver interface. sandbox/k8s, sandbox/sbx, sandbox/docker and sandbox/fake are the drivers.
skills Loads and layers skills: a repository’s .factory/, the org’s skills, the built-in ones.
store The persistence interface. store/postgres is production, store/memory backs unit tests and kojo eval --local, store/storetest is the suite both pass.
surfaces forge and chat are the contracts; github, gitlab, forgejo, slack and mcp implement them; forge/forgetest is an in-memory forge.
tools Pins build dependencies behind the tools build tag.
version The version, commit and date, set by the linker.

Schemas and the config reference

The JSON Schemas are generated from the Go structs that load the files, so they match what the binary accepts.

make schema
make schema-check

make schema runs go run ./schemas/gen schemas site/src/pages/docs/config-reference.md. It writes schemas/*.schema.json (kojo, skill, goals, kit, factory, schedules, config-export) and the kojo.yaml reference page. Do not edit that page by hand: change the struct or its comment and regenerate. make schema-check generates into a temporary directory and fails when anything differs from what is committed; it is part of make all.

kojo schema prints the same schemas from the binary, and the site publishes them, for example kojo.schema.json.

The docs site

The site is an Astro project under site/. Pages are Markdown files under site/src/pages/docs/.

make site-dev
make site-build
make site-linkcheck

The targets load Node 26 through nvm and run npm install first. site-linkcheck builds the site and checks its internal links.

make check-claims runs .github/scripts/check_docs_claims.sh. It fails when the README, CONTRIBUTING.md, the chart’s README or a page under site/src/pages/docs names a kojo command the CLI does not have, and when a command of kojo --help is named nowhere. To check one file:

KOJO_BIN=bin/kojo bash .github/scripts/check_readme_claims.sh site/src/pages/docs/cli.md

Lint, format and vulnerabilities

Target Tool Notes
make fmt gofmt Checks only. Run gofmt -w on the files it lists.
make vet go vet Both build configurations.
make lint golangci-lint v2 .golangci.yml enables the standard set: errcheck, govet, ineffassign, staticcheck, unused.
make lint-integration golangci-lint v2 The same with the integration and e2e build tags.
make vuln govulncheck Reachable vulnerabilities only. .github/govulncheck-ignore lists accepted IDs with the reason.
make tidy go mod tidy

Releases

Releases are driven by Conventional Commits. Nobody tags by hand.

  1. On every push to main, the Release workflow (.github/workflows/release.yml) builds a snapshot of the binary and smoke-tests it with kojo version and kojo --help, before anything is tagged.
  2. semantic-release (.releaserc.json) analyses the commits since the last release, decides the next version, updates CHANGELOG.md and pushes the tag vX.Y.Z. Without a releasable commit the workflow stops here.
  3. GoReleaser (.goreleaser.yaml) cross-compiles the binary for Linux, macOS and Windows on amd64 and arm64 and creates the GitHub Release: archives with the shell completions, .deb, .rpm and .apk packages, checksums.txt signed with cosign, SBOMs, the multi-arch image ghcr.io/xavidop/kojo signed by digest, the Homebrew cask and the Scoop manifest.
  4. SLSA provenance for the archives and packages is attached as kojo.intoto.jsonl.
  5. The Helm workflow (.github/workflows/helm.yml) packages the chart at the same version, attaches it to the release, indexes it on the gh-pages branch and pushes it to oci://ghcr.io/xavidop/charts/kojo.
  6. The sandbox toolchain image (deploy/toolchain) is built for linux/amd64 and linux/arm64, smoke-tested, pushed to ghcr.io/xavidop/kojo-toolchain at the same version and signed.
  7. The Docs workflow (.github/workflows/pages.yml) redeploys the site, which serves the installer and the chart index.

The Release workflow can also be started by hand with an existing tag, to publish a tag whose GitHub Release is missing.

The other workflows:

Workflow Runs Does
ci.yml every pull request and push to main tests with the race detector and coverage, lint, gofmt, claim checks, schema check, build of the binary and the image, integration tests, driver conformance (fake, docker, sbx where the runner has KVM, k8s on kind), the skill evals with recorded models (make eval), the end-to-end scenarios on the compose stack and on the kind stack (make e2e), the toolchain image (make toolchain), govulncheck, helm lint, docs build and link check
helm.yml every pull request and push to main, and release tags make helm-lint, ct lint, ct install on kind; publishes the chart for a release tag
nightly.yml 03:17 UTC, and pushes to main that change skills/ or evals/ end-to-end scenarios and skill evals with live models, the security suite, conformance on a cluster with Kata. A job whose requirement is missing is skipped and reported, not passed.
pages.yml pushes to main that change site/ or schemas/ builds and deploys the docs site
Scroll to move. + - zoom, 0 fit, Esc close.100%