headless

Run Mayros in non-interactive mode. Send a prompt, receive the response, and exit — ideal for scripts, CI/CD pipelines, and automation.

Usage

bash
mayros -p "your prompt here"
mayros --prompt "your prompt here"

Stdin is automatically read and appended to the prompt when available:

bash
echo "explain this code" | mayros -p "review the following"
cat src/index.ts | mayros -p "find bugs in this file"

Output formats

Text (default)

Streams response text to stdout as it arrives:

bash
mayros -p "list all exported functions in src/index.ts"

JSON

Accumulates the full response silently, outputs a single JSON object on completion:

bash
mayros -p "analyze this code" --output-format json
json
{
  "type": "final",
  "text": "The analysis shows...",
  "model": "claude-sonnet-4-20250514",
  "inputTokens": 1234,
  "outputTokens": 567
}

Stream JSON

JSON-lines format — each event is a separate JSON object:

bash
mayros -p "explain step by step" --output-format stream-json
json
{"type":"delta","text":"First, "}
{"type":"delta","text":"we need to..."}
{"type":"final","text":"First, we need to...","inputTokens":100,"outputTokens":50}

Options

FlagDescriptionDefault
-p, --promptThe prompt to sendrequired
--output-formattext, json, or stream-jsontext
--jsonShorthand for --output-format json
--modelOverride the modelconfig default
--thinkingThinking mode: on, off, verboseconfig default
--timeoutTimeout in milliseconds120000
--max-turnsMaximum conversation turnsunlimited
--max-budget-usdMaximum cost budgetunlimited
--system-promptPrepend a system message
--append-system-promptAppend a system message
--toolsComma-separated tool restriction listall tools
--json-schemaValidate output against JSON Schema
--sessionUse a specific sessionnew session
--deliverEnable delivery modefalse

Examples

Script integration

bash
# Generate a commit message
DIFF=$(git diff --staged)
MSG=$(echo "$DIFF" | mayros -p "write a commit message for this diff" --output-format json | jq -r '.text')
git commit -m "$MSG"

CI pipeline

bash
# Code review in CI
mayros -p "review this PR for security issues" \
  --model claude-sonnet-4-20250514 \
  --max-budget-usd 0.50 \
  --timeout 60000

Tool restrictions

bash
# Only allow read-only tools
mayros -p "analyze the codebase" --tools "read,glob,grep"

JSON Schema validation

bash
# Structured output
mayros -p "list the top 3 issues" \
  --json-schema '{"type":"object","required":["issues"],"properties":{"issues":{"type":"array"}}}'

Exit codes

CodeMeaning
0Success
1Error (timeout, connection failure, schema validation failure)