| name | reference-preserving-edit |
| description | Use this workflow when editing an existing HWPX while minimizing layout drift by copying first, inspecting the relevant package parts, making bounded edits with the current MCP tools, and validating the result before handoff. |
Reference-Preserving Edit
Use this workflow when the document already exists and layout stability matters more than editing speed.
Tool Order
- Create a working copy with
copy_document.
- Read the current structure with
get_document_outline, get_paragraphs_text, get_table_text, or hwpx_extract_json.
- In advanced mode, inspect sensitive package parts with
package_parts, package_get_xml, package_get_text, object_find_by_tag, or object_find_by_attr.
- Validate the baseline with
validate_structure if the source document is externally produced or suspicious.
- Apply the smallest possible edit:
search_and_replace or batch_replace for anchored text updates
format_text for localized styling
set_table_cell_text for fixed cells
- paragraph insertion/deletion only when structure must change
- Re-read the touched areas and rerun
validate_structure.
Minimize Layout Drift
- Prefer replacement over insertion.
- Avoid changing table geometry unless required.
- Limit edits to the smallest paragraph or table region possible.
- Use package inspection when memo anchors, section XML, or dense table layouts make visual assumptions risky.
When To Inspect Package Parts
- The source was generated by another system.
- The visible text is not enough to identify the true anchor.
- You need to confirm which section or package part contains the target content.
Honest Limitations
apply_document_commands supports a typed set/add/remove/move/copy union, not arbitrary package mutation; use a domain-specific tool when its evidence or semantics are required.
- There is no public layout-drift report or structure-diff tool on the active MCP surface.
- Saving is implicit: mutating tools persist immediately, so always start from
copy_document when the original must stay untouched.