Envy-Based Prompt Middleware Specification

Overview

This specification defines an API-driven middleware system that injects personalized, envy-informed prompts into customer checkout experiences. The system is designed to increase loyalty program conversion using psychological levers—primarily envy, social proof, scarcity, and identity.

The core concept is based on the principles outlined in the article “Envy” (offshorewesterly.wordpress.com, April 20, 2025) and is built around the idea that customers convert when:

  • They see others gaining status or perks they do not yet have
  • They can visibly benefit by acting (rewards, early access, referrals)
  • They feel an emotional draw toward exclusivity and recognition

System Architecture

Components

  1. Client-Side SDK / ScriptTag
    • Injects into the merchant’s thank_you or confirmation page
    • Sends customer + order metadata to the API middleware
    • Receives personalized loyalty prompt content
  2. Prompt Middleware API
    • Ingests customer order context and tone profile
    • Classifies tone + bias using social signals from social login profile via classification API call
    • Selects appropriate envy-based prompt template
    • Constructs API request to OpenAI (with memory)
    • Returns: loyalty_message, cta_label, optional_share_caption, referral_code
    • Uses context memory for returning users to reduce prompt token length and API cost
  3. OpenAI Integration (with Memory)
    • Multi-turn memory stores tone_profile, cognitive_bias, optout_preference
    • Personalized prompt response per user session
  4. Merchant CRM Integration (Optional)
    • Tracks join/skip/share decisions
    • Stores tone and conversion outcome for future refinement
  5. Adaptive Self-Improvement Loop
    • A/B testing module continuously compares prompt variants based on conversion outcomes
    • LLM-initiated feedback analysis evaluates which tones and formats perform best across customer segments
    • Improves future prompts by updating templates or request logic using live performance data

Envy Prompt Strategy

Prompt Triggers (Mutually Exclusive)

  1. Defined Benefit Trigger: Customer qualifies for a reward or credit
  2. Social Capital Trigger: Customer likely to share and signal status
  3. Tribal Follower Trigger: Customer admires users already in the loyalty group

Message Requirements

  • One sentence only
  • Tone-matched to user (via classifier)
  • Ends with a CTA
  • Includes opt-out clause if user has autonomy bias or has previously declined
  • Must not sound like marketing copy (no promotional language or cliché phrasing)

Message Constraints by Tone

Tone Segment Message Style CTA Label Minimalist Dry, utility-focused “Join quietly” Aesthetic Wellness Calming, ritual-based, elegant “Join the Circle” Deal-Seeking Direct, value-emphasizing “Use your credit” Anti-Hype Skeptical, plain, self-directed “Join if you want” Social-Seeking Fun, polished, designed to be shared “Copy & Join”

Bias Stack Logic

Customer Signal Bias Inferred Follows influencers or aesthetic brands Social proof bias Posts rewards, streaks, completion Completion bias Avoids brand praise, “no ads” Autonomy bias Uses group hashtags (#ceogirl) Tribal affiliation Uses aspirational captions Envy, status-motivated


Social Signal Inference via Social Login

When customers authenticate using social login (e.g. Google, Facebook, Instagram):

  • A dedicated classification API processes the user’s public bio, recent captions, followed accounts, and hashtags
  • The API returns structured classifications:
    • tone_profile (e.g. minimalist, aesthetic, dry-skeptical)
    • cognitive_bias (e.g. autonomy, social proof, status-seeking)
  • These values are injected into prompt construction and stored in OpenAI memory for future API calls

Prompt Format (API to OpenAI)

{ "system": "You are a tone-sensitive loyalty copywriter using envy and social psychology to increase loyalty signups. Do not use marketing language.", "user": "Customer spent $78 on skincare. Tone: minimalist. Bias: autonomy + envy. Do not use praise. Emphasize the benefit without obligation. Add opt-out clause at the end. Return loyalty_message and cta_label." }

Expected GPT Output:{ "loyalty_message": "You earned $5 in credit. Use it, ignore it, up to you.", "cta_label": "Join quietly" }


Memory Fields (Persistent per Customer)

  • tone_profile
  • cognitive_bias
  • conversion_trigger_type
  • optout_preference
  • loyalty_decision (joined, skipped, shared)
  • referral_code
  • joined_at_timestamp

Failover Logic

If tone or bias cannot be reliably classified:

  • Default to neutral prompt: utility-focused, with soft opt-out clause
  • Do not inject a prompt unless conversion_trigger is validated

Future Extensions

  • Multi-language envy tone tuning
  • A/B testing of envy dial (hard vs soft)
  • Visual prompt injection with brand-safe templates
  • Leaderboard-based social proof overlays
  • Automated prompt tuning via GPT-based evaluation
  • Real-time variant ranking and regression-informed prompt mutation engine

This spec is the foundation of the LoyaltyPrompt AI middleware platform, designed to generate high-performance, envy-based loyalty invitations at scale.