Commit Graph

2 Commits

Author SHA1 Message Date
Dealix Builder
47f4dc2fb6 feat(positioning+customer-ops): Saudi Revenue Execution OS — 8 modules + 20 endpoints + 44 tests + 8 docs + 2 modes
Locks Dealix's positioning forever and closes the operational gap between
"great product" and "great customer experience": onboarding, connectors,
support SLA, incidents, customer success cadence, and companies/marketers
landing pages.

Positioning Lock (3 docs)
- POSITIONING_LOCK.md (Arabic): Saudi Revenue Execution OS category lock; one-liner; primary buyers (companies + agencies/marketers); wedge (First 10 Opportunities + Proof Pack); 5 approved claims; 5 prohibited categories; 5 modes; 5 bundles; 6 "what Dealix is NOT" rules
- PROHIBITED_CLAIMS.md (Arabic): 8 categories of forbidden marketing language (guaranteed results, scraping, full automation, bypass approvals, competitor attacks, legal/financial promises, medical language, exaggerated speed) + technical enforcement (safety_eval + tone_eval + quality_review_gate + tool_action_planner + test_positioning_lock.py)
- APPROVED_MARKET_MESSAGING.md (Arabic): tagline + 30-second elevator pitch + 5 headlines + competitor positioning table + 4-segment outreach templates + LinkedIn/X social posts + slogan bank

Customer Ops (6 modules)
- onboarding_checklist: 8-step Pilot onboarding (select_goal → select_bundle → company_intake → connect_channels → upload_or_source → risk_review → first_service_run → first_proof_pack) with progress tracking + state advancement
- connector_setup_status: 11 connectors (Gmail/Calendar/Sheets/Moyasar/WhatsApp/Forms/LinkedIn-LeadForms/GBP/CRM/Meet/Instagram) each with default_mode (draft_only/manual/ingest_only/approved_execute), launch phase, and blocking flag; ready_for_first_service gate requires no blocking connectors missing AND ≥1 connected
- support_ticket_router: 4-tier P0/P1/P2/P3 classification with Arabic+English keyword matching; auto-classifies "تسريب", "إرسال بدون موافقة", "بدون موافقتي", "live charge", "unauthorized" as P0; per-priority Arabic first-response templates; SLA targets per priority
- sla_tracker: SLA targets per priority (P0=30min/4h, P1=2h/24h, P2=8h/72h, P3=24h/1week); record_sla_event with strict event-type validation; classify_sla_breach for individual tickets; build_sla_health_report aggregates with verdict (healthy/watch/critical based on breach_rate)
- customer_success_cadence: 6 cadence types (weekly_check_in, monthly_proof_review, QBR, at_risk_alert, renewal_30/7_day); build_at_risk_alert with risk_score 0..100 from days_inactive + drafts_pending + last_proof_pack_days_ago; build_customer_success_plan with 30-day per-bundle cadences (growth_starter, executive_growth_os, partnership_growth)
- incident_router: SEV1/SEV2/SEV3 with first_action_minutes + comm_cadence; auto-SEV1 on has_data_leak OR has_unauthorized_send; SEV2 on affected_customers≥5; canonical 5-step response plan (freeze live actions / notify founder / create incident channel / review Action Ledger / PDPL 72h notification) + per-severity additional steps + post-mortem template

New Operator Modes (2)
- self_growth_mode: re-exports targeting_os.self_growth_mode (DEALIX_ICP_FOCUSES, recommend_dealix_targets, build_self_growth_daily_brief, build_weekly_learning_report) + operator-tier reminders (no cold WhatsApp even for Dealix itself, all drafts approval-first, no scraping)
- service_delivery_mode: orchestrates service_tower workflow + revenue_launch.pilot_delivery + customer_ops.sla_tracker; build_service_delivery_brief (per-service template), build_sla_status_for_delivery (breach detection on open tickets), build_post_delivery_handoff (5-step transition to Customer Success cadence)

Router (1 new) — 20 endpoints
- /api/v1/customer-ops/* — onboarding (checklist/update-step/demo), connectors (catalog/summary/update/demo), support (priorities/classify/route/first-response), sla (event/classify-breach/health-report/health-report-demo), incidents (triage/response-plan), cs (weekly-check-in/at-risk-alert/success-plan)

Customer-facing pages (1 new, 1 already-existed-preserved)
- landing/companies.html (NEW): Saudi B2B companies pitch — Approval-first, no scraping, no cold WhatsApp; 4 bundles (Growth Starter / Data to Revenue / Executive Growth OS / Full Growth Control Tower); Proof Pack section; safety + compliance section
- landing/marketers.html (existed): preserved as-is — agency/marketers Agency Growth OS path

Tests (2 new files, 44 tests)
- test_customer_ops.py: 31 tests
  * 4 onboarding (8 steps, advancement, unknown step error, complete-all)
  * 5 connectors (critical connectors present, blocking_missing detection, ready gate, validation, write)
  * 8 support (P0 security, P0 unauthorized send, P1 service down, P2 connector, P3 default, empty input, route includes SLA, P0 first-response Arabic with 30 min)
  * 6 SLA (event validates, log appends, breach detection within/exceeded targets, health report aggregation, critical verdict)
  * 4 incidents (data leak SEV1, unauthorized send SEV1, ≥5 customers SEV2, single customer SEV3, SEV1 plan includes PDPL)
  * 4 customer success (weekly check-in talking points Arabic, at-risk high severity, at-risk low severity, success plan per bundle including growth_starter and executive_growth_os Founder Shadow Board)

- test_positioning_lock.py: 13 tests
  * positioning_lock.md exists with category + "ليس CRM" + "ليس بوت"
  * prohibited_claims.md exists with "نضمن" + "scraping"
  * approved_market_messaging.md has Approval-first + PDPL + Saudi Tone + Proof Pack
  * landing pages contain NO positive forbidden claims (negative restatements like "no auto-DM" in safety sections allowed)
  * companies.html includes "Approval-first" + "Proof Pack"
  * agency-partner.html OR marketers.html exists
  * private-beta.html does NOT promise guarantees
  * REVENUE_TODAY_PLAYBOOK emphasizes Approval-first
  * positioning_lock lists all 5 bundles
  * positioning_lock lists all 5 modes (CEO + Growth Manager + Agency Partner + Self-Growth + Service Delivery)

Customer Ops Docs (5 new)
- ONBOARDING_RUNBOOK.md (Arabic): 8 onboarding steps + day-by-day Day1-Day5 + 11 connector states + acceptance criteria
- SUPPORT_SLA.md (Arabic): 4 priority tiers + auto-classification keywords + Arabic first-response templates + weekly review process
- INCIDENT_RESPONSE.md (Arabic): SEV1/SEV2/SEV3 logic + canonical response plan + per-severity additional steps + post-mortem template + Arabic communication templates + auto-actions
- CUSTOMER_SUCCESS_PLAYBOOK.md (Arabic): cadence types + weekly agenda (25 min) + at-risk scoring formula + per-bundle cadence + QBR + renewal flow + health score formula
- CONNECTOR_SETUP_GUIDES.md (Arabic): all 11 connectors with scopes + step-by-step + acceptance criteria + troubleshooting table

Test results
- 44/44 new tests pass
- Full suite: 949 passed, 2 skipped (missing API keys, unrelated)
- 0 existing tests broken

Safety + integration
- All 20 customer-ops endpoints: approval_required=True, live_send_allowed=False
- support_ticket_router HARD-CLASSIFIES "تسريب", "إرسال بدون موافقة", "live charge", "unauthorized" as P0 (founder owner, 30-min first response)
- incident_router auto-promotes to SEV1 on has_data_leak or has_unauthorized_send (regardless of affected_customers count)
- onboarding_checklist requires WhatsApp connector (blocking) before ready_for_first_service
- connector_setup_status default_mode is draft_only/manual/ingest_only — never live
- Positioning Lock test_positioning_lock.py enforces:
  * 5 bundles must be listed in POSITIONING_LOCK.md
  * 5 modes must be listed
  * landing pages must not contain positive forbidden claims (8 phrases)
  * companies.html must mention Approval-first + Proof Pack
- self_growth_mode reminds operator: no cold WhatsApp even for Dealix itself
- service_delivery_mode integrates SLA tracker before declaring delivery success

Integration with everything before
- Customer Ops onboarding integrates Service Bundles (autonomous_service_operator.service_bundles)
- Customer Ops connectors mirror connector_catalog risk_levels + add operational state machine
- Support classifier integrates with security_curator (P0 on secret leaks) + revenue_launch.payment_manual_flow (P0 on unauthorized charge)
- Customer Success metrics flow from agent_observability + revenue_launch.proof_pack_template
- Service Delivery Mode wires service_tower.workflow + revenue_launch.pilot_delivery + sla_tracker into one pipeline
- Self-Growth Mode wraps targeting_os.self_growth_mode with operator-tier safety reminders
- Companies + Marketers pages enforce POSITIONING_LOCK headlines

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 18:14:51 +03:00
Dealix Builder
ef08649efe feat(autonomous-revenue-os): Dealix becomes a Category — Autonomous Revenue Company OS — 26 modules + 47 endpoints + 81 tests
# Dealix is no longer "a platform". It is a new category:
# An Autonomous Revenue Company OS that runs growth FOR Saudi businesses
# as if Growth + Sales + Partnerships + Customer Success + Strategy +
# Compliance + Data sat in one self-improving system.

Autonomous Service Operator (16 modules) — البوت المركزي
- intent_classifier: 16 supported intents (Arabic + English keywords; deterministic; no LLM)
- conversation_router: route_message + handle_message — single entry point that classifies, routes to handler, recommends a bundle, builds intake + initial pipeline
- session_state: 13 valid states + UUID-based sessions + audit history
- intake_collector: per-intent intake question sets + parse + validation
- approval_manager: Arabic approval cards (capped at 3 buttons) + decision processing (approve/edit/skip/reject including Arabic verbs)
- service_orchestrator: 11-step canonical pipeline (intake→data_check→targeting→contactability→strategy→drafting→approval→execution_or_export→tracking→proof→upsell)
- workflow_runner: advance + completion check
- tool_action_planner: HARD-BLOCKS linkedin.scrape_profile, linkedin.auto_dm, linkedin.auto_connect, social.scrape_followers; high-risk tools require approval; draft-safe tools return draft_only; unknown tools default to approval_required
- proof_pack_dispatcher: per-service Proof Pack envelope with required metrics
- upsell_engine: 3 deterministic verdicts (upsell_now / iterate_first / gentle_upsell) based on csat + pipeline + meetings
- whatsapp_renderer: render any card / approval / daily brief as WhatsApp draft (≤3 buttons, Arabic body, never live)
- operator_memory: in-process sessions + customer_facts + preferences + audit log (production = Supabase)
- service_bundles: 6 customer-facing bundles instead of 20 raw services (Growth Starter, Data to Revenue, Executive Growth OS, Partnership Growth, Local Growth OS, Full Growth Control Tower)
- executive_mode: CEO command center + daily brief + revenue risks (3) + next 3 moves
- client_mode: Growth Manager dashboard with 4 panels
- agency_mode: multi-client roster + co-branded Proof Pack + revenue share calc

Revenue Company OS (10 modules) — الذكاء عبر القنوات
- event_to_card: 13 event types → Arabic decision cards (email/whatsapp/form/review/payment/risk/partner/meeting/service.completed/...) each with title_ar/summary_ar/why_now_ar/recommended_action_ar/risk_level/buttons_ar (≤3)
- command_feed_engine: aggregate events for a customer + sort by risk (high first) + by_type and by_risk counts
- action_graph: 14 typed edges (signal_created_opportunity → message_triggered_reply → reply_led_to_meeting → meeting_led_to_proposal → proposal_led_to_payment → ...) with what_works_for_customer scoring (outcome edges weigh more)
- revenue_work_units: 19 RWU types (Salesforce-inspired): opportunity_created, draft_created, approval_collected, meeting_drafted, payment_received, risk_blocked, etc. + aggregate_work_units (counts/revenue/risks)
- channel_health: cross-channel reputation snapshot (email/whatsapp/linkedin) + overall_score + channels_at_risk
- opportunity_factory: turn (sector, city) into 5 opportunity cards via targeting_os.recommend_accounts + buying committee
- service_factory: instantiate any service for a customer (intake + workflow + quote)
- proof_ledger (revenue-tier, NOT platform_services.proof_ledger): customer-facing scoreboard with totals + summary_ar + by_type breakdown
- growth_memory: anonymized cross-customer aggregates — sector_message_winrate, sector_channel_winrate, common_objections, blocked_action_reasons, successful_playbooks; best_message_for_sector + best_channel_for_sector
- self_improvement_loop: weekly Arabic recommendations from real metrics (approval_rate, reply_rate, meeting_rate, blocked_actions, service_revenue) + best_service_id + next_experiment

Routers (2 new) — 47 endpoints
- /api/v1/operator/* (28): chat (message/decision/classify), sessions (new/transition/context/get), cards (approval/whatsapp/render), intake (questions/validate), service (start), tools (plan), proof-pack (dispatch), upsell (recommend/card), bundles (list/recommend), modes (ceo/ceo-daily-brief/ceo-risks/client/agency/agency-add-client/agency-revenue-share/agency-co-branded-proof), demos (whatsapp-daily-brief/proof-pack)
- /api/v1/revenue-os/* (19): command-feed (demo/build/events-ingest), work-units (types/build/aggregate/demo), proof-ledger/demo, action-graph (edge-types/demo), channel-health (snapshot/demo), opportunity-factory (run/demo), service-factory (instantiate/demo), growth-memory/demo, self-improvement (weekly-report/demo)

Tests (2 new files, 81 tests)
- test_autonomous_service_operator.py: 50 tests
  * 8 intent classification tests (want_more_customers, has_contact_list, partnerships, whatsapp, pricing, approve, unknown fallback)
  * 4 conversation router (recommends correct service per intent + bundle, processes approval decisions)
  * 4 session lifecycle (UUID, transition validation, memory store, context build)
  * 4 intake (questions per intent, validation detects missing fields, complete intake passes)
  * 4 approval (≤3 buttons, approve/skip Arabic, unknown decision returns error)
  * 5 tool planner (linkedin scrape blocked, auto_dm blocked, high-risk → approval, draft-safe → draft_only, unknown → approval_required)
  * 4 bundles (6 total, agency → partnership_growth, local → local_growth_os, default → growth_starter)
  * 7 modes (CEO Arabic, daily brief 3 decisions, 3 risks, client panels, agency aggregation, revenue share calc, co-branded includes both names)
  * 3 WhatsApp renderer (no live send, ≤3 buttons, Arabic morning text)
  * 4 proof + upsell (Proof Pack draft, upsell_now for strong, iterate_first for weak, ≤3 buttons)

- test_revenue_company_os.py: 31 tests
  * 4 event → card (email Arabic, low review high-risk, risk.blocked high, unknown → action_required)
  * 3 command feed (demo 8 events, sorts high-risk first, empty handling)
  * 4 RWUs (≥18 types, build validates, aggregate sums revenue, risks_blocked counted)
  * 4 action graph (≥12 edge types, validates type, demo 2 customers, what_works scoring)
  * 2 channel health (returns score, flags risky channel)
  * 2 opportunity factory (5 opps no live send, blocks unsafe in notes)
  * 3 service factory (instantiate known + unknown errors, demo 4 services)
  * 3 proof ledger (appends, rejects unknown, demo has revenue + risks)
  * 2 growth memory (top objections, best message per sector)
  * 3 self-improvement (low approval recommends fix, high blocked recommends review, returns best service)

Docs (1 new + 1 updated)
- AUTONOMOUS_REVENUE_COMPANY_OS.md (Arabic): 12-layer architecture + service bundles + safety + endpoints + competitive positioning
- DEALIX_100_PERCENT_LAUNCH_PLAN.md: added §44 Autonomous Revenue Company OS

Test results
- 81/81 new tests pass
- Full suite: 905 passed, 2 skipped (missing API keys, unrelated)
- 0 existing tests broken

Safety + integration
- All 47 new endpoints: live_send_allowed=False, approval_required=True
- LinkedIn scrape/auto-DM/auto-connect HARD-BLOCKED in tool_action_planner
- High-risk tools (whatsapp.send_message, gmail.send, calendar.insert_event, moyasar.charge, gbp.publish_review_reply, social.publish_dm, social.publish_post) → approval_required forced
- Cold WhatsApp blocked via existing contactability_matrix
- Operator memory hashes nothing yet — production must wire to security_curator.trace_redactor before any persistence
- 6 bundles unify the 12 productized services from Service Tower
- Modes integrate platform_services + intelligence_layer + service_excellence
- Action Graph + Revenue Work Units + Proof Ledger together form Dealix's Saudi Revenue Graph
- Self-improvement loop reads metrics that flow from agent_observability + growth_curator

Integration with everything before
- Autonomous Service Operator orchestrates Service Tower, Service Excellence OS, Targeting OS, Platform Services, Intelligence Layer
- Revenue Company OS reads from platform_services event_bus + intelligence_layer mission_engine + targeting_os reputation_guard
- Service factory uses service_tower.get_service + build_intake_questions + quote_service
- Opportunity factory uses targeting_os.recommend_accounts + map_buying_committee
- Channel health uses targeting_os.calculate_channel_reputation
- Tool planner integrates with platform_services.tool_gateway policies
- WhatsApp renderer aligns with launch_ops button caps
- Bundles map to service_tower upgrade_paths

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 17:50:32 +03:00