Lacuna/Labs
detect-near-duplicate-image
green
#216 / 601

NAME

detect-near-duplicate-image — Flag a photo that looks like another listing's. Addresses pain #26.

SYNOPSIS

id detect-near-duplicate-image tier green section §8. Green — cloud assist + web search + vision (46 baseline, 152 post-matrix) trigger event tools (vision) source carry-forward

DESCRIPTION

Pure-logic check — one feature inspected per row. Surfaces a flag for the operator's eye; never acts alone.

Flag a photo that looks like another listing's. Addresses pain #26.

MECHANISM

PREfetchGUARDtier: greenACTperformRESULTrenderON-ERRretry / esc
;;~ title    "Detect near-duplicate image"
;;~ author   "lacuna"
;;~ version  1
;;~ mode     automation
;;~ flavor   pink
;;~ id       detect-near-duplicate-image
;;~ touches  ()
;;~ summary  "Flag a photo that looks like another listing's."

;; Flag a photo that looks like another listing's.
;;
;; Local Sakura runs over one listing's context. precondition_fetch
;; pulls the listing record, sakura/decide produces the summary or
;; comparison, type-trap on the output, then announce.

(cart 'detect-near-duplicate-image
  '((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) 'invoke)))

(define (invoke ctx)
  (let ((listing (ctx-result ctx)))
    (cond
      ((null? listing)              (escalate 'no-data null))
      ((eq? listing 'rate-limited)  (after 30 'fetch ctx))
      (else (act 'sakura/decide
                 (list 'task 'detect-near-duplicate-image listing)
                 'check-result)))))

(define (check-result ctx)
  (let ((r (ctx-result ctx)))
    (cond
      ((null? r)                  (escalate 'sakura-empty null))
      ((not (string? r))          (escalate 'sakura-garbled null))
      (else                       (next 'announce (ctx-set 'output r ctx))))))

(define (announce ctx) (done))

source: curator-web/src/scheme/carts/etsy/detect-near-duplicate-image.sks · 47 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)