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(template-authoring): make imported SVG views editable IR

hugohe365e9a54e89b9
diff --git a/docs/faq.md b/docs/faq.md
index 76c44ef3..19c3b30e 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -242,7 +242,7 @@ Want to turn a PPT you love into a reusable template for PPT Master? Here's how:
The recommended input is the original `.pptx`. PPT Master extracts theme identity, declared Master/Layout topology, placeholder metadata, native-shape evidence, and reusable assets. `standard` and `fidelity` use the source as visual reference and author a new SVG roster plus a new Master/Layout/slot system; they neither preserve nor distill source topology. `mirror` instead restores source slide order, Master/Layout identities and parentage, placeholder facts, and supported visuals without semantic synthesis. Fixed Master/Layout group wrappers are mechanically expanded into direct atoms because structural layers cannot be `<g>`.
-Large imported SVGs may contain native-shape metadata, hidden carriers, and preview fingerprints. That lossless representation stays in the temporary analysis workspace, while the model reads a lightweight inspection projection. The projection is never an export source. `standard` / `fidelity` author project-canonical SVG and use compact authored-preset groups only for exact registered preset matches. Mirror materializes from the lossless source, reuses only metadata already supported by the converter on unchanged Slide-local/slot objects, and keeps an SVG fallback for unsupported or edited objects.
+Large imported SVGs may contain native-shape metadata, hidden carriers, and preview fingerprints. That lossless representation stays immutable in the temporary analysis workspace as payload backing. Template creation uses a lightweight editable IR with document-local source refs and a compact path/hash manifest. `standard` / `fidelity` author project-canonical SVG and use compact authored-preset groups only for exact registered preset matches. Mirror materializes final templates from the IR, reuses converter-supported payload only for unchanged Slide-local/slot refs, and keeps an SVG fallback for unsupported or edited objects.
If no source PPTX exists, screenshots of the key page types still work — cover, TOC, chapter, content, and closing — but geometry, fonts, and inheritance must then be inferred visually.
diff --git a/docs/roadmap.md b/docs/roadmap.md
index 60c64d08..b9e3c1d2 100644
--- a/docs/roadmap.md
+++ b/docs/roadmap.md
@@ -84,7 +84,7 @@ The past two months' structural capability growth. Single flags / incremental po
- **`--native-charts-and-tables` hardened from dormant marker to usable opt-in** — the narrow native Chart/Table exception (see Non-goals below) now emits charts and pure-text tables that keep the deck's own design instead of snapping to PowerPoint's white default theme. Classic native charts write explicit chart-area / plot-area / axis-line / gridline / label-text colors — inferred from the visible SVG fallback (largest panel `<rect>` → background, fallback text → labels, fallback strokes → axis/grid) or overridden per `style` (`chart_area_fill` / `plot_area_fill` / `text_color` / `axis_color` / `grid_color`, `"none"` for transparent); the color parser normalizes named CSS colors, `#RGB` shorthand, and `rgb()` / `rgba()` to OOXML hex; bar/column series disable negative-value fill inversion so negative bars keep their series color. The activated export is named `<name>_<ts>_native_charts_tables.pptx` to tell it apart from the default shape-based export. **The default route is unchanged** — charts/tables still export as editable SVG-derived DrawingML shapes for cross-renderer fidelity; PowerPoint-native Chart/Table objects add a data source and object-specific editing model and stay the deliberate opt-in trade documented under Non-goals below
-- **Native package structure + mode-specific template creation** — deck/layout-template SVG pages declare their final Master/Layout identity while they are authored. Fixed Master/Layout visuals are root-level atoms, reusable slots are bounded top-level groups with real carriers or an explicit composite proxy, and zero-slot Layouts remain valid. Structured export deterministically compiles only that contract and performs final package read-back; it never promotes repeated chrome or infers placeholders. Flat free-design/brand-only export keeps all content Slide-local while replacing the stock Office scaffold with one clean project-owned Master and Blank Layout plus a deck-named current-lock theme. It removes title/body and other stock content, prunes unused Layouts, and retains only the standard date/footer/slide-number capability hooks. Both generated routes write the locked title plus a deterministic nine-level body hierarchy into Master `p:txStyles`, preserving paragraph and bullet settings. `standard` / `fidelity` author new SVG rosters and new Master/Layout systems without preserving or distilling source topology. `mirror` restores the complete supported source graph—including definition-only prototypes for unused Layouts—without semantic synthesis; fixed-layer source groups are mechanically expanded into direct atoms. Lossless imports stay in analysis and lightweight projections stay inspection-only. Library and project outputs share required `templates/`, optional `images/` / `icons/`, and optional on-demand review output in `exports/`; only library registration differs. Legacy baseline/template/preserve SVG packages first run `restore-pptx-structure`. Raw one-off PPTX filling remains `template-fill-pptx`.
+- **Native package structure + mode-specific template creation** — deck/layout-template SVG pages declare their final Master/Layout identity while they are authored. Fixed Master/Layout visuals are root-level atoms, reusable slots are bounded top-level groups with real carriers or an explicit composite proxy, and zero-slot Layouts remain valid. Structured export deterministically compiles only that contract and performs final package read-back; it never promotes repeated chrome or infers placeholders. Flat free-design/brand-only export keeps all content Slide-local while replacing the stock Office scaffold with one clean project-owned Master and Blank Layout plus a deck-named current-lock theme. It removes title/body and other stock content, prunes unused Layouts, and retains only the standard date/footer/slide-number capability hooks. Both generated routes write the locked title plus a deterministic nine-level body hierarchy into Master `p:txStyles`, preserving paragraph and bullet settings. `standard` / `fidelity` author new SVG rosters and new Master/Layout systems without preserving or distilling source topology. `mirror` restores the complete supported source graph—including definition-only prototypes for unused Layouts—without semantic synthesis; fixed-layer source groups are mechanically expanded into direct atoms. Lossless imports stay immutable in analysis as payload backing, while `authoring-svg/` plus its manifest form the editable template-creation IR. Library and project outputs share required `templates/`, optional `images/` / `icons/`, and optional on-demand review output in `exports/`; only library registration differs. Legacy baseline/template/preserve SVG packages first run `restore-pptx-structure`. Raw one-off PPTX filling remains `template-fill-pptx`.
- **Native-preset authoring guidance strengthened across roles** — using a real PowerPoint preset (`prstGeom`, with adjustment handles and the non-flat-card look) is reaffirmed as the default for stock geometry (block arrows, chevrons, banners, callouts, flowchart nodes, stars), not an exception. New pages and project-owned templates use the compact atomic `<g>` emitted by `preset_shape_svg.py`: the group owns the preset metadata and base paint once, while its direct visible paths are registry-derived layers with only necessary per-layer paint overrides. The authoring form has no hidden carrier, preview wrapper, or stored fingerprint; it is helper-only, and any change to preset, frame, adjustments, or paint regenerates the whole group instead of editing paths or metadata. A matching compact fragment may therefore live in `templates/charts/` when it expresses an intentional stock shape. The Executor still decides by object intent at draw time rather than scanning finished paths, and the paint boundary remains narrow: gradient fill/stroke or pattern fill stays ordinary SVG. PPTX import and `mirror` keep the separate expanded lossless representation. The Strategist continues to prime likely pages with a non-destructive `native-preset candidate` note; the Executor selects the exact preset, frame, and paint
diff --git a/docs/technical-design.md b/docs/technical-design.md
index ddf02f67..e09b46cc 100644
--- a/docs/technical-design.md
+++ b/docs/technical-design.md
@@ -503,7 +503,7 @@ These direct routes share some analysis primitives with the main pipeline, espec
**Why per-element dispatch, not whole-file translation.** SVG's hierarchical model maps cleanly onto DrawingML's group / shape / picture types — there's no need for a holistic optimizer that re-plans the slide. Each shape kind gets its own narrow translator, which keeps each translator simple enough to debug and unit-test in isolation. The output quality of a slide is the sum of independent local conversions; that property is fragile under whole-file translation but robust under element dispatch.
-**Why imported and authored shape metadata are separate.** A lossless imported SVG may need native-shape metadata, hidden carriers, and preview fingerprints to recover an advanced PowerPoint shape. That representation stays in the temporary analysis workspace. `svg_authoring_view.py` creates a lightweight inspection projection without opaque payload or duplicate hidden carriers; the projection is never an export source. `standard` / `fidelity` author project-canonical SVG and use the compact authored-preset group only for exact registered preset matches. Mirror materializes from the lossless source and may reuse converter-supported metadata on unchanged Slide-local/slot objects; fixed structural layers remain direct atoms, and unsupported or edited objects keep their current SVG fallback.
+**Why imported and authored shape metadata are separate.** A lossless imported SVG may need native-shape metadata, hidden carriers, and preview fingerprints to recover an advanced PowerPoint shape. That representation stays immutable in the temporary analysis workspace as native-payload backing. `svg_authoring_view.py` creates the editable template-creation IR: lightweight SVGs with document-local source refs plus an `authoring_manifest.json` containing paths and initial hashes, not duplicated payload. `standard` / `fidelity` author project-canonical SVG and use the compact authored-preset group only for exact registered preset matches. Mirror materializes validated templates from the IR and rehydrates converter-supported metadata only for unchanged Slide-local/slot refs; fixed structural layers remain direct atoms, unsupported or edited objects keep their current SVG fallback, and IR-only refs do not enter final template SVGs.
**Why there is only one PPTX compiler route.** Native export reads authored SVGs and translates supported SVG elements into DrawingML shapes. The normal deck path reads `svg_output/`; when requested, create-template invokes the same structured compiler on validated template prototypes to produce `exports/<id>_template_preview.pptx` as review evidence. The project does not package whole-slide SVG media or alternate raster renderings into a second PPTX. `svg_final/` is still generated on every standard deck run, but it is a self-contained visual-preview artifact rather than a PPTX source; users may insert it as an SVG picture, while PowerPoint's manual Convert to Shape command remains outside the supported contract.
diff --git a/docs/templates-architecture.md b/docs/templates-architecture.md
index 9257b909..2f0bd64f 100644
--- a/docs/templates-architecture.md
+++ b/docs/templates-architecture.md
@@ -69,7 +69,7 @@ Imported vectors use `data-icon="imported/<name>"` and have one canonical file
at `icons/imported/<name>.svg`. Workspace-aware validation and export resolve
that root path directly; `templates/icons/` is not part of the package shape.
-PPTX import uses a two-level metadata model. The temporary lossless SVG keeps native-shape metadata, hidden carriers, and preview evidence; `svg_authoring_view.py` creates a lightweight model-facing projection without opaque payload or duplicate hidden carriers. The projection is never an export source. Authored modes use project-canonical SVG and compact authored-preset groups only for exact registered preset matches. Mirror may reuse converter-supported metadata on unchanged Slide-local/slot objects; fixed structural layers remain direct atoms, and unsupported or edited objects keep their SVG fallback. Export compiles only the declared SVG structure and never infers ownership.
+PPTX import uses a two-level metadata model. The temporary lossless SVG keeps native-shape metadata, hidden carriers, and preview evidence as immutable payload backing; `svg_authoring_view.py` creates the editable authoring IR bundle, whose lightweight SVGs carry document-local source refs and whose manifest stores only paths and initial hashes. Authored modes use project-canonical SVG and compact authored-preset groups only for exact registered preset matches. Mirror materializes templates from the IR and reuses converter-supported payload only for unchanged Slide-local/slot refs; fixed structural layers remain direct atoms, unsupported or edited objects keep their SVG fallback, and final templates contain no IR-only refs. Export compiles only the declared SVG structure and never infers ownership.
Both scopes retain `kind: layout` or `kind: deck` in portable frontmatter. `output_scope` and `target_project` stay in the workflow brief and are not persisted into `design_spec.md`.
diff --git a/docs/templates-guide.md b/docs/templates-guide.md
index 13b9b5e2..331d1812 100644
--- a/docs/templates-guide.md
+++ b/docs/templates-guide.md
@@ -172,7 +172,7 @@ This is the most easily confused decision when deriving a template.
**About sprite sheets**: PPTX-exported assets are often a single large image referenced from multiple slides, each cropping a different region via nested `<svg viewBox=...>` wrappers. In `fidelity` and `mirror` modes this nesting must be preserved — you cannot flatten it to a bare `<image>`, or the crop is lost and the page misaligns. The workflow validates this automatically.
-**About native PowerPoint shapes**: the lossless import SVG stays in the temporary analysis workspace, while the model works from a lightweight projection that omits opaque payload and duplicate hidden carriers. The projection is never an export source. Authored modes use project-canonical SVG and compact authored-preset groups only for exact registered preset matches. Mirror may reuse converter-supported metadata on unchanged Slide-local/slot objects; fixed Master/Layout layers remain direct atoms, and unsupported or edited objects keep the current SVG fallback.
+**About native PowerPoint shapes**: the lossless import SVG stays immutable in the temporary analysis workspace as native-payload backing. Template creation uses the lightweight editable `authoring-svg/` IR and its source-ref/hash manifest. Authored modes use project-canonical SVG and compact authored-preset groups only for exact registered preset matches. Mirror materializes final template SVGs from the IR, reusing converter-supported payload only for unchanged Slide-local/slot refs; fixed Master/Layout layers remain direct atoms, unsupported or edited objects keep the current SVG fallback, and final templates contain no IR-only refs.
**Mirror graph boundary**: mirror preserves the complete supported source Master/Layout graph. It emits one complete prototype per source slide and one definition-only `layout_<layout_key>.svg` prototype for every source Layout unused by those slides. The latter registers in PowerPoint through the independent Layout roster without becoming a published page; its parent Master is retained with it. Preflight stops only when required source facts or supported geometry are missing, never merely because a Layout is unused.
diff --git a/docs/zh/faq.md b/docs/zh/faq.md
index 9b63edaf..a7ea2700 100644
--- a/docs/zh/faq.md
+++ b/docs/zh/faq.md
@@ -246,7 +246,7 @@ beautify 和主管线的一句话判别:**原来的分页是要保留的信息
**最推荐的方式是直接给原始 `.pptx` 文件**。PPT Master 会提取主题色、字体、Master/Layout、placeholder type/idx、原生形状信息和可复用图片资源。`standard` 与 `fidelity` 把来源当作视觉参考,重新设计 SVG roster 和新的 Master/Layout/slot 系统,不保留、也不蒸馏来源拓扑。`mirror` 则按来源页序恢复 Master/Layout 身份与父子关系、placeholder 事实和受支持的视觉对象,不做语义归纳。由于结构层禁止 `<g>`,来源 Master/Layout 的 group wrapper 只允许机械展开成直接原子。
-完整导入 SVG 可以保留高级 PowerPoint 形状所需的 metadata、隐藏 carrier 和预览指纹,但模型只读取轻量 inspection projection;projection 永远不是导出源。`standard` / `fidelity` 创作项目规范化 SVG,只有精确匹配已登记 preset 时才使用 compact authored-preset 组。Mirror 从无损来源物化,只在未改的 Slide-local/slot 对象上复用转换器已经支持的 metadata;不支持或已修改的对象保留当前 SVG fallback。
+完整导入 SVG 可以保留高级 PowerPoint 形状所需的 metadata、隐藏 carrier 和预览指纹,并作为载荷后备留在临时分析工作区且保持不可变。模板创建使用带文档内 source ref 和紧凑路径/hash manifest 的轻量可编辑 IR。`standard` / `fidelity` 创作项目规范化 SVG,只有精确匹配已登记 preset 时才使用 compact authored-preset 组。Mirror 从 IR 物化最终模板,只为未改且 hash 匹配的 Slide-local/slot ref 恢复转换器已经支持的载荷;不支持或已修改的对象保留当前 SVG fallback。
没有源 PPTX 时,截图集也能跑(`cover.png` / `toc.png` / `chapter.png` / `content.png` / `closing.png`),但保真度会明显下降。建议优先找原始 PPTX。
diff --git a/docs/zh/roadmap.md b/docs/zh/roadmap.md
index 26751865..7ac3f44c 100644
--- a/docs/zh/roadmap.md
+++ b/docs/zh/roadmap.md
@@ -84,7 +84,7 @@
- **`--native-charts-and-tables` 从休眠 marker 硬化为可用级 opt-in** — 那条窄「原生 Chart/Table」例外(见下文 Non-goals)现在导出的图表与纯文本表格会**保留 deck 自己的设计**,不再塌回 PowerPoint 的白底默认主题。classic 原生图表显式写入 chart-area / plot-area / 轴线 / 网格线 / 标签文字颜色——从可见的 SVG fallback 推断(最大面板型 `<rect>` → 背景、fallback 文字 → 标签、fallback 描边 → 轴线/网格),或用 `style` 显式覆盖(`chart_area_fill` / `plot_area_fill` / `text_color` / `axis_color` / `grid_color`,`"none"` 表透明);颜色解析把命名色、`#RGB` 简写、`rgb()` / `rgba()` 归一为 OOXML hex;bar/column 系列关掉负值反色,负值柱保持系列色。激活导出命名为 `<name>_<ts>_native_charts_tables.pptx`,以与默认形状导出区分。**默认路线不变**——图表/表格仍以可编辑的 SVG 派生 DrawingML 形状导出以保跨渲染器保真;PowerPoint 原生 Chart/Table 增加数据源和对象专属编辑模型,仍是下文 Non-goals 里那条刻意的 opt-in 取舍
-- **原生 package 结构 + 按模式创建模板** — deck/layout-template SVG 页面在创作时就声明最终 Master/Layout 身份。固定 Master/Layout 视觉是根级原子,可复用槽位是带真实 carrier 或显式 composite proxy 的有界顶层 group,零槽位 Layout 也合法。`structured` 导出只确定性编译该合同并执行最终 package 回读;不提升重复 chrome,也不推断 placeholder。`flat` 自由设计 / brand-only 导出则保持所有内容 Slide-local,同时把 stock Office 脚手架替换成一个属于项目的干净 Master、一个 Blank Layout 和按 deck 命名的当前 lock 主题;删除 title/body 等 stock 内容、裁掉未使用 Layout,仅保留标准日期、页脚和页码能力钩子。两条生成路线都把锁定 title 与确定性的九级 body 层级写入母版 `p:txStyles`,同时保留段落和项目符号设置。`standard` / `fidelity` 重新创作 SVG roster 和新的 Master/Layout 系统,不保留、也不蒸馏来源拓扑。`mirror` 恢复完整且受支持的来源图谱,包括未使用 Layout 的定义专用原型;固定结构层的来源 group 只允许机械展开成直接原子,不做语义归纳。无损导入保留在分析区,轻量 projection 仅供检查。`library` 与 `project` 都要求 `templates/`,`images/` / `icons/` 可选,`exports/` 仅在按需生成评审文件时出现;只有全局注册不同。旧 baseline/template/preserve SVG 包先运行 `restore-pptx-structure`;原始 PPTX 的一次性回填仍走 `template-fill-pptx`。
+- **原生 package 结构 + 按模式创建模板** — deck/layout-template SVG 页面在创作时就声明最终 Master/Layout 身份。固定 Master/Layout 视觉是根级原子,可复用槽位是带真实 carrier 或显式 composite proxy 的有界顶层 group,零槽位 Layout 也合法。`structured` 导出只确定性编译该合同并执行最终 package 回读;不提升重复 chrome,也不推断 placeholder。`flat` 自由设计 / brand-only 导出则保持所有内容 Slide-local,同时把 stock Office 脚手架替换成一个属于项目的干净 Master、一个 Blank Layout 和按 deck 命名的当前 lock 主题;删除 title/body 等 stock 内容、裁掉未使用 Layout,仅保留标准日期、页脚和页码能力钩子。两条生成路线都把锁定 title 与确定性的九级 body 层级写入母版 `p:txStyles`,同时保留段落和项目符号设置。`standard` / `fidelity` 重新创作 SVG roster 和新的 Master/Layout 系统,不保留、也不蒸馏来源拓扑。`mirror` 恢复完整且受支持的来源图谱,包括未使用 Layout 的定义专用原型;固定结构层的来源 group 只允许机械展开成直接原子,不做语义归纳。无损导入在分析区保持不可变并作为载荷后备,`authoring-svg/` 及其 manifest 则组成可编辑的模板创建 IR。`library` 与 `project` 都要求 `templates/`,`images/` / `icons/` 可选,`exports/` 仅在按需生成评审文件时出现;只有全局注册不同。旧 baseline/template/preserve SVG 包先运行 `restore-pptx-structure`;原始 PPTX 的一次性回填仍走 `template-fill-pptx`。
- **原生预设创作引导跨角色强化** — 用真正的 PowerPoint 预设(`prstGeom`,带调节手柄、非扁平卡片外观)被重申为库存几何(块箭头、chevron、横幅、标注、流程节点、星形)的**默认**而非例外。新页面与项目自有模板使用 `preset_shape_svg.py` 输出的 compact 原子 `<g>`:group 只写一次 preset metadata 与基础 paint,直接可见 path 是 registry 派生层,只保留必要的分层 paint 覆盖。创作形式没有 hidden carrier、preview wrapper 或持久化 fingerprint;只允许通过 helper 生成,preset、frame、adjustment 或 paint 任一变化都整体重生成,不手改 path 或 metadata。因此,当 compact 片段明确表达所需库存形状时,可以保存在 `templates/charts/` 中。Executor 仍按对象意图在画图当下决定,绝不扫描已完成路径;paint 边界保持收窄:渐变填充/描边或 pattern 填充仍用普通 SVG。PPTX 导入与 `mirror` 继续使用另一套 expanded 无损表达。Strategist 仍给可能适用的 §VII 页面追加非破坏性的 `native-preset candidate` 注记;具体 preset、frame 与 paint 由 Executor 选择
diff --git a/docs/zh/technical-design.md b/docs/zh/technical-design.md
index d103e534..42beaedb 100644
--- a/docs/zh/technical-design.md
+++ b/docs/zh/technical-design.md
@@ -505,7 +505,7 @@ PowerPoint 的 DrawingML 是 SVG 表达力的严格子集,因此主编译路
**为什么是逐元素派发而不是整体翻译。** SVG 的层级模型干净地映射到 DrawingML 的 group / shape / picture 类型——不需要一个全局优化器去重新规划幻灯片。每种形状都有自己窄的翻译器,简单到能单独调试和单元测试。一张幻灯片的最终质量等于这些独立局部转换之和;这个性质在整体翻译下脆弱,在元素派发下稳健。
-**为什么导入型与生成型 metadata 分层。** 导入 PPTX 时,完整 SVG 可以携带高级形状所需的 metadata、隐藏 carrier 和预览指纹,但这类载荷不适合直接进入模型上下文。authoring projection 会非破坏性地移除大体积载荷,只保留可见几何和紧凑意图,而且永远不是导出源。`standard` / `fidelity` 创作项目规范化 SVG,只有精确匹配已登记 preset 时才使用 compact authored-preset 组。Mirror 从无损来源物化,可在未改的 Slide-local/slot 对象上复用转换器已经支持的 metadata;固定结构层保持直接原子,不支持或已修改的对象保留当前 SVG fallback。
+**为什么导入型与生成型 metadata 分层。** 导入 PPTX 时,完整 SVG 可以携带高级形状所需的 metadata、隐藏 carrier 和预览指纹,因此作为原生载荷后备留在临时分析工作区且保持不可变。`svg_authoring_view.py` 生成模板创建所用的可编辑 IR:轻量 SVG 通过文档内 source ref 标识对象,`authoring_manifest.json` 只记录路径与初始 hash,不重复保存原始载荷。`standard` / `fidelity` 创作项目规范化 SVG,只有精确匹配已登记 preset 时才使用 compact authored-preset 组。Mirror 从 IR 物化通过校验的模板,只为未改且 hash 匹配的 Slide-local/slot ref 恢复转换器已支持的 metadata;固定结构层保持直接原子,不支持或已修改的对象保留当前 SVG fallback,IR 专用 ref 不进入最终模板 SVG。
**为什么只有一条 PPTX 编译路线。** Native 导出把作者 SVG 中受支持的元素逐个翻译成 DrawingML 形状。常规 deck 路线读取 `svg_output/`;用户需要时,create-template 对通过校验的模板原型调用同一 structured 编译器,生成 `exports/<id>_template_preview.pptx` 作为审阅证据。项目不会把整页 SVG 媒体或另一套位图渲染打包成第二类 PPTX。`svg_final/` 仍由常规 deck 的强制后处理生成,但只承担自包含视觉预览和 SVG 图片插入,不为 PowerPoint 手工“转换为形状”提供兼容兜底。
diff --git a/docs/zh/templates-architecture.md b/docs/zh/templates-architecture.md
index 41b69453..12101959 100644
--- a/docs/zh/templates-architecture.md
+++ b/docs/zh/templates-architecture.md
@@ -69,7 +69,7 @@ native_structure_mode: structured
导入向量统一使用 `data-icon="imported/<name>"`,唯一规范文件位于 `icons/imported/<name>.svg`。具备工作区感知的校验与导出会直接解析这个根目录路径;`templates/icons/` 不属于模板包结构。
-原生形状 metadata 采用两级模型。完整导入 SVG 保存 native metadata、隐藏 carrier 和预览证据;轻量 authoring projection 移除大体积载荷与重复 carrier,只供模型检查,永远不是导出源。创作模式使用项目规范化 SVG,只有精确匹配已登记 preset 时才使用 compact authored-preset 组。Mirror 可在未改的 Slide-local/slot 对象上复用转换器已经支持的 metadata;固定结构层保持直接原子,不支持或已修改的对象保留 SVG fallback。导出只编译声明的结构,不推断归属。
+原生形状 metadata 采用两级模型。完整导入 SVG 保存 native metadata、隐藏 carrier 和预览证据,并作为不可变原生载荷后备;`svg_authoring_view.py` 生成可编辑 authoring IR,其中轻量 SVG 使用文档内 source ref 标识对象,manifest 只保存路径和初始 hash。创作模式使用项目规范化 SVG,只有精确匹配已登记 preset 时才使用 compact authored-preset 组。Mirror 从 IR 物化模板,仅为未改且 hash 匹配的 Slide-local/slot ref 恢复转换器已支持的载荷;固定结构层保持直接原子,不支持或已修改的对象保留 SVG fallback,最终模板不包含 IR 专用 ref。导出只编译声明的结构,不推断归属。
两种范围都在可移植 frontmatter 中保留 `kind: layout` 或 `kind: deck`。`output_scope` 与 `target_project` 只属于工作流简报,不写入 `design_spec.md`。
diff --git a/docs/zh/templates-guide.md b/docs/zh/templates-guide.md
index 676ec93c..f46e16f7 100644
--- a/docs/zh/templates-guide.md
+++ b/docs/zh/templates-guide.md
@@ -172,7 +172,7 @@ PPT Master 的“模板”是一份**结构 + 风格**的预设包:每张 SVG
**关于精灵图**:PPTX 导出的素材常常是**一张大图 + 多页通过 viewBox 裁剪不同区域**。`fidelity` 和 `mirror` 模式下必须保留这层嵌套 `<svg viewBox=...>` 包装,不能扁平化为单张 `<image>`——否则裁剪信息丢失,画面会错位。工作流会自动校验这一点。
-**关于 PowerPoint 原生形状**:完整导入 SVG 保留在临时分析工作区,模型读取的是移除 opaque payload 和重复 carrier 的轻量 projection;projection 永远不是导出源。创作模式使用项目规范化 SVG,只有精确匹配已登记 preset 时才使用 compact authored-preset 组。Mirror 可在未改的 Slide-local/slot 对象上复用转换器已支持的 metadata;固定 Master/Layout 层保持直接原子,不支持或已修改的对象保留当前 SVG fallback。
+**关于 PowerPoint 原生形状**:完整导入 SVG 作为原生载荷后备留在临时分析工作区且保持不可变;模板创建使用轻量、可编辑的 `authoring-svg/` IR 及其 source-ref/hash manifest。创作模式使用项目规范化 SVG,只有精确匹配已登记 preset 时才使用 compact authored-preset 组。Mirror 从 IR 物化最终模板 SVG,只为未改且 hash 匹配的 Slide-local/slot ref 恢复转换器已支持的载荷;固定 Master/Layout 层保持直接原子,不支持或已修改的对象保留当前 SVG fallback,最终模板不包含 IR 专用 ref。
**Mirror 图谱边界**:mirror 保留完整且受支持的来源 Master/Layout 图谱。它为每张来源 Slide 输出一个完整原型,并为未被任何来源 Slide 使用的 Layout 额外输出一个定义专用的 `layout_<layout_key>.svg`。后者通过独立 Layout roster 注册进 PowerPoint,不会变成发布页面;其父 Master 也随之保留。预检只在必要来源事实或受支持几何缺失时停止,不会仅因 Layout 未使用而停止。
diff --git a/skills/ppt-master/SKILL.md b/skills/ppt-master/SKILL.md
index c3015c00..b8776d5f 100644
--- a/skills/ppt-master/SKILL.md
+++ b/skills/ppt-master/SKILL.md
@@ -90,7 +90,7 @@ description: >
| `${SKILL_DIR}/scripts/latex_render.py` | LaTeX formula rendering (manifest-driven PNG assets) |
| `${SKILL_DIR}/scripts/image_gen.py` | AI image generation (multi-provider) |
| `${SKILL_DIR}/scripts/slice_images.py` | Slice one AI illustration sheet into individual spot-illustration elements |
-| `${SKILL_DIR}/scripts/svg_authoring_view.py` | Create a lightweight non-destructive inspection projection of PPTX-imported SVGs; never a release source |
+| `${SKILL_DIR}/scripts/svg_authoring_view.py` | Create a lightweight editable authoring IR bundle and compact provenance manifest from PPTX-imported SVGs |
| `${SKILL_DIR}/scripts/svg_quality_checker.py` | SVG quality check |
| `${SKILL_DIR}/scripts/preset_shape_svg.py` | Print one compact registry-backed native PowerPoint preset `<g>` to stdout for page or template insertion |
| `${SKILL_DIR}/scripts/total_md_split.py` | Speaker notes splitting |
@@ -140,12 +140,16 @@ Master/Layout topology is neither preserved nor distilled. `mirror` is a
restoration path: preserve the source slide roster/order, visual appearance,
Master/Layout parentage and identities, placeholder type/index/bounds, native
object ownership, and supported native-shape metadata. The lossless import is
-the restoration authority; the lightweight authoring projection exists only to
-keep model context small. Mechanical normalization may express the source facts
-in the current explicit SVG contract and expand fixed-layer group wrappers into
-direct atoms, but it MUST NOT merge, split, promote, demote, rename, or
-re-parent source structure. Export compiles the selected contract and never
-infers a different one. Mirror emits one complete page prototype per source
+the native-payload backing store; the `authoring-svg/` bundle and its
+`authoring_manifest.json` are the only editable template-creation IR. Stable
+document-local source references let mirror materialization reuse unchanged
+native payload without putting it in model context. Mechanical normalization
+may express the source facts in the current explicit SVG contract and expand
+fixed-layer group wrappers into direct atoms, but it MUST NOT merge, split,
+promote, demote, rename, or re-parent source structure. The IR is materialized
+into validated `templates/*.svg` before export; it is not itself a release SVG
+directory. Export compiles the selected contract and never infers a different
+one. Mirror emits one complete page prototype per source
Slide plus one definition-only `layout_<layout_key>.svg` prototype for every
source Layout unused by those Slides. The independent Master/Layout roster then
registers the complete supported source graph without publishing synthetic
diff --git a/skills/ppt-master/references/artifact-ownership.md b/skills/ppt-master/references/artifact-ownership.md
index c9f9789f..13f63d09 100644
--- a/skills/ppt-master/references/artifact-ownership.md
+++ b/skills/ppt-master/references/artifact-ownership.md
@@ -22,6 +22,11 @@ Global artifact ownership rules for PPT Master projects.
| `images/` | Runtime image pool | User, extracted, AI, web, formula, slice, EMF/WMF assets | Step 5 writes here; `analysis/image_analysis.csv` derives from current contents |
| `icons/` | Project icon inventory | Icons copied by `icon_sync.py` for this project | Executor uses locked project icons; exporter may fall back to global library only as documented |
| `templates/` | Project template reference | Step 3 imported specs, template SVGs, and non-image assets | Strategist/Executor read only when Step 3 is triggered |
+| `<import_workspace>/svg/`, `<import_workspace>/svg-flat/` | Imported native-payload backing | Complete PPTX-derived metadata, hidden carriers, fallback evidence, and source structure | Keep immutable; create-template materialization may resolve a validated source ref against these files, but models do not edit or bulk-read them |
+| `<import_workspace>/authoring-svg/` | Template-creation author source | Layered editable SVG IR for imported Master, Layout, and Slide objects | Template_Designer reads and edits this bundle; final template SVGs are materialized from it rather than copied from lossless backing |
+| `<import_workspace>/authoring-svg/authoring_manifest.json` | Authoring provenance contract | Per-document source/authoring hashes and document-local source-ref paths | Generated atomically with the IR; materialization validates it before reusing native payload; never duplicate raw payload here |
+| `<import_workspace>/authoring-svg-flat/` | Complete-page verification IR | Self-contained page composition view with its own provenance manifest | Use to verify composition; layered `authoring-svg/` remains the canonical editable source |
+| `<import_workspace>/icons/imported/` | Imported vector pool | One canonical copy of every factored vector subtree | Authoring SVGs reference `data-icon="imported/<name>"`; vector inventories retain source refs so expansion restores IR identity |
| `confirm_ui/recommendations.json` | Confirmation proposal | Strategist-authored confirmation payload | Confirm UI reads; rewritten between Stage 1, Stage 2, and Stage 3 |
| `confirm_ui/result.json` | Confirmation result | User-confirmed values | Strategist treats final result as authoritative over recommendations |
| `svg_output/` | Page-design author source | Main-agent handwritten SVG pages containing the complete visible design | Quality checker and native PPTX export read this as the canonical visual/page-layout source; templates and locks do not add missing visible objects at export |
@@ -44,6 +49,7 @@ Global artifact ownership rules for PPT Master projects.
| Design contract | `design_spec.md` explains; `spec_lock.md` executes. Executor must not infer execution values from prose. |
| Free-design / brand-only packaging authority | `spec_lock.md` declares `pptx_structure.mode: flat` and omits `pptx_masters`, `pptx_layouts`, `page_pptx_layouts`, and `page_layouts`. `svg_output/` owns the complete Slide-local visual design without root Master/Layout identity, fixed-layer ownership, or placeholder metadata. Export materializes one clean project-owned Master plus one Blank Layout, applies the locked theme defaults, removes stock content placeholders/Layout inventory, and retains only the standard date/footer/slide-number capability hooks. |
| Template structure authority | `page_layouts` owns each page's authoring-input prototype. `pptx_masters` / `pptx_layouts` own the unique reusable output definitions, while `page_pptx_layouts` owns page assignment. Strict keeps the prototype contract; adaptive may create a new Layout definition during page authoring and updates its assignment immediately. Unused definitions may register without a published Slide. Templates validate provenance but never add missing visible page objects during export. |
+| Imported-template authoring | `authoring-svg/` plus its `authoring_manifest.json` own edits and source-object identity during create-template. Lossless `svg/` / `svg-flat/` own only immutable native payload and fallback evidence. Materialized `templates/*.svg` own the validated deliverable contract and contain no IR-only source refs. |
| Legacy structure migration | [`restore-pptx-structure`](../workflows/restore-pptx-structure.md) owns conversion of old unmapped/distilled/preserve structured projects and legacy template packages into the current template contract. An intentional free-design or brand-only `flat` project is not a migration input. The exporter does not migrate or visually cluster legacy template structure. |
| Image facts | `images/` is live state; `analysis/image_analysis.csv` is a regenerated view, not a durable cache. |
| SVG source | `svg_output/` is the only author source for generated pages. |
@@ -54,7 +60,7 @@ Global artifact ownership rules for PPT Master projects.
| Shape-conversion boundary | PowerPoint's manual Convert-to-Shape operation on `svg_final/` is outside the project compatibility contract. |
| Confirmation | Final `confirm_ui/result.json` or chat confirmation overrides recommendations. |
-**Forbidden - mixed ownership**: Do not copy chart values from Markdown into `analysis/` by hand, do not edit `svg_final/` as the source of a fix, and do not treat `design_spec.md` prose as a replacement for `spec_lock.md`.
+**Forbidden - mixed ownership**: Do not copy chart values from Markdown into `analysis/` by hand, do not edit `svg_final/` as the source of a fix, do not edit imported lossless SVGs instead of their authoring IR, and do not treat `design_spec.md` prose as a replacement for `spec_lock.md`.
---
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index 3021387d..0d80a5f6 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -28,7 +28,7 @@ Other files link here instead of restating its contracts.
| Text treatments | Mixed runs, tracking, underline, strikethrough, gradient fill, outline, transparency, watermark text, and text glow | §4.2, §6.7 |
| Transforms and composition | Translate, scale, rotate, mirror, supported matrix composition, layering, and static local reuse | §1.3, §6.8 |
| Freeform geometry | Full SVG path vocabulary, curves, organic containers, multi-subpaths, and asymmetric rounded rectangles | §6.9 |
-| Imported PowerPoint shapes | Lossless import payload, lightweight inspection projection, and selective restoration of preset/custom geometry, connectors, and unchanged native text bodies | §1.4 |
+| Imported PowerPoint shapes | Immutable lossless payload backing, editable authoring IR, and selective restoration of preset/custom geometry, connectors, and unchanged native text bodies | §1.4 |
| Authored PowerPoint preset shapes | Registry-generated visible fragments that export as one native preset shape or connector | §1.5; [`native-shape-authoring.md`](./native-shape-authoring.md) |
| Radial/chart geometry | Pie/donut arcs, dashed-circle ring segments, gauges, progress rings, sunbursts, and diagonal polygon arrowheads | §6.10 |
| Constructed visual styles | Faux glass, hand-drawn marks, ink wash, Riso offset, pixel grid, halftone, isometric facets, paper cut, and line-plus-area data treatment | §6.11 |
@@ -296,10 +296,18 @@ one. This array is still diagnostic metadata, not an authoring surface.
| Representation | Contract |
|---|---|
-| Lossless import SVG | Keep complete native payload, hidden carriers, and preview evidence in the temporary analysis workspace. This is the round-trip source, not the model-facing authored page. |
-| Lightweight authoring projection | Exclude opaque payload and duplicate hidden carriers from model context while retaining visible shape intent and logical ids needed to locate an adopted object in the lossless import. It is not an export source. |
+| Lossless import SVG | Keep complete native payload, hidden carriers, and preview evidence in the temporary analysis workspace. It is immutable native-payload backing, not the editable template source. |
+| Authoring IR bundle | Keep editable SVGs plus `authoring_manifest.json`. Exclude opaque payload and duplicate hidden carriers from model context while retaining visible shape intent and a stable document-local `data-pptx-source-ref` on each imported logical object. The manifest owns source paths and initial hashes; it never duplicates raw payload. |
| `standard` / `fidelity` output | Use the compact authored-preset contract (§1.5) for newly authored stock shapes; do not transplant opaque import payload or source topology. |
-| `mirror` output | Keep the expanded lossless representation and supported imported metadata only on unchanged Slide-local/slot objects. Expand fixed Master/Layout group wrappers into direct semantic atoms while preserving source ownership, paint order, and visible appearance. |
+| `mirror` output | Materialize from the edited authoring IR. Rehydrate supported imported metadata only when a Slide-local/slot object's source ref and initial authoring hash still match; otherwise keep the current SVG fallback. Expand fixed Master/Layout group wrappers into direct semantic atoms while preserving source ownership, paint order, and visible appearance. |
+
+**Hard rule — authoring source refs**: `data-pptx-source-ref` is reserved for
+the create-template authoring IR. Its value is unique within one authoring SVG,
+not across the workspace, and must be resolved through that document's
+`authoring_manifest.json` record. Moving a referenced subtree into
+`icons/imported/` for readability must preserve the attribute and record it in
+the vector inventory; re-inlining restores the same mapping. Final materialized
+template SVGs and normal project `svg_output/` must not contain this attribute.
**Hard rule — structural-layer boundary**: An unchanged imported logical object
may keep currently supported metadata while it remains Slide-local or inside a
@@ -312,10 +320,10 @@ to exactly one native shape/connector. Do not use this normalization to change
ownership or appearance.
**Hard rule — selective payload**: Do not copy every imported metadata block into
-an authored template. Keep the full lossless import SVG separately as the
-audit/fallback source. Mirror may reuse only metadata already supported by the
-converter on unchanged Slide-local/slot objects; unsupported or edited objects
-use the current SVG fallback. `data-pptx-replace-with` remains reserved for the
+an authored template. Keep the full lossless import SVG separately as immutable
+audit/fallback backing. Mirror may reuse only metadata already supported by the
+converter on source-ref/hash-matching Slide-local/slot objects; unsupported or
+edited objects use the current SVG fallback. `data-pptx-replace-with` remains reserved for the
optional PowerPoint-native Chart/Table replacement contract.
**Registry and rendering rules**:
diff --git a/skills/ppt-master/references/template-designer.md b/skills/ppt-master/references/template-designer.md
index d34fbed2..e7233c40 100644
--- a/skills/ppt-master/references/template-designer.md
+++ b/skills/ppt-master/references/template-designer.md
@@ -27,11 +27,11 @@ When the workflow provides a PPTX reference source, the effective input package
- `source_template.pptx` — byte-preserved analysis copy for visual/package cross-checking; never a final template asset
- `summary.md` — short orientation digest derived from manifest.json
- exported `assets/`
-- `svg/master_*.svg` / `svg/layout_*.svg` — lossless layered import evidence; every master / layout in the deck rendered once, including ones no sample slide references
-- `svg/slide_NN.svg` — lossless slide-local import evidence; do not bulk-read because opaque native payload is retained
+- `svg/master_*.svg` / `svg/layout_*.svg` — immutable layered native-payload backing; every master / layout in the deck rendered once, including ones no sample slide references
+- `svg/slide_NN.svg` — immutable slide-local native-payload backing; do not bulk-read because opaque native payload is retained
- `svg/inheritance.json` — which layout / master each slide consumes
-- `svg-flat/slide_NN.svg` — lossless complete-page import evidence; use it as mirror restoration authority, not as model-facing context
-- `authoring-svg/` / `authoring-svg-flat/` — lightweight non-destructive projections created by `svg_authoring_view.py`; these are the model-facing layered and complete-page views
+- `svg-flat/slide_NN.svg` — immutable complete-page native-payload/visual backing; do not use it as the editable source
+- `authoring-svg/` / `authoring-svg-flat/` — lightweight non-destructive IR bundles created by `svg_authoring_view.py`; each contains editable SVGs plus `authoring_manifest.json`
- optional screenshots for visual cross-checking
PPTX import interpretation:
@@ -44,8 +44,8 @@ Input priority for PPTX-backed template creation depends on replication mode:
| Mode | Authoritative inputs | Model-facing inputs |
|---|---|---|
-| `standard` / `fidelity` | Finalized brief for the newly designed output; `manifest.json` for factual canvas/theme/assets | Lightweight `authoring-svg-flat/` pages and exported assets as visual references. Source Master/Layout topology is informational only and is not mined into output structure. |
-| `mirror` | `manifest.json`, `native_structure.json`, lossless layered `svg/`, lossless complete-page `svg-flat/`, and `svg/inheritance.json` | Matching lightweight `authoring-svg/` and `authoring-svg-flat/` projections for inspection. The projections never replace the lossless restoration source. |
+| `standard` / `fidelity` | Finalized brief for the newly designed output; `manifest.json` for factual canvas/theme/assets | `authoring-svg/` and optional `authoring-svg-flat/` IR documents plus exported assets as visual references. Source Master/Layout topology is informational only and is not mined into output structure. |
+| `mirror` | `manifest.json`, `native_structure.json`, `svg/inheritance.json`, and the authoring manifests | Layered `authoring-svg/` as the editable restoration IR; `authoring-svg-flat/` for complete-page verification; matching lossless `svg/` / `svg-flat/` only as immutable payload backing. |
Use `summary.md` only for orientation. Open screenshots or the original PPTX only for visual cross-checking.
@@ -54,7 +54,7 @@ Use `summary.md` only for orientation. Open screenshots or the original PPTX onl
| Mode | Output structure contract |
|---|---|
| `standard` / `fidelity` | Author project-canonical SVG prototypes and an intentional new Master/Layout/slot system. Source visual language and assets may guide the design, but source ownership, keys, picker names, parent relationships, placeholders, and repeated Slide-local elements do not define or seed the output topology. Use the compact authored-preset group only for exact registered preset matches. |
-| `mirror` | Restore the source graph one-to-one: keep source Master/Layout identities and parentage, slide assignments, placeholder type/index/bounds, and supported visual/native-object facts. Preserve the expanded lossless representation required for supported native-object round trips. Mechanical normalization maps fixed-layer source groups into the direct atoms required by the current explicit SVG contract while preserving ownership, paint order, and appearance; it must not semantically redesign the graph. |
+| `mirror` | Restore the source graph one-to-one: keep source Master/Layout identities and parentage, slide assignments, placeholder type/index/bounds, and supported visual/native-object facts. Edit the authoring IR; materialization may rehydrate converter-supported native payload only for unchanged source refs. Mechanical normalization maps fixed-layer source groups into the direct atoms required by the current explicit SVG contract while preserving ownership, paint order, and appearance; it must not semantically redesign the graph. |
Every page remains a complete standalone SVG preview.
@@ -98,7 +98,7 @@ The output page set is determined by **replication mode**, declared in the final
|------|-------------|--------|
| `standard` (default) | Most templates — clean, reusable, balanced coverage | `01_cover`, `02_chapter`, `03_content`, `04_ending`; with the optional TOC the roster is `01_cover`, `02_toc`, `03_chapter`, `04_content`, `05_ending` |
| `fidelity` | User wants a broader, source-aligned but newly designed template | Standard roster + intentionally designed variants that cover useful reference compositions |
-| `mirror` | User wants the source template restored | One SVG prototype restored from the lossless source per source slide, named `<NNN>_<page_type>.svg` by source order |
+| `mirror` | User wants the source template restored | One SVG prototype materialized from the authoring IR per source slide, named `<NNN>_<page_type>.svg` by source order |
**Hard rule — mode controls authorship**: `standard` and `fidelity` create new SVG documents and their own Master/Layout system. `mirror` restores the imported source contract and must not reauthor, distill, or reinterpret its structure.
@@ -143,7 +143,7 @@ Extension page types beyond the canonical four (transition / appendix / disclaim
When the brief sets `Replication mode: mirror`, restore the imported template rather than designing a new one:
-- Restoration source: lossless `svg/master_*.svg`, `svg/layout_*.svg`, `svg/slide_NN.svg`, `svg-flat/slide_NN.svg`, `svg/inheritance.json`, and `native_structure.json`. Use matching lightweight projections only to inspect the result without loading opaque payload into model context.
+- Authoring source: layered `authoring-svg/*.svg` plus `authoring-svg/authoring_manifest.json`, `svg/inheritance.json`, and `native_structure.json`. Use `authoring-svg-flat/` for full-page verification. Matching lossless `svg/` / `svg-flat/` files are immutable native-payload backing and are resolved only during materialization.
- Precondition: the import evidence identifies every source Master/Layout, parent relationship, picker name, placeholder contract, and fixed visual layer. Stop only when required facts or supported geometry are missing; unused identities are not a stop condition.
- Output: `<template_workspace>/templates/<NNN>_<page_type>.svg` for every source slide, plus `layout_<layout_key>.svg` for every source Layout unused by all source slides. `<NNN>` is the zero-padded source slide index (3 digits) and `<page_type>` is derived from `manifest.json` `pageTypeCandidates` — `cover` / `toc` / `chapter` / `content` / `ending`. When the page-type heuristic is ambiguous, fall back to `content`. Preserve source slide order via the numeric prefix; definition-only files are not generated pages.
- Required restoration: preserve source Master/Layout keys and picker names, Layout-to-Master parentage, slide assignments, placeholder type/index/bounds, supported native-object metadata, geometry, decoration, sprite-sheet wrappers, original example text, chart previews, fonts, effects, and paint order whenever the importer represents them.
@@ -268,9 +268,9 @@ If PPTX import output exists:
**Precondition**:
-- For `standard`, inspect enough lightweight complete-page projections to understand the requested visual direction and reusable assets; do not analyze source topology.
-- For `fidelity`, inspect every lightweight complete-page projection so the newly designed roster covers the useful source composition range; do not derive output ownership from source Master/Layout recurrence.
-- For `mirror`, verify every projected Master, Layout, and Slide against `native_structure.json` and `svg/inheritance.json`, then restore from the matching lossless files. Before restoration begins, report the verified source slide indexes.
+- For `standard`, inspect enough lightweight complete-page IR documents to understand the requested visual direction and reusable assets; do not analyze source topology.
+- For `fidelity`, inspect every lightweight complete-page IR document so the newly designed roster covers the useful source composition range; do not derive output ownership from source Master/Layout recurrence.
+- For `mirror`, verify every authoring Master, Layout, and Slide plus its manifest record against `native_structure.json` and `svg/inheritance.json`, then materialize from the IR with matching lossless payload backing. Before restoration begins, report the verified source slide indexes.
### 2.1 PPTX Import Mode Rule
@@ -289,18 +289,19 @@ produce direct atoms with the same ownership, transforms, paint order, and
appearance. A maintainability preference is not authority to alter the source
template.
-### 2.2 Native Shape Payload and Authoring Projection
+### 2.2 Native Shape Payload and Authoring IR
| Representation | Purpose | Payload rule |
|---|---|---|
-| Lossless import SVG | Round-trip and mirror-restoration source | Retain complete imported metadata, native object boundaries, hidden carriers, and source-scope identity. It is authoritative for mirror restoration. |
-| Lightweight authoring projection | Model-readable inspection surface | Omit opaque native payload and duplicate hidden carriers from model context; retain visible shape intent and logical ids needed to locate an adopted object in the lossless import |
+| Lossless import SVG | Native-payload backing | Retain complete imported metadata, native object boundaries, hidden carriers, and source-scope identity. Keep it immutable and resolve it only through validated source refs. |
+| Authoring IR bundle | Editable template-creation source | Omit opaque native payload and duplicate hidden carriers from model context; retain visible shape intent and stable document-local source refs. `authoring_manifest.json` records source paths and initial hashes without duplicating payload. |
| `standard` / `fidelity` output | Newly authored contract | Use `preset_shape_svg.py` compact canonical `<g>` output for exact preset matches, with paint from the confirmed brief / `design_spec.md`; use ordinary project SVG for other geometry. Reuse exported image/vector assets, not opaque source shape payload or source topology. |
-| `mirror` output | Restored contract | Keep the expanded lossless representation and currently supported imported metadata on unchanged Slide-local/slot objects. Normalize fixed structural layers into semantic atoms from the lossless source. The projection never becomes the restoration source. |
+| `mirror` output | Materialized restored contract | Preserve currently supported imported metadata on unchanged Slide-local/slot refs, use the edited SVG fallback otherwise, and normalize fixed structural layers into semantic atoms. Strip IR-only source refs from final templates. |
-**Validation**: Mirror does not silently use stale metadata or a lightweight
-projection. If an imported object cannot use the converter's supported native
-metadata after normalization, keep its current SVG fallback and report the
+**Validation**: Mirror does not silently use stale metadata. Materialization
+validates source-document hashes and each referenced object's initial authoring
+hash before reusing native payload. If an imported object cannot use the
+converter's supported native metadata after normalization, keep its current SVG fallback and report the
limitation. For exact registered preset matches, `standard` / `fidelity`
regenerate the compact helper group instead of transplanting opaque source
payload; other geometry stays ordinary project SVG. `data-pptx-replace-with` remains
@@ -479,7 +480,7 @@ Mirror mode emits one SVG per source slide, named by source order:
└── 050_ending.svg
```
-Filenames preserve the source slide order via the 3-digit prefix; `<page_type>` is derived from `manifest.json` `pageTypeCandidates`. Literal source text and the source native structure are restored; the lightweight projection is not copied into the output.
+Filenames preserve the source slide order via the 3-digit prefix; `<page_type>` is derived from `manifest.json` `pageTypeCandidates`. Literal source text and the source native structure are restored by materializing the authoring IR; IR-only refs and its manifest are not copied into the template output.
**Hard rule — common routing**: Keep `design_spec.md`, template SVGs, and non-bitmap template-source assets in `templates/`; place every bitmap in `images/`; place each imported vector exactly once in `icons/imported/` and reference it as `data-icon="imported/<name>"`. Never create `templates/icons/`. Write a review deck to `exports/` only when explicitly requested. Create optional directories only when they contain real files; never add placeholders for empty directories. Do not branch asset placement by output scope.
@@ -534,11 +535,11 @@ templates/
- [x] Every page listed in `design_spec.md §V Page Roster` saved to `<template_workspace>/templates/`
- [x] Naming convention applied (standard / fidelity: letter-suffix variants; mirror: `<NNN>_<page_type>.svg`)
- [x] Templates follow design spec (colors, fonts, layout)
-- [x] `standard` / `fidelity` SVGs and Master/Layout contracts were newly authored; `mirror` SVGs restore the lossless source graph without semantic redesign
+- [x] `standard` / `fidelity` SVGs and Master/Layout contracts were newly authored; `mirror` SVGs were materialized from the authoring IR while preserving the source graph without semantic redesign
- [x] Placeholder markers are clear and standardized for `standard` / `fidelity`; mirror preserves literal source text plus source placeholder type/index/bounds
- [x] Every SVG is a complete preview with explicit root Master/Layout identity and `native_structure_mode: structured`; authored modes use canonical fixed layers/slots, while mirror preserves source ownership and mechanically expands fixed-layer groups into direct atoms
- [x] Authored `standard` / `fidelity` Layout keys are non-duplicative; mirror keeps distinct source Layout identities even when their current visible contracts are equivalent
-- [x] Model context used lightweight projections; lossless expanded imports remained authoritative for mirror restoration, while `standard` / `fidelity` used helper-generated compact canonical preset groups and `design_spec.md` paint
+- [x] Template creation used the authoring IR; lossless expanded imports remained immutable payload backing for mirror materialization, while `standard` / `fidelity` used helper-generated compact canonical preset groups and `design_spec.md` paint
- [x] Both scopes route bitmaps to `images/` and keep one canonical copy of every imported vector under `icons/imported/`
- [ ] **Next step**: Validate assets, optionally export a review PPTX, then register only library scope
```
diff --git a/skills/ppt-master/scripts/README.md b/skills/ppt-master/scripts/README.md
index a64cd4b4..1c1928a2 100644
--- a/skills/ppt-master/scripts/README.md
+++ b/skills/ppt-master/scripts/README.md
@@ -81,22 +81,23 @@ Template source import:
python3 scripts/pptx_template_import.py <template.pptx>
python3 scripts/pptx_template_import.py <template.pptx> --manifest-only
python3 scripts/pptx_template_import.py <template.pptx> --inheritance-mode both
-python3 scripts/svg_authoring_view.py <imported-svg-or-dir> -o <output-dir>
+python3 scripts/svg_authoring_view.py <imported-svg-or-dir> -o <output-dir> --projection-kind layered
python3 scripts/template_preview_pptx.py <template_workspace>
python3 scripts/template_preview_pptx.py <legacy_template_workspace> --visual-only
```
-`svg_authoring_view.py` creates a lightweight, non-destructive inspection copy
-of PPTX-imported SVGs. It removes embedded `txbody` payloads,
+`svg_authoring_view.py` creates a lightweight, non-destructive editable IR
+bundle from PPTX-imported SVGs. It removes embedded `txbody` payloads,
duplicate hidden geometry carriers, and import-identity attributes from the
copy while retaining visible fallback geometry, text, images, stable element
-ids, root Master/Layout markers, and selected native-shape intent for
-inspection.
+ids, root Master/Layout markers, selected native-shape intent, and
+document-local `data-pptx-source-ref` values.
Relative local image references are rewritten so the projected copy still
-renders from its new location. The full imported SVG remains unchanged and is
-the evidence source for mirror restoration; the projection is inspection-only.
-The exporter never reads the import workspace or the projection. A projected
-view is not a final template or release export source.
+renders from its new location. The bundle's `authoring_manifest.json` records
+source/authoring hashes and object paths without duplicating opaque payload.
+The full imported SVG remains unchanged as native-payload backing. Template
+creation edits the IR and materializes validated `templates/*.svg`; the IR
+directory itself is not a final template or direct release export source.
`template_preview_pptx.py` reads a template workspace, exports every `templates/*.svg` prototype as one structured review slide, and verifies the resulting Master/Layout package. This is an on-demand review action: its default output is `exports/<template_id>_template_preview.pptx`, and that directory need not exist before the command runs. It refuses an existing output unless an intentional re-export passes `--force`. `--visual-only` is an explicit migration aid for legacy SVG rosters: it creates a slide-local visual review deck without validating or claiming a reusable Master/Layout contract. This diagnostic path does not require a project `spec_lock.md`; it may retain generic theme/text defaults inside its clean one-Master/one-Layout shell. New structured templates use the default mode when a review deck is requested.
@@ -160,6 +161,8 @@ the flat view with `--reuse-inventory`; matching flat subtrees reference the
existing layered asset instead of creating a duplicate file. Only unmatched
flat-only vectors create new assets. Create-template stores these assets once in
`<workspace>/icons/imported/` and writes `data-icon="imported/<name>"` references.
+Inventories retain any `data-pptx-source-ref` values carried by the extracted
+subtree, so re-inlining preserves authoring-manifest object identity.
Rerunning a namespaced pass against an already rewritten projection inventories
the existing references without progressively wrapping more parent geometry.
diff --git a/skills/ppt-master/scripts/docs/svg-pipeline.md b/skills/ppt-master/scripts/docs/svg-pipeline.md
index 6bb88fe3..8e41b198 100644
--- a/skills/ppt-master/scripts/docs/svg-pipeline.md
+++ b/skills/ppt-master/scripts/docs/svg-pipeline.md
@@ -8,16 +8,19 @@ The supported delivery contract has one PPTX path: `svg_output/` → the project
## `svg_authoring_view.py`
-Create a lightweight inspection/authoring projection of one PPTX-imported SVG
-or a directory of imported SVGs:
+Create a lightweight editable authoring IR bundle from one PPTX-imported SVG or
+a directory of imported SVGs:
```bash
-python3 scripts/svg_authoring_view.py <svg-file-or-directory> -o <output-dir>
+python3 scripts/svg_authoring_view.py <svg-file-or-directory> -o <output-dir> \
+ --projection-kind layered
```
The operation is non-destructive and refuses existing output files unless
`--force` is explicit. It never writes back to the source SVG. The JSON report
-on stdout records original/projected byte counts and removals by category.
+on stdout records original/projected byte counts and removals by category. The
+output directory contains the editable SVGs and one atomic
+`authoring_manifest.json` sidecar.
The projected copy:
@@ -27,14 +30,16 @@ The projected copy:
- removes source-object identity/style/hash attributes that are only useful to
an exact import round trip;
- keeps visible paths, text, images, stable ids, Master/Layout root markers,
- and selected native-shape intent useful for inspection; and
+ selected native-shape intent, and a document-local `data-pptx-source-ref` on
+ each imported logical object;
- rewrites relative local asset references for the projection's new location.
-The complete imported SVG remains the evidence source for mirror restoration.
-The exporter does not read the import workspace or the projection. The
-projection is deliberately not a template generator, not a replacement for
-the explicit Master/Layout restoration workflow, and not a supported release
-input to `svg_to_pptx.py`.
+The manifest stores relative source/authoring filenames, source and initial
+authoring hashes, and source element paths. It deliberately does not copy the
+opaque payload. The authoring bundle is the editable source for template
+creation; the complete imported SVG remains immutable native-payload backing.
+Final `templates/*.svg` files are materialized and validated from that pair.
+The IR directory itself is not a supported direct input to `svg_to_pptx.py`.
This projection is separate from canonical preset authoring. New project SVGs
and project-owned templates use the compact authored form: one atomic
@@ -50,7 +55,7 @@ authoring guidance in
## `extract_svg_assets.py`
-Factor large vector subtrees out of lightweight authoring projections and
+Factor large vector subtrees out of lightweight authoring IR documents and
replace them with compact `<use data-icon>` references:
```bash
@@ -69,7 +74,9 @@ writes no duplicate SVG file. Unmatched flat-only subtrees still extract
normally. Use `--clean-stale` on both import-workspace passes to remove stale
generated files for their respective prefixes. In create-template workspaces,
`imported` is the fixed namespace: assets live once under `icons/imported/`, and
-the working SVGs reference them as `data-icon="imported/<name>"`. A rerun on an
+the working SVGs reference them as `data-icon="imported/<name>"`. Inventory
+entries retain source refs from each extracted subtree, allowing expansion to
+restore the authoring-manifest mapping. A rerun on an
already rewritten namespaced projection inventories those references and does
not progressively extract their remaining parent or sibling geometry.
diff --git a/skills/ppt-master/scripts/extract_svg_assets.py b/skills/ppt-master/scripts/extract_svg_assets.py
index 35a36125..64c38d9f 100644
--- a/skills/ppt-master/scripts/extract_svg_assets.py
+++ b/skills/ppt-master/scripts/extract_svg_assets.py
@@ -17,12 +17,12 @@ Usage:
python3 scripts/extract_svg_assets.py <svg_dir> [options]
Examples:
- python3 scripts/extract_svg_assets.py import_ws/svg \
+ python3 scripts/extract_svg_assets.py import_ws/authoring-svg \
--icons-dir import_ws/icons --icon-namespace imported \
--inplace --id-prefix layered --clean-stale
- python3 scripts/extract_svg_assets.py import_ws/svg-flat \
+ python3 scripts/extract_svg_assets.py import_ws/authoring-svg-flat \
--icons-dir import_ws/icons --icon-namespace imported \
- --reuse-inventory import_ws/svg_vector_asset_inventory.json \
+ --reuse-inventory import_ws/authoring-svg_vector_asset_inventory.json \
--inplace --id-prefix flat --clean-stale
python3 scripts/extract_svg_assets.py project/svg_output --inplace --min-drawables 40
@@ -54,6 +54,7 @@ SEMANTIC_CONTENT = {"text", "tspan", "foreignObject"}
DEFAULT_MIN_DRAWABLES = 20
DEFAULT_MIN_BYTES = 3000
DEFAULT_MIN_DECORATION_BYTES = 3000
+SOURCE_REF_ATTRIBUTE = "data-pptx-source-ref"
ICON_NAMESPACE_RE = re.compile(r"^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?$")
URL_REF_RE = re.compile(r"url\(\s*(['\"]?)#([^)'\"]\S*?)\1\s*\)")
@@ -67,7 +68,12 @@ def _drawable_count(elem: ET.Element) -> int:
def _xml_size(elem: ET.Element) -> int:
- return len(ET.tostring(elem, encoding="utf-8"))
+ if not any(item.get(SOURCE_REF_ATTRIBUTE) for item in elem.iter()):
+ return len(ET.tostring(elem, encoding="utf-8"))
+ measured = copy.deepcopy(elem)
+ for item in measured.iter():
+ item.attrib.pop(SOURCE_REF_ATTRIBUTE, None)
+ return len(ET.tostring(measured, encoding="utf-8"))
def _large_enough(elem: ET.Element, min_drawables: int, min_bytes: int) -> bool:
@@ -111,6 +117,14 @@ def _tag_histogram(elem: ET.Element) -> dict[str, int]:
return hist
+def _source_references(elem: ET.Element) -> list[str]:
+ return sorted({
+ source_ref
+ for item in elem.iter()
+ if (source_ref := item.get(SOURCE_REF_ATTRIBUTE))
+ })
+
+
def _is_descendant(container: ET.Element, candidate: ET.Element) -> bool:
return any(elem is candidate for elem in container.iter())
@@ -437,6 +451,7 @@ def _existing_placeholder_entries(
entry["drawable_count"] = _drawable_count(root)
entry["byte_count"] = _xml_size(root)
entry["elements"] = _tag_histogram(root)
+ entry["source_refs"] = _source_references(root)
entry["dependencies"] = sorted(
elem_id
for elem in root.iter()
@@ -592,6 +607,7 @@ def extract_file(
if (elem_id := elem.get("id"))
})
source_sha256 = _source_sha256(group, dependencies, view_box, width, height)
+ source_refs = _source_references(group)
reusable = (reusable_assets or {}).get(source_sha256)
if reusable is not None:
reused_icon = str(reusable["icon"])
@@ -613,6 +629,7 @@ def extract_file(
"reused_from_svg": reusable.get("svg"),
"drawable_count": _drawable_count(group),
"byte_count": _xml_size(group),
+ "source_refs": source_refs,
"dependencies": dependency_source_ids,
"elements": _tag_histogram(group),
})
@@ -644,6 +661,7 @@ def extract_file(
"asset_sha256": hashlib.sha256(asset_bytes).hexdigest(),
"drawable_count": _drawable_count(group),
"byte_count": _xml_size(group),
+ "source_refs": source_refs,
"dependencies": [id_mapping.get(elem_id, elem_id) for elem_id in dependency_source_ids],
"elements": _tag_histogram(group),
})
diff --git a/skills/ppt-master/scripts/svg_authoring_view.py b/skills/ppt-master/scripts/svg_authoring_view.py
index c3030963..f764ee6d 100644
--- a/skills/ppt-master/scripts/svg_authoring_view.py
+++ b/skills/ppt-master/scripts/svg_authoring_view.py
@@ -2,23 +2,27 @@
"""
PPT Master - SVG Authoring View
-Create a lightweight, non-destructive view of PPTX-imported SVG files for
-human or model inspection. The source SVG remains the round-trip authority;
-the output copy keeps visible SVG content and compact shape intent while
-hiding bulky import-only payloads and duplicate hidden geometry carriers.
+Create a lightweight, non-destructive editable IR from PPTX-imported SVG
+files. The source SVG remains the native-payload authority; the authoring copy
+keeps visible SVG content, compact shape intent, and stable source references
+while hiding bulky import-only payloads and duplicate hidden geometry carriers.
Usage:
- python3 scripts/svg_authoring_view.py <svg-file-or-directory> -o <output-dir>
+ python3 scripts/svg_authoring_view.py <svg-file-or-directory> \
+ -o <output-dir> --projection-kind <kind>
Examples:
- python3 scripts/svg_authoring_view.py analysis/source_svg_import/svg-flat -o analysis/authoring-svg
- python3 scripts/svg_authoring_view.py imported/slide_06.svg -o /tmp/slide-authoring-view
+ python3 scripts/svg_authoring_view.py analysis/source_svg_import/svg \
+ -o analysis/authoring-svg --projection-kind layered
+ python3 scripts/svg_authoring_view.py imported/slide_06.svg \
+ -o /tmp/slide-authoring-view --projection-kind generic
Dependencies:
None (standard library only).
-This tool produces an inspection/authoring projection, not a final template or
-release export source. Keep the complete imported SVG for native restoration.
+The output directory is an authoring bundle: editable SVGs plus one
+`authoring_manifest.json` provenance sidecar. It is the template-creation input,
+not a release SVG directory; final templates are materialized from this IR.
Directory runs prepare and stage the complete batch before publishing it, so a
failed page leaves the existing destination set unchanged.
"""
@@ -26,6 +30,7 @@ failed page leaves the existing destination set unchanged.
from __future__ import annotations
import argparse
+import hashlib
import json
import os
import shutil
@@ -44,6 +49,9 @@ configure_utf8_stdio()
SVG_NS = "http://www.w3.org/2000/svg"
XLINK_NS = "http://www.w3.org/1999/xlink"
+AUTHORING_MANIFEST_NAME = "authoring_manifest.json"
+AUTHORING_SCHEMA = "ppt-master.svg-authoring-ir.v1"
+SOURCE_REF_ATTRIBUTE = "data-pptx-source-ref"
ET.register_namespace("", SVG_NS)
ET.register_namespace("xlink", XLINK_NS)
@@ -62,13 +70,161 @@ IMPORT_SOURCE_ATTRIBUTES = {
# Compact native-shape intent is intentionally not in the removal set:
# data-pptx-object, data-pptx-prst, and data-pptx-frame remain useful while
# reviewing the visible fallback. Structural markers also pass through
-# unchanged; this projection never defines restoration policy.
+# unchanged; the IR records identity but never decides payload-restoration
+# policy.
def _local_name(name: object) -> str:
return name.rsplit("}", 1)[-1] if isinstance(name, str) else ""
+@dataclass
+class SourceReference:
+ source_ref: str
+ source_path: tuple[int, ...]
+ initial_authoring_subtree_sha256: str | None = None
+
+ def as_dict(self) -> dict[str, object]:
+ return {
+ "source_path": list(self.source_path),
+ "initial_authoring_subtree_sha256": self.initial_authoring_subtree_sha256,
+ }
+
+
+def _semantic_text(value: str | None) -> str | None:
+ if value is None or not value.strip():
+ return None
+ return value
+
+
+def _stable_tag_name(tag: object) -> str:
+ if isinstance(tag, str):
+ return tag
+ if tag is ET.Comment:
+ return "#comment"
+ if tag is ET.ProcessingInstruction:
+ return "#processing-instruction"
+ raise ValueError(f"Unsupported XML node type in source object: {tag!r}")
+
+
+def _subtree_sha256(
+ element: ET.Element,
+ *,
+ ignored_attributes: frozenset[str] = frozenset(),
+) -> str:
+ """Hash parsed SVG semantics without attribute order or indentation noise."""
+ digest = hashlib.sha256()
+
+ def visit(item: ET.Element) -> None:
+ digest.update(_stable_tag_name(item.tag).encode("utf-8"))
+ for name, value in sorted(item.attrib.items()):
+ if name in ignored_attributes:
+ continue
+ digest.update(b"\0a")
+ digest.update(name.encode("utf-8"))
+ digest.update(b"\0")
+ digest.update(value.encode("utf-8"))
+ text = _semantic_text(item.text)
+ if text is not None:
+ digest.update(b"\0t")
+ digest.update(text.encode("utf-8"))
+ for child in item:
+ digest.update(b"\0c")
+ visit(child)
+ tail = _semantic_text(child.tail)
+ if tail is not None:
+ digest.update(b"\0l")
+ digest.update(tail.encode("utf-8"))
+ digest.update(b"\0e")
+
+ visit(element)
+ return digest.hexdigest()
+
+
+def _iter_element_paths(
+ root: ET.Element,
+) -> list[tuple[tuple[int, ...], ET.Element]]:
+ indexed: list[tuple[tuple[int, ...], ET.Element]] = []
+
+ def walk(element: ET.Element, path: tuple[int, ...]) -> None:
+ indexed.append((path, element))
+ for index, child in enumerate(element):
+ walk(child, (*path, index))
+
+ walk(root, ())
+ return indexed
+
+
+def _source_reference(element: ET.Element) -> str | None:
+ if not element.get("id") or not element.get("data-pptx-object"):
+ return None
+ scope = element.get("data-pptx-shape-scope")
+ shape_id = element.get("data-pptx-shape-id")
+ if not scope or not shape_id:
+ return None
+ return f"{scope}:{shape_id}"
+
+
+def _stamp_source_references(root: ET.Element) -> list[SourceReference]:
+ existing = [
+ element
+ for _, element in _iter_element_paths(root)
+ if element.get(SOURCE_REF_ATTRIBUTE) is not None
+ ]
+ if existing:
+ raise ValueError(
+ f"Input already contains reserved {SOURCE_REF_ATTRIBUTE}; "
+ "project from the lossless import SVG instead"
+ )
+
+ references: list[SourceReference] = []
+ seen: set[str] = set()
+ for path, element in _iter_element_paths(root):
+ source_ref = _source_reference(element)
+ if source_ref is None:
+ continue
+ if source_ref in seen:
+ raise ValueError(f"Duplicate source object identity: {source_ref}")
+ seen.add(source_ref)
+ references.append(
+ SourceReference(
+ source_ref=source_ref,
+ source_path=path,
+ )
+ )
+ element.set(SOURCE_REF_ATTRIBUTE, source_ref)
+ return references
+
+
+def _index_initial_authoring_references(
+ root: ET.Element,
+ references: list[SourceReference],
+) -> None:
+ by_ref = {reference.source_ref: reference for reference in references}
+ seen: set[str] = set()
+ for element in root.iter():
+ source_ref = element.get(SOURCE_REF_ATTRIBUTE)
+ if source_ref is None:
+ continue
+ if source_ref in seen:
+ raise ValueError(f"Duplicate authoring source reference: {source_ref}")
+ reference = by_ref.get(source_ref)
+ if reference is None:
+ raise ValueError(f"Unknown authoring source reference: {source_ref}")
+ seen.add(source_ref)
+ reference.initial_authoring_subtree_sha256 = _subtree_sha256(
+ element,
+ ignored_attributes=frozenset({SOURCE_REF_ATTRIBUTE}),
+ )
+
+ missing = sorted(set(by_ref) - seen)
+ if missing:
+ raise ValueError(
+ "Authoring projection dropped source-referenced object(s): "
+ + ", ".join(missing[:5])
+ )
+
+
@dataclass
class ProjectionStats:
txbody_metadata: int = 0
@@ -104,6 +260,9 @@ class ProjectionReport:
original_bytes: int
projected_bytes: int
stats: ProjectionStats
+ source_sha256: str
+ initial_authoring_sha256: str
+ source_references: list[SourceReference]
def as_dict(self) -> dict[str, object]:
saved = self.original_bytes - self.projected_bytes
@@ -115,6 +274,9 @@ class ProjectionReport:
"projected_bytes": self.projected_bytes,
"bytes_saved": saved,
"reduction_percent": round(reduction, 2),
+ "source_sha256": self.source_sha256,
+ "initial_authoring_sha256": self.initial_authoring_sha256,
+ "source_ref_count": len(self.source_references),
"removed": self.stats.as_dict(),
}
@@ -251,10 +413,12 @@ def _render_projection(source: Path, output: Path) -> tuple[ProjectionReport, by
if _local_name(root.tag) != "svg":
raise ValueError(f"Root element is not <svg>: {source}")
+ source_references = _stamp_source_references(root)
stats = ProjectionStats()
_project_subtree(root, stats)
_strip_import_attributes(root, stats)
_rewrite_asset_references(root, source.parent, output.parent, stats)
+ _index_initial_authoring_references(root, source_references)
projected = ET.tostring(root, encoding="utf-8", xml_declaration=False)
if not projected.endswith(b"\n"):
@@ -266,31 +430,55 @@ def _render_projection(source: Path, output: Path) -> tuple[ProjectionReport, by
original_bytes=len(original),
projected_bytes=len(projected),
stats=stats,
+ source_sha256=hashlib.sha256(original).hexdigest(),
+ initial_authoring_sha256=hashlib.sha256(projected).hexdigest(),
+ source_references=source_references,
)
return report, projected
-def project_svg(source: Path, output: Path) -> ProjectionReport:
- """Write one lightweight authoring projection without changing the source."""
- report, projected = _render_projection(source, output)
- output.parent.mkdir(parents=True, exist_ok=True)
-
- temporary: Path | None = None
+def _portable_path(path: Path, base: Path) -> str:
try:
- with tempfile.NamedTemporaryFile(
- mode="wb",
- prefix=f".{output.name}.",
- suffix=".tmp",
- dir=output.parent,
- delete=False,
- ) as stream:
- temporary = Path(stream.name)
- stream.write(projected)
- temporary.replace(output)
- finally:
- if temporary is not None:
- temporary.unlink(missing_ok=True)
- return report
+ return os.path.relpath(path, base).replace(os.sep, "/")
+ except ValueError:
+ return path.resolve().as_uri()
+
+
+def _authoring_manifest_bytes(
+ reports: list[ProjectionReport],
+ source_root: Path,
+ output_dir: Path,
+ projection_kind: str,
+) -> bytes:
+ documents = []
+ for report in sorted(reports, key=lambda item: item.output.as_posix()):
+ documents.append({
+ "source": report.source.relative_to(source_root).as_posix(),
+ "authoring": report.output.relative_to(output_dir).as_posix(),
+ "source_sha256": report.source_sha256,
+ "initial_authoring_sha256": report.initial_authoring_sha256,
+ "source_refs": {
+ reference.source_ref: reference.as_dict()
+ for reference in sorted(
+ report.source_references,
+ key=lambda item: item.source_ref,
+ )
+ },
+ })
+
+ payload = {
+ "schema": AUTHORING_SCHEMA,
+ "projection_kind": projection_kind,
+ "source_root": _portable_path(source_root, output_dir),
+ "authoring_root": ".",
+ "source_ref_attribute": SOURCE_REF_ATTRIBUTE,
+ "file_count": len(documents),
+ "source_ref_count": sum(len(report.source_references) for report in reports),
+ "documents": documents,
+ }
+ return (
+ json.dumps(payload, ensure_ascii=False, indent=2) + "\n"
+ ).encode("utf-8")
def _nearest_existing_directory(path: Path) -> Path:
@@ -354,7 +542,7 @@ def _rollback_published_files(
def _publish_existing_directory(
- staged: list[tuple[ProjectionReport, Path]],
+ staged: list[tuple[Path, Path]],
staging_root: Path,
*,
force: bool,
@@ -362,8 +550,7 @@ def _publish_existing_directory(
backup_root = staging_root / "previous"
backups: dict[Path, Path | None] = {}
- for index, (report, _) in enumerate(staged):
- target = report.output
+ for index, (target, _) in enumerate(staged):
if not os.path.lexists(target):
backups[target] = None
continue
@@ -372,7 +559,7 @@ def _publish_existing_directory(
if target.is_dir() and not target.is_symlink():
raise IsADirectoryError(f"Output target is a directory: {target}")
- backup = backup_root / f"{index:06d}.svg"
+ backup = backup_root / f"{index:06d}.bak"
backup.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(target, backup, follow_symlinks=False)
backups[target] = backup
@@ -380,22 +567,21 @@ def _publish_existing_directory(
created: list[Path] = []
published: list[tuple[Path, Path | None]] = []
try:
- for report, _ in staged:
- _ensure_directory(report.output.parent, created)
+ for target, _ in staged:
+ _ensure_directory(target.parent, created)
staging_device = staging_root.stat().st_dev
- for report, _ in staged:
- if report.output.parent.stat().st_dev != staging_device:
+ for target, _ in staged:
+ if target.parent.stat().st_dev != staging_device:
raise OSError(
- f"Cannot atomically publish across filesystems: {report.output}"
+ f"Cannot atomically publish across filesystems: {target}"
)
- if backups[report.output] is None and os.path.lexists(report.output):
+ if backups[target] is None and os.path.lexists(target):
raise FileExistsError(
- f"Output appeared while projections were staged: {report.output}"
+ f"Output appeared while projections were staged: {target}"
)
- for report, staged_file in staged:
- target = report.output
+ for target, staged_file in staged:
staged_file.replace(target)
published.append((target, backups[target]))
except OSError as exc:
@@ -410,11 +596,13 @@ def _publish_existing_directory(
def project_svg_batch(
mapping: list[tuple[Path, Path]],
+ source_root: Path,
output_dir: Path,
*,
force: bool,
+ projection_kind: str,
) -> list[ProjectionReport]:
- """Project and publish a directory mapping as one recoverable transaction."""
+ """Build and publish one complete authoring bundle transactionally."""
rendered = [_render_projection(source, output) for source, output in mapping]
staging_parent = _nearest_existing_directory(output_dir.parent)
@@ -424,14 +612,26 @@ def project_svg_batch(
) as temporary:
staging_root = Path(temporary)
new_root = staging_root / "projected"
- staged: list[tuple[ProjectionReport, Path]] = []
+ staged: list[tuple[Path, Path]] = []
for report, projected in rendered:
relative = report.output.relative_to(output_dir)
staged_file = new_root / relative
staged_file.parent.mkdir(parents=True, exist_ok=True)
staged_file.write_bytes(projected)
- staged.append((report, staged_file))
+ staged.append((report.output, staged_file))
+
+ manifest_path = output_dir / AUTHORING_MANIFEST_NAME
+ staged_manifest = new_root / AUTHORING_MANIFEST_NAME
+ staged_manifest.write_bytes(
+ _authoring_manifest_bytes(
+ [report for report, _ in rendered],
+ source_root,
+ output_dir,
+ projection_kind,
+ )
+ )
+ staged.append((manifest_path, staged_manifest))
if not output_dir.exists():
created: list[Path] = []
@@ -490,7 +690,7 @@ def _source_mapping(input_path: Path, output_dir: Path) -> list[tuple[Path, Path
def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
description=(
- "Create lightweight, non-destructive authoring views of PPTX-imported SVG files."
+ "Create lightweight editable IR bundles from PPTX-imported SVG files."
),
formatter_class=argparse.RawDescriptionHelpFormatter,
)
@@ -505,7 +705,16 @@ def build_parser() -> argparse.ArgumentParser:
parser.add_argument(
"--force",
action="store_true",
- help="Replace projected files that already exist (never changes source files)",
+ help=(
+ "Replace authoring files/manifest that already exist "
+ "(never changes source files)"
+ ),
+ )
+ parser.add_argument(
+ "--projection-kind",
+ choices=("layered", "flat", "generic"),
+ default="generic",
+ help="Record the IR representation kind in authoring_manifest.json",
)
return parser
@@ -537,9 +746,13 @@ def main(argv: Optional[list[str]] = None) -> int:
return 1
collisions = [target for _, target in mapping if os.path.lexists(target)]
+ manifest_path = output_dir / AUTHORING_MANIFEST_NAME
+ if os.path.lexists(manifest_path):
+ collisions.append(manifest_path)
if collisions and not args.force:
print(
- f"Error: {len(collisions)} output file(s) already exist; use --force to replace projections. "
+ f"Error: {len(collisions)} output file(s) already exist; "
+ "use --force to replace the authoring bundle. "
f"First collision: {collisions[0]}",
file=sys.stderr,
)
@@ -547,15 +760,14 @@ def main(argv: Optional[list[str]] = None) -> int:
reports: list[ProjectionReport] = []
try:
- if input_path.is_file():
- source, output = mapping[0]
- reports.append(project_svg(source, output))
- else:
- reports = project_svg_batch(
- mapping,
- output_dir,
- force=args.force,
- )
+ source_root = input_path if input_path.is_dir() else input_path.parent
+ reports = project_svg_batch(
+ mapping,
+ source_root,
+ output_dir,
+ force=args.force,
+ projection_kind=args.projection_kind,
+ )
except (ET.ParseError, OSError, RuntimeError, ValueError) as exc:
print(f"Error: {exc}", file=sys.stderr)
return 1
@@ -573,6 +785,8 @@ def main(argv: Optional[list[str]] = None) -> int:
result = {
"input": str(input_path),
"output_dir": str(output_dir),
+ "manifest": str(output_dir / AUTHORING_MANIFEST_NAME),
+ "projection_kind": args.projection_kind,
"file_count": len(reports),
"files": [report.as_dict() for report in reports],
"totals": {
diff --git a/skills/ppt-master/workflows/create-template.md b/skills/ppt-master/workflows/create-template.md
index 1b08f88e..b532a8c2 100644
--- a/skills/ppt-master/workflows/create-template.md
+++ b/skills/ppt-master/workflows/create-template.md
@@ -78,7 +78,7 @@ Branch by the type of reference source the user supplied. This step produces ana
| Type | What the user supplied | Tool / read path | Replication modes available |
|------|-------------------------|------------------|------------------------------|
| **A** `.pptx` reference | A `.pptx` file path | `pptx_template_import.py` → `manifest.json` + `native_structure.json` + `source_template.pptx` + layered/flat SVGs + `assets/` | `standard` / `fidelity` / `mirror` |
-| **B** Existing SVG assets | `projects/<x>/svg_output/`, a current template workspace root, a legacy flat template root, or a loose `.svg` folder | Normalize the source directory, create a lightweight projection with `svg_authoring_view.py`, then read projected page SVGs; also read companion `design_spec.md` / `spec_lock.md` when present | `standard` / `fidelity`; `mirror` only when the source already carries a complete explicit Master/Layout/placeholder/native-object contract |
+| **B** Existing SVG assets | `projects/<x>/svg_output/`, a current template workspace root, a legacy flat template root, or a loose `.svg` folder | Normalize the source directory, create an editable authoring IR bundle with `svg_authoring_view.py`, then use its page SVGs; also read companion `design_spec.md` / `spec_lock.md` when present | `standard` / `fidelity`; `mirror` only when the source already carries a complete explicit Master/Layout/placeholder/native-object contract |
| **C** Image / visual references | Screenshot folder, single image, PDF pages | `ls` + `Read` each file (multimodal visual recognition) | `standard` only |
| **D** No reference source | Verbal description only ("McKinsey style", "tech blue", "dark minimal") | — | `standard` only |
@@ -127,20 +127,22 @@ Import fidelity rules:
It is a reconstruction aid, not a final direct template conversion.
-**Lossless source + lightweight authoring view**:
+**Lossless payload backing + editable authoring IR**:
-Keep `<import_workspace>/svg/` and `<import_workspace>/svg-flat/` unchanged as the lossless import evidence. Before the Template_Designer reads any imported page SVG, create non-destructive model-facing projections:
+Keep `<import_workspace>/svg/` and `<import_workspace>/svg-flat/` unchanged as lossless native-payload backing. Before the Template_Designer reads or edits any imported page SVG, create non-destructive authoring IR bundles:
```bash
-python3 skills/ppt-master/scripts/svg_authoring_view.py "<import_workspace>/svg" -o "<import_workspace>/authoring-svg"
-python3 skills/ppt-master/scripts/svg_authoring_view.py "<import_workspace>/svg-flat" -o "<import_workspace>/authoring-svg-flat"
+python3 skills/ppt-master/scripts/svg_authoring_view.py "<import_workspace>/svg" -o "<import_workspace>/authoring-svg" --projection-kind layered
+python3 skills/ppt-master/scripts/svg_authoring_view.py "<import_workspace>/svg-flat" -o "<import_workspace>/authoring-svg-flat" --projection-kind flat
```
-The projection removes opaque text payload, duplicate hidden geometry carriers, and import-only identity attributes while keeping visible shape intent, compact preset/frame metadata, structure markers, logical ids, and valid asset references. It is an inspection surface only. Never export it as a finished template and never overwrite the lossless source.
+Each bundle contains editable SVGs plus `authoring_manifest.json`. The projection removes opaque text payload, duplicate hidden geometry carriers, and import-only identity attributes while keeping visible shape intent, compact preset/frame metadata, structure markers, logical ids, valid asset references, and a reserved `data-pptx-source-ref` on each imported logical object. The manifest records relative source files, document hashes, source paths, and initial authoring-subtree hashes; it does not duplicate opaque payload. Source refs are unique within one document and are interpreted together with that document's manifest record.
+
+`authoring-svg/` is the canonical editable IR for template creation. The lossless trees are read only by materialization when an unchanged referenced object needs supported native payload or fallback evidence. Do not edit or copy the lossless SVGs directly. The IR is not a finished template directory and must be materialized into validated `<template_workspace>/templates/*.svg` before preview or export.
**Vector illustration readability pass**:
-Factor large decorative vector groups out of the lightweight projections so the model-facing SVGs stay readable while export remains native shapes. Never run this in place on the lossless import SVGs:
+Factor large decorative vector groups out of the lightweight IR documents so the model-facing SVGs stay readable while export remains native shapes. Never run this in place on the lossless import SVGs:
```bash
# layered view — primary read surface and canonical extracted-vector inventory
@@ -150,7 +152,7 @@ python3 skills/ppt-master/scripts/extract_svg_assets.py "<import_workspace>/auth
python3 skills/ppt-master/scripts/extract_svg_assets.py "<import_workspace>/authoring-svg-flat" --icons-dir "<import_workspace>/icons" --icon-namespace imported --reuse-inventory "<import_workspace>/authoring-svg_vector_asset_inventory.json" --inplace --id-prefix flat --min-decoration-bytes 3000 --clean-stale
```
-The projected SVGs in `<import_workspace>/authoring-svg/` / `<import_workspace>/authoring-svg-flat/` are rewritten in place with compact `<use data-icon="imported/..."/>` placeholders. Extracted assets have one canonical copy under `<import_workspace>/icons/imported/`; never duplicate them under `templates/icons/`. The root `icons/` directory remains a namespace container and must not contain rewritten page SVGs or inventories. The inventory is written beside the processed projection directory. The existing icon embedding path re-inlines the extracted assets before final export, preserving multi-color artwork and non-square viewBox geometry as native SVG shapes. Text-bearing groups are never extracted; text must stay readable/editable in the working SVG. Extraction triggers on either many drawable elements or a large pure-vector XML block, so long single-path illustrations are factored out too. Pure-vector decoration runs inside text-bearing groups use a lower size threshold, allowing card borders and decorative paths to be extracted without hiding text. Referenced defs (`gradient` / `pattern` / `filter` / `clipPath` / `marker`) are copied into each asset and namespaced so the asset is self-contained after re-inline. If both layered and flat views are processed into the same icon namespace, keep distinct `--id-prefix` values to avoid asset ID collisions. `--clean-stale` removes only stale generated assets for the current SVG filenames and prefix inside the selected namespace; it is safe in this import workspace but should not be used against a shared hand-curated icon directory without a specific prefix.
+The authoring SVGs in `<import_workspace>/authoring-svg/` / `<import_workspace>/authoring-svg-flat/` are rewritten in place with compact `<use data-icon="imported/..."/>` placeholders. Extracted assets have one canonical copy under `<import_workspace>/icons/imported/`; never duplicate them under `templates/icons/`. The root `icons/` directory remains a namespace container and must not contain rewritten page SVGs or inventories. The inventory is written beside the processed IR directory and records every preserved `data-pptx-source-ref`; re-inlining an asset therefore restores the referenced object mapping before materialization. The existing icon embedding path re-inlines the extracted assets before final export, preserving multi-color artwork and non-square viewBox geometry as native SVG shapes. Text-bearing groups are never extracted; text must stay readable/editable in the working SVG. Extraction triggers on either many drawable elements or a large pure-vector XML block, so long single-path illustrations are factored out too. Pure-vector decoration runs inside text-bearing groups use a lower size threshold, allowing card borders and decorative paths to be extracted without hiding text. Referenced defs (`gradient` / `pattern` / `filter` / `clipPath` / `marker`) are copied into each asset and namespaced so the asset is self-contained after re-inline. If both layered and flat views are processed into the same icon namespace, keep distinct `--id-prefix` values to avoid asset ID collisions. `--clean-stale` removes only stale generated assets for the current SVG filenames and prefix inside the selected namespace; it is safe in this import workspace but should not be used against a shared hand-curated icon directory without a specific prefix.
The layered pass owns the canonical extracted-vector pool. Each new asset records a source fingerprint before generated ID namespacing. The flat pass MUST consume the layered inventory through `--reuse-inventory`: an exact fingerprint match writes only a `<use>` reference to the existing layered asset, while an unmatched flat-only subtree may create one new asset under the `flat` prefix. Do not independently extract the two views into parallel asset sets. With `--clean-stale`, a rerun also removes obsolete generated `flat_*` duplicates while retaining every reused layered reference.
@@ -158,7 +160,7 @@ The layered pass owns the canonical extracted-vector pool. Each new asset record
When one imported native group is deliberately being retained as one complex
SVG picture rather than rebuilt as editable paths, select its exact id in the
-lightweight projection and normalize it explicitly:
+layered authoring IR and normalize it explicitly:
```bash
python3 skills/ppt-master/scripts/extract_svg_pictures.py \
@@ -197,8 +199,8 @@ does not turn those vectors into a picture.
| Mode | Required read set |
|---|---|
-| `standard` / `fidelity` | `manifest.json`, exported assets, `svg/inheritance.json`, and every cleaned layered projection (`authoring-svg/master_*.svg` / `layout_*.svg` / `slide_NN.svg`). The layered view is the complete read surface: it covers Layouts unused by any sample slide (invisible in `svg-flat/` yet still template vocabulary), and per-page composition follows from `inheritance.json`. Cleaned flat pages are optional composition spot checks, not a required second pass over the same shapes. Source topology remains non-binding; the two modes differ in output design (`fidelity` designs a broader roster covering the useful visual range), not in read coverage. |
-| `mirror` | `manifest.json`, `native_structure.json`, `svg/inheritance.json`, every cleaned layered Master/Layout/Slide projection, and every cleaned flat slide projection. Verify the projection against the lossless file inventory; restoration itself reads the matching lossless files by identity rather than placing their opaque payload in model context. |
+| `standard` / `fidelity` | `manifest.json`, exported assets, `svg/inheritance.json`, `authoring-svg/authoring_manifest.json`, and every cleaned layered IR document (`authoring-svg/master_*.svg` / `layout_*.svg` / `slide_NN.svg`). The layered IR is the complete read surface: it covers Layouts unused by any sample slide (invisible in `svg-flat/` yet still template vocabulary), and per-page composition follows from `inheritance.json`. Cleaned flat pages are optional composition spot checks, not a required second pass over the same shapes. Source topology remains non-binding; the two modes differ in output design (`fidelity` designs a broader roster covering the useful visual range), not in read coverage. |
+| `mirror` | `manifest.json`, `native_structure.json`, `svg/inheritance.json`, `authoring-svg/authoring_manifest.json`, every cleaned layered Master/Layout/Slide IR document, and every cleaned flat slide IR document. Edit and select objects only through the IR; materialization may resolve unchanged refs against the matching lossless backing without placing opaque payload in model context. |
Use `summary.md` only for orientation. Use screenshots or the original PPTX only for visual cross-checking. Do not bulk-read opaque lossless payload into model context.
@@ -209,15 +211,15 @@ Interpretation rule (carries forward into Steps 2 and 4):
- `summary.md` is a quick scan; never treat it as the canonical fact source — go back to `manifest.json` if anything is unclear
- exported `assets/` are the canonical reusable image pool — `<image>` references in `svg/` already point at these files directly
- exported `icons/imported/*.svg` files are the canonical reusable vector illustration pool, but they are **not** part of the default read set. Read the cleaned SVGs and `*_vector_asset_inventory.json` first; open a specific imported SVG only when the cleaned page or inventory shows that the extracted asset is relevant to the current design decision. This is what makes the SVG work surface smaller.
-- cleaned layered projections are mirror verification views; they expose source ownership without requiring the model to read opaque payload. Do not use them to promote, demote, merge, or split source structure.
-- cleaned complete-page projections are optional composition spot checks for authored modes and verification views for mirror. They are never the lossless restoration source.
+- cleaned layered authoring SVGs are the mirror editing and verification surface; they expose source ownership without requiring the model to read opaque payload. Do not use them to promote, demote, merge, or split source structure.
+- cleaned complete-page IR documents are optional composition spot checks for authored modes and verification views for mirror. They never replace the layered editable IR or immutable payload backing.
- screenshots remain useful for judging composition and style, but should not override extracted factual metadata unless the import result is clearly incomplete
**Mirror complete-graph gate**: compare every `native_structure.json` Layout
-and Master with the layered projection inventory before offering `mirror`.
+and Master with the layered authoring manifest before offering `mirror`.
Every source Layout—including one unused by all source slides—must have a
-lossless Layout projection from which a reusable definition SVG can be restored.
-Every source Master must own at least one retained Layout. Missing projections
+layered IR document and matching payload backing from which a reusable
+definition SVG can be materialized. Every source Master must own at least one retained Layout. Missing IR documents
or ambiguous parentage are blocking; unused identities themselves are supported
and must not be dropped.
@@ -240,26 +242,26 @@ Distinguish observed facts from template rules: "`slide_07` uses a left photo cr
**Read gate**:
-- `standard` / `fidelity`: read and report every projected Master, Layout, and Slide plus the inheritance map; flat pages are optional spot checks
-- `mirror`: verify and report every projected Master, Layout, and Slide plus the inheritance map, while keeping opaque payload out of model context
+- `standard` / `fidelity`: read and report every layered IR Master, Layout, and Slide plus the inheritance map; flat pages are optional spot checks
+- `mirror`: verify and report every layered IR Master, Layout, and Slide plus the authoring manifest and inheritance map, while keeping opaque payload out of model context
-Do not treat lightweight projections as final template assets. `standard` / `fidelity` author new SVGs. Mirror restores from the lossless import and uses projections only for inspection.
+Do not treat authoring IR documents as final template assets. `standard` / `fidelity` author new SVGs from the confirmed brief and IR references. Mirror edits the IR and materializes it with lossless native-payload backing.
-> **Mirror-mode restoration path** — use lossless layered SVGs, flat SVGs, `native_structure.json`, and `svg/inheritance.json` as authority. The cleaned projections are the literal inspection target, not a replacement data source. Preserve roster, appearance, ownership, placeholders, converter-supported native metadata, and available SVG fallbacks; do not synthesize a different graph.
+> **Mirror-mode restoration path** — use `native_structure.json`, `svg/inheritance.json`, and the authoring manifest as structural/provenance authority. The cleaned layered IR is the editable source; lossless layered/flat SVGs are immutable payload backing. Preserve roster, appearance, ownership, placeholders, converter-supported native metadata, and available SVG fallbacks; do not synthesize a different graph.
### 1B. Existing SVG assets
-First resolve the Type B source directory using the rule above. Create a non-destructive authoring projection in a throwaway analysis workspace, then run the same vector readability pass only on that projection. Do **not** rewrite the user's original source directory in place.
+First resolve the Type B source directory using the rule above. Create a non-destructive authoring IR bundle in a throwaway analysis workspace, then run the same vector readability pass only on that IR. Do **not** rewrite the user's original source directory in place.
```bash
-python3 skills/ppt-master/scripts/svg_authoring_view.py "<normalized_svg_source>" -o "<svg_analysis_workspace>/authoring-svg"
+python3 skills/ppt-master/scripts/svg_authoring_view.py "<normalized_svg_source>" -o "<svg_analysis_workspace>/authoring-svg" --projection-kind generic
python3 skills/ppt-master/scripts/extract_svg_assets.py "<svg_analysis_workspace>/authoring-svg" --icons-dir "<svg_analysis_workspace>/icons" --icon-namespace imported --inplace --id-prefix source --min-decoration-bytes 3000 --clean-stale
```
If the source contains one deliberately selected complex subtree that should
remain a single SVG picture, apply the explicit normalization above only to the
-analysis projection. Set `--resource-root` to the narrowest workspace directory
-that contains both the projection and every local dependency referenced by the
+analysis IR. Set `--resource-root` to the narrowest workspace directory
+that contains both the IR and every local dependency referenced by the
selected group. This does not authorize automatic group selection or mutation
of the user's original SVG directory.
@@ -344,7 +346,7 @@ Items to surface:
For type A, also include in this message:
-- the exact projected files required by the selected mode and verified during Step 1
+- the exact authoring-manifest documents required by the selected mode and verified during Step 1
- a one-line summary of the source Master/Layout structure
- the source structure facts, including master/layout counts, multi-master status, and reason codes; state whether they will be restored (`mirror`) or ignored as output topology (`standard` / `fidelity`)
@@ -416,8 +418,8 @@ If the input source is type A, pass the following internal package to the role:
- `summary.md` (orientation only)
- exported `assets/`
- `*_vector_asset_inventory.json`, when the vector readability pass extracted assets; do not bulk-read `icons/imported/*.svg`
-- lightweight references from `authoring-svg/` and `authoring-svg-flat/`
-- for `mirror` only, matching lossless `svg/`, `svg-flat/`, and `svg/inheritance.json` restoration sources
+- editable IR documents and manifests from `authoring-svg/` and `authoring-svg-flat/`
+- for `mirror` only, matching immutable `svg/` / `svg-flat/` payload backing plus `svg/inheritance.json`
- optional screenshots, if available
For type B, pass the cleaned SVG file list from the analysis workspace, `*_vector_asset_inventory.json` if extraction ran, any companion `design_spec.md` / `spec_lock.md`, and the analysis notes. Do not bulk-read extracted vectors; open individual `icons/imported/*.svg` files only when needed.
@@ -429,7 +431,7 @@ The role interprets the package according to replication mode:
| Mode | Final SVG authority | Structure behavior |
|---|---|---|
| `standard` / `fidelity` | Newly authored SVGs based on the confirmed brief and visual references | Design an intentional new Master/Layout/slot system. Source topology is neither preserved nor distilled into the output. |
-| `mirror` | Lossless imported SVG/native-structure evidence | Restore source pages, Master/Layout identities and parentage, placeholder identity/bounds, ownership, and supported native-object metadata one-to-one. Lightweight projections are inspection views only. |
+| `mirror` | Editable `authoring-svg/` IR plus native-structure facts and lossless payload backing | Restore source pages, Master/Layout identities and parentage, placeholder identity/bounds, ownership, and supported native-object metadata one-to-one. Materialization resolves unchanged source refs; it does not copy the lossless tree as the editable source. |
**Hard rule — mode-specific authorship**: `standard` and `fidelity` author new
project-canonical SVG documents. When one registered PowerPoint preset exactly
@@ -456,17 +458,16 @@ re-parenting.
SVG authors own the semantic roster, parentage, picker names, direct atoms, and slots. The exporter owns OOXML part cloning, Theme isolation, relationship registration, and package identity. Do not encode package repair workarounds in individual template SVGs.
-Do not package `native_structure.json` or `source_template.pptx` as template inputs. In `standard` / `fidelity`, author Master/Layout direct semantic atoms and bounded slot groups deliberately from the intended reusable behavior. A validated compact canonical authored-preset `<g>` compiles to one native shape and therefore counts as one semantic atom; it may own a Master/Layout fixed layer or serve as the one direct carrier of an `object` slot. Ordinary groups are not structural atoms or single-object carriers. In `mirror`, use the lossless layered and flat SVGs plus inheritance/native facts to preserve source ownership. Recursively expand fixed Master/Layout group wrappers only because the structured contract requires semantic atoms; preserve transforms, styles, paint order, and appearance, and never flatten or regroup by semantic judgment.
+Do not package `native_structure.json` or `source_template.pptx` as template inputs. In `standard` / `fidelity`, author Master/Layout direct semantic atoms and bounded slot groups deliberately from the intended reusable behavior. A validated compact canonical authored-preset `<g>` compiles to one native shape and therefore counts as one semantic atom; it may own a Master/Layout fixed layer or serve as the one direct carrier of an `object` slot. Ordinary groups are not structural atoms or single-object carriers. In `mirror`, edit the layered authoring IR and use inheritance/native facts to preserve source ownership; the lossless trees remain payload backing. Recursively expand fixed Master/Layout group wrappers only because the structured contract requires semantic atoms; preserve transforms, styles, paint order, and appearance, and never flatten or regroup by semantic judgment.
`design_spec.md §V` records the newly authored roster for `standard` / `fidelity`. For `mirror`, add the `Source Restoration Map` required by [template-designer.md](../references/template-designer.md), with one row per source slide and its preserved Master/Layout assignment. Do not add a synthesis-decision table.
-**Native-shape metadata boundary**: The lightweight authoring projection
-removes opaque payload only from model context; it never becomes the
-restoration source. `standard` / `fidelity` use helper-generated compact
-canonical preset groups and project SVG/assets rather than copied source
-payload. `mirror` preserves the expanded lossless representation and reuses
-only native metadata already supported by the converter on unchanged
-Slide-local/slot objects. Fixed layers are normalized to semantic atoms;
+**Native-shape metadata boundary**: The authoring IR removes opaque payload
+from model context while retaining stable source refs. `standard` / `fidelity`
+use helper-generated compact canonical preset groups and project SVG/assets
+rather than copied source payload. `mirror` materialization rehydrates only
+native metadata already supported by the converter when a referenced
+Slide-local/slot object's initial authoring hash still matches. Fixed layers are normalized to semantic atoms;
unsupported or edited objects keep the current SVG fallback and are reported
rather than silently replaced by stale metadata. Do not reproduce the preset
syntax here; its single authority is
@@ -481,10 +482,10 @@ Downstream, both template-adherence choices use `pptx_structure.mode: structured
**Mirror-mode restoration contract** (type A or B): when `Replication mode: mirror`, the Template_Designer role:
-1. **Restores one output SVG per source page** in `<template_workspace>/templates/`. Use lightweight projections for inspection, but materialize from the matching lossless source and native structure facts. Preserve source Master/Layout keys and picker names, Layout parentage, slide assignment, placeholder type/index/bounds, ownership, paint order, and supported native metadata. Mechanical namespace, root-declaration, asset-path, and fixed-layer group normalization is allowed only when source ownership and appearance remain unchanged.
- - Type A restoration source: `<import_workspace>/svg/`, `<import_workspace>/svg-flat/`, `svg/inheritance.json`, and `native_structure.json`
- - Type B restoration source: the complete explicit source SVG contract; `authoring-svg/` remains inspection-only
- - For every source Layout unused by all source slides, additionally restore one definition-only SVG named `layout_<layout_key>.svg` from its lossless Master/Layout projections. It carries the exact root identity, fixed atoms, and placeholder contract but is not a generated page assignment. Use source placeholder prompts/carriers; do not invent business content. This definition SVG lets downstream export register the Layout and any otherwise-unused parent Master without retaining an internal carrier slide.
+1. **Restores one output SVG per source page** in `<template_workspace>/templates/`. Edit and normalize the matching `authoring-svg/` IR document, then materialize it with the authoring manifest, native structure facts, and immutable payload backing. Preserve source Master/Layout keys and picker names, Layout parentage, slide assignment, placeholder type/index/bounds, ownership, paint order, and supported native metadata. Mechanical namespace, root-declaration, asset-path, and fixed-layer group normalization is allowed only when source ownership and appearance remain unchanged.
+ - Type A authoring source: `<import_workspace>/authoring-svg/` plus its `authoring_manifest.json`; `<import_workspace>/svg/`, `<import_workspace>/svg-flat/`, `svg/inheritance.json`, and `native_structure.json` provide payload and structural backing
+ - Type B authoring source: `<svg_analysis_workspace>/authoring-svg/` plus its manifest; the complete explicit source SVG contract is immutable backing
+ - For every source Layout unused by all source slides, additionally materialize one definition-only SVG named `layout_<layout_key>.svg` from its layered authoring IR document and payload backing. It carries the exact root identity, fixed atoms, and placeholder contract but is not a generated page assignment. Use source placeholder prompts/carriers; do not invent business content. This definition SVG lets downstream export register the Layout and any otherwise-unused parent Master without retaining an internal carrier slide.
2. **Renames each file** using the source-order-first convention `<NNN>_<page_type>.svg`, where `<NNN>` is the source-order index zero-padded to 3 digits and `<page_type>` is typically `cover` / `toc` / `chapter` / `content` / `ending` (fall back to `content` when the type cannot be confidently classified). Examples: `001_cover.svg`, `002_toc.svg`, `003_content.svg`, ..., `050_ending.svg`.
- Type A: derive `<page_type>` from `manifest.json.pageTypeCandidates`
- Type B: derive `<page_type>` from the source filename when it follows the PPT Master convention (`01_cover.svg` → `cover`, `03a_content_two_col.svg` → `content`); otherwise infer from page content or fall back to `content`
@@ -567,7 +568,7 @@ This checker validates the authoring contract, not the compiled OOXML package. T
- [ ] Mirror output preserves source slide order, Master/Layout identity and parentage, placeholder facts, and ownership; fixed-layer group expansion is mechanical and pixel-equivalent, and the Source Restoration Map lists every source slide
- [ ] Mirror preflight covered the complete source graph; each unused Layout has one `layout_<layout_key>.svg` definition prototype and each otherwise-unused Master is retained through at least one such Layout
- [ ] For `standard` / `fidelity`, no duplicate-Layout-contract warning remains; mirror may keep equivalent source Layout identities when the restoration map explains them
-- [ ] Lightweight projections were used only for inspection. Mirror materialized from lossless sources, reused only converter-supported metadata on unchanged Slide-local/slot objects, and kept fixed Master/Layout visuals as direct atoms
+- [ ] All template-creation edits used the authoring IR; mirror materialization validated its manifest, reused only converter-supported payload for hash-matching Slide-local/slot refs, stripped IR-only source-ref metadata, and kept fixed Master/Layout visuals as direct atoms
- [ ] If any SVG references an extracted vector, it uses `data-icon="imported/<name>"` and the sole SVG asset exists at `<template_workspace>/icons/imported/<name>.svg`; `templates/icons/` does not exist and no separate illustration embedding script was added
- [ ] For `fidelity` mode: every sprite-sheet asset retains its nested `<svg viewBox=...>` crop wrapper; no image whose file aspect differs from its on-page aspect was flattened to a bare `<image>`
- [ ] For `mirror` mode: source-page SVG count equals source page count, while additional files are exactly the required `layout_<layout_key>.svg` definitions for unused source Layouts; source-page filenames follow the `<NNN>_<page_type>.svg` convention; **no new `{{...}}` authoring placeholders were inserted into restored source-page SVGs**; §V Page Roster lists every emitted file and marks definition-only prototypes explicitly