From 7ba6d4ead90d97f574d104d8adc9b8b6e0fb7739 Mon Sep 17 00:00:00 2001 From: chablino Date: Mon, 23 Mar 2026 20:40:37 +0800 Subject: [PATCH 1/3] Fix: Support multiline string parsing (|) in markdown frontmatter --- agents/s05_skill_loading.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/agents/s05_skill_loading.py b/agents/s05_skill_loading.py index 07e580e82..bb1a17469 100644 --- a/agents/s05_skill_loading.py +++ b/agents/s05_skill_loading.py @@ -42,6 +42,7 @@ from anthropic import Anthropic from dotenv import load_dotenv +import yaml load_dotenv(override=True) @@ -69,18 +70,24 @@ def _load_all(self): meta, body = self._parse_frontmatter(text) name = meta.get("name", f.parent.name) self.skills[name] = {"meta": meta, "body": body, "path": str(f)} - - def _parse_frontmatter(self, text: str) -> tuple: + + def _parse_frontmatter(self, text: str) -> tuple[dict, str]: """Parse YAML frontmatter between --- delimiters.""" match = re.match(r"^---\n(.*?)\n---\n(.*)", text, re.DOTALL) if not match: return {}, text - meta = {} - for line in match.group(1).strip().splitlines(): - if ":" in line: - key, val = line.split(":", 1) - meta[key.strip()] = val.strip() - return meta, match.group(2).strip() + + yaml_text = match.group(1).strip() + body_text = match.group(2).strip() + + try: + meta = yaml.safe_load(yaml_text) + if meta is None: + meta = {} + except yaml.YAMLError as e: + print(f"YAML Parsing error: {e}") + meta = {} + return meta, body_text def get_descriptions(self) -> str: """Layer 1: short descriptions for the system prompt.""" From 48c44ad0371fc4c18c534e25641d15a6b4ab1890 Mon Sep 17 00:00:00 2001 From: chablino Date: Mon, 23 Mar 2026 20:55:38 +0800 Subject: [PATCH 2/3] Chore: Actually add PyYAML to requirements.txt --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 55f896d40..8f8229d51 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ anthropic>=0.25.0 python-dotenv>=1.0.0 +PyYAML>=6.0 \ No newline at end of file From e9f5afe066a73e284fcb92667e0c3a45ad907486 Mon Sep 17 00:00:00 2001 From: to7for <31083461+chablino@users.noreply.github.com> Date: Mon, 23 Mar 2026 21:01:41 +0800 Subject: [PATCH 3/3] Update agents/s05_skill_loading.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- agents/s05_skill_loading.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/agents/s05_skill_loading.py b/agents/s05_skill_loading.py index bb1a17469..7fdea081b 100644 --- a/agents/s05_skill_loading.py +++ b/agents/s05_skill_loading.py @@ -81,8 +81,9 @@ def _parse_frontmatter(self, text: str) -> tuple[dict, str]: body_text = match.group(2).strip() try: - meta = yaml.safe_load(yaml_text) - if meta is None: + meta = yaml.safe_load(yaml_text) + # Ensure frontmatter is a mapping; fall back to empty dict otherwise. + if meta is None or not isinstance(meta, dict): meta = {} except yaml.YAMLError as e: print(f"YAML Parsing error: {e}")