CognitiveMode
The autonomous control loop that orchestrates task execution, manages reasoning state, and defines the agent's problem-solving persona.
Core Architecture
Stateful
Strategy Engine
⚙️ OrchestrationConfig.json
{
"mode": "AdaptivePlanningMode",
"schema_strategy": "ScientificMethod",
"auto_fix": true,
"model_config": {
"smart": "gpt-4-turbo",
"fast": "gpt-3.5-turbo"
}
}
→
🧠 Live Transcript
State: Hypothesis Testing
graph TD
A[Analyze Error] --> B{Hypothesis?}
B -->|Network| C[Check DNS]
B -->|Code| D[Run Linter]
C --> E[Refute Hypothesis]
E --> A
Thinking: Network checks passed. Switching strategy to Code Analysis.
Executing: RunCodeTask...
Cognotik ships with four distinct architectural patterns for problem-solving.
| Mode Name | Architecture | Best Use Case |
|---|---|---|
| WaterfallMode | Plan -> Review -> Execute |
Well-defined problems requiring user approval of the roadmap. |
| ConversationalMode | Listen -> Act -> Reply |
Interactive debugging or simple "Chat with Code" workflows. |
| AdaptivePlanningMode | Loop(Think -> Act -> Reflect) |
Complex, ambiguous goals requiring research and self-correction. |
| HierarchicalPlanningMode | Tree(Decompose -> Delegate) |
Massive projects requiring sub-goal decomposition. |
Integration Guide
To use a specific mode, reference it in your OrchestrationConfig. The resulting execution plan is stored in the Tasks data structure.
val config = OrchestrationConfig(
// Select the architectural mode
mode = CognitiveMode.AdaptivePlanningMode,
// Inject the reasoning strategy
overrides = mapOf(
"schema_strategy" to "AgileDeveloper"
),
// Define autonomy level
autoFix = true
)
Implementation Note: Tasks.kt
The
Tasks class acts as the container for the MutableList<TaskExecutionConfig> generated by the Cognitive Mode. It ensures that every task in the sequence is validated before execution.