Skills Rulebase
Querying a Rulebase workspace with SQL
Rulebase exposes workspace data to an AI client as a read-only SQL sandbox over organization-scoped views. It is the most capable tool on the server and the one that fails most often, in two ways that look nothing alike.
npx rulebase-skills install rulebase-workspace-sqlWhen to use it
Reach for this when someone says any of these — they are the phrases the skill itself triggers on:
- “query my Rulebase data”
- “the query timed out”
- “statement timeout”
- “canceling statement due to statement timeout”
How it works
The method, in the order the skill runs it. The full procedure — tables, worked examples and the edge cases — is in the skill itself.
Step 0: introspect, always
Never write a query from remembered field names. Views and columns differ between workspaces and plans.
Why queries time out
LIMIT bounds the output, not the work. This is the single most useful thing to understand about the sandbox.
Patterns that finish
1. Resolve identifiers first, fetch content second. Two cheap queries beat one expensive one. Query for the ids and metadata you need using indexed predicates, then query content keyed by those specific ids. This is the highest-leverage pattern in the sandbox and it works for almost every "show me the messages where…" question.
The fan-outs that produce wrong numbers
These are correctness bugs, not performance bugs, and they do not announce themselves. Each one has been the cause of a real reconciliation failure.
Reconciling against the app
When a number must match what the user sees in Rulebase, do not reverse-engineer the definition from SQL. Pull the equivalent figure from the purpose-built summary tools first, then reconcile your query to it. If they differ, the difference is almost always one of: the status filter, the date field (event time vs. evaluation time vs. import time), the scorecard scope, or a fan-out from the list above. Check those fou
Related skills
Free and open source, and vendor-neutral — it reads the conversations from whichever helpdesk you already run. Browse all 149 skills · connect your helpdesk over MCP · source on GitHub
