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, and validation_rules.
  • Task N+1 is blocked until Task N is 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

pending running self_test validated committed released_next failed Task N+1 can start validation failed + retries left retry budget exhausted runtime error commit error unlock Task N+1

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.

  1. Inspect your current agents:
kafclaw config get agents.list
  1. 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
  1. Keep exploratory or chat agents disabled:
kafclaw configure --agent-id main --agent-cascade-enabled-set --agent-cascade-enabled=false
  1. Verify persisted config:
kafclaw config get agents.list
  1. Validate runtime behavior on a trace:
kafclaw task status --trace <trace-id> --json

For failure triage, see the runbook snippet in Memory Governance Operations.


Back to top

Apache®, Apache Wayang®, Wayang®, Apache Kafka®, Kafka®, Apache Flink®, Flink®, Apache Iceberg®, Iceberg®, Apache Spark®, Spark® and associated open source project names are trademarks of the Apache Software Foundation.
Maintained and developed by Scalytics (www.scalytics.io).

This site uses Just the Docs, a documentation theme for Jekyll.