Strip the operational metadata preamble that agent pipelines prepend to
artifacts. These are lines of the form **Run:** …, **Window:** …,
**Methodology:** …, etc., followed optionally by a standalone ---
horizontal rule. They are agent-operational metadata that should not appear
in the published article.
Algorithm:
Skip leading blank lines (they don't count as metadata).
If the first non-blank line does NOT match the metadata pattern, return
the document unchanged (lines: 0).
Otherwise consume all metadata lines and interspersed blank lines.
If the next non-blank line is a standalone ---, consume that too.
Return the stripped Markdown and the count of lines removed.
Parameters
md: string
Markdown source (after banner/heading passes)
Returns {md:string;lines:number}
{ md, lines } — stripped Markdown and number of lines removed
Strip the operational metadata preamble that agent pipelines prepend to artifacts. These are lines of the form
**Run:** …,**Window:** …,**Methodology:** …, etc., followed optionally by a standalone---horizontal rule. They are agent-operational metadata that should not appear in the published article.Algorithm:
lines: 0).---, consume that too.