Search

0004: Use One Shared Workspace Daemon for MCP Clients

On this page

Status: Proposed Date: 2026-06-25 Supersedes: N/A Superseded by: N/A

Context

Tower is used by multiple agents and clients in the same workspace. Each client needs MCP over stdio, but the expensive and stateful parts of the engine are the VFS, Sled index, watcher, extension registry, and sidecar processes.

Running a full independent engine per client would duplicate watchers and extension hosts, amplify filesystem contention, and create divergent indexes.

Candidates

OptionProsCons
One daemon per workspace with thin tower mcp clientsShared state, single watcher, consistent extension stateRequires socket lifecycle and idle management
One engine per MCP clientSimple stdio lifecycleDuplicates state and can create inconsistent indexing
One global daemon for all workspacesCentralized managementHarder isolation, workspace-specific config, and cleanup

Decision

We will run one shared daemon per workspace. tower mcp is a thin stdio client that connects to or spawns the daemon. The daemon owns the Sled index, watcher, extension registry, and sidecar processes, and listens on <workspace>/.tower/daemon.sock.

The daemon serves one MCP session per connected client over shared state. It self-terminates after the configured idle timeout when no clients remain.

Consequences

What becomes easier:

  • Multiple agents observe one coherent workspace state.
  • Only one watcher and extension registry operate per workspace.
  • Sidecar lifecycle is centralized.

What becomes harder:

  • The daemon must handle concurrent clients safely.
  • Socket cleanup, idle timeout, and connect-or-spawn behavior become part of the runtime contract.

Constitution Compliance

PrincipleStatusJustification
Multi-agent modelCompliantThe decision makes the daemon the shared workspace authority.
Low contentionCompliantShared state avoids duplicate watchers and indexes.
Operational clarityCompliantRuntime ownership lives in one foreground daemon process.

View original on GitHub