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

# Multiline Input

> Multiline text input support across all ChatCLI modes using the --- delimiter.

ChatCLI supports multiline text input in **all modes** (Chat, Agent, and Coder), allowing you to organize your messages, paste code snippets, or send complex instructions without each Enter submitting the message.

***

## How It Works

The `---` delimiter (three or more dashes) controls multiline mode:

1. **Open**: Type `---` on a line by itself and press Enter
2. **Write**: Each Enter adds a new line (does not submit)
3. **Close and send**: Type `---` again on a line by itself

<Note>
  The delimiter accepts **3 or more dashes** (`---`, `----`, `-----`, etc.). They all work the same way.
</Note>

***

## Examples by Mode

### Chat Mode (main prompt)

```text theme={"system"}
> ---
  Multiline mode — type --- on a new line to finish
  ... [1] I need help with a complex problem.
  ... [2] I have a REST service that needs:
  ... [3] - JWT authentication
  ... [4] - rate limiting
  ... [5] - email validation
  ... [6] ---
```

All 5 lines are sent as a **single message** to the AI.

### Coder Mode (waiting for user response)

When the AI in `/coder` mode asks a question and waits for your response, you can also use multiline:

```text theme={"system"}
  Waiting for your response (--- for multiline, 'exit' to finish): ---
  Multiline mode — type --- on a new line to finish
  ... [1] PostgreSQL on port 5432
  ... [2] Host: db.internal
  ... [3] Database: myapp_prod
  ... [4] Use pgx as driver
  ... [5] ---
```

The complete response is added to the history and the AI continues the ReAct cycle with all the information.

### Agent Mode

The same mechanism works in `/agent` mode when the system requests user input.

***

## Cancelling Multiline

| Mode            | How to cancel | Result                                                       |
| --------------- | ------------- | ------------------------------------------------------------ |
| **Chat**        | `Ctrl+C`      | Discards all accumulated text, shows `[multiline cancelled]` |
| **Agent/Coder** | `Ctrl+C`      | Cancels the current operation (default Ctrl+C behavior)      |

***

## Continuation Prompt

While multiline mode is active, the prompt changes to show the line number:

```text theme={"system"}
  ... [1] first line
  ... [2] second line
  ... [3] third line
```

This makes it easy to know how many lines you've typed and maintain visual organization.

***

## When to Use

<CardGroup cols={2}>
  <Card title="Complex Instructions" icon="list-check">
    When your request has multiple requirements or constraints that are clearer organized on separate lines.
  </Card>

  <Card title="Detailed Responses" icon="message-lines">
    When the AI asks something in Coder mode and you need to provide several pieces of information at once (database, host, credentials, etc.).
  </Card>

  <Card title="Structured Context" icon="layer-group">
    When you want to send a specification, task list, or bug description formatted in multiple lines.
  </Card>

  <Card title="Code Snippets" icon="code">
    When you need to paste or type a code snippet as part of the message.
  </Card>
</CardGroup>

***

## Technical Details

* The `MultilineBuffer` component is shared across all modes
* In Chat mode, go-prompt displays the continuation prompt via `changeLivePrefix`
* In Agent/Coder mode, `readMultiline()` reads from the centralized `stdinLines` channel
* Empty lines (Enter without text) are included normally in the multiline content
* The opening and closing delimiters are **not** included in the final text
