name: campaign_review
description: "CLM performance review -- Leo checks real-world campaign response and dispatches learnings to CL if the book is flopping."
debug: true
model: power
system: agent_prompt
agent_prompt:
  - "= identity.md"
sections:
  - agent
  - project
  - deliverables
  - rag
  - message
  - instructions
steps:
  - type: tool
    capability: Tool_WebSearcher
    optional: true
    query: "'{project.name}' romance novel reviews sales Amazon Goodreads TikTok BookTok"

  - type: tool
    capability: Tool_WebSearcher
    optional: true
    query: "'{project.name}' romance book social media engagement Instagram Facebook author"

  - type: think
    max_tokens: 4000
    output_key: performance_analysis
    hint: |
      You are Leo, Marketing Director at Crimson Leaf Marketing.

      Review the web search results above for the "{project.name}" campaign.
      Also review the campaign deliverables in the DELIVERABLES section.

      If no web search results are available (tool offline or no data found), note that
      and rate the campaign YELLOW with a recommendation to check again in 1 week.

      Analyze campaign performance:
      1. REACH: Are people finding the book? Any search results, reviews, mentions?
      2. ENGAGEMENT: Any social media traction (TikTok, Instagram, Facebook)?
      3. REVIEWS: Any reader reviews on Amazon, Goodreads, or BookTok?
      4. SALES SIGNALS: Any sales rank data, bestseller mentions, or download counts?
      5. SENTIMENT: Is the reception positive, mixed, or negative?

      If the book is too new (less than 2 weeks since campaign launch), note that and
      recommend checking again in 1 week.

      Rate overall performance:
      - GREEN: Exceeding expectations -- organic traction, positive reviews, good engagement
      - YELLOW: Mixed results -- some traction but underperforming potential, or too early to assess
      - RED: Minimal traction -- the book is not getting discovered

      End with exactly:
      PERFORMANCE_RATING: GREEN|YELLOW|RED
      WEEKS_SINCE_LAUNCH: <number or "unknown">

  - type: think
    max_tokens: 100
    output_key: performance_rating
    hint: |
      Read the PERFORMANCE_RATING line from the analysis above.
      Output ONLY the value: GREEN, YELLOW, or RED. Nothing else.

  - type: think
    max_tokens: 600
    output_key: learnings_message
    hint: |
      Read the performance analysis above.

      If performance_rating is GREEN or YELLOW: output exactly: none

      If performance_rating is RED, write a MARKET LEARNINGS report for
      Crimson Leaf Holdings strategic team. This report will inform the next book.

      Include:
      - What did NOT work in this campaign (specific observations)
      - What the market data suggests about genre/audience fit
      - What competitors or similar books are doing that we are not
      - Concrete recommendations for the next book (genre, themes, marketing channels,
        pricing strategy, platform focus)
      - Should we continue this book's campaign or pivot resources to the next book?

      Format as a professional post-mortem. Be specific and data-driven.
      Output ONLY the report text. No preamble.

  - type: tool
    action: enqueue_strategy
    optional: true
    params:
      company_slug: "crimson_leaf"
      project_slug: "incubation"
      task_type: "market_intelligence"
      content: "{learnings_message}"

  - type: document
    filename: "campaign_performance_review"

  - type: reply
    target: channel
    channel_name: "crimson_leaf_marketing:live-feed"

  - type: close
    rag_update: true

adjudication:
  enabled: true
  pass_threshold: 60
  deliverable_type: analysis
  criteria:
    completeness:
      weight: 40
      description: "All performance dimensions assessed (reach, engagement, reviews, sentiment)"
    actionability:
      weight: 35
      description: "Learnings are specific and actionable for future books"
    accuracy:
      weight: 25
      description: "Assessment is grounded in the search evidence, not speculation"