5.7 KiB
Contracts and Schema Blueprint_ Founder CRM and Platform Planning
Date: 2026-04-18
Status: Draft
Owner: Sagnik
Reviewers: Sayan, Sourik
Scope: Canonical artifact contracts for client graph, imports, interactions, writebacks, and approvals
Purpose: Define the internal artifact contracts, schema boundaries, versioning rules, and validation strategy for the founder-side CRM and platform model.
Decision Boundary: This document defines target contracts. It does not itself create runtime validators or database migrations.
1. Purpose
This contract system exists to stop Project Velocity from passing loosely structured lead and interaction data between subsystems with no canonical artifact shape.
2. Contract Design Principles
- preserve raw evidence and normalized projections separately
- make producer and consumer ownership explicit
- version artifacts from the start
- keep provenance and confidence attached to inferred data
- require approval-aware contracts for destructive or merging operations
3. Canonical Artifact Set
RawImportBatchImportRowRecordImportMappingManifestNormalizedEntityProposalClientGraphDeltaInteractionBundleTranscriptBundleQdSignalBundleOracleWritebackProposalApprovalDecisionClient360Snapshot
4. Schema Rules
Required metadata for every artifact:
artifact_idartifact_typeschema_versionsource_systemcreated_atcreated_byconfidenceprovenance
Versioning model:
- semantic schema version per artifact family
- additive evolution preferred
- breaking changes require a new version and explicit reader mapping
5. Artifact Definitions
RawImportBatch
- purpose: preserve the uploaded import exactly as received
- required fields:
batch_idsource_systemuploaded_filenamemime_typestorage_refrow_countuploaded_by
- validation rules:
- immutable after upload
ImportMappingManifest
- purpose: define how source columns map to canonical fields
- required fields:
manifest_idbatch_idsource_profilecolumn_mappingsunmapped_columnsresolver_notes
- validation rules:
- every imported column is either mapped, ignored, or unresolved
NormalizedEntityProposal
- purpose: represent AI-assisted structured projections before approval
- required fields:
proposal_idbatch_identity_typecanonical_payloadconfidencemerge_candidate_refsreview_required
- validation rules:
- cannot become committed data without an approval or low-risk auto rule
InteractionBundle
- purpose: capture messages, calls, visits, and related communication artifacts for one interaction thread or event cluster
- required fields:
bundle_idclient_refchannelevent_refsattachmentssummary
- validation rules:
- must preserve raw event refs even when summarized
TranscriptBundle
- purpose: group transcripts, speaker segmentation, timing metadata, and related media refs
- required fields:
transcript_idinteraction_refmedia_refspeaker_segmentslanguagetext
- validation rules:
- speaker segmentation and timing metadata are first-class, not comments
QdSignalBundle
- purpose: package QD-relevant signals and time-series projections
- required fields:
signal_idclient_refsource_refscore_typevaluetime_windowsupporting_evidence_refs
- validation rules:
- every score must point back to evidence refs or explicit operator input
OracleWritebackProposal
- purpose: capture an AI-suggested change from Oracle or NemoClaw before commit
- required fields:
proposal_idtarget_domaintarget_entity_refproposed_changereasoning_summaryevidence_refsapproval_required
- validation rules:
- writeback proposals never masquerade as committed state
ApprovalDecision
- purpose: represent explicit human review outcome
- required fields:
decision_idproposal_refreviewer_refdecisiondecision_notesdecided_at
- validation rules:
- immutable audit record
Client360Snapshot
- purpose: provide a stable read model for UI and Oracle
- required fields:
client_refidentityaccount_linksactive_opportunitiesrecent_interactionsproperty_intereststasksqd_overviewrisk_flags
- validation rules:
- derived snapshot; never the sole source of truth
6. Storage Mapping
- raw batches and raw rows map to raw import storage plus structured index tables
- normalized proposals map to workflow/governance tables
- client graph deltas map to canonical domains
- interaction and transcript bundles map to
intel_* - snapshots map to materialized read models or service aggregation outputs
7. Validation Strategy
Service layer:
- validate schema presence and required metadata
Root layer:
- validate auth, ownership, and approval gates
Persistence layer:
- validate referential integrity and lifecycle rules
8. Compatibility Strategy
- additive extensions preferred
- preserve readers for older import manifests during transition
- all schema migrations should be tied to explicit artifact version upgrades
9. Implementation Order
- raw import and mapping artifacts
- normalized proposals
- writeback and approval artifacts
- interaction and transcript bundles
- client 360 snapshot contracts
10. Bottom Line
Without stable artifact contracts, the future CRM/client-graph implementation will drift again. These contracts are the minimum spine required to keep AI, UI, and persistence working against the same truth.