system-prompts-and-models-o.../salesflow-saas/docs/governance/execution-fabric.md
Claude a319feb6d7
feat(dealix): complete Tier-1 Sovereign Enterprise Growth OS
Governance layer (14 docs):
- MASTER_OPERATING_PROMPT.md — operating constitution (five planes, six tracks, policy classes)
- docs/ai-operating-model.md — five-plane architecture (Decision/Execution/Trust/Data/Operating)
- docs/dealix-six-tracks.md — six strategic tracks (Revenue/Intelligence/Compliance/Expansion/Operations/Trust)
- docs/governance/execution-fabric.md — OpenClaw execution plane deep dive
- docs/governance/trust-fabric.md — trust plane with contradiction engine + evidence packs
- docs/governance/saudi-compliance-and-ai-governance.md — PDPL/ZATCA/SDAIA/NCA live controls
- docs/governance/technology-radar-tier1.md — Core/Strong/Pilot/Watch/Hold classification
- docs/governance/partnership-os.md — alliance lifecycle management
- docs/governance/ma-os.md — M&A corporate development lifecycle
- docs/governance/expansion-os.md — geographic and vertical growth
- docs/governance/pmi-os.md — post-merger integration framework
- docs/governance/executive-board-os.md — executive decision surfaces
- docs/execution-matrix-90d-tier1.md — 90-day sprint execution plan
- docs/adr/0001-tier1-execution-policy-spikes.md — 8 architectural decisions

Backend (3 models, 6 services, 8 API routes):
- Contradiction Engine — detect/track system conflicts
- Evidence Pack System — tamper-evident audit proof with SHA256
- Saudi Compliance Matrix — live PDPL/ZATCA/SDAIA/NCA controls
- Executive Room — unified executive decision surface
- Connector Governance — integration health monitoring
- Model Routing Dashboard — LLM provider metrics
- Forecast Control Center — actual vs forecast across tracks
- Approval Center — enhanced approval queue with SLA

Frontend (9 components):
- Executive Room, Evidence Pack Viewer, Approval Center
- Connector Governance Board, Saudi Compliance Dashboard
- Actual vs Forecast Dashboard, Risk Heatmap
- Policy Violations Board, Partner Pipeline Board

Tooling:
- scripts/architecture_brief.py — preflight validation (40/40 checks pass)
- Updated CLAUDE.md and AGENTS.md with governance references

https://claude.ai/code/session_01W1rJthWDkasijTdXCfxVHs
2026-04-16 12:48:13 +00:00

6.0 KiB

Execution Fabric — Dealix Execution Plane Deep Dive

Parent: MASTER_OPERATING_PROMPT.md
Plane: Execution | Tracks: All
Version: 1.0 | Status: Canonical


Overview

The Execution Fabric defines how Dealix performs work: how tasks are classified, routed, checkpointed, retried, and completed. The backbone is the OpenClaw Framework — a durable execution engine with policy-aware gating.


Architecture

Inbound Request/Event
        │
        ▼
┌──────────────────┐
│  OpenClaw Gateway │  ← Single ingress for all tasks
│   (gateway.py)    │
└───────┬──────────┘
        │
        ▼
┌──────────────────┐
│   Policy Gate     │  ← Classify action (A/B/C)
│   (policy.py)     │
└───────┬──────────┘
        │
   ┌────┴────┐
   │ Class C │──→ BLOCKED (forbidden)
   └─────────┘
        │
   ┌────┴────┐
   │ Class B │──→ Check approval_token
   └─────────┘     │
        │     ┌────┴─────┐
        │     │ No token │──→ BLOCKED (requires_approval)
        │     └──────────┘
        │
        ▼
┌──────────────────┐
│  Canary Context   │  ← Tenant in canary group?
│ (canary_context)  │
└───────┬──────────┘
        │
        ▼
┌──────────────────┐
│  Observability    │  ← Start trace, record steps
│ (observability)   │
└───────┬──────────┘
        │
        ▼
┌──────────────────┐
│   Task Router     │  ← Dispatch to handler
│  (task_router)    │
└───────┬──────────┘
        │
        ▼
┌──────────────────┐
│  Durable Flow     │  ← Checkpoint state
│ (durable_flow)    │
└───────┬──────────┘
        │
        ▼
┌──────────────────┐
│  Handler / Agent  │  ← Execute business logic
│  (Celery / Sync)  │
└──────────────────┘

Task Classification

Class A — Safe Auto Actions

SAFE_AUTO_ACTIONS = {
    "read_status", "collect_signals", "summarize", "classify",
    "tag", "internal_status_update", "research", "generate_draft",
    "plan", "predictive_analysis"
}

These execute immediately without human approval.

Class B — Approval-Gated Actions

APPROVAL_GATED_ACTIONS = {
    "send_whatsapp", "send_email", "send_linkedin",
    "trigger_voice_call", "sync_salesforce", "create_charge",
    "publish_content", "change_billing_state", "modify_lead_routing",
    "send_contract_for_signature", "video_generate", "music_generate"
}

These require an approval_token in the payload.

Class C — Forbidden Actions

FORBIDDEN_ACTIONS = {
    "exfiltrate_secrets", "delete_data_without_audit",
    "bypass_auth", "publish_without_approval", "destructive_unchecked"
}

These are unconditionally blocked.

Default: Unknown actions → Class B (approval required).


Durable Flow Lifecycle

1. CREATE    → DurableTaskFlow(flow_name, tenant_id)
2. CHECKPOINT → flow.checkpoint(note, state_patch) → FlowRevision
3. RESUME    → Load from checkpoints, continue from last state
4. COMPLETE  → Final checkpoint, mark complete
5. ROLLBACK  → Compensate side effects (target state)

Each checkpoint stores:

  • revision_id (UUID)
  • at (ISO timestamp)
  • note (human-readable)
  • checkpoint (full state snapshot)

Plugin System

Plugins extend the Execution Plane with external integrations:

Plugin File Purpose
WhatsApp plugins/whatsapp_plugin.py WhatsApp Cloud API messaging
Salesforce plugins/salesforce_agentforce_plugin.py CRM sync, Account 360
Stripe plugins/stripe_plugin.py Payment processing
Voice plugins/voice_plugin.py Voice call integration
Contract Intel plugins/contract_intelligence_plugin.py Contract analysis

Plugin Contract

Each plugin must:

  1. Register its task types with task_router.register()
  2. Accept (tenant_id: str, payload: dict) as input
  3. Return dict with structured output
  4. Handle its own retries and error reporting
  5. Log to observability bridge

Agent Execution Model

Event → Agent Router → Input Validation → Celery Task
  → LLM Call (model_router.py selects provider)
  → Output Parsing (Pydantic schema validation)
  → Escalation Check (rules in agent config)
  → Action Handler / Human Handoff
  → Log to ai_conversations

19 specialized agents, each with:

  • System prompt (ai-agents/prompts/)
  • Input/output schema
  • Model + temperature config
  • Escalation rules

Error Handling

Error Type Behavior
LLM timeout Retry with exponential backoff (3 attempts)
Plugin failure Log error, mark flow as failed, alert
Policy violation Block immediately, log to audit
Tenant mismatch Block, log security event
Unknown task type Raise ValueError, log

Current vs Target

Capability Current Target
Task classification (A/B/C) Live Live
Durable checkpointing Live (in-memory) Persistent storage
Plugin system Live (5 plugins) Expand to 10+
Agent execution Live (19 agents) Add governance agents
Canary enforcement Live Live
Compensation/rollback Not implemented Planned
Idempotency keys Not implemented Planned
Dead letter queue Not implemented Planned
Temporal integration Not evaluated Watch