Skip to content

fix(skills): YAML comments for frontmatter story tags, and a gate that rejects what pi rejects - #221

Merged
danielvm-git merged 4 commits into
mainfrom
fix/skills-frontmatter-173-207
Nov 6, 2026
Merged

danielvm-git merged 4 commits into
mainfrom
fix/skills-frontmatter-173-207

Conversation

@danielvm-git

Copy link
Copy Markdown
Owner

What this fixes

Two defects that are the same failure seen from the artifact and the gate.

#173 — pi drops 10 skills. pi 1.5.0 parses SKILL.md frontmatter with the yaml package (uniqueKeys on by default). A <!-- story: eNNsNN --> line inside the --- block is a mapping entry, not a comment, so a second marker repeats the key and the whole block throws Map keys must be unique — pi discards the skill. 22 sources carried the form (43 markers); the 10 with 2+ markers were dropped on every install: audit-code, craft-skill, deepen-architecture, develop-tdd, gate-trace, plan-work, request-review, run-benchmark, stocktake-skills, validate-fix. Frontmatter tags are now # comments; body tags keep the HTML form, which is legal below the closing delimiter.

#207 — the gate could not see it. validate-skill-yaml.py used PyYAML (duplicate keys last-wins) and its docstring allowed <!-- story: --> inside the block, so it reported PASS 160/160 while pi rejected 10 files. Added two dependency-free rules that also fire with the bundled simple_yaml fallback: R4 no HTML comment inside the block, R5 no duplicate top-level key.

Evidence

Validator against the pre-fix tree (git archive HEAD skills, before the data commit):

run-benchmark: R4 HTML comment inside frontmatter at line 4 …
validate-fix:  R4 HTML comment inside frontmatter at line 5 …
FAIL: 22 issues (0 delimiter + 0 parse + 0 semantic + 22 structure)

After the fix, with pi 1.5.0's own parser (require("yaml").parse from the installed host):

pi-parser failures: 0
frontmatter keys in use: description, effort, model, name, phase

New tests/test-skill-frontmatter-strict.sh (5 checks, wired into the golden suite):

ok   T1 rejects HTML comment inside frontmatter (R4)
ok   T2 rejects duplicate frontmatter key (R5)
ok   T3 accepts '#' story comments inside frontmatter
ok   T4 accepts HTML story tag in the body
ok   T5 repository SKILL.md frontmatter passes strict rules

Gates

  • Baseline before any change: compliance 0, gates 56/56, trace-stories --strict 0 (green).
  • After: npm run compliance 0, bash scripts/run-verification-gates.sh 57/57 (the new gate included), trace-stories --strict 0.
  • Generated targets (.pi/skills, .cursor/rules, .gemini/extensions/bigpowers, website/) are byte-identical: they render from body only, so no regeneration was needed. skills-lock.json refreshed.
  • Not touched, by design: model/effort/phase are bigpowers extensions rather than spec keys — separating them is epic: move bigpowers metadata out of the Agent Skills frontmatter contract #215, out of this PR.

Closes #173
Closes #207

pi parses SKILL.md frontmatter with the yaml package, where uniqueKeys is on
by default. A '<!-- story: eNNsNN -->' line inside the --- block is a mapping
entry, not a comment: two of them repeat the key and the block throws
'Map keys must be unique', so pi drops the skill entirely.

22 sources carried the form (43 markers, 2 of them with several ids on one
line); of those, the ones with 2+ markers were dropped: audit-code,
craft-skill, deepen-architecture, develop-tdd, gate-trace, plan-work,
request-review, run-benchmark, stocktake-skills, validate-fix.

Frontmatter tags are now '#' comments; body tags keep the HTML form, which
is legal below the closing delimiter. Verified with pi 1.5.0's own parser:
80/80 sources parse, frontmatter keys are name, description, model, effort,
phase.

Refs #173
PyYAML accepts duplicate keys last-wins and the docstring allowed
'<!-- story: -->' inside the block, so the validator reported PASS on 160
files while pi rejected 10 of them.

Add two dependency-free structural rules that fire even with the bundled
simple_yaml fallback:

  R4  no HTML comment inside the frontmatter block
  R5  no duplicate top-level key

New tests/test-skill-frontmatter-strict.sh drives the real validator over
throw-away trees (reject R4, reject R5, accept '#' comments, accept body
HTML comments, repository clean) and is wired into the golden gate suite.
On the pre-fix tree the new rules report 22 violations across 22 files; on
this branch they pass.

Refs #207
Eleven bug records (ten from GitHub #173, #207, #208-#212, #218-#220 plus
the local sync-artifact churn finding) so progress survives context loss.
specs/bugs/registry.yaml regenerated from the records.
@danielvm-git
danielvm-git merged commit 28110b8 into main Nov 6, 2026
7 checks passed
@danielvm-git
danielvm-git deleted the fix/skills-frontmatter-173-207 branch November 6, 2026 17:48
github-actions Bot pushed a commit that referenced this pull request Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 2.93.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

danielvm-git added a commit that referenced this pull request Nov 6, 2026
The bug batch shipped through PRs #221-#227 and the trace-worktrees fix #203,
but the records stayed open; two omp defects (#119, #189) were fixed in code
without the record updated, and pi-scripts-provisioning was fixed by PR #117.
Record the evidence and regenerate the registry.

Remaining open: cli-nontty-silent-noop (parked #201),
dev-dependency-advisories (accepted: dev-only), story-verify-e58-eval-flake
(epic done, flake not reproduced).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

1 participant