diff --git a/skills/session-handoff/scripts/validate_handoff.py b/skills/session-handoff/scripts/validate_handoff.py index ad1e3c1..892e983 100755 --- a/skills/session-handoff/scripts/validate_handoff.py +++ b/skills/session-handoff/scripts/validate_handoff.py @@ -64,15 +64,15 @@ def check_required_sections(content: str) -> tuple[bool, list[str]]: """Check that required sections exist and have content.""" missing = [] for section in REQUIRED_SECTIONS: - # Look for section header - pattern = rf'(?:^|\n)##?\s*{re.escape(section)}' + # Look for section header at any heading depth (# through ######) + pattern = rf'(?:^|\n)#{{1,6}}\s*{re.escape(section)}' match = re.search(pattern, content, re.IGNORECASE) if not match: missing.append(f"{section} (missing)") else: # Check if section has meaningful content (not just placeholder) section_start = match.end() - next_section = re.search(r'\n##?\s+', content[section_start:]) + next_section = re.search(r'\n#{1,6}\s+', content[section_start:]) section_end = section_start + next_section.start() if next_section else len(content) section_content = content[section_start:section_end].strip() @@ -87,7 +87,7 @@ def check_recommended_sections(content: str) -> list[str]: """Check which recommended sections are missing.""" missing = [] for section in RECOMMENDED_SECTIONS: - pattern = rf'(?:^|\n)##?\s*{re.escape(section)}' + pattern = rf'(?:^|\n)#{{1,6}}\s*{re.escape(section)}' if not re.search(pattern, content, re.IGNORECASE): missing.append(section) return missing