DEV Community

Cover image for Beyond Selectors: The Starlight Protocol and the Era of Sovereign Automation
Dhiraj Das
Dhiraj Das

Posted on • Originally published at dhirajdas.dev

Beyond Selectors: The Starlight Protocol and the Era of Sovereign Automation

"The ground is chaotic. Navigation requires a higher frame of reference."

— Inspired by the dung beetle, which navigates using the Milky Way

The Problem with Traditional Automation

Every test engineer has experienced the 3 AM page: "Build Failed - Element Not Found."

Traditional browser automation is fragile by design. We bind our tests to the implementation details of the UI—CSS selectors, XPaths, and dynamic IDs that change with every sprint. When a developer renames a button, our tests break. When a modal appears unexpectedly, our scripts crash.

The industry's solution? Add more wait statements. More try-catch blocks. More conditional logic.

The Fundamental Problem

This is treating symptoms, not the disease. The fundamental problem is that we're looking at the ground when we should be looking at the stars.

Introducing Constellation-Based Automation

What if your automation could handle unexpected obstacles the way a human does—not by predicting every possible state, but by *adapting* to whatever the environment throws at it?

This is the core philosophy behind Constellation-Based Automation (CBA) and its communication protocol, Starlight.

Instead of writing scripts that handle every edge case, CBA introduces a Sovereign Constellation of autonomous agents that:

  • Monitor the environment for obstacles (popups, modals, network jitter)
  • Clear the path before your intent even knows there was a problem
  • Learn from experience to handle similar situations faster next time

Clean Intent

Your test script stays clean and focused on the business goal. The *environment's chaos* becomes someone else's problem.

The Architecture: A New Paradigm

┌─────────────────────────────────────────────────────────────┐
│                      INTENT LAYER                           │
│         "Login" • "Submit Form" • "Initiate Mission"        │
└─────────────────────────┬───────────────────────────────────┘
                          │ JSON-RPC
                          ▼
┌─────────────────────────────────────────────────────────────┐
│                        CBA HUB                              │
│              Orchestrator • Semantic Resolver               │
│                   Predictive Memory                         │
└───────────┬─────────────┬─────────────┬─────────────────────┘
            │             │             │
            ▼             ▼             ▼
    ┌───────────┐  ┌───────────┐  ┌───────────┐
    │   PULSE   │  │  JANITOR  │  │  VISION   │
    │ Stability │  │ Heuristic │  │  AI-Based │
    │  Monitor  │  │  Healing  │  │ Detection │
    └───────────┘  └───────────┘  └───────────┘
         │              │              │
         └──────────────┴──────────────┘
                        │
                        ▼
              ┌──────────────────┐
              │     BROWSER      │
              │   (Playwright)   │
              └──────────────────┘
Enter fullscreen mode Exit fullscreen mode

The Sentinels

1

Pulse Sentinel — The Guardian of Time

Monitors network requests and DOM mutations. Vetoes execution until the environment is stable. Eliminates the need for setTimeout or waitForSelector.

2

Janitor Sentinel — The Heuristic Healer

Detects known obstacle patterns (modals, cookie banners). Clears them automatically using proven selectors. Learns which actions work and remembers for next time.

3

Vision Sentinel — The AI Eye

Uses local AI models (Ollama/Moondream) to *see* obstacles. Works without selectors—pure visual detection. Handles encrypted or obfuscated UIs.

The Starlight Protocol

Communication between the Hub and Sentinels uses JSON-RPC 2.0 with a set of standardized signals:

Signal Purpose
starlight.intent "I want to click the Login button"
starlight.pre\_check "Everyone check the path before I proceed"
starlight.clear "Path is clear, proceed"
starlight.wait "Hold on, environment is unstable"
starlight.hijack "I need to take over and fix something"
starlight.resume "Problem fixed, continue the mission"

Consensus-Based Execution

The Hub never executes an action until all relevant Sentinels have cleared the path.

Predictive Intelligence: The Galaxy Mesh

CBA doesn't just react—it learns.

1

Self-Healing Selectors

When a selector fails, the Hub checks its historical memory. If it has seen this goal before with a different selector that worked, it substitutes automatically.

// First run: User clicks "Submit" → selector fails
// Hub learns: "Submit" goal worked with "#submit-btn" in the past
// Second run: Auto-substitutes and succeeds
Enter fullscreen mode Exit fullscreen mode

2

Aura-Based Throttling

The Hub tracks *when* entropy events occur during missions. If the first 5 seconds of a particular page are historically unstable, it proactively slows down before problems occur.

3

Sentinel Memory

Sentinels remember which remediation actions worked. If the Janitor cleared a modal with .modal .close-btn, it remembers this for next time—skipping the exploration phase entirely.

The ROI Dashboard: Proving Value

Every mission generates a "Hero Story" report that quantifies the business value:

Event Type Value Saved
Sentinel Intervention 5 minutes (manual triage avoided)
Self-Healing Event 2-3 minutes (debugging avoided)
Aura Stabilization 30 seconds (flake prevention)

From Cost Center to Value Generator

This transforms testing from a cost center to a *measurable value generator*.

Real-World Impact

In traditional automation, a single unexpected modal can:

  • Crash the test → 30 seconds wasted
  • Trigger manual investigation → 5-10 minutes
  • Require code changes → 30-60 minutes
  • Wait for PR review → hours to days

In CBA, the same modal:

  • Detected by Janitor Sentinel → 0.1 seconds
  • Cleared automatically → 0.5 seconds
  • Test continues successfully
  • Event logged for dashboard

Zero Human Minutes

Total impact: 0 human minutes required.

Time-Travel Triage: Debugging the Future

When something does go wrong, CBA doesn't leave you guessing. The Time-Travel Triage feature records every handshake, every decision, every DOM state.

Open triage.html, load your mission trace, and *rewind* to see exactly what the browser looked like when the failure occurred. No more "works on my machine" debates.

Getting Started

# Clone and setup
git clone https://github.com/godhiraj-code/cba
cd cba
npm install
pip install -r requirements.txt
npx playwright install chromium

# Run the constellation
run_cba.bat  # Windows
Enter fullscreen mode Exit fullscreen mode

Or build your own Sentinel in minutes:

from sdk.starlight_sdk import SentinelBase
import asyncio

class MySentinel(SentinelBase):
    def __init__(self):
        super().__init__(layer_name="MySentinel", priority=10)
        self.capabilities = ["custom-healing"]

    async def on_pre_check(self, params, msg_id):
        # Your healing logic here
        await self.send_clear()

if __name__ == "__main__":
    asyncio.run(MySentinel().start())
Enter fullscreen mode Exit fullscreen mode

The SDK handles:

  • ✅ WebSocket connection management
  • ✅ Auto-reconnect on failure
  • ✅ Persistent memory (JSON-based)
  • ✅ Graceful shutdown (Ctrl+C saves state)
  • ✅ Configuration loading

The Technology Stack

Component Technology
Hub Node.js + Playwright
Sentinels Python + AsyncIO
Protocol JSON-RPC 2.0 over WebSocket
AI Vision Ollama + Moondream (local SLM)
Deployment Docker Compose

Privacy First

All AI processing happens locally—no cloud dependencies, no data leakage.

The Future: Sovereign Security

Phase 9 is on the horizon, bringing enterprise-grade features:

  • Shadow DOM Penetration: Handle modern web components with encapsulated styles
  • PII Sentinel: Detect and redact sensitive data before screenshots
  • Traffic Sovereign: Network-level chaos engineering and request mocking

Why "Starlight"?

The dung beetle doesn't navigate by watching the ground. It looks up at the Milky Way—a fixed reference point that transcends the chaos below.

The Analogy

Traditional automation is like watching the ground: every rock, every leaf, every obstacle requires explicit handling. CBA is like looking at the stars: we navigate by intent, and the constellation handles the terrain.

Conclusion: A Paradigm Shift

CBA isn't just a framework—it's a philosophical shift in how we think about automation.

Old Paradigm New Paradigm
Handle every edge case Adapt to any edge case
Fragile selectors Semantic goals
Hard-coded waits Temporal intelligence
Invisible failures Quantified ROI
Hope it works Know it will work

The goal is constant. The path is sovereign. The mission will succeed.

"The stars are aligned."

Built with ❤️ by Dhiraj Das
Explore the protocol on GitHub

Top comments (0)