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

docs(skill): extract visual edit into a standalone workflow

hugohe34ad41690c705
diff --git a/AGENTS.md b/AGENTS.md
index 3d59369d..8625c4ac 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -13,6 +13,8 @@ PPT Master is an AI-driven presentation generation system. Multi-role collaborat
> Decks containing data charts: run the standalone [`verify-charts`](skills/ppt-master/workflows/verify-charts.md) workflow between the executor and post-processing steps to calibrate chart coordinates.
>
> Recorded narration / video export: run the standalone [`generate-audio`](skills/ppt-master/workflows/generate-audio.md) workflow after post-processing.
+>
+> Fine-grained edits after export: when (and only when) the user explicitly asks to refine specific elements, run the standalone [`visual-edit`](skills/ppt-master/workflows/visual-edit.md) workflow.
## Execution Requirements
diff --git a/CLAUDE.md b/CLAUDE.md
index 86f3d8a1..23a94584 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -13,6 +13,8 @@ PPT Master is an AI-driven presentation generation system. Multi-role collaborat
> Decks containing data charts: run the standalone [`verify-charts`](skills/ppt-master/workflows/verify-charts.md) workflow between the executor and post-processing steps to calibrate chart coordinates.
>
> Recorded narration / video export: run the standalone [`generate-audio`](skills/ppt-master/workflows/generate-audio.md) workflow after post-processing.
+>
+> Fine-grained edits after export: when (and only when) the user explicitly asks to refine specific elements, run the standalone [`visual-edit`](skills/ppt-master/workflows/visual-edit.md) workflow.
## Execution Requirements
diff --git a/skills/ppt-master/SKILL.md b/skills/ppt-master/SKILL.md
index 23eeb793..077fa873 100644
--- a/skills/ppt-master/SKILL.md
+++ b/skills/ppt-master/SKILL.md
@@ -75,6 +75,7 @@ For complete tool documentation, see `${SKILL_DIR}/scripts/README.md`.
|----------|------|---------|
| `create-template` | `workflows/create-template.md` | Standalone template creation workflow |
| `verify-charts` | `workflows/verify-charts.md` | Chart coordinate calibration — run after SVG generation if the deck contains data charts |
+| `visual-edit` | `workflows/visual-edit.md` | Browser-based visual editor for fine-grained edits — run only when the user explicitly requests it after export |
---
@@ -336,39 +337,7 @@ Full effect list, anchor logic, and limits: [`references/animations.md`](referen
> ❌ **NEVER** export from `svg_output/` — MUST use `-s final` (exports from `svg_final/`)
> ❌ **NEVER** use `--only` (it suppresses one of the two output files)
-**Step 7.4: SVG Editor — opt-in only**
-
-This step is **OPTIONAL**. Do **NOT** run it as part of the default flow. Run it **only** when the user explicitly asks for fine-grained visual edits (any wording — recognize intent, don't match keywords).
-
-When such an intent is detected, ask the user (in their language) whether they want to launch the visual editor.
-
-If the user confirms, start the editor. The editor edits the project's `svg_output/` in place; `svg_to_pptx` already snapshots it into `backup/<timestamp>/` on every export, so prior versions are recoverable from there:
-
-```bash
-python3 ${SKILL_DIR}/scripts/svg_editor/server.py <project_path> --no-browser
-```
-
-Inform the user (in their language) that:
-- the editor is running at `http://localhost:5050`
-- they should click an element in the browser, add an annotation, and save when done
-
-**Edit Loop (Triggered After User Submits Annotations):**
-
-When the user indicates (in any wording) that they have submitted annotations and want the AI to apply them:
-
-1. The server will have auto-shut down after the user saved (port is released). If it's still running, kill it.
-2. Run `python3 ${SKILL_DIR}/scripts/check_annotations.py <project_path>` to discover annotations
-3. If no annotations found, inform the user and stop
-4. Read each annotated SVG file from `<project_path>/svg_output/`
-5. For each annotation: modify the target SVG element per the user's instruction
-6. Remove `data-edit-target` and `data-edit-annotation` attributes from modified elements
-7. Re-run Step 7 post-processing: `finalize_svg.py` → `svg_to_pptx.py`
-8. Re-start the SVG editor server:
- ```bash
- python3 ${SKILL_DIR}/scripts/svg_editor/server.py <project_path> --no-browser
- ```
-9. Inform the user (in their language) that annotations have been applied, the PPT has been updated, and the editor is running again at `http://localhost:5050`.
-10. Wait for the user's next message. If they indicate they are done, the editing loop ends. If they submit more annotations, return to step 1.
+> Fine-grained edits after export: when (and only when) the user explicitly asks to refine specific elements, run the standalone [`visual-edit`](workflows/visual-edit.md) workflow.
---
diff --git a/skills/ppt-master/workflows/visual-edit.md b/skills/ppt-master/workflows/visual-edit.md
new file mode 100644
index 00000000..5a2e1957
--- /dev/null
+++ b/skills/ppt-master/workflows/visual-edit.md
@@ -0,0 +1,73 @@
+---
+description: Launch a local browser-based visual editor so the user can pinpoint elements they want changed; AI applies the annotations and re-exports the PPTX
+---
+
+# Visual Edit Workflow
+
+> Standalone post-export step. Run when the user explicitly asks for fine-grained visual edits after PPTX export — e.g. "want to tweak something specific", "this part isn't right", "调一下这里" — any wording that signals they want to refine particular elements rather than regenerate. Do NOT run as part of the default flow.
+
+This workflow is **independent**: it operates on `<project_path>/svg_output/` and re-runs the same post-processing scripts the main pipeline uses. Safe to invoke in a fresh session as long as the project has reached Step 7.
+
+## When to Run
+
+- The deck has been exported once (Steps 1–7 of the main workflow are complete).
+- The user explicitly requests fine-grained edits.
+- A browser is available on the host (Linux headless / containers without a display cannot use this workflow — fall back to direct SVG edits via conversation).
+
+If the user's request is broad ("regenerate", "redo this slide"), use the main workflow instead — the editor is for surgical edits, not full rewrites.
+
+---
+
+## Step 1: Confirm with the user
+
+Before launching anything, confirm in the user's language that you're about to start a local visual editor in their browser, and that they'll click elements to add written instructions. Wait for confirmation.
+
+If they decline or want a different approach (e.g. just describe the edit in chat), don't launch — apply the edit directly instead.
+
+## Step 2: Start the editor
+
+```bash
+python3 ${SKILL_DIR}/scripts/svg_editor/server.py <project_path> --no-browser
+```
+
+The server binds to `127.0.0.1:5050` and edits `<project_path>/svg_output/` in place. `svg_to_pptx` already snapshots `svg_output` into `backup/<timestamp>/` on every export, so prior versions are recoverable from there.
+
+After the server prints `SVG Editor running at http://localhost:5050`, inform the user (in their language):
+
+- The editor is running at `http://localhost:5050`.
+- They should open it in a browser, click the element they want changed, write the change as a short instruction, then click **保存 / Save**.
+- After saving, the server auto-shuts and the user should return to the conversation.
+
+## Step 3: Apply annotations (Edit Loop)
+
+Triggered when the user signals (in any wording) that they have submitted annotations and want them applied.
+
+1. If the server is somehow still running, kill the process.
+2. Discover annotations:
+ ```bash
+ python3 ${SKILL_DIR}/scripts/check_annotations.py <project_path>
+ ```
+3. If no annotations are found, tell the user and stop.
+4. For each annotated SVG in `<project_path>/svg_output/`:
+ - Read the file.
+ - For each element with `data-edit-target="true"`, apply the change described in `data-edit-annotation`.
+ - Strip `data-edit-target` and `data-edit-annotation` from the modified element.
+5. Re-run post-processing:
+ ```bash
+ python3 ${SKILL_DIR}/scripts/finalize_svg.py <project_path>
+ python3 ${SKILL_DIR}/scripts/svg_to_pptx.py <project_path> -s final
+ ```
+6. Restart the editor (same command as Step 2).
+7. Tell the user (in their language) that annotations have been applied, the PPT is updated, and the editor is running again at `http://localhost:5050`.
+8. Wait for the user's next message:
+ - If they indicate they're done, the loop ends.
+ - If they submit more annotations, return to step 1.
+
+---
+
+## Notes
+
+- **Browser preview**: the server inlines `<use data-icon>` placeholders and serves `images/*` so the SVG renders correctly in the browser. The on-disk SVG is unchanged by these previews.
+- **Element targeting**: each element gets a transient `_edit_N` id assigned by the server while previewing. After save, only annotated elements keep their id; unannotated `_edit_N` ids are stripped before writing back to disk.
+- **Port conflict**: if `5050` is taken, pass `--port <other>` and update the URL you tell the user.
+- **Idle timeout**: the server self-terminates after 15 minutes of inactivity (override with `--timeout <seconds>`).