a11oy · Governance Substrate · Doctrine v10

Substrate Inspector — @szl/substrate v0.2.0

Sovereign Execution Substrate — policy-shaped graphs, evidence-chained transitions, confidence-budget routing, and counterfactual replay for all SZL workflows.
Source: https://github.com/szl-holdings/platform/tree/main/packages/substrate · public package (private:false) · #2 — compile-time Kahn-sort approval-DAG (packages/substrate/src/compiler.ts).

Reason()Retrieve()ToolCall()Verify()Decide()ApprovalGate()
modes:livedry-runreplaycounterfactual

The moat in one line

The single, opinionated execution runtime every SZL product surface (Lyte · Aegis · Vessels · Terra · Counsel · Carlota Jo) calls the same way. defineWorkflow({stages, policy, budget})runtime.start(workflow, input, {mode})PipelineRun.

Innovation #2 — compile-time approval-DAG

compiler.ts runs a Kahn topological sort over the approval DAG at compile time and throws SubstrateCompilerError for cycles, orphan gates, or high-risk side-effects reachable without an ancestor ApprovalGate(). Topology-enforced, not runtime-checked. Tests: vitest — src/engine.test.ts · src/compiler.test.ts · src/workflows/phase2.test.ts.

Substrate packages (the moat)

@szl/substrate @szl/substrate-adapters@szl/substrate-client

Public API surface — core files

FilePurposeLOCExports
src/index.tsPublic package entry — re-exports every primitive, type, runtime, compiler, journal, telemetry & workflow symbol.332AdvisorMatch, AegisThreatTriageInput, AegisThreatTriageResult, AnomalyFinding, AnyStage, ApprovalGate, BriefSection, CarlotaJoTaskRoutingInput…
src/types.tsCore TypeScript interfaces + Zod schemas: ExecutionMode, SideEffectCategory, 7 StageTypes, WorkflowDefinition, PipelineRun, EvidenceBundle.559AnyStage, AnyStageSchema, ApprovalGate, ApprovalGateSchema, BaseStage, CompiledGraph, CompiledStageNode, ConfidenceBudget…
src/stage-primitives.tsFive stage primitive factories — Reason() · Retrieve() · ToolCall() · Verify() · Decide() — plus ApprovalGate(), definePolicy(), defineBudget().161ApprovalGate, Decide, Reason, Retrieve, ToolCall, Verify, defineBudget, definePolicy
src/compiler.tsInnovation #2 — compile-time Kahn topological sort over the approval DAG; throws SubstrateCompilerError for cycles, orphan gates, or high-risk side-effects reachable without an ancestor ApprovalGate. Topology-enforced, not runtime-checked.276SubstrateCompilerError, compile
src/engine.tsSubstrateRuntime: start(workflow, input, {mode}) → PipelineRun. Workflow registry (register/lookup/list/clear), defaultRuntime singleton.1105SubstrateRuntime, SubstrateRuntimeOptions, clearWorkflowRegistry, defaultRuntime, listWorkflows, lookupWorkflow, registerWorkflow
src/journal.tsEvidence-chained journal: computeBundleHash, hashValue, sign/verify bundle signatures, SubstrateJournal store, runtime event bus.540JournalStore, RunStore, SubstrateJournal, SubstrateRuntimeEvent, SubstrateRuntimeEventType, computeBundleHash, defaultJournal, defaultJournalStore…
src/budget-router.tsConfidence-budget routing — routeByBudget, aggregatePipelineConfidence, validateFinalConfidence (escalate when budget exceeded).110RoutingDecision, aggregatePipelineConfidence, routeByBudget, validateFinalConfidence
src/adapters.tsAdapter registries (model/policy/resource/retriever/tool) + wirePolicyEngineAdapter / wireToolMeshAdapter bridges to platform packages.494McpCapabilitySpec, McpToolCall, McpToolDefinition, McpToolResult, ModelAdapter, ModelAdapterInput, ModelAdapterOutput, PolicyAdapter…
src/telemetry.tsOpenTelemetry spans: SubstrateTelemetry, getMetrics, getRecentSpans, getRunSpans (SubstrateSpan).279SubstrateSpan, SubstrateTelemetry, getMetrics, getRecentSpans, getRunSpans
src/python-worker.tsBridge to services/substrate-py-workers — protocol messages (claim/result/error/heartbeat/register), PYTHON_WORKER_PROTOCOL_VERSION.386PYTHON_WORKER_PROTOCOL_VERSION, PythonWorkerBaseMessage, PythonWorkerChannel, PythonWorkerMessage, PythonWorkerMessageType, RegisteredWorker, StageClaimMessage, StageErrorMessage…
src/cli/bin.ts`substrate` CLI binary entrypoint.80
src/cli/replay.tsReplay & counterfactual — replay(), handleReplayRequest, resolvePolicyProfileById, formatDiff (deterministic re-execution of a recorded run).312PolicyNotFoundError, ReplayEndpointRequest, ReplayEndpointResponse, ReplayOptions, ReplayResult, formatDiff, handleReplayRequest, replay…

Reference + vertical workflow packs

WorkflowPurposeExports
opportunity-audit.tsPhase-1 reference workflow — anomaly→remediation opportunity audit (Lyte retriever).AnomalyFinding, OpportunityAuditInput, OpportunityAuditResult, RemediationDecision, isLyteRetrieverRegistered, opportunityAuditWorkflow
cross-system-reconciliation.tsReconcile discrepancies across systems → reconciliation decision.CrossSystemReconciliationInput, CrossSystemReconciliationResult, ReconciliationDecision, ReconciliationDiscrepancy, crossSystemReconciliationWorkflow, runCrossSystemReconciliation
evidence-based-recommendation.tsEvidence-cited recommendation decision packet.EvidenceBasedRecommendationInput, EvidenceBasedRecommendationResult, EvidenceCitation, RecommendationDecisionPacket, evidenceBasedRecommendationWorkflow, runEvidenceBasedRecommendation
executive-brief.tsMulti-section executive brief generation.BriefSection, ExecutiveBriefInput, ExecutiveBriefOutput, ExecutiveBriefResult, executiveBriefWorkflow, runExecutiveBrief
risk-escalation.tsRisk-signal summary → escalation decision.RiskEscalationDecision, RiskEscalationInput, RiskEscalationResult, RiskSignalSummary, riskEscalationWorkflow, runRiskEscalation
aegis-threat-triage.tsAegis vertical pack — threat triage decision.AegisThreatTriageInput, AegisThreatTriageResult, ThreatTriageDecision, TriagedThreat, aegisThreatTriageWorkflow, runAegisThreatTriage
carlota-jo-task-routing.tsCarlota Jo vertical pack — advisor-match task routing.AdvisorMatch, CarlotaJoTaskRoutingInput, CarlotaJoTaskRoutingResult, TaskRoutingDecision, carlotaJoTaskRoutingWorkflow, runCarlotaJoTaskRouting
lyte-operational-drift.tsLyte vertical pack — operational drift detection decision.DriftItem, LyteOperationalDriftInput, LyteOperationalDriftResult, OperationalDriftDecision, lyteOperationalDriftWorkflow, runLyteOperationalDrift
prism-counsel-evidence-packaging.tsPrism Counsel vertical pack — legal evidence packaging + matter deadlines.EvidencePackage, MatterDeadline, PrismCounselDecision, PrismCounselEvidencePackagingInput, PrismCounselEvidencePackagingResult, prismCounselEvidencePackagingWorkflow
terra-portfolio-anomaly.tsTerra vertical pack — portfolio anomaly decision.PortfolioAnomaly, PortfolioAnomalyDecision, TerraPortfolioAnomalyInput, TerraPortfolioAnomalyResult, runTerraPortfolioAnomaly, terraPortfolioAnomalyWorkflow
vessels-voyage-anomaly.tsVessels vertical pack — voyage anomaly decision.VesselsVoyageAnomalyInput, VesselsVoyageAnomalyResult, VoyageAnomaly, VoyageAnomalyDecision, runVesselsVoyageAnomaly, vesselsVoyageAnomalyWorkflow
index.tsDemo seed inputs for the reference workflows.ALL_WORKFLOW_SEEDS, WorkflowSeedKey, aegisThreatTriageSeed, carlotaJoTaskRoutingSeed, crossSystemReconciliationSeed, evidenceBasedRecommendationSeed

Subpath exports (package.json)

../adapters./budget-router./compiler./engine./journal./python-worker./telemetry./types./workflows/aegis-threat-triage./workflows/carlota-jo-task-routing./workflows/cross-system-reconciliation./workflows/evidence-based-recommendation./workflows/executive-brief./workflows/lyte-operational-drift./workflows/opportunity-audit./workflows/prism-counsel-evidence-packaging./workflows/risk-escalation./workflows/seeds./workflows/terra-portfolio-anomaly./workflows/vessels-voyage-anomaly
What is honest right now. This page reads the real packages/substrate/ source in szl-holdings/platform and lists every public file, its purpose, and its exported symbols. The substrate is real code (compiler + engine + journal + budget-router + 11 workflow packs). It is shipped here as an inspector / documentation surface — the live TypeScript runtime executes inside the platform monorepo (and the substrate-py-workers GPU fleet), not inside this static HF Space. The side-effect categories enforced by the compiler are: read-only, write-internal, write-external, financial, notification, deletion, escalation, infrastructure.