From caaa0e6a466eefe6c55ade83cfffcdad001a2d12 Mon Sep 17 00:00:00 2001 From: Jason Woltje Date: Tue, 17 Feb 2026 13:31:29 -0600 Subject: [PATCH] add matrix orchestrator rail and repo scaffolding --- README.md | 16 ++ STANDARDS.md | 1 + bin/mosaic-bootstrap-repo | 7 + bin/mosaic-doctor | 2 + bin/mosaic-orchestrator-run | 12 + rails/orchestrator-matrix/README.md | 50 ++++ rails/orchestrator-matrix/adapters/README.md | 52 ++++ .../mosaic_orchestrator.cpython-311.pyc | Bin 0 -> 14282 bytes .../controller/mosaic_orchestrator.py | 259 ++++++++++++++++++ .../protocol/event.schema.json | 64 +++++ .../protocol/task.schema.json | 49 ++++ templates/repo/.mosaic/README.md | 16 ++ .../repo/.mosaic/orchestrator/config.json | 19 ++ .../repo/.mosaic/orchestrator/logs/.gitkeep | 1 + .../.mosaic/orchestrator/results/.gitkeep | 1 + .../repo/.mosaic/orchestrator/state.json | 4 + .../repo/.mosaic/orchestrator/tasks.json | 16 ++ 17 files changed, 569 insertions(+) create mode 100755 bin/mosaic-orchestrator-run create mode 100644 rails/orchestrator-matrix/README.md create mode 100644 rails/orchestrator-matrix/adapters/README.md create mode 100644 rails/orchestrator-matrix/controller/__pycache__/mosaic_orchestrator.cpython-311.pyc create mode 100755 rails/orchestrator-matrix/controller/mosaic_orchestrator.py create mode 100644 rails/orchestrator-matrix/protocol/event.schema.json create mode 100644 rails/orchestrator-matrix/protocol/task.schema.json create mode 100644 templates/repo/.mosaic/orchestrator/config.json create mode 100644 templates/repo/.mosaic/orchestrator/logs/.gitkeep create mode 100644 templates/repo/.mosaic/orchestrator/results/.gitkeep create mode 100644 templates/repo/.mosaic/orchestrator/state.json create mode 100644 templates/repo/.mosaic/orchestrator/tasks.json diff --git a/README.md b/README.md index 6880c66..d8de5ca 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,22 @@ Templates currently supported: - `typescript-nextjs` - `monorepo` +## Matrix Orchestrator Rail + +Mosaic includes a runtime-agnostic orchestrator rail at: + +- `~/.mosaic/rails/orchestrator-matrix/` + +Run from a bootstrapped repo: + +```bash +~/.mosaic/bin/mosaic-orchestrator-run --once +~/.mosaic/bin/mosaic-orchestrator-run --poll-sec 10 +``` + +The controller reads/writes repo-local state in `.mosaic/orchestrator/` and emits +structured events to `.mosaic/orchestrator/events.ndjson` for Matrix bridge consumption. + ## Bootstrap Any Repo (Slave Linkage) Attach any repository/workspace to the master layer: diff --git a/STANDARDS.md b/STANDARDS.md index d7a98c2..d0dfd79 100644 --- a/STANDARDS.md +++ b/STANDARDS.md @@ -21,6 +21,7 @@ Master/slave model: - Run validation checks before claiming completion. - Apply quality rails from `~/.mosaic/rails/` when relevant (review, QA, git workflow). - For project-level mechanical enforcement templates, use `~/.mosaic/rails/quality/` via `~/.mosaic/bin/mosaic-quality-apply`. +- For runtime-agnostic delegation/orchestration, use `~/.mosaic/rails/orchestrator-matrix/` with repo-local `.mosaic/orchestrator/` state. - Avoid hardcoded secrets and token leakage in remotes/commits. - Do not perform destructive git/file actions without explicit instruction. diff --git a/bin/mosaic-bootstrap-repo b/bin/mosaic-bootstrap-repo index 71d09d5..1a4210d 100755 --- a/bin/mosaic-bootstrap-repo +++ b/bin/mosaic-bootstrap-repo @@ -37,6 +37,7 @@ if [[ ! -d "$TEMPLATE_ROOT" ]]; then fi mkdir -p "$TARGET_DIR/.mosaic" "$TARGET_DIR/scripts/agent" +mkdir -p "$TARGET_DIR/.mosaic/orchestrator" "$TARGET_DIR/.mosaic/orchestrator/logs" "$TARGET_DIR/.mosaic/orchestrator/results" copy_file() { local src="$1" @@ -54,6 +55,11 @@ copy_file() { copy_file "$TEMPLATE_ROOT/.mosaic/README.md" "$TARGET_DIR/.mosaic/README.md" copy_file "$TEMPLATE_ROOT/.mosaic/repo-hooks.sh" "$TARGET_DIR/.mosaic/repo-hooks.sh" copy_file "$TEMPLATE_ROOT/.mosaic/quality-rails.yml" "$TARGET_DIR/.mosaic/quality-rails.yml" +copy_file "$TEMPLATE_ROOT/.mosaic/orchestrator/config.json" "$TARGET_DIR/.mosaic/orchestrator/config.json" +copy_file "$TEMPLATE_ROOT/.mosaic/orchestrator/tasks.json" "$TARGET_DIR/.mosaic/orchestrator/tasks.json" +copy_file "$TEMPLATE_ROOT/.mosaic/orchestrator/state.json" "$TARGET_DIR/.mosaic/orchestrator/state.json" +copy_file "$TEMPLATE_ROOT/.mosaic/orchestrator/logs/.gitkeep" "$TARGET_DIR/.mosaic/orchestrator/logs/.gitkeep" +copy_file "$TEMPLATE_ROOT/.mosaic/orchestrator/results/.gitkeep" "$TARGET_DIR/.mosaic/orchestrator/results/.gitkeep" for file in "$TEMPLATE_ROOT"/scripts/agent/*.sh; do base="$(basename "$file")" @@ -97,6 +103,7 @@ fi echo "[mosaic] Repo bootstrap complete: $TARGET_DIR" echo "[mosaic] Next: edit $TARGET_DIR/.mosaic/repo-hooks.sh with project workflows" echo "[mosaic] Optional: apply quality rails via ~/.mosaic/bin/mosaic-quality-apply --template