Skip to content

Running Prompts

clido can be used non-interactively from the command line. This is useful for scripting, CI pipelines, and one-shot tasks where you do not want the TUI.

Pass your prompt as a positional argument:

Terminal window
clido "explain the purpose of each function in src/lib.rs"

Or use the run subcommand (useful in scripts to avoid ambiguity with flags):

Terminal window
clido run "explain the purpose of each function in src/lib.rs"

Both forms are equivalent.

Pipe a prompt through stdin:

Terminal window
echo "what does this code do?" | clido
cat error.log | clido "explain these errors and suggest fixes"

When stdin is not a TTY and no prompt is given on the command line, clido reads stdin as the prompt.

::: tip Combining stdin and file context You can pass a prompt on the command line and pipe supplementary content in the same invocation, though this is uncommon. Most of the time the agent uses its file-reading tools directly. :::

Control output format with --output-format:

Human-readable output. The agent’s final response is printed, along with tool activity and a cost footer:

Terminal window
clido "count lines in main.rs"
[Turn 1] Reading src/main.rs...
src/main.rs has 312 lines.
Cost: $0.0009 Turns: 1 Time: 2.1s

A single JSON object with the full session result:

Terminal window
clido --output-format json "count lines in main.rs"
{
"session_id": "a1b2c3d4e5f6...",
"result": "src/main.rs has 312 lines.",
"total_cost_usd": 0.0009,
"num_turns": 1,
"duration_ms": 2100,
"exit_status": "success"
}

Newline-delimited JSON events emitted as they happen. Useful for integrating clido into a parent process that wants to observe progress:

Terminal window
clido --output-format stream-json "count lines in main.rs"
{"type":"tool_start","tool_name":"Read","input":{"file_path":"src/main.rs"}}
{"type":"tool_done","tool_name":"Read","is_error":false,"duration_ms":12}
{"type":"assistant_text","text":"src/main.rs has 312 lines."}
{"type":"result","exit_status":"success","total_cost_usd":0.0009,"num_turns":1,"duration_ms":2100}

See Output Formats for the full schema of each format.

Suppress spinner, tool lifecycle output, and the cost footer — only print the agent’s final response:

Terminal window
clido --quiet "what is the sum of 2 + 2?"
# 4

Quiet mode is useful when the output will be consumed by another tool:

Terminal window
SUMMARY=$(clido --quiet "summarise CHANGELOG.md in one paragraph")
echo "$SUMMARY" | pbcopy

--print (or -p) is similar to --quiet but also disables the REPL. It is intended for non-interactive pipelines where you want to ensure clido never blocks waiting for user input:

Terminal window
clido --print "list all TODO comments in this repo"

Prevent runaway agents with explicit limits:

Terminal window
# Stop after 5 turns
clido --max-turns 5 "refactor the authentication module"
# Stop if cost exceeds $0.50
clido --max-budget-usd 0.50 "generate comprehensive tests for all public APIs"

When a limit is reached, clido exits with code 3 (soft limit) and prints whatever the agent has produced so far.

Default values (from config):

  • --max-turns: 50
  • --max-budget-usd: 5.0

Control how the agent handles state-changing tool calls:

ModeBehaviour
defaultPrompt for permission before each state-changing tool call (TUI) or allow all (non-TUI)
accept-allAllow all tool calls without prompting
planNo tool calls allowed; agent can only plan and respond with text
Terminal window
# Trust the agent completely
clido --permission-mode accept-all "apply all the TODO items in this file"
# Read-only — agent cannot modify files or run commands
clido --permission-mode plan "review this codebase and suggest improvements"

::: warning accept-all gives the agent full access to your filesystem and shell. Only use it when you trust the prompt and have reviewed the task scope. :::

Terminal window
# Use a specific model for this invocation
clido --model claude-haiku-4-5 "quick question: what is 17 * 23?"
# Use a different provider
clido --provider openrouter --model anthropic/claude-3-5-sonnet "refactor this"

By default clido uses the current directory as the workspace root. Override with --workdir (or -C):

Terminal window
clido -C /path/to/project "add type hints to all functions"

Here is a shell script pattern for using clido’s JSON output programmatically:

#!/usr/bin/env bash
set -euo pipefail
RESULT=$(clido --output-format json --quiet --max-turns 10 \
"analyse src/ and list any files with cyclomatic complexity > 10")
# Use jq to extract the result text
echo "$RESULT" | jq -r '.result'
EXIT=$(echo "$RESULT" | jq -r '.exit_status')
if [ "$EXIT" != "success" ]; then
echo "Agent did not complete successfully: $EXIT" >&2
exit 1
fi
FlagDescription
--output-formattext (default), json, or stream-json
--input-formattext (default) or stream-json
--quiet / -qSuppress tool output and cost footer
--print / -pNon-interactive; no REPL
--max-turns NMaximum agent turns (default: 50)
--max-budget-usd NMaximum cost in USD
--permission-modedefault, accept-all, or plan
--modelModel override
--providerProvider override
--workdir / -CWorking directory
--continueResume newest session
--resume IDResume session by ID prefix

See All Flags for the complete reference.