Software Design Specification (SDS)
Proposed
This specification details the technical integration of GovernedSpeed™ services into the SEA-Forge™ runtime. It maps SEA-DSL Governance entities to GovernedSpeed™ configuration and defines the deployment topology for the Policy Gateway and Risk & Evidence Service.
@namespace "system.sea.governance"
@version "1.0.0"
// ENTITIES: Map to GovernedSpeed™ implementations
Entity "PolicyGateway" in system.sea.governance
@rationale "Implemented by GovernedSpeed™ apps/policy-gateway"
@implementation "policy_gateway.application.services.PolicyDecisionService"
Entity "EvidenceLedger" in system.sea.governance
@rationale "Implemented by GovernedSpeed™ apps/risk-evidence-service"
@implementation "risk_evidence.domain.models.GovernanceEvent"
Entity "PolicyCompiler" in system.sea.governance
@rationale "Compiles SEA-DSL policies to GovernedSpeed™ YAML"
@implementation "tools/sea-compiler/plugins/gov_compiler.py"
// RESOURCES
Resource "GovernedSpeed™Config" in system.sea.governance
@rationale "The runtime configuration file (adr-006.yaml)"
@format "yaml"
// FLOWS
Flow "EnforceRequest" from "AI-Agent" to "PolicyGateway"
@rationale "Intercepts LLM requests for policy validation"
@cqrs { "kind": "command", "synchronous": true }
Flow "LogDecision" from "PolicyGateway" to "EvidenceLedger"
@rationale "Asynchronously logs decision evidence"
@cqrs { "kind": "event", "outbox": "required" }
Flow "CompilePolicy" from "SEACore" to "GovernedSpeed™Config"
@rationale "Transforms semantic policy definitions to runtime config"
@cqrs { "kind": "command" }
apps/policy-gateway)Role: The primary enforcement point.
Configuration Mapping:
PAC_CONFIG: Path to the compiled adr-006.embedded-governance.yaml.PAC_LLM_PROVIDER: litellm or http (default).Deployment:
uvicorn on port 8081.Interface:
POST /proxy/completion: OpenAI-compatible endpoint that wraps filter/prompt and filter/output checks.apps/risk-evidence-service)Role: The immutable audit log.
Storage Backend:
Schema (SDS-001):
governance_event, risk_snapshot, incident tables as defined in GovernedSpeed™ SDS-001.tools/sea-compiler)Role: Translates human-authored SEA-DSL into machine-executable YAML.
Transformation Logic:
Policy entity.thresholds (Quality, Fairness, Safety).rules (Conditionals, Actions).roles to owners.adr-006.embedded-governance.yaml.Example Mapping:
SEA-DSL:
Policy "NoPII" per Obligation priority 10
as: context.contains_pii == true implies action.block()
GovernedSpeed™ YAML:
1
2
3
4
rules:
- id: "NoPII"
when: "context.contains_pii == true"
action: "block"
specs/governance.sea.just gov-compile -> Generates libs/governance/policies/active.yaml.just gov-start -> Starts Policy Gateway with new config.localhost:8081.just gov-ci-check.active.yaml.libs/governance/policies into SEA-DSL format.AI-Agent clients to point to Policy Gateway URL instead of direct LLM URL.[!NOTE] SDS-047 (Policy Gateway) and SDS-047 (Risk & Evidence) have been superseded by the unified SDS-047.