Chat & Do
The two primary interaction modes in Opta CLI. chat gives you a conversational session with manual control. do runs an autonomous agent loop to complete a task from start to finish.
Chat Mode
opta chat starts an interactive conversation session. The model receives your messages, streams back responses token by token, and maintains full context across the conversation. You stay in control of tool approvals and can guide the conversation at every step.
opta chatopta chat --model deepseek-r1Streaming Output
Responses stream in real time as tokens are generated. You see the output building character by character, giving immediate feedback even for long responses. The stream includes thinking indicators and turn statistics (tokens generated, speed in tokens/sec, elapsed time) displayed after each response completes.
Tool Execution
During a chat session, the model can invoke tools to interact with your system. Tools let the AI read files, write code, run shell commands, and search your codebase. Each tool call is displayed in a collapsible card showing the tool name, arguments, and result.
| Tool | Description | Auto-approve |
|---|---|---|
| read_file | Read contents of a file | Yes |
| write_file | Create or overwrite a file | Prompt |
| run_command | Execute a shell command | Prompt |
| search_files | Search file contents with regex | Yes |
| list_directory | List directory contents | Yes |
Permission Prompts
When the model requests a tool that modifies your system (writing files, running commands), the CLI displays a permission prompt. You can approve, deny, or approve all similar operations for the rest of the session.
Tool: write_file
Path: src/auth/validate.ts
Content: (47 lines)
[A]pprove [D]eny [A]ll for this tool [Q]uitread_file, search_files, and list_directory are auto-approved by default. This can be changed in configuration.Do Mode
opta do takes a natural-language task and runs an autonomous agent loop. It plans the work, executes tool calls, and iterates until the task is complete. Safe tools (reads, searches) are auto-approved; destructive tools (writes, commands) still require confirmation unless you opt in to full auto-approval.
opta do "Refactor the auth module to use JWT tokens"How Do Works
When you run opta do, the agent follows this loop:
- Receives your task description as the initial prompt
- Analyzes the codebase by reading relevant files
- Creates a plan of changes needed
- Executes changes step by step, using tools
- Verifies the result (runs tests if applicable)
- Reports completion with a summary of changes made
Mode Flag
The --mode flag controls how the agent approaches the task.
--mode plan makes the agent analyze and propose changes without executing them. It produces a detailed plan you can review before running the actual implementation.
opta do "Add error handling to API routes" --mode planTool Call Limits
To prevent runaway agent loops, opta do enforces a maximum of 30 tool calls per task. If the agent reaches this limit, it stops and reports what it accomplished. You can then resume or start a new task to continue the work.
do commands.Cancelling a Task
Press Ctrl+C at any time to cancel a running task. The agent will stop after completing its current tool call. Any changes already written to disk remain in place -- the cancellation does not roll back previous tool calls.
# Press Ctrl+C during executionTask cancelled. 12 of 30 tool calls used.\nChanges written to 3 files.
Available Tools
Both chat and do modes have access to the same set of tools. The difference is only in approval behavior -- do mode auto-approves safe tools while chat mode may prompt depending on your settings.
| Category | Tools | Safety |
|---|---|---|
| Read | read_file, search_files, list_directory | Safe |
| Write | write_file, edit_file, delete_file | Destructive |
| Execute | run_command | Destructive |
| Browser | browser_open, browser_navigate, browser_screenshot | Destructive |
Examples
opta chatopta chat --model qwen3-30bopta chat --session abc123