/microstrategy-to-sigma:microstrategy-to-sigmafrom MicroStrategy → Sigma
Migrate MicroStrategy (Strategy One) content to Sigma. Use when the user has MicroStrategy dossiers, reports, or a classic schema (attributes / facts / metrics) and wants to recreate them in Sigma. Extracts the dossier + full semantic model over the MSTR REST API into a bundle, converts it to a Sigma data model + workbook, reproduces Analytical-Engine row-collapse quirks deterministically, and verifies row-level parity. Live-validated with exact parity on the classic-schema grid path.
Ships in MicroStrategy → Sigma. 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.
Windows / first run — run the environment doctor before anything else:
bash scripts/doctor.sh(macOS/Linux/Git Bash) orpowershell -ExecutionPolicy Bypass -File scripts\doctor.ps1(Windows). It checks Ruby/Python/Node/bash and flags the Python "Store stub" + CRLF with exact fixes. Details:refs/environment.md.
⛔ THE ONE PATH (do not ship an unverified/empty workbook)
Convert with
convert.py, POST its specs, then verify withverify_parity.py. Rules:
- NEVER hand-author a DM/workbook JSON and
curl-POST it, and never ship empty "placeholder" pages. Post only whatconvert.pyproduces. If MicroStrategy is unreachable (no session), STOP and tell the user to authenticate — don't build a shell.verify_parity.pymust be GREEN with REAL reports before you're done. It now refuses a vacuous pass — anexpected_parity.jsonwith 0 reports is "NOT parity-clean" (exit 1), never a silent green. An empty/placeholder workbook is never done.
Before POSTing any workbook spec, run both validators:
ruby scripts/lib/preflight_lint.rb <spec.json> catches grouping and control grammar failures.sigma-workbooks skill, run ./scripts/validate-spec.sh <absolute-spec-path> to reject bare source-column self-references and list/segmented controls without a value-list source.The API accepts a filters-only list control, but the picker is empty: filters names what changes; source supplies the values a user can select. API acceptance is not a shipping criterion. Date-range controls are different and correctly use filters without a separate value-list source. Fix every violation first — never POST past it, and never conclude a feature is "unsupported" from an Invalid kind error (it means the inner fields are wrong). Verified shapes: sigma-workbooks controls.md / tables.md.
Unlike the Group-A converters (tableau, powerbi, qlik, quicksight, looker,
thoughtspot, cognos) — which share the vendored converter-source engine
(converter/*.mjs, with the hosted convert_* MCP tool as a fallback) — this
skill uses a self-contained Python converter that ships in scripts/
(convert.py). It runs locally via python3; there is no vendored .mjs
bundle, no convert_microstrategy_to_sigma MCP tool, and no --converter /
*_MCP_DIR override — those concepts do not apply here. Nothing about the model
conversion leaves your machine.
--folder-id is required downstream)Don't pick the destination folder for the user. For a normal single-fact run,
resolve it before building. If source extraction is already available, run the
Phase-1 multi-fact preflight first so an unsupported source shape does not
trigger a tenant-wide Sigma catalog scan. convert.py requires --folder-id,
so resolve it WITH the user before conversion:
python3 scripts/pick_destination.py list → { workspaces, folders (editable, with parentName), myDocuments }id lands content in the workspace root),
an existing folder, My Documents (when non-null — null for service tokens), or
create a new folder: python3 scripts/pick_destination.py create --name "<name>" [--parent <workspace-or-folder-id>]--folder-id <id>. folderId accepts a workspace id or a folder id.If the user already named a destination, honor it silently — don't ask.
Extract a MicroStrategy dossier + its full semantic model into one
bundle.json, convert it to a Sigma data model (table sources + joins +
metrics) and a matching workbook, then verify row-level parity against
the numbers MicroStrategy itself reports. Translate what maps cleanly; flag
what doesn't (unmapped viz types → flagged tables) instead of emitting wrong
logic.
Validated: exact parity (19/19 + 30/30 + 3/3 rows) on a live Strategy One trial against Snowflake — classic-schema path, grid reports, incl. a
Count<Distinct=True>metric, a compound margin metric, and an Analytical-Engine row-collapse report. Grid and bar/line are live-validated; waterfall is released and wired; area is mechanically wired but has not passed a live source-to-target render/parity run. Richer chart families and the newer "Data Model" object remain roadmap (refs/design-notes.md).
READ FIRST —
refs/operating-contract.md: the fidelity guardrails (render + value-check EVERY page against the source; never ship empty or silently drop a tile; don't spin — surface blockers). Modeling strategy —refs/modeling-strategy.md: faithful reproduction of the source model is the DEFAULT (parity is the gate); an upstream OBT or Sigma-native materialization is an OPT-IN optimization for hot, join-heavy dashboards, re-verified against the same parity oracle. The converter never auto-flattens. Readrefs/before relying on shapes:mstr-rest-api.md(every verified REST gotcha — changesets, locks, lowercase response headers, session-bound dossier flows),ae-row-collapse.md(the one MSTR behavior no clean SQL reproduces, and the pinning workflow),viz-type-mapping.md(dossier viz → Sigma element lookup),plugin-tier.md(what to do when a source viz has NO native Sigma analog —heat_mapis a treemap, and Sigma has none: match it with a plugin, never a shaded table),design-notes.md(architecture + modeling gotchas + roadmap),control-parity.md(shared control-targeting contract: the control lint, the control-scope.json sidecar, and the flip test). For canonical Sigma spec shapes, defer to the companionsigma-data-models/sigma-workbooksskills.
MSTR_BASE_URL (the Library root, e.g.
https://<host>/MicroStrategyLibrary), MSTR_USERNAME, MSTR_PASSWORD
(+ optional MSTR_PROJECT_ID), exported or in ~/.sigma-migration/env.
Auth is session-based (POST /api/auth/login, loginMode 1) — there is no
API-key concept; scripts/mstr.py handles it.SIGMA_BASE_URL, then preferably run
eval "$(bash scripts/browser-login.sh)" once from an interactive terminal.
The co-located scripts/lib/sigma_rest.py reuses a current bearer or the
keychain refresh session; SIGMA_CLIENT_ID / SIGMA_CLIENT_SECRET remain the
unattended fallback. Known-old tokens refresh proactively, and live requests
retry once after HTTP 401. ruby scripts/setup.rb can persist unattended
credentials and the optional connection id. (Source-side MSTR creds are
separate — see the MicroStrategy bullet above.)resolve_ae_winners.py and parity readback also
want PyYAML for Sigma's YAML spec responses) and Ruby (the shared
gate stack: put-layout.rb, assert-phase6-ran.rb, probe-controls.rb,
scripts/lib/*.rb — vendored byte-identical across the sibling plugins).Run the sibling microstrategy-assessment skill for an estate-wide
inventory (reports/dossiers, viz histogram, complexity tags) — its
inventory.json lists dossier ids. Or quick-check connectivity and pick a
dossier by hand:
python3 scripts/mstr.py # login probe + project list
# dossiers: see assessment, or GET /api/searches/results?type=55 via mstr.py
Check what backs the dossier's dataset before extracting. GET /objects/{datasetId}?type=3 →
subtype:
Classic schema / Mosaic Data Model (live warehouse-backed) → the normal path. Continue to Phase 1; extract.py reads the semantic model.
Quick Cube / super-cube (subtype 779, or a dataset whose source is a file import — Row Count - <name>.xlsx metric, no live warehouse connection) → there is no warehouse semantic model to convert. The model lives inside the in-memory cube. This is a data rehost + rebuild, not a semantic auto-conversion — set expectations accordingly and don't claim convert.py drove it.
Decide first (ask the customer): if the cube has a real upstream system of record, prefer pointing Sigma at that live warehouse source. Rehosting the cube copies a point-in-time snapshot into the customer's warehouse — it does not stay fresh unless something re-feeds it. Only rehost when there's no live source (demo/prototype cubes, locked-down trials, managed metrics without formulas).
If rehosting — full depth, fidelity recipes, and the exact shapes are in refs/path-b-rehost.md — the cube's data still extracts cleanly even though its model doesn't:
Cartesian Join Governing abort); the auto Row Count - <name> metrics enumerate the source tables. Run python3 scripts/extract-cube.py <cubeId> <outDir> — one CSV per table, with membership decided by the grand-total invariant (an attribute/measure is native to a table only if grouping that table's Row Count by it preserves the total — a foreign/conformed dim repeats rows), page-scoped label resolution while paging (POST /v2/cubes/{id}/instances then GET …/instances/{iid}?offset), and a fan-out guard (SUM(row-count)==table total, SUM(measure)==grand total) that fails loudly on cross-join inflation. A single-table cube (no Row Count - metrics) is the simple flatten-to-one-table case.COPY each CSV into the warehouse the Sigma connection reaches (quote identifiers to preserve display names; DATE_FORMAT/FIELD_OPTIONALLY_ENCLOSED_BY for messy CSV). The connection reads as a service role, not your loader's role, so the new tables stay invisible until you GRANT SELECT … TO ROLE <the connection's role> and schema-level sync: POST /v2/connections/{connectionId}/sync {"path":["DB","SCHEMA"]} (table-level sync 404s until the table is already discovered — sync the schema first). See refs/path-b-rehost.md / sigma-data-models.sql DM source over warehouse-table for these freshly-loaded tables — it runs live against the connection and resolves immediately, skipping the catalog-sync dependency (the role still needs SELECT; it also lets you alias clean display names). Skip Phase 1/2 (no bundle to extract) — build the DM + workbook directly, and lean hard on Phase 1.1's source capture + execute-instance value truth (a cube's KPIs are often a latest-period stat, and a chapter date filter drives the row subsets).assert-phase6-ran.rb is wired for the classic path — in path B it does not apply, but you still MUST run the parity gate and the source-fidelity Visual QA gate (compare the render to source_dossier.pdf, every page). Don't declare done on HTTP 200.Derived metrics — recover, then VERIFY across every period: a dossier's headline metrics (Revenue / Cost / margin %, or non-additive aggregations) are often dossier-level derived metrics that are not in the cube's
availableObjects, so they do NOT reduce from the rehosted base columns. Recover them rather than guess: pull their ids from an executed viz (definition.grid.columns[templateMetrics].elements), reverse-engineer the definition from the statement structure (which base rows they aggregate), and verify the formula against the executed viz values across EVERY period — not one — before trusting it. Reproduce as a Sigma DM metric; otherwise (Workstation export / ODBC, or approximate) label the approximation. Never silently ship a guessed metric as exact. (refs/path-b-rehost.md§3.)
If the source is a Report Services document (banded/print layout: invoices,
statements, form letters, where the printed PDF is the deliverable) rather than a
dossier, don't force it into a workbook. Convert it to a fixed-layout Sigma
Report with scripts/convert-rs-document.py. Its input is an
mstr-rs-document/1 definition (sections + controls in inches + a dataset bound
to a warehouse table). Its output is the POST /v2/reports body (/v2/reports/spec
is deprecated) plus feature-gaps.json and control-map.json. A grouping with a
page break between groups becomes invoice mode (one group per render via a
hidden-page list control; schedule one PDF per value). Without page breaks it
becomes banded mode (table groupings + subtotals). Read
refs/rs-document-reports.md first: the definition contract, the mapping, the
2026-10-29 live dry-run evidence (including why report-repeated-container can't
carry a banded invoice yet), and the limits. The MicroStrategy REST API doesn't
expose RS layout, so the definition is hand-built today
(fixtures/rs-documents/tutorial-invoice.rs-document.json is the worked example).
A dry run is not parity. Create only with an approved destination, export the PDF,
compare it page by page with the MicroStrategy PDF, and review every layout /
review gap.
python3 scripts/convert-rs-document.py --document doc.rs-document.json \
--connection-id <conn> --folder-id <folder> \
--out report.json --gaps-out feature-gaps.json --map-out control-map.json
python3 tests/test_rs_document_report.py # offline golden + structure checks
python3 scripts/extract.py <dossierId> bundle.json
Walks dossier definition → dataset reports (showExpressionAs=tokens) →
referenced attributes / metrics (compound/derived chains of any depth) /
facts / logical tables / hierarchy relationships. Derived metrics (built
inside a report or dossier, not schema objects) 404 on /model/metrics/{id};
that is never fatal: extract.py recovers dossier-level arithmetic formulas
from /model/documents/{id} and parks the rest (report-level formulas are not
exposed) in bundle.unresolvedMetrics, which convert.py skips with a
⚠ derived metric warning; hand-author those (refs/mstr-rest-api.md
§Derived metrics). The bundle is the converter
contract — fixtures/bundle.json is a real, validated example. A dataset
written as hand-written Freeform SQL has no schema objects: extract.py
parks it in bundle.sqlDatasets (captured without executing the report) and
convert.py refuses the bundle. Convert those with
scripts/extract-sql-dataset.py → scripts/convert-sql-datasets.py (one
Custom SQL element per dataset); read refs/sql-datasets.md (endpoints
unverified live, not bound into a workbook yet). New extracts
carry _extraction.retrievedAtUtc; do not silently reuse a stale stored bundle
for a current migration.
Run this immediately after extraction, before destination selection or any Sigma catalog scan:
python3 scripts/plan_multifact.py bundle.json --out multi_fact_plan.json
Read refs/multifact-semantics.md for the MSTR→Sigma semantic crosswalk. A
fact expression's tables[] are candidate mappings, not tables that must all
be joined. The planner intersects each report's metric/fact candidates,
requires matching candidate attribute-key signatures, and mirrors
MicroStrategy's documented unique-lowest-logicalSize election:
single-fact-table reports can be migrated independently if the dossier's
reports do not mix their measures.alternate-table-mappings with one elected table continues automatically
through the normal star path. Verify the executed sqlView: source filters
and metric dimensionality can further constrain MSTR's choice.ambiguous-alternate-mappings means eligible tables tie or lack logical-size
evidence. Do not pick the first table.multi-pass means no one table resolves all report facts. Never join those
raw fact tables directly or delete mappings from bundle.json: both can fan
out financial measures.ApplySimple, rather than one physical
column, also routes to the conformed-SQL path; treating its expression text as
a warehouse column name is invalid.For either unresolved multi-table case, recover the executed report's resolved sqlView
after prompts, security substitutions, and filters have been applied. Turn its
multipass/volatile-table plan into one read-only SELECT or WITH query,
either with CTEs or by selecting from a customer-approved conformed warehouse
view. Preserve each pass's grain and outer-join semantics. The query must emit
every exact alias under conformedSqlContract.requiredColumns in
multi_fact_plan.json, including the generated MSTR Fact - … aliases.
Then continue through the normal converter—do not hand-author specs:
python3 scripts/convert.py --bundle bundle.json \
--connection-id <SIGMA_CONNECTION_ID> --database <DB> --folder-id <FOLDER_ID> \
--multi-fact-sql conformed.sql
The converter rejects unresolved placeholders, writes a Sigma sql data-model
source, and builds the workbook normally. The standard DM readback, workbook
readback, parity, and visual gates still apply. If the captured plan cannot be
expressed as one query, ask the customer to materialize the conformed view;
Sigma warehouse connections are read-only for this migration and the skill
must not create warehouse objects silently. A certificate warning from one
HTTP client, an unselected connection's health failure, or disabled warehouse
writeback is not this blocker—classify those as separate warnings.
The bundle gives you the data model and which vizzes exist; it does not tell you what the dossier looks like or what each viz actually displays. Both are required for a faithful migration — skip this and you will rebuild the right numbers in the wrong dashboard (and sometimes the wrong numbers). Two captures:
# (a) Pixel-faithful PDF of the live dossier — the layout/branding/arrangement reference.
python3 scripts/export-dossier-pdf.py <dossierId> source_dossier.pdf
# (a2) Source dashboard PNG at a gate-discovered path — arms the Phase-6 MEASURED gates 13/14:
python3 scripts/microstrategy-render-source.py <dossierId> --workdir <WORK> # -> <WORK>/dashboards/source.png (dossier PDF -> page-1 PNG; needs pdftoppm/magick/sips)
# Then READ that PNG and transcribe >=5 anchors EXACTLY as printed into <WORK>/source-anchors.json
# (every KPI, top-3 of each ranked list/table, one bucket per chart; schema: refs/source-anchors.md).
READ source_dossier.pdf before composing anything. Note, per page: the
element arrangement (columns/rows, what sits next to what), each viz's real
chart KIND (a "microcharts" or "kpi" type is not a bar table), branding/header
bands, and any controls/selector panels.
Read the dossier's own "Dashboard Details" / "About" chapter if it has one — it is a design spec handed to you. Polished dossiers frequently ship a documentation page describing each chapter's chart kinds, filters, and interactions ("panel stack with a panel selector", "grids with outline mode", "heat map … filters the horizontal stacked bar to the right", "synchronized-axis bar chart", "default dynamic selection filter set to the last 4 quarters", "linked text boxes"). Those phrases map directly to Sigma shapes (tabbed-container, pivot hierarchy, backgroundScale + cross-filter, trellis, last-N filter, navigate buttons) — see
refs/path-b-rehost.md§5.PDF-export limits (
export-dossier-pdf.py): it tends to render only the active/default chapter and blocks external images (whitelist) — the branding logo comes back empty and other chapters may be absent. So don't treat the PDF as the whole dashboard: execute every viz (below), and ask the customer for the logo asset (Sigmaimageneeds a hosted URL — no upload API). Match the source theme too (a dark dossier →settings.theme.name: Dark), not the default light canvas.
# (b) Execute the dossier instance and pull each visualization's grid + DISPLAYED values.
# The static definition's panelStacks carry NO grid metrics — you must execute:
# POST /dossiers/{id}/instances (v1; v2 404s) -> mid
# GET /v2/dossiers/{id}/instances/{mid}/chapters/{chapKey}/visualizations/{vizKey}
# Per-viz response gives definition.grid (rows/columns/metrics) + data.metricValues.
A page's top-level
visualizations[]is ALWAYS empty in the static definition — the real vizzes live inpanelStacks[].panels[].visualizations[](each carrieskey,name,visualizationType). NEVER conclude a page "has no visualizations" and emit a stub/placeholder from the empty page-level list — that is a bug, not an empty page. Walk panelStacks recursively (seeconvert.py:_walk_viz_keys), then execute eachkeyfor its grid+values. A page that looks empty means you read the wrong field. (This is the single most common way a migrated page comes out blank.)
Capture each viz's actual displayed values as the parity baseline. Two traps this surfaces that the bundle hides:
Sum over the filter window. Match the
number the card shows; don't assume the aggregation.Date Between …) found via …/instances/{mid}/definition → chapters[].filters
(NOT in the static /definition) is the reason row counts and totals look
"filtered." Apply the equivalent as a page/base filter so all elements inherit
it (a hidden base table with the filter, sourced by every element, is the
cleanest propagation).Sparklines and KPI comparison/delta badges are UI-only in the Sigma spec API
(see sigma-workbooks kpis.md) — reproduce the big-number value via formula,
and flag the sparkline/badge as a one-click editor follow-up rather than
claiming spec parity.
python3 scripts/convert.py --bundle bundle.json \
--connection-id <SIGMA_CONNECTION_ID> --database <DB> --folder-id <FOLDER_ID> \
[--inode-map inodes.json] \
[--multi-fact-sql conformed.sql] # required only by Phase-1 multi-fact recovery
Emits sigma_dm_spec.json (one table element per logical table, derived
left-outer joins, a consumable join element, token-parsed metrics with derived
display formats) + sigma_workbook_spec.json in the current workbook code
representation: outer name/folderId metadata plus
contents:{schemaVersion,kind,pages,elements,layout}. Workbook pages are
metadata-only, elements are flat, and the required authoritative layout assigns
every element to a page. The data-model spec deliberately retains its separate
pages[].elements[] nesting. The workbook contains one page per dossier chapter,
grouped tables mirroring each report template, controls from the dossier's
filter signals, and banded-layout container elements. Also emits
parity_keys.json + layout.xml (a human-readable copy of the embedded layout) +
control-scope.json + feature-gaps.json. The workbook spec carries
{{DATA_MODEL_ID}} / element-id placeholders until Phase 4 re-runs with real
ids.
Controls (refs/control-parity.md is the contract): MSTR dossiers DECLARE
selector targets (selectors[].targets = viz keys) — the strongest
source-scope signal of any BI tool — so each selector becomes a Sigma control
whose filters wire to exactly the table elements built from the declared
vizzes; chapter filter panels cover every element on their chapter's page.
Verified shapes baked in: filter targets only on TABLE elements; controls
AFTER their targets in spec order; date attributes → date-range with flat
mode: between (list-on-datetime targets are silently stripped); numeric
attributes bind through a hidden Text() cast column (a list-control filter
target on a NUMERIC column also posts 200 and reads back filters: null —
live-verified 2026-06-12). Panel selectors are navigation, not filters —
flagged MANUAL in the sidecar, never silently dropped. control-scope.json
carries sourceFilterSignals + per-control declared scope/mustReach for
gate 7.
Conversion patterns to know (details in refs/): grids group by the
attribute's KEY form and label with Max([DESC]); dim-keyed groupings get an
exclude [null] filter to mirror MSTR's inner joins; metrics referencing
metrics are inlined in workbook context, [Name]-referenced in DM context.
DM metric references (leverage the semantic layer, don't duplicate it). A metric
column prefers a governed [Metrics/<name>] reference over re-deriving the
aggregation inline, when its expanded inline aggregate matches a metric on the join
element (formula-equivalence match via the shared binder scripts/lib/metric_binding.py
— strip the --join-element-name prefix so Sum([Orders/Net Revenue]) equals a
metric's Sum([Net Revenue])). build_workbook_spec receives the just-built DM's
elements in-process (own metrics live on the join element). SAFE: composite/ratio
metrics stay inline (the workbook expands them with expand_metrics=True, while the DM
keeps [MetricName] refs, so they never match) and any non-match falls back to inline.
Empty metrics → byte-identical. Verified: tests/test_metric_reference.py.
If any report has an attribute whose DESC form differs from its key (the
converter's grouping output makes this visible — and resolve_ae_winners.py
detects it itself), MicroStrategy's Analytical Engine collapses non-unique key
groups to one representative row that cannot be derived from the model:
python3 scripts/resolve_ae_winners.py --connection-id <id> --database <DB> \
--folder-id <folderId> --out ae_winners.json
python3 scripts/convert.py ... --ae-winners ae_winners.json
It re-executes the affected reports in MSTR, computes the clean warehouse
groups via a throwaway Sigma probe workbook, pins each winner empirically, and
the converter emits a deterministic SQL element reproducing the grid. Read
refs/ae-row-collapse.md — this is the single biggest parity trap.
(Fixture path: fixtures/ae_winners.json carries the winners pinned during
the live validation, so the bundled fixture runs end-to-end without a
Strategy One instance.)
Before POSTing a new data model, score the org's existing Sigma DMs against this dossier's tables/columns and reuse on a strong match — don't create a 4th near-identical model:
python3 scripts/mstr-dm-signature.py --dm-spec sigma_dm_spec.json --out dm-signature.json
ruby scripts/find-or-pick-dm.rb --workbook-signature dm-signature.json \
--out dm-match.json [--auto-pick]
mstr-dm-signature.py derives {warehouse_tables, referenced_columns, measures}
from the Phase-2 sigma_dm_spec.json. find-or-pick-dm.rb scores each existing
DM (0.7·column + 0.2·table + 0.1·metric overlap):
dm-match.json. On
reuse, skip the Phase 3 POST and point Phase 4's workbook at the reused
dataModelId.--auto-pick (with tie-window safety).python3 scripts/sigma-request.py POST /v2/dataModels/spec \
--body sigma_dm_spec.json # -> dataModelId
python3 scripts/sigma-request.py GET /v2/dataModels/<dataModelId>/spec \
> dm_readback.yaml
The readback is YAML, with reassigned element ids — capture them as
dm_element_ids.json ({"<element name>": "<server id>"}). Gate: scan the
readback for any column with type: error (a spec can POST 200 yet carry
formulas that don't resolve at query time). Do not proceed on errors —
mcp__sigma-data-model__diagnose_sigma_save_error and the
sigma-data-models skill are the debugging path.
sigma_workbook_spec.jsonis thePOST /v2/workbooksbody and must becontents-wrapped, not flat (live-verified 2026-11-03, includingdryRun):schemaVersion/pages/kind/layoutnest under a top-levelcontentskey;name/folderIdstay outside it. A flat body (these fields at the file's root) 400s, andPOST /v2/workbooks/spec(document-wrapped) is deprecated.scripts/convert.pyemits the wrapped shape viacode_rep.create_body— the Phase 3 DM spec above is unaffected and stays flat.
python3 scripts/convert.py ... --data-model-id <dataModelId> \
--dm-element-ids dm_element_ids.json [--ae-winners ae_winners.json]
python3 scripts/sigma-request.py POST /v2/workbooks \
--body sigma_workbook_spec.json # -> workbookId
# MANDATORY run-each-time gap-scout gate (): the converter
# passes metric function names through, so a function with no Sigma equivalent
# surfaces HERE as a type=error column. This script STOPS (exit 11) on any
# UNSCOUTED error column — spawn a gap-scout per the printed --gap-id (see
# scripts/gap-scout.md), re-run the gate, and only proceed when it exits 0.
python3 scripts/scout-gate-readback.py --workbook-id <workbookId> --workdir <out-dir>
# Read back, validate, and confirm contents.layout + flat contents.elements survived.
python3 scripts/sigma-request.py GET "/v2/workbooks/<workbookId>?includeContents=true" \
> <out-dir>/workbook-readback.json
# Run from the companion sigma-workbooks skill directory (its validator still
# expects the `document` wrapper, so re-key the readback's `contents` first):
jq '{document: .contents}' <absolute-out-dir>/workbook-readback.json \
> <absolute-out-dir>/workbook-readback.validate.json
./scripts/validate-spec.sh <absolute-out-dir>/workbook-readback.validate.json
# put-layout.rb is now a repair/reapply tool, not the normal create path:
# ruby scripts/put-layout.rb --workbook <workbookId> --layout layout.xml
The create body already applies the banded contents.layout (header band titled
from the chapter/dossier name, navigation/controls bands, full-width content).
Layout is required and authoritative: without it flat elements have no reliable
page membership and the workbook falls back to a broken stack. put-layout.rb
remains available to reapply a corrected layout and uses CodeRep helpers to keep
pages metadata-only and elements flat. The scout-gate-readback.py step above is the mechanical version
of the old "confirm no type: error columns" check — do NOT skip it; a broken
metric must be scouted (translated or escalated) before the workbook ships, not
waved through. (Workbook DELETE, if you need to retry, is
DELETE /v2/files/<id> — not /v2/workbooks/<id>.)
Expected values come from MicroStrategy, never invented: execute each
report via POST /api/v2/reports/{id}/instances?limit=N and write
expected_parity.json ({"<report name>": [{"keys": [...], "values": {...}}]}
— fixtures/expected_parity.json is the shape). Then:
python3 scripts/verify_parity.py --workbook-id <workbookId> \
--expected expected_parity.json --report parity_report.md
Exports every workbook element to CSV via the Sigma export API and compares row-by-row (money/counts exact; ratio metrics rel 1e-6). GREEN only when every report PASSes — never on a 200 POST alone. Mind freshness: Sigma reads the live warehouse; if rows landed since the MSTR numbers were captured, re-capture before calling a delta a failure (reconcile the delta against the post-snapshot rows — the fixture's shared demo tables drift daily).
It also writes the gate sentinels parity-final.json + wb-ids.json next to
the report — the contract Phase 6 reads.
A workbook that POSTs 200 and passes row parity can still be the wrong
dashboard — right numbers, wrong look. This gate has TWO parts: source
fidelity (does it resemble the original?) and intrinsic quality (is it
cleanly laid out?). Both must pass. Sigma's grid has no z-order; the shared
layout lib de-overlaps bands, but this gate is the safety net (without a
layout — document.layout in the current wrapped spec shape, see Phase 4 —
the workbook renders as a single-column stack).
python3 scripts/sigma-export-png.py --workbook <id> --page <pageId> --out /tmp/<page>.png --w 1600source_dossier.pdf and compare page-for-page against the
refs/layout-visual-qa.md "Source-fidelity parity" checklist: same element
set, same relative arrangement (3-column stays 3-column), matching chart
KINDS (KPI vs bar vs table), KPI showing the same VALUE as the source card,
selector/control panels present, branding bands present (or explicitly
descoped with the user). A render that looks nothing like the PDF FAILS even
if parity is green.scripts/wb-rep.rb (full-clone: plugins/sigma-authoring/skills/sigma-workbooks/scripts/wb-rep.rb; pull → edit → push) — then re-render and re-compare.ruby scripts/verify-anchors.rb --workdir <dir> --workbook-id <workbookId> # -> anchors-verdict.json (gate 13; Phase 1.1 landed dashboards/source.png + source-anchors.json)
ruby scripts/assert-phase6-ran.rb --workdir <dir> --workbook-id <workbookId>
The shared gates (vendored byte-identical): parity ran + PASS,
no orphan workbooks, no live type=error columns, layout applied, tile
census (skipped — this converter does not emit one), layout lint (gate 6:
no raw-id titles, no orphan controls, no dead zones, no generic "Page N"
header, no under-filled bands), and control lint (gate 7: no dead
controls, no ghost targets, full declared reach, control-scope.json
coverage — an interactive dossier converting to zero controls FAILS), plus the
measured bars from Phase 1.1: gate 13 (source-anchor values — source-anchors.json
≥5 + a passing anchors-verdict.json; arms once dashboards/source.png is on disk;
--skip-anchors-gate "<reason>") and gate 14 (visual-similarity floor — measured
vs the source PNG; --skip-visual-similarity "<reason>"); no source PNG → both
self-SKIP (stated), never a silent pass.
Exit 0 = GREEN. Optional runtime proof after the lint passes:
ruby scripts/probe-controls.rb --workbook-id <workbookId> --check-out-of-closure
# numeric selectors bind via a hidden "<Name> (Filter)" Text() column the
# auto-picker can't see — pass --value, e.g. --value YearFilter=2024
Converted (live-validated): classic schema → DM (logical tables → table
elements; attribute key forms on fact+lookup → left-outer joins; heterogeneous
key columns; facts + token-parsed metrics incl. Count<Distinct=True> →
CountDistinct and compound metrics; semantic display formats) · dossier
chapters → workbook pages with grouped tables (KEY-form grouping + Max(DESC)
labels + null-exclude filters) · AE row-collapse reports → deterministic
pinned-winner SQL elements · chapter filters + attribute selectors → Sigma
controls wired to the selectors' DECLARED viz targets (gate-7-verified +
flip-tested) with banded layout · released workbook code surfaces when grounded
in source metadata: waterfall charts; chart legends; chapter navigation tabs;
fully populated panel-stack tabbed containers; explicit print page breaks;
explicit-value progress gauges; allowlisted styling; and explicit repeaters.
Every partial panel/repeater/style translation is recorded in
feature-gaps.json. Box plots remain capability-gated and default to a loud
table fallback.
Report Services documents → Sigma Reports (dry-run-verified, not yet
PDF-parity-proven): page header/footer panels; positioned text with
attribute/metric/auto-text tokens; lines; header bands; a paginated detail table;
dataset filters; invoice mode (page break per group) and banded mode (grouped
subtotals). There's no definition extractor yet, and graphs/grids/panel stacks/
selectors inside documents are blocking gaps. See refs/rs-document-reports.md.
Plugin tier: viz types with no native Sigma analog (heat_map — a
treemap — plus sankey, network, sunburst) are matched with a bespoke plugin
element, not degraded to a table; see refs/plugin-tier.md. If you do ship a
degraded tile, the visual-QA report must NAME it as an approximation and say
what encoding was lost — never fold it into "matches".
Flagged / roadmap: unmapped or unwired viz types → flagged table fallback
(refs/viz-type-mapping.md); KPI/pie/combo/scatter and other non-axis-generic
chart emission; type-only gauges without value/range semantics; box plots unless
the operator explicitly enables the workspace capability; standalone
legend/drill selectors without complete released source/target bindings;
metric-condition selectors / report page-by / prompts
(metric qualification selectors land in control-scope.json unbound as
MANUAL); panel selectors (navigation — flagged MANUAL); the newer
REST-authorable "Data Model" object incl. securityFilters (the future RLS
port surface — until then, ask the customer about security filters
explicitly; never assume an estate has none just because the classic extract
doesn't carry them). Browser OAuth does not change this limitation: there is no
automated MicroStrategy RLS port path yet, so a security-filter finding is a
hard stop for an explicit port/skip decision, never a silent omission.
DELETE /api/model/schema/lock; reports do NOT
use changesets; lowercase x-mstr-ms-instance response header; PUT
relationships REPLACES the parent list — refs/mstr-rest-api.md.Count(Customer)) → cartesian governance aborts —
count a fact/key column instead; compound denominators need ZeroToNull()
or Snowflake kills the report — refs/design-notes.md.filters: null on readback) — dates → date-range
controls, numbers → hidden Text() cast column (convert.py handles both;
gate 7 catches escapes).VERIFY_X509_STRICT) —
mstr.py handles it.QUICKSTART.md (opens in a new tab)fixtures/BUILD_SPEC.md (opens in a new tab)fixtures/ae_winners.json (opens in a new tab)fixtures/build_schema.py (opens in a new tab)fixtures/bundle-charts.json (opens in a new tab)fixtures/bundle.json (opens in a new tab)fixtures/datamodel_definition.json (opens in a new tab)fixtures/derived-metrics/model-document.tutorial.json (opens in a new tab)fixtures/dossier_definition.json (opens in a new tab)fixtures/expected_parity.json (opens in a new tab)fixtures/rs-documents/golden/tutorial-invoice.feature-gaps.json (opens in a new tab)fixtures/rs-documents/golden/tutorial-invoice.report.json (opens in a new tab)fixtures/rs-documents/tutorial-invoice.rs-document.json (opens in a new tab)fixtures/sql-datasets/desk-coverage-pnl.sql-datasets.json (opens in a new tab)fixtures/sql-datasets/golden/desk-coverage-pnl.dm.json (opens in a new tab)fixtures/sql-datasets/golden/desk-coverage-pnl.gaps.json (opens in a new tab)refs/ae-row-collapse.md (opens in a new tab)refs/app-recommendation-signals.md (opens in a new tab)refs/blind-grader-brief.md (opens in a new tab)refs/catalogs/aggregation.json (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub sigmacomputing/sigma-migration-skills --plugin microstrategy-to-sigma2 skills in this plugin