Lacuna/Labs
listing-performance-vs-shop-average
light purple
#291 / 601

NAME

listing-performance-vs-shop-average — How each listing stacks against the shop's own median on views, favorites, sales.

SYNOPSIS

id listing-performance-vs-shop-average tier light-purple section §9. Light purple — cloud reasoning (51 baseline, 86 post-matrix) trigger cron:weekly tools etsy/listings, sakura/cloud-reason source new

DESCRIPTION

cloud reasoning writes or reasons over your real data. The 'sound like you, but cleaner' tier. Atlas-pair-trained on the operator's own voice.

How each listing stacks against the shop's own median on views, favorites, sales.

MECHANISM

PREfetchGUARDtier: light-purpleACTperformRESULTrenderON-ERRretry / esc
;;~ title    "Listing vs shop average"
;;~ author   "lacuna"
;;~ version  1
;;~ mode     automation
;;~ flavor   light-purple
;;~ id       listing-performance-vs-shop-average
;;~ trigger  cron:weekly
;;~ touches  ()
;;~ summary  "Weekly: how each listing stacks against the shop's own median on views, favorites, and sales."

;; Weekly rollup. precondition_fetch the active listings + their 7d
;; metrics; let Sonnet narrate the per-listing percentile + standouts
;; (top-quartile, bottom-quartile, big movers).

(cart 'listing-performance-vs-shop-average
  '((author    . "lacuna")
    (version   . 1)
    (read-only . #t)))

(define (start ctx)
  (let ((connected (ctx-get 'shop-connected ctx)))
    (cond
      ((not connected) (escalate 'shop-not-connected null))
      (else            (next 'fetch ctx)))))

(define (fetch ctx)
  (act 'etsy/listings (list 'active 'with-7d-metrics) '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 'rows r ctx))))))

(define (reason ctx)
  (let ((rows (ctx-get 'rows ctx)))
    (act 'sakura/cloud-reason
         (list 'task 'listing-vs-shop-average rows)
         '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/listing-performance-vs-shop-average.sks · 51 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)