Lacuna/Labs
write-customer-recovery-message
light purple
#256 / 601

NAME

write-customer-recovery-message — Recovery note to an unhappy buyer, tuned to the case. Addresses pain #16.

SYNOPSIS

id write-customer-recovery-message tier light-purple section §9. Light purple — cloud reasoning (51 baseline, 86 post-matrix) trigger analysis-pattern (low rating / refund) tools draftcustomermessage, cortex_query source carry-forward

DESCRIPTION

cloud reasoning drafts a buyer-facing reply in your voice, grounded in Cortex context (the buyer's past purchases, shop policy). Never auto-sends; operator reviews and fires manually.

Recovery note to an unhappy buyer, tuned to the case. Addresses pain #16.

MECHANISM

PREfetchGUARDtier: light-purpleACTperformRESULTrenderON-ERRretry / esc
;;~ title    "Write a customer-recovery message"
;;~ author   "lacuna"
;;~ version  1
;;~ mode     automation
;;~ flavor   light-purple
;;~ id       write-customer-recovery-message
;;~ touches  ()
;;~ summary  "Recovery note to an unhappy buyer, tuned to the case."

;; Recovery note to an unhappy buyer, tuned to the case.
;;
;; Multi-step reasoning cart. precondition_fetch pulls the
;; needed shop facts, then escalates the reasoning step to
;; Sonnet via sakura/cloud-reason. Cloud is gated; we ask
;; consent before the relay if the operator hasn't pre-approved.

(cart 'write-customer-recovery-message
  '((author    . "lacuna")
    (version   . 1)
    (read-only . #t)))

(define (start ctx)
  (next 'fetch ctx))

(define (fetch ctx)
  (act 'etsy/receipts (list '90d) 'check-fetch))

(define (check-fetch ctx)
  (let ((r (ctx-result ctx)))
    (cond
      ((null? r)                       (escalate 'no-data null))
      ((eq? r 'rate-limited)           (after 30 'fetch ctx))
      (else                            (next 'reason (ctx-set 'facts r ctx))))))

(define (reason ctx)
  (let ((facts (ctx-get 'facts ctx)))
    (act 'sakura/cloud-reason
         (list 'task 'write-customer-recovery-message facts)
         'check-reason)))

(define (check-reason ctx)
  (let ((r (ctx-result ctx)))
    (cond
      ((null? r)                       (escalate 'cloud-empty null))
      ((not (string? r))               (escalate 'cloud-garbled null))
      ((eq? r 'cloud-quota-exhausted)  (escalate 'cloud-quota null))
      ((eq? r 'cloud-consent-required) (escalate 'cloud-consent null))
      (else                            (next 'announce (ctx-set 'narrative r ctx))))))

(define (announce ctx) (done))

source: curator-web/src/scheme/carts/etsy/write-customer-recovery-message.sks · 50 lines

EXAMPLES

Example forthcoming — docs/automations/examples.json entry editable in place.

TIER

light purple
cloud reasoning · cents per call

FITNESS

Almost there

Works on smaller shops too; the answer sharpens as you collect more sales.

SEE ALSO

HISTORY

canonical source: curator/docs/AUTOMATIONS-CANONICAL.md · §9-light-purple-cloud-reasoning-51-baseline-86-post-matrix
last regenerated: 2026-06-05 20:31 UTC (mechanical — edits land in the MD or sidecars, not here)

KNOWN BUGS

(none recorded — flag in AUTOMATIONS-CANONICAL.md or open an issue against the cart file)