Software Design Specification - Core Platform Thruway
Draft
Establishes the Semantic Observability Envelope for SEA-Forge™. This specification defines how semantic concepts, events, and execution contexts are mapped into standard observability signals (Traces, Logs, Metrics) while strictly enforcing privacy, cardinality limits, and anti-leakage constraints.
It bridges the gap between Semantic Concepts (what the business means) and Telemetry (what the system observes).
The “Envelope” is a standardized wrapper for all observability data emitted by the SEA™ Runtime.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"traceId": "12345...", // W3C Trace ID
"spanId": "abcde...", // W3C Span ID
"timestamp": "2025-10-27T...", // ISO-8601
"semanticContext": {
"domain": "Sales", // High-level domain
"concept": "OrderPlacement", // The semantic concept active
"regimeId": "regime:v1" // Invariant Regime ID (from SDS-019)
},
"provenance": {
"executor": "agent:shipping-optimizer-v2",
"trigger": "event:order-received"
},
"payloadMode": "full_fidelity", // or "aggregated"
"data": { ... } // Signal-specific payload
}
We rigorously partition data into Metrics, Logs, and Traces to balance cost, performance, and utility.
Purpose: Health, Trends, SLAs. Constraint: Strict High Cardinality Blocking.
| Field | Inclusion | Rule |
|---|---|---|
domain |
✅ Yes | Low cardinality grouping. |
concept |
✅ Yes | Key for “Business Activity Monitoring”. |
entityId |
❌ NO | Cardinality explosion risk. |
userId |
❌ NO | Privacy + Cardinality risk. |
errorType |
✅ Yes | Aggregate semantic error types (e.g., “PolicyViolation”). |
Cardinality Guardrail:
If concept cardinality > 1000 per hour, dynamic aggregation kicks in -> concept="other".
Purpose: Latency analysis, dependency graphing, root cause. Constraint: Flow Fidelity.
| Field | Inclusion | Rule |
|---|---|---|
entityId |
✅ Yes | Essential for correlating specific flows. |
decisionTree |
⚠️ Hash | If decision logic exposes strategy, use hash/ID only. |
causality |
✅ Yes | sea-caused-by links are primary. |
Purpose: Detailed debugging, audit, replay. Constraint: Volume Sampling & Privacy.
| Field | Inclusion | Rule |
|---|---|---|
payload |
✅ Yes | Full request/response (subject to PII scrubbing). |
stackTrace |
✅ Yes | Only on error. |
stateSnapshot |
⚠️ Mode Dependent | See “Payload Modes”. |
Provenance data (who did what based on reason) is highly sensitive in a semantic system as it reveals intent.
meta:sensitivity="high".Input -> Rule A -> Rule B -> Output.Input -> [PolicyHash:xyz] -> Output.The envelope supports two modes aligning with SDS-016 (Debt) and SDS-003 (KG).
full_fidelityEntity state before and after operation.aggregatedTranslation Loss vector (from SDS-019) is explicitly logged here to indicate what detail was dropped.Prevent observers from reconstructing sensitive behavior/data through telemetry patterns.
UserType=VIP because processing time is consistently 50ms faster (different code path).ms rounded to nearest 10ms or 100ms interval.A sidecar/middleware that:
meta:sensitivity.1
2
3
4
5
6
7
8
9
10
observability:
defaults:
mode: "aggregated"
sampling: 0.1 # 10%
overrides:
- context: "Finance.HighValueParams"
mode: "full_fidelity"
sampling: 1.0
retention: "audit_7yr"
sensitivity: "high" # Trigger hashing
To ensure full causality tracking across distributed boundaries (including non-HTTP transports like NATS), we enforce strict propagation rules.
| Header | Purpose | Format | OTel Mapping |
|---|---|---|---|
traceparent |
W3C Trace Context | 00-{traceId}-{spanId}-{flags} |
Automatically handled by OTel Propagators |
tracestate |
Vendor/System specific state | Key-value pairs | Automatically handled by OTel Propagators |
sea-correlation-id |
Business Transaction ID | UUID v7 | attributes.sea_correlation_id |
sea-causation-id |
Direct Causal Parent | UUID v7 | attributes.sea_causation_id |
Inbound Request:
sea-correlation-id is present, MUST use it as the Trace ID or link to it.sea-correlation-id.Domain Events:
correlation_id (from current context)causation_id (ID of the command/event that triggered this)Background Jobs:
sea-correlation-id.Added 2025-12-30: Defines the governance and performance signals required by
MetricIndexer(SDS-015) to compute pattern success rates forPatternOraclerecommendations.
These metrics are emitted by the runtime and ingested by MetricIndexer to compute pattern success_rate and combined_score:
| Metric Name | Type | Labels | Purpose | SDS Reference |
|---|---|---|---|---|
sea_pattern_invocation_total |
Counter | pattern_id, domain, outcome |
Total pattern uses by outcome (success/failure/timeout) | SDS-015 IndexTelemetry |
sea_pattern_latency_seconds |
Histogram | pattern_id, domain |
Execution latency distribution per pattern | SDS-015 RefreshStats |
sea_pattern_governance_score |
Gauge | pattern_id, domain, policy_id |
Governance compliance score (0-1) from policy evaluations | SDS-047 GovernedSpeed™ Governance Runtime |
sea_pattern_drift_psi |
Gauge | pattern_id, domain |
Population Stability Index detecting pattern drift | SDS-016 Drift Detection |
The PatternOracle computes combined_score from these signals:
1
2
3
4
5
6
7
8
9
10
combined_score = (
weight_similarity * semantic_similarity +
weight_performance * success_rate +
weight_governance * governance_score
)
where:
semantic_similarity = cosine_similarity(query_embedding, pattern_embedding)
success_rate = success_count / total_count (from sea_pattern_invocation_total)
governance_score = avg(sea_pattern_governance_score) per pattern_id
Default weights (configurable):
weight_similarity: 0.4weight_performance: 0.35weight_governance: 0.25Pattern-related telemetry MUST include these semantic context fields:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
"semanticContext": {
"domain": "semantic-core",
"concept": "PatternExecution",
"regimeId": "regime:pattern-oracle-v1"
},
"provenance": {
"executor": "agent:vibes-pro-generator",
"trigger": "event:generation-planning"
},
"patternContext": {
"pattern_id": "ifl:hash:abc123...",
"pattern_name": "hexagonal-adapter",
"pattern_version": "1.2.0",
"invocation_context": "code-generation"
}
}
Per SDS-015 Policy LocalFirstPrivacy:
ifl:hash identity tokens onlyAdd to OTel Collector configuration for pattern metrics routing:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Append to otel-collector-config.yaml
processors:
# Pattern metric enrichment
resource/patterns:
attributes:
- key: sea.concept
value: PatternExecution
action: insert
- key: sea.domain
value: semantic-core
action: insert
# Cardinality protection for pattern_id
groupbyattrs:
keys:
- pattern_id
- domain
- outcome
exporters:
# Route to MetricIndexer via OpenObserve
otlp/metric-indexer:
endpoint: ${OPENOBSERVE_ENDPOINT}
headers:
Authorization: ${OPENOBSERVE_TOKEN}
X-SEA-Routing: metric-indexer
service:
pipelines:
metrics/patterns:
receivers: [otlp]
processors: [batch, resource/patterns, groupbyattrs]
exporters: [otlp/metric-indexer, otlp/openobserve]
The IndexTelemetry flow (SDS-015) expects this event structure from GovernedSpeed™:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
interface PatternTelemetryEvent {
// Identity
pattern_id: string; // ifl:hash of the pattern
event_id: string; // UUID v7
correlation_id: string; // From sea-correlation-id header
// Metrics
outcome: 'success' | 'failure' | 'timeout';
latency_ms: number;
governance_score: number; // 0-1 from policy evaluation
// Temporal
timestamp: string; // ISO-8601
window_start: string; // Aggregation window start
window_end: string; // Aggregation window end
// Context
domain: string;
invocation_context: string;
}
| INV-ID | Invariant | Type | Enforcement |
|---|---|---|---|
| INV-OBS-06 | Pattern metrics MUST include pattern_id label |
System | OTel Collector processor validation |
| INV-OBS-07 | Governance scores MUST be [0,1] normalized | Semantic | Policy Gateway normalization |
| INV-OBS-08 | Pattern telemetry MUST respect LocalFirstPrivacy | Privacy | Collector PII scrubbing + no raw code |
<- Returns ` = `false` Updated: 2025-12-30 - Added Pattern Weighting Telemetry section (Plan P010 C1B) –>