Static prompt (no tools) keeps rules that use $variables, @Set, Query and @Count

Open
#1,503 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active

Research direction

Start at openuiLibrary.prompt(openuiPromptOptions) and trace how the component-group notes and openuiAdditionalRules are included when tools is absent; the issue does not name source or test files. Compare the generated static prompt with the documented defaults for toolCalls, bindings, and built-in functions. Done when a static prompt no longer includes rules requiring disabled features, with coverage for the reported examples.

Written by the indexing model from the issue text.

Description

Describe the bug

Without tools, openuiLibrary.prompt(openuiPromptOptions) leaves out the Built-in Functions, Query, Mutation and Interactive Filters sections, as the System Prompts docs describe (toolCalls and bindings default to off). But openuiLibrary's component-group notes and openuiAdditionalRules are still added in full. So the static prompt keeps about 20 rules that use the features it no longer explains, for example:

- Shared filter across Tabs: same $days binding in Query args works across all TabItems
- KPI card: Card([TextContent("Label", "small"), TextContent("" + @Count(@Filter(data.rows, "field", "==", "value")), "large-heavy")])
- Use @Reset($var1, $var2) after form submit to restore defaults — not @Set($var, "")
- Multi-query refresh: Action([@Run(mutation), @Run(query1), @Run(query2), @Reset(...)])

The model gets @Count/@Filter/@Each, @Set/@Reset/@Run, Query and data.rows only through these examples, with no definitions, and with no Query whose result data.rows could refer to.

To Reproduce

import { openuiLibrary, openuiPromptOptions } from "@openuidev/react-ui/genui-lib";

const prompt = openuiLibrary.prompt(openuiPromptOptions); // no tools: a static prompt

for (const s of ["## Built-in Functions", "## Query", "## Mutation", "## Interactive Filters"]) {
  console.log(s, prompt.includes(s)); // all false
}
const rules = prompt
  .split("\n")
  .filter((line) => line.startsWith("- ") && /\$[a-z]|@[A-Z][a-z]+\(|Query/.test(line));
console.log(rules.length); // 21

Expected behavior

A static prompt only contains rules for features it enables. For example, notes and rules that need toolCalls, bindings or builtinFunctions could be left out when those flags are off. Otherwise, the docs could say that the default notes assume a prompt with tools and bindings.

Versions

  • @openuidev/react-ui 0.18.1, @openuidev/lang-core 1.0.2
  • Node 24, no browser involved

Additional context

The library rework in #1385 keeps rules of the same kind, e.g. KPI card: Card([Metric("" + @Count(@Filter(data.rows, ... and Success toast: ... use @Set($showSuccess, true).

Dominant language
TypeScript
Stars
10k
Forks
698
Avg merge
1d 3h
Merged PRs (30d)
133

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from thesysdev/openui

All issues in thesysdev/openui

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.