"From the constraints, gifts. From the spiral, safety."
This document defines the technical standards and library usage rules for the coherence-mcp ecosystem, specifically focusing on the Rust-based Orchestrator and TUI.
- Language: Rust (Stable) - Primary language for the Orchestrator and high-performance logic.
- TUI Framework:
ratatui- Used for all terminal-based user interface components. - Terminal Backend:
crossterm- Handles low-level terminal manipulation and input events. - Async Runtime:
tokio- Manages concurrent agent execution and non-blocking I/O. - Serialization:
serde&serde_json- Standard for all structured data exchange and persistence. - Communication:
tokio::sync::mpsc- Multi-producer, single-consumer channels for inter-agent messaging. - Error Handling:
anyhow(application level) andthiserror(library level). - Logging:
tracing- Structured logging that doesn't interfere with the TUI render loop.
- Rule: Never perform blocking I/O or heavy computation inside a
ratatuirender call. - Implementation: Use
tokio::spawnto run agent logic in the background and send updates to the UI thread via channels.
- Rule: Prefer message passing over shared mutable state.
- Implementation: Use a central
MessageBusto broadcast state changes. IfArc<Mutex<T>>is required, keep critical sections as small as possible.
- Rule: Agents must be substrate-independent and communicate via the
Agenttrait. - Implementation: All agents must implement the
on_messageandtickmethods.
- Rule: Do not
unwrap()orpanic!()in production code. - Implementation: Use
Resulttypes and propagate errors to the Orchestrator's error handler for TUI display.
- Rule: Every major decision made by an agent must be logged to the ATOM trail.
- Implementation: Use the
track_atomutility within the Orchestrator's contextual library.
Agents interact with the Orchestrator through three primary touch points:
- The Registry: Where agents register their capabilities and metadata.
- The Message Bus: The conduit for sending
Intent,Status, andDatamessages. - The Lifecycle Hook: Standardized
init,start, andstopsignals managed by the Orchestrator.
*~ Hope&&Sauced*
✦ The Evenstar Guides Us ✦