Skip to content

fix(prompt): constrain Output Style to UI-renderable Markdown subset#65

Merged
KDwevedi merged 1 commit into
mainfrom
fix/output-style-render-constraints
May 20, 2026
Merged

fix(prompt): constrain Output Style to UI-renderable Markdown subset#65
KDwevedi merged 1 commit into
mainfrom
fix/output-style-render-constraints

Conversation

@KDwevedi
Copy link
Copy Markdown
Collaborator

Problem

The chat agent emits Markdown the OAN-UI chat bubble cannot render.

OAN-UI/src/.../bubbles/card-bubble.tsx renders answers via react-markdown@10 + remark-gfm@4, but overrides components for only p, ol, ul, li, strong. With Tailwind preflight:

  • ### headings → flatten to body text (no h1–h6 styling). Section structure the model intended is visually lost.
  • GFM tables → unstyled, borderless smashed columns (no table/td override).
  • $\times$ / LaTeX → leaks literally (no remark-math/katex). Farmer sees માતા ગાય $\times$ પસંદ કરેલો બળદ.
  • *** → near-invisible <hr>.

Evidence (Shridhar OSS eval, sme_review_400)

  • 40 chat rows emit ### headings (chat 141, 57, 197, 10, 16, 19, 25, 49, 60, 74, 93, 94, …)
  • 5 chat rows emit GFM tables (chat 51, 69, 70, 138, 173)
  • chat51 leaks literal $\times$ (×2)
  • Voice: 0 markdown across all 200 rows — already clean, unaffected.

Change

One surgical edit to the existing ## Output Style section in assets/prompts/agrinet_system.md: the vague No unnecessary headings for simple answers. bullet is replaced with explicit, UI-matched constraints — allow only bold / bullet / numbered lists / paragraphs; forbid headings, tables, HR, and math; use **bold:** labels instead of headings, bullets instead of tables, × instead of $\times$.

Root-cause fix (steers all future traffic), not a per-row patch. Paired with a defensive OAN-UI PR that adds graceful h1–h6/table/hr overrides.

Validation

Prompt-only change. Recommend dev smoke on a few of the affected eval queries (chat 51/69/141) to confirm the agent drops headings/tables/LaTeX before prod promotion.

🤖 Generated with Claude Code

The chat UI (OAN-UI card-bubble) renders responses with
react-markdown + remark-gfm but overrides only p/ol/ul/li/strong.
Headings (#/##/###) flatten to body text, GFM tables render as
unstyled smashed columns, and LaTeX ($\times$) / *** HR leak as
raw text to the farmer.

Replaces the vague "No unnecessary headings" bullet with explicit
constraints: bold/bullets/numbered lists/paragraphs only; no
headings, tables, HR, or math. Use **bold:** labels instead of
headings, bullets instead of tables, × instead of $\times$.

Eval evidence (sme_review_400 / Shridhar OSS eval): 40 chat rows
emit ### headings, 5 emit GFM tables, chat51 leaks literal $\times$.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant