Lacuna/Labs
spot-trend-in-my-shop
green
#230 / 601

NAME

spot-trend-in-my-shop — Find an emerging pattern across listings + receipts.

SYNOPSIS

id spot-trend-in-my-shop tier green section §8. Green — cloud assist + web search + vision (46 baseline, 152 post-matrix) trigger analysis-pattern tools cortex.aggregate, web_search source carry-forward

DESCRIPTION

web search reads the live market in your niche; we diff against where you sit. The gap between what's moving and what you're listing is the opportunity.

Find an emerging pattern across listings + receipts.

MECHANISM

PREfetchGUARDtier: greenACTperformRESULTrenderON-ERRretry / esc
;;~ title    "Spot a trend in my shop"
;;~ author   "lacuna"
;;~ version  1
;;~ mode     automation
;;~ flavor   light-purple
;;~ id       spot-trend-in-my-shop
;;~ touches  ()
;;~ summary  "Find an emerging pattern across listings + receipts."

;; Find an emerging pattern across listings + receipts.
;;
;; 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 'spot-trend-in-my-shop
  '((author    . "lacuna")
    (version   . 1)
    (read-only . #t)))

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

(define (fetch ctx)
  (act 'etsy/listings (list 'active) '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 'spot-trend-in-my-shop 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/spot-trend-in-my-shop.sks · 50 lines

EXAMPLES

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

TIER

green
cloud assist / web search / image understanding · sub-cent / call

FITNESS

Ready

Fits any shop today — this one has no sample-size floor.

SEE ALSO

HISTORY

canonical source: curator/docs/AUTOMATIONS-CANONICAL.md · §8-green-cloud-assist-web-search-vision-46-baseline-152-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)