Maxxing Code
Documentation · ScriptingGetting startedModels and providersInstruction filesPermissionsToolsSessionsSkills, commands, sub-agentsMCPScriptingACPConfigurationArchitectureDesign decisions

Scripting

-p: one answer

maxxing-code -p "what does the retry logic in src/http.ts do?"
git diff --staged | maxxing-code -p "write a commit message for this diff"
maxxing-code -p --mode accept-edits --allow "Bash(npm test:*)" "fix the failing test in src/cart"

The answer goes to stdout, everything else (retries, notices, --verbose tool lines) to stderr. What is piped on stdin is appended to the prompt. The session is saved like any other: -c continues it.

Nobody can answer a question in this mode, so anything that would ask for permission is refused and the agent adapts. Give the permissions up front with --mode, --allow and --deny (Permissions).

Exit codes: 0 done, 1 error, 2 stopped on a refused permission, 130 interrupted.

--json: the event stream

-p --json prints one JSON object per line: first the session, then every event of the turn, then the result.

{"type":"session","id":"20260114-ab12cd34ef56","cwd":"/work/shop","model":"anthropic/claude-sonnet-4-5","mode":"default"}
{"type":"turn_start"}
{"type":"user_message","text":"fix the test","images":0,"from":"prompt"}
{"type":"thinking","delta":"…"}
{"type":"text","delta":"I'll run the tests first."}
{"type":"assistant_message","message":{…},"usage":{"input":812,"output":36,"cacheRead":0,"cacheWrite":0,"reasoning":0},"cost":0.0031,"model":"…","contextTokens":848}
{"type":"tool_start","id":"c1","name":"bash","input":{"command":"npm test"},"title":"npm test"}
{"type":"tool_update","id":"c1","output":"…"}
{"type":"tool_end","id":"c1","name":"bash","output":"…","isError":false}
{"type":"turn_end","reason":"done","usage":{…},"cost":0.0124}
{"type":"result","reason":"done","text":"The discount was…","cost":0.0124,"usage":{…},"session":"20260114-ab12cd34ef56"}
Event Meaning
text, thinking pieces of the answer and of the reasoning, as they stream
stream_reset the model call is being retried: discard the pieces streamed for it
assistant_message one model call is complete, with its tokens, its cost and the context size
tool_start, tool_update, tool_end a tool call; display on tool_end carries a diff or a task list
todos, mode the task list or the permission mode changed
retry, notice a passing error is being retried; something worth telling
compaction_start, compaction_end the conversation was summarized
subagent an event of a sub-agent, with the callId of the task call that started it
turn_end, result reason is done, interrupted, error or denied

For a two-way integration (permissions answered by your program, several prompts, cancel), use ACP rather than parsing this stream.

Edit this page on GitHub