Skip to content

sadpig70/SGL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SGL — Semantic & Governance Layer (Emergency Bridge MVP)

SGL — Semantic & Governance Layer: positioning, processing flow, and five invariants

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.

Design invariants (enforced by tests)

# 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

Processing flow (§3 SGL_Flow)

Ingest → Normalize → InferType → EstimateQuantity → Calibrate →
Govern → Draft → Approve(friction) → [Dispatch] → Audit

Modules

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

Usage

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 integrity

Tests

python -m pytest -q     # 55 passed

PGF artifacts: .pgf/DESIGN-SglEmergencyBridge.md, .pgf/WORKPLAN-SglEmergencyBridge.md, .pgf/status-SglEmergencyBridge.json.

Deliberately out of scope (§12.1)

  • 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

License

MIT — see LICENSE.

About

Semantic & Governance Layer for agent communication — a semantic + governance overlay on top of A2A/MCP that normalizes meaning, infers resource types, and enforces calibrated trust, approval, and audit. Emergency Bridge MVP (CAP to EDXL-RM).

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages