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

fix(workflows): restore legacy export compatibility and chart recall guard

hugohe36a310606f9e1
diff --git a/skills/ppt-master/references/strategist.md b/skills/ppt-master/references/strategist.md
index 56c59c93..cf4ccc60 100644
--- a/skills/ppt-master/references/strategist.md
+++ b/skills/ppt-master/references/strategist.md
@@ -288,12 +288,12 @@ python3 skills/ppt-master/scripts/chart_recall.py recall \
--limit 6
```
-The command returns a bounded shortlist plus `no-template-match`. Read it unfiltered: `--limit` already bounds output, while `tail` / `head` / `grep` can hide higher-ranked candidates. `confidence` is diagnostic only. Semantically review the candidates; if terminology or structural ambiguity suggests a missed catalog structure, rerun with `--semantic-fallback` and compare its rules. This is optional, not a routine no-match gate. Do not open a second index.
+The command returns a bounded shortlist plus `no-template-match`. Read it unfiltered; `tail` / `head` / `grep` can hide ranked candidates. `confidence` is lexical only. At `high` / `medium`, keep no-match after candidate review. At `low` / `none`, use a fitting candidate directly; otherwise rerun once with `--semantic-fallback` before no-match. Do not open a second index.
**Selection**:
1. Choose the most specific valid structure from the bounded candidates or an explicitly requested semantic fallback; keep one primary visualization per page and adapt its treatment rather than mimicking it.
-2. When no recalled reference fits, retain `no-template-match` by Strategist judgment: data content falls back to a table, permitted conceptual content to an AI image, and structural content to a custom layout. Record the chosen fallback only in the affected page's §IX `Visualization` / `Layout`; do not serialize the negative result into §VII.
+2. After the fallback gate above, retain `no-template-match` when no reference fits: data content falls back to a table, permitted conceptual content to an AI image, and structural content to a custom layout. Record the fallback only in the page's §IX `Visualization` / `Layout`; never serialize it into §VII.
3. Validate all selected keys before writing the lock:
```bash
diff --git a/skills/ppt-master/scripts/chart_recall.py b/skills/ppt-master/scripts/chart_recall.py
index a291a986..b050ccce 100644
--- a/skills/ppt-master/scripts/chart_recall.py
+++ b/skills/ppt-master/scripts/chart_recall.py
@@ -199,20 +199,33 @@ def recall_candidates(
else:
confidence = "none"
+ fallback_required_before_no_match = (
+ confidence in {"low", "none"} and not force_semantic_fallback
+ )
+ if fallback_required_before_no_match:
+ no_match_instruction = (
+ f"Lexical confidence is {confidence}. Select a bounded candidate when one "
+ "fits; otherwise rerun the same recall with --semantic-fallback before "
+ "keeping no-template-match. Keep the final negative result out of Design "
+ "Spec Section VII and describe the chosen fallback in the page's Section "
+ "IX block."
+ )
+ else:
+ no_match_instruction = (
+ "Use when none of the reviewed candidates fits the page structure. Keep "
+ "this result out of Design Spec Section VII and describe the chosen fallback "
+ "in the page's Section IX block."
+ )
+
result: dict[str, object] = {
"page": page,
"semantic_tags": tags,
"confidence": confidence,
"candidates": candidates,
"no_template_match": {
- "allowed": True,
+ "allowed": not fallback_required_before_no_match,
"key": "no-template-match",
- "instruction": (
- "Use when none of the bounded candidates fits the page structure. If the "
- "shortlist may have missed a relevant catalog rule, rerun with "
- "--semantic-fallback first. Keep this result out of Design Spec Section "
- "VII and describe the chosen fallback in the page's Section IX block."
- ),
+ "instruction": no_match_instruction,
},
}
if force_semantic_fallback:
diff --git a/skills/ppt-master/scripts/docs/chart-recall.md b/skills/ppt-master/scripts/docs/chart-recall.md
index e90923f4..c089c4b5 100644
--- a/skills/ppt-master/scripts/docs/chart-recall.md
+++ b/skills/ppt-master/scripts/docs/chart-recall.md
@@ -15,9 +15,9 @@ python3 skills/ppt-master/scripts/chart_recall.py recall \
--limit 6
```
-`--limit` accepts 3-8 and defaults to 6. The JSON is already bounded and must be read unfiltered: `tail`, `head`, `grep`, or another truncator can discard higher-ranked candidates. `confidence` reports lexical strength only; `low` / `none` never decides whether a template should be used.
+`--limit` accepts 3-8 and defaults to 6. The JSON is already bounded and must be read unfiltered: `tail`, `head`, `grep`, or another truncator can discard higher-ranked candidates. `confidence` reports lexical strength only; it never decides whether a candidate fits. At `low` / `none`, a fitting bounded candidate needs no expansion, but `no_template_match.allowed` remains false until one explicit semantic fallback review.
-Semantically review the bounded candidates. If none fits and the page clearly needs a custom composition, retain `no-template-match`. If terminology mismatch or structural ambiguity suggests that bounded recall may have missed a catalog match, rerun the same command with `--semantic-fallback`, then compare the returned rules semantically. The flag is an uncertainty fallback, not a routine no-match gate. Do not open or maintain a second keyword/category index. `no-template-match` is an internal recall result, not a Design Spec §VII row.
+Semantically review the bounded candidates. At `high` / `medium`, retain `no-template-match` when none fits. At `low` / `none`, select a fitting bounded candidate directly; otherwise rerun the same command once with `--semantic-fallback`, compare the returned rules semantically, and only then retain `no-template-match`. The full-catalog review is therefore a narrow low-confidence no-match gate, not a routine recall step. Do not open or maintain a second keyword/category index. `no-template-match` is an internal recall result, not a Design Spec §VII row.
| Field | Contract |
|---|---|
@@ -26,9 +26,9 @@ Semantically review the bounded candidates. If none fits and the page clearly ne
| `confidence` | Lexical recall strength; never a selection decision |
| `candidates` | Ranked keys, SVG paths, verbatim catalog summaries, scores, and matched tags |
| `semantic_fallback` | Full live catalog, present only with `--semantic-fallback`; requires semantic comparison |
-| `no_template_match` | Explicit fallback when the Strategist judges that no recalled reference fits |
+| `no_template_match` | Explicit fallback; `allowed` stays false for `low` / `none` until `--semantic-fallback` is used |
-The scorer treats the key and the summary's Pick clause as positive evidence and the Skip clause as negative evidence. A term found only in Skip cannot make a candidate eligible, and Skip matches explicitly reduce a candidate's score. Unicode input is NFKC-normalized before matching. The Strategist still applies semantic judgment: inspect the returned candidates, reject candidates whose Skip clause matches, and prefer the most specific valid structure. An empty shortlist permits `no-template-match`; use `--semantic-fallback` only when the Strategist suspects a relevant catalog structure was missed.
+The scorer treats the key and the summary's Pick clause as positive evidence and the Skip clause as negative evidence. A term found only in Skip cannot make a candidate eligible, and Skip matches explicitly reduce a candidate's score. Unicode input is NFKC-normalized before matching. The Strategist still applies semantic judgment: inspect the returned candidates, reject candidates whose Skip clause matches, and prefer the most specific valid structure. An empty or low-confidence shortlist requires one `--semantic-fallback` review only when the Strategist is about to keep `no-template-match`.
## Validate selected keys
diff --git a/skills/ppt-master/scripts/docs/svg-pipeline.md b/skills/ppt-master/scripts/docs/svg-pipeline.md
index c33dd92a..9105fb16 100644
--- a/skills/ppt-master/scripts/docs/svg-pipeline.md
+++ b/skills/ppt-master/scripts/docs/svg-pipeline.md
@@ -296,6 +296,12 @@ python3 scripts/svg_to_pptx.py <project_path> --no-merge # strict line-fidelit
python3 scripts/svg_to_pptx.py <project_path> --recorded-narration audio
```
+The normal command reads `pptx_structure.mode` from `spec_lock.md`. For legacy
+projects whose lock exists but predates that field, export emits one compatibility
+warning and uses `flat`; no SVG regeneration is required. A missing `spec_lock.md`,
+an explicit legacy/unknown mode, or a requested `structured` export without an
+explicit current structured contract remains blocking.
+
For generated-project narration, follow the
[`generate-audio`](../../workflows/stages/generate-audio.md) stage. It owns voice
selection, audio generation, and the narrated re-export workflow.
diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py
index 77d35297..358f02dd 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py
@@ -80,7 +80,7 @@ _PPTX_STRUCTURE_SECTION_RE = re.compile(
r"(?ms)^##[ \t]+pptx_structure[ \t]*\r?\n(.*?)(?=^##[ \t]+|\Z)"
)
_PPTX_STRUCTURE_MODE_RE = re.compile(
- r"(?m)^-[ \t]+mode[ \t]*:[ \t]*([^\s#]+)[ \t]*(?:#.*)?$"
+ r"(?m)^-[ \t]+mode[ \t]*:[ \t]*([^#\r\n]*?)[ \t]*(?:#.*)?$"
)
_LEGACY_PPTX_STRUCTURE_MODES = frozenset({
'baseline',
@@ -466,7 +466,7 @@ def _print_postflight_receipt(receipt: _PostflightReceipt) -> None:
def _declared_pptx_structure_mode(project_path: Path) -> str | None:
- """Return the explicitly locked SVG export mode, without legacy fallback."""
+ """Return the explicitly locked SVG export mode, if the lock declares one."""
lock_path = project_path / 'spec_lock.md'
try:
content = lock_path.read_text(encoding='utf-8')
@@ -493,22 +493,40 @@ def _declared_canvas_viewbox(project_path: Path) -> str | None:
return value.strip() if isinstance(value, str) and value.strip() else None
-def _print_structure_contract_error(mode: str | None) -> None:
- """Explain how to replace a legacy or absent SVG structure contract."""
- label = repr(mode) if mode else 'missing (legacy implicit baseline)'
+def _print_structure_contract_error(
+ mode: str | None,
+ *,
+ requested_mode: str | None = None,
+) -> None:
+ """Explain an unsupported mode or a structured-export lock mismatch."""
+ label = repr(mode) if mode is not None else 'missing'
+ if requested_mode == 'structured':
+ print(
+ "Error: --pptx-structure structured requires an explicit "
+ "spec_lock.md pptx_structure.mode: structured contract; found "
+ + label + ".",
+ file=sys.stderr,
+ )
+ print(
+ " A legacy lock without pptx_structure.mode defaults only to flat. "
+ "Mirror/layout reuse must first create a current template workspace "
+ "through skills/ppt-master/workflows/create-template.md, then generate "
+ "new structured SVG pages.",
+ file=sys.stderr,
+ )
+ return
print(
- "Error: release SVG export requires an explicit spec_lock.md "
- "pptx_structure.mode: flat (style reference / free design / brand-only) "
- "or structured (mirror/layout reuse); found " + label + ".",
+ "Error: unsupported spec_lock.md pptx_structure.mode " + label + ". "
+ "Current release modes are flat (style reference / free design / "
+ "brand-only) and structured (mirror/layout reuse).",
file=sys.stderr,
)
print(
- " Style-reference, free-design, and brand-only projects must write a "
- "new mode: flat lock and regenerate project-canonical flat SVG pages. "
- "Mirror/layout reuse must first create a current template workspace "
+ " A legacy lock with no pptx_structure.mode defaults to flat. "
+ "Explicit legacy or unknown values are not inferred. Mirror/layout reuse "
+ "must first create a current template workspace "
"through skills/ppt-master/workflows/create-template.md, then generate "
- "new structured SVG pages. Existing PPTX/SVG files are not upgraded "
- "in place.",
+ "new structured SVG pages.",
file=sys.stderr,
)
@@ -735,8 +753,8 @@ Recorded narration:
default=None,
help=(
'PPTX structure strategy for native export. Omitting this flag reads '
- 'spec_lock.md: flat is the style-reference/free-design/brand-only '
- 'release mode and '
+ 'spec_lock.md; a legacy lock without pptx_structure.mode defaults to '
+ 'flat. Flat is the style-reference/free-design/brand-only release mode and '
'builds one clean project-owned Master plus Blank Layout while keeping '
'all SVG objects slide-local; structured is the mirror/layout reuse '
'mode and requires complete explicit metadata. baseline, template, '
@@ -837,17 +855,38 @@ Recorded narration:
structure_lock = None
native_structure_contract = None
pptx_structure = args.pptx_structure
+ lock_path = project_path / 'spec_lock.md'
+ if not lock_path.is_file():
+ print(
+ "Error: spec_lock.md is required for release SVG export",
+ file=sys.stderr,
+ )
+ return 1
declared_structure_mode = _declared_pptx_structure_mode(project_path)
if pptx_structure in _LEGACY_PPTX_STRUCTURE_MODES:
_print_structure_contract_error(pptx_structure)
return 1
+ if (
+ declared_structure_mode is not None
+ and declared_structure_mode not in _RELEASE_PPTX_STRUCTURE_MODES
+ ):
+ _print_structure_contract_error(declared_structure_mode)
+ return 1
if pptx_structure is None:
- if declared_structure_mode not in _RELEASE_PPTX_STRUCTURE_MODES:
- _print_structure_contract_error(declared_structure_mode)
- return 1
- pptx_structure = declared_structure_mode
+ if declared_structure_mode is None:
+ pptx_structure = 'flat'
+ print(
+ "Warning: spec_lock.md has no pptx_structure.mode; using flat "
+ "compatibility mode.",
+ file=sys.stderr,
+ )
+ else:
+ pptx_structure = declared_structure_mode
elif pptx_structure == 'structured' and declared_structure_mode != 'structured':
- _print_structure_contract_error(declared_structure_mode)
+ _print_structure_contract_error(
+ declared_structure_mode,
+ requested_mode='structured',
+ )
return 1
if (
diff --git a/skills/ppt-master/templates/charts/README.md b/skills/ppt-master/templates/charts/README.md
index 348c7b94..d292ee96 100644
--- a/skills/ppt-master/templates/charts/README.md
+++ b/skills/ppt-master/templates/charts/README.md
@@ -6,7 +6,7 @@ This directory contains the standardized SVG visualization templates used by PPT
[`charts_index.json`](./charts_index.json) is the single source of truth for the library: total count + one selection-rule `summary` per template (format: `"Pick for X. Skip if Y (use other_key)."`). [`chart_recall.py`](../../scripts/chart_recall.py) can recall a bounded candidate set from this live registry without maintaining a second category or keyword index.
-For one planned page, provide 3-8 English semantic content-shape tags, then inspect the positive-scoring summaries plus the explicit `no-template-match` option. The requested limit is a cap, not a padding target, and lexical confidence never expands the output automatically. When terminology mismatch or structural ambiguity suggests that bounded recall missed a relevant template, rerun with `--semantic-fallback` for an explicit full-catalog review. The flag is optional, not a gate before `no-template-match`. `no-template-match` stays inside planning: it creates no §VII row or `page_charts` entry, and the chosen fallback is described in the page's §IX block. See [`chart-recall.md`](../../scripts/docs/chart-recall.md). The Generate workflow remains the authority for when Strategist uses this helper; maintainers may still open the registry directly when editing or auditing the catalog.
+For one planned page, provide 3-8 English semantic content-shape tags, then inspect the positive-scoring summaries plus the explicit `no-template-match` option. The requested limit is a cap, not a padding target, and lexical confidence never expands the output automatically. At `high` / `medium`, the Strategist may keep `no-template-match` when no bounded candidate fits. At `low` / `none`, a fitting candidate needs no expansion, but the Strategist must rerun the same query once with `--semantic-fallback` before keeping `no-template-match`. The negative result stays inside planning: it creates no §VII row or `page_charts` entry, and the chosen fallback is described in the page's §IX block. See [`chart-recall.md`](../../scripts/docs/chart-recall.md). The Generate workflow remains the authority for when Strategist uses this helper; maintainers may still open the registry directly when editing or auditing the catalog.
## Authoring contract