> ## Documentation Index
> Fetch the complete documentation index at: https://docs.piebald.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat flow

In Piebald, chat flow can be manipulated in many ways, through **branching**, **queuing**, **quoting**,

## Branching

<Badge color="green">Available in [Piebald Pro](https://piebald.ai/pricing)</Badge>

*Branching* is creating a new fork or branch in a chat so that you can continue chatting with the messages prior to that fork or branch.

There are two ways of branching: **replying** to a previous message, and **editing and regenerating** a previous message. Both will generate a fresh response in a new branch.

Branching allows you to be significantly more efficient with your context window. When you want to, for example, ask a followup question of an older response, or perform more tasks related to the current conversation, you don't have to include subsequent irrelevant context.

This lets you work with the conversation's valuable past context for much longer before you have to compact or start a new chat, and avoids sending unnecessary tokens to providers.

You can rename any branch by hovering the branch tab (e.g. "Branch 1" or "Branch 2") and clicking **Rename**.

<img className="shadow-md rounded-xl" width="800" alt="Screenshot of an AI message that branched with two different user replies, and a subsequent AI message with 3 different replies and a new draft one" src="https://mintcdn.com/piebald/wjQDBwbo9_qowjtt/imgs/v0-1-13/branching.png?fit=max&auto=format&n=wjQDBwbo9_qowjtt&q=85&s=641534e412e9873ea77dfe0885c6eb98" data-path="imgs/v0-1-13/branching.png" />

If you have branches but you've downgraded to Piebald Basic, then the branch point banner will still show but it will be locked:

<img className="shadow-md rounded-xl" width="500" alt="A branch point indicator with 6 branches that are locked due to lack of Piebald Pro subscription" src="https://mintcdn.com/piebald/wjQDBwbo9_qowjtt/imgs/branching_locked_basic.png?fit=max&auto=format&n=wjQDBwbo9_qowjtt&q=85&s=e2ca70dc4aceea71df8e11d9eaa9491e" data-path="imgs/branching_locked_basic.png" />

## Quoting

<Badge color="blue">Available in Piebald Basic (Free)</Badge>

*Quoting* is where you copy some of the model's text and paste it back with a request for more discussion or explanation.

To quote a phrase or sentence, or discuss it more with the model, you can select the text and click the **Quote** button just below the message:

<img className="shadow-md rounded-xl" width="500" alt="Screenshot of Quote dropdown button (appears on selection of assistant message text)" src="https://mintcdn.com/piebald/oA_AkXyXwSPTtCub/imgs/quote_dropdown_button.png?fit=max&auto=format&n=oA_AkXyXwSPTtCub&q=85&s=e8dd8cdf4ad989dd23bab164acdc05af" data-path="imgs/quote_dropdown_button.png" />

And then Piebald will insert the message directly into the message input as a markdown blockquote:

<img className="shadow-md rounded-xl" width="500" alt="Screenshot of Quote dropdown button (appears on selection of assistant message text)" src="https://mintcdn.com/piebald/oA_AkXyXwSPTtCub/imgs/markdown_blockquote.png?fit=max&auto=format&n=oA_AkXyXwSPTtCub&q=85&s=35d07b4f27a3c79ed69be1cd1fd2d57d" data-path="imgs/markdown_blockquote.png" />

Piebald also supports quoting text in plans proposed by the model.

## Pausing

<Badge color="green">Available in [Piebald Pro](https://piebald.ai/pricing)</Badge>

*Pausing* waits for running generations and tool calls to complete and then stops the model.

Traditionally, the only way you can stop an agent is by interrupting it.  If it's generating text, there will be a partial response which will have to be regenerated, wasting time, tokens, and context space.  If it's executing a tool call, the subprocess will be killed and the system may be left in an inconsistent state (files partially modified, temporary files not cleaned up, handles corrupted, etc.).

Piebald takes advantage of the **agentic loop** to enable graceful pausing of the chat **without** interrupting.

### The agentic loop

The "agentic loop" is the underlying mechanism that enables AI agents to work autonomously.  A conversation is a list of messages starting with the first user message; that context is sent to an AI provider and a response is generated and appended to the conversation.

If the response contains tool calls, they get executed—possibly waiting while the interface allows the user to approve or deny them—and their output is appended to the conversation context, and a second response is generated.

This cycle of *context update → regenerate* fully encapsulates the entire agentic loop and is what makes modern agentic development possible.

### Pausing the loop

In order to provide graceful pausing, Piebald hooks into the agentic loop; we simply break the loop and skip auto-approval if the chat is paused.  This allows you to temporarily and cleanly stop the agent—for example, if the model has done its research and planning but your working directory isn't ready yet—without wasting time or tokens.

Pausing has another benefit as well.  When the loop is paused, no tool calls are automatically approved, so you can intercept tools that would normally be auto-approved and edit or deny them instead.  Here's an example of a read-only tool (`ls -la`) which would normally be auto-approved, but, since the chat is paused, is left waiting for manual handling:

<img className="shadow-md rounded-xl" width="600" alt="Screenshot of `ls -la` not being auto-approved because the chat has been paused." src="https://mintcdn.com/piebald/-AaSH-LxuVoxYcZl/imgs/v0-1-10/chat_paused.png?fit=max&auto=format&n=-AaSH-LxuVoxYcZl&q=85&s=5786631a488e2455117930e52e52b382" data-path="imgs/v0-1-10/chat_paused.png" />

### Resuming the loop after pausing

Resuming the loop simply picks it up where it left off; auto-approving any elligible pending tool calls, starting a new generation, and repeating.  The result will be exactly the same as if you had let the agent continue without pausing.

Pausing the agentic loop requires [Piebald Pro](https://piebald.ai/pricing).

## Continuation

<Badge color="green">Available in [Piebald Pro](https://piebald.ai/pricing)</Badge>

*Continuation* enables you to make the model keep going if it's been stopped without sending an extra dummy message like "continue" or "."

Click the Continue button next to the Send message button.

<img className="shadow-md rounded-xl" width="500" alt="Screenshot of Continue button in a chat with a user message but no AI message." src="https://mintcdn.com/piebald/6tQfHBAxXertJR1r/imgs/v0-1-6/continue_button.png?fit=max&auto=format&n=6tQfHBAxXertJR1r&q=85&s=e9fec14e8aca89958e530747d631535f" data-path="imgs/v0-1-6/continue_button.png" />

The agentic loop will be continued seamlessly.  From the model's perspective there will not have been an interruption, and it will generate a response as normal.

<Warning>
  If you click continue but the model is not in the middle of an agentic loop or has already responded without any tool calls, you may see an empty message generated when using Claude models.
</Warning>

Chat continuation requires [Piebald Pro](https://piebald.ai/pricing).

### Goals

<Badge color="blue">Available in Piebald Basic (Free)</Badge>

*Goals* force the model to continue working until it's reached the specified objective (goal).  Unless the model explicitly marks the goal as complete or blocked, generation will be automatically continued again and again each time the model stops generating.

## Usage

You can start a new goal with the `/goal <goal objective>` slash command.  The model can also start a goal itself by calling the `CreateGoal` tool.

Each time the model completes generation, Piebald automatically sends another user message with a goal-specific context notification reminding it to continue working or complete the goal.  The model can update the goal with a builtin tool, `UpdateGoal`, to mark it as complete or blocked.

The model can also get the goal details at any time using the `GetGoal` builtin tool.  This tool returns the original goal objective and the current state of the goal.

You can check on the progress of the goal by clicking the "Active goal" indicator in the chat bar at the top of the app:

<img class="shadow-md rounded-xl" width="500" alt="active_goal.png" src="https://mintcdn.com/piebald/lK9zVQ0FITXi-EDF/imgs/active_goal.png?fit=max&auto=format&n=lK9zVQ0FITXi-EDF&q=85&s=bc6a6d124dda6a2d4177833f75e6d544" data-path="imgs/active_goal.png" />

Chats with goals—active and complete—are displayed in the sidebar with a special goal indicator:

<img class="shadow-md rounded-xl" width="350" alt="chat_with_active_goal.png" src="https://mintcdn.com/piebald/lK9zVQ0FITXi-EDF/imgs/chat_with_active_goal.png?fit=max&auto=format&n=lK9zVQ0FITXi-EDF&q=85&s=97fac1fa3097f15a9f757e3a3b170bc7" data-path="imgs/chat_with_active_goal.png" />

<img class="shadow-md rounded-xl" width="350" alt="chat_with_completed_goal.png" src="https://mintcdn.com/piebald/lK9zVQ0FITXi-EDF/imgs/chat_with_completed_goal.png?fit=max&auto=format&n=lK9zVQ0FITXi-EDF&q=85&s=e3a138e4673aa2302f14738cffef9679" data-path="imgs/chat_with_completed_goal.png" />
