headless
Run Mayros in non-interactive mode. Send a prompt, receive the response, and exit — ideal for scripts, CI/CD pipelines, and automation.
Usage
bashmayros -p "your prompt here" mayros --prompt "your prompt here"
Stdin is automatically read and appended to the prompt when available:
bashecho "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:
bashmayros -p "list all exported functions in src/index.ts"
JSON
Accumulates the full response silently, outputs a single JSON object on completion:
bashmayros -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:
bashmayros -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
| Flag | Description | Default |
|---|---|---|
-p, --prompt | The prompt to send | required |
--output-format | text, json, or stream-json | text |
--json | Shorthand for --output-format json | — |
--model | Override the model | config default |
--thinking | Thinking mode: on, off, verbose | config default |
--timeout | Timeout in milliseconds | 120000 |
--max-turns | Maximum conversation turns | unlimited |
--max-budget-usd | Maximum cost budget | unlimited |
--system-prompt | Prepend a system message | — |
--append-system-prompt | Append a system message | — |
--tools | Comma-separated tool restriction list | all tools |
--json-schema | Validate output against JSON Schema | — |
--session | Use a specific session | new session |
--deliver | Enable delivery mode | false |
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
| Code | Meaning |
|---|---|
0 | Success |
1 | Error (timeout, connection failure, schema validation failure) |