Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

feat(text_measure,prompts): calibrate text widths once before P01; evaluate module triggers over the roster, drop the first-exercise gate

hugohe3788cd2d43bf9
diff --git a/docs/rules/prompt-layers.md b/docs/rules/prompt-layers.md
index e1768f85..a634e045 100644
--- a/docs/rules/prompt-layers.md
+++ b/docs/rules/prompt-layers.md
@@ -45,7 +45,7 @@ case is what makes a rule hard to recall at authoring time.
**Hard rule — one owner, pointers elsewhere**: a rule is stated in full in exactly one file. Every other file that needs it carries a pointer naming the file and section, not a paraphrase. A paraphrase is a second owner: it drifts, contradicts the original after the next edit, and doubles the tokens. The cross-file duplicate check in `prompt_audit.py` catches verbatim copies only; paraphrases are caught by reading.
-**Hard rule — planning reads everything, execution loads on triggers, the core keeps the recall**: the planning role reads its complete bundle. The execution core (`executor-base.md`, `shared-standards-core.md`, `semantic-svg.md`, the preset vocabulary, plus the confirmed mode / visual-style catalog file when the confirmation points to one — a `custom` with `*_references` reads only those files, a `custom` without references reads none) stays resident and carries the everyday forms and a recall of every deeper module — device menu, everyday effects, preset families, the Structure decision — so a capability is known before its file is opened. The preset vocabulary stays resident with the core so contours are known before selection. Each deeper module (effects, native-shape authoring, relationship grammar and topology, images, charts/tables, formula, hyperlink, structured templates, video, animation, web-image attribution) loads on one observable trigger — named in the core's routing table for construction modules, or in the owning route step for video, animation, and post-processing stages — is read completely on first use, and stays for the run; the page's module line records the load. A module with no recall in the core is the failure where a capability not in context is never used.
+**Hard rule — planning reads everything, execution loads on triggers, the core keeps the recall**: the planning role reads its complete bundle. The execution core (`executor-base.md`, `shared-standards-core.md`, `semantic-svg.md`, the preset vocabulary, plus the confirmed mode / visual-style catalog file when the confirmation points to one — a `custom` with `*_references` reads only those files, a `custom` without references reads none) stays resident and carries the everyday forms and a recall of every deeper module — device menu, everyday effects, preset families, the Structure decision — so a capability is known before its file is opened. The preset vocabulary stays resident with the core so contours are known before selection. Each deeper module (effects, native-shape authoring, relationship grammar and topology, images, charts/tables, formula, hyperlink, structured templates, video, animation, web-image attribution) loads on one observable trigger — named in the core's routing table for construction modules, or in the owning route step for video, animation, and post-processing stages — evaluated once over the whole roster before P01 so that reading stays out of the page loop, or at the page that first reaches an unforeseen capability; it is read completely and stays for the run, and the page's module line records what the page uses. A module with no recall in the core is the failure where a capability not in context is never used.
---
diff --git a/docs/rules/prompt-style.md b/docs/rules/prompt-style.md
index b1cd2416..ca112aed 100644
--- a/docs/rules/prompt-style.md
+++ b/docs/rules/prompt-style.md
@@ -129,8 +129,9 @@ vocabulary, the Structure decision, and one routing row per deeper module —
while the deeper module itself (effects beyond the everyday block, native-shape
authoring, relationship grammar and topology assembly, and the rarer formula,
hyperlink, chart/table, structured-template, video, animation, and web-image
-files) is loaded on its own observable trigger, read completely on first use,
-and kept for the run. The owning rule is
+files) is loaded when its observable trigger appears — evaluated once over the
+whole roster before P01, or at the page that first reaches an unforeseen
+capability — read completely, and kept for the run. The owning rule is
[`prompt-layers.md`](prompt-layers.md) §2.
**Hard rule — core volume ceiling**: the always-read core of an authoring role
diff --git a/skills/ppt-master/references/executor-base.md b/skills/ppt-master/references/executor-base.md
index b4b50279..2030ec0f 100644
--- a/skills/ppt-master/references/executor-base.md
+++ b/skills/ppt-master/references/executor-base.md
@@ -2,7 +2,7 @@
Always-loaded Executor authority for flat SVG page authoring, shared by Default and Quick. Executor is the crew that builds the finished pages on the plan's structure: it receives the blueprint (§2), owns every decision judged on the canvas — carrier mix, geometry, composition, hierarchy, treatment — and draws from the expression vocabulary below. Items marked `Default only` bind to the persisted Design Spec / `spec_lock.md`; Quick applies the same craft to the transient anchors from [`quick-generate.md`](../workflows/profiles/quick-generate.md) §2, and its own pacing, single final checker, and export replace the Default gates and §6.
-**Conditional branch routing** — load a branch only when its trigger is present:
+**Conditional branch routing** — evaluate every trigger once over the whole roster before P01 (Default: §IX; Quick: the frozen transient roster) and read the triggered modules then, in one batch, so that reading stays out of the page loop; a page that reaches a capability the sweep did not foresee reads its module at that moment, before that page's first SVG line:
| Trigger | Load |
|---|---|
@@ -12,7 +12,7 @@ Always-loaded Executor authority for flat SVG page authoring, shared by Default
| Any semantic cell grid, including a table-family reference | [`executor-table.md`](./executor-table.md) |
| A page uses a preset pattern fill, or an independent Chart/Table object is resolved as `<object-key>=yes` | [`native-data-interface.md`](./native-data-interface.md) before emitting the pattern or replacement metadata |
| The per-page Structure decision is `yes` for the first time | [`executor-structure.md`](./executor-structure.md) + [`topology-assembly.md`](./topology-assembly.md) |
-| A page's contour reaches beyond rectangle, rounded rectangle, circle, ellipse, and line — block arrow, chevron, callout, flowchart symbol, banner, star, bracket, connector preset — or needs a Boolean / freeform decision | [`native-shape-authoring.md`](./native-shape-authoring.md), read completely on first use (the preset vocabulary is already resident) |
+| A page's contour reaches beyond rectangle, rounded rectangle, circle, ellipse, and line — block arrow, chevron, callout, flowchart symbol, banner, star, bracket, connector preset — or needs a Boolean / freeform decision | [`native-shape-authoring.md`](./native-shape-authoring.md), read completely (the preset vocabulary is already resident) |
| A page's visual job reaches beyond the everyday block below — faux glass, constructed styles (hand-drawn, ink, riso, pixel, halftone, paper-cut, facets, gradient ribbon), gradient stroke, text picture/texture fill, gauge / sunburst / explicit arc geometry, freeform curves, transforms beyond rotate, or an unsupported effect needing a native-safe alternative | [`svg-effects.md`](./svg-effects.md) |
| Any image | [`executor-image.md`](./executor-image.md) + [`image-layout-spec.md`](./image-layout-spec.md) + [`image-layout-patterns.md`](./image-layout-patterns.md) + [`svg-image-embedding.md`](./svg-image-embedding.md) |
| Any nontrivial mathematical expression | [`native-formula.md`](./native-formula.md) |
@@ -125,7 +125,7 @@ Repeating symmetric card grids without a page job is the failure mode these stru
## 1. Effect Capability Discovery
-**Reference — effects are a triggered module**: the everyday block above covers gradients, cards, shadow, glow, scrims, dashes, and inline emphasis for most pages. Load [`svg-effects.md`](./svg-effects.md) the first time a page's job reaches beyond it (routing table above); once loaded, its §6.1 Visual Job Router recalls candidates and §6.13 offers coordinated page recipes, and it stays in context for the rest of the run. Active cross-page continuous action additionally loads [`animations.md`](./animations.md) §3.1 before authoring both endpoints.
+**Reference — effects are a triggered module**: the everyday block above covers gradients, cards, shadow, glow, scrims, dashes, and inline emphasis for most pages. Load [`svg-effects.md`](./svg-effects.md) when the pre-P01 sweep or a page's job reaches beyond it (routing table above); once loaded, its §6.1 Visual Job Router recalls candidates and §6.13 offers coordinated page recipes, and it stays in context for the rest of the run. Active cross-page continuous action additionally loads [`animations.md`](./animations.md) §3.1 before authoring both endpoints.
**Hard rule — discovery does not expand compatibility**: follow `svg-effects.md` syntax and fallbacks; source/backdrop blur, blend mode, `<mask>` / per-pixel masking, dense texture, and skew stay baked or alternative-only.
@@ -199,22 +199,22 @@ Mechanical repetition comes from reusing one carrier and topology without a page
- **Element grouping (Mandatory)**: wrap each logical Slide-local body unit in a descriptive, page-unique top-level `<g id>` with root-coordinate `data-pptx-bounds="x y width height"`; a helper-authored preset atom stays top-level with `data-pptx-frame` and no bounds; nested groups need none. Give a root background image or full-canvas scrim/decoration rectangle a stable `id` plus `data-pptx-role="background"` / `"decoration"` instead of a wrapper. Thresholds, exemptions, and the Morph staging marker: [`shared-standards-core.md`](./shared-standards-core.md) §4.3.
- **Reference — nested edit groups**: a top-level group may contain descriptive nested `<g>` groups for meaningful subunits; they need no bounds and create no animation step, with no default depth or quota.
-- **Default — bounds are the module zone, not a glyph box (may skip when no text is estimable)**: make each zone as generous as the canvas and siblings allow without overlap. An untransformed line spans `y − 0.85 × font_size` to `y + 0.35 × font_size`. **Width is calibrated once, then estimated**: on P01 measure one representative line per role with `python3 ${SKILL_DIR}/scripts/text_measure.py measure` (batch via `--stdin`) and keep "≈ N chars per W px" per role; every later page sizes its zones from that per-font arithmetic (characters × the role's calibrated width, plus its headroom) — write the sentence first, then fit the zone to it; no per-page measurement, no line-by-line tool calls, and never trim wording to satisfy an estimate. Reach for `measure|wrap|box` again only for a role or size that was never calibrated. When text does not fit, first expand a zone with unused space, then reflow or adapt; larger bounds never repair off-canvas text.
+- **Default — bounds are the module zone, not a glyph box (may skip when no text is estimable)**: make each zone as generous as the canvas and siblings allow without overlap. An untransformed line spans `y − 0.85 × font_size` to `y + 0.35 × font_size`. **Width is calibrated once, then estimated**: before P01 the route runs `python3 ${SKILL_DIR}/scripts/text_measure.py calibrate` (Default from the lock with `--outline`, Quick with `--role` arguments) and keeps its per-role table — CJK and Latin ≈ chars per 100 px, plus each role's longest planned line — in context; every later page sizes its zones from that arithmetic (characters ÷ the role's chars-per-100-px × 100; the estimator already carries the wrapping headroom) — write the sentence first, then fit the zone to it; no per-page measurement, no line-by-line tool calls, and never trim wording to satisfy an estimate. Reach for `calibrate --role` or `measure|wrap|box` again only for a role or size that was never calibrated. When text does not fit, first expand a zone with unused space, then reflow or adapt; larger bounds never repair off-canvas text.
- **Spec adherence**: binding color, canvas, typography, identity, resource, and template anchors hold; layout and other References apply under §2.1 without becoming locks.
- **Template structure**: inherit the native framework only for `template_reuse_scope: mirror|layout`; `style` uses the flat route.
- **Main-agent ownership**: SVG generation runs in the main agent, never a sub-agent — pages share upstream context for cross-page continuity.
**Checkpoints**:
-- **Mandatory — per-page module line**: before drawing each page, write one line `P<NN> modules: core[, structure][, native-shape][, effects][, image][, native-data][, chart | table | formula | link | web-image]` naming the triggered modules the page uses; a module named for the first time is read completely before that page's first SVG line, and a page whose carrier mix uses a module's capability without naming it is a defect the carrier receipt exposes.
+- **Mandatory — per-page module line**: before drawing each page, write one line `P<NN> modules: core[, structure][, native-shape][, effects][, image][, native-data][, chart | table | formula | link | web-image]` naming the triggered modules the page uses; a module the pre-P01 sweep did not read is read completely before that page's first SVG line, and a page whose carrier mix uses a module's capability without naming it is a defect the carrier receipt exposes.
- **Phased generation** (recommended):
1. **Visual Construction Phase**: generate all pages sequentially, applying every triggered branch while drawing. **MUST embed one object-scoped plot-area marker** per §IX-named or Quick-promoted value-driven chart object ([`executor-chart.md`](./executor-chart.md) §2); calibration follows in [`verify-charts`](../workflows/stages/verify-charts.md). Write every `<object-key>=yes` native marker plus JSON metadata atomically ([`native-data-interface.md`](./native-data-interface.md) §2) and stamp its baseline before the page's gate — `python3 ${SKILL_DIR}/scripts/stamp_native_fallbacks.py <project_path>/svg_output/<page>.svg --write`, rerun after any visible edit inside the marker group. **Reach for native presets** per §3.0 as you draw, decided by the object's intent, never by scanning finished paths; several presets for one page go through one `preset_shape_svg.py render-batch --input -` round (gradient/pattern paint stays ordinary SVG; a justified §6.4 shadow/glow stays on the helper-authored shape).
- 2. **Quality gates**: owned by the route — [`generate-pptx.md`](../workflows/generate-pptx.md) Step 6 (first-page, first-exercise, final, carrier receipt) or [`quick-generate.md`](../workflows/profiles/quick-generate.md) §4 (one lockless final check). Run each checker unfiltered, review the complete issue set, fix every error plus selected warnings in one consolidated pass, verify once; never check between individual fixes, never `cat` a passing report, never defer errors past `finalize_svg.py` (it rewrites SVG and masks violations). Every `warning` is advisory.
+ 2. **Quality gates**: owned by the route — [`generate-pptx.md`](../workflows/generate-pptx.md) Step 6 (first-page, final, carrier receipt) or [`quick-generate.md`](../workflows/profiles/quick-generate.md) §4 (one lockless final check). Run each checker unfiltered, review the complete issue set, fix every error plus selected warnings in one consolidated pass, verify once; never check between individual fixes, never `cat` a passing report, never defer errors past `finalize_svg.py` (it rewrites SVG and masks violations). Every `warning` is advisory.
3. **Logic Construction Phase (conditional)**: after the gates pass, generate speaker notes for narrative continuity only when the effective Speaker Notes outcome is enabled.
### 3.0 Native Shape Selection
-**Hard rule — contour before encoding**: choose the page-fit contour from the full native vocabulary — [`preset-shape-vocabulary.md`](./preset-shape-vocabulary.md), read completely before the first page — before its authoring form; the first time a page reaches beyond rectangle, rounded rectangle, circle, ellipse, and line, read [`native-shape-authoring.md`](./native-shape-authoring.md) completely before choosing. Rectangle, rounded rectangle, circle, and ellipse are preset contours even in short SVG syntax; easier syntax never selects a contour. Block arrows, chevrons, banners, callouts, flowchart nodes, stars, and other Office symbols come from `preset_shape_svg.py`, never plain paths or fake rectangles. No Design Spec selection, scorer, or inventory gates this choice.
+**Hard rule — contour before encoding**: choose the page-fit contour from the full native vocabulary — [`preset-shape-vocabulary.md`](./preset-shape-vocabulary.md), read completely before the first page — before its authoring form; when the roster sweep or a page reaches beyond rectangle, rounded rectangle, circle, ellipse, and line, read [`native-shape-authoring.md`](./native-shape-authoring.md) completely before choosing. Rectangle, rounded rectangle, circle, and ellipse are preset contours even in short SVG syntax; easier syntax never selects a contour. Block arrows, chevrons, banners, callouts, flowchart nodes, stars, and other Office symbols come from `preset_shape_svg.py`, never plain paths or fake rectangles. No Design Spec selection, scorer, or inventory gates this choice.
**Mandatory — independent per-page geometry move**: after the Structure result and any topology, decide the page's geometry before writing coordinates; when it reaches beyond basic primitives, apply [`native-shape-authoring.md`](./native-shape-authoring.md) §2.1 (loading it then); it owns exact-fit comparison, composition lenses, relationship and carrier fit, contour-family choice, the reader effect of a generic or undrawn result, the running geometry signature, and the materialization boundary for both Structure results. Keep the decision in active context; never change the Structure result.
diff --git a/skills/ppt-master/scripts/docs/svg-pipeline.md b/skills/ppt-master/scripts/docs/svg-pipeline.md
index d3f41930..3c550a25 100644
--- a/skills/ppt-master/scripts/docs/svg-pipeline.md
+++ b/skills/ppt-master/scripts/docs/svg-pipeline.md
@@ -1001,7 +1001,7 @@ Requirements:
- Heading text matches the SVG filename
- Sections are separated by `---`
-## Measuring and wrapping text before authoring
+## Measuring, wrapping, and calibrating text before authoring
`text_measure.py` imports the same single-line DrawingML width estimator used by
the SVG quality checker.
@@ -1012,11 +1012,17 @@ the SVG quality checker.
includes the outer `<text>` element, and `--json` prints line metrics.
- `box` prints a `data-pptx-bounds` attribute plus numeric `top` and `bottom`, or
a JSON bounds object with `--json`.
+- `calibrate` measures fixed CJK and Latin samples for every typography role
+ from `spec_lock.md` or repeatable `--role NAME:FAMILY:SIZE` overrides, writes
+ `validation/text_calibration.json`, and prints a compact table or JSON. Add
+ `--outline` to include the longest planned line per mapped role from Design
+ Spec §IX.
```bash
python3 scripts/text_measure.py measure "Editable DrawingML text" --size 22
python3 scripts/text_measure.py wrap "Editable DrawingML text stays measurable" --size 22 --max-width 240 --x 96 --dy 30 --y 140
python3 scripts/text_measure.py box "First line" "Second line" --x 96 --y 140 --size 22 --lines 2 --dy 30
+python3 scripts/text_measure.py calibrate projects/example --outline
```
## `svg_quality_checker.py`
diff --git a/skills/ppt-master/scripts/text_measure.py b/skills/ppt-master/scripts/text_measure.py
index d3f803f4..0fcd1bb9 100644
--- a/skills/ppt-master/scripts/text_measure.py
+++ b/skills/ppt-master/scripts/text_measure.py
@@ -1,12 +1,13 @@
#!/usr/bin/env python3
"""PPT Master - Text Measurement
-Measure, wrap, or calculate bounds with the SVG checker's width estimator.
+Measure, wrap, calibrate, or calculate bounds with the SVG checker's width estimator.
Usage:
- python3 scripts/text_measure.py <measure|wrap|box> [options]
+ python3 scripts/text_measure.py <measure|wrap|box|calibrate> [options]
Examples:
python3 scripts/text_measure.py measure "Editable text" --size 22
+ python3 scripts/text_measure.py calibrate projects/example --outline
Dependencies:
Standard library and PPT Master sibling modules
"""
@@ -17,8 +18,10 @@ import argparse
import html
import json
import math
+import re
import sys
import unicodedata
+from datetime import datetime, timezone
from functools import partial
from pathlib import Path
@@ -28,6 +31,7 @@ if str(_SCRIPTS_DIR) not in sys.path:
sys.path.insert(0, str(_SCRIPTS_DIR))
from console_encoding import configure_utf8_stdio # noqa: E402
+from project_specs import parse_markdown_artifact, parse_spec_lock # noqa: E402
from svg_to_pptx.drawingml.elements import estimate_single_line_text_frame_width # noqa: E402
from svg_to_pptx.drawingml.utils import split_project_text_clusters # noqa: E402
@@ -37,6 +41,21 @@ _OPENING_PUNCTUATION = frozenset('([{(《「『【“‘')
_PREFERRED_BREAK_PUNCTUATION = frozenset(',。;:')
_LATIN_TOKEN_CONNECTORS = frozenset("'’._:/+%@#-")
_WEIGHTS = ('normal', 'bold', '100', '200', '300', '400', '500', '600', '700', '800', '900')
+_CALIBRATION_CJK_SAMPLE = '天地玄黄宇宙洪荒日月盈昃辰宿列张寒来暑往'
+_CALIBRATION_LATIN_SAMPLE = 'Clear Slides Make Big Ideas Easy to See.'
+_CORE_CALIBRATION_ROLES = ('body', 'title', 'subtitle', 'annotation')
+_SLIDE_HEADING_RE = re.compile(
+ r'^#{3,6}[ \t]+Slide[ \t]+([0-9]+|NN)\b.*$',
+ flags=re.IGNORECASE | re.MULTILINE,
+)
+_OUTLINE_FIELD_RE = re.compile(
+ r'^(?P<indent>[ \t]*)-[ \t]+(?:\*\*)?'
+ r'(?P<label>Title|Core message|Content)(?:\*\*)?[ \t]*:[ \t]*(?P<value>.*)$',
+ flags=re.IGNORECASE,
+)
+_OUTLINE_DATA_LINE_RE = re.compile(
+ r'^(?P<indent>[ \t]*)-[ \t]+(?:\*\*)?[^:\n*]+?(?:\*\*)?[ \t]*:',
+)
def _bounded_float(value: str, *, minimum: float | None = None, strict: bool = False) -> float:
@@ -245,6 +264,290 @@ def text_box(
return dict(x=left, y=top, width=width, height=bottom - top, top=top, bottom=bottom)
+def _role_argument(value: str) -> tuple[str, str, float]:
+ try:
+ name_and_family, raw_size = value.rsplit(':', 1)
+ name, family = name_and_family.split(':', 1)
+ except ValueError as exc:
+ raise argparse.ArgumentTypeError('expected NAME:FAMILY:SIZE') from exc
+ name, family = name.strip().casefold(), family.strip()
+ if not name or not family:
+ raise argparse.ArgumentTypeError('expected non-empty NAME and FAMILY')
+ try:
+ size = _positive_float(raw_size)
+ except (argparse.ArgumentTypeError, ValueError) as exc:
+ raise argparse.ArgumentTypeError('SIZE must be a positive finite number') from exc
+ return name, family, size
+
+
+def _ordered_roles(roles: dict[str, tuple[str, float]]) -> list[tuple[str, str, float]]:
+ names = [name for name in _CORE_CALIBRATION_ROLES if name in roles]
+ names.extend(sorted(set(roles) - set(names)))
+ return [(name, *roles[name]) for name in names]
+
+
+def _roles_from_spec_lock(lock_path: Path) -> dict[str, tuple[str, float]]:
+ lock = parse_spec_lock(lock_path, report_duplicate_fields=True)
+ typography = next(
+ (
+ fields
+ for heading, fields in lock.items()
+ if heading.strip().casefold() == 'typography'
+ ),
+ {},
+ )
+ rows = {
+ str(key).strip().casefold(): str(value).strip()
+ for key, value in typography.items()
+ }
+ roles: dict[str, tuple[str, float]] = {}
+ for role, raw_size in rows.items():
+ if role == 'font_family' or role.endswith('_family'):
+ continue
+ try:
+ size = _positive_float(raw_size)
+ except (argparse.ArgumentTypeError, ValueError) as exc:
+ raise ValueError(
+ f'spec_lock.md typography role {role!r} has invalid size {raw_size!r}'
+ ) from exc
+ family = rows.get(f'{role}_family', '')
+ if not family:
+ fallback = 'title_family' if 'title' in role else 'body_family'
+ family = rows.get(fallback, '') or rows.get('font_family', '')
+ if not family:
+ raise ValueError(
+ f'spec_lock.md typography role {role!r} has no resolvable font family'
+ )
+ roles[role] = (family, size)
+ return roles
+
+
+def _clean_planned_line(raw: str) -> str:
+ text = re.sub(r'^(?:[-*+]|\d+[.)])[ \t]+', '', raw.strip())
+ if not text or re.fullmatch(r'[|:\- \t]+', text):
+ return ''
+ text = re.sub(r'!\[([^]]*)\]\([^)]*\)', r'\1', text)
+ text = re.sub(r'\[([^]]+)\]\([^)]*\)', r'\1', text)
+ text = text.replace('**', '').replace('__', '').replace('`', '')
+ return ' '.join(text.split())
+
+
+def _slide_id(token: str) -> str:
+ return 'PNN' if token.upper() == 'NN' else f'P{int(token):02d}'
+
+
+def _outline_candidates(
+ design_path: Path,
+ role_names: set[str],
+) -> dict[str, list[tuple[str, str]]]:
+ candidates = {name: [] for name in role_names}
+ if not design_path.is_file():
+ return candidates
+ sections = parse_markdown_artifact(design_path)
+ outline = next(
+ (
+ str(section.get('body', ''))
+ for section in sections
+ if re.match(
+ r'^IX\.[ \t]+Content Outline\b',
+ str(section.get('heading', '')),
+ flags=re.IGNORECASE,
+ )
+ ),
+ '',
+ )
+ slide_matches = list(_SLIDE_HEADING_RE.finditer(outline))
+ for slide_index, slide_match in enumerate(slide_matches):
+ block_end = (
+ slide_matches[slide_index + 1].start()
+ if slide_index + 1 < len(slide_matches)
+ else len(outline)
+ )
+ slide = _slide_id(slide_match.group(1))
+ lines = outline[slide_match.end():block_end].splitlines()
+ field_matches = [match for line in lines if (match := _OUTLINE_FIELD_RE.match(line))]
+ if not field_matches:
+ continue
+ base_indent = min(len(match.group('indent').expandtabs()) for match in field_matches)
+ line_index = 0
+ while line_index < len(lines):
+ field_match = _OUTLINE_FIELD_RE.match(lines[line_index])
+ if (
+ field_match is None
+ or len(field_match.group('indent').expandtabs()) != base_indent
+ ):
+ line_index += 1
+ continue
+ label = field_match.group('label').casefold()
+ value = _clean_planned_line(field_match.group('value'))
+ if label == 'title':
+ if value and 'title' in candidates:
+ candidates['title'].append((slide, value))
+ line_index += 1
+ continue
+ if label == 'core message':
+ role = 'subtitle' if 'subtitle' in candidates else 'body'
+ if value and role in candidates:
+ candidates[role].append((slide, value))
+ line_index += 1
+ continue
+
+ content_lines = [value] if value else []
+ next_index = line_index + 1
+ while next_index < len(lines):
+ next_field = _OUTLINE_DATA_LINE_RE.match(lines[next_index])
+ if (
+ next_field is not None
+ and len(next_field.group('indent').expandtabs()) <= base_indent
+ ):
+ break
+ planned_line = _clean_planned_line(lines[next_index])
+ if planned_line:
+ content_lines.append(planned_line)
+ next_index += 1
+ if 'body' in candidates:
+ candidates['body'].extend((slide, text) for text in content_lines)
+ line_index = next_index
+ return candidates
+
+
+def _truncate_planned_line(text: str, limit: int = 40) -> str:
+ clusters = split_project_text_clusters(text)
+ return text if len(clusters) <= limit else ''.join(clusters[:limit - 1]) + '…'
+
+
+def _longest_planned_lines(
+ project_path: Path,
+ roles: list[tuple[str, str, float]],
+) -> dict[str, dict[str, object] | None]:
+ candidates = _outline_candidates(
+ project_path / 'design_spec.md',
+ {name for name, _family, _size in roles},
+ )
+ longest: dict[str, dict[str, object] | None] = {}
+ for name, family, size in roles:
+ best: tuple[float, str, str] | None = None
+ for slide, planned_line in candidates[name]:
+ width = measure_text(planned_line, size=size, family=family)
+ if best is None or width > best[0]:
+ best = (width, slide, planned_line)
+ longest[name] = None if best is None else {
+ 'px': round(best[0], 1),
+ 'slide': best[1],
+ 'text': _truncate_planned_line(best[2]),
+ }
+ return longest
+
+
+def _calibration_payload(
+ roles: list[tuple[str, str, float]],
+ *,
+ project_path: Path,
+ source: str,
+ include_outline: bool,
+) -> dict[str, object]:
+ longest = (
+ _longest_planned_lines(project_path, roles)
+ if include_outline
+ else {name: None for name, _family, _size in roles}
+ )
+ cjk_length = len(split_project_text_clusters(_CALIBRATION_CJK_SAMPLE))
+ latin_length = len(split_project_text_clusters(_CALIBRATION_LATIN_SAMPLE))
+ role_rows = {}
+ for name, family, size in roles:
+ cjk_width = measure_text(_CALIBRATION_CJK_SAMPLE, size=size, family=family)
+ latin_width = measure_text(_CALIBRATION_LATIN_SAMPLE, size=size, family=family)
+ role_rows[name] = {
+ 'family': family,
+ 'size': size,
+ 'cjk_chars_per_100px': round(100.0 * cjk_length / cjk_width, 1),
+ 'latin_chars_per_100px': round(100.0 * latin_length / latin_width, 1),
+ 'longest_planned_line': longest[name],
+ }
+ return {
+ 'roles': role_rows,
+ 'source': source,
+ 'generated_at': datetime.now(timezone.utc)
+ .isoformat(timespec='seconds')
+ .replace('+00:00', 'Z'),
+ }
+
+
+def _render_calibration_table(payload: dict[str, object], *, include_outline: bool) -> str:
+ role_rows = payload['roles']
+ assert isinstance(role_rows, dict)
+ headers = ['role', 'family', 'size', 'CJK ≈chars/100px', 'Latin ≈chars/100px']
+ if include_outline:
+ headers.append('longest planned line (px, slide, text)')
+ lines = [
+ f'[CALIBRATION] roles: {len(role_rows)} | source: {payload["source"]}',
+ ' | '.join(headers),
+ ' | '.join('---' for _header in headers),
+ ]
+ for name, raw_row in role_rows.items():
+ assert isinstance(raw_row, dict)
+ row = [
+ name,
+ str(raw_row['family']),
+ _format_number(float(raw_row['size'])),
+ f'{raw_row["cjk_chars_per_100px"]:.1f}',
+ f'{raw_row["latin_chars_per_100px"]:.1f}',
+ ]
+ if include_outline:
+ planned = raw_row['longest_planned_line']
+ row.append(
+ '-'
+ if planned is None
+ else f'{planned["px"]:.1f}px, {planned["slide"]}, {planned["text"]}'
+ )
+ lines.append(' | '.join(row))
+ return '\n'.join(lines) + '\n'
+
+
+def _run_calibrate(args: argparse.Namespace) -> int:
+ project_path = args.project_path.resolve()
+ if not project_path.is_dir():
+ print(
+ f'Calibration failed: project path is not a directory: {project_path}',
+ file=sys.stderr,
+ )
+ return 2
+ lock_path = project_path / 'spec_lock.md'
+ if not lock_path.is_file() and not args.role:
+ print(
+ 'Calibration requires spec_lock.md or at least one --role NAME:FAMILY:SIZE entry.',
+ file=sys.stderr,
+ )
+ return 2
+ try:
+ roles = _roles_from_spec_lock(lock_path) if lock_path.is_file() else {}
+ for name, family, size in args.role:
+ roles[name] = (family, size)
+ ordered_roles = _ordered_roles(roles)
+ if not ordered_roles:
+ raise ValueError('no typography size roles were found')
+ source = 'spec_lock.md' if lock_path.is_file() else '--role'
+ payload = _calibration_payload(
+ ordered_roles,
+ project_path=project_path,
+ source=source,
+ include_outline=args.outline,
+ )
+ output_path = project_path / 'validation' / 'text_calibration.json'
+ output_path.parent.mkdir(parents=True, exist_ok=True)
+ rendered_json = json.dumps(payload, ensure_ascii=False, indent=2)
+ output_path.write_text(rendered_json + '\n', encoding='utf-8')
+ except (OSError, ValueError) as exc:
+ message = ' '.join(str(exc).splitlines())
+ print(f'Calibration failed: {message}', file=sys.stderr)
+ return 2
+ if args.json:
+ print(rendered_json)
+ else:
+ sys.stdout.write(_render_calibration_table(payload, include_outline=args.outline))
+ return 0
+
+
def _add_style_arguments(parser: argparse.ArgumentParser) -> None:
parser.add_argument('--size', type=_positive_float, required=True)
parser.add_argument('--family', default='Calibri')
@@ -258,7 +561,9 @@ def _add_style_arguments(parser: argparse.ArgumentParser) -> None:
def build_parser() -> argparse.ArgumentParser:
- parser = argparse.ArgumentParser(description='Measure and wrap SVG authoring text.')
+ parser = argparse.ArgumentParser(
+ description='Measure, wrap, and calibrate SVG authoring text.'
+ )
subparsers = parser.add_subparsers(dest='command', required=True)
measure = subparsers.add_parser('measure', help='Measure single-line text.')
@@ -281,6 +586,12 @@ def build_parser() -> argparse.ArgumentParser:
box.add_argument('--dy', type=_positive_float)
box.add_argument('--width', type=_nonnegative_float)
box.add_argument('--anchor', choices=('start', 'middle', 'end'), default='start')
+
+ calibrate = subparsers.add_parser('calibrate', help='Calibrate project typography roles.')
+ calibrate.add_argument('project_path', type=Path)
+ calibrate.add_argument('--outline', action='store_true')
+ calibrate.add_argument('--role', action='append', type=_role_argument, default=[])
+ calibrate.add_argument('--json', action='store_true')
for command in (measure, wrap, box):
command.add_argument('--json', action='store_true')
_add_style_arguments(command)
@@ -291,6 +602,8 @@ def main(argv: list[str] | None = None) -> int:
configure_utf8_stdio()
parser = build_parser()
args = parser.parse_args(argv)
+ if args.command == 'calibrate':
+ return _run_calibrate(args)
style = dict(
size=args.size,
family=args.family,
diff --git a/skills/ppt-master/workflows/generate-pptx.md b/skills/ppt-master/workflows/generate-pptx.md
index fcf9f99b..03d7524f 100644
--- a/skills/ppt-master/workflows/generate-pptx.md
+++ b/skills/ppt-master/workflows/generate-pptx.md
@@ -13,7 +13,7 @@ description: Default Generate PPTX authority for source intake, planning, SVG au
**Generate-specific execution discipline**:
- The current main agent hand-writes every SVG page; never delegate page generation or run a generator over `svg_output/`. `preset_shape_svg.py` and `shape_boolean_svg.py` provide only their stdout fragments after the agent chooses role, operands, paint, and z-order.
-- SVG cadence: P01 → first-page gate → remaining pages (one page gate per first-exercised `not-exercised` item) → final gate. No batches, no other mid-run checker calls.
+- SVG cadence: P01 → first-page gate → remaining pages → final gate. No batches, no other mid-run checker calls.
- Gate checklists are internal: on success continue with at most one compact status line; on failure report only the blocking items and required recovery.
**SVG page-design boundary**: `svg_output/` is the complete page-design source — every visible element of the exported slide is in the page SVG or referenced by it; templates, `design_spec.md`, and `spec_lock.md` never supply content at export ([`shared-standards-core.md`](../references/shared-standards-core.md) §4.0). Export compiles only the selected route's explicit structure contract (`flat` Slide-local; `structured` Master/Layout/Slide parts) and never infers structure. `svg_final/` is an optional preview release export never reads. Notes, animations, narration, and Edit Native PPTX stay outside this closure.
@@ -220,17 +220,18 @@ Read ${SKILL_DIR}/references/semantic-svg.md # REQUIRED core: sema
Read ${SKILL_DIR}/references/preset-shape-vocabulary.md # REQUIRED core: complete 187-name preset vocabulary
Read ${SKILL_DIR}/references/modes/<resolved-id>.md # one preset id, or each `mode_references` id
Read ${SKILL_DIR}/references/visual-styles/<resolved-id>.md # one preset id, or each `visual_style_references` id
-# Triggered modules — read completely the first time a page needs them (executor-base routing table):
+# Triggered modules — evaluate every trigger over the §IX roster before P01 and read the triggered ones now, in this batch;
+# a page reaching a capability the sweep did not foresee reads its module then (executor-base routing table):
# executor-structure.md + topology-assembly.md first `Structure = yes` page
# native-shape-authoring.md first contour beyond rect / roundRect / circle / ellipse / line, or a Boolean / freeform
# svg-effects.md first visual job beyond the everyday block
```
-Read the core as one batch with the exact detail files named by the retained `spec_lock.md`, then modules only on their triggers (each page's module line records them); never reopen the planning indexes, infer adjacent bases, glob a catalog, or blend unselected identities (an unreferenced custom follows its behavior alone). Conditional modules load on [`executor-base.md`](../references/executor-base.md)'s routing table, never by analogy; `video-design.md` is read before the first SVG when §I records recorded/self-running/video delivery or §X a literal script. `executor-structured.md` owns template specs and prototypes; `executor-visualization.md` resolves a selected reference to one SVG plus its family branch. Read each reference once per valid context.
+Read the core as one batch with the exact detail files named by the retained `spec_lock.md`, then every module the roster sweep triggers, in the same batch (each page's module line records what it uses; a capability the sweep did not foresee loads at that page); never reopen the planning indexes, infer adjacent bases, glob a catalog, or blend unselected identities (an unreferenced custom follows its behavior alone). Conditional modules load on [`executor-base.md`](../references/executor-base.md)'s routing table, never by analogy; `video-design.md` is read before the first SVG when §I records recorded/self-running/video delivery or §X a literal script. `executor-structured.md` owns template specs and prototypes; `executor-visualization.md` resolves a selected reference to one SVG plus its family branch. Read each reference once per valid context.
**Context validity**: reuse the retained Design Spec and lock for every page while the context is unchanged and uncompacted; do not reread or poll them. A fresh, resumed, restarted, compacted, or externally changed context rereads `design_spec.md`, then `spec_lock.md`, once, plus triggered references and the latest completed SVG when mid-deck ([`failure-recovery.md`](governance/failure-recovery.md)); on local uncertainty consult the retained lock, then only the owning Design Spec fragment — sources supply facts only, and the Design Spec wins a conflict. A bounded same-context repair that preserves roster/order/identity/communication needs only the affected fragment readback plus `project_manager.py validate`. **Five-page lock re-read**: after P05, P10, P15, … when another page follows, read `spec_lock.md` in full once before the next page — a pure re-anchor of palette, typography, icon style, and `page_rhythm` under long context, with no checker run, no output, no pause, and no repair loop; an external change found here follows the recovery branch. **Hard rule — exact page roster**: `design_spec.md §IX` is the ordered queue — one final slide per entry, same id and order; never add, drop, merge, split, or reorder while drawing. A continuous run may first repair the affected §IX blocks and `page_rhythm` rows and rerun `validate` while the count stays inside the Stage-1 confirmed range; leaving that range reconfirms Stage 1. §IX is preferred wording and semantic authority, adapted only under `executor-base.md` §2.1's content-vs-expression contract, with sources read only for verification. **Missing `spec_lock.md` or `design_spec.md`** → stop and report the missing gate artifact; recover through [`failure-recovery.md`](governance/failure-recovery.md) §3; a missing field in an existing lock → its §2. When §X records a literal script, read the frozen `notes/total.md` once before P01 and design each visible state around its segment. Trust the latest `analysis/image_analysis.csv` (rerun `analyze_images.py` if `images/` changed; an empty folder means no inventory). `page-context` is a diagnostic only ([`artifact-ownership.md`](../references/artifact-ownership.md) §1).
-**Design Parameter Confirmation (Mandatory)**: before the first SVG, output one confirmation listing the compact communication objective, canvas dimensions, body font size, color scheme (primary/secondary/accent HEX), font plan, the measured line capacity of the body and annotation roles (`python3 ${SKILL_DIR}/scripts/text_measure.py measure` on one representative CJK/Latin line per role, stated as "≈ N chars per W px" — the checker adds DrawingML wrapping headroom, so characters × font size underestimates by roughly 15%), and the live-preview URL from the launcher below. If the preview failed to launch, say so here rather than proceeding silently.
+**Design Parameter Confirmation (Mandatory)**: before the first SVG, output one confirmation listing the compact communication objective, canvas dimensions, body font size, color scheme (primary/secondary/accent HEX), font plan, the per-role calibration table from `python3 ${SKILL_DIR}/scripts/text_measure.py calibrate <project_path> --outline` (every lock role: family, size, CJK and Latin ≈ chars per 100 px, and the longest planned §IX line per role in px — the checker's own estimator with wrapping headroom, written to `validation/text_calibration.json`), and the live-preview URL from the launcher below. If the preview failed to launch, say so here rather than proceeding silently.
**Live Preview Auto-Startup (Mandatory)**: before the first SVG, start the editor and keep it running through Step 7:
@@ -240,7 +241,7 @@ python3 ${SKILL_DIR}/scripts/svg_editor/server.py <project_path> --live --daemon
Default first free port from `6060` (`--port N` binds strictly); read the URL from output or `<project_path>/live_preview/lock.json` and report it — or the launch failure — before the first SVG. It is a side process: never wait for it or for user confirmation, and keep it running until the user clicks **Exit preview** or asks in chat. Do not read or apply submitted annotations during generation; that window opens after Step 7 ([`live-preview.md`](stages/live-preview.md), which also describes staged direct edits).
-> ⚠️ **Main-agent only**: SVG generation stays in the current main agent — page design depends on full upstream context. Cadence: P01 → first-page gate → remaining pages (one page gate per first-exercised item) → final gate, in one context, no batches or other mid-run checker calls; reload under Context validity above after context invalidation.
+> ⚠️ **Main-agent only**: SVG generation stays in the current main agent — page design depends on full upstream context. Cadence: P01 → first-page gate → remaining pages → final gate, in one context, no batches or other mid-run checker calls; reload under Context validity above after context invalidation.
**Visual Construction Phase**: generate pages sequentially into `<project_path>/svg_output/`. Each SVG carries the slide's complete visible design (a JSON-first Chart/Table is the sole exception: inline JSON authoritative, visible subtree an approximate preview). Native shapes follow [`native-shape-authoring.md`](../references/native-shape-authoring.md), loaded at the first contour beyond basic primitives while the preset vocabulary is read before page one: independent atoms first, Merge Shapes only when contour semantics require it, freeform last. `mirror|layout` pages start from the complete `page_layouts` SVG and preserve inherited visuals, root identity, atoms, and slots (strict keeps the contract; `layout` may reflow carrier text inside unchanged slot bounds; adaptive uses a Strategist-declared Layout; a required atom or slot change returns upstream, and Executor never edits `spec_lock.md`); `style`, free-design, and brand-only pages are flat per `executor-base.md` and [`semantic-svg.md`](../references/semantic-svg.md).
@@ -261,11 +262,11 @@ gate-signal: method=<rule resolved, or none> | page-local=<count> | not-exercise
| Signal | Reading |
|---|---|
-| Two or more issues share a category and direction | Method-level bias — resolve to the authoritative rule before P02 (for text extents: fix the P01 per-role calibration from `python3 ${SKILL_DIR}/scripts/text_measure.py measure`, then every later page estimates by that arithmetic and measures nothing); a correction fitted to the observed offset patches only this sample |
+| Two or more issues share a category and direction | Method-level bias — resolve to the authoritative rule before P02 (for text extents: correct the per-role calibration table — rerun `python3 ${SKILL_DIR}/scripts/text_measure.py calibrate <project_path> --outline` or add the missing `--role` — then every later page estimates by that arithmetic and measures nothing); a correction fitted to the observed offset patches only this sample |
| One isolated issue tied to this page's structure | Page-local — fix and continue |
| A recurring element appears for the first time (furniture, caption format, section numbering, accent discipline) | It will be copied to every later page — confirm its semantics now |
-`not-exercised` names what P01 could not test (a cover typically omits multi-line text, columns, charts, captions, data objects); carry each resolved rule forward as arithmetic. **First-exercise gate**: the first page exercising a listed item runs `python3 ${SKILL_DIR}/scripts/svg_quality_checker.py <project_path> --canonical-authoring --stage page --page <svg>` once (items first exercised together share it), fixes blocking items, then continues; every other page runs without checker calls.
+`not-exercised` names what P01 could not test (a cover typically omits multi-line text, columns, charts, captions, data objects); carry each resolved rule forward as arithmetic. Every later page runs without checker calls; a listed item first exercised later is held to the carried-forward rule and caught by the final gate.
**Quality Check Gate (Mandatory)** — only after every planned SVG exists, before annotations and speaker notes:
diff --git a/skills/ppt-master/workflows/profiles/quick-generate.md b/skills/ppt-master/workflows/profiles/quick-generate.md
index 6e8afb20..8d6b44d3 100644
--- a/skills/ppt-master/workflows/profiles/quick-generate.md
+++ b/skills/ppt-master/workflows/profiles/quick-generate.md
@@ -159,7 +159,7 @@ This menu never satisfies the per-page Structure decision in §3.
## 3. Direct SVG Authoring
-Read the execution core together, never file by file: [`shared-standards-core.md`](../../references/shared-standards-core.md), [`executor-base.md`](../../references/executor-base.md), [`semantic-svg.md`](../../references/semantic-svg.md), and [`preset-shape-vocabulary.md`](../../references/preset-shape-vocabulary.md) (complete, before P01); then load modules only on their triggers from `executor-base.md`'s routing table, each read completely the first time a page needs it and recorded in that page's module line — [`executor-structure.md`](../../references/executor-structure.md) + [`topology-assembly.md`](../../references/topology-assembly.md) at the first `Structure = yes`, [`native-shape-authoring.md`](../../references/native-shape-authoring.md) at the first contour beyond basic primitives, [`svg-effects.md`](../../references/svg-effects.md) at the first visual job beyond the everyday block; installed Layout/Deck structure adds [`pptx-structure-interface.md`](../../references/pptx-structure-interface.md). Keep the selected mode/style files: a custom applies one basis under its behavior, synthesizes several by their contributions, or follows the behavior alone. When any image exists, read the complete `Any image` row of `executor-base.md`'s routing table — [`executor-image.md`](../../references/executor-image.md), [`image-layout-spec.md`](../../references/image-layout-spec.md), [`image-layout-patterns.md`](../../references/image-layout-patterns.md), and [`svg-image-embedding.md`](../../references/svg-image-embedding.md) — once before the first affected page (plus [`executor-web-image.md`](../../references/executor-web-image.md) for a `Sourced` image); reread anything only after a known file change or context invalidation.
+Read the execution core together, never file by file: [`shared-standards-core.md`](../../references/shared-standards-core.md), [`executor-base.md`](../../references/executor-base.md), [`semantic-svg.md`](../../references/semantic-svg.md), and [`preset-shape-vocabulary.md`](../../references/preset-shape-vocabulary.md) (complete, before P01); then evaluate `executor-base.md`'s routing triggers once over the frozen roster before P01 and read every triggered module in the same batch — [`executor-structure.md`](../../references/executor-structure.md) + [`topology-assembly.md`](../../references/topology-assembly.md) for any `Structure = yes` page, [`native-shape-authoring.md`](../../references/native-shape-authoring.md) for any contour beyond basic primitives, [`svg-effects.md`](../../references/svg-effects.md) for any visual job beyond the everyday block — each recorded in the module line of the pages that use it; a page that reaches a capability the sweep did not foresee reads its module at that moment, before its first SVG line; installed Layout/Deck structure adds [`pptx-structure-interface.md`](../../references/pptx-structure-interface.md). Keep the selected mode/style files: a custom applies one basis under its behavior, synthesizes several by their contributions, or follows the behavior alone. When any image exists, read the complete `Any image` row of `executor-base.md`'s routing table — [`executor-image.md`](../../references/executor-image.md), [`image-layout-spec.md`](../../references/image-layout-spec.md), [`image-layout-patterns.md`](../../references/image-layout-patterns.md), and [`svg-image-embedding.md`](../../references/svg-image-embedding.md) — once before the first affected page (plus [`executor-web-image.md`](../../references/executor-web-image.md) for a `Sourced` image); reread anything only after a known file change or context invalidation.
`executor-base.md` binds Quick exactly as it binds Default except its `Default only` items — the persisted-plan handoff in §2 / §2.1 and the export hand-off in §6 — which Quick's transient §2 anchors, single final checker, and export below own; the Default gate cadence lives in `generate-pptx.md` Step 6 and does not apply. Conditional authorities load on its routing table (Chart/Table branches, native data, formula, hyperlink); Chart/Table reference and final information model are independent signals, and selection never makes an object native-ready. Explicit user/template requirements and the resolved style override compatible aesthetic defaults, never technical boundaries, carrier eligibility, or native capability discovery.
@@ -175,7 +175,7 @@ Read the execution core together, never file by file: [`shared-standards-core.md
**PPTX structure**: speed never flattens template structure. Free design and Brand/Style-only author flat Slide-local SVG with one root `data-pptx-page-role` (`cover` / `toc` / `section` / `content` / `ending`) and no Master/Layout/layer/placeholder metadata. When Layout or Deck owns structure, every page is a complete structured Slide SVG that preserves or deliberately adapts the prototype's root identity, fixed layers, and slots with current content on top — all-or-none across the roster, every reused Layout repeating an identical fixed-layer/slot contract, a new Layout allowed under the selected Master when the application paragraph calls for adaptation, ownership never inferred from repeated geometry, and `data-pptx-page-role` omitted. A Style never strips structure; only an explicit instruction to use the workspace as visual language permits flat output.
-**Typography**: name a concrete target-installed/approved family under `shared-standards-core.md` §4.1, never a lock or the host's fonts. Before P01 measure one representative line per recurring role with `python3 ${SKILL_DIR}/scripts/text_measure.py measure` (batched through `--stdin`) and keep "≈ N chars per W px" in context (the checker adds wrapping headroom, so characters × font size underestimates by roughly 15%); every later page sizes zones from that per-font arithmetic — write the sentence first, fit the zone to it, and never trim wording to satisfy an estimate; measure again only for a role or size never calibrated, and `wrap` only a genuinely long paragraph.
+**Typography**: name a concrete target-installed/approved family under `shared-standards-core.md` §4.1, never a lock or the host's fonts. Before P01 run `python3 ${SKILL_DIR}/scripts/text_measure.py calibrate <project_path> --role <name>:<family>:<size>` for every recurring role (one command, repeatable `--role`) and keep its table — CJK and Latin ≈ chars per 100 px per role, the checker's own estimator with wrapping headroom — in context; every later page sizes zones from that per-font arithmetic — write the sentence first, fit the zone to it, and never trim wording to satisfy an estimate; calibrate again only for a role or size never calibrated, and `wrap` only a genuinely long paragraph.
**Generation pacing**: hand-write the roster in order — P01 calibrates visual identity and cover expression, the first ordinary content page calibrates content geometry and carrier integration, neither becomes a reusable template — with no first-page checker or confirmation stop. A resolved motif follows its reuse mode (exact repetition for deliberate chrome, adaptive variation of scale, crop, density, position, or interaction otherwise). After every page exists, run the one final checker below; use other stages only when their capability is needed.