An emergency ops agent must write a structured JSON status update into the incident log after every tool turn. How should that side effect be enforced?
Select an answer to reveal the explanation.
Short Explanation
Incident logs are the black box on the fire truck—you can't count on an entry after every move if it's just up to the model to append JSON in its response text. Hooks make that logging automatic and structured.
Full Explanation
Use hooks to force structured JSON logging after each tool turn so an emergency ops agent writes a structured status update into the incident log every time. Incident logs are the black box: entries must be automatic and structured, not optional. Adding model instructions to append JSON status in the response text is only advisory; the model can ignore or vary the format, and it does not force structured logging after each tool turn the way post-tool hooks do, which run as part of the harness lifecycle and append JSON status (tool name, result summary, timestamp, incident ID). Relying on model instructions to append JSON in the response text fails by concept: discretionary logging is non-deterministic under incident load. Using a Stop hook to write a batched JSON log at session end fails completeness—most tool turns would be unlogged until the session ends, and a crash before then loses them. Defining an output style that formats status updates as JSON fails durability and shared incident-command visibility; it only changes how the model renders chat text and does not write to the incident log of record. Exam caveat: hook-enforced logs must avoid dumping sensitive raw payloads unnecessarily; prefer structured summaries with redaction rules. Operational check: attach an after-tool hook that writes schema-validated JSON to the incident log, fail closed or alert if logging fails, test multi-tool turns for one-entry-per-turn fidelity, and verify responders can query status without relying on chat scrollback.