Spaces:
Running
Running
File size: 8,021 Bytes
bd28470 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | # π€ AI Client Acquisition System
> Enterprise-grade, hyper-intelligent lead discovery, profiling, and scoring pipeline.
> Built with production AI engineering practices β not n8n-style hype.
[]()
[]()
[]()
[]()
---
## What This System Does
Automatically discovers, qualifies, and profiles potential clients for an AI automation agency.
```
Every day at 9 AM PKT:
1. Pick next territory (city Γ industry) β 27 cities, auto-rotation
2. Search Google for companies β Serper API
3. Scrape each website β Playwright (headless)
4. Detect pain signals β "no chatbot", "phone booking only", etc.
5. Gate 2: Skip if < 2 pain signals
6. Find decision-maker emails β Hunter.io + Pattern Generation + SMTP
7. Verify emails β 7-layer verification (FREE)
8. Find personal LinkedIn + social profiles
9. AI profiling β MiniMax M2.7 (chain-of-thought reasoning)
10. Deterministic scoring β 100-point scale, zero hallucination
11. Alert on Slack β hot leads (85+) instant, daily digest for all
```
## Architecture
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CRON: daily-lead-discovery (4 AM UTC = 9 AM PKT) β
β β Territory Manager β Google Search β Queue β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
βΌ (max 3 concurrent)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TASK: process-company β
β β Scrape β Pain Signals β Gate 2 β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TASK: enrich-and-profile β
β β Hunter β Pattern Gen β SMTP β LinkedIn β
β β Python AI Service β Save β Slack Alert β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
```
## Model Chain (All FREE on NVIDIA NIM)
| Priority | Model | Parameters | Use Case |
|----------|-------|-----------|----------|
| 1st | MiniMax M2.7 | ~100B+ | Profiling, scoring, complex reasoning |
| 2nd | LLaMA 3.3 70B | 70B | Reliable fallback |
| 3rd | LLaMA 3.1 8B | 8B | Email classification, simple tasks |
| 4th | Deterministic | β | Zero hallucination fallback |
**Single API key. Single endpoint. $0/day.**
## Scoring System (100 points, fully deterministic)
```
Company Fit: 25 pts (industry + size match)
AI Readiness: 20 pts (tech stack + AI jobs)
Service Match: 20 pts (pain signals β our services)
Decision Maker: 20 pts (verified email + LinkedIn + authority)
Timing: 15 pts (growth signals + active website)
Tiers: hot (85+) | warm (70-84) | nurture (50-69) | archive (<50)
```
## Tech Stack
| Layer | Technology | Purpose |
|-------|-----------|---------|
| Orchestration | Trigger.dev | CRON, task chaining, retry, queuing |
| Database | Supabase (PostgreSQL) | Data storage, config, state |
| LLM | NVIDIA NIM (MiniMax + LLaMA) | AI profiling & analysis |
| Web Scraping | Playwright | Headless browser |
| Email | Hunter.io + SMTP | Finding & verification |
| Notifications | Slack Bot | Alerts, commands, digest |
| AI Service | Python FastAPI | Profiling, scoring, hallucination guard |
| Language | TypeScript + Python | Core logic |
## Project Structure
```
src/
βββ discovery/ # Phase 1: Finding pipeline
β βββ lib/ # Core logic
β β βββ contact-enricher.ts # 6-step email pipeline
β β βββ email-classifier.ts # Tier 1/2/3 classification
β β βββ email-verifier.ts # 7-layer verification
β β βββ email-pattern-generator.ts # FREE Snov replacement
β β βββ linkedin-person-finder.ts # Personal LinkedIn
β β βββ social-finder.ts # Instagram, Facebook, Twitter
β β βββ pain-signal-detector.ts # Heuristic + LLM
β β βββ territory-manager.ts # CityΓindustry grid
β β βββ web-scraper.ts # Playwright scraper
β βββ providers/ # External APIs
β β βββ hunter.ts # Hunter.io integration
β β βββ serper.ts # Google search
β β βββ reoon.ts # Email verification
β βββ trigger-tasks/ # Trigger.dev tasks
β βββ auto-discovery.ts # 5 chained tasks
β βββ manual-discovery.ts # Slack-triggered runs
βββ profiling/ # AI profiling service
β βββ python-service/ # FastAPI
β βββ main.py # /profile endpoint
β βββ profiler.py # Chain-of-thought profiling
β βββ scorer.py # Signal extraction + deterministic math
β βββ hallucination_guard.py # Evidence-based cross-check
β βββ nvidia_client.py # Multi-model LLM client
β βββ config.py # Settings
βββ shared/ # Shared utilities
β βββ config/env.ts # Environment validation (Zod)
β βββ llm/nvidia-client.ts # Multi-model LLM (MiniMax primary)
β βββ llm/prompts.ts # Production prompts
β βββ llm/grounding.ts # Evidence-based verification
β βββ observability/tracer.ts # Trace IDs + token tracking
β βββ pipeline/checkpoint.ts # Crash recovery
β βββ supabase/client.ts # DB client
β βββ utils/ # Retry, rate limiter, logger
βββ slack/ # Slack integration
βββ slack-service.ts # 3-layer delivery
βββ slack-commands.ts # /discover, /leads, /status, etc.
```
## Quick Start
See [Setup Guide](docs/setup-guide.md) for detailed instructions.
```bash
# 1. Clone
git clone https://github.com/iDevBuddy/ai-client-acquisition.git
cd ai-client-acquisition
# 2. Install
npm install
cd src/profiling/python-service && pip install -r requirements.txt && cd ../../..
# 3. Configure
cp .env.example .env
# Fill in your API keys (see docs/setup-guide.md)
# 4. Database
# Run supabase/migrations/*.sql on your Supabase project
# 5. Run
npm run trigger:dev # Start Trigger.dev (task orchestration)
cd src/profiling/python-service && python main.py # Start AI service
```
## API Keys Required
| Service | Cost | What It Does |
|---------|------|-------------|
| NVIDIA NIM | FREE | AI models (MiniMax + LLaMA) |
| Serper.dev | FREE (2500/mo) | Google search |
| Hunter.io | FREE (25/mo) | Email finding |
| Reoon | FREE (20/day) | Email verification |
| Supabase | FREE | Database |
| Slack | FREE | Notifications |
| Trigger.dev | FREE (50K runs/mo) | Job orchestration |
**Total cost: $0/month**
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
## License
Private β All rights reserved.
|