Files
bacca87 29e384cda2 fix(skills): parser-safe title/summary in canonical page template and server write_page (#207)
* fix(skills): parser-safe title/summary in canonical page template and server write_page

The canonical Page Template in llm-wiki/SKILL.md showed `title:` and
`summary:` as bare YAML scalars, and server.py write_page interpolated
them the same way. Free-text values containing ": " (colon + space),
"#", or quotes break YAML parsing - Obsidian then reports "Invalid
properties" and hides the frontmatter. Any ingest following the
canonical template can corrupt pages this way: one real vault ended up
with 25 unparseable pages from a single ingest of colon-heavy technical
summaries.

PR #3 already fixed wiki-update's own template with folded scalars; the
canonical template every other write skill follows (wiki-ingest: "Use
the page template from the llm-wiki skill") was left unguarded, and PR
#2 (quoted variant) was closed unmerged. PR #103's OKF export now
auto-repairs unquoted colons at read time - this fixes the source.

- llm-wiki/SKILL.md: Page Template (and the project-overview example)
  now emit title/summary as folded scalars (>-), with explicit
  parser-safety guidance matching wiki-update's merged wording.
- server.py write_page: emit title/summary via json.dumps - YAML 1.2 is
  a superset of JSON, so the emitted double-quoted scalar always parses,
  for any caller-supplied value.
- tests: regression test writes a page whose title/summary contain
  ": ", "#", and quotes and asserts both round-trip through a JSON
  parse of the emitted scalar; the existing round-trip assertion is
  updated to the quoted form.

* fix(server): emit folded scalars, not JSON, so the vault's own readers agree

json.dumps satisfies a YAML 1.2 parser, but _parse_frontmatter_values only
strips outer quotes — it never unescapes. A quoted title came back with
literal backslashes, and ensure_ascii=True turned every non-ASCII character
into a \uXXXX escape both on disk and in every downstream read.

A folded block needs no escaping, round-trips through pyyaml and the vault's
own parser alike, stays readable in the file, and matches the >- convention
this PR documents in llm-wiki/SKILL.md.

---------

Co-authored-by: Marco Baccarani <marco.baccarani@committa.it>
Co-authored-by: ar9av <ar9avg@gmail.com>
2026-09-05 14:05:40 -07:00
..