How Niko Works
Understand how Niko, the Betwixt orchestrator agent, decomposes tasks and coordinates specialist AI models.
Niko is the orchestrator agent at the heart of Betwixt. When you send a prompt, Niko does not try to answer it directly. Instead, it analyzes the request, breaks it into sub-tasks, and delegates each piece to the specialist model best suited for the job.
The Orchestration Loop
Every interaction follows the same high-level loop:
- Receive -- Niko receives your prompt and loads relevant context from Memory-OS
- Decompose -- The request is broken into atomic sub-tasks with clear inputs and outputs
- Route -- Each sub-task is matched to a specialist model based on capability, cost, and latency
- Execute -- Sub-tasks run in parallel where possible, with Niko monitoring progress
- Synthesize -- Results are merged into a coherent response and presented back to you
Why an Orchestrator?
No single model excels at everything. Claude is strong at reasoning and long-context analysis. Codex is built for code generation and editing. Gemini handles multimodal inputs and large context windows efficiently.
By decomposing tasks and routing to specialists, Betwixt achieves higher quality results at lower cost than sending everything to a single model. The orchestrator pattern also enables parallel execution -- three models working simultaneously finish faster than one model working sequentially.
Context Management
Niko uses Memory-OS to maintain persistent context across sessions. Before executing any task, Niko queries Memory-OS for:
- Previous decisions related to the current project
- API contracts and schemas that are already defined
- Lessons learned from past debugging sessions
- Code patterns and conventions established by the team
This context is compressed and included only where relevant, which is how Betwixt achieves up to 96% token reduction compared to naive context stuffing.
Task Decomposition
Niko uses a structured decomposition model. A complex request like "refactor the authentication module and add OAuth2 support" becomes:
- Analysis task -- Review the existing auth module structure (routed to Claude)
- Schema task -- Design the OAuth2 database schema (routed to Claude)
- Implementation task -- Write the OAuth2 provider integration (routed to Codex)
- Test task -- Generate integration tests for the new flow (routed to Codex)
Each task receives only the context it needs -- not the entire codebase.
Next Steps
Learn more about Agent Routing to understand how Niko selects the right model for each sub-task.