#!/usr/bin/env python3
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
SKILL = ROOT / "skills" / "gpt-workflow" / "SKILL.md"

assert SKILL.is_file(), f"missing global skill source: {SKILL}"
text = SKILL.read_text(encoding="utf-8")
normalized = text.lower()

required = (
    "name: gpt-workflow",
    "audience: ai coding agents first.",
    "main session is sole orchestrator",
    "/gpt-orchestrator",
    "gpt-5.6 luna",
    "gpt-5.6 terra",
    "maximum eight",
    "55–75 seconds",
    "baseline commit",
    "baseline tree",
    "candidate tree",
    "diff_sha256",
    "changed_paths_sha256",
    "implementation conversation id",
    "fresh ask-gpt pro",
    "resumes original implementation conversation",
    "correction_required",
    "guarded landing",
    "installed-entrypoint proof",
    "process death never means cancellation",
    "never self-edit from model opinion",
)
missing = [item for item in required if item not in normalized]
assert not missing, f"missing required contracts: {missing}"

assert "luna must not design, decompose, review, fix, apply, integrate, land" in normalized
assert "terra must not dispatch children" in normalized
assert "subagents must not invoke `cdx`" in normalized
assert "one main-owned send queue" in normalized
assert "review must not use a moving worktree" in normalized
assert "verification delta → fresh review" in normalized
assert "never restart from scratch" in normalized
assert len(text.splitlines()) < 400, "SKILL.md exceeds focused skill limit"

print("gpt-workflow skill contract: PASS")
