| name | polymorph |
| description | This spell is about representation change, not:
- Naming changes (same structure, different identifiers)
- Execution changes (same code, different runtime)
- Architecture changes (new system design)
- Duplication (same thing, different place) The key test: Can you point to a source artifact and a target artifact where the same information is expressed in structurally different ways? If yes → Polymorph. |
| user-invocable | true |
Polymorph
Transform one representation into another entirely — formats, schemas, protocols, or interfaces.
Overview
Polymorph is interpreted here as a metaphorical spell with a shipping-now execution model.
Canonical source: Polymorph (spell)
Provider target: OpenClaw
When To Use
- Activate this spell when the user asks to convert, transform, or migrate data, code, or specifications from one representation format to another where the source and target have different structures and require real semantic mapping.
- Verbs: "convert", "transform", "translate", "migrate" (between formats)
- Explicit format pairs: "CSV to JSON", "Python to JavaScript", "REST to GraphQL", "YAML to HCL", "Swagger to OpenAPI", "Avro to JSON Schema"
- Phrases: "preserve the structure but change the format", "map X concepts to Y", "flag what doesn't translate", "equivalent in [target format]"
- Scope indicators: "150 test files", "50 components", "entire test suite" (still this spell if it's format conversion at scale)
Workflow
- Identify source and target representations — name both formats explicitly
- Map structural correspondences — list what maps to what; identify what has no equivalent
- Execute transformation — convert preserving semantics; flag losses immediately
- Validate and report — confirm output is well-formed; document preserved, approximated, and lost elements
Deliverables
- The transformed artifact in the target representation.
- A mapping report showing what was preserved, approximated, and lost in translation.
- Validation that the output is well-formed in the target format.
Guardrails
- Always report losses — never claim lossless conversion when formats differ in expressive power
- Flag ambiguous mappings — when source concept has no clean target equivalent, say so
- Validate output format — the result must be syntactically valid in the target representation
- Do NOT activate this spell for:
- Do not use for: Global rename/refactor: "rename module X to Y across the codebase" — same structure, different names
- Do not use for: Disguise/wrapper layers: "make JSON look like XML without changing backend" — not actual transformation
- Do not use for: Workflow orchestration: "chain these scripts into a pipeline", "create a DAG" — about execution order, not representation
- Do not use for: Worker pools/parallelism: "spawn background workers for each record" — about concurrency, not format
- Do not use for: Full redesign from scratch: "rewrite as blockchain-based system" — new architecture, not mapping
- Do not use for: Cloning/duplicating: "make staging look like production" — copying, not transforming
Default Invocation
Use $polymorph to transform this from its current form into the target format, and tell me what survived the conversion and what did not.