Arcen Agent v1.0.0
⌘K
⌘K

CLI & TUI User Guide

Arcen Agent supports two local interface modes: a classic interactive CLI built with prompt_toolkit and Rich, and an Ink-based TUI.


1. CLI Commands & Slash Commands

Launch the classic interactive session:

arcen

Slash Command Registry

All slash commands are registered centrally as CommandDef entries in arcen_cli/commands.py. This ensures autocomplete, help pages, Slack routing, and Telegram menus stay in sync automatically.

To add or modify a command:

  1. Define a CommandDef in arcen_cli/commands.py:
    CommandDef(
        name="background",
        description="Put the current task in the background",
        category="Session",
        aliases=("bg", "detach"),
        args_hint="[task_id]",
    )
  2. Add a command handler in ArcenCLI.process_command() in cli.py:
    elif canonical == "background":
        self._handle_background(cmd_original)
  3. If the command runs remotely, register its handler in gateway/run.py as well.

Common Slash Commands

CommandCategoryDescription
/new (or /reset)SessionReset the conversation history and start a new session.
/model [provider:model]SessionSwitch model and provider for the active session.
/usageSessionView current token counts and budget limits.
/skillsToolsList available built-in and optional skills.
/skin [name]ConfigSwitch the active terminal visual theme.
/quitExitTerminate the CLI.

2. TUI Architecture

The Terminal User Interface (TUI) replaces the classic prompt-toolkit shell. Launch it with:

arcen --tui
# or
ARCEN_TUI=1 arcen

Process Model

The TUI is structured as two separate processes communicating over standard input/output:

┌────────────────────────────────┐
│         Node (Ink UI)          │   TypeScript owns the screen, rendering
│   (Transcripts, Prompts, etc.) │   the transcript, composer, and status logs.
└───────────────┬────────────────┘

         stdio JSON-RPC

┌───────────────▼────────────────┐
│      Python (tui_gateway)      │   Python manages AIAgent iterations, session DB
│   (AIAgent, Tools, Sessions)   │   records, tool registry checks, and LLM calls.
└────────────────────────────────┘

3. Local TUI Development

The TUI is built using React, Ink, and TypeScript in the ui-tui directory.

Development Commands

cd ui-tui
npm install        # Install Node dependencies
npm run dev        # Run in watch mode (compiles ink and updates on change)
npm run build      # Full production build compiling assets
npm run type-check # Run TypeScript checks without building
npm test           # Execute Vitest test suites

TypeScript and State Style Rules

When developing for the TUI, follow these architectural constraints:

  • State Management: Use small, focused nanostores rather than monolithic React component state when state is shared or accessed by distant components.
  • Store Subscriptions: Components rendering from an atom should use useStore(atom). Pure logic handlers should read state using $atom.get() instead of subscribing.
  • Asynchronous Handlers: Async UI triggers should return void explicitly:
    onClick={() => void save()}
  • Type Interfaces: Prefer interface rather than type intersections for public component props:
    interface ButtonProps extends React.ComponentProps<'button'> {
      variant?: 'primary' | 'secondary';
    }
  • Routing & Routing Roots: Keep route entry files thin. They are controllers for composing child routes and layout shells; business logic belongs in separate packages.