?

Overview

rousseau chat opens the interactive Bubble Tea TUI (source: internal/cli/chat.go and internal/tui/model.go). It wires together the session store (SQLite at state.path), the tool registry (read, write, edit, grep, bash), the approval policy, and the LLM provider — then hands control to the terminal UI.

This is the primary interactive surface. It is the one subcommand that expects a real user at the keyboard; every other transport subcommand (whatsapp, slack, discord, and friends) is a headless daemon that reuses the same wiring underneath.

Synopsis

rousseau chat [--session <id>] [--title <string>] [--config <path>]

Flags

Flag Type Default Effect
--session string empty Resume an existing session by id (loads via state.Store.Load).
--title string "chat <UTC-date>" Title assigned when creating a new session. Ignored when --session is set.
--config string $XDG_CONFIG_HOME/rousseau/config.yaml Path to the YAML config file. Persistent flag inherited from the root command.

There are no other flags on chat. Everything else — provider, log level, approver — is picked up from config, environment, or hard-coded defaults.

Environment variables

rousseau chat inherits every environment variable resolved by config.Load (see internal/config/config.go). The most relevant ones:

Variable Effect
ROUSSEAU_PROVIDER Overrides provider.
ROUSSEAU_LOG_LEVEL Overrides log.level (debug, info, warn, error).
ROUSSEAU_LOG_FORMAT Overrides log.format (text or json).
ROUSSEAU_STATE_PATH Overrides the SQLite session store location.
XDG_CONFIG_HOME Config discovery base directory.
XDG_DATA_HOME State discovery base directory.

Provider selection precedence

The provider is resolved in the order flag > env > file > default:

  1. --config YAML provider: field.
  2. ROUSSEAU_PROVIDER environment variable.
  3. Hard-coded default claudecli (set in setDefaults).

The provider factory (buildProvider in internal/cli/provider.go) is called before the TUI starts; a misconfigured provider aborts the command with a non-zero exit code before the screen switches to alt-screen mode.

Session-store interaction

  • The store is opened at state.path (default ~/.local/share/rousseau/sessions.db). Missing parent directories are created with mode 0755.
  • --session <id> calls store.Load(ctx, id). An unknown id returns an error.
  • Without --session, a fresh agent.Session is created and immediately persisted so subsequent rousseau session list calls see it.
  • Every message committed inside the TUI is saved via store.Save. The store closes on TUI exit (best-effort).

Exit codes

Code Meaning
0 Clean exit (Ctrl+C, :q, or provider EOF).
1 Configuration, provider, or store error before TUI startup.
130 SIGINT while inside the TUI (Bubble Tea exits with 130 by convention).

Worked examples

# 1. Default: start a fresh session with an auto-generated title
rousseau chat

# 2. Resume yesterday's session (find the id with `rousseau session list`)
rousseau chat --session 3f4b1c9e-…

# 3. Named session, structured JSON logs to a file
ROUSSEAU_LOG_FORMAT=json rousseau chat --title "auth refactor" 2>chat.log

# 4. Point at a project-scoped config
rousseau chat --config ./ops/rousseau.yaml

Common failure modes

  • claudecli: exec: "claude": executable file not found — the default provider needs the claude CLI on $PATH. Either install Claude Code or set provider: anthropic with an API key. See Providers: claudecli.
  • state: open …/sessions.db: unable to open database file — the parent directory is not writable. Run rousseau doctor for the resolved path.
  • session not found — the id passed to --session does not exist. Use rousseau session list to discover valid ids.

Related pages

Type to search 150+ pages. Ranking: BM25 with title/description boost.