Skip to content

Check_plan

FieldValue
TypeSkill Resource
Source~/.copilot/skills/plan/scripts/check_plan.py
DescriptionNot specified

Source Content

#!/usr/bin/env python3
"""Check a parallel-execution plan for the two properties that make it
actually parallel-safe: disjoint file ownership across workstreams, and
binary (not vague) acceptance criteria per workstream.
Usage: check_plan.py <plan.md>
"""
import re
import sys
VAGUE_WORDS = re.compile(r"\b(should work|looks good|feels right|properly|correctly|as expected)\b", re.IGNORECASE)
def main() -> int:
if len(sys.argv) != 2:
print("Usage: check_plan.py <plan.md>", file=sys.stderr)
return 2
text = open(sys.argv[1], encoding="utf-8").read()
fail = 0
workstreams = re.split(r"^##\s+Workstream", text, flags=re.MULTILINE)[1:]
if not workstreams:
print("❌ no '## Workstream ...' sections found")
return 1
file_owners = {}
for i, ws in enumerate(workstreams, start=1):
files = set(re.findall(r"`([\w./-]+\.\w+)`", ws))
for f in files:
file_owners.setdefault(f, []).append(i)
ac_match = re.search(r"Acceptance [Cc]riteria(.*?)(?:\n##|\Z)", ws, re.DOTALL)
ac_text = ac_match.group(1) if ac_match else ""
if VAGUE_WORDS.search(ac_text):
print(f"❌ workstream {i}: acceptance criteria contains a vague phrase — make it binary (pass/fail, not a feeling)")
fail = 1
elif ac_text.strip():
print(f"✅ workstream {i}: acceptance criteria present and looks binary")
else:
print(f"❌ workstream {i}: no 'Acceptance Criteria' section found")
fail = 1
conflicts = {f: owners for f, owners in file_owners.items() if len(set(owners)) > 1}
if conflicts:
print(f"❌ file(s) owned by more than one workstream — not parallel-safe: {conflicts}")
fail = 1
else:
print("✅ file ownership is disjoint across workstreams")
return fail
if __name__ == "__main__":
raise SystemExit(main())