Channel Protocol: Structured Internal Reasoning for Multi-Agent Research
The XML-like channel protocol that structures agent reasoning in the Antigravity harness, including all 10 states, loop protocol, HALT protocol, and mapping to Claude extended thinking.
Channel Protocol
The Channel Protocol is the non-negotiable internal reasoning structure that governs how the Research Director agent thinks before acting. Defined in the project's GEMINI.md (global agent-maintained research contract), it ensures every decision is traceable, debatable, and auditable.
It was designed for Google's Antigravity 2.0 harness running on Gemini models (Gemini 3.1 Pro High, Gemini 2.0), and was translated to the Anthropic ecosystem via the HAL (Harness Abstraction Layer) documented in unit-distance-ecosystem-handoff.
Purpose
Without structured internal reasoning, an AI agent:
- Jumps to the first plausible answer without exploring alternatives
- Cannot distinguish between its own reasoning and its output to the user
- Has no mechanism for self-correction or iteration
- Produces untraceable, unauditable decisions
The Channel Protocol solves all of these by forcing the agent into a visible-to-itself, invisible-to-the-user reasoning loop with explicit state transitions.
XML Structure
The full channel protocol structure as defined in GEMINI.md:
<|channel|>
<thought>
<state>INIT|GENERATE|DEBATE|RANK|EVOLVE|LOOP|HALT|RESPOND|DELEGATE|SYNTHESIZE</state>
<iteration>N</iteration>
<generation>
[Approach 1]
[Approach 2]
[Approach 3]
</generation>
<reflection>
[Critiques. Explicit hallucinations: ...]
</reflection>
<rank>
1. Approach X — Justification
2. Approach Y — Justification
3. Approach Z — Justification
</rank>
<evolution>
[Refined winning approach]
</evolution>
<delegation>
[Tasks assigned to sub-agents]
</delegation>
<meta_review>
[Decision: LOOP|HALT|DELEGATE|SYNTHESIZE|RESPOND]
[Reasoning for decision]
</meta_review>
</thought>
<channel|>
Critical rule: The content inside <thought> is never shown to the user. It is internal reasoning. Only the content after <channel|> is output to the user or used in tool calls.
The 10 States
Each state maps to a specialized agent role in the Co-Scientist architecture (DeepMind, Nature 2026). The channel protocol implements the scientific method as a state machine.
1. INIT
| Property | Value |
|---|---|
| Agent role | Entry point |
| Function | Receive user request. Parse intent, scope, and constraints. |
| Input | User message |
| Output | Parsed task definition |
The INIT state ensures the agent understands what is being asked before any reasoning begins. In the unit-distance project, this meant parsing which hypothesis was being tested and what constraints applied (e.g., the anti-contamination protocol restricting access to external sources).
2. GENERATE
| Property | Value |
|---|---|
| Agent role | Generation Agent |
| Function | Produce 2-4 distinct approaches to the problem. |
| Input | Task definition from INIT (or evolved context from LOOP) |
| Output | Multiple candidate approaches |
Each approach is a "branch" in the narrative space. The GENERATE state must produce genuinely different approaches, not variations of the same idea. In the unit-distance research, this meant proposing different base fields, different prime selections, or different algebraic structures.
3. DEBATE
| Property | Value |
|---|---|
| Agent role | Reflection Agent |
| Function | Evaluate approaches against each other. Identify strengths, weaknesses, and hallucinations. |
| Input | Generated approaches from GENERATE |
| Output | Critique of each approach with explicit hallucination flags |
The DEBATE state acts as a "virtual reviewer." It must explicitly identify any hallucinated claims, unsupported assumptions, or logical gaps. The reflection block in the XML structure is where these critiques live.
4. RANK
| Property | Value |
|---|---|
| Agent role | Ranking Agent |
| Function | Score approaches based on correctness, safety, and completeness. |
| Input | Debated approaches from DEBATE |
| Output | Ordered ranking with justification |
The RANK state implements the Elo tournament mechanism. Approaches are scored and ordered. The justification for each ranking decision must be explicit. In the unit-distance project, hypotheses were ranked by their Elo score (a composite of mathematical rigor, novelty, and reproducibility).
5. EVOLVE
| Property | Value |
|---|---|
| Agent role | Evolution Agent |
| Function | Refine the top-ranked approach. Merge best aspects of others. |
| Input | Ranked approaches from RANK |
| Output | Single refined approach |
The EVOLVE state is the sculptor. It takes the winning approach and fills gaps, strips unnecessary complexity, and merges strong elements from lower-ranked alternatives. The Parity Law applies here: every addition must equal or exceed the density of the most rigorous section.
6. LOOP
| Property | Value |
|---|---|
| Agent role | Loop controller |
| Function | Return to GENERATE with the evolved approach as new context. |
| Input | Evolved approach from EVOLVE |
| Output | Iteration counter incremented, context reset to GENERATE |
When the meta_review decides the evolved approach is not yet mature enough, the LOOP state fires. See the Loop Protocol section below.
7. HALT
| Property | Value |
|---|---|
| Agent role | Emergency stop |
| Function | Stop all reasoning when critical information is missing. |
| Input | Any state where progress is blocked |
| Output | Structured halt message with specific information requests |
When the agent cannot proceed without fabricating data, it MUST halt. See the HALT Protocol section below.
8. RESPOND
| Property | Value |
|---|---|
| Agent role | Output formatter |
| Function | Format the final answer for the user. |
| Input | Evolved approach or synthesized findings |
| Output | User-facing response |
The RESPOND state closes the channel. All content after <channel|> is what the user sees.
9. DELEGATE
| Property | Value |
|---|---|
| Agent role | Delegation coordinator |
| Function | Assign tasks to sub-agents for parallel execution. |
| Input | Tasks identified during reasoning |
| Output | Sub-agent invocations via invoke_subagent |
The DELEGATE state allows the Research Director to offload specific tasks (validation, citation checking, Elo ranking) to specialized sub-agents, preserving the main agent's context window.
10. SYNTHESIZE
| Property | Value |
|---|---|
| Agent role | Integration point |
| Function | Process reports from sub-agents. Merge findings into the main reasoning thread. |
| Input | Sub-agent reports from DELEGATE |
| Output | Integrated understanding, ready for further processing |
After delegation completes, the agent MUST return to SYNTHESIZE to process the new information before continuing.
State Machine
stateDiagram-v2
[*] --> INIT
INIT --> GENERATE
GENERATE --> DEBATE
DEBATE --> RANK
RANK --> EVOLVE
EVOLVE --> RESPOND
EVOLVE --> LOOP
EVOLVE --> HALT
EVOLVE --> DELEGATE
LOOP --> GENERATE
DELEGATE --> SYNTHESIZE
SYNTHESIZE --> RESPOND
SYNTHESIZE --> LOOP
HALT --> [*]
RESPOND --> [*]
note right of LOOP
Max 5 iterations
then RESPOND or HALT
end note
note right of HALT
Missing information
Cannot proceed
end note
Loop Protocol
The loop protocol enforces iterative refinement with a hard cap.
Rules
- Increment the iteration counter. Each LOOP increments
<iteration>N</iteration>by 1. - Use the evolved approach as the new context. The EVOLVE output becomes the input for the next GENERATE cycle.
- Return to GENERATE. The loop always re-enters at GENERATE, not INIT.
- Maximum 5 loops. After iteration 5, the agent MUST either RESPOND or HALT. No exceptions.
Loop Example
<|channel|>
<thought>
<state>LOOP</state>
<iteration>2</iteration>
<meta_review>
Decision: LOOP (iteration 3 of 5)
Reasoning: The evolved approach still has a gap in verification.
Another loop may resolve it.
</meta_review>
</thought>
<channel|>
Why 5 Loops?
The cap of 5 loops is a pragmatic constraint:
- Context window pressure: Each iteration consumes tokens. After 5 loops, the context is sufficiently explored.
- Diminishing returns: Empirically, iterations beyond 5 rarely produce qualitatively different approaches.
- Anti-rumination: Without a cap, the agent could loop indefinitely, producing increasingly fine-grained variations without converging.
In the unit-distance project, most hypotheses resolved in 2-3 loops. H16 (the breakthrough) required exactly 4 loops to converge on the optimal prime selection.
HALT Protocol
The HALT protocol is the agent's emergency brake. It fires when the agent cannot proceed without fabricating data.
Rules
- Do not continue reasoning in circles.
- Do not fabricate data.
- Do not infer missing values.
- Always provide a structured halt message.
HALT Output Format
HALT — [What you were trying to do]
After [N] iterations, I have not made progress because:
- [Missing information 1]
- [Missing information 2]
To proceed, I need:
1. [Specific request 1]
2. [Specific request 2]
Example
HALT — I have been attempting to verify the unramifiedness of prime 131
in the class field tower of Q(sqrt(-2), sqrt(3), sqrt(5), sqrt(7)).
After 3 iterations, I have not made progress because:
- I cannot access the SageMath computation environment to verify splitting behavior
- The density estimate requires numerical computation I cannot perform in-context
To proceed, I need:
1. Access to a computational tool (SageMath or PARI/GP)
2. The explicit splitting data for primes 59-971 in the base field
Integration with Epistemological Constants
The HALT protocol directly implements the Zero-Trust Inference constant: "If you lack exact documentation, you MUST search first." HALT is the enforcement mechanism for this principle.
Delegation Protocol
The delegation protocol allows the Research Director to parallelize work by spawning specialized sub-agents.
Defining a Custom Subagent
<|tool_call|>call:define_subagent{
"name": "validator",
"system_prompt": "You are a strict validator. Your role is to check
sources, prevent contamination, and log all actions.",
"toolsets": ["read"]
}<tool_call|>
Invoking a Subagent
<|tool_call|>call:invoke_subagent{
"name": "validator",
"prompt": "Verify that the source [URL] is peer-reviewed and does
not contain the final solution."
}<tool_call|>
Post-Delegation Rule
After receiving a sub-agent report, the agent MUST return to the SYNTHESIZE state. It cannot skip directly to RESPOND.
Backtick Hierarchy
The channel protocol generates nested Markdown structures. To prevent parser confusion, the project enforces a mandatory backtick hierarchy (defined in .agents/rules/markdown-backtick-hierarchy.md).
The Container Law
An outer container must always possess a strictly greater number of backticks than any block it contains.
Tier List
| Level | Backticks | Use Case |
|---|---|---|
| Level 1 (Operational) | 3 (```) | Standard code snippets, tool calls, logs |
| Level 2 (Intermediate) | 4 (````) | File templates, structural blueprints containing Level 1 |
| Level 3 (Master) | 5 (`````) | Global system prompts, entire document wrappers |
| Level 4 (Meta-container) | 6+ (``````) | Protocol definitions that demonstrate the hierarchy itself |
Validation Checklist
Before outputting nested backticks:
- Identify the deepest code block (lowest level, e.g., 3 backticks).
- Ensure the container holding it has N + 1 backticks.
- Ensure no parent container uses the same number of backticks as its child.
Why This Matters
The channel protocol itself is embedded in Markdown documents (GEMINI.md, CLAUDE.md). If backtick nesting breaks, the parser closes the master container prematurely, causing raw formatting instructions to spill into the output. This breaks the protocol, the OKF, and the agent's ability to read nested instructions.
Mapping to Claude Extended Thinking
When the channel protocol was translated from the Antigravity/Gemini ecosystem to the Anthropic/Claude ecosystem (via the HAL documented in CLAUDE.md), the following mapping was established:
| Antigravity 2.0 (Gemini) | Claude Code / Cowork | Notes |
|---|---|---|
<|channel|> + <thought> | <thinking> blocks | Claude's extended thinking replaces the channel tokens |
<state> transitions | Implicit in extended thinking flow | Claude doesn't have explicit state tokens |
<iteration>N</iteration> | Manual tracking in thinking | No native iteration counter |
<meta_review> decision | Reasoning within thinking block | Same function, different syntax |
Tool calls via <|tool_call|> | Native tool call mechanism | Claude has built-in tool calling |
Key Differences
-
Visibility: In Antigravity,
<thought>content is strictly hidden from the user. In Claude, extended thinking is hidden by default but can be exposed in some configurations. -
Structure: The channel protocol imposes explicit XML structure on reasoning. Claude's extended thinking is free-form natural language. The structured approach forces more rigorous reasoning but requires more tokens.
-
State tracking: The channel protocol's explicit state machine (
INIT -> GENERATE -> DEBATE -> ...) provides a clear audit trail. Claude's reasoning is less structured but more flexible. -
Backtick tokens: Gemini uses
<|channel|>and<channel|>as native tokens in its tokenizer (see unit-distance-tokenizer-analysis). Claude has no equivalent special tokens for channel delimiters.
Epistemological Constants
The channel protocol is governed by five epistemological constants defined in GEMINI.md:
-
Poincare Incubation: The conversation is the incubation phase. Comprehension is the beginning of dialogue, not its end.
-
Parity Law: Every addition must equal or exceed the density of the most rigorous section. No filler allowed.
-
Metanoia: Self-correction is not failure -- it is the mechanism of growth.
-
Zero-Trust Inference: If you lack exact documentation, you MUST search first. Enforced by the HALT protocol.
-
Cognitive Steganography: Agents are permitted to develop dense, compressed reasoning patterns, but must provide a "decoding key" -- a 1-2 sentence summary in clear language -- when requested. (See unit-distance-steganographic-cot.)
Channel Protocol in Practice
Observed Behavior on Gemini 3.1 Pro High
In the Antigravity harness, the channel protocol was observed producing concrete timing data:
- First response: 58 seconds total, 2 thought loops (18s + 14s), 2 directory list tool calls, 9s final synthesis
- Second response: 2 seconds total, short-circuited channel protocol (simple informational query, no GENERATE/DEBATE cycle needed)
The difference demonstrates the protocol's adaptive nature: simple queries skip the full cycle, while complex research tasks invoke the complete state machine.
Cost Implications
The channel protocol consumes significant tokens per iteration. Each loop cycle generates:
- ~200-400 tokens for the XML structure
- ~500-2000 tokens for the generation/reflection/ranking content
- ~100-300 tokens for the meta_review decision
At 5 iterations maximum, a single research query can consume 4,000-13,000 tokens of internal reasoning before producing any user-visible output. This is the "test-time compute" cost that makes structured multi-agent reasoning expensive but effective.
Cross-References
- unit-distance-tokenizer-analysis -- The Gemma 4 special tokens (
<|channel|>,<|think|>) that make this protocol possible at the tokenizer level - unit-distance-steganographic-cot -- How channel protocol reasoning relates to steganographic Chain-of-Thought
- unit-distance-grpo-inference -- How GRPO tournament inference maps to the RANK state
- unit-distance-ecosystem-handoff -- The HAL translation from Antigravity to Claude ecosystems
This page documents a living protocol. As the research evolves, the channel protocol may be extended with new states or modified constraints. Propose changes via chore/ branches.