Skip to content

fix(core): frontmatter keys are read at top level only, never from nested maps - #255

Merged
Max17190 merged 1 commit into
mainfrom
frontmatter-keys-read-top-level-only
Aug 29, 2026
Merged

fix(core): frontmatter keys are read at top level only, never from nested maps#255
Max17190 merged 1 commit into
mainfrom
frontmatter-keys-read-top-level-only

Conversation

@Max17190

@Max17190 Max17190 commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Why

Round-7 contract audit, the round's one P2, reproduced on a built binary. parse_skill_source and the shared frontmatter_descriptions reader matched name:/description: on TRIMMED lines, last wins, at any depth. The standard skill frontmatter commonly carries a metadata: block; a field of it spelled name: or description: silently stole the skill's identity:

---
name: pdf-tools
description: Extract text and tables from PDF files.
metadata:
  name: internal-scratch
  description: not for the index
---

loaded as skill 'internal-scratch' with description not for the index, the frozen index carried the stolen strings, the #250 portability warning evaluated a name the author never wrote, and --check reported ok. It was the only state found where the verification surface certifies a broken outcome. A description: block scalar containing a line that starts with name: hit the same path, because the name loop had no block-scalar awareness.

Summary

  • Both readers match keys only at the block's top level (no leading indentation). That single rule also excludes block-scalar content, whose lines are always indented past their key, so the name loop needs no scalar tracking.
  • Templates share frontmatter_descriptions, so a description: nested under metadata: in a prompt template no longer becomes the popup line.
  • --spec skills states the top-level rule, so the text and the binary agree.
  • Top-level last-wins semantics for SKILL.md and first-wins for templates are unchanged (fix(skills): read block scalar descriptions instead of indexing the > header #227).

Test Plan

  • a_nested_frontmatter_key_does_not_override_the_skill_name: the reproduction above; asserts the top-level name and description survive. Red on the old readers.
  • a_block_scalar_line_spelling_name_does_not_become_the_name: a description: > scalar containing name: ... prose; asserts the name is untouched and the folded description keeps the line. Red on the old readers.
  • a_nested_description_is_not_the_template_description (templates): a nested-only description leaves the popup line empty. Red on the old readers.
  • Full workspace suite green (exit 0), clippy at zero warnings.

Greptile Summary

This change limits skill and prompt-template frontmatter metadata to unindented top-level keys. Nested map fields and block-scalar prose can no longer replace the displayed skill name or description.

Runtime checks exercised real skill discovery, template discovery, and template invocation. They confirmed that valid top-level metadata remains available, nested keys are ignored, and valid top-level keys appearing after nested or scalar content are still read. The same harness demonstrated the prior nested-template-description behavior on the parent revision and passed on this revision.

No defects were found.

Confidence Score: 5/5

The metadata parsing change is safe to merge based on exercised discovery and invocation behavior.

The affected behavior was checked with real skill and template fixtures, including nested maps, block-scalar content resembling metadata, nested-only template descriptions, and later valid top-level keys. The current implementation produced the intended results.

Files Needing Attention: No files need follow-up attention.

T-Rex T-Rex Logs

What T-Rex did

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "fix(core): frontmatter keys are read at ..." | Re-trigger Greptile

…sted maps

The SKILL.md readers matched name:/description: on trimmed lines, last
wins, at any depth. The standard skill frontmatter commonly carries a
metadata: block; any of its fields spelled name: or description: silently
stole the skill's identity, the frozen index carried the stolen strings,
the #250 portability warning evaluated a name the author never wrote, and
--check certified the file ok. A description block scalar containing a
line starting with name: hit the same path.

Keys now match only at the block's top level (no leading indentation),
which also excludes block-scalar content, whose lines are always indented
past their key. The shared reader fixes templates identically. --spec
skills states the rule.
@Max17190
Max17190 merged commit 1591144 into main Aug 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant