mirror of
https://github.com/x1xhlol/system-prompts-and-models-of-ai-tools.git
synced 2026-06-17 23:09:35 +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>
216 lines
7.3 KiB
Python
216 lines
7.3 KiB
Python
"""Account-first targeting — يبحث عن الشركات المناسبة قبل الأشخاص."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from typing import Any
|
|
|
|
# Signals that indicate a company is "in market" right now.
|
|
ACCOUNT_SIGNALS_AR: dict[str, str] = {
|
|
"hiring_sales": "توظيف مبيعات",
|
|
"new_branch": "فرع جديد",
|
|
"website_updated": "تحديث الموقع",
|
|
"active_ads": "إعلانات نشطة",
|
|
"event_participation": "مشاركة في فعاليات",
|
|
"google_reviews": "تقييمات Google نشطة",
|
|
"booking_link": "صفحة حجز/طلب",
|
|
"crm_visible": "بيانات CRM متوفرة",
|
|
"growing_team": "نمو الفريق",
|
|
"partner_potential": "إمكانية شراكة",
|
|
"expansion_news": "أخبار توسع",
|
|
"leadership_change": "تغيير قيادي",
|
|
}
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class AccountSignal:
|
|
"""A single buying-readiness signal on a company."""
|
|
key: str
|
|
label_ar: str
|
|
weight: int # 1..10
|
|
why_ar: str
|
|
|
|
def to_dict(self) -> dict[str, object]:
|
|
return {
|
|
"key": self.key, "label_ar": self.label_ar,
|
|
"weight": self.weight, "why_ar": self.why_ar,
|
|
}
|
|
|
|
|
|
# Default signal weights — can be overridden per sector.
|
|
_DEFAULT_WEIGHTS: dict[str, int] = {
|
|
"hiring_sales": 9,
|
|
"new_branch": 8,
|
|
"expansion_news": 9,
|
|
"active_ads": 7,
|
|
"growing_team": 7,
|
|
"leadership_change": 8,
|
|
"booking_link": 5,
|
|
"website_updated": 4,
|
|
"google_reviews": 5,
|
|
"crm_visible": 3,
|
|
"event_participation": 6,
|
|
"partner_potential": 6,
|
|
}
|
|
|
|
|
|
def _signal_objs(signals: dict[str, bool] | list[str]) -> list[AccountSignal]:
|
|
out: list[AccountSignal] = []
|
|
if isinstance(signals, list):
|
|
signals = {s: True for s in signals}
|
|
for key, val in signals.items():
|
|
if not val or key not in ACCOUNT_SIGNALS_AR:
|
|
continue
|
|
out.append(AccountSignal(
|
|
key=key,
|
|
label_ar=ACCOUNT_SIGNALS_AR[key],
|
|
weight=_DEFAULT_WEIGHTS.get(key, 3),
|
|
why_ar=f"إشارة: {ACCOUNT_SIGNALS_AR[key]}",
|
|
))
|
|
return out
|
|
|
|
|
|
def score_account_fit(account: dict[str, Any]) -> dict[str, Any]:
|
|
"""Score an account 0..100 based on its signals + sector+size match."""
|
|
signals = _signal_objs(account.get("signals", {}))
|
|
base = sum(s.weight for s in signals)
|
|
score = min(100, base * 4) # ~25 weight points = max 100
|
|
if account.get("sector_match"):
|
|
score = min(100, score + 10)
|
|
if account.get("city_match"):
|
|
score = min(100, score + 5)
|
|
|
|
if score >= 70:
|
|
tier = "hot"
|
|
elif score >= 40:
|
|
tier = "warm"
|
|
elif score >= 15:
|
|
tier = "watching"
|
|
else:
|
|
tier = "cold"
|
|
|
|
return {
|
|
"score": score,
|
|
"tier": tier,
|
|
"signals": [s.to_dict() for s in signals],
|
|
"signal_count": len(signals),
|
|
}
|
|
|
|
|
|
def explain_why_now(account: dict[str, Any]) -> str:
|
|
"""Build an Arabic 'why now' line from an account's signals."""
|
|
signals = _signal_objs(account.get("signals", {}))
|
|
if not signals:
|
|
return "لا توجد إشارات شراء واضحة الآن — متابعة دورية مقترحة."
|
|
top = sorted(signals, key=lambda s: -s.weight)[:2]
|
|
labels = " + ".join(s.label_ar for s in top)
|
|
company = account.get("name") or "الشركة"
|
|
return f"{company} تظهر إشارات: {labels}. نافذة فرصة مناسبة الآن."
|
|
|
|
|
|
def recommend_account_source_strategy(account: dict[str, Any]) -> dict[str, Any]:
|
|
"""Recommend safe sources for reaching this account's decision-makers."""
|
|
has_crm = bool(account.get("crm_visible"))
|
|
has_ads = bool(account.get("active_ads"))
|
|
has_events = bool(account.get("event_participation"))
|
|
|
|
primary = []
|
|
if has_crm:
|
|
primary.append("crm_customer")
|
|
primary.append("website_form")
|
|
primary.append("linkedin_lead_form")
|
|
|
|
if has_ads:
|
|
primary.append("ads_retargeting")
|
|
if has_events:
|
|
primary.append("event_lead")
|
|
|
|
return {
|
|
"primary_sources": primary,
|
|
"blocked_sources": ["scraped_email", "scraped_phone", "purchased_list"],
|
|
"notes_ar": (
|
|
"ابدأ بمصادر مصرّح بها: قوائم العميل، Lead Gen Forms، "
|
|
"نماذج الموقع، شركاء، أحداث. لا scraping ولا قوائم مشتراة."
|
|
),
|
|
}
|
|
|
|
|
|
def recommend_accounts(
|
|
sector: str,
|
|
city: str,
|
|
*,
|
|
offer: str = "",
|
|
goal: str = "fill_pipeline",
|
|
limit: int = 10,
|
|
seed_signals: list[str] | None = None,
|
|
) -> dict[str, Any]:
|
|
"""
|
|
Generate a deterministic list of recommended target accounts.
|
|
|
|
This is a structural template — production reads from real data sources
|
|
(Google Maps, CRM, web forms, etc). The output shape stays identical.
|
|
"""
|
|
seed_signals = seed_signals or [
|
|
"hiring_sales", "new_branch", "active_ads",
|
|
"growing_team", "booking_link", "google_reviews",
|
|
]
|
|
sector_label_ar = {
|
|
"training": "التدريب", "saas": "البرمجيات", "real_estate": "العقار",
|
|
"retail": "التجزئة", "healthcare": "الرعاية الصحية",
|
|
"logistics": "اللوجستيات", "fintech": "الفنتك",
|
|
"agency": "الوكالات", "education": "التعليم",
|
|
}.get(sector.lower(), sector)
|
|
|
|
accounts: list[dict[str, Any]] = []
|
|
n = max(1, min(limit, 25))
|
|
for i in range(n):
|
|
# Spread signals across accounts deterministically.
|
|
my_signals = {seed_signals[(i + j) % len(seed_signals)]: True
|
|
for j in range(2 + (i % 3))}
|
|
acct = {
|
|
"name": f"شركة {sector_label_ar} #{i + 1} في {city}",
|
|
"sector": sector,
|
|
"city": city,
|
|
"signals": my_signals,
|
|
"sector_match": True,
|
|
"city_match": True,
|
|
}
|
|
scored = score_account_fit(acct)
|
|
sources = recommend_account_source_strategy(acct)
|
|
acct.update({
|
|
"fit_score": scored["score"],
|
|
"tier": scored["tier"],
|
|
"why_now_ar": explain_why_now(acct),
|
|
"primary_sources": sources["primary_sources"],
|
|
"best_angle_ar": (
|
|
f"عرض Pilot 7 أيام لاستخراج 10 فرص في قطاع {sector_label_ar}."
|
|
if not offer else
|
|
f"العرض المقترح: {offer}."
|
|
),
|
|
"recommended_channel": (
|
|
"email_first"
|
|
if "crm_visible" in my_signals
|
|
else "linkedin_lead_form_first"
|
|
),
|
|
"risk_level": "low" if scored["score"] >= 50 else "medium",
|
|
})
|
|
accounts.append(acct)
|
|
|
|
accounts = rank_accounts(accounts)
|
|
return {
|
|
"sector": sector, "city": city, "goal": goal, "offer": offer,
|
|
"total": len(accounts),
|
|
"accounts": accounts,
|
|
"do_not_do_ar": [
|
|
"لا scraping للبيانات.",
|
|
"لا cold WhatsApp.",
|
|
"لا auto-DM على LinkedIn.",
|
|
"لا charge بدون موافقة.",
|
|
],
|
|
}
|
|
|
|
|
|
def rank_accounts(accounts: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
|
"""Sort accounts by fit_score desc; stable for ties."""
|
|
return sorted(accounts, key=lambda a: -int(a.get("fit_score", 0)))
|