# 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> |
||
|---|---|---|
| .. | ||
| .cursor/rules | ||
| .github | ||
| api | ||
| auto_client_acquisition | ||
| autonomous_growth | ||
| core | ||
| dashboard | ||
| db | ||
| dealix | ||
| docs | ||
| evals | ||
| integrations | ||
| landing | ||
| scripts | ||
| supabase/migrations | ||
| tests | ||
| .dockerignore | ||
| .editorconfig | ||
| .env.example | ||
| .env.staging.example | ||
| .gitignore | ||
| .gitleaks.toml | ||
| .pre-commit-config.yaml | ||
| .secrets.baseline | ||
| CHANGELOG.md | ||
| cli.py | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| DEALIX_COMPANY_OPERATIONAL_STATE.md | ||
| DEPLOYMENT.md | ||
| docker-compose.yml | ||
| Dockerfile | ||
| LICENSE | ||
| Makefile | ||
| Procfile | ||
| pyproject.toml | ||
| QUICK_START.md | ||
| railway.json | ||
| railway.toml | ||
| README.ar.md | ||
| README.md | ||
| requirements-dev.txt | ||
| requirements.txt | ||
| SECURITY.md | ||
| v3_app.py | ||
🏢 Dealix — AI Company Saudi
Sovereign, policy-governed Growth & Execution OS for Saudi enterprises
نظام نمو وتنفيذ سيادي محكوم بالسياسات، للشركات السعودية
العربية · English
🚀 Deploy Now · 📦 .env Template · 🎯 Landing · 🗺️ API Map · 🏢 Day 1 Plan
🎯 What's in this repo
Backend — FastAPI + SQLAlchemy 2.0 async + Postgres. 13 routers / 102 endpoints. See API_MAP.md.
Lead Machine — Provider adapter chains for Search / Maps / Crawler / Tech / EmailIntel that fall back gracefully when env keys are missing. See PROVIDER_ADAPTERS.md.
Data Lake + Lead Graph — 7-table compliant ingestion: raw_lead_imports → raw_lead_rows → accounts → contacts → signals → lead_scores → data_suppression_list. PDPL-aware (allowed_use, consent_status, opt_out, risk_level mandatory per row). See DATA_LAKE_PLAYBOOK.md.
Frontend — Static landing on GitHub Pages + interactive dashboard with live Saudi Lead Engine demo. See landing/.
Day-1 Operating Kit — 287 outreach-ready Saudi B2B accounts pre-built across 7 segments (real-estate / construction / hospitality / events / food / logistics / SaaS / agency). Pricing ladder + Pilot offer + Partner model + Channel templates. See docs/business/.
⚡ Quick Deploy
Any Docker-capable platform works. See DEPLOYMENT.md for Railway, Render, Fly.io, Heroku, DigitalOcean, AWS, self-hosted.
# Local
docker build -t dealix .
cp .env.example .env # edit with real values
docker run -p 8000:8000 --env-file .env dealix
curl localhost:8000/health
Public endpoints (no auth): /health, /api/v1/public/demo-request, /api/v1/pricing/plans, /api/v1/checkout, /api/v1/webhooks/moyasar
🌟 One-line definition
Dealix is a sovereign, policy-governed Growth & Execution OS for Saudi enterprises. It combines agentic intelligence, deterministic execution, approval controls, and executive observability to drive revenue, partnerships, expansion, and strategic operations with enterprise-grade trust.
It is not a CRM, not a chatbot, not a sales automation tool.
🧭 The Prime Operating Rule
AI explores, analyzes, and recommends. Deterministic workflows execute. Humans approve critical moves.
No agent makes an external commitment on its own. No critical output leaves the system without being structured, evidence-backed, policy-evaluated, and (where required) human-approved.
🧱 The six OS tracks
- Revenue OS — lead to close, pipeline, forecasting
- Partnership OS — partner discovery, joint pursuits, co-sell
- Corporate Development / M&A OS — sourcing, diligence, integration
- Expansion OS — new-market entry, localization
- PMI / Strategic PMO OS — post-merger integration, cross-BU initiatives
- Trust, Policy & Executive Governance OS — controls, approvals, risk, audit
🏗️ Five mandatory planes
Every feature lives in exactly one plane. Crossing planes happens via contracts, never via shared memory or direct calls.
| Plane | Responsibility | Module |
|---|---|---|
| Decision | Agents: reasoning, synthesis, recommendation, evidence assembly | auto_client_acquisition/, autonomous_growth/, core/agents/ |
| Execution | Durable workflows, retries, compensation, external commitments | auto_client_acquisition/pipeline.py, dealix/execution/ |
| Trust | Policy, approval, audit, tool verification, evidence packs | dealix/trust/ |
| Data | Operational source of truth, semantic metrics, lineage | db/, integrations/ |
| Operating | Repo governance, CI/CD, releases, SDLC security | .github/, Dockerfile, Makefile |
🛡️ What makes this Tier-1
1. Structured outputs with classifications
Every critical agent output is a validated DecisionOutput (Pydantic + JSON Schema) carrying:
- Approval class (A0–A3): who must approve
- Reversibility class (R0–R3): how hard to undo
- Sensitivity class (S0–S3): data/impact risk
2. Trust Plane as a non-bypassable overlay
Every NextAction runs through a PolicyEvaluator that returns ALLOW / DENY / ESCALATE. Escalations create ApprovalRequests with TTL + multi-approver support. Every step is audited.
3. Never-auto-execute list
Hardcoded in dealix/classifications/NEVER_AUTO_EXECUTE: pricing commits, contract changes, NDAs, payment terms, regulator comms, sensitive data exports — these cannot bypass human approval, regardless of other signals.
4. Evidence packs on high-stakes decisions
A2+/R3/S3 decisions cannot be constructed without evidence — Pydantic validator enforces it. Every pack ships with sources, tool calls (intended vs actual), prompts used, model versions, and a bilingual AR/EN board-grade memo.
5. No-overclaim register
Every public product claim is tracked in dealix/registers/no_overclaim.yaml with status (Production / Partial / Pilot / Planned) and evidence paths.
6. Saudi-native from day one
Not localization — Gulf business register Arabic, SAR pricing tiers, Riyadh timezone awareness, PDPL lawful-basis enforcement via policy rules, NCA ECC/DCC/CCC mapping in dealix/registers/compliance_saudi.yaml.
✨ Core technical features
- 🧠 Multi-LLM routing with fallback — Claude, Gemini, Groq, DeepSeek, GLM, OpenAI. Task → best provider → auto-fallback on failure. Per-provider usage tracking.
- 🤖 15+ production agents — typed I/O, structured logging, graceful degradation, 63 tests.
- 🌍 First-class bilingual AR/EN — detection, routing (Arabic → GLM), content generation, sales scripts, docs.
- 🔒 Security-first —
.env-only config,SecretStreverywhere, gitleaks + detect-secrets + trufflehog + bandit in pre-commit AND CI, webhook HMAC verification, non-root Docker, ToS-safe LinkedIn. - 🐳 Cloud-ready — multi-stage Dockerfile, docker-compose stack (Postgres + Redis + Mongo), GitHub Actions CI/CD, GHCR image push on release tags.
- 📊 Observable — structlog JSON logs in prod, request IDs, per-provider LLM usage metrics, optional Langfuse integration.
🏗️ Architecture
graph TB
subgraph Clients
W[Website Forms]
WA[WhatsApp Business]
E[Email]
end
subgraph Gateway["FastAPI Gateway"]
R[6 routers + middleware]
end
subgraph Decision["Decision Plane — agents"]
I[Intake] --> P[Pain Extract]
P --> IC[ICP Match]
IC --> Q[Qualification]
end
subgraph Trust["Trust Plane — NON-BYPASSABLE"]
POL[Policy Evaluator]
APR[Approval Center]
AUD[Audit Sink]
TV[Tool Verification Ledger]
end
subgraph Execution["Execution Plane — deterministic"]
CRM[HubSpot sync]
BK[Booking]
PS[Proposal send]
end
subgraph LLM["LLM Router — fallback"]
CL[Claude]
GM[Gemini]
GQ[Groq]
DS[DeepSeek]
GL[GLM]
end
Clients --> Gateway
Gateway --> Decision
Decision --> Trust
Trust -->|ALLOW| Execution
Trust -->|ESCALATE| HUMAN[Human approver]
HUMAN --> Execution
Decision --> LLM
Trust --> AUD
Full blueprint: docs/blueprint/master-architecture.md.
🚀 Quick start
git clone https://github.com/YOUR-ORG/ai-company-saudi.git
cd ai-company-saudi
make setup
# edit .env, then:
make run
# → http://localhost:8000/docs
Full stack (app + Postgres + Redis + Mongo):
make docker-up
Try the governed pipeline
curl -X POST http://localhost:8000/api/v1/leads \
-H "Content-Type: application/json" \
-d '{
"company": "شركة التقنية المتقدمة",
"name": "أحمد محمد",
"email": "ahmed@example.sa",
"phone": "+966501234567",
"sector": "technology",
"region": "Saudi Arabia",
"budget": 50000,
"message": "نحتاج نظام AI لإدارة المبيعات"
}'
Use the GovernedPipeline directly (shows the governance layer)
import asyncio
from dealix.execution import GovernedPipeline
async def main():
gp = GovernedPipeline()
result = await gp.run(payload={
"company": "...",
"name": "...",
"message": "..."
})
print(f"Decisions: {len(result.decisions)}")
print(f"Policy results: {len(result.policy_results)}")
print(f"Approval requests: {len(result.approval_requests)}")
print(f"Audit trail: {len(result.audit_trail)} entries")
asyncio.run(main())
📚 The twelve Master Documents
All under dealix/masters/ and dealix/registers/:
- Master Architecture Blueprint — canonical source of truth
- AI Operating Constitution — binding rules
- Trust Fabric Specification
- Execution Fabric Specification
- Repo Operating Pack
- 90-Day Execution Matrix
- Saudi Compliance Register — PDPL + NCA + AI governance
- Technology Radar
- Incident & Rollback Runbook
- Release Readiness Checklist
- No-Overclaim Register — every public claim tracked
- Evidence Pack Specification
🧪 Testing
make test # 63 tests, all passing
Tests include: intake, ICP matcher, pain extractor, model router, API endpoints, full Phase 8 pipeline, Dealix contracts (with high-stakes validation), Trust Plane (policy + approval + audit + tool verification), Governed pipeline end-to-end.
🧰 Tech stack
| Layer | Choice | Status |
|---|---|---|
| Language | Python 3.11 / 3.12 | ADOPT |
| Framework | FastAPI 0.115 + Uvicorn | ADOPT |
| Validation | Pydantic v2 + pydantic-settings | ADOPT |
| Contracts | JSON Schema + CloudEvents 1.0 | ADOPT |
| DB | PostgreSQL 16 + pgvector | ADOPT |
| LLM | Claude, Gemini, Groq, DeepSeek, GLM, OpenAI fallback | ADOPT |
| Execution | In-process → LangGraph → Temporal spike | TRIAL→ADOPT |
| Trust — Policy | In-process → OPA/Rego | TRIAL |
| Trust — AuthZ | In-process → OpenFGA | TRIAL |
| Trust — Identity | local → Keycloak | TRIAL |
| Trust — Secrets | .env + SecretStr → Vault |
TRIAL |
| Observability | structlog → OpenTelemetry | TRIAL |
| CI/CD | GitHub Actions + rulesets + OIDC | ADOPT |
Full radar: dealix/registers/technology_radar.yaml.
📊 Phase 8 — Acquisition agents
All 9 agents + pipeline. Every output lifts to a DecisionOutput via dealix.contracts.builders.
| Agent | Classification | Role |
|---|---|---|
| Intake | A0/R0/S2 | Multi-source lead capture, normalization, dedup |
| ICP Matcher | A0/R0/S1 | 5-dim weighted Fit scoring with tier A/B/C/D |
| Pain Extractor | A0/R0/S1 | Hybrid keyword + LLM pain extraction (AR+EN) |
| Qualification | A0/R0/S1 | BANT questions, status advancement |
| Booking | A1/R1/S2 | Calendly → Google Calendar → manual (requires approval) |
| CRM | A0→A1/R1/S2 | HubSpot contact upsert (A0) + deal create (A1) |
| Proposal draft | A0/R0/S2 | Claude-authored, region-aware pricing |
| Proposal send | A2/R2/S2 | Gated — requires manager + legal approval |
| Outreach | A1/R2/S2 | Bilingual cold openers — gated |
| Follow-up | A1/R2/S2 | Cadence-based — gated |
📈 Phase 9 — Growth agents
| Agent | Role |
|---|---|
| Sector Intel | 12 Saudi sectors with curated market size, growth, AI readiness |
| Content Creator | Bilingual articles, LinkedIn, case studies, newsletters |
| Distribution | Multi-channel scheduling (Riyadh timezone) |
| Enrichment | Domain + LLM-based lead enrichment |
| Competitor Monitor | Positioning, pricing hints, counter-moves |
| Market Research | Gemini-powered research with bullet findings |
🔒 Security
.env-only config viapydantic-settings;SecretStron every sensitive value- Pre-commit:
gitleaks,detect-secrets,bandit,hadolint - CI: re-runs the above +
trufflehogon every push and PR - Webhook HMAC verification (WhatsApp)
- Non-root Docker container with healthcheck
- LinkedIn integration disabled by default (ToS compliance)
- See SECURITY.md for reporting vulnerabilities
🇸🇦 Saudi compliance
Designed from inception for:
- PDPL — lawful-basis register, retention schedule, breach response, DPO assessment, cross-border transfer posture
- NCA ECC 2-2024 — Essential Cybersecurity Controls
- NCA DCC-1:2022 — Data Cybersecurity Controls
- NCA CCC 2:2024 — Cloud Cybersecurity Controls
- NIST AI RMF 1.0 + OWASP Top 10 for LLM Applications
Full register: dealix/registers/compliance_saudi.yaml.
🤝 Contributing
See CONTRIBUTING.md and Repo Operating Pack. By participating you agree to the Code of Conduct.
📜 License
MIT — see LICENSE.