--- kind: spec status: active source_of_truth: true --- # Official Mosaic CLI Capability and Tool Migration - **Workstream:** T78 - **Status:** active requirements contract, implementation held by the M0 gates - **Decision authority:** Jason Woltje - **Design owner:** Vision - **Integration trunk:** `next` This contract is authoritative only on the integration trunk `next`. Branch copies are proposals. Publication does not authorize implementation until the M0 milestone, task-graph, interface, and partition gates pass. ## 1. Purpose Migrate agent-facing operations from directly invoked scripts into documented, first-class command groups in the existing TypeScript and Node.js `mosaic` CLI. The CLI becomes the stable interface for operators, agents, the webUI, future seat containers, and future `mosaicd` execution. The mission also phases out the installed `~/.config/mosaic/tools` script surface. Existing scripts may remain private compatibility adapters only while measured consumers still require them. ## 2. Product alignment Items 1 through 3 implement PRD D8 and D12: 1. The CLI is the primary execution surface. 2. The webUI uses Gateway APIs backed by the same official capability contracts. 3. A missing official capability is built before a webUI bypass is accepted. This contract adds one explicit extension beyond D8 and D12: no harness, skill, or agent receives a separate business-logic path around the CLI and Gateway capability contract. This contract does not replace the fleet north star, issue `#1382`, the fleet configuration contract `#758`, the exact fleet communications contract `#766`, or future container and `mosaicd` specifications. It defines the interfaces those tracks consume. ## 3. Fixed decisions | ID | Decision | | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | T78-D1 | Extend the existing official TypeScript and Node.js `mosaic` CLI. A second Python or shell entrypoint is forbidden. | | T78-D2 | Expose documented groups such as `mosaic git`, `mosaic comms`, and `mosaic ci`. A generic public `mosaic tools` passthrough is forbidden. | | T78-D3 | Resolve homes, endpoints, sockets, tool locations, and runtime paths through the central registry and one typed resolver. Commands do not hard-code them. | | T78-D4 | One rootless container per seat is the target sandbox. It has a read-only root filesystem, no container-runtime socket, and lifecycle through future `mosaicd`. | | T78-D5 | Dispatch is per-site. Localhost `orch-01` alone dispatches USC-seat implementation. Homelab `orch-01` alone dispatches homelab-seat implementation and homelab-owned surfaces. | | T78-D6 | Tmux and fleet-comms remain temporary communications adapters behind a transport-neutral CLI contract. | | T78-D7 | Decommissioning is phased and mechanically enforced. Removal requires zero measured consumers and a discriminating planted-reference control. | Derived security boundary: - `~/.mosaic/tools` is canonical working source during migration. It is not automatically trusted runtime installation state. - Reviewed source is promoted into installed or packaged runtime artifacts. - A multi-writer brain-repository push must not silently replace credential-bearing executable code used by every seat. ## 4. Explicitly rejected alternatives | Alternative | Rejection reason | | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | | Separate Python CLI | Creates a second contract, release path, and policy surface. | | Public `mosaic tools