Skip to content

Headless mode (exec)

Run hipmmcode non-interactively from scripts, CI, cron jobs, or other programs.

bash
hipmmcode "what's the latest tokio release?"      # positional prompt → exec
hipmmcode exec "fix the failing test"             # explicit form
cat report.md | hipmmcode "summarize this"        # stdin as context
echo "prompt" | hipmmcode                         # stdin as the prompt

Non-zero exit on failure — safe to gate CI steps on.

Output formats

FlagOutput
(default)Final assistant text, plain
--json / --output-format jsonOne JSON envelope: result text, usage, cost, session id, exit metadata
--stream / --output-format stream-jsonNDJSON — one event per line as the run progresses (tool calls, text deltas, result)

Extra stream detail: --include-partial-messages (per-token deltas), --include-hook-events (hook lifecycle frames), --prompt-suggestions (predicted next user message), --verbose.

Structured output

Force the answer to conform to a JSON Schema — validated, with automatic retry on mismatch:

bash
hipmmcode --print --json-schema '{"type":"object","properties":{"version":{"type":"string"}},"required":["version"]}' \
  "what is the latest stable Rust version?"

Limits & budgets

bash
hipmmcode --max-turns 8 "..."            # cap tool-use iterations (default 200)
hipmmcode --max-budget-usd 0.50 "..."    # hard spend ceiling — run stops when reached

Budget exhaustion is reported in the result envelope (budget_exceeded).

System prompt control

FlagEffect
--system-prompt <text> / --system-prompt-file <f>Replace the lead system prompt entirely (exec only)
--append-system-prompt <text> / --append-system-prompt-file <f>Append to the default prompt (repeatable)
--dump-system-promptPrint the fully-assembled prompt and exit (no model call)
--no-memorySkip injecting persistent memory files
--exclude-dynamic-system-prompt-sectionsMove per-machine sections to the first user message for better prompt-cache reuse

Sessions in headless runs

Headless runs persist sessions by default (resumable later):

bash
hipmmcode --resume sess_abc "continue where we left off"
hipmmcode -c "one more thing"                  # continue the most recent session
hipmmcode --fork-session --resume sess_abc "try a different approach"
hipmmcode --no-session-persistence "throwaway question"

Autonomy helpers

bash
# Keep going until a condition is met (verified by a cheap evaluator model):
hipmmcode --goal "all tests pass" "fix the test suite"

# End-of-run memory extraction (self-evolution):
hipmmcode --auto-memory "refactor the config loader"

goalMaxContinuations (default 25) bounds --goal; goalEvaluatorModel picks the evaluator.

Permissions without a human

Headless runs have no one to click "allow". Options:

FlagBehavior
(none)ask-rule decisions fail closed (denied)
--dangerously-skip-permissionsBypass all prompts (except explicit deny rules)
--permission-mode acceptEditsAuto-approve file edits, still deny risky bash
--permission-webhook <url>POST each decision to your service; reply {"behavior":"allow"|"deny"|"allow_always"}
--permission-prompt-tool <mcp-tool>Route decisions to an MCP tool
--ask-webhook <url>POST AskUserQuestion calls to your service; reply {"answers":[…]}

See Permissions for rule syntax.

Tool surface control

bash
hipmmcode --allowed-tools Bash,Read,Grep "..."   # allowlist (FileRead still works as alias)
hipmmcode --disallowed-tools WebSearch "..."         # denylist (applied after allowlist)
hipmmcode --bare "..."                               # fast start: skip skills/MCP/hooks, tools narrowed to Bash+Read+Edit
hipmmcode --safe-mode "..."                          # troubleshooting: disable ALL customizations

Scheduled runs

bash
hipmmcode cron list               # durable tasks in <cwd>/.hipmmcode/scheduled_tasks.json
hipmmcode cron daemon --interval 60   # out-of-process scheduler: poll + fire tasks headlessly

Exit codes

CodeMeaning
0Success
1Error (flag / config / auth / network)
2Bad JSON args or a blocking hook
non-zeromax-turns cap, budget ceiling, or schema-validation retry exhaustion

For long-lived integrations, prefer the server & task queue or the SDK protocol. The complete machine-integration handbook is embedded in the binary: hipmmcode integration.