feat: Two-way job messaging (inbox/outbox)
Source
Audit report — Section 9: Phase 3 Roadmap
Prerequisites
- #74 — Notifications route to active session instead of launching session. Without session-aware routing, messages will be delivered to the wrong session when users multitask.
Description
Currently, communication between the main session and spawned jobs is one-directional: the main session can mc_capture output, and jobs can mc_report status. There is no structured messaging channel for the main session to send instructions to a running job or for jobs to request information.
Proposed Solution
Implement a simple inbox/outbox messaging system:
- Outbox (job → main): Jobs can post structured messages (not just status) — e.g., "Need clarification on X", "Found issue Y, should I fix?"
- Inbox (main → job): Main session can send messages to running jobs — e.g., "Also handle edge case Z", "Prioritize the auth fix"
- Message format: JSON with type, content, timestamp, read/unread status
- Storage: Per-job message files in the job's state directory
- Surfacing: Messages appear in
mc_status,mc_overview, and notifications
Use Cases
- Redirecting a running job without killing and relaunching
- Job asking for clarification before proceeding
- Main session providing additional context discovered after launch
- Cross-job coordination in complex plans
Priority
P3 — nice to have. Current workaround is to kill and relaunch with updated prompt.
Superseded by #65 (serve-based orchestration). The SDK + SSE approach in #65 Phase 4 provides native bidirectional communication — real-time event streams (job → main) and programmatic session control via client.session.prompt() (main → job) — making a file-based inbox/outbox unnecessary.