synwire-daemon 0.1.0

Singleton background daemon for Synwire — manages embeddings, indexing, and multi-repo state
Documentation

synwire-daemon

Singleton background daemon for Synwire. Manages the embedding model, file watchers, indexing pipelines, and multi-repo/worktree state for a single product. MCP servers connect via a Unix domain socket as thin stdio-to-UDS proxies.

What this crate provides

  • RepoManager -- central coordinator that tracks active worktrees, registers projects by WorktreeId, and evicts idle entries via LRU
  • WorktreeHandle / WorktreeStatus -- per-worktree runtime state (Idle, Indexing, Ready)
  • Lifecycle management -- PID file, Unix domain socket listener, signal handling, 5-minute grace period after last client disconnects
  • IPC protocol -- framed messaging over Unix domain sockets for MCP server communication
  • Indexing orchestration -- triggers and coordinates walk/chunk/embed/store pipelines per worktree
  • Auto-launch -- spawned as a detached process by the first MCP server; no systemd or launchctl required
  • Zero unsafe code -- #![forbid(unsafe_code)]

Quick start

[dependencies]
synwire-daemon = "0.1"

The daemon binary reads SYNWIRE_PRODUCT (defaults to "synwire") and stores state under StorageLayout::data_home():

use synwire_daemon::{RepoManager, WorktreeStatus};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let manager = RepoManager::new(storage_layout, 32)?;
    let handle = manager.register("/home/user/project").await?;
    assert_eq!(handle.status(), WorktreeStatus::Idle);
    Ok(())
}

Documentation