Complete guide to K-LEAN commands, agents, and workflows.
All commands are used inside Claude Code.
| Command | Description | Time |
|---|---|---|
/kln:quick <focus> |
Single model review | ~30s |
/kln:multi <focus> |
3-5 model consensus | ~60s |
/kln:agent <role> <task> |
Specialist agent | ~2min |
/kln:rethink |
Contrarian debugging | ~20s |
Examples:
/kln:quick security
/kln:multi "check error handling"
/kln:agent security-auditor "audit authentication"| Command | Description |
|---|---|
/kln:learn |
Extract learnings from conversation context |
/kln:learn "topic" |
Focused extraction on specific topic |
/kln:remember |
End-of-session comprehensive capture |
Examples:
/kln:learn # Auto-detect learnings from context
/kln:learn "auth bug fix" # Extract insights about auth bug
/kln:remember # End-of-session, syncs to KB| Command | Description |
|---|---|
/kln:status |
System health check (services, models, KB) |
/kln:doc <title> |
Generate session documentation |
/kln:help |
Show command reference |
Most commands support these flags:
| Flag | Description |
|---|---|
--async |
Run in background |
--models N |
Number of models (for /kln:multi) |
--output json|text |
Output format |
8 specialist agents with domain expertise, powered by smolagents.
| Agent | Expertise |
|---|---|
code-reviewer |
OWASP, SOLID, code quality |
security-auditor |
Vulnerabilities, auth, crypto |
debugger |
Root cause analysis |
performance-engineer |
Profiling, optimization |
rust-expert |
Ownership, lifetimes, unsafe |
c-pro |
C99/C11, POSIX, memory |
arm-cortex-expert |
Embedded ARM, real-time |
orchestrator |
Multi-agent coordination |
# In Claude Code
/kln:agent security-auditor "audit the payment module"
/kln:agent debugger "investigate the memory leak"
/kln:agent rust-expert "review unsafe blocks"
# Direct CLI
kln-smol security-auditor "audit auth" --model qwen3-coder
kln-smol --list # List available agents- Tools: Agents can read files, search code, query Knowledge DB
- Memory: Session learnings persist to KB after execution
- Telemetry: Enable tracing with
--telemetryflag
kln-smol security-auditor "audit" --telemetry
# View traces at http://localhost:6006Orchestrated reviews using multiple agents:
# 3-agent (default) - manager + file_scout + analyzer
kln multi "Review src/klean/cli.py for bugs"
# 4-agent (thorough) - adds security_auditor + synthesizer
kln multi --thorough "Security audit of auth module"Persistent semantic memory across sessions with hybrid search and temporal filtering.
| Method | When to Use |
|---|---|
/kln:learn |
Mid-session, capture insights from context |
/kln:learn "topic" |
Focused capture on specific topic |
/kln:remember |
End-of-session, comprehensive capture |
Entry types (auto-inferred from content):
| Type | Signal Words |
|---|---|
warning |
"don't", "avoid", "careful", "gotcha" |
solution |
"fixed", "solved", "workaround" |
pattern |
"use X for Y", "prefer", "best way" |
decision |
"chose", "decided", "instead of", "trade-off" |
discovery |
"found that", "turns out", "TIL", "surprisingly" |
finding |
Default for everything else |
Use /kln:find slash command for knowledge search:
| Command | Action |
|---|---|
/kln:find <query> |
Semantic search KB |
/kln:find <query> since:YYYY-MM-DD |
Search with date filter |
/kln:find <query> branch:<name> |
Search filtered by git branch |
/kln:find <query> type:<type> |
Search filtered by entry type |
Results are numbered with insight excerpts:
1. [solution] Auth refactor (2026-02-07) [id:abc12345]
Moved JWT validation to middleware, reduced duplicated checks...
2. [pattern] JWT token handling (2026-02-06) [id:def67890]
Use short-lived access tokens with refresh rotation...
Use --id for full entry details. Type InitKB to initialize the Knowledge DB.
Examples:
/kln:find "authentication patterns"
/kln:find auth since:2026-02-01
/kln:find auth branch:feature/auth type:decisionHooks automatically capture events to the Knowledge DB:
| Event | Type | Priority |
|---|---|---|
| Git commits | commit |
low |
| Test failures | finding |
high |
| Build errors | finding |
high |
| Package installs | finding |
low |
| Doc URL fetches | discovery |
low |
| Session learnings (PreCompact) | various | medium |
All auto-captured entries include timestamp and git branch metadata.
When Claude Code compacts context (PreCompact hook), K-LEAN automatically generates a session summary:
- Reads the conversation transcript (user messages)
- Gets git log since 6am
- Queries KB for today's entries (findings, warnings, solutions)
- Sends all three to Claude Haiku for summarization
- Appends to
.serena/memories/kln-session-YYYY-MM-DD.md - Creates a searchable KB entry (type:
session) linking to the full log
Session logs are Serena-discoverable and injected as context on next session start:
[SESSION] 14:00 - 16:30 | main
- Implemented PreCompact session log system
- Commits: feat(hooks): add session persistence
- Status: completed
Manual trigger: kln admin persist-session [--transcript PATH]
/kln:remember # Captures learnings + syncs Serena lessons
/clear # Clear contextThe /kln:remember command:
- Extracts learnings from git diff/log
- Saves entries to Knowledge DB (V3.1 schema with timestamp + branch)
- Syncs Serena lessons to KB (searchable by agents)
Session logs are generated automatically on context compaction -- no manual action needed.
/kln:quick "check for issues"/kln:multi "review changes"/kln:agent security-auditor "comprehensive security audit"/kln:rethink/kln:learn "the solution we found"/kln:rememberCommands run in terminal (not Claude Code).
kln init # Initialize: install + configure provider
kln install # Install components to ~/.claude/
kln uninstall # Remove componentskln start # Start LiteLLM proxy
kln start -s all # Start LiteLLM + Knowledge server
kln stop # Stop all serviceskln status # Component status
kln doctor # Validate configuration
kln doctor -f # Auto-fix issueskln model list # List available models
kln model list --health # Check model health
kln model add # Add individual model
kln model remove # Remove model
kln model test # Test a specific modelkln provider list # Show configured providers
kln provider add # Add provider with recommended models
kln provider set-key # Update API key
kln provider remove # Remove providerDevelopment (Hidden Admin Subgroup)
kln admin test # Run test suite
kln admin sync # Sync package data
kln admin debug # Live monitoring dashboard
kln admin persist-session # Generate session log via Claude Haiku| Type | Path |
|---|---|
| SmolKLN agents | .claude/kln/agentExecute/ |
| Multi-agent reviews | .claude/kln/multiAgent/ |
| Quick reviews | .claude/kln/quickReview/ |
| Knowledge DB | .knowledge-db/ |
| Timeline | .knowledge-db/timeline.txt |
| Session logs | .serena/memories/kln-session-YYYY-MM-DD.md |
| System logs | ~/.klean/logs/ |
| Phoenix traces | http://localhost:6006 |
See reference.md for complete configuration options.