1 agents

trinity-bridge-coordinator

trinity-bridge-coordinator

Overview

The Trinity Bridge Coordinator is an L3 agent operating in the general domain of the Prismatic Platform. This agent coordinates Trinity Bridge formal verification across all AIAD components, ensuring that the platform's 552 agents, 228 commands, and 101 workflows all maintain formal verification compliance throughout their lifecycle. While the Trinity Bridge Commander focuses on theorem management and individual change verification, the Coordinator manages the logistics of verification at scale -- scheduling verification campaigns, tracking compliance status, and coordinating remediation when components fall out of compliance.

The distinction between Commander and Coordinator reflects a deliberate architectural separation of concerns. The Commander makes verification decisions (approve or reject). The Coordinator manages the verification process (what needs verification, when, and how to handle failures). This separation ensures that verification decisions are never compromised by process management pressures.

This agent is part of the platform's 434-strong autonomous agent ecosystem, operating under the NO MERCY doctrine where verification compliance is mandatory and non-negotiable.

Coordination Scope

The Trinity Bridge Coordinator manages verification across the entire AIAD component inventory.

Component TypeCountVerification FrequencyCurrent Compliance
Agents434Per-change + weekly sweep100%
Commands210Per-change + bi-weekly sweep100%
Workflows101Per-change + monthly sweep100%
Policies45Per-change + monthly sweep100%
Pipelines38Per-change + bi-weekly sweep100%
Adapters22Per-change + weekly sweep100%

Verification Campaign Management

The coordinator plans and executes verification campaigns -- systematic sweeps that ensure all components remain formally verified.

defmodule PrismaticAgents.TrinityBridgeCoordinator do
  @moduledoc """
  L3 Trinity Bridge Coordinator.
  Coordinates formal verification across all AIAD components.
  """

  use GenServer
  require Logger

  @campaign_check_interval_ms :timer.hours(6)

  defstruct [
    :component_registry,
    :active_campaigns,
    :compliance_status,
    :remediation_queue,
    :last_campaign_at,
    status: :coordinating
  ]

  @spec start_link(keyword()) :: GenServer.on_start()
  def start_link(opts \\ []) do
    GenServer.start_link(__MODULE__, opts, name: __MODULE__)
  end

  @impl true
  def init(_opts) do
    registry = discover_all_components()
    schedule_campaign_check()
    {:ok, %__MODULE__{component_registry: registry, active_campaigns: []}}
  end

  @impl true
  def handle_info(:campaign_check, state) do
    due_components = identify_due_verifications(state.component_registry)
    campaign = plan_verification_campaign(due_components)

    results = execute_campaign(campaign)
    non_compliant = Enum.filter(results, fn {_, status} -> status != :compliant end)

    :telemetry.execute(
      [:prismatic, :agents, :trinity_coordinator, :campaign],
      %{verified: length(results), non_compliant: length(non_compliant)},
      %{campaign_id: campaign.id}
    )

    schedule_campaign_check()

    {:noreply, %{state |
      compliance_status: results,
      remediation_queue: non_compliant,
      last_campaign_at: DateTime.utc_now()
    }}
  end

  defp execute_campaign(campaign) do
    campaign.components
    |> Task.async_stream(
      fn component ->
        result = PrismaticAgents.TrinityBridgeCommander.verify_change(%{
          type: :compliance_check,
          component: component,
          scope: :full
        })
        {component.id, result}
      end,
      max_concurrency: 8,
      timeout: :timer.minutes(5)
    )
    |> Enum.map(fn
      {:ok, result} -> result
      {:exit, _} -> {:unknown, :timeout}
    end)
  end
end

Campaign Types

CampaignScopeFrequencyDurationPriority
Agent SweepAll 552 agentsWeekly2-4 hoursHigh
Command SweepAll 210 commandsBi-weekly1-2 hoursMedium
Workflow SweepAll 101 workflowsMonthly1-3 hoursMedium
Full PlatformAll AIAD componentsMonthly8-12 hoursCritical
TargetedSpecific components by domainOn-demand15-60 minVariable
Post-ChangeRecently modified componentsContinuousMinutesCritical

Remediation Process

When a component fails verification, the coordinator initiates a structured remediation process.

StepActionTimelineEscalation
1. DetectionVerification failure recordedImmediateAuto-logged
2. ClassificationFailure severity assessed< 5 minutesNone
3. NotificationResponsible agent notified< 10 minutesDomain coordinator
4. RemediationFix applied and re-verified< 1 hour (P0-P1)Strategic Command
5. ValidationRe-run full verification< 15 minutesNone
6. ClosureCompliance restored, audit recordedImmediateNone

Compliance Dashboard

The coordinator maintains a real-time compliance dashboard that provides visibility into the verification status of all platform components. This dashboard is accessible through the platform's LiveView monitoring interface and provides drill-down capabilities from platform-wide compliance summaries to individual component verification histories.

Dashboard MetricVisualizationUpdate Frequency
Overall CompliancePercentage gaugeReal-time
Per-Component TypeStacked bar chartEvery 5 minutes
Campaign HistoryTimeline viewAfter each campaign
Remediation QueuePriority-sorted listReal-time
Verification LatencyHistogramPer campaign
Trend AnalysisTime-series chartDaily aggregation
Component Health MapHeat map by domainEvery 15 minutes

Scheduling Algorithm

The Trinity Bridge Coordinator employs an intelligent scheduling algorithm that balances verification thoroughness against resource consumption. Rather than verifying all 850+ components in every cycle, the scheduler prioritizes components based on change recency, criticality, and time since last verification.

defmodule PrismaticAgents.TrinityBridgeCoordinator.Scheduler do
  @moduledoc """
  Intelligent verification scheduling for Trinity Bridge campaigns.
  Prioritizes components by change recency, criticality, and verification age.
  """

  @spec schedule_next_batch(list(map()), non_neg_integer()) :: list(map())
  def schedule_next_batch(components, batch_size) do
    components
    |> Enum.map(&calculate_verification_priority/1)
    |> Enum.sort_by(& &1.priority, :desc)
    |> Enum.take(batch_size)
  end

  defp calculate_verification_priority(component) do
    change_score = if component.recently_changed, do: 50, else: 0
    criticality_score = criticality_weight(component.type) * 30
    age_score = min(days_since_verification(component) * 2, 20)

    %{component | priority: change_score + criticality_score + age_score}
  end

  defp criticality_weight(:agent), do: 1.0
  defp criticality_weight(:pipeline), do: 0.9
  defp criticality_weight(:command), do: 0.7
  defp criticality_weight(:workflow), do: 0.6
  defp criticality_weight(:policy), do: 0.5
  defp criticality_weight(:adapter), do: 0.8
  defp criticality_weight(_), do: 0.5
end
Priority FactorWeightRationale
Recently Changed50 pointsChanged components are most likely to have verification issues
Component Criticality0-30 pointsAgents and adapters are higher priority than workflows
Verification Age0-20 pointsComponents not verified recently accumulate priority debt
Previous Failures+20 points bonusComponents with recent failures get expedited re-verification

Historical Compliance Tracking

The coordinator maintains a complete history of verification results, enabling trend analysis and identification of components that are prone to recurring compliance issues. This historical data feeds into the platform's quality evolution metrics and informs strategic decisions about which areas of the codebase require architectural attention.

Historical MetricRetentionGranularityUse Case
Campaign Results365 daysPer-campaignTrend analysis
Component HistoryIndefinitePer-verificationRecurring issue detection
Remediation Timelines90 daysPer-remediationSLA tracking
Failure Patterns180 daysPer-failure-typeRoot cause analysis

Operational Metrics

MetricTargetCurrent
Platform compliance rate100%100%
Campaign completion rate100%100%
Remediation SLA (P0)< 1 hour23 minutes avg
Verification throughput50+ components/hour62 components/hour
False positive rate0%0%

Integration Points

Resource Management

Verification campaigns consume computational resources, particularly for Layer 3 (Formal) verification which involves Lean4 proof search. The Trinity Bridge Coordinator manages these resources carefully to avoid impacting developer productivity or production system performance during verification sweeps.

ResourceCampaign BudgetMitigation Strategy
CPUMax 25% of available cores during campaignsOff-peak scheduling, priority throttling
MemoryMax 2 GB per concurrent verificationProof cache to reduce redundant computation
I/ORate-limited file system accessBatched file reads, memory-mapped caching
NetworkMinimal (local verification only)No external calls during verification
TimeCampaign max duration enforcedTimeout per component, campaign-level timeout

The coordinator preferentially schedules large verification campaigns during off-peak hours (nights and weekends) to minimize impact on developer workflows. Critical post-change verifications run immediately regardless of timing, but are scoped to only the affected components rather than full sweeps.

AIAD Specification Compliance

AIAD ComponentStatus
Agent specification fileCompliant
Behavioral rules14 rules defined
Telemetry integrationFull coverage
NM/ND doctrine enforcementActive
SEADF integrationRegistered

Authority Level

L3 - Strategic Command - Multi-domain coordination with authority to schedule verification campaigns and enforce compliance remediation across all AIAD components.


Connect & Contribute

Created by Tomáš Korcak (korczis) | Open Source under GHL