From 44f351349ac70f7bf7bfd4bb77e6bf9cde40bd29 Mon Sep 17 00:00:00 2001 From: glifocat Date: Tue, 7 Jul 2026 00:26:12 +0000 Subject: [PATCH] =?UTF-8?q?docs:=20Output=20Delivery=20=E2=80=94=20message?= =?UTF-8?q?s=5Fout=20comes=20from=20=20envelope=20parsing,=20not?= =?UTF-8?q?=20raw=20results?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The section still described the pre-envelope model where every provider result was written to messages_out verbatim. Since the envelope parser landed, the agent-runner parses the final text for blocks (dispatchResultText, poll-loop.ts): one messages_out row per block, bare/ text is scratchpad (logged, never sent), unknown destinations are dropped, unwrapped output gets a one-time re-wrap nudge, and non-retryable error results are delivered as error notices instead of being dropped. --- docs/architecture.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/architecture.md b/docs/architecture.md index 4780c4075..2d4995b3d 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -486,7 +486,9 @@ The central DB session row creation is the serialization point. No provider sess ### Output Delivery -NanoClaw does not stream tokens to users. The provider's query interface yields complete results. The agent-runner writes one complete message to messages_out per result. The host delivers complete messages to channels. +NanoClaw does not stream tokens to users. The provider's query interface yields complete results, but a result's text is not delivered as-is: the agent-runner parses it for `...` blocks (`dispatchResultText` in poll-loop.ts) and writes one messages_out row per block, addressed to that destination with its thread context resolved per destination. Everything outside a block — including `...` — is scratchpad: logged, never sent. A block naming an unknown destination is dropped into the scratchpad log. + +If a result produced text but no valid block, the agent-runner pushes a one-time `` nudge into the live turn asking the agent to re-wrap its response. The exception is a non-retryable error result (e.g. a billing error) with no envelope, which is delivered as an error notice instead of being dropped as scratchpad. Mid-turn interim updates go out through the `send_message` MCP tool; the final-text envelope parsing is how a turn's reply reaches the user. The host delivers complete messages_out rows to channels. Message editing is supported as an explicit operation (agent calls an `edit_message` tool), not as a streaming mechanism.