Skip to content

CLI Commands

CommandDescription
kj initInteractive setup wizard
kj run <task>Full pipeline: coder → sonar → reviewer
kj code <task>Coder-only mode
kj review <task>Reviewer-only mode
kj plan <task>Generate implementation plan
kj scanRun SonarQube analysis
kj doctorCheck environment
kj configShow configuration
kj reportSession reports with budget tracking
kj resume <id>Resume paused session
kj rolesInspect pipeline roles and templates
kj agentsList or set AI agent per pipeline role
kj audit [task]Read-only codebase health audit (5 dimensions, A-F scores)
kj board <subcommand>Manage HU Board dashboard
kj sonar <subcommand>Manage SonarQube Docker container

Global options: --help, --version


Initialize configuration, review rules, and SonarQube setup.

Terminal window
kj init [options]
FlagTypeDefaultDescription
--no-interactivebooleanfalseSkip wizard, use defaults (for CI/scripts)

What it does:

  • Creates ~/.karajan/kj.config.yml with sensible defaults
  • Creates review-rules.md and coder-rules.md in the project
  • Detects available AI agents and guides selection
  • Starts SonarQube Docker container if enabled

Examples:

Terminal window
# Interactive setup
kj init
# Non-interactive (CI/CD)
kj init --no-interactive

Full pipeline: coder → refactorer → sonar → reviewer loop with optional pre/post stages.

Terminal window
kj run "<task>" [options]

The <task> argument accepts:

  • A plain text description: "Fix the login bug"
  • A Planning Game card ID: "KJC-TSK-0042" (when --pg-project is set or config has planning_game.project_id)
FlagTypeDefaultDescription
--coder <name>stringfrom configAI agent for coding (claude, codex, gemini, aider, opencode)
--reviewer <name>stringfrom configAI agent for review
--planner <name>stringAI agent for planning
--refactorer <name>stringAI agent for refactoring
--coder-model <model>stringSpecific model for coder (e.g., sonnet, opus)
--reviewer-model <model>stringSpecific model for reviewer
--planner-model <model>stringSpecific model for planner
--refactorer-model <model>stringSpecific model for refactorer
FlagDefaultDescription
--enable-planneroffEnable planner stage
--enable-refactoreroffEnable refactorer stage
--enable-researcheroffEnable researcher stage (codebase investigation)
--enable-testeroffEnable tester stage (test quality gate)
--enable-securityoffEnable security audit stage (OWASP)
--enable-triageoffEnable task complexity classification
--enable-revieweronEnable reviewer stage
--enable-serenaoffEnable Serena MCP integration
--enable-impeccableoffEnable Impeccable design audit (automated UI/UX quality gate)
--enable-hu-revieweroffEnable HU story certification (user story quality gate)
--hu-file <path>stringPath to user story file for HU reviewer
--auto-simplifyonAuto-simplify pipeline for triage level 1-2 (coder-only, skip reviewer/tester)
--no-auto-simplifyDisable auto-simplify: always run full pipeline regardless of triage level
FlagTypeDefaultDescription
--mode <name>stringstandardReview strictness: paranoid, strict, standard, relaxed
--methodology <name>stringauto-detectedDevelopment approach: tdd or standard. Auto-detected from project test framework since v1.25.0
--reviewer-fallback <name>stringcodexFallback reviewer if primary fails
--reviewer-retries <n>number1Max reviewer retry attempts
--coder-fallback <name>stringFallback coder if primary hits rate limit
FlagTypeDefaultDescription
--max-iterations <n>number5Max coder/reviewer loops
--max-iteration-minutes <n>number15Timeout per iteration (minutes)
--max-total-minutes <n>number120Total session timeout (minutes)
--checkpoint-interval <n>number5Minutes between interactive checkpoints (0 to disable)
FlagTypeDefaultDescription
--base-branch <name>stringmainBase branch for diff generation
--base-ref <ref>stringExplicit git ref (e.g., HEAD~3)
--auto-commitbooleanfalseAuto-commit after approval
--auto-pushbooleanfalseAuto-push after commit
--auto-prbooleanfalseCreate PR after push
--no-auto-rebasebooleanfalseDisable auto-rebase before push
--branch-prefix <prefix>stringfeat/Branch naming prefix
FlagTypeDefaultDescription
--no-sonarbooleanfalseSkip SonarQube analysis
--pg-task <cardId>stringPlanning Game card ID
--pg-project <projectId>stringPlanning Game project ID
--smart-modelsbooleanfrom configEnable smart model selection based on triage complexity
--no-smart-modelsbooleanDisable smart model selection
FlagTypeDefaultDescription
--dry-runbooleanfalseShow what would execute without running
--jsonbooleanfalseOutput JSON only (no styled display)
Terminal window
# Basic run with defaults
kj run "Add input validation to the signup form"
# Strict TDD with specific agents
kj run "Fix SQL injection in search endpoint" \
--coder claude --reviewer codex --mode paranoid
# Multi-agent with all stages
kj run "Implement user authentication" \
--enable-planner --enable-tester --enable-security \
--coder claude --reviewer codex --max-iterations 3
# Planning Game integration
kj run "KJC-TSK-0042" --pg-project "Karajan Code"
# Dry run to preview pipeline
kj run "Refactor database layer" --dry-run
# Auto-commit and push after approval
kj run "Add loading spinner" --auto-commit --auto-push

Run coder only — no review loop. Useful for quick changes you’ll review yourself.

Terminal window
kj code "<task>" [options]
FlagTypeDefaultDescription
--coder <name>stringfrom configAI agent for coding
--coder-model <model>stringSpecific model for coder

Examples:

Terminal window
kj code "Add a loading spinner to the dashboard"
kj code "Write unit tests for the auth service" --coder gemini

Run reviewer only against the current git diff. Useful after manual changes.

Terminal window
kj review "<task>" [options]
FlagTypeDefaultDescription
--reviewer <name>stringfrom configAI agent for review
--reviewer-model <model>stringSpecific model for reviewer
--base-ref <ref>stringmainGit ref to diff against

Examples:

Terminal window
kj review "Review my auth refactor"
kj review "Check for security issues" --reviewer claude --base-ref HEAD~5

Generate an implementation plan without writing code.

Terminal window
kj plan "<task>" [options]
FlagTypeDefaultDescription
--planner <name>stringcoder roleAI agent for planning
--planner-model <model>stringSpecific model for planner
--context <text>stringAdditional context for planner
--jsonbooleanfalseOutput raw JSON plan

Examples:

Terminal window
kj plan "Migrate from REST to GraphQL"
kj plan "Add multi-tenancy support" --context "Using row-level security" --json

Run SonarQube static analysis on the current project.

Terminal window
kj scan

No additional options. Uses SonarQube settings from config.

Prerequisites: Docker running, SonarQube container started (kj sonar start).


Check system environment for required tools and configuration.

Terminal window
kj doctor

Checks performed:

CheckWhat it verifies
Karajan versionShows installed Karajan Code version
Config filekj.config.yml exists
Git repositoryInside a git repo
DockerDocker is installed
SonarQubeReachable at configured host
Agent CLIsClaude, Codex, Gemini, Aider respond to --version
Core binariesnode, npm, git installed
Serena MCPserena --version (when enabled)
Rule filesreview-rules.md and coder-rules.md exist

Each check shows OK or MISS with a suggested fix.


Display or edit configuration.

Terminal window
kj config [options]
FlagTypeDefaultDescription
--jsonbooleanfalseOutput as JSON
--editbooleanfalseOpen in $EDITOR for editing

Examples:

Terminal window
kj config # Pretty-print current config
kj config --json # Output as JSON
kj config --edit # Open in editor

Display session reports with budget tracking and token usage.

Terminal window
kj report [options]
FlagTypeDefaultDescription
--listbooleanfalseList all session IDs
--session-id <id>stringlatestShow report for specific session
--format <type>stringtextOutput format: text or json
--tracebooleanfalseShow chronological trace of all stages
--currency <code>stringusdDisplay costs in usd or eur

Report includes:

  • Session ID and status
  • Task description
  • Pipeline stages executed
  • Iterations (coder runs, reviewer attempts, approval status)
  • SonarQube issues (initial → final → delta)
  • Estimated budget consumed
  • Commits generated
  • Trace mode: per-stage timing, tokens in/out, cost breakdown

Examples:

Terminal window
kj report # Latest session
kj report --trace # Detailed cost breakdown
kj report --list # List all sessions
kj report --session-id s_2026-02-28... # Specific session
kj report --trace --currency eur # Costs in EUR
kj report --format json # Machine-readable

Resume a paused, stopped, or failed session. Sessions pause on repeat detection, budget warnings, or when human guidance is needed.

Terminal window
kj resume <sessionId> [options]
FlagTypeDefaultDescription
--answer <text>stringAnswer to the question that caused the pause
--jsonbooleanfalseOutput JSON only

Examples:

Terminal window
# Resume with guidance
kj resume s_2026-02-28T20-47-24 --answer "Focus on the security issue first"
# Resume and check result as JSON
kj resume s_2026-02-28T20-47-24 --answer "Skip the style issues" --json

List pipeline roles or show role template instructions.

Terminal window
kj roles [subcommand] [role]
SubcommandDescription
list (default)List all available roles
show <role>Show the full template for a role

Available roles:

RolePurpose
triageTask complexity classification
researcherCodebase investigation
plannerImplementation planning
coderCode and test generation
refactorerCode quality improvement
sonarStatic analysis
reviewerCode review
testerTest quality gate
securityOWASP security audit
solomonConflict resolution
commiterGit automation
discoverPre-execution gap detection
hu-reviewerUser story certification
architectSolution architecture design
auditRead-only codebase health audit

Review mode variants: reviewer-strict, reviewer-relaxed, reviewer-paranoid

Examples:

Terminal window
kj roles # List all roles
kj roles show coder # Show coder template
kj roles show reviewer # Show reviewer template

List or set the AI agent assigned to each pipeline role on the fly. Changes persist to kj.config.yml — no restart needed.

Terminal window
kj agents [subcommand] [role] [agent]
SubcommandDescription
list (default)Show current agent assignment per role
set <role> <agent>Assign an agent to a role and persist to config

Examples:

Terminal window
kj agents # List current agent per role
kj agents list # Same as above
kj agents set coder gemini # Switch the coder role to Gemini
kj agents set reviewer claude # Switch the reviewer role to Claude

Manage the HU Board dashboard for visual task tracking.

Terminal window
kj board <subcommand>
SubcommandDescription
startStart the HU Board dashboard
stopStop the HU Board dashboard
statusCheck if the HU Board is running
openOpen the HU Board in the browser

Examples:

Terminal window
kj board start # Start the dashboard
kj board status # Check if it's running
kj board open # Open in browser
kj board stop # Stop the dashboard

Manage the SonarQube Docker container.

Terminal window
kj sonar <subcommand>
SubcommandDescription
statusCheck container status
startStart SonarQube container
stopStop SonarQube container
logsView container logs
openOpen SonarQube dashboard in browser

Examples:

Terminal window
kj sonar status # Is SonarQube running?
kj sonar start # Start it
kj sonar open # Open dashboard at http://localhost:9000
kj sonar logs # Check logs if something is wrong
kj sonar stop # Stop when done

VariableDescriptionDefault
KJ_HOMEConfig and sessions directory~/.karajan
KJ_SONAR_TOKENSonarQube authentication tokenfrom config
KJ_SONAR_PROJECT_KEYSonarQube project keyauto-detected
KJ_SONAR_ADMIN_USERSonarQube admin usernameadmin
KJ_SONAR_ADMIN_PASSWORDSonarQube admin passwordfrom config
SONAR_TOKENAlternative SonarQube tokenfallback
PG_API_URLPlanning Game API URLhttps://planning-game.geniova.com/api
VISUALText editor for kj config --editfallback to EDITOR
EDITORText editor fallbackvi

CodeMeaning
0Success
1Error (command failed, validation error, config error, budget exceeded)