drivia-legion-ai
v2.0.0
Published
Drivia Legion AI — AI-powered lead generation + conversion engine. 15+ ed-tech personas, 10+ scraping sources, 6 sales psychology frameworks (Carnegie, Cialdini, Ziglar, Cardone, Covey, Voss), multi-AI fallback (Claude → Gemini → OpenAI), plain email form
Maintainers
Readme
@drivia/legion-ai
Drivia Legion AI — AI-powered lead generation + conversion engine for Drivia.
Private package. UNLICENSED. Do not distribute.
What It Does
Drivia Legion AI is the intelligence layer behind Drivia's automated outreach system. It:
- Scrapes 15+ ed-tech personas from Reddit, Dev.to, HN, Adzuna, Product Hunt, GitHub, RemoteOK, Arbeitnow
- Scores leads by purchase intent signal strength (keyword-based, 0–100)
- Tags leads into one of 15+ personas for hyper-personalized emails
- Writes AI emails using 6 sales psychology frameworks (Carnegie, Cialdini, Ziglar, Cardone, Covey, Voss)
- Tracks clicks with UTM attribution — see exactly who clicked which email
- Negotiates replies with multi-turn AI that drives to booking calls (never quotes prices)
- Multi-AI fallback — Claude → Gemini → OpenAI ensures 99.9% uptime
- Q-learning integration — reinforcement learning optimizes outreach strategy over time
- Plain email format — looks like a personal email from Wilson, not marketing spam
The 15+ Target Personas
| Tag | Persona | Pain Point |
|-----|---------|------------|
| upskilling | Upskilling Seeker | No clear learning path |
| job_seeker | Job Seeker | Skills gap costing interviews |
| career_change | Career Changer | No on-ramp into tech |
| newsletter | Newsletter Builder | Audience growth too slow |
| educator | Educator / Teacher | Overwhelmed by repetitive Q&A |
| course_creator | Course Creator | Students not completing courses |
| edtech_builder | Ed-Tech Builder | 18+ months to build AI learning infra |
| personalization_accessibility | Personalization Champion | One-size-fits-all fails diverse learners |
| ai_in_education | AI in Education | Generic LLMs not built for learning |
| distribution | Content Creator | Content takes forever, growth is random |
| corporate_training | Corporate Trainer / L&D | Onboarding slow, compliance painful |
| homeschool | Homeschool Parent | Doing it alone is exhausting |
| k12 | K-12 Administrator | Student engagement declining |
| disability | Special Ed / Disability | IEP compliance overwhelming, tools don't adapt |
| charter_school | Charter School Innovator | Need to differentiate from traditional |
| healthcare | Healthcare / CE | CE credits and compliance are painful |
6 Sales Psychology Frameworks
| Framework | Author | When Used | |-----------|--------|-----------| | Carnegie | "How to Win Friends" | Educators, job seekers — empathy-first | | Cialdini | "Influence" | Newsletter, distribution — social proof + scarcity | | Ziglar | "Secrets of Closing" | Career changers — feel/felt/found technique | | Cardone | "Sell or Be Sold" | Ed-tech builders, corporate — assume the sale | | Covey | "7 Habits" | General — seek to understand first | | Voss | "Never Split the Difference" | Negotiations — tactical empathy + calibrated questions |
Negotiation Rules
The AI negotiation engine follows strict rules:
- NEVER quotes prices — all pricing discussed on booking calls only
- Always drives to booking — every reply ends with
https://drivia.consulting/book - Under 80 words — casual, warm, confident tone
- Multi-turn context — remembers full conversation history
- Graceful unsubscribe — negative/spam replies handled with class
Usage
import {
DRIVIA_PERSONAS,
scoreLead,
extractTags,
filterHighValue,
BOOKING_URL,
AI_MODELS,
NEGOTIATION_RULES,
} from "@drivia/legion-ai";
import { pickFramework } from "@drivia/legion-ai/frameworks";
import { REDDIT_SUBS, DEVTO_TAGS } from "@drivia/legion-ai/sources";
// Score a scraped post
const lead = scoreLead({
name: "sarah_dev",
source: "reddit",
source_url: "https://reddit.com/r/cscareerquestions/...",
source_title: "How do I break into AI without a CS degree?",
source_body: "I've been trying to learn Python but don't know which course to take...",
});
// => { score: 75, tags: ["upskilling", "career_change", "ai_interest"], ... }
// Get all high-value leads (score >= 40)
const hotLeads = filterHighValue(leads, 40);
// Pick the right sales framework for this lead
const framework = pickFramework(lead.tags);
// => { name: "Ziglar+Carnegie", description: "Find their pain..." }
// Get persona config for a tag
import { getPersonaByTag } from "@drivia/legion-ai/personas";
const persona = getPersonaByTag("edtech_builder");
// => { emailAngle: "The AI learning infrastructure...", framework: "Cardone+Authority", ... }Architecture
┌─────────────────────────────────────────────────────┐
│ Drivia Legion AI │
├─────────────────────────────────────────────────────┤
│ │
│ ┌─────────┐ ┌──────────┐ ┌──────────────────┐ │
│ │ Scraper │→│ Scoring │→│ Tag + Persona │ │
│ │ (10+ │ │ Engine │ │ Assignment │ │
│ │ sources) │ │ (0-100) │ │ (15+ personas) │ │
│ └─────────┘ └──────────┘ └──────────────────┘ │
│ ↓ ↓ │
│ ┌─────────┐ ┌──────────┐ ┌──────────────────┐ │
│ │ Email │→│ Hunter.io│→│ Verification │ │
│ │ Enrich │ │ + GitHub │ │ (bounce guard) │ │
│ └─────────┘ └──────────┘ └──────────────────┘ │
│ ↓ ↓ │
│ ┌─────────┐ ┌──────────┐ ┌──────────────────┐ │
│ │ AI │→│ Framework│→│ Send via Resend │ │
│ │ Writer │ │ Selector │ │ (plain personal) │ │
│ │ (3 LLMs)│ │ (6 types)│ │ + BCC archive │ │
│ └─────────┘ └──────────┘ └──────────────────┘ │
│ ↓ ↓ │
│ ┌─────────┐ ┌──────────┐ ┌──────────────────┐ │
│ │ Follow │→│ Reply │→│ AI Negotiation │ │
│ │ Up (4 │ │ Detect │ │ → Book Call │ │
│ │ steps) │ │ + Route │ │ (never prices) │ │
│ └─────────┘ └──────────┘ └──────────────────┘ │
│ │
│ Supabase Edge Functions + pg_cron scheduling │
│ Multi-AI: Claude → Gemini → OpenAI fallback │
│ Q-Learning: Strategy optimization over time │
└─────────────────────────────────────────────────────┘Edge Functions
| Function | Purpose |
|----------|---------|
| lead-gen-agent | Main orchestrator: scrape → enrich → write → send → follow-up |
| lead-scraper | High-volume parallel scraping (called per-source by cron) |
| legion-ai-pipeline | Conversational email pipeline with A/B subjects + social proof |
| lead-gen-negotiate | AI negotiation engine for inbound replies |
Changelog
v2.0.0 (2026-03-16)
Breaking Changes:
- Removed
DISCOUNT_LADDERandDRIVIA_PRICES— AI never quotes prices now - Negotiation drives exclusively to booking calls at
drivia.consulting/book
New Features:
- 6 new personas:
corporate_training,homeschool,k12,disability,charter_school,healthcare - 6 sales psychology frameworks module (
frameworks.ts) - Scraping sources module (
sources.ts) with all Reddit, Dev.to, HN, Adzuna configs - Multi-AI fallback: Claude → Gemini 2.0 → OpenAI gpt-4o-mini
- Follow-up time budgeting (110s) to prevent edge function timeouts
- Plain personal email format (no branded headers)
- Booking-first negotiation with master sales psychology prompt
- Inbound email forwarding fix (replies now properly processed)
- Unified email identity:
[email protected]/reply.drivia.consulting
v1.0.0 (2025-12-15)
- Initial release: 10 personas, scoring, discount ladder, UTM tracking
