Skip to content

Work with your agent

The chain in v4 is: you → your agent → kj → git. You describe outcomes; your agent (any CLI: Claude Code, Codex, Gemini, Cursor) does the work; kj gives it method, memory and a second pair of eyes; git refuses anything unverified.

You almost never type kj yourself. Your agent does — the playbook installed by kj env install orders it to.

From your agent: once the project turns it on (kj gates set claims warn or block, off by default), every hard fact in your agent’s final message, a number or a “tests pass”, is cross-checked against what its own session actually executed; kj claims check --file does the same for a PR body or a card. Each fact comes back backed, unbacked or disproven by its own terminal; with block, a disproven one stops the turn before it ships, and with warn it is only reported. You read the PR knowing its claims survived that check.

Under the hood: kj claims check runs the cross-check over the session’s transcript — the transcript is the register of sources, so “did this actually happen?” is answerable, not trusted.

From your agent: the project declares its guarantees (“the suite passes”, “there is a recent audit”), and the Steward re-verifies them each time kj steward sweep runs, on demand or, if the project opts in, on a schedule. Stale evidence stops counting (an expired guarantee reads as unknown, never green), and every break lands on the board as PROPOSED work that nothing executes unreviewed. Projects rot exactly when nobody is looking; this looks.

Under the hood: kj steward sweep runs the check on demand, or as an opt-in scheduled Action.

A task is DONE when its done-statement is literally true, the suite is green, and every commit carries a cross-AI verdict. The invariants:

  • RAG before assuming — kj rag query answers questions about the codebase; the index is built on install and refreshes itself on drift.
  • Card first, on YOUR board — work is tracked before it starts in the board the project declares (state_backend in config): kj’s HU Board (kj hu add|move|list — your agent creates the card before it codes), your Planning Game, or the board you already use — Linear, Trello, Jira, GitHub Issues — worked through your agent’s own MCP/tools (state_backend: external + board.name; kj never mirrors it). kj env install verifies the board is reachable — Karajan does not run without one. Architecture decisions live as git-tracked ADRs: kj adr add|list.
  • A team on one repo — kj hu backend github turns the shared HU Board on once: it writes .karajan/board.yml, which you commit in a PR so every clone inherits it. From then on each HU is a GitHub issue: its id is HU-<issue number>, so two people never mint the same one; kj hu move <id> running assigns it to you (the assignee is the reservation), and moving a running HU someone else holds needs --release. Each clone declares its GitHub login with kj identity set. Without board.yml, kj keeps the local board.
  • Parallel work in lanes — more than one task at a time? kj worktree start <slug> gives each its own isolated worktree; every review verdict is stamped with the workspace it ran from, so isolation claims are auditable.
  • Tests prove behavior — failing test first, suite never left red.
  • Cross-AI review before commit — a different AI reviews every diff.
  • Security findings are never overridable.
  • Branch first — the base branch only moves via PR.
  • kj brief <role> — the distilled method of a role (triage, planner, researcher, architect, tester, security, audit) as mission + invariants + deliverable. Your agent absorbs these roles; the briefs keep it honest.
  • kj agent run <agent> "<task>" — delegate work to another AI. kj handles the subprocess plumbing; your agent reads the output and decides.
  • kj solomon --position "<why>" — when your agent disagrees with a rejected review, a third AI arbitrates (never the brain, never the reviewer). Its ruling is recorded and obeyed — except security findings, which nobody overrides.
  • kj report-issue — your agent hits a kj bug? It diagnoses it and files a sanitized issue upstream (no project code, no paths, no personal data), after asking you. The ecosystem repairs itself.

Your agent’s conversation keeps growing, and every turn re-reads all of it on its top model. Writing every card there costs more than it needs: most cards do not need the top model, and none needs the whole conversation. So the work is split, as kj run split it before 5.0:

  1. Plan with a tier. As your agent plans, it judges how much model each card needs and says so on creation: kj hu add "<card>" --tier trivial|standard|deep --tier-reason "<why>". kj crosses it with its own signal: the higher one wins, and anything touching auth, secrets, migrations or the Sentinel is always deep. The tier lives on the card (a kj:tier:<level> label on the shared GitHub board), so anyone can change it there. kj hu tier <id> reads it.
  2. kj test writes the tests, kj code writes the code. kj test --card <id> --brief has another model write the card’s failing tests from its criteria: roles.tester if you set it, else Solomon’s agent and model, never the coder. Then kj code --card <id> --brief runs the coder of your panel in a clean context, on the model of the card’s tier, to make them pass. The coder may not change those tests. --brief hands your agent only the end of each answer, so its own context stays small. A model you chose always wins.
roles:
tester:
provider: codex
  1. The review judges it, and a rejection climbs. Your agent runs kj review --staged as always. If the review rejects it, kj code --card <id> --retry --brief gives the coder that review’s findings, on the most capable model.

The first time your agent goes to write a planned card’s code itself, the Sentinel stops it once with the command (see the Sentinel guide). It can still write it: a second try passes, and the decision is recorded.

Self-review rubber-stamps. In v4 the reviewer is always a different agent than the one that orchestrates: your panel’s reviewer, or another installed CLI when that one is the host (Claude orchestrates → Codex reviews, and vice versa), and its verdict binds to the sha256 of the exact diff: change one byte and the verdict is void. This is not a convention: once .karajan/review-gate is committed (kj env install or kj review --install-gate creates it), the pre-commit gate enforces it, and CI checks it again. In this repo’s own development, the cross reviewer has repeatedly rejected the author’s first version with real findings. It works on us; it will work on you.

Karajan Code™ · AGPL-3.0