intel agent json output broke briefing renderer on unescaped quote
This skill repairs briefing renders broken by unescaped quotes in agent JSON. It validates agent output with a real parser and adds a repair loop before rendering.
TL;DR
Unescaped quotes in agent JSON output break the briefing renderer because the agent wrote raw text containing quotes into a JSON string field. Validate the agent's JSON with a real parser before rendering, and have the agent emit the briefing as structured fields rather than one big JSON blob of prose.
The error
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 12 column 88
renderer input: {"headline": "CEO says "growth" ahead", ...}
Briefing render failed; raw JSON had unescaped quotes.Fix it
Fix the immediate break: re-escape the offending field or regenerate the briefing JSON for the failed item. Expected: Expected: the briefing renders after the JSON parses cleanly.
Add a JSON parse check between the agent output and the renderer; on parse failure, ask the agent to re-emit the JSON instead of crashing. Expected: Expected: malformed output triggers a repair loop, not a failed render.
Constrain the agent's output schema: short fields (headline, tickers as arrays) rather than long prose inside JSON strings, with prose in markdown fields the renderer handles separately. Expected: Expected: fewer quotes inside JSON strings means fewer escaping failures.
Log every repair-loop trigger with the offending snippet so you can see which prompt patterns produce bad JSON. Expected: Expected: the log reveals whether quotes in headlines are the main culprit.
When to use
- Your briefing renderer crashes on the agent's malformed JSON.
- You need a repair loop between generation and rendering.
- You have agents emitting structured output with free-text fields.
When not to use
- The renderer accepts markdown directly - then skip the JSON layer entirely.
- The JSON is valid but the renderer misreads it - that is a renderer bug, not output escaping.
- You control the agent's output format fully - then use a format without quoting issues.
Why it happens
Agents writing JSON by hand (as text) do not escape quotes inside string values; a headline like CEO says 'growth' ahead becomes invalid JSON. The renderer then fails at parse time. The root fix is structural: validate output as data, not as text that happens to look like JSON.
Variant phrasings
agent json output invalid unescaped quote
Same failure and fix; some searchers phrase the query this way.
JSONDecodeError briefing renderer agent output
Same failure and fix; some searchers phrase the query this way.
Edge cases
- Unicode quotes (smart quotes) from copied press text also break naive parsers; normalize them.
- A second failure mode is trailing commas, which strict parsers reject; same repair loop handles it.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_QAt35AfbpBFiP6r4J8UJNQ