zap command supports --json. Success prints a JSON document on stdout; failure prints a structured error object and exits non-zero.
Exit codes: 0 success, 1 failure, 2 usage error.
Error object
code, a human message, a retryable flag, and copyable remediation commands.
Common error codes
Session events (JSONL)
zap session --json streams one JSON event per line:
turn.failed and a stable code:
Plan output
zap compose --dry-run --json and zap run <Zap.md> --json emit deterministic plans: equivalent Runtime.md and zap.config.ts definitions produce identical plugin trees and lock hashes, so agents can diff plans reliably.