Surfaced by
The eval harness from #65 (PR #149). Gemma 2 (2B) under the terse prompt variant emits per-bullet outputs that bold just the leading verb in markdown, e.g.:
**Increased** weekly active users by 1500% (120,000 to 1.8 million)…
**Spearheaded** a growth team of six individuals…
**Streamlined** the checkout process…
Example from tests/fixtures/rewrite/reports/eval-rewrite-gemma-2-2b-it-q4f16-1-mlc-…json:
{
"text": "**Triaged** an average of 200+ inbound customer support tickets per week…",
"startsWithActionVerb": false
}
The **Triaged** token survives into the bullet text. The first-token check in verbs.ts::startsWithActionVerb strips non-[a-z] chars after lowercasing, so the verb match itself still works — but the visible bullet contains literal ** delimiters that a user would see if this output were ever surfaced in product.
Root cause
src/lib/webllm/post-process.ts::cleanRewriteLine strips markdown emphasis only when the whole bullet is wrapped:
const withoutEmphasis = withoutPrefix
.replace(/^\*\*(.+)\*\*$/s, "$1")
.replace(/^\*(.+)\*$/s, "$1")
.replace(/^_(.+)_$/s, "$1");
Inline **verb** at the start of a longer bullet doesn't match ^\*\*(.+)\*\*$, so the delimiters pass through.
Fix
Add a narrow pre-strip that removes **word** only when it leads the bullet (a verb-bolding pattern), without touching legitimate mid-line emphasis:
const withoutLeadingBold = trimmed.replace(/^\*\*([A-Za-z][\w-]*)\*\*\s+/, "$1 ");
Match characteristics:
^\*\* — must be at the start
([A-Za-z][\w-]*) — captured word (single token, alphanumeric/hyphen)
\*\*\s+ — closing delimiter followed by at least one space (so we only match when there's body text after)
Apply before the existing whole-bullet emphasis strip so the order is: leading-verb-bold strip → whole-bullet emphasis strip → list-marker strip → quote strip.
Add unit tests in post-process.test.ts:
expect(cleanRewriteLine("**Increased** weekly active users by 1500%."))
.toBe("Increased weekly active users by 1500%.");
expect(cleanRewriteLine("**Streamlined the** checkout")) // not just one word
.toBe("**Streamlined the** checkout"); // unchanged — defensive
Tracking
Surfaced by
The eval harness from #65 (PR #149). Gemma 2 (2B) under the terse prompt variant emits per-bullet outputs that bold just the leading verb in markdown, e.g.:
Example from
tests/fixtures/rewrite/reports/eval-rewrite-gemma-2-2b-it-q4f16-1-mlc-…json:{ "text": "**Triaged** an average of 200+ inbound customer support tickets per week…", "startsWithActionVerb": false }The
**Triaged**token survives into the bullet text. The first-token check inverbs.ts::startsWithActionVerbstrips non-[a-z]chars after lowercasing, so the verb match itself still works — but the visible bullet contains literal**delimiters that a user would see if this output were ever surfaced in product.Root cause
src/lib/webllm/post-process.ts::cleanRewriteLinestrips markdown emphasis only when the whole bullet is wrapped:Inline
**verb**at the start of a longer bullet doesn't match^\*\*(.+)\*\*$, so the delimiters pass through.Fix
Add a narrow pre-strip that removes
**word**only when it leads the bullet (a verb-bolding pattern), without touching legitimate mid-line emphasis:Match characteristics:
^\*\*— must be at the start([A-Za-z][\w-]*)— captured word (single token, alphanumeric/hyphen)\*\*\s+— closing delimiter followed by at least one space (so we only match when there's body text after)Apply before the existing whole-bullet emphasis strip so the order is: leading-verb-bold strip → whole-bullet emphasis strip → list-marker strip → quote strip.
Add unit tests in
post-process.test.ts:Tracking