fix: enforce confidence-range language and data-sufficiency gate in report generation - #25
Open
drewstarr0408 wants to merge 1 commit into
Open
Conversation
…eport generation Report agent was asserting specific real-world outcomes (e.g. exact match scores) as settled fact even when the simulation graph had ~zero observed agent interactions (0 edges, 0 interviews). Root cause was two-fold: prompt templates framed simulation output as "the predicted future" rather than a scenario hypothesis, and later sections treated earlier sections' generated text as verified ground truth to build on rather than provisional content. - Reworded PLAN_SYSTEM_PROMPT, PLAN_USER_PROMPT_TEMPLATE, SECTION_SYSTEM_PROMPT_TEMPLATE, SECTION_USER_PROMPT_TEMPLATE to forbid asserting specific outcomes/scores/winners and require confidence-range language throughout - Added a data-sufficiency gate: when total_nodes==0 or total_edges==0, plan_outline() sets self.data_insufficient and injects an explicit warning into the outline and every section prompt forcing "insufficient data, no outcome projection possible" framing instead of a fabricated conclusion - Section prompts now explicitly flag prior sections as unverified LLM output, not fact to build recommendations on
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Report generation could assert specific real-world outcomes (e.g. an exact match score) as settled fact even when the underlying simulation graph had effectively zero observed agent interactions (0 edges, 0 successful interviews). The recommendation/synthesis step compounded this by treating that fabricated conclusion as a premise, recommending generation of more synthetic data specifically to manufacture supporting evidence for it — conclusion-first, evidence-manufactured-after.
Repro case: a simulation seeded with only factual/structural data (no outcome data) still produced a report stating a specific final score as fact, while the same report elsewhere admitted 0 edges and 0 interviews existed in the graph.
Root cause
PLAN_SYSTEM_PROMPT/SECTION_SYSTEM_PROMPT_TEMPLATEtold the model simulation output "ARE the predicted future," with no code-level check gating generation on how much real simulation data actually existed (total_nodes/total_edgeswere computed but never used as a gate).SECTION_USER_PROMPT_TEMPLATEfed each prior section's generated text into the next section's prompt as "Completed section content," with no instruction to treat it as provisional — so a later section could build directly on an earlier section's unverified/fabricated claim.Fix
PLAN_SYSTEM_PROMPT,PLAN_USER_PROMPT_TEMPLATE,SECTION_SYSTEM_PROMPT_TEMPLATE,SECTION_USER_PROMPT_TEMPLATEto forbid asserting specific outcomes/scores/winners and require confidence-range language throughout.total_nodes == 0 or total_edges == 0,plan_outline()setsself.data_insufficientand injects an explicit "DATA SUFFICIENCY WARNING" into the outline prompt and every section's system prompt, forcing "insufficient data, no outcome projection possible" framing instead of a guess.Testing
Live end-to-end re-verification was blocked by unrelated API credit exhaustion on my end, so I built an offline mock test (mocks
GraphToolsService/LLMClient, no network calls) exercising the actualReportAgent.plan_outline()gate logic and prompt construction directly:data_insufficientcorrectly triggers at 0 edges / 0 nodes (including the exact repro shape: nodes present, 0 edges) and correctly stays off on a healthy graph.22/22 checks pass. Happy to share the test script if useful, or add it to the repo's test suite if there's a place for it.
🤖 Generated with Claude Code