Grand Diomande Research · Full HTML Reader

Unified Agent OS — Architecture Document

The Unified Agent OS (UAOS) merges three autonomous systems — **Pulse** (development), **Heartbeat** (monitoring), and **Dream Weaver / Noosphere** (incubation) — into a single coherent platform. Today these systems share the filesystem implicitly and bridge state through ad-hoc scripts (`noosphere_bridge.py`, `cadence_bridge.py`). The UAOS replaces those stitches with a unified state bus, a single lifecycle model, and formalized handoff protocols.

Agents That Account for Themselves architecture technical paper candidate score 66 .md

Full Public Reader

Unified Agent OS — Architecture Document

> Dream Origin: dream_202601291857_a242e7
> Version: 1.0 — Design Phase
> Date: 2025-02-09

1. Vision

The Unified Agent OS (UAOS) merges three autonomous systems — Pulse (development), Heartbeat (monitoring), and Dream Weaver / Noosphere (incubation) — into a single coherent platform. Today these systems share the filesystem implicitly and bridge state through ad-hoc scripts (`noosphere_bridge.py`, `cadence_bridge.py`). The UAOS replaces those stitches with a unified state bus, a single lifecycle model, and formalized handoff protocols.

Design Principles

1. Preserve what works — Every current Pulse session, Dream Weaver incubation, and Heartbeat check must continue to function unchanged. Migration is additive, not reductive.
2. Shared state, separate concerns — Each subsystem keeps its domain logic but reads/writes to a common state layer.
3. Events over polling — Move from file-watching and cron loops to an event bus that subsystems publish to and subscribe from.
4. Extensibility for Cadence — The multi-agent coordination system (higher-level / lower-level agents, INBOX/OUTBOX protocols) becomes a first-class orchestration layer.

---

2. Current State Analysis

2.1 Pulse v3 (Autonomous Development)

Location: `[home-path]`, `[home-path]`

ComponentRole
`dual_runner.py`Rate-aware session executor across two Claude Max accounts
`enriched_spawn.py`Context-enriched prompt builder for sub-agent iterations
`server.ts` (MCP)MCP server exposing `pulse_start`, `pulse_status`, `pulse_iterate`, etc.
`sessions/*.json`Per-session state files (id, project, iteration count, status, goal)

State Model: JSON files in `[home-path]`, one per session. Status enum: `running | paused | complete | blocked | failed | aborted`.

Key Signals: `CONTINUE`, `COMPLETE`, `BLOCKED`, `ERROR`, `TIMEOUT`.

2.2 Heartbeat v2 (Monitoring & Proactive Agent)

Location: `[home-path]`, `[home-path]`

ComponentRole
`HEARTBEAT.md`Declarative checklist of periodic tasks
`heartbeat-state.json`Last-check timestamps per domain
Main agent loopInterprets HEARTBEAT.md on each poll interval (~30 min)

State Model: Single JSON state file tracking timestamps. No formal schema — ad-hoc keys (`dreamWeaver`, `projects`, `calendar`, `weather`).

Interaction with other systems:
- Checks Dream Weaver daemon health
- Checks Pulse session status
- Monitors CompCore services (Graph Kernel, RAG++)
- Can trigger Dream Weaver evolution cycles during idle

2.3 Dream Weaver / Noosphere (Incubation & Emergence)

Location: `[home-path]`, `[home-path]`, `[home-path]`

ComponentRole
`incubator.py`5-phase incubation engine (context → plan → approach → synthesis → refine)
`noosphere.py`Convergent dream intelligence: rhizome graph, mycelium sensing, spore cross-pollination
`daemon.py`Background process advancing incubations hourly
`noosphere_bridge.py`Bidirectional sync between noosphere dreams.json and daemon incubation files
`server.py` (MCP)MCP tools: `incubate`, `iterate`, `run_to_completion`, `view_dream`, etc.
`dream-weaver-engine/`GitHub Actions-based evolution using Kimi-K2-Thinking

State Model: Dual storage — `[home-path]` (unified dream graph) and `[home-path]` (daemon working files). Bridged by `noosphere_bridge.py`.

Dream Lifecycle: `SEED (0.1) → GERMINATING (0.3) → GROWING (0.5) → FLOWERING (0.7) → BLOOM (0.9+)` (engine) or `gestating → emerging → emerged → metamorphosed` (noosphere).

2.4 Cadence (Multi-Agent Coordination)

Location: `[home-path]`, `Desktop/Comp-Core/.governance/`

ComponentRole
`cadence_bridge.py`Prompt-logger extension detecting INBOX/OUTBOX changes, syncing decisions to Supabase
HIGHER_LEVEL.md / LOWER_LEVEL.mdAgent role definitions with INBOX/OUTBOX protocols
`decisions.jsonl`Trajectory log of agent decisions

State Model: Markdown files with structured INBOX/OUTBOX sections + Supabase `memory_motifs` table.

---

3. Unified Architecture

╔══════════════════════════════════════════════════════════════════════════════╗
║                           UNIFIED AGENT OS (UAOS)                          ║
╠══════════════════════════════════════════════════════════════════════════════╣
║                                                                            ║
║  ┌────────────────────────────────────────────────────────────────────┐    ║
║  │                     CADENCE ORCHESTRATION LAYER                    │    ║
║  │  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌───────────────────┐ │    ║
║  │  │ Scheduler│  │ Router   │  │ Priority │  │ Agent Registry    │ │    ║
║  │  │          │  │          │  │ Queue    │  │ (roles, caps)     │ │    ║
║  │  └────┬─────┘  └────┬─────┘  └────┬─────┘  └───────────────────┘ │    ║
║  └───────┼──────────────┼──────────────┼────────────────────────────┘    ║
║          │              │              │                                   ║
║  ┌───────┼──────────────┼──────────────┼────────────────────────────┐    ║
║  │       ▼              ▼              ▼                             │    ║
║  │                 UNIFIED EVENT BUS                                 │    ║
║  │   ┌─────────────────────────────────────────────────────────┐    │    ║
║  │   │  Topics: dream.*, pulse.*, heartbeat.*, cadence.*       │    │    ║
║  │   │  Format: {type, source, payload, timestamp, trace_id}   │    │    ║
║  │   └─────────────────────────────────────────────────────────┘    │    ║
║  └──────────────────────────────────────────────────────────────────┘    ║
║          │              │              │              │                   ║
║  ┌───────▼──────┐ ┌─────▼──────┐ ┌────▼──────┐ ┌────▼──────────┐       ║
║  │   PULSE      │ │ HEARTBEAT  │ │  DREAM    │ │  CADENCE      │       ║
║  │   ENGINE     │ │ MONITOR    │ │  WEAVER   │ │  AGENTS       │       ║
║  │              │ │            │ │           │ │               │       ║
║  │ • Sessions   │ │ • Checks   │ │ • Seeds   │ │ • Higher-Level│       ║
║  │ • Iterations │ │ • Alerts   │ │ • Evolve  │ │ • Lower-Level │       ║
║  │ • Commits    │ │ • Proactive│ │ • Emerge  │ │ • INBOX/OUTBOX│       ║
║  │ • PRs        │ │ • Batch    │ │ • Morph   │ │ • Decisions   │       ║
║  └──────┬───────┘ └─────┬──────┘ └────┬──────┘ └──────┬────────┘       ║
║         │               │              │               │                 ║
║  ┌──────┴───────────────┴──────────────┴───────────────┴────────┐       ║
║  │                    UNIFIED STATE STORE                        │       ║
║  │                                                               │       ║
║  │  ┌─────────────┐  ┌──────────────┐  ┌──────────────────┐    │       ║
║  │  │ State DB    │  │ Event Log    │  │ Connection Graph │    │       ║
║  │  │ (SQLite)    │  │ (append-only)│  │ (Noosphere)      │    │       ║
║  │  │             │  │              │  │                  │    │       ║
║  │  │ • sessions  │  │ • all events │  │ • nodes          │    │       ║
║  │  │ • dreams    │  │ • decisions  │  │ • edges          │    │       ║
║  │  │ • checks    │  │ • handoffs   │  │ • weights        │    │       ║
║  │  │ • agents    │  │ • signals    │  │ • patterns       │    │       ║
║  │  └─────────────┘  └──────────────┘  └──────────────────┘    │       ║
║  └──────────────────────────────────────────────────────────────┘       ║
║                                                                          ║
╚══════════════════════════════════════════════════════════════════════════════╝

---

4. Unified State Model

4.1 State DB (SQLite — `[home-path]`)

Replace the scattered JSON files with a single SQLite database. Each subsystem gets its own table but can join on shared keys.

sql
-- Core entity: anything the OS tracks
CREATE TABLE entities (
    id          TEXT PRIMARY KEY,
    type        TEXT NOT NULL,  -- 'session', 'dream', 'check', 'agent', 'decision'
    status      TEXT NOT NULL,
    created_at  TEXT NOT NULL DEFAULT (datetime('now')),
    updated_at  TEXT NOT NULL DEFAULT (datetime('now')),
    metadata    TEXT  -- JSON blob for subsystem-specific data
);

-- Pulse sessions
CREATE TABLE sessions (
    id              TEXT PRIMARY KEY REFERENCES entities(id),
    project_name    TEXT NOT NULL,
    project_path    TEXT NOT NULL,
    goal            TEXT,
    current_iteration INTEGER DEFAULT 0,
    max_iterations  INTEGER DEFAULT 10,
    active_account  TEXT,  -- dual-max tracking
    origin_dream_id TEXT REFERENCES entities(id)  -- if born from metamorphosis
);

-- Dream Weaver dreams (unified noosphere + incubation)
CREATE TABLE dreams (
    id                  TEXT PRIMARY KEY REFERENCES entities(id),
    seed_idea           TEXT NOT NULL,
    keywords            TEXT,  -- JSON array
    connection_strength REAL DEFAULT 0.0,
    connections         TEXT,  -- JSON array
    synthesis           TEXT,  -- JSON blob
    approaches          TEXT,  -- JSON array
    pollinated_by       TEXT,  -- JSON array of dream IDs
    metamorphosis       TEXT,  -- JSON blob (pulse goal, confidence)
    phase               TEXT DEFAULT 'seed'  -- seed, germinating, growing, flowering, bloom
);

-- Heartbeat check records
CREATE TABLE checks (
    id          TEXT PRIMARY KEY,
    domain      TEXT NOT NULL,  -- 'dreamWeaver', 'projects', 'calendar', etc.
    checked_at  TEXT NOT NULL DEFAULT (datetime('now')),
    result      TEXT,  -- JSON blob
    alert_level INTEGER DEFAULT 0  -- 0=silent, 1-3=low, 4-6=medium, 7-9=high, 10=critical
);

-- Cadence agents
CREATE TABLE agents (
    id          TEXT PRIMARY KEY REFERENCES entities(id),
    role        TEXT NOT NULL,  -- 'higher_level', 'lower_level', 'pulse_worker', etc.
    inbox       TEXT,  -- JSON array of messages
    outbox      TEXT,  -- JSON array of messages
    capabilities TEXT  -- JSON array
);

-- Cross-system handoff log
CREATE TABLE handoffs (
    id              TEXT PRIMARY KEY,
    from_system     TEXT NOT NULL,  -- 'dream_weaver', 'pulse', 'heartbeat', 'cadence'
    to_system       TEXT NOT NULL,
    entity_id       TEXT REFERENCES entities(id),
    handoff_type    TEXT NOT NULL,  -- 'metamorphosis', 'alert', 'delegation', 'escalation'
    payload         TEXT,  -- JSON
    status          TEXT DEFAULT 'pending',  -- pending, accepted, rejected, completed
    created_at      TEXT NOT NULL DEFAULT (datetime('now')),
    completed_at    TEXT
);

-- Unified event log (append-only)
CREATE TABLE events (
    id          INTEGER PRIMARY KEY AUTOINCREMENT,
    timestamp   TEXT NOT NULL DEFAULT (datetime('now')),
    topic       TEXT NOT NULL,  -- 'pulse.iteration.complete', 'dream.emerged', etc.
    source      TEXT NOT NULL,  -- which subsystem
    entity_id   TEXT,
    payload     TEXT,  -- JSON
    trace_id    TEXT   -- for correlating related events
);

CREATE INDEX idx_events_topic ON events(topic);
CREATE INDEX idx_events_entity ON events(entity_id);
CREATE INDEX idx_events_time ON events(timestamp DESC);
CREATE INDEX idx_handoffs_status ON handoffs(status);

4.2 Connection Graph (Noosphere — preserved)

The noosphere's `ConnectionGraph` (nodes + weighted edges) stays as the semantic layer. But instead of its own JSON files, it reads/writes through the state DB:

  • `entities` + `dreams` tables replace `dreams.json`
  • `events` table replaces the sensing/mycelium state
  • The graph's `nodes` and `edges` remain in `[home-path]` (too graph-specific for SQL) but are indexed in the state DB for cross-system queries

4.3 Event Topics

Topic PatternSourceDescription
`pulse.session.created`PulseNew session started
`pulse.session.status_changed`PulseStatus transition (running→paused, etc.)
`pulse.iteration.started`PulseIteration N begins
`pulse.iteration.completed`PulseIteration N done, includes signal
`pulse.commit`PulseGit commit made
`dream.seed.planted`Dream WeaverNew seed idea planted
`dream.evolved`Dream WeaverEvolution cycle ran
`dream.emerged`Dream WeaverConnection strength ≥ threshold
`dream.metamorphosis.ready`Dream WeaverDream ready for Pulse conversion
`dream.metamorphosis.triggered`Dream WeaverPulse session spawned from dream
`heartbeat.check.completed`HeartbeatA periodic check ran
`heartbeat.alert`HeartbeatAlert raised (level 7+)
`heartbeat.quiet_hours.entered`HeartbeatEntering quiet hours
`heartbeat.quiet_hours.exited`HeartbeatExiting quiet hours
`cadence.message.received`CadenceINBOX message arrived
`cadence.message.sent`CadenceOUTBOX message dispatched
`cadence.decision.made`CadenceDecision logged
`cadence.handoff`CadenceWork handed between agents
`system.startup`UAOSOS booted
`system.shutdown`UAOSOS shutting down

---

5. Inter-System Communication

5.1 Event Bus

The event bus is a lightweight in-process pub/sub system backed by the `events` table. Subsystems don't import each other — they publish events and subscribe to topics.

python
class EventBus:
    """Unified event bus for inter-system communication."""

    def __init__(self, db: StateDB):
        self.db = db
        self._subscribers: Dict[str, List[Callable]] = defaultdict(list)

    def publish(self, topic: str, source: str, payload: dict, entity_id: str = None):
        """Publish an event. Persists to event log and notifies subscribers."""
        event = {
            'topic': topic,
            'source': source,
            'entity_id': entity_id,
            'payload': json.dumps(payload),
            'timestamp': datetime.now().isoformat(),
            'trace_id': current_trace_id()
        }
        self.db.insert_event(event)

        # Notify matching subscribers
        for pattern, handlers in self._subscribers.items():
            if topic_matches(pattern, topic):
                for handler in handlers:
                    handler(event)

    def subscribe(self, pattern: str, handler: Callable):
        """Subscribe to events matching a topic pattern (supports wildcards)."""
        self._subscribers[pattern].append(handler)

5.2 Cross-System Reactions

EventReactionSystem
`dream.emerged`Create Heartbeat alert (level 8)Heartbeat
`dream.metamorphosis.triggered`Create Pulse session with dream contextPulse
`pulse.session.status_changed` → `complete`Update origin dream if from metamorphosisDream Weaver
`pulse.iteration.completed`Feed iteration summary to Mycelium sensingDream Weaver
`heartbeat.alert` (level ≥ 9)Notify via Cadence OUTBOX to higher-level agentCadence
`cadence.handoff` → type `delegation`Create Pulse session for delegated workPulse
`pulse.commit`Log to Connection Graph as implementation nodeDream Weaver

5.3 Handoff Protocols

Metamorphosis: Dream → Pulse

1. Dream Weaver detects dream.connection_strength ≥ 0.85
2. Publishes: dream.metamorphosis.ready {dream_id, confidence, pulse_goal}
3. Cadence Router evaluates priority vs. current Pulse load
4. If approved:
   a. Creates handoff record (from=dream_weaver, to=pulse, type=metamorphosis)
   b. Spawns Pulse session with:
      - goal = dream.metamorphosis.pulse_goal
      - origin_dream_id = dream.id
      - Context: dream synthesis, approaches, connections
   c. Publishes: dream.metamorphosis.triggered
   d. Updates dream status → metamorphosed
5. On Pulse session complete:
   a. Publishes: pulse.session.status_changed {status: complete}
   b. Dream Weaver updates handoff → completed
   c. Links implementation artifacts back to dream

Escalation: Heartbeat → Cadence

1. Heartbeat detects critical issue (alert_level ≥ 9)
2. Publishes: heartbeat.alert {domain, level, details}
3. Cadence receives, creates INBOX message for higher-level agent
4. Higher-level agent decides:
   a. Self-resolve → Cadence publishes resolution
   b. Delegate → Creates cadence.handoff → Pulse session
   c. Escalate → Notify human via Discord/notification

Learning: Pulse → Dream Weaver

1. Pulse iteration completes
2. Publishes: pulse.iteration.completed {summary, files_modified, signal}
3. Dream Weaver Mycelium senses keywords from summary
4. If patterns align with gestating dreams → strengthens connections
5. If novel patterns → creates sensing entries for future dream seeds

---

6. Unified Lifecycle

Every entity in the UAOS follows a unified lifecycle with subsystem-specific phases:

                    ┌─────────────────────────────────────────┐
                    │         UNIFIED ENTITY LIFECYCLE         │
                    ├─────────────────────────────────────────┤
                    │                                         │
                    │  INCEPTION ─── born/planted/triggered   │
                    │      │                                  │
                    │      ▼                                  │
                    │  ACTIVE ───── running/incubating/live   │
                    │      │                                  │
                    │      ├──▶ SUSPENDED (paused/dormant)    │
                    │      │       │                          │
                    │      │       └──▶ ACTIVE (resumed)      │
                    │      │                                  │
                    │      ├──▶ BLOCKED (needs intervention)  │
                    │      │       │                          │
                    │      │       ├──▶ ACTIVE (unblocked)    │
                    │      │       └──▶ TERMINATED (failed)   │
                    │      │                                  │
                    │      ├──▶ TRANSFORMED (metamorphosis)   │
                    │      │       └──▶ new entity created    │
                    │      │                                  │
                    │      └──▶ COMPLETED (goal achieved)     │
                    │                                         │
                    └─────────────────────────────────────────┘
PhasePulseDream WeaverHeartbeatCadence
INCEPTION`session.created``seed.planted``check.scheduled``agent.registered`
ACTIVE`running``gestating/emerging``checking``processing`
SUSPENDED`paused``dormant``quiet_hours``waiting`
BLOCKED`blocked``service_down``escalated`
TRANSFORMED`metamorphosed``delegated`
COMPLETED`complete``emerged/bloom``check.done``resolved`
TERMINATED`failed/aborted``withered``alert.expired``rejected`

---

7. Cross-System Learning

7.1 Knowledge Flow

  Pulse iterations ───▶ summaries ───▶ Mycelium sensing
                                              │
                                              ▼
  Heartbeat alerts ───▶ patterns ───▶ Connection Graph
                                              │
                                              ▼
  Cadence decisions ──▶ motifs ────▶ Dream seed suggestions
                                              │
                                              ▼
                                      Enriched Pulse prompts
                                      (via enriched_spawn.py)

7.2 Feedback Loops

1. Pulse → Dreams: Every completed iteration generates keywords that feed back into the Noosphere's mycelium sensing layer. Successful patterns strengthen existing dream connections.

2. Dreams → Pulse: When a dream reaches metamorphosis threshold, it provides a pre-researched goal with approaches, context, and related plans — far richer than a cold-start Pulse session.

3. Heartbeat → Dreams: Heartbeat's periodic checks surface patterns (recurring failures, emerging trends) that Dream Weaver uses as ambient sensing data.

4. Cadence → All: Multi-agent decisions create trajectory entries that inform future enriched spawn prompts, dream synthesis, and heartbeat priority tuning.

7.3 Shared Context Window

Each subsystem contributes to a shared context object that any subsystem can query:

python
@dataclass
class SharedContext:
    """Cross-system context available to all subsystems."""

    # Recent activity
    active_pulse_sessions: List[SessionSummary]
    gestating_dreams: List[DreamSummary]
    recent_alerts: List[AlertSummary]
    pending_cadence_messages: List[CadenceMessage]

    # Patterns
    hot_keywords: List[str]      # from Mycelium
    recurring_issues: List[str]  # from Heartbeat
    active_themes: List[str]     # from Connection Graph

    # Resource state
    account_usage: DualMaxState   # from Pulse
    quiet_hours: bool             # from Heartbeat
    active_agents: List[str]      # from Cadence

    # Lineage
    recent_handoffs: List[Handoff]
    metamorphosis_chain: List[MetamorphosisLink]

---

8. MCP Server Unification

Currently there are separate MCP servers for Pulse and Dream Weaver. The UAOS provides a single unified MCP server:

Tool Namespace

uaos.pulse.*        — All Pulse tools (start, status, iterate, etc.)
uaos.dream.*        — All Dream Weaver tools (incubate, evolve, view, etc.)
uaos.heartbeat.*    — Heartbeat control (check, status, configure)
uaos.cadence.*      — Cadence tools (message, delegate, escalate)
uaos.context        — Get shared context
uaos.handoff        — Create/query handoffs
uaos.events         — Query event log

New Unified Tools

ToolDescription
`uaos.context`Returns current SharedContext — what's active across all systems
`uaos.handoff.create`Formally hand work between systems
`uaos.handoff.status`Check handoff progress
`uaos.events.query`Search event log with filters
`uaos.dream.metamorphose`One-click dream → Pulse with full context
`uaos.heartbeat.snooze`Temporarily suppress a check domain
`uaos.lineage`Trace an entity's full history across systems

---

9. Daemon Unification

Replace the Dream Weaver daemon (`daemon.py`) with a unified UAOS daemon:

UAOS Daemon
├── Dream Evolution Loop (every 1h) — existing daemon logic
├── Heartbeat Check Loop (every 30m) — existing heartbeat logic
├── Event Processing Loop (continuous) — new
├── Handoff Monitor (every 5m) — new
├── Noosphere Sync (every 15m) — replaces noosphere_bridge.py
└── Account Usage Reset (daily) — from dual_runner.py

Single process, single PID file, single log destination. Each loop runs on its own schedule via an async event loop.

---

10. Security & Isolation

  • State DB is user-read/write only (`chmod 600`)
  • Event payloads never contain raw secrets — only references
  • Cadence INBOX/OUTBOX messages are validated against agent capabilities before routing
  • Handoffs require explicit acceptance — no system can force work onto another
  • Quiet hours are enforced at the event bus level — alerts below level 10 are batched

---

11. Observability

Dashboard Data (queryable via `uaos.context`)

┌──────────────────────────────────────────────────────┐
│  UAOS Dashboard                                      │
├──────────────────────────────────────────────────────┤
│                                                      │
│  🟢 Pulse:  2 active sessions (14/20 iterations)    │
│  🌱 Dreams: 5 gestating, 1 emerging, 12 bloomed     │
│  💓 Beats:  Last check 12m ago, all green            │
│  🤝 Cadence: 0 pending messages                      │
│                                                      │
│  Recent Events:                                      │
│  14:23  pulse.iteration.completed  spore-app #7     │
│  14:15  dream.evolved              config-genome     │
│  14:00  heartbeat.check.completed  projects          │
│  13:45  pulse.commit               motion-to-music   │
│                                                      │
│  Active Handoffs: 1                                  │
│  🦋 dream_20250209_abc123 → pulse_session_xyz       │
│     Status: in_progress (iteration 3/10)             │
│                                                      │
│  Hot Patterns: agent, orchestration, unified, pulse  │
│                                                      │
└──────────────────────────────────────────────────────┘

---

Appendix A: File Layout

[home-path]
├── state.db           # Unified SQLite database
├── graph.json         # Connection graph (Noosphere)
├── config.yaml        # Unified configuration
├── daemon.pid         # Single daemon PID
├── daemon.log         # Unified daemon log
├── events/            # Event log overflow (when DB gets large)
└── backups/           # Daily state.db snapshots

# Legacy paths (symlinked during migration):
[home-path]     → reads from state.db
[home-path] → reads from state.db
[home-path] → reads from state.db
[home-path] → reads from state.db

Promotion Decision

Promote into a technical note or architecture paper with implementation anchors.

Source Anchor

projects/dream-metamorphosis/unified-agent-os/ARCHITECTURE.md

Detected Structure

Method · Evaluation · References · Figures · Code Anchors · Architecture