Skip to content

fix(prompt): forbid citing table doc profiling stats as data answers - #1435

Open
tckaros wants to merge 1 commit into
getnao:mainfrom
tckaros:fix/system-prompt-doc-stats-rule
Open

fix(prompt): forbid citing table doc profiling stats as data answers#1435
tckaros wants to merge 1 commit into
getnao:mainfrom
tckaros:fix/system-prompt-doc-stats-rule

Conversation

@tckaros

@tckaros tckaros commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Fixes #1434

The agent could answer a quantitative question by quoting profiling statistics from table documentation files (columns.md, preview.md, ai_summary.md, how_to_use.md) instead of running a query — stale snapshots from the last profiling sync, sometimes inconsistent between files of the same table. It even emitted a <citation-number> tag with a fabricated query id, since no execute_sql result existed to cite.

Changes

  • Add a rule to the "SQL Query Rules" section of the default system prompt, next to the existing LIMIT rule: table docs are for schema and semantics only; any number presented as an answer to a data question must come from a query executed in the conversation, or be computed from such results.
  • Add a unit test asserting the rule is present in the rendered prompt, following the existing substring-check style of system-prompt.test.ts.

🤖 Generated with Claude Code

Review in cubic

Add a SQL Query Rules entry so the agent never answers a data question
with row counts or aggregates from table documentation files
(columns.md, preview.md, ai_summary.md, how_to_use.md) — those are
stale profiling snapshots. Any number presented as an answer to a data
question must come from a query executed in the conversation (or be
computed from its results), which also keeps citation query ids real.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Re-trigger cubic

@socallmebertille socallmebertille left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for your contribution!
LGTM 👍

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.

[bug] Agent answers quantitative questions with stale profiling stats from table docs instead of running a query

2 participants