Overview
Kapso uses a modular architecture with pluggable components connected through factories. The system is designed around a central orchestration loop that coordinates experimentation.Component Responsibilities
Kapso (Main API)
The user-facing entry point that provides the four-pillar API:OrchestratorAgent
The central coordinator that manages the solve loop:Pluggable Components
All major components are created via factories and can be swapped via configuration:| Component | Factory | Registered Types |
|---|---|---|
| Search Strategy | SearchStrategyFactory | llm_tree_search, linear_search |
| Context Manager | ContextManagerFactory | token_efficient, kg_enriched, cognitive |
| Knowledge Search | KnowledgeSearchFactory | kg_graph_search, kg_llm_navigation |
| Coding Agent | CodingAgentFactory | aider, gemini, claude_code, openhands |
| Evaluator | EvaluatorFactory | no_score, regex_pattern, llm_judge, … |
| Stop Condition | StopConditionFactory | never, threshold, plateau, … |
Configuration Flow
Data Flow
- Problem Handler provides problem context and evaluation
- Context Manager gathers problem + history + knowledge
- Search Strategy generates and selects solutions
- Experiment Workspace manages git branches
- Coding Agent generates code from solutions
- Problem Handler evaluates code and returns scores
- RepoMemory tracks code understanding across experiments
Directory Structure
Key Design Patterns
Factory Pattern
All pluggable components use factories with decorator-based registration:Configuration Modes
Configuration is organized into modes that bundle related settings:Git-Based Experiment Isolation
Each experiment runs on its own git branch, enabling:- Parallel experimentation
- Easy rollback to any state
- Tree-based solution exploration
- RepoMemory inheritance across branches