dse120071750/m8m-harness-builder / skills/m8m/m8m-harness-builder
m8m-harness-builder
FlaggedBuild and edit M8M harnesses that coordinate existing tools and FlowSteps, validate milestone outputs, and track progress and resume. Reuse working implementations in place. Compile workflow changes without runtime packaging; build portable packages when requested and deliver server installations through the dedicated M8M server installer.
scripts/coordinate_workflow.py
View on GitHub"""Compile workflow edits against existing tools without creating a runtime release."""
from __future__ import annotations
import os
import sys
import tempfile
from pathlib import Path
from typing import Any
import yaml
from flowstep_runtime import FlowError
from flowstep_tools import infer_codebase
from skill_source import SkillSourceError, compile_skill_source
from teaching_contracts import write_milestone_gems
from validate_harness import validate_harness
def prepare_workflow(target: Path, codebase: Path, *, flow_id: str | None = None) -> dict[str, Any]:
"""Validate in place, then refresh the flow snapshot and milestone outlines.
Authored prompts and existing implementations remain intact.
A temporary sibling allows validation before changing the runnable snapshot.
Packaging and provider operations are deliberately absent from this path.
"""
target, codebase = target.resolve(), codebase.resolve()
if infer_codebase(target) != codebase:
raise FlowError(
"coordinate --target must be the authored harness at "
"<codebase>/flowsteps/flows/<flow_id>; keep existing tools in place "
"and add only the required workflow bindings there"
)
temporary: Path | None = None
snapshot = target / "flow.yaml"
packaged = (target / "m8m-runtime-lock.json").exists()
prompt_files: list[str] = []
try:
if (target / "agents" / "openai.yaml").is_file():
definition = compile_skill_source(target, check_snapshot=False)
if target.name != definition["flow_id"] or (flow_id and flow_id != definition["flow_id"]):
raise FlowError("authored flow_id must match the harness directory and --flow-id")
payload = yaml.safe_dump(definition, sort_keys=False, allow_unicode=True).encode("utf-8")
if snapshot.is_symlink():
raise FlowError("generated flow.yaml must not be a symbolic link")
with tempfile.NamedTemporaryFile(dir=target, prefix=".flow-", suffix=".yaml", delete=False) as stream:
temporary = Path(stream.name)
stream.write(payload)
validation = validate_harness(target, str(temporary), update_instruction=False, scope="workflow")
else:
# An already authored v4 flow remains usable; no forced dialect migration.
validation = validate_harness(target, update_instruction=False, scope="workflow")
if target.name != validation["flow_id"] or (flow_id and flow_id != validation["flow_id"]):
raise FlowError("flow_id must match the harness directory and --flow-id")
definition = yaml.safe_load(snapshot.read_text(encoding="utf-8-sig"))
# Installed packages keep their immutable source. Their build path writes
# these outlines before packaging; coordination never edits their pins.
if not packaged:
docs = []
for milestone in definition["milestones"]:
item = dict(milestone)
if (target / "agents" / "openai.yaml").is_file():
agent = yaml.safe_load((target / "agents" / f"{item['id']}.yaml").read_text(encoding="utf-8-sig"))
item["observer"] = agent.get("observer") or {}
docs.append(item)
prompt_files = write_milestone_gems(target, docs)
if temporary is not None and (not snapshot.is_file() or snapshot.read_bytes() != temporary.read_bytes()):
os.replace(temporary, snapshot)
temporary = None
except (SkillSourceError, OSError) as exc:
raise FlowError(str(exc)) from exc
finally:
if temporary is not None:
temporary.unlink(missing_ok=True)
runner = ([sys.executable, str(target / "launch.py")] if packaged else
[sys.executable, str(Path(__file__).with_name("run_flow.py")),
"--execution-mode", "coordination", "--skill-dir", str(target)])
return {
"status": "PASS", "mode": "coordinate", "flow_id": validation["flow_id"],
"harness_dir": str(target), "flow_path": str(snapshot),
"milestones": validation["steps"], "validation_scope": "workflow",
"updated_milestone_documents": prompt_files,
"runtime": "existing_packaged_launcher" if packaged else "installed_coordination_runner",
"run_command": runner,
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| planning-and-task-breakdownaddyosmani/agent-skillsBreaks work into ordered tasks. Use when you have a spec or clear requirements and need to break work into implementable tasks. Use when a task feels too large to start, when you need to estimate scope, or when parallel work is possible. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| screenpipethedotmack/claude-memSearch screen and audio history recorded by Screenpipe and optionally save selected context into claude-mem. Use when the user asks to recall desktop activity, a meeting, or something seen in another app through Screenpipe. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| contact-widgetnexu-io/open-designSelf-contained floating chat widget with welcome screen, social links, meeting button, and message input. Single HTML file, zero dependencies. | Stars: 108k | Updated | Claude CodeCodex | Verified | Install |
| meeting-notesnexu-io/open-designMeeting notes page — title bar with attendees, agenda checklist, decisions block, action items table with owners + dates, and a "next meeting" footer. Use when the brief mentions "meeting notes", "minutes", "1:1 notes", "all-hands recap", or "会议纪要". | Stars: 108k | Updated | Claude CodeCodex | Verified | Install |