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

# Chat

> Interactive chat mode with AI agents

The `chat` command starts an interactive chat session with an AI agent.

## Usage

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai chat [OPTIONS] [PROMPT]
```

## Arguments

| Argument | Description                         |
| -------- | ----------------------------------- |
| `PROMPT` | Initial prompt for the chat session |

## Options

| Option                     | Short | Description                                                                                             | Default                |
| -------------------------- | ----- | ------------------------------------------------------------------------------------------------------- | ---------------------- |
| `--model`                  | `-m`  | LLM model to use                                                                                        | provider-aware default |
| `--verbose`                | `-v`  | Verbose output                                                                                          | `false`                |
| `--memory`                 |       | Enable memory persistence                                                                               | `false`                |
| `--tools`                  | `-t`  | Comma-separated tool names (e.g. `web_search,github`) or a `tools.py` file path                         |                        |
| `--user-id`                |       | User ID for memory isolation                                                                            |                        |
| `--session`                | `-s`  | Session ID to resume                                                                                    |                        |
| `--workspace`              | `-w`  | Workspace directory                                                                                     | current dir            |
| `--debug`                  |       | Enable debug logging to `~/.praisonai/async_tui_debug.log`                                              | `false`                |
| `--safe` / `--no-safe`     |       | Safe mode: require approval for file writes and commands (default: **on**). Use `--no-safe` to disable. | `true`                 |
| `--autonomy/--no-autonomy` |       | Enable agent autonomy for complex tasks                                                                 | `true`                 |
| `--ui-backend`             |       | UI backend: `auto`, `plain`, `rich`, `mg`                                                               | `auto`                 |
| `--json`                   |       | Output JSON (forces plain backend)                                                                      | `false`                |
| `--no-color`               |       | Disable colors                                                                                          | `false`                |
| `--theme`                  |       | UI theme: `default`, `dark`, `light`, `minimal`                                                         | `default`              |
| `--compact`                |       | Compact output mode                                                                                     | `false`                |
| `--no-rules`               |       | Disable auto-injection of project instruction files                                                     | `false`                |
| `--no-context`             |       | Disable AGENTS.md/CLAUDE.md auto-loading into system prompt                                             | `false`                |

<Note>
  `praisonai chat` with no `--model` picks a default that matches your active provider credential — it no longer always falls back to `gpt-4o-mini`. See [Setup → What happens if you skip `--model`](/docs/cli/setup#what-happens-if-you-skip---model) for the precedence ladder.
</Note>

## Piped Input

`praisonai chat` accepts piped stdin as an initial prompt seed.

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
echo "$STACKTRACE" | praisonai chat "Explain this"
```

Prompt argument is merged first, piped body second. The interactive REPL still opens for follow-up turns. See [Piped Input](/docs/features/cli-piped-stdin).

## Examples

### Start a chat session

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai chat
```

### Chat with initial prompt

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai chat "Hello, how can you help me today?"
```

### Chat with specific model

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai chat --model gpt-4o "Explain machine learning"
```

### Chat with memory enabled

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai chat --memory "Remember my name is Alice"
```

### Resume a previous session

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai chat --session abc123
```

### Use plain text output (no colors)

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai chat --ui-backend plain "What is 2+2?"
```

### Output as JSON

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai chat --json "Summarize this text"
```

### Use middle-ground UI (enhanced streaming)

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai chat --ui-backend mg
```

### Chat without auto-loaded instructions

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai chat --no-rules "Hello, ignore project rules"
```

The chat session normally inherits `AGENTS.md`/`CLAUDE.md`/`PRAISON.md` from the working directory. `--no-rules` runs the assistant with only its built-in instructions.

## Exit codes

`praisonai chat` returns a non-zero exit code on failure so shell scripts and CI can detect problems without parsing stderr.

| Exit code | Meaning                                                                                                                                                 |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `0`       | Prompt executed successfully.                                                                                                                           |
| `1`       | Authentication failed (invalid or missing API key), the agent raised an exception, or a profiled run finished with no response and a logged auth error. |

<Note>
  Exit-code semantics apply to single-prompt / non-interactive invocations (`praisonai chat "..."` and `praisonai chat --profile ...`). The interactive TUI (`praisonai chat` with no prompt) always exits `0` when you leave the session.
</Note>

### Detect failures in a script

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
if ! praisonai chat "Summarize the changelog" >/dev/null; then
  echo "chat failed — check credentials or provider status" >&2
  exit 1
fi
```

### CI example (GitHub Actions)

```yaml theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
- name: Smoke-test chat
  run: praisonai chat "Say hello" > /tmp/chat.out
  env:
    OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
```

The step fails automatically if the key is invalid — no extra parsing needed.

## Project context

By default, `praisonai chat` walks up from the current directory to your git root and prepends any `AGENTS.md` / `CLAUDE.md` / `agents.md` / `.agents/AGENTS.md` it finds to the agent's system prompt, layered on top of `~/.praisonai/AGENTS.md`. Pass `--no-context` (or set `PRAISON_NO_CONTEXT=true`) to disable. See [Context Files](/docs/features/context-files) for details.

## UI Backends

The `--ui-backend` flag controls how output is rendered:

| Backend | Description                                       |
| ------- | ------------------------------------------------- |
| `auto`  | Auto-select best available (default)              |
| `plain` | Plain text, no colors, works everywhere           |
| `rich`  | Rich formatting with colors and panels            |
| `mg`    | Middle-ground: enhanced streaming with no flicker |

**Environment variable**: Set `PRAISONAI_UI_SAFE=1` to force plain backend.

## Interactive Commands

During a chat session, you can use these commands:

| Command                  | Description                                                |
| ------------------------ | ---------------------------------------------------------- |
| `/help`                  | Show available commands                                    |
| `/exit`, `/quit`         | Exit the chat session                                      |
| `/clear`                 | Clear conversation history                                 |
| `/new`                   | Start new conversation                                     |
| `/session`               | Show current session info                                  |
| `/sessions`              | List all saved sessions                                    |
| `/continue`              | Continue most recent session                               |
| `/model [name]`          | Show or change model                                       |
| `/cost`                  | Show token usage and cost                                  |
| `/history`               | Show conversation history                                  |
| `/export [file]`         | Export conversation to file                                |
| `/import <file>`         | Import conversation from file                              |
| `/status`                | Show ACP/LSP runtime status                                |
| `/auto`                  | Toggle autonomy mode (auto-delegate complex tasks)         |
| `/debug`                 | Toggle debug logging to `~/.praisonai/async_tui_debug.log` |
| `/plan <task>`           | Create a step-by-step plan for a task                      |
| `/handoff <type> <task>` | Delegate to specialized agent (code/research/review/docs)  |
| `/compact`               | Toggle compact output mode                                 |
| `/multiline`             | Toggle multiline input mode                                |
| `/files`                 | List workspace files for @ mentions                        |
| `/queue`                 | Show pending prompts in queue                              |

## Quick Start

Running `praisonai` with no arguments starts interactive mode:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai
```

This is equivalent to `praisonai chat`.

## Features

The interactive chat mode includes:

* **ASCII Art Logo** - Beautiful PraisonAI branding on startup
* **Status Bar** - Shows model, session info, and keyboard shortcuts
* **Auto-completion** - Tab completion for commands and file paths
* **Command History** - Navigate previous commands with arrow keys
* **Markdown Rendering** - Rich formatted responses with syntax highlighting
* **Streaming Output** - Real-time response streaming

## See Also

* [Interactive TUI](/docs/cli/interactive-tui) - Full TUI interface
* [Session](/docs/cli/session) - Session management
* [Memory](/docs/cli/memory) - Memory management
