| 1 | # Message Loop Result Extensions DOX |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | - Own normalization and policy handling after a model turn completes, before default assistant-history and tool-dispatch processing. |
| 6 | |
| 7 | ## Ownership |
| 8 | |
| 9 | - Extensions receive mutable `result_data` with `llm_result` and may set `skip_default_processing` after fully handling the turn. |
| 10 | - `_20_empty_response.py` retries turns with neither response nor reasoning, counts them toward the unusable-response limit without adding a warning to model history, and uses `fw.msg_empty_response.md` for agent-prefixed UI warning text only. |
| 11 | - `_30_repeat_response.py` retries response content that exactly matches `loop_data.last_response`, regardless of reasoning, using `fw.msg_repeat.md` for history and `fw.msg_repeat_response.md` for the agent-prefixed UI warning text. |
| 12 | |
| 13 | ## Local Contracts |
| 14 | |
| 15 | - Files run in deterministic filename order. |
| 16 | - A handler that sets `skip_default_processing` owns needed history and UI side effects for that turn. |
| 17 | - Handlers that should not add side effects after an earlier extension has handled the result must return when `skip_default_processing` is set. |
| 18 | - Do not use this point to mutate streamed partial content. |
| 19 | |
| 20 | ## Work Guidance |
| 21 | |
| 22 | - Normalize a completed result before policy extensions compare or persist it. |
| 23 | - Keep loop-control policy independent from optional plugins. |
| 24 | |
| 25 | ## Verification |
| 26 | |
| 27 | - Run message-loop and unusable-response regression tests. |
| 28 | |
| 29 | ## Child DOX Index |
| 30 | |
| 31 | No child DOX files. |