{
  "schema_version": "1.0",
  "baseline": "V4",
  "updated_at": "2026-04-22",
  "owner_session": "B",
  "phase": "Phase 12F — Source Mapping Engine (B-owned contract · A-owned runtime)",
  "purpose_th": "Rule book สำหรับ mapping source ที่ normalise แล้ว → KB node ปลายทาง (doc · service · journey · dashboard · case · living-city · lexicon · generated-asset). สืบทอด case_mapping_model 10 rule และเพิ่ม 8 rule ใหม่ของ 12F",
  "purpose_en": "Rule book for mapping normalised sources → KB target nodes (doc · service · journey · dashboard · case · living-city · lexicon · generated-asset). Inherits case_mapping_model's 10 rules and adds 8 new Phase 12F rules",
  "hard_rules": [
    "Every mapping attempt is a PROPOSAL not a fact · requires_human_review=true always",
    "Confidence floor 0.70 · below floor → not queued · logged as low-confidence",
    "Never remove source attribution on merge · contributed-by chain preserved",
    "No cross-tenant mapping proposals · tenant-scoped always",
    "AI-authored sources (T5) cannot propose promotions to T1..T3 · only T5→T4 path permitted",
    "Faithfulness floor from DOC-007 §7 (<0.70 regenerate · still <0.70 decline)"
  ],
  "inherited_rules_from_case_mapping_model": [
    "rule-report-to-actor","rule-loc-to-spatial","rule-issue-to-pattern","rule-case-to-service",
    "rule-case-to-signal","rule-case-to-dashboard","rule-case-to-journey","rule-case-to-living-city",
    "rule-case-to-source-provenance","rule-case-to-immune-step"
  ],
  "new_rules_12f": [
    {
      "id":"rule-source-to-truth-node",
      "purpose_th":"ให้ source ที่เข้ามาใหม่หา truth_tree node ที่สัมพันธ์กัน","purpose_en":"Match incoming source to a truth_tree node",
      "method":"semantic similarity + lexicon map + authority-tier check",
      "inputs":["normalised_chunk","truth_tree.nodes"],
      "outputs":["tt_node_id","confidence","mapping_reason"],
      "confidence_floor":0.70,
      "requires_human_review":true
    },
    {
      "id":"rule-source-to-lexicon",
      "purpose_th":"จับคู่ term ใหม่กับ lex-* ที่มีอยู่ · ถ้าไม่มี เสนอ lexicon-extension proposal","purpose_en":"Match terms to existing lex-* entries · if none, propose a lexicon extension",
      "method":"term extraction + disambiguation cluster check",
      "inputs":["normalised_chunk","lexicon.json","lexicon_disambiguation.json"],
      "outputs":["lex_id_or_proposal","ambiguity_status","proposed_alt_terms"],
      "confidence_floor":0.75,
      "requires_human_review":true
    },
    {
      "id":"rule-source-to-service",
      "purpose_th":"เสนอ SVC-* candidate · ถ้า service อยู่ใน services.json → reference · ถ้าไม่อยู่ · เสนอเป็น T5 proposed service ใน session_a_handoff","purpose_en":"Propose SVC-* candidate · if the service exists in services.json → reference · else propose as T5 proposed service in session_a_handoff",
      "method":"keyAction + outcome + surface match against services.json",
      "inputs":["normalised_chunk","services.json (A-owned read-only)"],
      "outputs":["svc_id_or_proposal","maturity_candidate","canonical_refs_candidate"],
      "confidence_floor":0.75,
      "requires_human_review":true,
      "honest_note":"B never writes services.json · proposal goes to session_a_handoff for A-owned channel"
    },
    {
      "id":"rule-source-to-journey",
      "purpose_th":"จับคู่ touchpoint / friction → stage ของ journey","purpose_en":"Match touchpoint / friction → journey stage",
      "method":"actor+action+outcome triple vs journeys.json stages",
      "inputs":["normalised_chunk","journeys.json"],
      "outputs":["journey_id","stage_id","confidence","mapping_reason"],
      "confidence_floor":0.70,
      "requires_human_review":true
    },
    {
      "id":"rule-source-to-dashboard",
      "purpose_th":"จับคู่ metric / signal → dashboard id","purpose_en":"Match metric / signal → dashboard id",
      "method":"metric name + dimension + unit match vs dashboard_contract.json",
      "inputs":["normalised_chunk","dashboard_contract.json"],
      "outputs":["dashboard_id","metric_slot","confidence"],
      "confidence_floor":0.70,
      "requires_human_review":true
    },
    {
      "id":"rule-source-to-case-type",
      "purpose_th":"classify เนื้อหาเป็น case_type ที่เหมาะ","purpose_en":"Classify content into appropriate case_type",
      "method":"pattern + severity + sensitive_surface signal vs case_schema.json",
      "inputs":["normalised_chunk","case_schema.json","case_portal.json"],
      "outputs":["case_type","default_alert_level","sensitive_surface_flag"],
      "confidence_floor":0.75,
      "requires_human_review":true
    },
    {
      "id":"rule-source-to-living-city",
      "purpose_th":"เสนอ organ / flow ที่สัมพันธ์","purpose_en":"Propose related organ / flow",
      "method":"metaphor match + organ responsibility + flow direction",
      "inputs":["normalised_chunk","living_city.json"],
      "outputs":["organ_id_or_flow_id","proposed_extension"],
      "confidence_floor":0.70,
      "requires_human_review":true
    },
    {
      "id":"rule-source-to-generated-asset",
      "purpose_th":"ลงทะเบียน artefact ที่เกิดใหม่ใน generated_assets · ตั้ง status ให้รีวิว","purpose_en":"Register a newly-created artefact in generated_assets · set review status for review",
      "method":"authoring_model + authoring_session + target_path + category inference",
      "inputs":["authored_file_path","authoring_context"],
      "outputs":["generated_assets_entry","review_status","initial_confidence"],
      "confidence_floor":0.0,
      "requires_human_review":true,
      "honest_note":"registry append is automatic · the artefact itself still requires human review before promotion"
    }
  ],
  "chunking_policy": {
    "target_size_tokens":[300,800],
    "chunk_overlap_tokens":50,
    "respect_structure":"headings + paragraphs + table rows · never split a table row across chunks",
    "language_split":"if chunk is mixed-language · tag both languages · split only when separate translation needed",
    "embedding_model":"voyage-3 (1024-dim) per CLAUDE.md tech stack"
  },
  "confidence_model": {
    "low":{"range":"0.00–0.49","treatment":"not queued · logged only · human may request re-run"},
    "medium":{"range":"0.50–0.69","treatment":"queued with low-priority · human may approve/reject"},
    "high":{"range":"0.70–0.89","treatment":"queued with normal priority · review required"},
    "very_high":{"range":"0.90–1.00","treatment":"queued with promote-candidate hint · review still required · never auto-promote"}
  },
  "heuristics_claude_derived": [
    {
      "id":"heur-same-fact-dedup",
      "rule":"Two chunks with >0.95 cosine similarity AND identical values on ≥3 of 5 structured fields (actor · action · outcome · location · time) → dedup candidate",
      "confidence":"medium",
      "requires_human_review":true,
      "honest_note":"Heuristic · tune after pilot data"
    },
    {
      "id":"heur-novelty-threshold",
      "rule":"Chunk with no match >0.50 to any existing node AND with extractable actor+action+outcome → novelty candidate for new lex-* or tt-* proposal",
      "confidence":"medium",
      "requires_human_review":true,
      "honest_note":"Heuristic · may generate false novelty when KB is thin in a domain"
    },
    {
      "id":"heur-sensitive-trigger",
      "rule":"Chunk containing any of {PDPA · biometric · financial · emotional · legal · sovereign} markers → sensitive_surface_flag=true regardless of similarity scores",
      "confidence":"high",
      "requires_human_review":true,
      "honest_note":"Sensitive trigger is intentionally conservative · false positives handled in review"
    }
  ],
  "telemetry_requirements": [
    "Per-stage latency · per-rule confidence distribution · per-tenant throughput",
    "Reviewer acceptance rate per rule · rejection reason histogram",
    "Faithfulness score distribution · regenerate count · decline count",
    "Novelty rate · dedup rate · conflict rate"
  ],
  "honest_note_th": "Source Mapping Engine rule book · ฝั่ง A ต้อง implement runtime ตาม · ทุก rule เป็น proposer ไม่ใช่ decider · human review คือ decider · heuristic ระบุชัดว่า claude-derived ต้อง tune หลัง pilot",
  "honest_note_en": "Source Mapping Engine rule book · A implements runtime against it · every rule is a proposer not a decider · human review is the decider · heuristics explicitly labelled claude-derived and tunable after pilot"
}
