Skip to content

feat: migrate lieutenants to reef, add core services for VM tree architecture#13

Merged
nsluss merged 1 commit intomainfrom
claude/migrate-lieutenants-service-kuEjD
Mar 18, 2026
Merged

feat: migrate lieutenants to reef, add core services for VM tree architecture#13
nsluss merged 1 commit intomainfrom
claude/migrate-lieutenants-service-kuEjD

Conversation

@pranavpatilsce
Copy link
Contributor

@pranavpatilsce pranavpatilsce commented Mar 17, 2026

Summary
Migrates the lieutenants service and its supporting infrastructure from the pi-vers monorepo into reef. This lays the groundwork for reef's VM tree architecture — persistent, long-lived agent sessions that can run locally or on Vers VMs.

What's included

  • Lieutenant service (services/lieutenant/) — persistent conversational agent sessions with tools for creating, messaging, pausing/resuming, and destroying lieutenants. Includes SQLite-backed state, an RPC layer for VM communication, and a runtime that manages lieutenant lifecycles.

  • Registry service (services/registry/) — tracks running Vers VMs and their capabilities. Provides tools to list, inspect, and manage registered VMs, plus a behaviors system for automatic VM lifecycle rules.

  • VM tree service (services/vm-tree/) — hierarchical VM management. Models parent-child relationships between VMs, supports tree-wide operations (pause/resume/destroy subtrees), and persists the tree structure in SQLite.

  • Bootloader service (services/bootloader/) — provisions new Vers VMs by generating cloud-init configs, injecting SSH keys, and bootstrapping fleet agent installation.

  • Vers config service (services/vers-config/) — manages Vers API configuration, authentication, and VM spec defaults (region, size, image).

Context
These services were previously in pi-vers but belong in reef as core infrastructure for multi-VM agent orchestration. The migration brings them over with the reef service module pattern (tools, routes, store, events) while removing pi-vers-specific coupling.

…itecture

Phase 1: Lieutenant service (services/lieutenant/)
- SQLite-backed persistent agent session management
- 8 tools: create, send, read, status, pause, resume, destroy, discover
- Local mode (subprocess) and remote mode (VM-based) support
- RPC process management with event-driven state updates
- HTML dashboard and widget contribution

Phase 2: Registry service (services/registry/)
- Promoted from examples/ to core with SQLite backing
- VM lineage tracking (parent-child relationships)
- Reef config per VM ("DNA" — organs + capabilities)
- Config diff between VMs
- Heartbeat-based liveness, discovery by role

Phase 3: VM Tree service (services/vm-tree/)
- SQLite lineage tree: roof reef → lieutenants → swarm/agent VMs
- Full tree queries (ancestors, descendants, subtrees)
- Category filtering (lieutenant, swarm_vm, agent_vm, infra_vm)
- Organ/capability search across all VMs
- Hourly snapshots via cron (retain last 24)
- Visual tree dashboard

Phase 4: Vers Config service (services/vers-config/)
- Centralized config resolution (env → store → file fallback)
- Replaces ~/.vers/keys.json, config.json, agent-services.json
- API for viewing and setting config overrides

Phase 5: Bootloader service (services/bootloader/)
- VM type profiles: full, swarm, lightweight, infra
- Boot script generation with selective module loading
- VM DNA configuration and tree registration
- Polymorphic VM provisioning

https://claude.ai/code/session_01Y4T4TrePAqaoEwb3UPPa4r
@pranavpatilsce pranavpatilsce marked this pull request as draft March 17, 2026 16:46
@nsluss nsluss marked this pull request as ready for review March 18, 2026 18:07
Copy link

@nsluss nsluss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests pass, code reviewed

@nsluss nsluss merged commit 29c5a04 into main Mar 18, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants