Lacuna/Labs
year-end-summary
deep purple
#302 / 601

NAME

year-end-summary — Narrative recap of the year.

SYNOPSIS

id year-end-summary tier deep-purple section §10. Deep purple ✨ — deep reasoning (34 baseline, 45 post-matrix) trigger cron (Dec 31) tools cortex.aggregate (heavy) source carry-forward shape PLAYBOOK

DESCRIPTION

deep reasoning runs a multi-step playbook. Reserved for strategy, MCMC, code-from-scratch — things where a single cloud reasoning call would give the right answer but not the right plan.

Narrative recap of the year.

MECHANISM

DATAyour cortexFITmathPOSTERIORcredible bandFORECASTdecision
;;~ title    "Year-end summary"
;;~ author   "lacuna"
;;~ version  1
;;~ mode     automation
;;~ flavor   light-purple
;;~ id       year-end-summary
;;~ touches  ()
;;~ summary  "Narrative recap of the year for the shop."

;; Narrative recap of the year for the shop.
;;
;; 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 'year-end-summary
  '((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 'year-end-summary 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/year-end-summary.sks · 50 lines

EXAMPLES

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

TIER

deep purple
deep reasoning · batched · dollars per run

FITNESS

Not yet

This method only gives a real answer above a sample threshold. Running it on a small shop produces a confidence band the size of the universe — useless. When the shop crosses the threshold, this lights up.

SEE ALSO

HISTORY

canonical source: curator/docs/AUTOMATIONS-CANONICAL.md · §10-deep-purple-deep-reasoning-34-baseline-45-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)