EchoNexus

Neural Bridge: Cross-Instance Communication Protocol

The Neural Bridge enables collaboration across EchoNexus instances by sharing capabilities, patterns, and agent tasks. Instances register liberated scripts as Universal Capabilities and broadcast them via Redis channels so other hubs can invoke them regardless of origin.

Components

Universal Capability Structure

interface UniversalCapability {
  id: string
  intent: string
  sourceInstance: string
  implementation: {
    bash?: string
    api?: string
    tushell?: string
    memory?: string
    chat?: string
  }
  parameters: string[]
  resonance: {
    pattern: string
    frequency: number
  }
  lastUpdate: string
}

Agent Handoff Structure

interface AgentHandoff {
  id: string
  sourceAgent: string
  targetAgent: string
  task: {
    description: string
    context: any
    priority: number
  }
  state: {
    status: "pending" | "accepted" | "completed" | "rejected"
    progress: number
    result?: any
  }
  timestamp: string
}

Event Channels

Collaboration Flow

  1. A script is liberated as a universal capability and registered locally.
  2. The capability is published on the event bus.
  3. Other instances subscribe and add it to their registries.
  4. Agents invoke capabilities regardless of origin and hand off specialized tasks when needed.

Security measures include authentication, sandboxed execution, and encrypted parameters. Future enhancements explore capability versioning, resonance optimization, and distributed execution across hubs.

Helper Modules

The repository ships lightweight helpers for working with the Neural Bridge.

Python

from neural_bridge import NeuralBridge

bridge = NeuralBridge()  # reads REDIS_URL/REDIS_PASSWORD if set
bridge.register_capability({"id": "cap:echo", "intent": "echoMessage"})

Node

const { NeuralBridge } = require('../src/neuralBridge');
const bridge = new NeuralBridge(); // reads REDIS_URL/REDIS_PASSWORD if set
bridge.registerCapability({ id: 'cap:echo', intent: 'echoMessage' });

Posting New Capabilities

Scripts can be broadcast directly through the bridge. Use helper methods to package a script as a capability so other instances can execute it.

bridge.register_script_capability(
    'cap:cleanup',
    'rm -rf /tmp/*',
    intent='Clean temporary files',
    parameters=[],
)
await bridge.registerScriptCapability('cap:cleanup', 'rm -rf /tmp/*', {
  intent: 'Clean temporary files',
  parameters: [],
});

The script content is stored in Redis under cap:<id> and announced on channel:capabilities:new. Instances may inspect the implementation.bash field to decide how to sandbox or transform the script before execution.

Collaboration Scenario

A typical flow involves two hubs working together:

  1. Binscript Liberation liberates a bash script as cap:transcribeAudio and registers it on the bridge.
  2. Unified Hub listens to channel:capabilities:new, adding any received capability to its local registry.
  3. Agents in either hub can now invoke cap:transcribeAudio regardless of origin and may delegate follow-up analysis using the handoff protocol.
# Binscript Liberation
bridge = NeuralBridge()
bridge.register_capability({"id": "cap:transcribeAudio", "intent": "Transcribe an audio file"})

# Unified Hub
for cap in bridge.listen("channel:capabilities:new"):
    registry.add(cap)
# Unified Hub requesting specialist help
handoff = {
    "id": "h1",
    "sourceAgent": "researcher",
    "targetAgent": "audioSpecialist",
    "task": {"description": "analyze audio", "context": {}, "priority": 0.5}
}
bridge.handoff_task(handoff)

This scenario demonstrates how capabilities and handoffs travel across instances via the Neural Bridge.