Non-Interactive Mode
When you provide a prompt argument on the command line, term2 executes non-interactively without launching the terminal UI:
term2 [options] [prompt...]Basic Non-Interactive Queries
Section titled “Basic Non-Interactive Queries”Execute one-off queries with stdout output:
term2 "Explain the purpose of package.json in this project"A new positional-prompt session without --auto-approve uses builtin:bare by default (unless --profile is specified or a persisted Mentor or Orchestrator profile takes precedence). Tool execution is disabled without --auto-approve, independently of the selected profile. --auto-approve opts out of that implicit Bare selection and enables tools. It applies GREEN/YELLOW heuristic policy; it is not the same as /auto-approve always, and RED shell commands are still refused.
The output streams directly to standard output. Non-error diagnostic logs are printed to standard error.
Enabling Tool Execution (--auto-approve)
Section titled “Enabling Tool Execution (--auto-approve)”To permit the agent to run tools (such as reading files, writing changes, or executing commands), pass --auto-approve:
term2 --auto-approve "Run pnpm typecheck and fix any trivial lint errors"Output Formatting & Scripting
Section titled “Output Formatting & Scripting”Quiet Mode (-q, --quiet)
Section titled “Quiet Mode (-q, --quiet)”Suppress non-error diagnostics on stderr to cleanly capture tool output in shell variables:
SUMMARY=$(term2 -q "Explain what a TODO comment is")JSON Mode (--json)
Section titled “JSON Mode (--json)”Emit newline-delimited JSON (NDJSON) events on standard output for machine consumption:
term2 --json "Explain common authentication security risks"The conversation event stream can emit these type values: approval_required, background_check_in_due, background_shell_completed, background_shell_output, background_shell_started, codex_rate_limits, command_message, context_compaction_completed, context_compaction_failed, context_compaction_started, cost_update, error, final, reasoning_delta, retry, retry_exhausted, run_budget, subagent_approval_required, subagent_command_message, subagent_completed, subagent_interrupted, subagent_question, subagent_retry, subagent_run_budget, subagent_started, subagent_streaming_text, subagent_streaming_tool, subagent_text_turn, subagent_tool_started, subagent_transferred, subagent_usage_update, text_delta, tool_call_streaming_delta, tool_dispatched, tool_recovery, tool_started, usage_update, and user_message_consumed_for_abort. Non-interactive JSON also emits approval_rejected for a refusal and completed after success.
Streaming Reasoning Deltas (--show-reasoning)
Section titled “Streaming Reasoning Deltas (--show-reasoning)”Stream thinking/reasoning deltas from reasoning-capable models (e.g. o1, o3, Grok, Claude with thinking) to standard error:
term2 --show-reasoning "Solve this mathematical recurrence relation"Minimal-Prompt Execution (--lite)
Section titled “Minimal-Prompt Execution (--lite)”--lite (or -l) is a compatibility alias for --profile bare. Bare uses a minimal prompt with project instructions included; it retains codebase tools and exposes selected capabilities through run_code. Tools still require --auto-approve in non-interactive mode:
term2 --lite "Explain the difference between disk usage and apparent file size"Pauses and Exit Codes
Section titled “Pauses and Exit Codes”- 0: Successful completion.
- 1: Failure. A tool refusal can still be followed by successful completion; inspect stderr or JSON
approval_rejectedrather than relying only on the exit code. - 2: A recoverable context-limit or run-budget pause. Completed work and session history are retained; use the printed
--resume <session>hint after reviewing the limit.
With --json, context-limit pauses emit context_paused with a code of request_input_limit, context_compaction_hard_fit, or provider_context_overflow. Budget check-ins emit run_budget_paused, including budget evidence and recovery guidance. --auto-approve never grants more run budget. The default budget escalation, warn, remains advisory.