Implementation of the Phase 1 MVP from the technical spec
docs/AI_Semantic_Interop_Layer_spec_v0.3.md.
Scope: CAP disaster alert → EDXL-RM resource-request type draft + governance.
SGL does not replace transport. On top of A2A/MCP it adds ① semantic normalization, ② type inference, and ③ enforced provenance, calibrated trust, approval, and audit — a semantic + governance overlay.
| # | Invariant | Source | Enforced in |
|---|---|---|---|
| 1 | type/quantity separation — AI infers resource types only; quantities are rule/human only | §5 | quantity.py (no AI_ functions, AST-verified) |
| 2 | raw source always retained | §4.1 | normalizer.py raw_source |
| 3 | uncalibrated confidence = null + forced approval | §6 | calibration.py ECE<0.05 |
| 4 | automation-bias-resistant friction | §8 | approval.py quantity gate / low-confidence lock / pace guard / abort asymmetry |
| 5 | audit integrity — append-only hash chain | §3,§14 | audit.py |
Ingest → Normalize → InferType → EstimateQuantity → Calibrate →
Govern → Draft → Approve(friction) → [Dispatch] → Audit
| File | Responsibility |
|---|---|
sgl/models.py |
Common semantic object + pipeline dataclasses |
sgl/adapters/cap.py |
CAP (dict/XML) parsing + signature/source verification |
sgl/normalizer.py |
AISIL normalization (CAP → SemanticObject) |
sgl/inference.py |
Type inference + relation inference (AI_ cognitive ops) |
sgl/quantity.py |
Quantity track — rule/human only (no standalone AI) |
sgl/calibration.py |
Isotonic (PAV) confidence calibration + ECE |
sgl/governance.py |
§8.1 approval policy guard |
sgl/drafter.py |
EDXL-RM draft (quantity locked) |
sgl/approval.py |
Friction-by-design approval UI logic |
sgl/sicp.py |
A2A payload SICP 0.3 block |
sgl/audit.py |
Immutable audit store |
sgl/pipeline.py |
run_bridge() orchestration |
from sgl import run_bridge
from sgl.models import GeoData, CalibrationSet
result = run_bridge(cap_dict_or_xml, calib_history=hist)
result.inferred.resource_types # ['search_and_rescue_team', ...] types only
result.inferred.quantities.status # 'pending_human_input' (when no data)
result.trust.type_inference_confidence # calibrated value or None
result.decision.disposition # 'require_authority' | 'block' | ...
result.draft # EDXL-RM draft (quantities locked)
result.sicp # A2A payload block
result.audit_valid # hash-chain integritypython -m pytest -q # 55 passedPGF artifacts: .pgf/DESIGN-SglEmergencyBridge.md, .pgf/WORKPLAN-SglEmergencyBridge.md,
.pgf/status-SglEmergencyBridge.json.
- Standalone AI estimation of resource quantities — risky, separate validation track
- Automatic execution of actual dispatch orders — human/authority approval required
- General multi-domain bridge — Phase 3, requires ontology governance first
MIT — see LICENSE.