 M wrappers/ca.sh
--- diff HEAD ---
diff --git a/wrappers/ca.sh b/wrappers/ca.sh
index a0bb2c6d..363efb72 100755
--- a/wrappers/ca.sh
+++ b/wrappers/ca.sh
@@ -235,11 +235,13 @@ if [[ $final_rc -eq 0 && -z "${raw_output//[[:space:]]/}" ]]; then final_rc=3; f
 echo "=== ca.sh exit=$RC (mapped to contract exit $final_rc) ===" | tee -a "$LOG"
 if [[ $final_rc -eq 75 ]]; then
   emit_event_line '{"kind":"error","subtype":"rate_limited","error":{"code":"rate_limit","message":"cursor-agent quota exhausted","errorKind":"quota"}}'
-  printf '{"ok":false,"detail":"rate-limited"}\n' | tee -a "$LOG"
+  STATUS_LINE='{"ok":false,"detail":"rate-limited"}'
 elif [[ $final_rc -eq 0 ]]; then
-  printf '{"ok":true,"detail":"cursor-agent completed","session_id":"%s"}\n' "$CHAT_ID" | tee -a "$LOG"
+  STATUS_LINE="$(printf '{"ok":true,"detail":"cursor-agent completed","session_id":"%s"}' "$CHAT_ID")"
 else
-  printf '{"ok":false,"detail":"cursor-agent failed","session_id":"%s"}\n' "$CHAT_ID" | tee -a "$LOG"
+  STATUS_LINE="$(printf '{"ok":false,"detail":"cursor-agent failed","session_id":"%s"}' "$CHAT_ID")"
 fi
+printf '%s\n' "$STATUS_LINE" | tee -a "$LOG"
 emit_event_line "$(usage_event_json)"
+printf '%s\n' "$STATUS_LINE"
 exit "$final_rc"
