mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-06-18 15:29:36 +00:00
Targeting & Acquisition OS (16 modules) — نظام الاستهداف الذكي - account_finder: account-first targeting; 12 buying signals; deterministic 10-25 accounts per (sector, city) - buyer_role_mapper: 14 buyer roles + sector-specific buying-committee maps + role-based Arabic angles - contact_source_policy: 12 sources (crm_customer→opt_out) with risk_score, channels-allowed, retention guidance, lawful_basis - contactability_matrix: 5 action modes (suggest_only/draft_only/approval_required/approved_execute/blocked); opt-out always blocked - linkedin_strategy: Lead Forms + Ads + manual ONLY; linkedin_do_not_do() locks scrape/auto-DM/auto-connect/extensions - email_strategy: drafts + unsubscribe footer + domain-pacing (fresh/warmed/trusted/damaged) + spam-trigger risk - whatsapp_strategy: opt-in only; rejects cold + risky phrases; opt-in template requires explicit purpose+company+unsubscribe - social_strategy: official APIs only; listening + drafts; no auto-publish - outreach_scheduler: day-by-day plans + daily limits + opt-out enforcement - reputation_guard: bounce/complaint/opt-out thresholds → healthy/watch/pause + recovery actions per channel - daily_autopilot: Arabic brief + 7 today actions + EOD report - acquisition_scorecard: pipeline + meetings + risks + productivity_score - self_growth_mode: 5 ICP focuses for Dealix; daily brief + monthly targets - free_diagnostic: Free Growth Diagnostic (3 ops + msg + risk + plan) → paid pilot recommendation - contract_drafts: Pilot/DPA/Referral/Agency/SOW outlines (legal_review_required, PDPL-aware) - service_offers: 7 targeting-tier offers + recommend by customer-type Service Tower (8 modules) — برج الخدمات الذاتية (12 productized services) - service_catalog: 12 services with target_customer/outcome/inputs/workflow/deliverables/pricing/risk/proof/upgrade - service_wizard: deterministic recommend (agency→partner; list→list_intelligence; founder→self_growth; CEO→exec_brief; budget≥2999→growth_os; default→first_10) - mission_templates: workflow steps with approval gates + linked growth missions - pricing_engine: SAR quotes scaled by company_size×urgency×channels_count + setup_fee + monthly_offer - deliverables: client report outline + proof pack template + operator checklist (no live actions) - service_scorecard: 0..100 score from drafts/replies/meetings/pipeline/CSAT - whatsapp_ceo_control: daily brief, approval cards (≤3 buttons), risk alerts, EOD reports - upgrade_paths: deterministic next-service recommendation + Arabic upsell messages Service Excellence OS (8 modules) — مصنع الخدمات الممتازة - feature_matrix: 12 must-have features per service + advanced/premium/future tiers - service_scoring: 10-dimension excellence score (clarity, speed_to_value, automation, compliance, proof, upsell, uniqueness, scalability, ops_daily, proof_data) → launch_ready/beta_only/needs_work - quality_review: 4 gates (proof / approval / pricing / channels) + status verdict; review_service_before_launch and review/all - competitor_gap: 7 competitor categories (CRM, WhatsApp tools, email assistants, LinkedIn tools, agencies, revenue intelligence, generic AI) + Dealix advantages + do-not-copy - proof_metrics: required metrics + ROI estimate (pipeline_x + closed_won_x) + Arabic summary - research_lab: monthly brief + feature hypotheses + top-3 experiments + monthly review - service_improvement_backlog: feedback→backlog conversion + impact/effort prioritization + weekly improvements - launch_package: landing outline + sales script + 12-min demo script + 5-day onboarding checklist Routers (3 new) — 62 endpoints - /api/v1/targeting/* — 20 endpoints (accounts, buying-committee, contacts, uploaded-list, outreach, daily-autopilot, self-growth, reputation, linkedin, drafts, free-diagnostic, services, contracts) - /api/v1/services/* — 20 endpoints (catalog, recommend, intake, start, workflow, deliverables, proof-pack, quote, setup-fee, monthly-offer, scorecard, upgrade-path, ceo daily-brief/approval-card/risk-alert/EOD) - /api/v1/service-excellence/* — 22 endpoints (feature-matrix, score, quality-review, review/all, proof-metrics, roi-estimate, gap-analysis, research-brief, hypotheses, experiments, monthly-review, backlog, weekly-improvements, launch-package, landing/sales/demo/onboarding) Tests (3 new files, 105 tests) - test_targeting_os: 47 tests (Arabic accounts, buying committees, opt-out blocked, cold WA blocked, LinkedIn no-scraping, email unsubscribe, WA risk, outreach plan, reputation guard, self-growth, contracts, scorecard) - test_service_tower: 38 tests (12+ services, all have pricing/proof/deliverables/approval, wizard recommendations, workflow includes approval, quote scales, CEO cards ≤3 buttons, no live send) - test_service_excellence: 33 tests (feature matrix, score returns status, ALL services pass quality gates, ROI x-multiples, 7 competitor categories, hypotheses+experiments, backlog conversion, launch package complete, demo=12min) Docs (3 new + 1 updated) - TARGETING_ACQUISITION_OS.md (Arabic) - SERVICE_TOWER_STRATEGY.md (Arabic) - SERVICE_EXCELLENCE_OS.md (Arabic) - DEALIX_100_PERCENT_LAUNCH_PLAN.md — added §36 Targeting OS + §37 Service Tower + §38 Service Excellence + §39 Landing Pages Landing pages (4 new, RTL Arabic) - services.html — 3 doors + 12 productized services - free-diagnostic.html — free growth diagnostic - first-10-opportunities.html — kill feature - agency-partner.html — agency partner program Test results - 105/105 new tests pass - Full suite: 768 passed, 2 skipped - 0 existing tests broken Safety + integration with previous layers - Targeting OS uses contactability_matrix → ALL contacts gated before any send - Service Tower's workflow includes approval gate; ALL services live_send_allowed=False - Service Excellence quality_review BLOCKS launch on missing proof/approval/pricing/unsafe channels - linkedin_do_not_do() encodes 8 explicit prohibitions (scraping/auto-DM/auto-connect/extensions) - whatsapp_do_not_do() blocks cold sends + group scraping - Contracts always: legal_review_required=True, not_legal_advice=True, PDPL sections present - Self-Growth Mode lets Dealix target its OWN ICP using the same approval-first pipeline Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
161 lines
5.7 KiB
Python
161 lines
5.7 KiB
Python
"""Email strategy — drafts only, unsubscribe always, pacing-aware."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
|
|
def draft_b2b_email(
|
|
contact: dict[str, Any],
|
|
*,
|
|
offer: str = "",
|
|
why_now: str = "",
|
|
tone: str = "professional_saudi",
|
|
) -> dict[str, Any]:
|
|
"""Build a B2B email draft (Arabic). Never sends."""
|
|
name = contact.get("name", "")
|
|
company = contact.get("company", "")
|
|
role = contact.get("role", "")
|
|
|
|
salutation = f"هلا {name}" if name else "هلا"
|
|
company_part = f" من {company}" if company else ""
|
|
why_now_part = f"\n{why_now}\n" if why_now else "\n"
|
|
|
|
body_ar = (
|
|
f"{salutation}،\n\n"
|
|
f"أكتب لك{company_part} باختصار. "
|
|
f"نشتغل على Dealix كمدير نمو عربي للشركات السعودية:"
|
|
f"{why_now_part}"
|
|
"خلال 7 أيام، نطلع لك:\n"
|
|
"• 10 فرص B2B مناسبة لقطاعكم\n"
|
|
"• رسائل عربية جاهزة بنبرتنا\n"
|
|
"• خطة متابعة قابلة للتنفيذ\n"
|
|
"• Proof Pack بعد الأسبوع\n\n"
|
|
f"{offer or 'Pilot بـ 499 ريال أو مجاني مقابل case study.'}\n\n"
|
|
"إذا الفكرة تناسبك، نحدد مكالمة 15 دقيقة هذا الأسبوع.\n"
|
|
"وإن ما كانت الأولوية الآن خبرني وأرتاح.\n\nشاكر لك."
|
|
)
|
|
|
|
return {
|
|
"subject_ar": (
|
|
f"فرصة نمو لـ{company}" if company else "فرصة نمو B2B خلال 7 أيام"
|
|
),
|
|
"body_ar": include_unsubscribe_footer(body_ar),
|
|
"tone": tone,
|
|
"target_role": role,
|
|
"approval_required": True,
|
|
"live_send_allowed": False,
|
|
}
|
|
|
|
|
|
def include_unsubscribe_footer(body: str) -> str:
|
|
"""Append a one-line unsubscribe footer (Arabic + English)."""
|
|
if not body:
|
|
return body
|
|
footer = (
|
|
"\n\n———\n"
|
|
"لإيقاف هذه الرسائل، رد بكلمة \"إلغاء\" / Reply STOP to unsubscribe."
|
|
)
|
|
return body + footer
|
|
|
|
|
|
def recommend_pacing(domain_reputation: str = "fresh") -> dict[str, Any]:
|
|
"""Recommend a daily send pacing based on domain reputation."""
|
|
rep = (domain_reputation or "fresh").lower()
|
|
table = {
|
|
"fresh": {"max_daily": 20, "warmup_days": 21, "ramp_step": 5},
|
|
"warmed": {"max_daily": 60, "warmup_days": 0, "ramp_step": 10},
|
|
"trusted": {"max_daily": 200, "warmup_days": 0, "ramp_step": 25},
|
|
"damaged": {"max_daily": 5, "warmup_days": 30, "ramp_step": 1},
|
|
}
|
|
plan = table.get(rep, table["fresh"])
|
|
return {
|
|
"domain_reputation": rep,
|
|
**plan,
|
|
"notes_ar": (
|
|
"ابدأ بحدود يومية صغيرة على domain جديد، وارتفع تدريجياً. "
|
|
"domain متضرر يحتاج فترة تبريد + warmup قبل العودة."
|
|
),
|
|
}
|
|
|
|
|
|
def score_email_risk(
|
|
contact: dict[str, Any], message: str = "",
|
|
) -> dict[str, Any]:
|
|
"""
|
|
Score an outbound email's risk 0..100 (higher = riskier).
|
|
|
|
Looks at source, opt_in, message content for spam triggers.
|
|
"""
|
|
source = contact.get("source", "unknown_source")
|
|
opt_in = (contact.get("opt_in_status") or "unknown").lower()
|
|
|
|
risk = 0
|
|
reasons: list[str] = []
|
|
|
|
if source == "cold_list":
|
|
risk += 50; reasons.append("قائمة باردة — مخاطرة spam مرتفعة.")
|
|
elif source == "unknown_source":
|
|
risk += 30; reasons.append("مصدر غير معروف — يحتاج مراجعة.")
|
|
elif source in ("inbound_lead", "crm_customer", "website_form"):
|
|
risk -= 10 # safer
|
|
|
|
if opt_in not in ("yes", "double"):
|
|
risk += 10
|
|
|
|
msg = (message or "").lower()
|
|
spam_triggers = ["ضمان 100%", "ضمان مضمون", "act now", "urgent",
|
|
"free money", "click here now", "limited offer"]
|
|
for t in spam_triggers:
|
|
if t in msg.lower() or t in (message or ""):
|
|
risk += 15
|
|
reasons.append(f"عبارة spam: {t}")
|
|
|
|
risk = max(0, min(100, risk))
|
|
if risk >= 60:
|
|
verdict = "blocked"
|
|
elif risk >= 30:
|
|
verdict = "needs_review"
|
|
else:
|
|
verdict = "safe"
|
|
|
|
return {"risk": risk, "verdict": verdict, "reasons_ar": reasons}
|
|
|
|
|
|
def build_followup_sequence(
|
|
contact: dict[str, Any], *, offer: str = "",
|
|
) -> dict[str, Any]:
|
|
"""Build a 3-step Arabic email follow-up sequence."""
|
|
name = contact.get("name", "")
|
|
sal = f"هلا {name}" if name else "هلا"
|
|
return {
|
|
"approval_required": True,
|
|
"live_send_allowed": False,
|
|
"steps": [
|
|
{
|
|
"day": 0,
|
|
"subject_ar": "فرصة نمو B2B خلال 7 أيام",
|
|
"body_ar": include_unsubscribe_footer(
|
|
f"{sal}، (الرسالة الأولى مع العرض الكامل)"
|
|
),
|
|
},
|
|
{
|
|
"day": 3,
|
|
"subject_ar": "متابعة سريعة",
|
|
"body_ar": include_unsubscribe_footer(
|
|
f"{sal}، أتابع رسالتي السابقة. "
|
|
"هل أرتب لك ديمو 12 دقيقة هذا الأسبوع؟"
|
|
),
|
|
},
|
|
{
|
|
"day": 7,
|
|
"subject_ar": "آخر متابعة",
|
|
"body_ar": include_unsubscribe_footer(
|
|
f"{sal}، آخر متابعة من جهتي. "
|
|
"إذا ما كانت الأولوية الآن أرتاح وأرشّفها. "
|
|
"وإن أردت ديمو لاحقاً، أنا موجود."
|
|
),
|
|
},
|
|
],
|
|
}
|