mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-26 10:26:26 +01:00
The Plan pane could render an entire plan document as one giant H1 with
`##` markers showing inline (e.g. "…plan pack)## The goal, restatedYou
picked…") when a producer wrote the plan document body with its
paragraph/heading newlines collapsed onto a single line.
Two layers:
- Producer (source): the plan-authoring guidance modeled the body as a
single-line `"# Plan\n\n…"` template, inviting flattened bodies. Add
explicit formatting rules (each heading on its own line, blank line
between blocks, JSON-safe encoding) and a multi-section example.
Reinforce the same rule in the onboarding publish contract.
- Write-path guard (defense-in-depth): multilineTextSchema now runs
normalizeMidLineHeadings after escaped-break normalization. It inserts
a paragraph break before a mid-line ATX heading marker (`#{1,6} `) so a
malformed single-line body self-heals into headings/paragraphs. Scoped
to skip fenced code blocks and to leave inline `#` tokens (C#, F#,
#hashtags, #123) untouched.
Unit tests cover the guard (mid-line `##` break, C#/F#/hashtag/code-fence
exclusions, leading-heading no-op).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>