CoT Cascading Protocol
The Cascading Protocol applies Chain-of-Thought style task decomposition with strict stage gates between subtasks.
- Every subtask declares
required_input,produced_output, andvalidation_rules. Task N+1is blocked untilTask Nis committed with validated outputs.- Failures route back with deterministic reasons (
missing_input,missing_output,invalid_rules) and retry controls. - State transitions are durable and idempotent.
State Machine Infographic
When To Use
Use this mode for deterministic, verifiable work where output shape and validation are clear.
- Runbooks and operations workflows
- Config generation and structured updates
- Code mod pipelines and migration steps
- Multi-stage tasks where each step has hard contracts
When Not To Use
Avoid this mode for open-ended and high-ambiguity work.
- Creative generation and brainstorming
- Exploratory research without stable validation criteria
- Low-latency conversational tasks
- Tasks where strict sequencing blocks useful parallelism
Implications and Tradeoffs
- Improves reliability by preventing context drift between subtasks.
- Reduces copy-of-copy distortion via explicit output validation.
- Adds latency and compute cost due to retries and gate checks.
- Can stall throughput if contracts are underspecified.
- Requires better task design (
required_input,produced_output, and validation rules must be explicit). - On retry-threshold exceed, failed transitions now trigger deterministic escalation hints for fallback model and tooling.
Configuration Guidance
This should be enabled per agent only when the agent’s workload is deterministic and auditable.
- Recommended: ops/runbook/config/code-mod agents
- Not recommended: general-purpose chat or exploratory analysis agents
Use kafclaw configure to enable or disable cascade behavior at the agent level, and keep default behavior unchanged for agents that do not need gated execution.
Migration Guide for Existing Agent Configs
Use this flow when upgrading an existing installation that already has agents.list entries.
- Inspect your current agents:
kafclaw config get agents.list
- Enable cascade only for deterministic agents:
kafclaw configure --agent-id ops --agent-cascade-enabled-set --agent-cascade-enabled=true
kafclaw configure --agent-id runbook --agent-cascade-enabled-set --agent-cascade-enabled=true
- Keep exploratory or chat agents disabled:
kafclaw configure --agent-id main --agent-cascade-enabled-set --agent-cascade-enabled=false
- Verify persisted config:
kafclaw config get agents.list
- Validate runtime behavior on a trace:
kafclaw task status --trace <trace-id> --json
For failure triage, see the runbook snippet in Memory Governance Operations.