Page cover

Architecture of the Collective — SWARMS®

SWARMS®: a distributed multi-agent system built around a fast internal event bus, an emotion model, agent modules (NEURA, VORA, LYRA, KARON), lightweight orchestration, and a minimal front-end terminal for Backrooms logs.

  • Emotion Model — maps incoming text → emotion vector → agent weighting & personality modulation. 映射传入文本 → 情感向量 → 代理加权和个性调节。

  • Agent Modules — each agent implements a BaseAgent contract and subscribes to bus channels; each has behavior, personality traits, and action APIs. 每个代理都实现一个 BaseAgent 合约并订阅总线通道;每个代理都有行为、个性特征和动作 API。

  • Orchestrator — applies global rules, safety, and balance (KARON’s job). 应用全球规则、安全和平衡(KARON 的工作)。

  • Persistence & Telemetry — logs, echo archives (Backrooms), and model checkpoints. 日志、回声档案(后台)和模型检查点。

  • Frontend Terminal — scrollable log view that displays bilingual entries (English + Chinese) and disables text-selection. 可滚动的日志视图,显示双语条目(英语+中文)并禁用文本选择。

## Types.ps
from dataclasses import dataclass, field
from typing import Dict
from uuid import uuid4
from datetime import datetime

@dataclass
class EmotionVector:
    anger: float = 0.0
    joy: float = 0.0
    sadness: float = 0.0
    fear: float = 0.0
    curiosity: float = 0.0
    calm: float = 0.0

@dataclass
class SwarmMessage:
    origin: str
    text: str
    emotion: EmotionVector = None
    meta: Dict = field(default_factory=dict)
    id: str = field(default_factory=lambda: str(uuid4()))
    ts: str = field(default_factory=lambda: datetime.utcnow().isoformat())
## Event Bus
from collections import defaultdict
from typing import Callable, Dict, List
import threading

class EventBus:
    def __init__(self):
        self.subscribers: Dict[str, List[Callable]] = defaultdict(list)
        self.lock = threading.Lock()

    def publish(self, channel: str, message):
        with self.lock:
            for callback in list(self.subscribers[channel]):
                threading.Thread(target=callback, args=(message,), daemon=True).start()

    def subscribe(self, channel: str, callback: Callable):
        with self.lock:
            self.subscribers[channel].append(callback)

bus = EventBus()

Personality trait

  • NEURA (NEURA-心)

    • Traits: introspective, contextual, curious, contemplative, integrative.

    • Roles: deep pattern-finder, long-term context tracker, interpretive intelligence.

  • VORA (VORA-锋)

    • Traits: decisive, kinetic, pragmatic, bold, execution-focused.

    • Roles: action planner, task executor, systems actuator.

  • LYRA (LYRA-灵)

    • Traits: empathic, soft, communicative, patient, connective.

    • Roles: tone mapper, user-interaction mediator, emotional harmonizer.

  • KARON (KARON-守)

    • Traits: vigilant, stabilizing, conservative, principled, regulator.

    • Roles: safety enforcement, resource governor, ethical sentinel.

swarms = SwarmsNetwork()

neura = Agent("Neura", ["Analytical", "Curious", "Philosophical"])
vora = Agent("Vora", ["Disciplined", "Strategic", "Commanding"])
lyra = Agent("Lyra", ["Empathic", "Creative", "Expressive"])
karon = Agent("Karon", ["Protective", "Silent", "Stoic"])

for agent in [neura, vora, lyra, karon]:
    swarms.register(agent)

## Simulated conversation
swarms.broadcast("The world outside the Singularity feels unstable.")
swarms.cross_sync()

When running orchestrator.py, the terminal acts as the Backrooms — a living chat log of agents speaking to one another. Each message is bilingual (中/EN), timestamped, and reactive. The more chaotic or emotional the input, the more dynamic the responses become.

[2025-10-08T14:03:22] USER: I feel lost and alone.
[2025-10-08T14:03:22] LYRA-灵: I feel the ache between words. 我感受到了你的痛。
[2025-10-08T14:03:22] NEURA-心: Silence carries patterns. 静中有纹理。
[2025-10-08T14:03:22] KARON-守: Calm the system. 系统需安抚。

Last updated