Note
Klaus Baudelaire is live! Changes are being made hourly as of 2/2/2026
To update, run
git pullin the klaus-baudelaire directory & run theinstall.shwithin.system/dir
The Polymathic Delegation System for Claude Code
Klaus was designed from the architectural design of the Claude Code harness. Instead of protecting his sisters from villains, he serves you -- delegating agents to ship your code with intelligence and precision.
Klaus is an intelligent task routing infrastructure that automatically analyzes your prompts and routes them to appropriate execution tiers based on complexity.
Before Klaus: Manual judgment calls -- "Should I use an agent? Which one? Do I need research?"
After Klaus: Automatic analysis routes tasks to the optimal tier (DIRECT, LIGHT, MEDIUM, FULL).
# Clone anywhere (your choice of location)
git clone https://github.com/blas0/klaus-baudelaire ~/klaus-baudelaire
# or: git clone https://github.com/blas0/klaus-baudelaire /path/to/anywhere
# Run installer (backs up existing ~/.claude automatically)
~/klaus-baudelaire/.system/install.sh
# Restart Claude Code, then verify
/klaus-testWhat the installer does:
- Backs up your existing
~/.claudeto~/.claude-backups/ - Copies Klaus components (hooks, agents, commands, config)
- Merges settings.json hooks (preserves your existing hooks)
- Preserves your CLAUDE.md and config customizations
+-------------------+
| Your Prompt |
+--------+----------+
|
+--------v----------+
| klaus-delegation |
| .sh (Hook) |
| |
| Score = keywords |
| + length bonus |
| - simple penalty |
+--------+----------+
|
+----------+---------+---------+----------+
| | | |
+-----v--+ +----v---+ +------v---+ +---v----+
| DIRECT | | LIGHT | | MEDIUM | | FULL |
| 0-2 | | 3-4 | | 5-6 | | 7+ |
+--------+ +----+---+ +-----+----+ +---+----+
Execute explore- explore- explore-
immediately lead lead + lead +
docs- research-
specialist + lead +
context- docs-
validator + specialist +
plan- context-
orchestrator validator +
plan-
orchestrator
| Tier | Score | Agents | Use Case |
|---|---|---|---|
| DIRECT | 0-2 | None | Simple edits, typos |
| LIGHT | 3-4 | explore-lead | Basic features, quick research |
| MEDIUM | 5-6 | explore-lead + docs-specialist + context-validator + plan-orchestrator | Multi-file changes |
| FULL | 7+ | explore-lead + research-lead + docs-specialist + context-validator + file-path-extractor + plan-orchestrator | Architecture, complex features |
Delegation Architecture --> | Scoring Algorithm -->
Score = 0
+ length bonus (>100: +1, >200: +1, >400: +2)
+ COMPLEX_KEYWORDS (e.g., "system architecture": +3, "oauth": +2)
- SIMPLE_KEYWORDS (e.g., "fix typo": -4, "just": -2)
= Final (bounded 0-50)
Example: "Set up OAuth with tests" = "set up tests" (+3) + "oauth" (+2) = 5 = MEDIUM
| Command | Purpose |
|---|---|
/klaus <prompt> |
Force FULL tier execution |
/klaus feature <action> |
Manage feature flags (list, toggle, enable, disable) |
/fillmemory |
Initialize project documentation structure |
/compost |
Extract codebase patterns into standards |
/updatememory |
Sync documentation with codebase |
/suggestkeywords |
Analyze routing telemetry for optimization |
/klaus-test |
Run system diagnostics |
Klaus extends its architecture with Native Teammate Skills for cost-conscious team formation using Claude Code's experimental teammate system.
| Skill | Purpose | Invocation | Cost |
|---|---|---|---|
/klaus-review-team |
3-lens code review (security, performance, test) | Manual or auto-trigger | ~4x |
/klaus-research-team |
Multi-source research (docs, web, codebase) | Manual or auto-trigger | ~6x |
/klaus-impl-team |
Parallel implementation with file locks | Manual or auto-trigger | ~5x |
klaus-team |
General-purpose team formation | Via plan-orchestrator | 4-8x |
- Manual slash commands:
/klaus-review-team,/klaus-research-team,/klaus-impl-team - Semi-automatic triggers: Keywords in prompts ("code review", "research", "implement in parallel")
- Plan-orchestrator delegation: FULL-tier tasks invoke skills automatically when teams are beneficial
[!!!] Critical: Skills are NOT routed via Klaus's UserPromptSubmit hook. Semi-automatic triggering relies on Claude Code's internal skill description matching.
# Environment variable (add to ~/.zshrc or ~/.bashrc)
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
# Feature flag in klaus-delegation.conf
ENABLE_NATIVE_TEAMS="ON"Klaus provides a 3-tier threshold for team formation:
- SOLO (1x): Single-file edits, simple queries
- SUBAGENT (1.5-2x): Multi-file exploration, documentation gathering
- TEAM (4-8x): 3+ independent workstreams, inter-communication required
[!!] Always prefer SUBAGENT tier unless inter-communication is critical.
10 of Klaus's 17 agents can be spawned as teammates:
Teammate-Eligible: plan-orchestrator, research-lead, explore-lead, docs-specialist, context-validator, web-research-specialist, implementer, test-infrastructure-agent, code-simplifier, recursive-agent
Subagent-Only: file-path-extractor, git-orchestrator, composter, reminder-nudger-agent, chunk-analyzer, conflict-resolver, synthesis-agent
When CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS is unavailable, skills automatically fall back to SUBAGENT tier using the Task tool with subagent_type parameter. All agent expertise is retained, but inter-communication is lost.
Delegation Specialists:
- plan-orchestrator (Sonnet) -- Primary delegator for MEDIUM/FULL tasks
- docs-specialist (Sonnet) -- Official documentation lookup
- context-validator (Sonnet) -- Validates context before implementation (GO/CAUTION/NO-GO)
- web-research-specialist (Sonnet) -- Deep web research
- file-path-extractor (Haiku) -- File path tracking
- test-infrastructure-agent (Sonnet) -- Test setup
- reminder-nudger-agent (Haiku) -- Stagnation detection
- implementer (Sonnet) -- Code implementation after discovery
Research Agents:
- explore-lead (Sonnet) -- Comprehensive codebase exploration for all tiers
- research-lead (Opus) -- Research coordination
Utility: code-simplifier, composter, git-orchestrator
RLM Agents (Recursive Language Model - for 50K+ token documents):
- recursive-agent (Opus) -- RLM orchestrator
- chunk-analyzer (Haiku) -- Document chunk processing
- conflict-resolver (Sonnet) -- Deduplication and conflict resolution
- synthesis-agent (Sonnet) -- Final report generation
Klaus implements heavy TaskList coordination across 11 agents:
| Role | Agents | Tools |
|---|---|---|
| Creators | research-lead, plan-orchestrator | TaskCreate, TaskUpdate, TaskList |
| Executors | 9 specialist agents | TaskUpdate, TaskList |
| Monitor | reminder-nudger-agent | TaskGet, TaskList (READ-ONLY) |
Lifecycle: pending --> in_progress --> completed
Press Ctrl+T in Claude Code to see task progress.
| # | System | Purpose |
|---|---|---|
| 1 | Profile System | Conservative/balanced/aggressive routing |
| 2 | Feature Flags | Runtime agent/capability toggles |
| 3 | Coverage Tracking | PS4-based Bash code coverage |
| 4 | Production Testing | Sandbox deployment pipeline |
| 5 | Plan Orchestration | 7-phase agent delegation |
File: ~/.claude/config/klaus-delegation.conf
SMART_DELEGATE_MODE="ON" # Enable/disable Klaus
TIER_LIGHT_MIN=3 # Score thresholds
TIER_MEDIUM_MIN=5
TIER_FULL_MIN=7
# CORE agent flags (essential - keep ON)
ENABLE_DOCS_SPECIALIST="ON" # docs-specialist agent (Sonnet)
ENABLE_CONTEXT_VALIDATOR="ON" # context-validator agent (Sonnet)
ENABLE_FILE_PATH_EXTRACTOR="ON" # file-path-extractor agent
# OPTIONAL agent flags
ENABLE_WEB_RESEARCHER="OFF" # web-research-specialist agent
ENABLE_TEST_INFRASTRUCTURE="OFF" # test-infrastructure-agent
ENABLE_REMINDER_SYSTEM="OFF" # reminder-nudger-agent
# UTILITY agent flags
ENABLE_CODE_SIMPLIFIER="OFF" # code-simplifier agent
ENABLE_COMPOSTER="ON" # composter agent (/compost command)
ENABLE_GIT_ORCHESTRATOR="OFF" # git-orchestrator agent
# RLM agent flags (large document analysis)
ENABLE_RLM_AGENTS="OFF" # recursive-agent, chunk-analyzer, etc.
ROUTING_EXPLANATION="ON" # Show routing rationale
DEBUG_MODE="OFF" # Debug loggingConfiguration Reference --> | Profiles -->
# Navigate to your clone location first
cd ~/klaus-baudelaire # or wherever you cloned
bash tests/unit-tests.sh # 79 unit tests
bash tests/hooks-suite.sh # 88 hook tests
bash tests/e2e-suite.sh # 26 E2E tests
bun tests/integration-tests.ts # 12 routing tests# In Claude Code
/klaus-testTotal: 205 tests, ~28-40s execution time
Klaus registers 1 hook (UserPromptSubmit) which invokes klaus-delegation.sh. This script sources additional modules as needed:
- klaus-delegation.sh -- Routing logic (always active, entry point)
- klaus-session-state.sh -- Async session management
- routing-telemetry.sh -- Privacy-first routing analytics
- rlm-workflow-coordinator.sh -- Recursive agent orchestration
Klaus not routing? Check ~/.claude/settings.json for UserPromptSubmit hook.
Wrong tier? Test: echo '{"prompt":"YOUR PROMPT"}' | bash ~/.claude/hooks/klaus-delegation.sh | jq
Tests failing? Run: bash ~/.claude/tests/unit-tests.sh 2>&1 | grep FAIL
Need debug? Set DEBUG_MODE="ON" in ~/.claude/klaus-delegation.conf
All detailed documentation:
- Installation | 02. Architecture | 03. Scoring
- Keywords | 05. Profiles | 06. Feature Flags
- Coverage | 08. Sandbox | 09. Plan Agent
- Memory | 11. Agents | 12. Tasks
- Hooks | 14. Testing | 15. Troubleshooting
- Teammate Skills
"I don't know if you've ever noticed, but first impressions are often entirely wrong." -- Lemony Snicket
