← LucenCONTENT HISTORY

Update to Lucen

Snapshot Nov 24, 2026 · 06:10 UTC · version 1.0.0

Collection source: downloaded plugin package.

WHAT CHANGED

First saved snapshot

No earlier snapshot is available to establish a change.

Save Lucen and check future changes in Following.

Up to 3 plugins free · no card required.

Compare saved observations

Download comparison JSON
Full technical diff · 0 changed fields
Full snapshot data
{
  "description": "Author Lucen Blocks dashboards over MCP. Trigger when the user wants to create, edit, restyle, or rearrange a Blocks page/dashboard; change chart colours or types; add KPIs with period comparison; compose rows/stacks/markdown; or anything involving upsert_page / get_page / list_pages for Lucen Blocks.",
  "included_files": [
    {
      "relative_path": "references/anti-patterns.md",
      "size_in_bytes": 7158
    },
    {
      "relative_path": "references/chart-decision-tree.md",
      "size_in_bytes": 4977
    },
    {
      "relative_path": "references/layout-recipes.md",
      "size_in_bytes": 5082
    },
    {
      "relative_path": "references/widget-catalog.md",
      "size_in_bytes": 17556
    }
  ],
  "name": "lucen-blocks",
  "skill_md_contents": "---\nname: lucen-blocks\ndescription: \"Author Lucen Blocks dashboards over MCP. Trigger when the user wants to create, edit, restyle, or rearrange a Blocks page/dashboard; change chart colours or types; add KPIs with period comparison; compose rows/stacks/markdown; or anything involving upsert_page / get_page / list_pages for Lucen Blocks.\"\nskill_version: 2026-09-30\n# Keep skill_version in sync with `_LUCEN_BLOCKS_SKILL_VERSION` in\n# platform/src/lucen_platform/ai/mcp/server.py.\n---\n\n# Lucen Blocks authoring guide\n\nThis skill **is** the authoring guide. Follow it before `upsert_page` or any restyle. Lucen renders a declarative PageSpec — you never emit React/CSS. Publishing is a human click in the portal; you only write drafts.\n\nRequires the **Lucen MCP server** (write scope) for `upsert_page`. Pair with **lucen-data** for `find_query` / `save_query`. If this skill is not installed, `get_blocks_guide` is an optional MCP fallback — do not call it when this skill is already loaded.\n\n## Before you build: intake\n\nA request like \"quiero un tablero de creatividades\" names an intent and nothing\nelse. Do not fill the gaps yourself — the generic answer (KPI strip + bars) is a\ndifferent page from the one asked for. Left alone, that is exactly what gets\nbuilt.\n\n1. Call `plan_page(request)` with the user's **exact words**. It is deterministic:\n   it reads the intent (creatives / funnel / trend / campaigns / overview), lists\n   which decisions are open (`open_decisions`: goal, period, metrics, platform,\n   most consequential first) and attaches `context` — this organization's relevant\n   gold tables with their columns, connected platforms, `data_as_of`, existing pages.\n   It does **not** write the questions.\n2. If `open_decisions` is non-empty, **you** write the questions: one per open\n   decision, at most `max_questions`, in the user's language, all in one message.\n   Ground each one in `context` — name the real columns and platforms, offer two or\n   three concrete options, mention how fresh the data is when offering periods. A\n   question that would fit any organization is a bad question. State the\n   `assumptions` you will apply so they can correct them in the same reply, then\n   stop. Do not call `find_query`, `save_query` or `upsert_page` until they answer.\n   \"You decide\" is an answer; silence is not.\n3. If `existing_page_slug` is set, ask whether to update that page or make a new one.\n4. Once `ready_to_build` (or the user answered), restate in one or two lines what\n   you will build — widgets, period, metrics — and proceed. Pass the user's words\n   to `upsert_page` as `prompt`: the server checks the spec against them and holds\n   the write (`state: \"needs_confirmation\"`) when a creatives / funnel / trend\n   request has no `gallery` / `funnel` / `timeseries`. Never pass `confirmed: true`\n   unless the user explicitly chose that layout after seeing the mismatch.\n\nIntent words that must change the widget, not just the title: *creativos,\ncreatividades, anuncios, piezas, imágenes, creatives, ads* → `gallery` (ad-grain\nquery, `media_id = creative_id`). *Embudo, funnel* → `funnel`. *Evolución,\ntendencia, por día, over time* → `timeseries`.\n\n## Authoring loop\n\n0. Intake above. Questions first when the request is one line.\n1. `find_query(question)` — HIT → reuse `query_version_id`; MISS → `list_tables` → SQL → `run_bigquery` → user approves → `save_query`\n2. **Create:** compose a PageSpec (`title`, `params`, `body`) and `upsert_page(spec, prompt=<user's words>)` → send the user `preview_url`\n3. **Edit:** `get_page(slug)` then `upsert_page(slug, patch=[...])`. Never resend the full body for a small change\n4. Iterate on the draft; never claim you published\n\n**Which page.** Every page in Lucen shows a copyable ID next to its title. When the user pastes one (a UUID, or its first 8 characters), pass it as `page_id` to `get_page` and `upsert_page` instead of `slug` (and as `page_id` to `create_alert` and `create_report`), and do not look the page up by title: titles repeat (an agency has a \"Meta Ads\" page under each client). A `page_id` also names its org, so `org_id` can be omitted. Without an ID, `list_pages` gives each page's `path` (`[\"Client A\", \"Meta Ads\"]`); when two pages share a title, name them by path and ask which one.\n\n`upsert_page` takes exactly one of `spec` or `patch`. `patch` requires `slug` or `page_id`. Ops are keyed by node `id`: `set` (title/subtitle/span/height), `remove`, `move`, `insert`, `replace`, `set_page`. A patch copies the rest of the tree, so an unrelated widget cannot disappear.\n\nA later full `spec` write reapplies stored span/height (`layout_prefs`) onto surviving node ids. Prefs for ids that are not in the spec you just wrote are dropped, so a deleted widget cannot haunt a later reincarnation of the same id.\n\nPass `apply_layout_prefs=false` when the user asked to redo the layout from scratch, **or** when a full spec includes explicit span/height the user just asked for (\"make this KPI full width\"). Otherwise a previous portal resize silently overwrites the spans you wrote.\n\nTo change one widget's width or height, always `patch` a `set`. That updates `layout_prefs`. Do not send a full spec just to change a span.\n\n## Hard rules\n\n- Widgets bind to `query_version_id` via `data.query` — **never inline SQL**\n- Layout is a **flow tree**: `row` (horizontal, spans in twelfths) + `stack` (vertical). No x/y/w/h grid\n- Every page `params` control must reach every widget (query declares the param) or the widget lists it in `data.ignores`\n- Heights are tokens: `sm|md|lg|xl`. Widths are `span` 1–12\n- Prefer named palettes; use `#RRGGBB` only when the user asks for a specific colour\n- **Do not rewrite the PageSpec to change a span, move a widget, retitle, or delete.** Use `patch`.\n\n## Colour policy\n\n| Prefer | When |\n|---|---|\n| `palette: \"lucen\"\\|\"ocean\"\\|\"mono\"\\|\"org\"` on page or widget | Default / restyle |\n| `emphasis: [{ when, value, means: \"good\\|bad\\|warning\\|muted\", column? }]` | Threshold colouring (ACOS > 100% → bad). `when` is `above\\|at_or_above\\|below\\|at_or_below\\|equals\\|not_equals`. Unmatched rows recede to the overflow slate automatically; do not paint them `muted` unless that is the meaning. |\n| `y[].color` or `series_colors: { \"meta\": \"#0C2AEA\" }` | User named an exact hex |\n\nThere is **no** `style` / `css` / `className` field. `\"red\"` is invalid — use `#DC2626` or `means: \"bad\"`.\n\n## Params every dashboard should declare\n\n```json\n\"params\": [\n  { \"type\": \"date_range\", \"name\": \"date_range\", \"default\": \"last_30d\" },\n  { \"type\": \"comparison\", \"name\": \"comparison\", \"default\": \"previous_period\" }\n]\n```\n\nAdd `select` / `multi_select` controls for any dimension the page should slice\n(channel, campaign, product). Ship `options` when the values are known and stable;\nleave `options` empty only when a dimension cache will fill them. Every widget's\nquery must declare the same param name, or list it in `data.ignores`.\n\nKPIs with `compare: true` (default) get “↑ 12.6% vs prev 30d” for free — the executor re-runs the query on the shifted window. Set `value.direction` to `higher_is_better`, `lower_is_better`, or `neutral`.\n\n## Chart choice\n\nSee [references/chart-decision-tree.md](references/chart-decision-tree.md). Pick the widget from the question (KPI vs trend vs ranking vs composition vs table), not from a gallery.\n\n## Creative galleries (Meta, MercadoLibre, TiendaNube)\n\n`gallery` draws one card per row: the image, up to 4 footer metrics and a status\nchip. `table` can also show images and links per-column (see\n[references/widget-catalog.md](references/widget-catalog.md), `## table`) — this\nsection covers the media-resolution rules both widgets share.\n`media_platform` picks how `media_id`\nis resolved -- `\"meta\"` (default), `\"facebook_page\"`, `\"instagram\"`, `\"mercadolibre\"`,\n`\"tiendanube\"` -- and each has its own hard requirement that is easy to miss.\n`\"meta\"`, `\"facebook_page\"` and `\"instagram\"` are the **cached** platforms: `media_id`\nis an id, and Lucen stores the image in its own bucket.\n\n**For `media_platform: \"meta\"`, the query must be at ad grain.** `media_id` names\nthe column holding Meta's `creative_id`, and a query aggregated by campaign does not\nhave one — there is no creative id at campaign grain, so the widget renders nothing.\nGroup by ad (or by creative), not by campaign or ad set, and select the creative id\ncolumn explicitly. `campaign_id`, `adset_id` and `ad_id` are all the wrong column:\nonly the creative id resolves to an image.\n\n**For `media_platform: \"facebook_page\"`, the query must be at post or reel grain.**\nA gallery of Page posts reads `gold_facebook_page_post` with `media_id: \"post_id\"`; a\ngallery of reels reads `gold_facebook_page_reel` with `media_id: \"video_id\"`. **For\n`media_platform: \"instagram\"`**, read `gold_instagram_media` with `media_id: \"media_id\"`\n(organic posts and reels; an Instagram post promoted as an ad is still a `\"meta\"`\ncreative). Never put `image_url` in `media_id`: it is the expiring Meta CDN link, kept\nfor SQL and Ask, and a URL resolves to `missing`. And never put an organic id on\n`media_platform: \"meta\"` (the default): it looks like a creative id and is fetched as\nan ad creative, which fails.\n\n**For `media_platform: \"mercadolibre\"` / `\"tiendanube\"`, the query must be at\nitem/product grain**, and `media_id` must select the gold layer's `thumbnail_url`\ncolumn directly — it already holds the final public image URL, not an id.\n\nMeta example:\n\n```json\n{\n  \"type\": \"gallery\",\n  \"id\": \"gal_creatives\",\n  \"title\": \"Creativos\",\n  \"data\": { \"query\": \"<query_version_id>\" },\n  \"media_id\": \"creative_id\",\n  \"title_column\": \"ad_name\",\n  \"status_column\": \"status\",\n  \"metrics\": [\n    { \"column\": \"spend\", \"format\": \"currency_compact\", \"direction\": \"neutral\" },\n    { \"column\": \"roas\", \"format\": \"ratio\", \"direction\": \"higher_is_better\" }\n  ],\n  \"sort\": { \"column\": \"spend\", \"order\": \"desc\" },\n  \"limit\": 24\n}\n```\n\nMercadoLibre / TiendaNube example — same shape, one extra field\n(`media_platform`), and no `status_column` because these rows carry no ad status:\n\n```json\n{\n  \"type\": \"gallery\",\n  \"id\": \"gal_products\",\n  \"title\": \"Productos\",\n  \"data\": { \"query\": \"<query_version_id>\" },\n  \"media_platform\": \"mercadolibre\",\n  \"media_id\": \"thumbnail_url\",\n  \"title_column\": \"item_title\",\n  \"metrics\": [\n    { \"column\": \"units_sold\", \"format\": \"number\", \"direction\": \"higher_is_better\" },\n    { \"column\": \"revenue\", \"format\": \"currency_compact\", \"direction\": \"higher_is_better\" }\n  ],\n  \"sort\": { \"column\": \"revenue\", \"order\": \"desc\" },\n  \"limit\": 24\n}\n```\n\n`\"tiendanube\"` is identical except `media_platform: \"tiendanube\"` and a query\nagainst `gold_tiendanube_product_performance` instead of\n`gold_mercadolibre_items`.\n\nFacebook Page example (Instagram is the same with `media_platform: \"instagram\"`,\n`media_id: \"media_id\"` and a query on `gold_instagram_media`):\n\n```json\n{\n  \"type\": \"gallery\",\n  \"id\": \"gal_posts\",\n  \"title\": \"Posts\",\n  \"data\": { \"query\": \"<query_version_id>\" },\n  \"media_platform\": \"facebook_page\",\n  \"media_id\": \"post_id\",\n  \"title_column\": \"text\",\n  \"metrics\": [\n    { \"column\": \"cumulative_views\", \"format\": \"number_compact\", \"direction\": \"higher_is_better\" }\n  ],\n  \"sort\": { \"column\": \"published_at\", \"order\": \"desc\" },\n  \"limit\": 24\n}\n```\n\n- `sort` and `limit` are applied **by the executor** here (and on `bar` / `pie` /\n  `table` via `widgets[<id>].order`). Do not also rank and cap in SQL. `limit` defaults to 24\n  and is hard-capped at 60; it always bounds the cards drawn. For the cached platforms\n  (`\"meta\"`, `\"facebook_page\"`, `\"instagram\"`) it also bounds how many ids are resolved\n  and cached per render.\n- For the **cached platforms**, images are served **by Lucen from its own bucket**,\n  never by Meta. Meta's URLs are signed and expire within days, so the row payload\n  never carries a provider CDN URL — the query supplies the id in `media_id`. A reel\n  or video card shows its still thumbnail, never the video. For\n  **`\"mercadolibre\"` / `\"tiendanube\"`**, put the gold layer's final `thumbnail_url` in\n  `media_id`; Lucen never re-hosts those images.\n- For the **cached platforms** only: cards are `pending` on the first render of a new\n  gallery and fill in over a short polling cycle as the cache warms. The other states\n  are `ok`, `unsupported` (no fetchable still, e.g. a text-only Page post) and\n  `missing` (fetch failed, or `media_id` is not an id of that platform). Grey cards on\n  first load are expected, not a bug. Share links never fill: they show only what is\n  already cached. **`\"mercadolibre\"` / `\"tiendanube\"`** cards are `ok` on the first\n  render — no polling.\n- Each cached platform needs a live connection: `\"meta\"` a Meta Ads\n  (`meta_marketing`) connection, `\"facebook_page\"` a `facebook_page` connection,\n  `\"instagram\"` an `instagram_organic` connection. `\"mercadolibre\"` and `\"tiendanube\"`\n  need no connection because `media_id` already holds the image URL.\n- For **`\"mercadolibre\"` / `\"tiendanube\"`**, `media_id` is validated, not trusted as-is:\n  it must be an `https` URL on `*.mlstatic.com` / `*.mitiendanube.com`. Anything else\n  (wrong scheme, wrong host, a malformed value) resolves to `missing` instead of\n  rendering — a query that selects the wrong column into `media_id` fails visibly as a\n  grey/missing card, not by putting an arbitrary string into the page's `<img src>`.\n  See [references/widget-catalog.md](references/widget-catalog.md)\n  (`## gallery`).\n\nFor a `table`, set `type: \"image\"` on a `ColumnSpec` instead of using a\ndedicated media widget — the column's own value is the reference, and\n`media_platform` goes on the `table` widget itself (same five values,\nsame resolution rules as above). See\n[references/widget-catalog.md](references/widget-catalog.md) (`## table`)\nfor the exact shape.\n\n## Widget cheat sheet\n\nSee [references/widget-catalog.md](references/widget-catalog.md).\n\n## Layout recipes\n\nSee [references/layout-recipes.md](references/layout-recipes.md).\n\n## Anti-patterns\n\nSee [references/anti-patterns.md](references/anti-patterns.md).\n\n## Markdown\n\n- Page title is H1 — do **not** use `#` for the page name\n- `## Section` → Lucen `// SECTION //` chrome\n- `###` → normal H3\n- GFM + small HTML allowlist (no script, iframe, image, inline style, free class)\n\n## Minimal KPI strip example\n\n```json\n{\n  \"title\": \"Overview\",\n  \"palette\": \"lucen\",\n  \"params\": [\n    { \"type\": \"date_range\", \"name\": \"date_range\", \"default\": \"last_30d\" },\n    { \"type\": \"comparison\", \"name\": \"comparison\", \"default\": \"previous_period\" }\n  ],\n  \"body\": [\n    {\n      \"type\": \"row\",\n      \"id\": \"kpis\",\n      \"children\": [\n        {\n          \"type\": \"kpi\",\n          \"id\": \"kpi_revenue\",\n          \"span\": 3,\n          \"title\": \"Facturación\",\n          \"data\": { \"query\": \"<query_version_id>\" },\n          \"value\": {\n            \"column\": \"revenue\",\n            \"format\": \"currency_compact\",\n            \"direction\": \"higher_is_better\"\n          }\n        }\n      ]\n    },\n    {\n      \"type\": \"timeseries\",\n      \"id\": \"rev_daily\",\n      \"title\": \"Evolución\",\n      \"height\": \"md\",\n      \"chart\": \"area\",\n      \"data\": { \"query\": \"<query_version_id>\" },\n      \"x\": \"day\",\n      \"y\": [{ \"column\": \"revenue\", \"format\": \"currency_compact\", \"label\": \"Facturación\" }]\n    }\n  ]\n}\n```\n"
}

SHA-256 of public snapshot: 2a8286cad1e575e52a6f14e7908f4194224d366b5804d66dab9f9f03c853da19