Skip to main content

Crate midtown

Crate midtown 

Source
Expand description

Midtown - Multi-agent workspace management daemon for Gas Town.

This crate provides the core library for the Midtown daemon, which manages multiple agent workspaces (polecats, refineries, witnesses) in a Git-based workflow system.

§Core Components

  • RPC: JSON-RPC 2.0 protocol for inter-process communication
  • Channels: Append-only message logs for agent coordination
  • Cursors: Per-agent position tracking in message streams
  • Worktrees: Git worktree isolation for coworkers
  • Coworkers: Agent session management via tmux
  • Tmux: Low-level tmux session operations
  • Nudge: Periodic and event-driven nudging for coworkers

§Quick Start

The primary abstractions are Channel for communication and Message for individual messages:

use midtown::{Channel, Message, MessageType};

// Create a channel for agent communication
let channel = Channel::new(temp_dir.path()).unwrap();

// Agents send messages to the channel
channel.send(&Message::text("lead", "Starting build")).unwrap();
channel.send(&Message::status("worker1", "Compiling...")).unwrap();
channel.send(&Message::text("worker1", "Build complete")).unwrap();

// Each agent tracks their read position with cursors
let messages = channel.read_since_cursor("worker2").unwrap();
assert_eq!(messages.len(), 3);

// Subsequent reads only return new messages
channel.send(&Message::text("lead", "Deploy now")).unwrap();
let new_messages = channel.read_since_cursor("worker2").unwrap();
assert_eq!(new_messages.len(), 1);

Re-exports§

pub use coworker::Coworker;
pub use coworker::CoworkerManager;
pub use coworker::CoworkerStatus;
pub use worktree::WorktreeError;
pub use worktree::WorktreeInfo;
pub use worktree::WorktreeManager;

Modules§

agents
Agent system prompt loading.
config
Project-level configuration for midtown.
coworker
Coworker management for the midtown daemon.
daemon
Midtown daemon server.
github_state
Persistent GitHub state for the midtown daemon.
nudge
Agent nudging system for periodic and event-driven reminders.
paths
Path utilities for midtown daemon and clients.
push
Web Push notification support for the Midtown PWA.
rpc
JSON-RPC 2.0 types for daemon communication.
tasks
Claude Code task storage integration.
tmux
Tmux session management for coworker processes.
web
Web server for Svelte mobile app
webhook
GitHub webhook integration
webserver
Standalone multi-project webserver for midtown.
worktree
Git worktree management for coworker isolation.

Structs§

Channel
A channel for agent communication.
Cursor
Cursor state for an agent’s read position in a channel.
Message
A message in the channel log.

Enums§

Error
Errors that can occur in the Midtown daemon.
MessageType
Types of messages that can be sent through a channel.

Type Aliases§

Result
Result type alias for Midtown operations.