docs: Added documentation on how to inject messages mid-stream in a session

2026-07-30 10:24:57 -06:00
parent a40c055cc4
commit 14caab27db
2 changed files with 34 additions and 0 deletions
+5
@@ -214,6 +214,11 @@ with "Nothing to undo" once the session has no more messages to remove.
> **Requires an active session.** `.undo` is only available when a session is open. Outside a session, conversation
> history is not tracked in memory, so there is nothing to walk back.
> **Discarding an interrupted response:** If you pressed Ctrl+C during a streaming response (see
> [Mid-Stream Interruption](Sessions#mid-stream-interruption)), the partial response was saved to the session.
> Use `.undo` to remove it and restore your original prompt if you want to start fresh rather than continue from the
> partial output.
Note that `.undo` only modifies the in-memory session state. The append-only `messages.md` log is not affected.
If you save the session after undoing (via `.save session` or automatic save-on-exit), the saved file will reflect
the trimmed history.
+29
@@ -140,3 +140,32 @@ at runtime using the `.set` command or configured in the session's YAML file:
| `skill_instructions` | Global `skill_instructions` value | Custom text for the skill-discovery hint. `null` to reset to the built-in default. |
For more information on the Todo System, see the [Todo System documentation](TODO-System).
# Mid-Stream Interruption
When streaming is enabled and a session is active, pressing **Ctrl+C** during a response interrupts the stream and
preserves any text the model had already generated. The partial response is saved to the session as the model's last
turn, and Coyote returns to the prompt so you can continue the conversation.
This lets you redirect the LLM mid-flight without losing the context that led up to the interruption:
1. The model begins generating a response.
2. You press **Ctrl+C**. The stream stops and Coyote prints `Response interrupted`.
3. The partial response is saved to the session history.
4. You type your next message at the normal prompt. The model sees the full conversation history, including the partial
response, and your new prompt.
If you want to discard the partial response entirely rather than continuing from it, use [`.undo`](REPL#undo---undo-the-last-exchange)
to remove the last exchange from the session and restore your original prompt for editing or re-sending.
> **Requires an active session.** Mid-stream interruption only preserves partial responses when a session is open.
> Without a session, Ctrl+C aborts the response as usual and nothing is saved to history.
> **Ctrl+C before the first token.** If you press Ctrl+C while the spinner is still showing (before any response text has
> arrived), the request is aborted cleanly and nothing is saved. This is identical behavior to how `Ctrl+C` functions without a session.
> **Ctrl+D is always a hard abort.** Pressing Ctrl+D during streaming discards the partial response regardless of session state and
> exits the REPL.
> **REPL only.** When running Coyote as a one-shot CLI command (`coyote <prompt>`), Ctrl+C aborts as usual. Mid-stream interruption
> is a REPL-only feature.