CRM ↔ Labyrinth
The technical view: how ElevateCRM and Labyrinth interact, the modules' impact on each other, the closed-won → onboarding handoff (data, gates, pre/post-conditions), and how both connect to the wider Elev8 fabric.
Two systems, one continuous funnel
ElevateCRM runs the revenue motion (lead → pipeline → closed-won). The moment a deal is won, two things fire in parallel: a direct handoff creates the delivery contract in Labyrinth, and a governed fabric event notifies the ecosystem. Labyrinth then runs execution.
| # | Stage | System | Primary trigger / event |
|---|---|---|---|
| 1 | Lead captured | ElevateCRM | form / manual / Nexus inbound |
| 2 | Qualified → Deal | ElevateCRM | lead conversion |
| 3 | Pipeline movement | ElevateCRM | move-stage → deal_stage_change (→ MAi) |
| 4 | Closed-Won gate | ElevateCRM | requires final value + payment terms + handoff form |
| 5 | Closed-Won fires | ElevateCRM | apply_closed_won_automations |
| 6a | Direct handoff | CRM → Labyrinth | POST /api/light/handoff (REST, token-auth) |
| 6b | Governed event | CRM → Seraph | deal_stage_change → MAi + Nexus |
| 7 | Contract created | Labyrinth OS | SIGNED / ONBOARDING + milestones + requests |
| 8 | Execution & accountability | Labyrinth OS | owner delegates · cron escalates overdue |
How the modules affect each other
Actions in one module ripple into others through triggers, automations and the fabric.
| Action (module) | Triggers / automations | Impact on other modules |
|---|---|---|
| Deal → any stage (CRM) | emits deal_stage_change → MAi | MAi event log records it; CRM dashboard counts update. |
| Deal → Closed-Won (CRM) | lock deal · assign delivery owner · kickoff task · notify finance · affiliate commission · call Labyrinth handoff · timeline event; fabric event → MAi + Nexus | Creates a Labyrinth contract; Nexus scorecard; Finance notified; Ripple commission. |
| Proposal accepted (CRM) | proposal_accepted → MAi (+ Nexus if a Nexus lead_id exists) | MAi notification; Nexus freezes eval snapshot when lead-linked. |
| Handoff received (Labyrinth) | creates contract + milestones + tasks + operational requests + Rainfall message + system event | Appears in System Factory, Contracts, Vision; requests in owners' My Work. |
| Request overdue (Labyrinth) | 15-min accountability cron walks the ladder | Rainfall escalation; Accountability queue; CRITICAL red tags block milestones. |
| Red tag raised (Labyrinth) | severity gates progression | WARNING blocks request · CRITICAL blocks milestone · BLOCKER blocks contract. |
| Milestone approval (Labyrinth) | 4-step chain | Coordinator → Advisor → Accountability → CEO; all four to fully approve. |
CRM → Labyrinth, step by step
Step A · Work the deal to "ready to win" (CRM)
The rep moves the deal across stages; each move emits deal_stage_change to MAi.
Pre-conditions for Closed-Won: contract_final_value (non-null), payment_terms (non-empty), and a complete handoff form (delivery owner + kickoff + checklist). Missing any → the move is blocked. A manager/admin may override with a reason.
Step B · Close the deal (CRM)
Closed-Won requires a win_reason (unless overridden). Deal then locks, status → won, probability → 100%, and apply_closed_won_automations runs.
Post-conditions: deal locked; delivery owner assigned; kickoff task created; finance notified; commission created; handoff fired; fabric event emitted.
Step C · The handoff call (CRM → Labyrinth)
CRM POSTs to {LABYRINTH_LIGHT_BASE_URL}/api/light/handoff with a Bearer token, gated by config + per-tenant flag.
What crosses the wire
The handoff payload shape:
{
"externalSystem": "elevatecrm",
"externalTenantId": "<tenant uuid>",
"externalDealId": "<deal uuid>",
"dealName": "…",
"clientName": "…",
"contract": { "name": "<Client> Operating Launch", "clientPackage": "SILVER",
"value": contract_final_value ?? proposal_value ?? amount },
"milestones": [ "Sales to delivery handoff", "Campaign readiness", "First campaign execution" ]
}
Step D · Labyrinth receives & creates (post-conditions)
The receiver authenticates the token; requires externalDealId, externalTenantId, contract.name, clientName; is idempotent on (tenant, deal). On success it creates:
- a Contract at stage
SIGNED, journeyONBOARDING, modeBUILD; - the milestones + tasks from the payload (or defaults);
- three operational requests (schedule kickoff, confirm onboarding access, publish first plan);
- a Rainfall communication (requires-ack) and a system event (
ELEVATECRM_HANDOFF_RECEIVED).
| Response | Meaning |
|---|---|
| 201 | Contract created. |
| 200 | Already linked — returns existing contract (idempotent re-send). |
| 401 | Bad/missing service token. |
| 422 | Missing required fields. |
| 500 | Internal failure — a Development incident is auto-created. |
Prerequisites, gates & failure modes
| Gate | Where | Behaviour |
|---|---|---|
LABYRINTH_LIGHT_ENABLED | CRM env | Master switch. Off → {status: skipped, reason: disabled}. |
| Per-tenant flag | workspace script_config.labyrinth_light.enabled | Tenant must opt in (or default flag). Not opted in → {skipped, tenant_disabled}. |
| Base URL + token | CRM env | Both required. Missing + REQUIRED → 503. |
LABYRINTH_LIGHT_REQUIRED | CRM env | If true, a failed handoff raises 502 (the close errors). If false, fails silently; deal still closes. |
| Token match | both apps | CRM's token must equal Labyrinth's. Mismatch → 401 at receiver → 502 if REQUIRED. |
labyrinth_light: synced with a contract created. Tokens matched, so no 502 under REQUIRED.Normal-operation expectations
- Happy path: close-won → 201 → contract visible in seconds; deal carries
spiced.labyrinth_light = synced. - Re-close / replay: idempotent — no duplicate contract.
- Handoff disabled: deal still closes; no contract; status
skipped(not an error).
How CRM & Labyrinth connect to the wider fabric
Both apps emit governed events into the Elev8 fabric through Seraph, which validates/audits and routes to the system-of-record (MAi) and other engines.
| External system | Role | Touchpoint |
|---|---|---|
| Seraph | Governance / audit / routing gate | CRM & Labyrinth POST UIR events with X-Fabric-Token to ELEV8_SERAPH_URL. |
| Mother AI (MAi) | System-of-record + leadership intelligence | Receives every deal_stage_change, proposal_accepted, labyrinth.* event. |
| Nexus | Strategy scoring + client journey/portal | Receives deal_stage_change on closed-won; proposal_accepted when lead-linked; pushes leads inbound to CRM. |
| Finexus / DealGauge | Financial valuation engine | Drives the Nexus evaluation; not directly called by CRM/Labyrinth. |
| Ripple | Referral / affiliate engine | CRM auto-creates an affiliate commission on closed-won. |
| Enlil | In-app AI assistant / observer | Surfaces proposal data (inbound) and observes the firehose. |
Prerequisites for fabric integration
ELEV8_FABRIC_ENABLED=trueon the emitting app.- Shared
ELEV8_FABRIC_SECRETmatching Seraph's, sent asX-Fabric-Token. ELEV8_SERAPH_URLpointing at the environment's Seraph; the app's origin allow-listed.
Enums, events & env
Labyrinth contract lifecycle (10-stage)
QUESTIONNAIRE → PROPOSAL → SOW → BID → SIGNED → ACTIVE → REVISED → CONFIRMING → COMPLETED → PAID (+ ON_HOLD, CANCELLED). Handoff creates contracts at SIGNED.
Operating journey stage
QUESTIONNAIRE · ONBOARDING · EVALUATION_STRATEGY · PROPOSAL · EXECUTION · DELIVERY · REPORTING · ENHANCEMENT · SCALING · EXIT. Handoff sets ONBOARDING.
Milestone status & approval chain
Status: NOT_STARTED · IN_PROGRESS · OPTIMIZED · EXECUTED · NEEDS_ATTENTION. Approval chain (all four): Coordinator → Advisor → Accountability → CEO.
Request state & red-tag severity
Request: OPEN · IN_PROGRESS · BLOCKED · COMPLETED · CANCELLED. Red tag: WARNING (blocks request) · CRITICAL (blocks milestone) · BLOCKER (blocks contract).
Fabric events
| Event | From | Targets | When |
|---|---|---|---|
elevatecrm.deal_stage_change | CRM | MAi (+ Nexus on closed_won) | any stage move |
elevatecrm.proposal_accepted | CRM | MAi (+ Nexus if lead_id) | proposal accepted |
labyrinth.* | Labyrinth | MAi (route/mai) | state-engine seams; includes tenant_id |
Key env vars
LABYRINTH_LIGHT_ENABLED · LABYRINTH_LIGHT_REQUIRED · LABYRINTH_LIGHT_DEFAULT_TENANT_ENABLED · LABYRINTH_LIGHT_BASE_URL · LABYRINTH_LIGHT_API_TOKEN · ELEV8_FABRIC_ENABLED · ELEV8_FABRIC_SECRET · ELEV8_FABRIC_HEADER · ELEV8_SERAPH_URL.