# Reasoning & Iteration in AgentServer v2.0 **January 03, 2026** LLM-based listeners (agents) achieve multi-step reasoning, planning, tool use, and iteration through **open, auditable self-calls and subthreading** — not hidden loops or state machines. ## Core Mechanism 1. **Thread = Memory** Full conversation history (all messages in the thread, including thoughts/tools/system) is the only memory. Each LLM call receives the complete thread context (system prompt + prior messages). 2. **Self-Reflection = Self-Message** To think step-by-step or continue reasoning, the agent emits its own root tag in the same thread: ```xml Outlining steps... ``` Pump routes it back → appended to history → next LLM call sees it. 3. **Iteration Emerges Naturally** Repeated self-calls continue until the agent emits a final response (e.g., structured answer to human). 4. **Subthreading for Parallel/Branched Computation** See [Thread Management](thread-management.md) for details. Agents spawn branches explicitly: ```xml ... ``` Core confirms with assigned ID → parallel queue drains independently. ## System Messages (Core-Generated Feedback) The organism injects visible system payloads for primitives and errors — ensuring no silent failure and aiding LLM recovery: - Spawn confirmation: ```xml ``` - Unknown thread error: ```xml ``` - Context management confirmation (agent-requested): ```xml ``` - Future primitives (timer, etc.) follow the same pattern — always visible, immediate response. ## Structured Planning Support Agents are encouraged to use visible structures for coordination: ```xml Search web Analyze results ``` Enables self-reading, GUI rendering, explicit termination. ## Key Properties - **No Hidden State**: Thread history is the sole memory. - **Fully Auditable**: Every thought, plan, spawn, system feedback, and step is a logged message. - **Tool Use Identical**: Calls to other listeners are normal payloads. - **Termination Natural**: Agent decides final output tag. The framework turns conversation into visible, branched computation — safe, transparent, and Turing-complete within bounds.