# Seven Swell AI Labs > Independent systems research lab founded by Thaddeus Sylvester Lee (Microsoft Certified Azure Data Engineer, DP-203) investigating neuro-symbolic reasoning, binary Hyperdimensional Computing (HDC), SQL Server schemas, FinOps multi-model routing, and deterministic MCP agent harnesses. URL: https://sevenswell.ai/ Full Dossier: https://sevenswell.ai/llms-full.txt ## Lab Scope & Methodology Instead of throwing massive GPU clusters and brute-force token spend at every problem, Seven Swell AI Labs focuses on how algebraic structure, SQL Server schemas, and deterministic state harnesses make enterprise AI faster, cheaper, and easier to verify. ## Active Research Tracks ### Track 01: Semantic Enterprise Search Without a Vector Database - Status: Working Prototype Verified (SQL Server + .NET 8 Binary HDC + React/Express Console) - Problem: Adding contextual search or dispatch matching to an enterprise ERP typically requires an external floating-point vector database, duplicated pipelines, and heavy RAM overhead. - Stack: SQL Server (relational EAV tables, T-SQL MERGE upserts, VARBINARY(1024)), C# / .NET 8 ASP.NET Core Minimal API (PLINQ BitOperations.PopCount), OpenAPI/Swagger, TypeScript, Node.js/Express, React. - Architecture: Encodes structured workforce and event records into 8,192-bit binary hypervectors stored inline in SQL Server VARBINARY(1024) columns (1,024 bytes vs 6,144 bytes for 1,536-dim float32, a 1:6 ratio on raw vector payload bytes only, excluding table/index overhead). Uses role-value XOR binding and weighted majority-vote bundling (Weight: Department=3, CallType=2, Location=2, Priority/Readiness=2), plus a 5-signal field ranking panel for EAV schema auditing where the UI edits existing field values. - Scope & Qualifications: Verified on a seeded demo dataset (144 employees, 8 departments, 48 events) with a 2,000-row synthetic dispatch simulator cap. Hamming matching scores in the console measure deterministic attribute and token overlap rather than held-out prediction accuracy. ### Track 02: Deterministic Agent Harnesses & Failure-State Memory - Status: Production Lab Tooling (Initial Architecture Built Nov 2025) - Problem: Coding and operational agents lose context across multi-step tasks, collide on local network ports, or repeat identical failed tool calls in unconstrained loops. - Subsystems: - Janus (Isolated RAM Sandbox): Mounts part of a 35GB RAM pool as a volatile execution substrate (< 1 us RAM access vs ~500 us SSD I/O) with dynamic path-rewriting and an SSE heartbeat reaper for deterministic teardown. - Port Guardian (Network & Process Lease MCP): PID-bound TCP port leases, sliding-window TCP/UDP packet aggregation, orphan listener cleanup, and Cloudflare Zero Trust API tunnel provisioning. - Cortex Relay (Persistent SSE MCP Bridge): Replaces fragile stdio subprocess transport with persistent HTTP SSE streams plus context_prune and analyze_drift context governance. - Agent Nudge DB (Binary HDC Failure-State Memory): Indexes failed tool calls and broken state transitions as binary HDC bit-vectors and injects targeted cautionary prompts during live inference. ### Track 03: FinOps Model Routing & Generative SQL Interfaces - Status: Working Prototype Verified (SQL Server + Prisma + Multi-Tier FinOps Router + Recharts) - Problem: Enterprise chat wrappers send trivial lookups to expensive frontier models without turn or context caps, returning walls of prose instead of structured operational views. - Stack: Google Gemini 2.5/3.x SDK, OpenRouter :free fallback chains (max_price: 0), SQL Server (31 Prisma models + raw T-SQL CTEs), Express, React 19, Recharts, hardened Streamdown (rehype-harden), JSDOM. - FinOps Routing: 4 cost modes (Eco, Smart, Balanced, Pro) bounding tool turns (3 to 5), conversation windows (4 to unbounded), and thinking budgets (0 to 4,096) across LITE, FLASH, and PRO model chains, pairing regex rules with a 10-token Gemini Flash-Lite classifier in Smart mode, cascading automatically on HTTP 429, 503, or 404 errors, failing over to OpenRouter :free endpoints, and recording tokens and duration in SQL Server AIRequestLog (without polling an external billing-balance API). - Typed SQL Tooling, Relational Schema & Compliance Workflow: Models 31 SQL Server tables reconciling sequential 90-day readiness gates (PhaseDefinition, Phase 0 to Phase 4), concurrent multi-program enrollment (ParticipantProgramLink) with continuous e-scrap floor tracking (WorkLog, ProductionLog, SerializedAsset, DestructionLog), multi-label participant attributes (ParticipantCategory), and priority-sorted notifications (Notification). Exposes 18 parameterized Prisma/SQL Server function tools streaming results into a resizable split-pane Impact Canvas with multi-view tabs, 5-mode Recharts controls, and React Router deep links. Originated during the January 2026 Hatch-a-thon challenge and expanded in October 2026 alongside RecycleGuard: JSDOM scraping with SHA-256 content hashing (OSHA, EPA, ADEM r. 335-13-3 / Form 539 75% diversion check, City of Mobile), 1-hour SQL-cached grant briefings with regulatory citations, and draft grant narratives applying fixed indicative per-pound commodity rates rather than realized sales ledgers. ### Track 04: Project Zero (Neuro-Symbolic & Algebra-Driven Reasoning) - URL: https://sevenswell.ai/#project-zero - Status: Core Foundational Research Program (Active Since Oct 2025) - Thesis & Spin-Out Primitives: Developing and benchmarking deterministic, algebra-driven and vector-symbolic structures for perpetual context persistence and white-box, explainable outputs without relying solely on brute-force parameter scale. Intermediate primitives from this program already power the binary hypervector storage engine in Track 01 (VARBINARY(1024)) and the binary failure-state memory index in Track 02 (Agent Nudge DB). Core mathematical formulations remain proprietary. ## Lab Infrastructure & Edge Testbed Prototypes are validated across enterprise SQL Server instances and a local Tailscale cluster of repurposed hardware running custom builds of llama.cpp serving Gemma 4 models behind a unified Go API router with user-in-the-loop pause, rewind, and semantic context injection controls. ## Documentation & Architecture Notes - [Full Technical Architecture Dossier (llms-full.txt)](https://sevenswell.ai/llms-full.txt): Complete plain-text architecture specifications, benchmarks, and operational workflows for all public lab subsystems. - [Janus Sandbox: Isolated RAM Sandbox (HTML Note)](https://sevenswell.ai/#janus): Volatile RAM-disk sandboxing and path-rewriting infrastructure for testing multi-step agent mutations before disk merge. - [Port Guardian: Network & Process Lease MCP (HTML Note)](https://sevenswell.ai/#port-guardian): PID-bound TCP port lease management, sliding-window packet aggregation, and orphan process cleanup for local multi-agent runs. - [Agent Nudge DB: Binary HDC Failure-State Memory (HTML Note)](https://sevenswell.ai/#nudge-db): Failure-state memory using binary Hyperdimensional Computing vectors to intercept repeated broken tool calls across sessions. - [Cortex Relay: Persistent SSE MCP Bridge (HTML Note)](https://sevenswell.ai/#cortex-relay): Server-Sent Events transport bridge and context-governance tooling replacing fragile stdio MCP pipes. - [Janus Sandbox White Paper (PDF)](https://sevenswell.ai/whitepapers/project-janus-white-paper.pdf): Downloadable technical white paper (Architecture Note 02-A, November 2025 (Updated 2026)). - [Port Guardian White Paper (PDF)](https://sevenswell.ai/whitepapers/port-guardian-white-paper.pdf): Downloadable technical white paper (Architecture Note 02-B, November 2025 (Updated 2026)). - [Agent Nudge DB White Paper (PDF)](https://sevenswell.ai/whitepapers/agent-nudge-db-white-paper.pdf): Downloadable technical white paper (Architecture Note 02-C, November 2025 (Updated 2026)). - [Cortex Relay White Paper (PDF)](https://sevenswell.ai/whitepapers/cortex-relay-white-paper.pdf): Downloadable technical white paper (Architecture Note 02-D, November 2025 (Updated 2026)). ## Principal Researcher & IP Boundary - Organization: Seven Swell AI Labs LLC (Mobile, Alabama) - Founder: Thaddeus Sylvester Lee, Microsoft Certified Azure Data Engineer (DP-203) with 7+ years of production experience in T-SQL, SQL Server data warehousing, and enterprise BI architecture. - IP Separation: All lab research and prototypes are developed independently outside of full-time employment hours on personal hardware. - GitHub: https://github.com/thaddeus-lee-iv - LinkedIn: https://www.linkedin.com/in/thaddeus-l-9b935344 - Email: mailto:thaddeusslee@gmail.com ## Architectural Comparison Matrices ### Track 01: SQL Server + Binary HDC vs External Float32 Vector DB - Raw Vector Payload: VARBINARY(1024) = 1,024 raw bytes binary (128 x UInt64) vs 1,536-dim float32 = 6,144 raw bytes (one-sixth raw vector bytes, not total DB RAM or learned-embedding accuracy). - Storage & Compute Split: SQL Server stores EAV catalog & VARBINARY(1024); C#/.NET 8 Minimal API runs PLINQ BitOperations.PopCount vs external floating-point cosine vector DB + duplicate ETL. - Encoding & Basis: SHA-256 trigrams/BPE, XOR binding, weighted bundling (Department=3, CallType=2, Location=2, Priority/Readiness=2), cyclic permutation & Hamming similarity. - Prototype Controls & Scale: 5-signal hybrid SQL/HDC field ranking, 144 seeded synthetic employees across 8 departments and 48 events, greedy staffing simulator, and 2,000-row active query cap. ### Track 03: 4-Mode FinOps Router & Typed SQL Canvas vs Single-Model Chat Wrapper - Cost Modes & Tier Chains: Eco, Smart, Balanced, and Pro bound tool turns (3 to 5), context windows (4 to unbounded), and thinking budgets (0 to 4,096) across LITE, FLASH, and PRO Gemini 2.5/3.x and OpenRouter :free chains, cascading on HTTP 429/503/404 and logging telemetry in AIRequestLog vs static single-model dispatch. - Parameterized SQL Canvas: 18 typed function-calling tools query 31 SQL Server Prisma models and T-SQL CTEs (seeded with synthetic workforce and e-scrap personas) into a resizable split-pane Recharts canvas with React Router deep links vs unconstrained raw SQL text. - Regulatory Scraper & Grant Qualifications: RecycleGuard indexes OSHA 29 CFR 1910, EPA 40 CFR Part 273, ADEM r. 335-13-3 (Form 539, 75% diversion gate), and City of Mobile rules via JSDOM + SHA-256 hashing and 1-hour SQL-cached grant briefings; commodity estimates apply fixed indicative per-pound rates rather than realized sales. --- # Complete Public Architecture Notes & White Papers ## Janus Sandbox: Isolated RAM Sandbox - Label: Architecture Note 02-A - Author: Thaddeus Sylvester Lee - Organization: Seven Swell AI Labs - Date: November 2025 (Updated 2026) - Classification: Production Lab Tooling - Interactive View: https://sevenswell.ai/#janus - PDF Download: https://sevenswell.ai/whitepapers/project-janus-white-paper.pdf Headline: Volatile RAM Substrate & Path-Rewriting Harness. Lead: Isolating multi-step agent mutations in sub-microsecond RAM mounts before merging validated state to disk. Abstract: Autonomous coding agents degrade when every experimental edit mutates the primary repository on SSD storage. Janus mounts part of a 35GB RAM pool as a volatile execution substrate with dynamic path-rewriting and an SSE heartbeat reaper, allowing agents to test schema or code mutations in memory and merge only verified changes back to disk. ### 01 / The Problem Metrics: - SSD I/O Latency: ~500 us - RAM Access Latency: < 1 us #### Mutable Working-Tree Risk When coding agents run iterative builds and schema refactors directly against the primary working tree, failed edits leave half-written files behind and incur persistent SSD I/O latency. ### 02 / Architecture #### RAM Substrate Janus uses the Advanced Interface for Memory (AIM) to mount a slice of the host 35GB RAM pool as a volatile virtual drive dedicated to isolated sandbox runs. #### Path-Rewriting Adapter An interception layer dynamically remaps file system paths from the primary repository to the RAM-disk mount so agents run normal build and test tools without touching disk state. #### SSE Heartbeat Reaper A lifecycle monitor tied to the active Server-Sent Events heartbeat prunes volatile sandbox allocations automatically when an agent session terminates or drops. ### 03 / Execution Loop #### 01 / Sandbox Allocation Mount the current repository state into an isolated volatile RAM volume. #### 02 / Parallel Mutation Testing Run competing schema or code edits across isolated mounts at RAM speed. #### 03 / State Verification Validate outputs against database assertions and unit or build checks. #### 04 / Verified Merge Promote only validated changes back to the primary working directory and release the mount. ### 04 / Operational Workflows #### Sandbox Mount (Volatile RAM Sandbox) Isolating repository state onto a dedicated RAM-disk volume. Objective: Initialize an isolated RAM-backed working tree for non-destructive agent testing. Phase: Initialization - RAM Volume Allocation: Mount a named RAM-disk partition to isolate candidate edits from the Primary Working Tree. [Tools: RAM Disk Controller] - Path Authorization: Configure the path-rewriting adapter to authorize atomic file operations only inside the mounted volume. [Tools: Path Rewriter] - Mount Verification: Verify directory readiness and confirm low-latency read/write access before agent execution. [Tools: Health Check] Phase: Execution - Workspace Redirection: Route agent tool calls to the RAM sandbox path while preserving relative project structure. [Tools: Path Rewriter] - In-Memory Validation: Run build and test suites inside RAM without mutating files on persistent storage. #### Parallel Candidates (Concurrent Sandboxes) Evaluating competing implementation patches across isolated mounts. Objective: Run parallel sandbox instances to compare candidate implementations against deterministic checks before merging. Phase: Branching - Sandbox Replication: Initialize separate RAM mounts for each candidate approach under test. [Tools: RAM Disk Controller] - Isolated Patching: Apply divergent schema or application edits independently in each sandbox. [Tools: Diff Engine] Phase: Selection - State Verification: Execute database assertions and test suites across every active sandbox. [Tools: Validation Suite] - Validated State Merge: Promote only the verified patch back into the Primary Working Tree. [Tools: Merge Gate] #### Guarded Feature Build (Atomic Integration) Developing and verifying mutations before disk commit. Objective: Keep the primary repository stable while agents iterate on schema and code mutations in memory. Phase: Isolation - Sandbox Allocation: Provision a dedicated volatile workspace for the current task. [Tools: RAM Disk Controller] - Scope Verification: Check proposed edits against schema contracts and state constraints. [Tools: Schema Validator] Phase: Commit Gate - Targeted Edits: Apply scoped modifications inside the sandbox without touching unrelated files. [Tools: Diff Engine] - Validated State Merge: Flush verified changes back to disk and release volatile memory. [Tools: Merge Gate] #### Cross-Module Audit (Dependency Mapping) Tracing schema and API boundaries across repositories. Objective: Inspect relational dependencies and call chains across modules before executing multi-file refactors. Phase: Ingestion - Dependency Scoping: Index root tables, stored procedures, and API entry points. [Tools: Dependency Audit] - State Capture: Snapshot baseline schema and test outputs before any refactor begins. [Tools: State Capture] Phase: Verification - Data Flow Tracing: Follow read and write paths across database and service boundaries. [Tools: Schema Validator] - Plan Output: Generate an ordered patch sequence verified against expected constraints. [Tools: Validation Suite] ### Summary Verify before committing. Janus keeps the primary workspace clean while agents test multi-step edits inside bounded, volatile memory sandboxes. --- ## Port Guardian: Network & Process Lease MCP - Label: Architecture Note 02-B - Author: Thaddeus Sylvester Lee - Organization: Seven Swell AI Labs - Date: November 2025 (Updated 2026) - Classification: Production Lab Tooling - Interactive View: https://sevenswell.ai/#port-guardian - PDF Download: https://sevenswell.ai/whitepapers/port-guardian-white-paper.pdf Headline: PID-Bound TCP Port Leases & Packet Aggregation. Lead: Preventing port collisions and orphaned listener processes across concurrent local agent runs. Abstract: Concurrent local agent workflows frequently collide on localhost ports and leave orphaned listener processes behind after crashes. Port Guardian is an MCP server providing PID-bound TCP port leases, sliding-window TCP/UDP packet aggregation, and automated orphan cleanup, paired with a Cloudflare Zero Trust MCP tool for automated tunnel provisioning. ### 01 / The Problem Metrics: - Unbound Local Ports: Collisions - Lease Registry: PID-Bound #### Port Collisions & Orphan Listeners When multiple agents start dev servers and test APIs simultaneously, hard-coded ports collide and crashed sessions leave stale processes listening on sockets without attribution. ### 02 / Core Capabilities #### PID-Bound Lease Controller Allocates TCP ports with explicit metadata binding project name, session ID, sandbox path, and process ID to every active lease. #### Sliding-Window Packet Sniffer Aggregates live TCP and UDP traffic on leased ports into sliding time windows so agents can diagnose connection errors without parsing raw packet floods. #### Orphan Process Cleanup Background sweeps detect processes listening on unregistered ports or linked to dead sessions and terminate them to reclaim localhost capacity. #### Cloudflare Zero Trust Integration Works alongside a Cloudflare Zero Trust MCP server that provisions tunnels and maps local leased ports to public hostnames via API without manual setup. ### 03 / Operational Workflows #### Port Lease Control (Lifecycle Binding) Preventing port collisions across local services. Objective: Bind local TCP ports to explicit process IDs and session metadata during multi-agent runs. Phase: Allocation - Lease Request: Reserve an available port range for a named agent task and project. [Tools: Port Lease Registry] - PID Binding: Record the owning process ID and workspace path against the active lease. [Tools: Process Tracker] Phase: Teardown - Explicit Release: Terminate leased child processes and free registered ports on session exit. [Tools: Lifecycle Reaper] #### Traffic Aggregation (Packet Telemetry) Diagnosing local TCP and UDP failures in real time. Objective: Aggregate live local traffic into time-windowed summaries for fast agent diagnostics. Phase: Capture - Port Filtering: Filter live TCP and UDP packets to the ports registered for the active session. [Tools: Packet Sniffer] - Window Rollup: Summarize request rates, status codes, and connection drops into sliding intervals. [Tools: Telemetry Store] Phase: Diagnosis - Event Correlation: Match socket failures and timeouts against recent service restarts. [Tools: Telemetry Store] #### Orphan Process Cleanup (Listener Reclamation) Detecting and clearing stale background listeners. Objective: Reclaim local ports held by orphaned processes whose parent agent sessions have exited. Phase: Detection - Registry Sweep: Compare active OS listening sockets against valid entries in the lease table. [Tools: Port Lease Registry] - Heartbeat Check: Verify whether the owning session stream is still active. [Tools: Lifecycle Reaper] Phase: Reclamation - Process Termination: Stop unleased orphan listeners and release their ports back to the pool. [Tools: Lifecycle Reaper] #### Tunnel Provisioning (Zero Trust API) Automated Cloudflare Zero Trust tunnel setup. Objective: Expose local services securely through Cloudflare Zero Trust tunnels without manual dashboard steps. Phase: Configuration - Route Registration: Map a leased local port to a configured Cloudflare tunnel hostname via API. [Tools: Cloudflare Zero Trust MCP] - Connectivity Check: Verify ingress routing and TLS termination before handing the URL back. [Tools: Health Check] ### Summary Deterministic local networking. Port Guardian gives multi-agent testbeds strict port ownership, live socket visibility, and clean teardown. --- ## Agent Nudge DB: Binary HDC Failure-State Memory - Label: Architecture Note 02-C - Author: Thaddeus Sylvester Lee - Organization: Seven Swell AI Labs - Date: November 2025 (Updated 2026) - Classification: Production Lab Tooling - Interactive View: https://sevenswell.ai/#nudge-db - PDF Download: https://sevenswell.ai/whitepapers/agent-nudge-db-white-paper.pdf Headline: Binary Hyperdimensional Failure Memory & Prompt Injection. Lead: Preventing repeated broken tool calls across sessions by indexing failure transitions as binary hypervectors. Abstract: Agent Nudge DB indexes verified failure scenarios, broken state transitions, and failed tool calls as binary Hyperdimensional Computing (HDC) bit-vectors. When a new task resembles a recorded failure state during live inference, the harness injects targeted cautionary context directly into the autoregressive loop. ### 01 / The Problem Metrics: - Stateless Loops: Repeat Errors - HDC Failure Index: Persistent #### Repeated Tool-Call Failures Agents running in stateless or unconstrained loops repeatedly attempt the same broken migrations, invalid flags, or port assumptions across sessions, wasting tokens and failing on known traps. ### 02 / Architecture #### Binary HDC Encoding Encodes failed tool calls, error signatures, and broken state transitions into compact binary bit-vectors scored via Hamming distance in microseconds. #### Live Autoregressive Injection Compares incoming task context against stored failure vectors and injects a concise cautionary prompt before the model repeats a known broken step. ### 03 / Operational Workflows #### Failure Indexing (Binary HDC Memory) Recording broken state transitions to stop repeat errors. Objective: Encode verified tool failures and corrective fixes as binary hypervectors for cross-session recall. Phase: Capture - Root Cause Tagging: Record the failing command, error signature, and broken state transition. [Tools: Failure Log] - Duplicate Check: Compute Hamming distance against existing entries to avoid redundant records. [Tools: HDC Matcher] Phase: Persistence - Verified Resolution: Attach the passing fix and validation evidence once the issue is resolved. [Tools: Validation Suite] - Hypervector Commit: Store the bundled binary vector in the failure-memory index for future sessions. [Tools: HDC Encoder] #### Session Hydration (Prior-Failure Lookup) Loading relevant project constraints at session start. Objective: Prime a new agent session with historical failure notes relevant to the target repository. Phase: Lookup - Context Encoding: Encode the active task summary and repository paths into a query hypervector. [Tools: HDC Encoder] - Similarity Scan: Retrieve matching cautionary notes via Hamming distance before the first edit. [Tools: HDC Matcher] #### Index Refresh (Memory Maintenance) Updating stored failure records after schema or API changes. Objective: Keep failure-state vectors aligned with current code and database schemas. Phase: Reconciliation - Stale Entry Audit: Flag failure records that reference renamed files, tables, or deprecated endpoints. [Tools: Failure Log] - Vector Re-encoding: Update affected hypervectors so similarity thresholds stay accurate. [Tools: HDC Encoder] #### Live Prompt Injection (Autoregressive Guard) Injecting cautionary prompts mid-loop when risk matches. Objective: Interrupt repeated failure loops by injecting prior corrective context during live inference. Phase: Intervention - Threshold Trigger: Detect when a pending tool call matches a previously indexed failure transition. [Tools: HDC Matcher] - Cautionary Nudge: Inject the recorded constraint and verified workaround before execution proceeds. [Tools: Prompt Injector] ### Summary Preserve every hard-won constraint. Agent Nudge DB turns past tool-call failures into fast, deterministic guardrails for future inference runs. --- ## Cortex Relay: Persistent SSE MCP Bridge - Label: Architecture Note 02-D - Author: Thaddeus Sylvester Lee - Organization: Seven Swell AI Labs - Date: November 2025 (Updated 2026) - Classification: Production Lab Tooling - Interactive View: https://sevenswell.ai/#cortex-relay - PDF Download: https://sevenswell.ai/whitepapers/cortex-relay-white-paper.pdf Headline: Persistent HTTP Stream Transport & Context Drift Control. Lead: Replacing fragile subprocess stdio pipes with observable SSE streams and context-governance primitives. Abstract: Cortex Relay replaces fragile subprocess stdio pipes with a persistent HTTP Server-Sent Events (SSE) bridge for Model Context Protocol (MCP) tools. It streams live tool execution logs to multiple observers and exposes context_prune and analyze_drift primitives to detect drift and curb token bloat. ### 01 / The Problem Metrics: - Stdio Transport: Single-Pipe / Fragile - Cortex Relay: HTTP SSE / Observable #### Subprocess Pipe Fragility Standard stdio-based MCP links tie session state to a single child process pipe. Subprocess crashes terminate the session, and inspecting live tool telemetry concurrently is difficult. ### 02 / Components #### Persistent SSE Bridge Exposes MCP transport over a persistent HTTP SSE stream so orchestrators and diagnostic monitors can observe live execution logs without interfering with tool calls. #### Context Governance Primitives Provides context_prune and analyze_drift tools to compact stale tool output and flag when an agent loop diverges from the assigned task. ### 03 / Operational Workflows #### Background Streams (Async Transport) Keeping long-running MCP tool streams alive over HTTP. Objective: Coordinate asynchronous agent operations over persistent SSE connections without blocking. Phase: Orchestration - Stream Subscription: Attach clients and observers to a persistent HTTP SSE endpoint. [Tools: SSE Bridge] - Heartbeat Supervision: Monitor active worker tasks and notify connected observers on completion or failure. [Tools: Process Monitor] #### State Inspection (Live Log Piping) Tracing tool calls and state mutations across active streams. Objective: Surface live tool execution logs and state transitions to diagnose race conditions. Phase: Tracing - Mutator Logging: Emit structured events whenever a tool writes files or alters database state. [Tools: SSE Bridge] - Stream Observation: Allow secondary observers to tail execution logs without interfering with stdio. [Tools: Process Monitor] Phase: Pinpointing - Divergence Check: Identify the exact tool call where actual state diverged from expected assertions. [Tools: Drift Analyzer] #### Drift Analysis (Context Governance) Detecting off-task loops and pruning stale context. Objective: Monitor context growth and semantic drift across multi-step agent runs. Phase: Measurement - Drift Scoring: Run analyze_drift against recent tool invocations and the original task objective. [Tools: Drift Analyzer] - Test Enforcement: Require isolated reproduction checks when repeated errors occur. [Tools: Validation Suite] Phase: Pruning - Context Compaction: Invoke context_prune to drop obsolete tool payloads while preserving key constraints. [Tools: Context Pruner] #### Protocol Guardrails (Harness Discipline) Validating tool inputs against session boundaries. Objective: Prevent destructive tool calls and boundary violations across connected MCP servers. Phase: Validation - Boundary Check: Verify target file paths and port numbers belong to the active sandbox and lease. [Tools: Path Rewriter] - Policy Rejection: Block unverified destructive commands and return actionable error context. [Tools: Policy Gate] Phase: Commit - Verified Write: Permit writes only after schema, port, and workspace checks pass. [Tools: Validation Suite] ### Summary Observable transport and bounded context. Cortex Relay keeps long-running MCP tool loops resilient, inspectable, and anchored to task scope. ---