Lacuna/Labs
listing-funnel-diagnosis
light purple
#292 / 601

NAME

listing-funnel-diagnosis — Walk the view → favorite → sale funnel for one listing, name the leak. Addresses pain #14.

SYNOPSIS

id listing-funnel-diagnosis tier light-purple section §9. Light purple — cloud reasoning (51 baseline, 86 post-matrix) trigger analysis-pattern tools etsy/listing, sakura/cloud-reason source new

DESCRIPTION

Walk the view → favorite → sale chain. At each step, count the drop-off. The biggest drop is where the listing is bleeding.

Walk the view → favorite → sale funnel for one listing, name the leak. Addresses pain #14.

MECHANISM

PREfetchGUARDtier: light-purpleACTperformRESULTrenderON-ERRretry / esc
;;~ title    "Listing funnel diagnosis"
;;~ author   "lacuna"
;;~ version  1
;;~ mode     automation
;;~ flavor   light-purple
;;~ id       listing-funnel-diagnosis
;;~ trigger  analysis-pattern
;;~ touches  ()
;;~ summary  "Walk the view -> favorite -> sale funnel for one listing, name the leak."

;; A reasoning walk over a single listing. Pull the listing record +
;; its 30d funnel metrics, escalate to Sonnet for the narrative. The
;; output is a paragraph naming the leak (low views? low favs/views?
;; low sales/favs?) with concrete next steps.

(cart 'listing-funnel-diagnosis
  '((author    . "lacuna")
    (version   . 1)
    (read-only . #t)))

(define (start ctx)
  (let ((id (ctx-get 'listing-id ctx)))
    (if (null? id)
        (escalate 'missing-listing-id null)
        (next 'fetch ctx))))

(define (fetch ctx)
  (let ((id (ctx-get 'listing-id ctx)))
    (act 'etsy/listing (list id 'with-funnel-30d) '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 'listing r ctx))))))

(define (reason ctx)
  (let ((listing (ctx-get 'listing ctx)))
    (act 'sakura/cloud-reason
         (list 'task 'diagnose-funnel listing)
         '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 'diagnosis r ctx))))))

(define (announce ctx) (done))

source: curator-web/src/scheme/carts/etsy/listing-funnel-diagnosis.sks · 53 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)