1---2name: adding-a-pipeline-step3description: Add a new step, capability, or agent to an existing named Superpipelines workflow.4---56# Adding a Pipeline Step — Mutation Workflow78<glossary>9 <term name="Insertion Point">The specific location in the topology (Before, After, Parallel, or Append) where the new step is added.</term>10 <term name="Topology Mutation">The process of updating `topology.json` and the entry skill to reflect new dependency edges.</term>11 <term name="Atomic Promotion">Moving all verified artifacts from a temporary staging directory to final production paths in a single operation.</term>12</glossary>1314## Workflow Phases1516<protocol>17### PHASE 0: PIPELINE SELECTION & INSPECTION18- Resolve scope registries and select the target pipeline via `AskUserQuestion`.19- Read and display the current `topology.json` as a numbered list of steps and dependency edges.2021### PHASE 1: INSERTION DESIGN22- Identify the insertion point (Before/After/Parallel/Append) and affected neighbors.23- Apply the 4D Method to define the new step's intent, inputs, and outputs.24- Determine the component type: Skill-only, Skill + Agent, or Reuse Existing.2526### PHASE 2: ARCHITECTED STAGING27- Dispatch `pipeline-architect` in `STEP-ADD` mode to generate new artifacts.28- <invariant>All new artifacts MUST be written to `{ROOT}/superpipelines/temp/{P}/edit-{ts}/` for staging. NEVER write directly to production paths during design.</invariant>2930### PHASE 3: TOPOLOGY VALIDATION31- Verify the staged `topology.json` for:32 - Unique Step ID.33 - Valid `depends_on` references.34 - Schema compatibility between predecessor outputs and new step inputs.35- **Failures**: Return to the Architect with specific error logs.3637### PHASE 4: DELTA AUDIT38- Dispatch `pipeline-auditor` in `DELTA` mode on all staged files (components, topology, and entry skill).39- <HARD-GATE>If the audit returns SEV-0 or SEV-1 findings, remediate and re-audit. Do NOT proceed to promotion until the delta is clear.</HARD-GATE>4041### PHASE 5: PROMOTION & REGISTRATION42- Present the updated topology and audit results for human approval (`AskUserQuestion`).43- Upon `APPROVE`, move staged files to their final absolute paths in agents, skills, and pipeline directories.44- Update the `registry.json` lists to include new components.45- **Version Stamp**: Update `plugin_version` in `topology.json`, the registry entry, and the new agent's frontmatter to the current superpipelines version.46</protocol>4748<invariants>49- NEVER skip the delta audit; topology mutations are the primary source of runtime orchestration failures.50- ALWAYS use a staging directory (`edit-{ts}/`) for artifact generation to prevent partial, unverified updates.51- Promote changes ONLY after explicit human approval of the updated `tasks.md` and topology snippet.52- ALWAYS update `plugin_version` in `topology.json`, the registry entry, and new agent frontmatter to the current superpipelines version when promoting changes.53</invariants>5455## Red Flags — STOP56- "The audit found minor issues, let's promote anyway." → **STOP**. SEV-0/1 findings are hard blockers for promotion.57- "I'll write directly to production paths to save time." → **STOP**. Direct writes bypass the mutation safety protocol.58- "The insertion point looks obvious, skip validation." → **STOP**. Topology validation catches silent edge mismatches.5960## Rationalization Table6162<rationalization_table>63| Excuse | Reality |64| :--- | :--- |65| "Staging is extra overhead." | Staging allows for a rollback if the audit or human review fails. Direct writes are permanent and destructive. |66| "Topology validation is redundant." | Manual inspection often misses transitive dependency breaks caused by insertion. |67| "Minor audit findings won't break it." | Even SEV-1 findings can cause context leakage or state corruption during execution. |68</rationalization_table>6970## Reference Files71- `sk-pipeline-paths/SKILL.md` — Path resolution.72- `sk-4d-method/SKILL.md` — Brief refinement.73- `creating-a-pipeline/SKILL.md` — Core scaffolding rules.74- `deleting-a-pipeline-step/SKILL.md` — Removal workflow.