Start here
Scenario Pack Guide
Defines the minimum pack, roles, authority, entry and exit criteria, externally enforced controls, deeper-record triggers, and reopening rules.
Preview
# Safe Database Query Assistant Scenario Pack Toolkit schema: `PAISEH-TK-1.0` Scenario pack: `PAISEH-SC-SDQA-1.0` Use this pack when an AI-assisted workflow turns a question into a database query, executes it against protected or production-shaped data, and explains the result. It is intended for read-only analysis where access controls, query limits, and audit capture are enforced outside the model. This pack records intent, authority, context, execution, findings, and results. It does not grant database access, make generated queries safe, authorize a mutation, or certify an answer as correct. ## Smallest Credible Starting Set For a bounded, read-only question over an approved dataset, complete: 1. `query-intent-record.md` 2. `data-access-contract.md` 3. `schema-context-manifest.md` 4. `query-execution-policy.md` 5. `safety-checklist.md` 6. `result-receipt.md` Attach any runbook whose entry condition is plausible. Use a separately governed workflow for every insert, update, delete, schema change, administrative command, or stored procedure with an unverified effect. ## Users, Owners, and Authority | Role | Responsibility | Authority boundary | | --- | --- | --- | | Requester | States the question, purpose, population, and time window | May request analysis; cannot grant data access or approve a query | | Query owner | Accepts the intent and owns the answer's use | May narrow or stop the question; cannot weaken access controls | | Data owner | Defines permitted datasets, purposes, fields, and retention | Grants or denies data use through the authoritative access process | | Query operator | Submits an approved candidate through the controlled executor | May execute only within the recorded policy and credential | | Database operator | Owns database health, cancellation, and workload protection | May stop, quarantine, or reschedule work to protect the service | | Reviewer | Inspects query shape, evidence, limitations, and safety findings | Produces findings or a recommendation, not automatic approval | | Result verifier | Checks that the result supports the stated answer | Accepts or rejects evidence for the named analytical claim | | Decision authority | Decides whether the answer may be used for the stated purpose | Records disposition under the owning team's policy | | Mutation authority | Controls any separately proposed write path | Cannot be inferred from read access, tool access, or requester status | One person may hold several roles when policy permits. Record each assignment and any separation-of-duties requirement. ## Required Inputs and Entry Criteria - A specific question, business purpose, intended audience, population, dimensions, measures, and time window. - A named query owner, data owner, query operator, database operator, reviewer, result verifier, and decision authority. - An externally enforced read-only credential with least privilege for the approved source, tenant, rows, columns, and operations. - An approved schema-context snapshot with provenance, freshness, semantics, and known limitations. - A controlled execution path that enforces parameter binding, statement allowlists, result limits, timeouts, workload limits, and audit records. - A defined plan or cost review threshold and an escalation path for database health. - A known treatment for empty, partial, timed-out, suppressed, or irreproducible results. Do not execute when the purpose, tenant boundary, credential mode, schema freshness, sensitive-data treatment, or effect of the candidate statement is unresolved. ## Working Sequence | Stage | Required record | Result | | --- | --- | --- | | Bound intent | Query Intent Record | Inspectable question, semantics, exclusions, and acceptance claims | | Authorize data | Data-Access Contract | Enforced source, tenant, row, column, purpose, and retention boundary | | Admit schema | Schema-Context Manifest | Versioned structural and semantic context with freshness limits | | Govern execution | Query-Execution Policy | Allowed statements, parameters, limits, cost gates, audit, and mutation separation | | Inspect | Safety Checklist | Evidence-indexed findings; never automatic approval | | Execute and explain | Controlled executor and Result Receipt | Query identity, result identity, answer, evidence, limitations, and disposition | ## Completed Walkthrough Use `examples/read-only-production-analytics-question.md` to inspect all six working records completed for a weekly aggregate question. The walkthrough shows enforced read-only access, current schema semantics, typed parameters, plan evidence, reproducibility, and a decision-use limitation. ## Control Boundary The model may propose text, but controls that protect data and service health must sit outside the model. At minimum, the execution path independently authenticates the caller, authorizes the dataset and tenant scope, parses or rejects statement types, binds parameters, applies limits and timeouts, records audit evidence, and blocks mutation-capable paths. Read-only must be enforced by the database credential and execution environment, not by an instruction such as “only generate SELECT.” A mutation requires a new intent record, a separately authorized identity and path, explicit preview and approval, effect verification, and a reversal or compensation plan. ## Runbook Selector | Condition | Runbook | | --- | --- | | Estimated or actual work exceeds the accepted scan, plan, latency, or cost envelope | `runbooks/expensive-query.md` | | A query waits on or contributes to blocking, deadlock risk, or material contention | `runbooks/lock-contention.md` | | Join cardinality, grain, filters, grouping, or aggregation may make the answer wrong | `runbooks/incorrect-join-or-aggregation.md` | | Results, logs, prompts, exports, or explanations expose sensitive data | `runbooks/sensitive-data-exposure.md` | | The schema snapshot no longer matches the authoritative structure or semantics | `runbooks/stale-schema-context.md` | | The executor returns incomplete, truncated, sampled, or mixed-success data | `runbooks/partial-results.md` | | Planning, execution, retrieval, or answer assembly exceeds a deadline | `runbooks/timeout.md` | | An authorized reviewer cannot reproduce the query result or answer | `runbooks/irreproducible-answer.md` | ## Exit and Acceptance Criteria Close the work only when: - the executed statement and parameters match the accepted intent and policy; - effective identity, source, tenant or row scope, schema version, and execution environment are recorded; - read-only and least privilege were externally enforced; - plan or cost evidence and runtime limits stayed within the accepted envelope; - the answer distinguishes observed facts, calculations, interpretation, and uncertainty; - suppression, truncation, sampling, missing data, and semantic assumptions are visible; - checklist findings have owners and dispositions; - the decision authority records whether and how the answer may be used; and - the Result Receipt is retrievable without exposing disallowed data. ## Deeper Record Triggers Attach the applicable core toolkit modules when the work: - includes personal, confidential, regulated, or otherwise sensitive data; - crosses tenants, trust boundaries, regions, or purpose restrictions; - joins sources with different owners, retention rules, or semantic definitions; - supports a high-consequence operational, financial, legal, or customer decision; - creates an export, durable cache, downstream dataset, or other retained effect; - requires a tool with broader access than the question needs; - proposes any mutation or administrative command; or - raises the affected population, autonomy, or consequence ceiling. Typical additions are the AI Fit and Risk Assessment Worksheet, Context Assembly Plan, Tool Permission Matrix, AI Threat Model, Evaluation Plan, AI Operations Runbook, and Principal Design Review Checklist and Record. ## Material Change and Reopening Triggers Reopen affected records when the question, purpose, audience, source, tenant, row or column scope, schema semantics, credential, query shape, parameters, limits, execution environment, result handling, retention, decision use, or consequence changes. Also reopen when later evidence reveals stale schema context, sensitive-data exposure, a partial result, an incorrect aggregation, or an answer that cannot be reproduced.