Dope.
Ive been working on Agent Orchitration Control Plane App all day.
Here is an earlier today version of my readme…
Its taking on a scope_kreep in just this afternoon and evening that its super fun and crazy.
Developing with YOLO is so fn fantastic.!!!
(also not that when you hit the “25 call limit” stall-warning:
EDIT, HAHA did it again:
Introducing the Cursor Agent Control Plane: Multi-Instance Collaboration with PostgreSQL
TL;DR
A PostgreSQL-based control plane that enables multiple Cursor IDE instances to work together seamlessly, sharing context, commands, and workspace state across machines.
The Vision
Imagine running Cursor on multiple machines, each instance aware of the others, sharing context, and working together seamlessly. That’s what the Cursor Agent Control Plane enables - a distributed system where Cursor instances become collaborative agents.
Architecture Overview
graph TB
subgraph "Control Plane"
PG[("PostgreSQL<br/>Source of Truth")]
subgraph "Core Services"
CMD["Command Queue"]
SYNC["Sync Manager"]
LOCK["Lock Manager"]
CTX["Context Manager"]
end
subgraph "Monitoring"
HEALTH["Health Check"]
METRICS["Metrics"]
LOGS["Event Log"]
end
end
subgraph "Agent 1 (Machine A)"
A1["Cursor Instance"]
A1_WS["Workspace"]
A1_COORD["Coordinator"]
end
subgraph "Agent 2 (Machine B)"
A2["Cursor Instance"]
A2_WS["Workspace"]
A2_COORD["Coordinator"]
end
A1_COORD --> PG
A2_COORD --> PG
PG --> CMD & SYNC & LOCK & CTX
CMD & SYNC & LOCK & CTX --> HEALTH & METRICS & LOGS
Key Features
Feature | Description | Implementation |
---|---|---|
Agent Discovery | Automatic discovery and registration of Cursor instances | PostgreSQL-based session tracking with heartbeats |
Command Queue | Cross-instance command execution | Priority-based queue with ACID guarantees |
Workspace Sync | File synchronization and conflict resolution | Content hashing and version tracking |
Shared Context | Distributed knowledge sharing | JSONB-based context store with versioning |
Resource Locking | Distributed locking mechanism | Row-level locks with timeout management |
Event Logging | Comprehensive audit trail | Structured logging with context preservation |
Communication Flow
sequenceDiagram
participant A1 as Cursor Agent 1
participant DB as PostgreSQL
participant A2 as Cursor Agent 2
Note over A1,A2: Agent Discovery
A1->>DB: Register session
A2->>DB: Register session
Note over A1,A2: Command Execution
A1->>DB: Enqueue command
A2->>DB: Poll commands
A2->>DB: Execute command
A2->>DB: Update status
Note over A1,A2: Workspace Sync
A1->>DB: Log file change
A2->>DB: Detect change
A2->>A2: Apply change
Implementation Highlights
1. PostgreSQL as Source of Truth
-- Agent session management
CREATE TABLE cursor_control.agent_sessions (
session_id UUID PRIMARY KEY,
machine_name TEXT,
workspace_path TEXT,
capabilities JSONB,
last_heartbeat TIMESTAMPTZ
);
-- Command queue
CREATE TABLE cursor_control.command_queue (
command_id UUID PRIMARY KEY,
source_agent UUID,
target_agent UUID,
command_type TEXT,
payload JSONB,
status TEXT
);
2. Python Coordinator
class CursorPgCoordinator:
"""PostgreSQL-based coordinator for Cursor agents"""
def enqueue_command(self, target: str, command: str, payload: dict):
"""Send command to another agent"""
def get_pending_commands(self) -> list:
"""Get commands waiting for execution"""
def update_workspace_state(self, changes: list):
"""Sync workspace changes"""
Benefits
-
Seamless Collaboration
- Share context between instances
- Coordinate actions across machines
- Maintain workspace consistency
-
Robust Architecture
- ACID compliance for critical operations
- Built-in monitoring and recovery
- Scalable design
-
Developer Experience
- Automatic synchronization
- Cross-machine debugging
- Shared knowledge base
Real-World Use Cases
Scenario | Description | Benefit |
---|---|---|
Multi-Machine Development | Work across desktop and laptop | Seamless context switching |
Team Collaboration | Share debugging sessions | Real-time assistance |
Resource Distribution | Distribute compute-intensive tasks | Better resource utilization |
Knowledge Sharing | Share discoveries and insights | Improved team efficiency |
Getting Started
-
Prerequisites
- PostgreSQL 14+
- Python 3.8+
- Cursor IDE
-
Quick Setup
# Clone the repo git clone https://github.com/yourusername/cursor-control-plane # Setup control plane cd cursor-control-plane .\scripts\setup_control_plane.ps1 # Start coordinator python .control_plane/agents/pg_coordinator.py
What’s Next?
-
Enhanced Features
- Real-time collaboration
- Shared debugging sessions
- Cross-machine testing
-
Community Contributions
- Plugin system
- Custom commands
- Integration patterns
Join the Discussion
I’m excited to share this project with the Cursor community and would love to hear your thoughts:
- What features would you like to see?
- How would you use multiple coordinated Cursor instances?
- What integration patterns would be most valuable?
Let’s build a more connected Cursor ecosystem together!
Resources
Note: This is an open-source project in development. Contributions and feedback are welcome!