YAML Frontmatter Content Separation
When processing Story or ADR files for AI prompts, ALWAYS separate metadata from content.
DO:
- •Extract content by detecting and removing YAML frontmatter delimited by
---markers - •Normalize line endings (
\r\nto\n) before processing - •Trim leading whitespace after frontmatter; preserve trailing whitespace
- •Return entire file as content if no valid frontmatter exists
- •Handle malformed YAML (missing closing
---) by treating entire file as content
DON'T:
- •Include YAML frontmatter (state, score) when sending content to AI prompts
- •Treat
---inside markdown code blocks as frontmatter delimiters - •Modify metadata values during content extraction
Rationale: Models may misinterpret metadata values, produce inappropriate responses, or conflate scoring with content generation if frontmatter is included.