karajan-code 1.36.1 → 1.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -32
- package/docs/README.es.md +131 -237
- package/package.json +1 -1
- package/src/agents/resolve-bin.js +26 -14
- package/src/hu/store.js +57 -0
- package/src/orchestrator/hu-sub-pipeline.js +166 -0
- package/src/orchestrator/iteration-stages.js +50 -15
- package/src/orchestrator/post-loop-stages.js +25 -11
- package/src/orchestrator/pre-loop-stages.js +147 -43
- package/src/orchestrator/preflight-checks.js +3 -3
- package/src/orchestrator/solomon-escalation.js +3 -2
- package/src/orchestrator.js +100 -15
- package/src/planning-game/pipeline-adapter.js +37 -0
- package/src/prompts/hu-reviewer.js +55 -0
- package/src/prompts/triage.js +4 -2
- package/src/utils/display.js +133 -23
- package/src/utils/injection-guard.js +171 -0
- package/src/utils/os-detect.js +17 -8
- package/src/utils/process.js +7 -4
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
25
|
-
You describe what you want to build. Karajan orchestrates multiple AI agents to plan it, implement it, test it, review it with SonarQube, and iterate
|
|
25
|
+
You describe what you want to build. Karajan orchestrates multiple AI agents to plan it, implement it, test it, review it with SonarQube, and iterate. No babysitting required.
|
|
26
26
|
|
|
27
27
|
## What is Karajan?
|
|
28
28
|
|
|
@@ -30,7 +30,7 @@ Karajan is a local coding orchestrator. It runs on your machine, uses your exist
|
|
|
30
30
|
|
|
31
31
|
It is not a hosted service. It is not a VS Code extension. It is a tool you install once and use from the terminal or as an MCP server inside your AI agent.
|
|
32
32
|
|
|
33
|
-
The name comes from Herbert von Karajan
|
|
33
|
+
The name comes from Herbert von Karajan, the conductor who believed that the best orchestras are made of great independent musicians who know exactly when to play and when to listen. Same idea, applied to AI agents.
|
|
34
34
|
|
|
35
35
|
## Why not just use Claude Code?
|
|
36
36
|
|
|
@@ -39,16 +39,16 @@ Claude Code is excellent. Use it for interactive, session-based coding.
|
|
|
39
39
|
Use Karajan when you want:
|
|
40
40
|
|
|
41
41
|
- **A repeatable, documented pipeline** that runs the same way every time
|
|
42
|
-
- **TDD by default
|
|
43
|
-
- **SonarQube integration
|
|
44
|
-
- **Solomon as pipeline boss
|
|
45
|
-
- **Multi-provider routing
|
|
46
|
-
- **Zero-config operation
|
|
47
|
-
- **Composable role architecture
|
|
48
|
-
- **Local-first
|
|
49
|
-
- **Zero API costs
|
|
42
|
+
- **TDD by default.** Tests are written before implementation, not after
|
|
43
|
+
- **SonarQube integration.** Code quality gates as part of the flow, not an afterthought
|
|
44
|
+
- **Solomon as pipeline boss.** Every reviewer rejection is evaluated by a supervisor that decides if it's valid or just style noise
|
|
45
|
+
- **Multi-provider routing.** Claude as coder, Codex as reviewer, or any combination
|
|
46
|
+
- **Zero-config operation.** Auto-detects test frameworks, starts SonarQube, simplifies pipeline for trivial tasks
|
|
47
|
+
- **Composable role architecture.** Agent behaviors defined as plain markdown files that travel with your project
|
|
48
|
+
- **Local-first.** Your code, your keys, your machine. No data leaves unless you say so
|
|
49
|
+
- **Zero API costs.** Karajan uses AI agent CLIs (Claude Code, Codex, Gemini CLI), not APIs. You pay your existing subscription (Claude Pro, ChatGPT Plus), not per-token API fees
|
|
50
50
|
|
|
51
|
-
If Claude Code is a smart pair programmer, Karajan is the CI/CD pipeline for AI-assisted development. They work great together
|
|
51
|
+
If Claude Code is a smart pair programmer, Karajan is the CI/CD pipeline for AI-assisted development. They work great together: Karajan is designed to be used as an MCP server inside Claude Code.
|
|
52
52
|
|
|
53
53
|
## Install
|
|
54
54
|
|
|
@@ -62,7 +62,7 @@ That's it. No Docker required (SonarQube uses Docker, but Karajan auto-manages i
|
|
|
62
62
|
|
|
63
63
|
Karajan installs **three commands**: `kj`, `kj-tail`, and `karajan-mcp`.
|
|
64
64
|
|
|
65
|
-
### 1. CLI
|
|
65
|
+
### 1. CLI: direct from terminal
|
|
66
66
|
|
|
67
67
|
Run Karajan directly. You see the full pipeline output in real time.
|
|
68
68
|
|
|
@@ -74,7 +74,7 @@ kj audit "Full health analysis of this codebase" # Read-only audit
|
|
|
74
74
|
kj plan "Refactor the database layer" # Plan without coding
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
### 2. MCP
|
|
77
|
+
### 2. MCP: inside your AI agent
|
|
78
78
|
|
|
79
79
|
This is the primary use case. Karajan runs as an MCP server inside Claude Code, Codex, or Gemini. You ask your AI agent to do something, and it delegates the heavy lifting to Karajan's pipeline.
|
|
80
80
|
|
|
@@ -86,7 +86,7 @@ The MCP server auto-registers during `npm install`. Your AI agent sees 20 tools
|
|
|
86
86
|
|
|
87
87
|
**The problem**: when Karajan runs inside an AI agent, you lose visibility. The agent shows you the final result, but not the pipeline stages, iterations, or Solomon decisions happening in real time.
|
|
88
88
|
|
|
89
|
-
### 3. kj-tail
|
|
89
|
+
### 3. kj-tail: monitor from a separate terminal
|
|
90
90
|
|
|
91
91
|
**This is the companion tool.** Open a second terminal in the **same project directory** where your AI agent is working, and run:
|
|
92
92
|
|
|
@@ -94,7 +94,7 @@ The MCP server auto-registers during `npm install`. Your AI agent sees 20 tools
|
|
|
94
94
|
kj-tail
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
You'll see the live pipeline output
|
|
97
|
+
You'll see the live pipeline output (stages, results, iterations, errors) as they happen. Same view as running `kj run` directly.
|
|
98
98
|
|
|
99
99
|
```
|
|
100
100
|
kj-tail # Follow pipeline in real time (default)
|
|
@@ -118,7 +118,7 @@ kj-tail --help # Full options
|
|
|
118
118
|
│ priority task │ │ ├─ 📋 Triage: medium │
|
|
119
119
|
│ │ │ ├─ 🔬 Researcher ✅ │
|
|
120
120
|
│ (Claude calls kj_run │ │ ├─ 🧠 Planner ✅ │
|
|
121
|
-
│ via MCP
|
|
121
|
+
│ via MCP, you see │ │ ├─ 🔨 Coder ✅ │
|
|
122
122
|
│ only the final result) │ │ ├─ 🔍 Sonar: OK │
|
|
123
123
|
│ │ │ ├─ 👁️ Reviewer ❌ │
|
|
124
124
|
│ │ │ ├─ ⚖️ Solomon: 2 cond. │
|
|
@@ -129,7 +129,7 @@ kj-tail --help # Full options
|
|
|
129
129
|
└─────────────────────────┘ └─────────────────────────┘
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
-
**Full pipeline example
|
|
132
|
+
**Full pipeline example**, a complex task with all roles:
|
|
133
133
|
|
|
134
134
|
```
|
|
135
135
|
┌─ Terminal 1 ─────────────────────────────────────────────────────────────────┐
|
|
@@ -154,7 +154,7 @@ kj-tail --help # Full options
|
|
|
154
154
|
|
|
155
155
|
┌─ Terminal 2: kj-tail ────────────────────────────────────────────────────────┐
|
|
156
156
|
│ │
|
|
157
|
-
│ kj-tail v1.
|
|
157
|
+
│ kj-tail v1.37.0 — .kj/run.log │
|
|
158
158
|
│ │
|
|
159
159
|
│ ├─ 📋 Triage: medium (sw) — enabling researcher, architect, planner │
|
|
160
160
|
│ ├─ ⚙️ Preflight passed — all checks OK │
|
|
@@ -193,7 +193,7 @@ kj-tail --help # Full options
|
|
|
193
193
|
└──────────────────────────────────────────────────────────────────────────────┘
|
|
194
194
|
```
|
|
195
195
|
|
|
196
|
-
[
|
|
196
|
+
[**Watch the full pipeline demo**](https://karajancode.com#demo): triage, architecture, TDD, SonarQube, code review, Solomon arbitration, security audit.
|
|
197
197
|
|
|
198
198
|
## The pipeline
|
|
199
199
|
|
|
@@ -217,7 +217,7 @@ hu-reviewer? → triage → discover? → architect? → planner? → coder →
|
|
|
217
217
|
| **reviewer** | Code review with configurable strictness profiles | **Always on** |
|
|
218
218
|
| **tester** | Test quality gate and coverage verification | **On** |
|
|
219
219
|
| **security** | OWASP security audit | **On** |
|
|
220
|
-
| **solomon** | Pipeline boss
|
|
220
|
+
| **solomon** | Pipeline boss: evaluates every rejection, overrides style-only blocks | **On** |
|
|
221
221
|
| **commiter** | Git commit, push, and PR automation after approval | Off |
|
|
222
222
|
| **audit** | Read-only codebase health analysis (5 dimensions, A-F scores) | Standalone |
|
|
223
223
|
|
|
@@ -233,7 +233,7 @@ hu-reviewer? → triage → discover? → architect? → planner? → coder →
|
|
|
233
233
|
|
|
234
234
|
Mix and match. Use Claude as coder and Codex as reviewer. Karajan auto-detects installed agents during `kj init`.
|
|
235
235
|
|
|
236
|
-
## MCP server
|
|
236
|
+
## MCP server (20 tools)
|
|
237
237
|
|
|
238
238
|
After `npm install -g karajan-code`, the MCP server auto-registers in Claude and Codex. Manual config if needed:
|
|
239
239
|
|
|
@@ -251,7 +251,7 @@ Use `kj-tail` in a separate terminal to see what the pipeline is doing in real t
|
|
|
251
251
|
|
|
252
252
|
## The role architecture
|
|
253
253
|
|
|
254
|
-
Every role in Karajan is defined by a markdown file
|
|
254
|
+
Every role in Karajan is defined by a markdown file: a plain document that describes how the agent should behave, what to check, and what good output looks like.
|
|
255
255
|
|
|
256
256
|
```
|
|
257
257
|
.karajan/roles/ # Project overrides (optional)
|
|
@@ -259,7 +259,7 @@ Every role in Karajan is defined by a markdown file — a plain document that de
|
|
|
259
259
|
templates/roles/ # Built-in defaults (shipped with package)
|
|
260
260
|
```
|
|
261
261
|
|
|
262
|
-
You can override any built-in role or create new ones. No code required. The agents read the role files and adapt their behavior.
|
|
262
|
+
You can override any built-in role or create new ones. No code required. The agents read the role files and adapt their behavior. Encode your team's conventions, domain rules, and quality standards, and every run of Karajan applies them automatically.
|
|
263
263
|
|
|
264
264
|
Use `kj roles show <role>` to inspect any template.
|
|
265
265
|
|
|
@@ -268,7 +268,8 @@ Use `kj roles show <role>` to inspect any template.
|
|
|
268
268
|
Karajan auto-detects and auto-configures everything it can:
|
|
269
269
|
|
|
270
270
|
- **TDD**: Detects test framework (vitest, jest, mocha) → auto-enables TDD
|
|
271
|
-
- **Bootstrap gate**: Validates all prerequisites (git repo, remote, config, agents, SonarQube) before any tool runs. Fails hard with actionable fix instructions
|
|
271
|
+
- **Bootstrap gate**: Validates all prerequisites (git repo, remote, config, agents, SonarQube) before any tool runs. Fails hard with actionable fix instructions, never silently degrades
|
|
272
|
+
- **Injection guard**: Scans diffs for prompt injection before AI review. Detects directive overrides, invisible Unicode, oversized comment payloads. Also runs as a GitHub Action on every PR
|
|
272
273
|
- **SonarQube**: Auto-starts Docker container, generates config if missing
|
|
273
274
|
- **Pipeline complexity**: Triage classifies task → trivial tasks skip reviewer loop
|
|
274
275
|
- **Provider outages**: Retries on 500/502/503/504 with backoff (same as rate limits)
|
|
@@ -278,18 +279,16 @@ No per-project configuration required. If you want to customize, config is layer
|
|
|
278
279
|
|
|
279
280
|
## Why vanilla JavaScript?
|
|
280
281
|
|
|
281
|
-
|
|
282
|
+
Not nostalgia, not stubbornness. I've been using JavaScript since 1997, when Brendan Eich created it in a week and changed the lives of everyone building for the web. I know its guts, its bugs, its quirks. And I know that whoever truly understands JS turns those bugs into features. TypeScript exists so that developers used to strongly-typed languages don't panic when they see JS. I respect that. But I don't need it. Tests are my type safety. JSDoc and a good IDE are my intellisense. And not having a compiler between the code and me is what lets me ship 57 releases in 45 days without fear.
|
|
282
283
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
This is a deliberate choice, not a limitation. The tests are the type safety. The legibility is a feature. **55 releases in 26 days** — that velocity is possible precisely because vanilla JS with good tests lets you move fast without fear.
|
|
284
|
+
[Why vanilla JavaScript: the long version](docs/why-vanilla-js.md)
|
|
286
285
|
|
|
287
286
|
## Recommended companions
|
|
288
287
|
|
|
289
288
|
| Tool | Why |
|
|
290
289
|
|------|-----|
|
|
291
290
|
| [**RTK**](https://github.com/rtk-ai/rtk) | Reduces token consumption by 60-90% on Bash command outputs |
|
|
292
|
-
| [**Planning Game MCP**](https://github.com/AgenteIA-Geniova/planning-game-mcp) | Agile project management (tasks, sprints, estimation)
|
|
291
|
+
| [**Planning Game MCP**](https://github.com/AgenteIA-Geniova/planning-game-mcp) | Agile project management (tasks, sprints, estimation), XP-native |
|
|
293
292
|
| [**GitHub MCP**](https://github.com/modelcontextprotocol/servers/tree/main/src/github) | Create PRs, manage issues directly from the agent |
|
|
294
293
|
| [**Chrome DevTools MCP**](https://github.com/anthropics/anthropic-quickstarts/tree/main/chrome-devtools-mcp) | Verify UI changes visually after frontend modifications |
|
|
295
294
|
|
|
@@ -299,11 +298,11 @@ This is a deliberate choice, not a limitation. The tests are the type safety. Th
|
|
|
299
298
|
git clone https://github.com/manufosela/karajan-code.git
|
|
300
299
|
cd karajan-code
|
|
301
300
|
npm install
|
|
302
|
-
npm test # Run
|
|
301
|
+
npm test # Run 2044 tests with Vitest
|
|
303
302
|
npm run validate # Lint + test
|
|
304
303
|
```
|
|
305
304
|
|
|
306
|
-
Issues and pull requests welcome. If something doesn't work as documented, [open an issue](https://github.com/manufosela/karajan-code/issues)
|
|
305
|
+
Issues and pull requests welcome. If something doesn't work as documented, [open an issue](https://github.com/manufosela/karajan-code/issues). That's the most useful contribution at this stage.
|
|
307
306
|
|
|
308
307
|
## Links
|
|
309
308
|
|
|
@@ -315,4 +314,4 @@ Issues and pull requests welcome. If something doesn't work as documented, [open
|
|
|
315
314
|
|
|
316
315
|
---
|
|
317
316
|
|
|
318
|
-
Built by [@manufosela](https://github.com/manufosela)
|
|
317
|
+
Built by [@manufosela](https://github.com/manufosela). Head of Engineering at Geniova Technologies, co-organizer of NodeJS Madrid, author of [Liderazgo Afectivo](https://www.amazon.es/dp/B0D7F4C8KC). 90+ npm packages published.
|