{
  "version": "1.0",
  "generated_at": "2026-06-12",
  "description": "FundOS module contract — describes every module's data ownership, canonical IDs, cross-module foreign keys, and webhook events. Read by AI agents (Claude, Cursor, Codex) to understand how to connect FundOS modules together.",
  "modules": {
    "crm": {
      "label": "Deal CRM",
      "api_prefix": "/api/v1/fundos/crm",
      "owns": ["Deal", "PipelineStage", "DealActivity", "DealContact"],
      "canonical_id": "deal_id",
      "cross_module_links": [
        {"field": "linked_room_id", "module": "vdr", "id": "room_id", "via": "Transaction.linked_room_id"},
        {"field": "fund_account_id", "module": "cfo", "id": "fund_account_id"}
      ],
      "emits": [
        {"event": "deal.created", "trigger": "POST /api/v1/fundos/crm/deals or web form"},
        {"event": "deal.stage_changed", "trigger": "POST /fundos/crm/<id>/move-stage"},
        {"event": "deal.closed", "trigger": "deal.stage_changed where new stage is_closed=true"}
      ],
      "ephemeral_support": true,
      "quickstart_url": "https://kela.com/developers/modules/crm",
      "agent_readiness_score": 6
    },
    "lp_crm": {
      "label": "LP CRM (Fundraising)",
      "api_prefix": "/api/v1/fundos/lp-crm",
      "owns": ["LPInvestor", "LPMeeting", "LPDevSignal", "LPOutreach", "LPDocShare"],
      "canonical_id": "lp_id",
      "cross_module_links": [
        {"field": "lp_room_id", "module": "vdr", "id": "room_id"},
        {"field": "lp_investor_id", "module": "investors", "id": "lp_id"}
      ],
      "emits": [
        {"event": "lp.created", "trigger": "POST /api/v1/fundos/lp-crm/investors"},
        {"event": "lp.stage_moved", "trigger": "POST /fundos/lp-crm/<id>/move-stage"},
        {"event": "lp.signal_logged", "trigger": "POST /fundos/lp-crm/<id>/log-signal"}
      ],
      "ephemeral_support": true,
      "quickstart_url": "https://kela.com/developers/modules/lp-crm",
      "agent_readiness_score": 6
    },
    "vdr": {
      "label": "VDR + Due Diligence",
      "api_prefix": "/api/v1",
      "owns": ["DealRoom", "Document", "Folder", "Question", "Answer", "DealRoomMember"],
      "canonical_id": "room_id",
      "cross_module_links": [
        {"field": "linked_room_id", "module": "crm", "id": "deal_id", "via": "Transaction.linked_room_id"},
        {"field": "lp_room_id", "module": "lp_crm", "id": "lp_id"}
      ],
      "emits": [
        {"event": "room.created", "trigger": "POST /api/v1/rooms or web"},
        {"event": "document.uploaded", "trigger": "POST /api/v1/rooms/<id>/documents"},
        {"event": "qa.answered", "trigger": "POST /api/v1/rooms/<id>/questions/<qid>/answer"}
      ],
      "ephemeral_support": false,
      "quickstart_url": "https://kela.com/developers/modules/vdr",
      "agent_readiness_score": 5
    },
    "transactions": {
      "label": "Transactions (Closing)",
      "api_prefix": "/api/v1/fundos/transactions",
      "owns": ["Transaction", "ClosingTask"],
      "canonical_id": "transaction_id",
      "cross_module_links": [
        {"field": "deal_id", "module": "crm", "id": "deal_id"},
        {"field": "linked_room_id", "module": "vdr", "id": "room_id"}
      ],
      "emits": [
        {"event": "transaction.created", "trigger": "POST /api/v1/fundos/transactions"},
        {"event": "transaction.task_completed", "trigger": "POST /fundos/transactions/<id>/tasks/<tid>/complete"},
        {"event": "transaction.closed", "trigger": "transaction status set to closed"}
      ],
      "ephemeral_support": true,
      "quickstart_url": "https://kela.com/developers/modules/transactions",
      "agent_readiness_score": 6
    },
    "investors": {
      "label": "Investor Portal",
      "api_prefix": "/api/v1/fundos/investors",
      "owns": ["CapitalCall", "Distribution", "LPCommitment"],
      "canonical_id": "call_id",
      "cross_module_links": [
        {"field": "lp_investor_id", "module": "lp_crm", "id": "lp_id"},
        {"field": "capital_call_id", "module": "cfo", "id": "journal_entry_id", "note": "CFO posts journal on call.paid"}
      ],
      "emits": [
        {"event": "capital_call.issued", "trigger": "POST /fundos/investors/<lp_id>/calls (status=issued)"},
        {"event": "capital_call.paid", "trigger": "capital call status updated to paid"}
      ],
      "ephemeral_support": false,
      "quickstart_url": "https://kela.com/developers/modules/investors",
      "agent_readiness_score": 6
    },
    "cfo": {
      "label": "CFO Center",
      "api_prefix": "/api/v1/fundos/cfo",
      "owns": ["FundAccount", "JournalEntry", "PeriodClose", "NavAccrualEntry", "BenchmarkPrice"],
      "canonical_id": "fund_account_id",
      "cross_module_links": [
        {"field": "deal_id", "module": "crm", "id": "deal_id"},
        {"field": "lp_investor_id", "module": "lp_crm", "id": "lp_id"},
        {"field": "parent_fund_account_id", "module": "cfo", "id": "fund_account_id", "note": "master-feeder self-ref"}
      ],
      "emits": [],
      "ephemeral_support": true,
      "quickstart_url": "https://kela.com/developers/modules/cfo",
      "agent_readiness_score": 5
    },
    "risk": {
      "label": "Risk (DSRI)",
      "api_prefix": "/api/v1/fundos/risk",
      "owns": ["Covenant", "RiskAlert", "PortfolioMetric"],
      "canonical_id": "covenant_id",
      "cross_module_links": [
        {"field": "deal_id", "module": "crm", "id": "deal_id"}
      ],
      "emits": [
        {"event": "covenant.breached", "trigger": "covenant check triggers status=breach"},
        {"event": "alert.created", "trigger": "RiskAlert row inserted"}
      ],
      "ephemeral_support": false,
      "quickstart_url": "https://kela.com/developers/modules/crm",
      "agent_readiness_score": 4
    },
    "cim": {
      "label": "CIM Builder",
      "api_prefix": "/api/v1/fundos/cim",
      "owns": ["CIMReport", "CIMSection"],
      "canonical_id": "cim_id",
      "cross_module_links": [
        {"field": "deal_id", "module": "crm", "id": "deal_id"}
      ],
      "emits": [],
      "ephemeral_support": false,
      "quickstart_url": "https://kela.com/developers/modules/crm",
      "agent_readiness_score": 4
    },
    "pricer": {
      "label": "Pricer (IRR/MOIC/WAL)",
      "api_prefix": "/api/v1/fundos/pricer",
      "owns": ["DealPricing"],
      "canonical_id": "pricing_id",
      "cross_module_links": [
        {"field": "deal_id", "module": "crm", "id": "deal_id"}
      ],
      "emits": [],
      "ephemeral_support": true,
      "quickstart_url": "https://kela.com/developers/modules/crm",
      "agent_readiness_score": 5
    },
    "syndication": {
      "label": "Syndication",
      "api_prefix": "/api/v1/fundos/syndication",
      "owns": ["Syndication", "SyndicationAllocation"],
      "canonical_id": "syndication_id",
      "cross_module_links": [
        {"field": "deal_id", "module": "crm", "id": "deal_id"}
      ],
      "emits": [],
      "ephemeral_support": false,
      "quickstart_url": "https://kela.com/developers/modules/crm",
      "agent_readiness_score": 3
    },
    "oms": {
      "label": "OMS (Order Management)",
      "api_prefix": "/api/v1/fundos/oms",
      "owns": ["Order", "Execution", "Position", "TaxLot", "PortfolioModel", "RebalanceProposal"],
      "canonical_id": "order_id",
      "cross_module_links": [
        {"field": "fund_account_id", "module": "cfo", "id": "fund_account_id"}
      ],
      "emits": [
        {"event": "order.created", "trigger": "POST /api/v1/fundos/oms/orders"},
        {"event": "order.filled", "trigger": "execution webhook marks order fully filled"},
        {"event": "order.cancelled", "trigger": "POST /api/v1/fundos/oms/orders/<id>/cancel"}
      ],
      "ephemeral_support": false,
      "quickstart_url": "https://kela.com/developers/modules/crm",
      "agent_readiness_score": 4
    },
    "hf_ops": {
      "label": "HF Ops (DTCC ITP)",
      "api_prefix": "/api/v1/fundos/hf-ops",
      "owns": ["DTCCTrade", "DTCCAffirmation", "HFReconRun"],
      "canonical_id": "ctm_ref",
      "cross_module_links": [
        {"field": "fund_account_id", "module": "cfo", "id": "fund_account_id"}
      ],
      "emits": [],
      "ephemeral_support": false,
      "quickstart_url": "https://kela.com/developers/modules/crm",
      "agent_readiness_score": 3
    }
  },
  "cross_module_flows": [
    {
      "name": "Deal Lifecycle",
      "description": "The canonical path from sourcing to closing.",
      "steps": [
        {"module": "crm", "action": "create Deal", "id_produced": "deal_id"},
        {"module": "transactions", "action": "create Transaction with deal_id", "id_produced": "transaction_id"},
        {"module": "vdr", "action": "create DealRoom, link via Transaction.linked_room_id", "id_produced": "room_id"},
        {"module": "pricer", "action": "attach DealPricing with deal_id", "id_produced": "pricing_id"},
        {"module": "cfo", "action": "link Deal.fund_account_id for P&L tracking", "id_produced": "fund_account_id"}
      ]
    },
    {
      "name": "LP Capital Call",
      "description": "Issue and track a capital call from an LP investor.",
      "steps": [
        {"module": "lp_crm", "action": "create LPInvestor", "id_produced": "lp_id"},
        {"module": "investors", "action": "issue CapitalCall with lp_investor_id", "id_produced": "call_id"},
        {"module": "cfo", "action": "post JournalEntry referencing capital_call_id", "id_produced": "journal_entry_id"}
      ]
    },
    {
      "name": "LP Onboarding to VDR",
      "description": "Give an LP investor access to a data room.",
      "steps": [
        {"module": "lp_crm", "action": "find LPInvestor by name/email", "id_produced": "lp_id"},
        {"module": "vdr", "action": "use lp_room_id from LPInvestor to locate LP room", "id_produced": "room_id"},
        {"module": "vdr", "action": "POST /api/v1/rooms/<room_id>/members to grant access"}
      ]
    },
    {
      "name": "Risk Monitor to Alert",
      "description": "Check a covenant and surface a breach as an alert.",
      "steps": [
        {"module": "crm", "action": "find Deal by name/id", "id_produced": "deal_id"},
        {"module": "risk", "action": "GET /api/v1/fundos/risk/covenants?deal_id=X", "id_produced": "covenant_id"},
        {"module": "risk", "action": "POST /api/v1/fundos/risk/covenants/<id>/check with new value"},
        {"module": "risk", "action": "if breach: RiskAlert auto-created, webhook covenant.breached fires"}
      ]
    }
  ],
  "webhook_catalogue": {
    "platform": [
      "credit.low", "credit.exhausted", "credit.granted",
      "action.approval_required", "action.approved", "action.rejected", "action.expired",
      "job.completed", "job.failed",
      "module.enabled", "module.disabled",
      "exception.created", "exception.resolved", "exception.sla_breached", "exception.agent_resolved"
    ],
    "business": [
      "deal.created", "deal.stage_changed", "deal.closed",
      "lp.created", "lp.stage_moved", "lp.signal_logged",
      "transaction.created", "transaction.task_completed", "transaction.closed",
      "capital_call.issued", "capital_call.paid",
      "covenant.breached", "alert.created",
      "room.created", "document.uploaded", "qa.answered",
      "order.created", "order.filled", "order.cancelled"
    ]
  },
  "auth": {
    "type": "bearer",
    "header": "Authorization: Bearer <key>",
    "key_format": "vdr_<random>",
    "obtain_at": "https://kela.com/admin/api-keys",
    "ephemeral_param": "?ephemeral=true (safe dry-run — no DB writes)"
  },
  "discovery_urls": {
    "mcp_json": "https://kela.com/.well-known/mcp.json",
    "tools_json": "https://kela.com/.well-known/tools.json",
    "llms_txt": "https://kela.com/llms.txt",
    "llms_full_txt": "https://kela.com/llms-full.txt",
    "openapi": "https://kela.com/api/openapi.json",
    "changelog": "https://kela.com/api/changelog.json",
    "module_guides": "https://kela.com/developers/modules/<module>"
  }
}
