{
  "schema_version": "1.0",
  "baseline": "V4",
  "updated_at": "2026-04-22",
  "owner_session": "B",
  "phase": "Phase 12F — Enterprise Upload model (B-owned contract · A-owned runtime)",
  "purpose_th": "Enterprise Upload model — Enterprise tenant อัปโหลด source bundle (โฟลเดอร์/ไฟล์/ลิงก์/AI-draft) → normalise → detect conflict → request approval → map เข้า tenant KB. ทำงานคู่กับ hybrid_intake_workspace.json · multi_source_intake.json · source_mapping_engine.json · tenant_scope.json",
  "purpose_en": "Enterprise Upload model — an Enterprise tenant uploads a source bundle (folders/files/links/AI drafts) → system normalises → detects conflicts → asks for approval → maps into the tenant KB. Works with hybrid_intake_workspace.json · multi_source_intake.json · source_mapping_engine.json · tenant_scope.json",
  "hard_rules": [
    "T1..T5 authority tier assigned at upload time · never flipped silently",
    "Folder structure treated as a bundle · never collapsed onto canonical tree without explicit mapping step",
    "Same-tier disagreements NEVER auto-merge · always escalate to human review",
    "AI-generated material enters at T5 regardless of bundle size or source framing",
    "Sensitive-surface content (PDPA · biometric · financial · emotional · legal · sovereign-data) requires dual approval before any promotion",
    "Every mapped node preserves 'contributed-by' chain · original source attribution never deleted",
    "Tenant KB is the tenant's own KB — never writes back to platform canonical (T1/T2)",
    "No auto-publish · tenant admin action required for every publish transition",
    "Every AI suggestion during intake carries requires_human_review=true + confidence + source_basis"
  ],
  "b_owned_vs_a_owned": {
    "b_owned_th":"B เป็นเจ้าของ: intake contract · authority-tier assignment rules · conflict-detection rules · comparison-matrix shape · approval-gate definitions · mapping-engine rules · honest_note · trilingual labels",
    "b_owned_en":"B owns: intake contract · authority-tier rules · conflict-detection rules · comparison-matrix shape · approval-gate definitions · mapping-engine rules · honest_note · trilingual labels",
    "a_owned_th":"A เป็นเจ้าของ: upload runtime · folder/file scanner · OCR · PDF parse · URL scraper · AI summarise engine · tenant KB persistence · feature-flag registry · analytics · rate-limit",
    "a_owned_en":"A owns: upload runtime · folder/file scanner · OCR · PDF parse · URL scraper · AI summariser · tenant KB persistence · feature-flag registry · analytics · rate-limit"
  },
  "source_origins": [
    {"id":"origin-internal-founder","tier_default":"T1","name_th":"เอกสารผู้ก่อตั้ง/ผู้บริหารของ tenant","name_en":"Tenant-internal founder/exec doc","examples":"founder memo · founding deck","review":"founder"},
    {"id":"origin-internal-canonical","tier_default":"T2","name_th":"canonical/spec ภายใน tenant","name_en":"Tenant-internal canonical/spec","examples":"tenant DOC-* · policy · SOP","review":"governance"},
    {"id":"origin-internal-concept","tier_default":"T3","name_th":"concept/derived ภายใน tenant","name_en":"Tenant-internal concept/derived","examples":"CONCEPT-* · DERIVED-* · revision log","review":"governance"},
    {"id":"origin-internal-system","tier_default":"T4","name_th":"ผลผลิตระบบของ tenant","name_en":"Tenant system output","examples":"nerve outputs · brainstorm artefacts · audit logs","review":"peer"},
    {"id":"origin-external-legacy-wiki","tier_default":"T3-or-T4","name_th":"wiki/CMS เดิม","name_en":"Legacy wiki / CMS export","examples":"Confluence · Notion · Google Sites","review":"peer-then-governance-for-promotion"},
    {"id":"origin-external-partner-doc","tier_default":"T3","name_th":"เอกสารจาก partner","name_en":"Partner-supplied document","examples":"contract · MOU · API spec","review":"governance"},
    {"id":"origin-external-regulator","tier_default":"T2-if-policy","name_th":"เอกสารจาก regulator","name_en":"Regulatory document","examples":"PDPA notice · tax code · licensing rule","review":"governance"},
    {"id":"origin-external-press","tier_default":"T4","name_th":"บทความข่าว/PR","name_en":"Press / PR article","examples":"news article · press release","review":"peer"},
    {"id":"origin-ai-chatgpt","tier_default":"T5","name_th":"ร่างจาก ChatGPT","name_en":"ChatGPT-authored draft","examples":"memo drafted by GPT · GPT summary","review":"governance-before-any-promotion"},
    {"id":"origin-ai-claude","tier_default":"T5","name_th":"ร่างจาก Claude","name_en":"Claude-authored draft","examples":"concept draft · mapping proposal","review":"governance-before-any-promotion"},
    {"id":"origin-ai-gemini","tier_default":"T5","name_th":"ร่างจาก Gemini","name_en":"Gemini-authored draft","examples":"summary · plan","review":"governance-before-any-promotion"},
    {"id":"origin-ai-perplexity","tier_default":"T5","name_th":"ร่างจาก Perplexity","name_en":"Perplexity-authored draft","examples":"research summary","review":"governance-before-any-promotion"},
    {"id":"origin-ai-mixed","tier_default":"T5","name_th":"ร่างที่เกิดจาก AI หลายตัวผสม","name_en":"Mixed AI-authored bundle","examples":"pipeline output · multi-model summary","review":"governance-before-any-promotion"}
  ],
  "unit_modes": [
    {
      "id":"unit-single-file",
      "label_th":"ไฟล์เดี่ยว",
      "label_en":"Single file",
      "label_zh":"单文件",
      "rule_th":"ไฟล์เดียวเป็นหน่วย atomic · ผู้อัปโหลดกำหนด tier + origin ตอนอัปโหลด · ไม่มี nesting โดยนัย",
      "rule_en":"File is atomic · uploader assigns tier + origin at upload · no implicit nesting",
      "allowed_types":["pdf","docx","doc","txt","md","json","csv","png","jpg","webp","url"]
    },
    {
      "id":"unit-folder",
      "label_th":"โฟลเดอร์",
      "label_en":"Folder",
      "label_zh":"文件夹",
      "rule_th":"โฟลเดอร์เป็น bundle · แต่ละไฟล์ภายในยังถือ tier ของตัวเอง · โฟลเดอร์มี metadata เสริมได้ แต่ไม่ override ไฟล์",
      "rule_en":"Folder is a bundle · each file inside keeps its own tier · folder metadata is optional and never overrides a file's tier",
      "nested_folder_rule":"Nested folders flattened to canonical hierarchy with cross-reference preserved (per source_taxonomy hierarchy_rules)",
      "max_files":2000,
      "max_total_size_mb":2048
    },
    {
      "id":"unit-link",
      "label_th":"ลิงก์ URL",
      "label_en":"URL link",
      "label_zh":"URL 链接",
      "rule_th":"URL ถูก fetch โดย A-owned runtime · เนื้อหาถูกเก็บเป็น snapshot พร้อมวันที่ fetch · tier = origin default",
      "rule_en":"URL fetched by A-owned runtime · content stored as dated snapshot · tier = origin default"
    },
    {
      "id":"unit-ai-bundle",
      "label_th":"ชุดร่างจาก AI",
      "label_en":"AI-generated bundle",
      "label_zh":"AI 生成的包",
      "rule_th":"AI bundle เข้าที่ T5 เสมอ · ไม่ว่าใหญ่แค่ไหน · ต้องมี 'authoring_model' + 'authoring_session' declared",
      "rule_en":"AI bundle always enters T5 regardless of size · must declare authoring_model + authoring_session"
    }
  ],
  "coverage_scoring": {
    "description_th":"ให้คะแนน tenant KB หลัง intake · ตอบว่า 'tenant KB ครบพอจะเปิด Nerve instance หรือยัง'",
    "description_en":"Scores a tenant KB after intake · answers 'is this tenant KB complete enough to instantiate a Nerve instance'",
    "dimensions":[
      {"id":"cov-founder","weight":0.25,"check":"Has at least one T1 founder/exec source"},
      {"id":"cov-canonical","weight":0.25,"check":"Has at least 3 T2 canonical/spec docs"},
      {"id":"cov-governance","weight":0.15,"check":"Has PDPA + lifecycle + classification equivalents declared"},
      {"id":"cov-services","weight":0.15,"check":"Has ≥5 service definitions mapped"},
      {"id":"cov-actors","weight":0.10,"check":"Has ≥3 actor journeys declared"},
      {"id":"cov-dashboard","weight":0.10,"check":"Has ≥3 dashboard contracts declared"}
    ],
    "thresholds":{
      "minimum_for_draft":0.40,
      "minimum_for_pilot":0.65,
      "minimum_for_go_live":0.85
    },
    "honest_note":"Weights are Claude-proposed · tenant admin may tune weights per their governance board. Thresholds not sealed until DEC."
  },
  "conflict_resolution": {
    "detection":[
      "Exact-text match across different tiers → same-fact-flag",
      "Same field with different values → contradiction-flag",
      "AI-claimed fact vs human-authored fact → AI-vs-human flag",
      "Same-tier mutually-exclusive claims → same-tier-disagreement flag"
    ],
    "resolution_rules":[
      "Cross-tier contradiction → higher tier wins on the disputed field; lower tier view preserved as 'alternative'",
      "Same-tier disagreement → escalate to human review · no auto-merge",
      "AI-vs-human → human wins on the disputed field · AI view parked as proposal",
      "Every resolution event is logged in a conflict-ledger with resolver + timestamp + rationale"
    ],
    "comparison_matrix": {
      "shape":"rows = candidate sources · columns = disputed fields · each cell shows source value + tier badge + confidence + last-edit",
      "purpose_th":"ให้ผู้ review เห็นทุก source ที่เกี่ยวข้องพร้อมกันเพื่อตัดสิน",
      "purpose_en":"Lets the reviewer see every candidate source side-by-side before deciding"
    }
  },
  "review_gates": [
    {"id":"gate-upload-tier","at":"upload-time","who":"uploader","action":"assign tier + origin per unit","fallback":"unit flagged as 'tier-unassigned' and blocked until assigned"},
    {"id":"gate-pii-scan","at":"post-upload","who":"A-owned runtime","action":"scan for PII + sensitive markers","fallback":"if PII found without tenant admin consent → quarantine unit"},
    {"id":"gate-conflict","at":"post-normalise","who":"tenant admin + domain lead","action":"resolve conflicts flagged by the matrix","fallback":"tenant KB cannot promote above draft while conflicts remain"},
    {"id":"gate-promotion","at":"promote-to-tenant-canonical","who":"tenant admin + tenant DPO","action":"dual approval per sensitive-surface rule","fallback":"unit parked at T5 · cannot exert authority"},
    {"id":"gate-go-live","at":"tenant-publish","who":"tenant admin + founder sign-off + platform governance","action":"triple approval for first go-live · dual thereafter","fallback":"tenant remains in pilot mode"}
  ],
  "tenant_ownership": {
    "visibility_default":"tenant-only",
    "share_scopes":["tenant-only","tenant-group","marketplace-candidate","platform-global-proposal"],
    "share_requirements":{
      "tenant-group":"tenant admin + group-admin approval",
      "marketplace-candidate":"tenant admin + platform governance + sensitivity check",
      "platform-global-proposal":"tenant admin + platform governance + DEC + no PII residue"
    },
    "never_shares":[
      "raw uploaded files (only normalised nodes can be shared)",
      "PII-bearing nodes (only after irreversible hash/fuzz)",
      "unresolved-conflict artefacts"
    ]
  },
  "shareability_and_resellability": {
    "reusable_template_rule":"A tenant may mark a normalised pattern (e.g. merchant onboarding flow · case schema tenant variant) as reusable_template=true · this advertises it into marketplace_candidate queue · platform governance decides",
    "resellability_rule":"Patterns originating from T1 founder source of another tenant cannot be resold without that tenant's explicit licence · platform does not broker",
    "marketplace_readiness_checks":[
      "No PII residue",
      "Source provenance chain complete",
      "Sensitive-surface flag cleared or explicitly dual-approved",
      "Tenant admin explicitly marks as marketplace_ready=true"
    ],
    "honest_note":"Marketplace = platform-wide pattern exchange. It does NOT run payments or contracts — platform only publishes the pattern metadata. Payment/contract is out of 12F scope."
  },
  "honest_note_th": "Enterprise Upload contract เท่านั้น · A implement runtime. Folder-as-unit + single-file-as-unit + URL + AI bundle ทั้ง 4 mode รองรับ · ทุก AI bundle เข้า T5 เสมอ · conflict-resolution comparison matrix ให้ human review ตัดสินเสมอ · ไม่มี auto-merge · sensitive-surface บังคับ dual approval · tenant KB ไม่เคย write กลับ platform canonical",
  "honest_note_en": "Enterprise Upload contract only · A implements runtime. Folder-as-unit + single-file-as-unit + URL + AI bundle supported · every AI bundle enters at T5 · conflict resolution via comparison matrix + human review · no auto-merge · sensitive-surface requires dual approval · tenant KB never writes back to platform canonical"
}
