No slash command · from anofox-scenario
Freezes approved plans, budgets, or forecasts as immutable snapshots using the anofox_scenario DuckDB extension. Captures audit trails, shows changes since sign-off, and manages versioned scenario data.
Ships in anofox-scenario. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Extension: anofox_scenario v2026.11.13 | DuckDB: v1.5.5+ and v2.0
A snapshot is a scenario that does not move with the base (materialized, or pinned to a
DuckLake snapshot) and is frozen so nobody writes to it. Errors and settings:
anofox-scenario-reference. DuckLake, Markdown export, legacy migration:
recipes.md.
Unfreezing an approved scenario, dropping it, or merging a revision into the real tables changes the record. Name the scenario and the consequence, get the user's yes, and log it (see "Audit notes"). Prefer branching an approved version over unfreezing it.
Decide before creating anything:
| Approving | Do |
|---|---|
| the current contents of the base tables | mode := 'materialized' + scenario_freeze (§1) |
| an existing what-if variant (a delta scenario) | capture it into a materialized scenario (§7); freezing the variant itself is not enough, its untouched rows still follow the base |
| a variant still to be planned | start from a materialized baseline, branch it, freeze the chosen branch |
| tables in a DuckLake catalog | base := 'lake' + freeze: pinned, no copy (recipes.md) |
scenario_unfreeze reverses it (not for a merged
scenario). Do an approved correction atomically (see "Audit notes").__anofox_scenario in a session with the
extension loaded, but a process without the extension, or with
anofox_scenario_allow_internal_writes, can. SET lock_configuration = true after loading
keeps the setting off (set the telemetry opt-out before it). For tamper evidence keep an
external copy: EXPORT DATABASE plus a checksum stored elsewhere.'ours' reverts those base edits.CREATE TABLE budget (cost_center VARCHAR PRIMARY KEY, amount DECIMAL(12,2), owner VARCHAR);
INSERT INTO budget VALUES ('CC-100', 50000, 'ops'), ('CC-200', 72000, 'sales'), ('CC-300', 31000, 'it');
BEGIN;
CALL scenario_create('budget_2026_approved', 'approved by the board 2026-03-14', mode := 'materialized');
CALL scenario_freeze('budget_2026_approved');
COMMIT;
ATTACH 'budget_2026_approved' AS approved (TYPE scenario);
SELECT * FROM approved.budget ORDER BY cost_center;
-- fails: is frozen. Unfreeze it with CALL scenario_unfreeze
UPDATE approved.budget SET amount = 0;
-- fails: Cannot modify __anofox_scenario.registry with SQL
UPDATE __anofox_scenario.registry SET frozen = false WHERE name = 'budget_2026_approved';
UPDATE budget SET amount = 80000 WHERE cost_center = 'CC-200';
INSERT INTO budget VALUES ('CC-400', 12000, 'hr');
DELETE FROM budget WHERE cost_center = 'CC-300';
Snapshot vs. live table (old = approved, new = today):
SELECT * FROM scenario_diff('budget_2026_approved', 'main', 'budget') ORDER BY cost_center;
The 2-argument form scenario_diff('budget_2026_approved', 'budget') answers another
question: what the scenario itself changed (nothing, for an untouched approval). For a
DuckLake approval 'main' is the pinned snapshot: compare with a join (recipes.md).
KPI view, approved vs. actual:
SELECT coalesce(a.cost_center, b.cost_center) AS cost_center,
a.amount AS approved, b.amount AS current, b.amount - a.amount AS delta
FROM approved.budget a FULL JOIN budget b USING (cost_center)
ORDER BY cost_center;
SELECT name, mode, frozen, parent, created_at, merged_at, description
FROM scenario_list() ORDER BY created_at;
Branch it instead of unfreezing it, so the approved version stays as it was:
CALL scenario_create('budget_2026_rev1', 'Q2 revision', from_scenario := 'budget_2026_approved');
ATTACH 'budget_2026_rev1' AS rev1 (TYPE scenario);
UPDATE rev1.budget SET amount = amount * 1.05 WHERE owner = 'sales';
SELECT * FROM scenario_diff('budget_2026_approved', 'budget_2026_rev1', 'budget');
Merging rev1 into the live table writes values computed from the approved copy: CC-200 was
changed in the base since approval, so it is a conflict. To apply a revision to today's data,
redo it in a fresh delta scenario (anofox-scenario-safe-change).
SELECT key, action, conflict FROM scenario_merge_preview('budget_2026_rev1');
Plain SQL over a plain, append-only table: every approval, correction and revision is a row.
CREATE SEQUENCE IF NOT EXISTS audit_events_seq;
CREATE TABLE IF NOT EXISTS audit_events (
event_id BIGINT DEFAULT nextval('audit_events_seq') PRIMARY KEY,
scenario VARCHAR NOT NULL, event VARCHAR NOT NULL, actor VARCHAR,
logged_at TIMESTAMP DEFAULT current_timestamp, note VARCHAR);
INSERT INTO audit_events (scenario, event, actor, note) VALUES
('budget_2026_approved', 'approved', 'board', 'board meeting 2026-03-14, minutes ref B-26-03'),
('budget_2026_rev1', 'created', 'cfo', 'sales headcount moved forward to Q2');
An approved correction (after the user's yes): unfreeze, correct, refreeze and log in one transaction, so the plan is never left writable and never changes without its log entry:
BEGIN;
CALL scenario_unfreeze('budget_2026_approved');
UPDATE approved.budget SET owner = 'infra' WHERE cost_center = 'CC-300';
CALL scenario_freeze('budget_2026_approved');
INSERT INTO audit_events (scenario, event, actor, note) VALUES
('budget_2026_approved', 'corrected', 'controller', 'CC-300 owner it -> infra; unfrozen and refrozen');
COMMIT;
SELECT frozen FROM scenario_list() WHERE name = 'budget_2026_approved';
SELECT cost_center, owner FROM approved.budget WHERE cost_center = 'CC-300';
Scenarios, copies and notes all live in the one .duckdb file.
Copy the variant's state into a new materialized scenario and freeze it in one transaction. Only the tables the variant changed need copying; the fresh copy already holds the rest.
-- doc-snippets: new session
CREATE TABLE demand (sku VARCHAR, region VARCHAR, qty INTEGER, PRIMARY KEY (sku, region));
INSERT INTO demand VALUES ('A', 'US', 100), ('A', 'EU', 80), ('B', 'US', 50);
CALL scenario_create('optimistic', 'US +10');
ATTACH 'optimistic' AS opt (TYPE scenario);
UPDATE opt.demand SET qty = qty + 10 WHERE region = 'US';
SELECT table_name FROM scenario_diff_summary('optimistic'); -- the tables to copy
CALL scenario_create('optimistic_approved', 'optimistic, approved 2026-03-14', mode := 'materialized');
ATTACH 'optimistic_approved' AS oa (TYPE scenario);
BEGIN;
DELETE FROM oa.demand;
INSERT INTO oa.demand SELECT * FROM opt.demand;
CALL scenario_freeze('optimistic_approved');
COMMIT;
SELECT count(*) AS differences FROM scenario_diff('optimistic', 'optimistic_approved', 'demand');
UPDATE demand SET qty = 0; -- the base moves on
SELECT * FROM oa.demand ORDER BY ALL; -- still the approved variant
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
duckdb, scenario-management, audit-trail, versioning, snapshot, compliance
Other plugins' skills for the same job
npx claudepluginhub datazoode/anofox-scenario --plugin anofox-scenario4 skills in this plugin
/anofox-scenario-referenceSupplementary lookup for the anofox_scenario DuckDB extension, loaded alongside a workflow skill or when a scenario statement fails. Error message -> cause -> fix table; every signature and output column (scenario_create, scenario_list, scenario_diff, scenario_diff_summary, scenario_merge_preview, scenario_merge, scenario_freeze, scenario_unfreeze, scenario_drop, scenario_refresh, scenario_migrate); settings (telemetry opt-out, suppression hash limit, internal writes); which base edits a merge does not detect; transactions; ATTACH ... (TYPE scenario) and USE; keyless tables, views, row identity; which tables a scenario changed; using a scenario from Python; sharing one with a colleague. Not a workflow on its own: plan variants -> anofox-scenario-what-if, dry run and merge -> anofox-scenario-safe-change, approved versions -> anofox-scenario-snapshot-audit.
/anofox-scenario-safe-changeTry a data change on a sandbox copy of DuckDB tables with the anofox_scenario extension, review exactly what it would change, then apply it to the real tables, throw it away, or undo it later. Use for a dry run or preview of a bulk UPDATE / DELETE / MERGE, an ETL step, a backfill, a price change or a data fix; "test it on a copy / staging version first"; applying (merging) a scenario or a chosen plan variant to the real data; merge conflicts; undoing or rolling back a change applied by a scenario merge; SQL that already uses (TYPE scenario) or scenario_merge. Row data only: schema migrations (ADD COLUMN, new tables) cannot run inside a scenario because DDL is rejected; this skill says what to do instead. Not for comparing plan variants (anofox-scenario-what-if) or keeping approved, signed-off versions (anofox-scenario-snapshot-audit).
/anofox-scenario-what-ifWhat-if planning and sensitivity analysis on DuckDB tables with the anofox_scenario extension: clone, fork or sandbox tables into named plan variants (optimistic / pessimistic, +5% / +10% / +20%), change each with ordinary SQL, and compare KPIs and rows across variants or with the current data, without touching the real tables. Use when the user asks "what happens if" demand, prices, costs, budget or capacity change, wants to clone a table to tweak numbers and see the effect, runs a sensitivity analysis, keeps several plan variants side by side (S&OP, budgeting), or forecasts per scenario with anofox_forecast. Not for applying a variant to the real tables (anofox-scenario-safe-change) or for approved, signed-off versions (anofox-scenario-snapshot-audit).