Skip to content

Examples

Full pipeline with security audit enabled:

Terminal window
kj run "Fix SQL injection in search endpoint - parameterize the query" \
--mode strict \
--enable-security \
--auto-commit

Expected output:

[coder] Replacing string interpolation with parameterized query...
[sonar] Quality gate passed — 0 blockers, 0 critical
[security] 0 vulnerabilities found — pass
[reviewer] APPROVED — no issues found (confidence: 0.98)
✔ Pipeline completed in 1m 42s (iteration 1/5)
Commits:
fix: parameterize search query to prevent SQL injection

Enable the planner for complex features:

Terminal window
kj run "Implement user avatar upload with size validation and CDN integration" \
--methodology tdd \
--enable-planner \
--enable-refactorer \
--max-iterations 4

Expected output:

[planner] Plan: 3 phases — test fixtures, handler implementation, CDN integration
[coder] Writing tests first, then implementation...
[refactorer] Extracted validateImageSize() utility
[sonar] Quality gate passed — coverage 94%
[reviewer] APPROVED — clean implementation (confidence: 0.96)
✔ Pipeline completed in 2m 34s (iteration 1/4)
Commits:
test: add avatar upload handler test suite
feat: implement avatar upload with validation
refactor: extract image validation utility

Review existing code for OWASP vulnerabilities:

Terminal window
kj run "Security audit of src/auth/ — check for OWASP top 10" \
--enable-security \
--mode paranoid \
--base-ref HEAD~10

Expected output:

[security] 3 vulnerabilities found:
CRITICAL — JWT secret hardcoded (src/auth/jwt.js:28)
HIGH — Email not validated before query (src/auth/login.js:42)
MEDIUM — Password hash in debug logs (src/auth/session.js:15)
[coder] Fixing 3 vulnerabilities...
[reviewer] APPROVED — all fixes verified (confidence: 0.99)
✔ Pipeline completed in 1m 45s (iteration 1/5)

Skip the review loop for simple changes:

Terminal window
kj code "Add a loading spinner to the dashboard component"

No reviewer, no SonarQube, no loop. The coder writes code and you review it yourself.


Review your manual changes without writing code:

Terminal window
kj review "Check my authentication refactor for security issues" \
--mode paranoid

Expected output:

Reviewing diff from main..HEAD (12 commits, 340 lines)
REJECTED — 2 blocking issues:
B1: Session token not invalidated on logout (src/auth/session.js:58)
B2: Missing input validation for token claims (src/auth/jwt.js:22)
Suggestions:
S1: Use crypto.timingSafeEqual() for password comparison
Confidence: 0.92

Use a fast coder with a strict reviewer:

Terminal window
kj run "Implement caching layer for database queries" \
--coder codex \
--reviewer claude \
--reviewer-fallback claude \
--mode paranoid \
--max-iterations 6

Expected flow:

Iteration 1: codex writes → claude rejects (2 issues)
Iteration 2: codex fixes → claude rejects (1 issue)
Iteration 3: codex fixes → claude APPROVES ✓
Total: 3m 27s | Cost: $1.42

Karajan runs CLI agents under your existing subscriptions — it adds no extra cost. The budget system estimates what each session would cost at API rates, which is useful for comparing approaches and setting guardrails. Set limits on these estimated costs:

Terminal window
kj run "Add multi-language support to UI components" \
--max-iterations 3 \
--max-iteration-minutes 8 \
--max-total-minutes 60

Add an estimated budget cap in config:

~/.karajan/kj.config.yml
max_budget_usd: 2.00
budget:
warn_threshold_pct: 80

Check estimated costs after the run:

Terminal window
kj report --trace --currency eur
Stage | Role | Duration | Cost (EUR)
---------|----------|----------|----------
1 | coder | 45.2s | €0.48
2 | reviewer | 14.8s | €0.28
3 | coder | 32.1s | €0.39
4 | reviewer | 12.4s | €0.20
---------|----------|----------|----------
Total | 1m 44s | €1.35

Maximum rigor for payment, auth, or compliance-critical code:

Terminal window
kj run "Implement PCI-DSS compliant payment processor" \
--coder claude \
--reviewer claude \
--mode paranoid \
--enable-security \
--enable-tester \
--enable-refactorer \
--max-iterations 10

In paranoid mode, the reviewer defaults to rejection and only approves with confidence > 0.85. Expect more iterations but higher quality:

Iteration 1: REJECTED — missing rate limiter
Iteration 2: REJECTED — error leaks card number
Iteration 3: APPROVED ✓ (confidence: 0.98)
Security audit: 0 vulnerabilities
Test coverage: 97%
SonarQube: PASSED (0 bugs, 0 smells)

Execute tasks from your Planning Game project management board:

Terminal window
kj run "KJC-TSK-0042" \
--pg-project "My Project" \
--pg-task KJC-TSK-0042 \
--auto-commit \
--auto-push

Karajan fetches the full task context (description, acceptance criteria) from Planning Game and updates the card status on completion.


Plan before coding — useful for complex tasks:

Terminal window
kj plan "Migrate authentication from sessions to JWT"

Returns a structured plan with phases, risks, and estimated effort — without writing any code.


Preview what would happen without executing:

Terminal window
kj run "Refactor database layer" --dry-run

Shows which agents would run, estimated duration, and cost — without making any changes.