--- name: crux-skill-memory-meditation-report description: Mandatory paired HTML+PDF report generation for meditation: Comprehensiveness Level Mapping (12 dimensions × 4 levels), anti-homogenisation rules, Universal Contrast, light/dark mode + print TOC, Chart.js / D3 / calculator content minima with static fallbacks, Per-Branch Section Rule, Depth-3 Leaf Inclusion Rule, Peer-Review Surfacing Rule, Init-Suggestions Honour rules, K10b Per-Cheap-Type Rendering Contract (7 cheap types), and Report-Skill Respawn Protocol resume-handler. Use when the `crux-cursor-meditation-guide` agent runs report generation (step 12), when the ensemble aggregator generates the ensemble-level report, or when the report skill is respawned via Dim 13. --- # CRUX Skill: Memory Meditation — Report Generation Implements the mandatory paired HTML+PDF report generation contract: Comprehensiveness Level Mapping, Anti-Homogenisation Rules, Universal Contrast, light/dark mode + print TOC, Chart.js / D3 / calculator with static fallbacks, Subject-Matter Focus rule, Init-Suggestions Honour, K10b Per-Cheap-Type Rendering Contract, headless Chrome → Chromium degradation, and the Report-Skill Respawn Protocol resume-handler. ## When to Use Load this skill when: - The `crux-cursor-meditation-guide` agent runs report generation at step 12 of the depth-0 manager workflow - The `crux-cursor-meditation-guide` ensemble aggregator generates the ensemble-level report (step 4 of Ensemble Aggregation) - The report skill is respawned via Dim 13 of the adversarial review (Report-Skill Respawn Protocol) ## Prerequisites 1. Adversarial review verdict is `PASS` or `PASS_WITH_ADVISORIES` — **never run on `ESCALATE`** 2. `comprehensiveness:` payload is present — abort with: "`comprehensiveness:` payload required; missing from spawn prompt — caller misconfigured" if missing 3. `theming:` payload is present — abort with a clear error pointing at Theme Preflight if missing 4. All meditation files are available in the working directory ## Comprehensiveness Level Mapping (contract) The report-generation skill reads the `comprehensiveness:` payload from its spawn prompt. Every subsection that cites a content minimum (charts, infographics, calculators, section depth, leaf inclusion) reads from this payload rather than hard-coding fixed numerals. **`comprehensiveness:` payload fields consumed by report generation:** | # | Dimension (`comprehensiveness.minima.*`) | `compact` | `default` | `detailed` | `exhaustive` | |---|------------------------------------------|-----------|-----------|------------|--------------| | 1 | `minima.charts.count` | **4** | 5 | 7 | 10 | | 2 | `minima.charts.types_required` | Any 4 distinct from Chart.js + D3 mix | ≥5 distinct, ≥1 D3-advanced (sunburst, sankey, force-directed, parallel-coordinates, choropleth) | ≥7 distinct, ≥2 D3-advanced, ≥1 per facet-kind: comparison, trend, distribution | ≥10 distinct, ≥3 D3-advanced, ≥1 per facet-kind: comparison, trend, distribution, composition, network/relationship, geo (when topic supports geo) | | 3 | `minima.infographics.count` | **3** | 4 | 6 | 8 | | 4 | `minima.infographics.types_required` | Any 3 distinct from the existing menu | ≥4 distinct, ≥1 hierarchy, ≥1 process/flow | ≥6 distinct, ≥1 hierarchy, ≥1 process/flow, ≥1 comparison (matrix/quadrant) | ≥8 distinct, ≥1 each of: hierarchy, process/flow, comparison, taxonomy, timeline, persona | | 5 | `minima.calculators.count` | **1** | 1 | 2 | 3 | | 6 | `minima.calculators.scenarios_per` | **3** | 4 | 5 | 5 | | 7 | `depth3_leaf_inclusion` | `summary` | `summary` | `verbatim_quotes` | `verbatim_quotes` | | 8 | `per_branch_section_depth` | `consolidation_only` | `branch_summary` | `per_leaf_detail` | `per_leaf_detail` | | 9 | `citation_density` | Research=`mandatory`; Quick=`warn_only` | Research=`mandatory`; Quick=`warn_only` | Research=`mandatory`; Quick=`warn_only` | Research=`per_finding_table`; Quick=`warn_only` with per-finding-table column (placeholder text for missing citations) | | 10 | `peer_review_surfacing` | `consolidation_only` | `consolidation_only` | `named_section` | `per_branch_dedicated` | | 11 | `section_length_budget_tokens` | `{ hero: 800, per_facet: 2500, citations: 1000 }` | `{ hero: 1200, per_facet: 4000, citations: 1500 }` | `{ hero: 1800, per_facet: 6500, citations: 2000 }` | `{ hero: 2400, per_facet: 9500, citations: 2500 }` | | 12 | `ensemble_cross_model_depth` | `per_facet_cards` | `per_facet_cards` | `per_leaf_attribution` | `per_leaf_attribution` | **`compact` backwards-compatibility anchor**: The `compact` row reproduces the pre-richness-feature behaviour byte-for-byte (4 charts, 3 infographics, 1 calculator, 3 scenarios per calculator, depth-3 leaf content elided beyond summary, all per-branch content folded into consolidation prose only, peer-review content folded into consolidation prose only). All subsections must produce identical output for a `compact` run as the pre-richness codebase did. **Subagent-abort rule**: if the `comprehensiveness:` payload is missing from the spawn prompt, abort with: "`comprehensiveness:` payload required; missing from spawn prompt — caller misconfigured." ## Paired HTML+PDF Rule Use the meditation's **topic slug** plus a UTC timestamp captured at the moment of report generation: TS=$(date -u +%Y%m%d%H%M%S) SLUG="{topic-slug}" HTML="{workingDir}/report-${SLUG}-${TS}.html" PDF="{workingDir}/report-${SLUG}-${TS}.pdf" - `{topic-slug}` MUST exactly match the slug component of the working-directory name. - The HTML and PDF for a single generation share the same timestamp. - All references match these files via the prefix glob `report-{topic-slug}-*.html` / `report-{topic-slug}-*.pdf`. **Never hard-code `report.html` / `report.pdf`.** - Respawned reports get a fresh timestamp. The prior HTML/PDF pair is **preserved on disk** for diff inspection. ## Inputs 1. **Read all meditation files**: Load `consolidation.md`, `facets.md`, `facet-registry.yml` (Research mode), `citations-index.yml` (Research mode), all `branch-*-depth-*-sub-*-*.md` files, and all `branch-*-peer-review-*.md` files (Research mode) from the working directory. 2. **Read `init-suggestions-{ts}.yml`** if it exists (honour rules below). 3. **Read `finalisation-enhancements.yml`** if it exists and has accepted cheap entries (K10b rendering below). 4. **Read `model_strategy` from `facets.md` frontmatter** (per the `crux-skill-memory-meditation-coordination` skill's `facets.md` frontmatter spec). The model strategy drives per-branch attribution annotations (per the **Per-Branch Model Attribution** section below) and the footer annotation. ## Anti-Homogenisation Rules AI-generated reports converge on a recognisable homogenised aesthetic. **All of the following defaults are forbidden** unless the user's `theming` payload explicitly invoked them by name: - **Purple-blue gradient hero** (`linear-gradient(135deg, indigo, blue/violet)` and friends). - **Inter as the headline font weight 700**. Default to a font dictated by the `theming.preset.typography` value or the matched repo signal. - **Three-card feature grids** as the dominant layout. Vary layout per section (asymmetric grids, single hero panel, two-column with sidebar, full-bleed tables, masonry). - **Doughnut chart with circular tinted-color legend chips**. Either move the legend, change its shape, or pick a different chart for the same data. - **Tailwind `indigo-500` (or its variants `#6366f1`, `#818cf8`) as the accent**. Pick a palette from the `theming` payload. - **Lucide-style icon-in-tinted-circle motif** for stat cards and bullets. - **Centred body paragraphs** and **gradient "Most popular" pricing pills** as filler. - **Five-star testimonial rows** and **DiceBear avatar fallbacks**. - **Smooth modern dark blue UI**, full stop, when no theming choice asked for it. How to apply this: 1. Before writing any CSS, look at the `theming` payload and pick concrete values (font stack, primary/secondary/accent hex, layout grammar, divider style, link decoration, heading scale). 2. If the chosen direction would naturally produce one of the forbidden patterns, *deliberately substitute*. 3. Include a one-line `theme:` annotation in the footer naming the resolved direction, palette, and typography. ## Universal Contrast (mandatory) Every rendered element in the HTML and PDF reports must maintain high contrast against its actual background in **both** light and dark screen modes and in the print/PDF mode. **Minimum contrast requirements**: - Body text, table text, captions, labels, legends, footnotes, citation markers, nav links, badge text, and chart labels: WCAG AA normal-text contrast (≥4.5:1) against the exact background behind the element. - Large headings and large stat numerals: WCAG AA large-text contrast (≥3:1), with ≥4.5:1 preferred unless the design would be harmed. - Non-text graphical elements that convey information (chart lines, SVG connectors, axes, grid lines, quadrant boundaries, heatmap cells, risk-meter segments, badges, table borders, focus rings): WCAG non-text contrast (≥3:1) against adjacent colours, with ≥4.5:1 preferred for thin lines (<2px) or small marks. **Hard rules**: - Never place text directly on a gradient, texture, image, translucent overlay, or saturated colour block unless the report also adds a solid or sufficiently opaque backing panel behind the text. - Do not rely on pastel text, low-opacity strokes, faint grid lines, transparent fills, glow-only emphasis, or colour-only distinctions. - Chart.js and D3 palettes must be generated separately for dark, light, and print modes. - Every SVG/HTML infographic must define explicit stroke and text colours for each colour mode. - Heatmaps and quadrant backgrounds must keep labels readable in every cell/region. - Thin lines (axes, connectors, borders) must be thickened, darkened, or backed by sufficient spacing if they would otherwise fall below contrast on coloured backgrounds. ## Light + Dark Mode (mandatory) - **Both modes are required.** Default = dark mode on first load, regardless of system preference. - **Toggle in the nav** — a clearly visible button. Switches modes immediately, no flicker. - **Persistence** — store the user's choice in `localStorage` under `meditation-color-mode`; on subsequent loads, honour the stored value before any rendering occurs (set on `` before paint to avoid FOUC). - **System preference signal** — read `window.matchMedia('(prefers-color-scheme: dark)')` only as a fallback when no localStorage value exists. - **Charts** — Chart.js color values must adapt to the active mode. Wire chart options to read CSS custom properties for stroke/fill. ## Print TOC + Print Theme (mandatory) The PDF must open with a **clickable Table of Contents** as the first content page. - Place inside `