Dhara
Reference

CLI Reference

Complete reference for all Dhara CLI commands and flags.

CLI Reference

Basic Usage

dhara [command] [options]

Commands

One-Shot Mode

Run a single prompt and exit:

dhara "Explain the architecture of this codebase"

Options:

FlagDescription
--provider <name>LLM provider (openai, anthropic, google, etc.)
--model <name>Model ID
--max-iterations <n>Max tool-use loop iterations (default: 10)
--max-tokens <n>Max tokens per response
--jsonJSON output mode
--no-contextSkip context file loading
--no-autosaveDon't save session

REPL Mode

Interactive chat with persistent state:

dhara --repl

REPL Commands

CommandDescription
/exit or /qQuit REPL
/clearClear conversation history
/statusShow current session info and context files loaded
/reloadReload context files (AGENTS.md / CLAUDE.md)
/session <id>Switch to a different session
/helpShow available commands

Approve Mode

Prompt before each tool execution:

dhara --mode approve "Refactor the auth module"

Review Mode

Run tools automatically, show results for review between iterations:

dhara --mode review "Add unit tests for auth"

TUI Mode

Full terminal UI with real-time streaming:

dhara --tui

Session Management

List Sessions

dhara session list [--provider <name>] [--search <query>]

Resume Session

dhara --session <id>

Rename Session

dhara session rename <id> [new-title]

Delete Session

dhara session delete <id> [--force]

Export Session

dhara session export <id> --format <json|markdown|text> [output-file]

Import Session

dhara session import --format <claude|pi|openai-chat> --file <path>

Replay Session

dhara session replay <id> [--headless]

Branch Session

dhara session branch <id> --name <branch-name>

Compact Session

dhara session compact <id> --keep <n>

Extension Management

Install Extension

dhara extension install <package-name>

Uninstall Extension

dhara extension uninstall <package-name>

List Extensions

dhara extension list

Update Extension

dhara extension update <package-name>
dhara extension update --all

Configuration

View Config

dhara config show

Edit Config

Opens the global config in your default editor:

dhara config edit

Set Config Value

dhara config set provider openai
dhara config set model gpt-4o

Permissions

# List all permissions
dhara config permissions list

# Show extension permissions
dhara config permissions show <extension>

# Approve a capability
dhara config permissions approve <extension> <capability>

# Revoke a capability
dhara config permissions revoke <extension> <capability>

# Reset all permissions for an extension
dhara config permissions reset <extension>

Health Checks

Doctor

Run diagnostics:

dhara doctor

Options:

FlagDescription
--check-sessionsValidate session files against schema
--audit-logShow recent audit log entries
--verify-extensionsVerify installed extension manifests

Version

dhara --version

Control output format:

# Default — human-readable with colors
dhara "Explain this code"

# JSON mode — machine-parseable output
dhara --json "Explain this code"

# Quiet mode — only final result, no tool output
dhara --quiet "Explain this code"

Environment Variables

VariableDescription
OPENAI_API_KEYOpenAI API key
ANTHROPIC_API_KEYAnthropic API key
GOOGLE_API_KEYGoogle Gemini API key
MISTRAL_API_KEYMistral API key
GROQ_API_KEYGroq API key
DHARA_PROVIDERDefault provider name
DHARA_MODELDefault model ID
DHARA_CONFIG_DIROverride config directory (default: ~/.dhara/)

Exit Codes

CodeMeaning
0Success
1General error
2Configuration error
3Provider error (API key missing, rate limited, etc.)
4Extension error (spawn failed, protocol violation)