Skip to content

blas0/klaus-baudelaire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Klaus Baudelaire

Note

Klaus Baudelaire is live! Changes are being made hourly as of 2/2/2026

To update, run git pull in the klaus-baudelaire directory & run the install.sh within .system/ dir

GitHub Stars Claude Code Tasks Teammates Orchestration X

Klaus Baudelaire

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.


What Is Klaus?

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).


Quick Install

# 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-test

What the installer does:

  • Backs up your existing ~/.claude to ~/.claude-backups/
  • Copies Klaus components (hooks, agents, commands, config)
  • Merges settings.json hooks (preserves your existing hooks)
  • Preserves your CLAUDE.md and config customizations

Full Installation Guide -->


Architecture

                          +-------------------+
                          |   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

The 4 Tiers

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 -->


Scoring (Simplified)

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

Configuration & Keywords -->


Commands

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

Memory Management -->



Teammate Skills (v1.0.7+)

Klaus extends its architecture with Native Teammate Skills for cost-conscious team formation using Claude Code's experimental teammate system.

The 4 Skills

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

Invocation Methods

  1. Manual slash commands: /klaus-review-team, /klaus-research-team, /klaus-impl-team
  2. Semi-automatic triggers: Keywords in prompts ("code review", "research", "implement in parallel")
  3. 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.

Configuration Requirements

# Environment variable (add to ~/.zshrc or ~/.bashrc)
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1

# Feature flag in klaus-delegation.conf
ENABLE_NATIVE_TEAMS="ON"

Cost-Conscious Team Formation

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.

Agent-to-Teammate Mapping

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

Graceful Degradation

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.

Teammate Skills Reference -->

Agents (17)

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

Agent Team Reference -->


TaskList Coordination

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.

Task Management -->


5 Core Systems

# 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

Configuration

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 logging

Configuration Reference --> | Profiles -->


Testing

From Your Cloned Repository

# 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

Quick Verification After Installation

# In Claude Code
/klaus-test

Total: 205 tests, ~28-40s execution time

Testing Guide -->


Hooks

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

Hooks System -->


Troubleshooting

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

Full Troubleshooting -->


Documentation

All detailed documentation:

  1. Installation | 02. Architecture | 03. Scoring
  2. Keywords | 05. Profiles | 06. Feature Flags
  3. Coverage | 08. Sandbox | 09. Plan Agent
  4. Memory | 11. Agents | 12. Tasks
  5. Hooks | 14. Testing | 15. Troubleshooting
  6. Teammate Skills

"I don't know if you've ever noticed, but first impressions are often entirely wrong." -- Lemony Snicket

About

Klaus was designed from the ground up, specifically around the architecturally embedded idiosyncrasies of Claude Code. Utilizing it's features, native capabilities, and spunkiness.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages