---
name: molecule-pipeline
description: Top-level router for moving molecules between EDA tools, the Adom wiki, and Hydrogen. ONE entry point for "publish/export this molecule to the wiki" (any EDA) and "go get that molecule and import it to Hydrogen" — detects the direction and source, then routes to the right skill chain (EDA export skill → molecule-publish → adom-molecule-import). Use when the user says "ship this board as a molecule", "molecule to the wiki", "publish AND import my molecule", "get molecule X into my Hydrogen", "import that molecule", "move a molecule from <EDA> to hydrogen", or names a molecule + a destination without naming tools.
user-invocable: true
argument-hint: "<molecule name> [from <kicad|fusion|altium|wiki>] [to <wiki|hydrogen>]"
---

# molecule-pipeline — the coordination layer

One mental model for the whole trip. Humans say what they want; this skill
picks the chain and the downstream skills fill in the constraint knowledge
(preflight gates, OCCT molecule-mode routing, stats verification, packaging).

```
 KiCad ──kicad-export-molecule──┐
 Fusion ─fusion-export-molecule─┼→ molecule-publish → WIKI → adom-molecule-import → HYDROGEN
 Altium ─altium-export-molecule─┘   (convert+package+publish)   (authenticated fetch + register)
```

## Routing table

| User intent | Route |
|---|---|
| "publish/export this molecule" + source is **KiCad** | `kicad-export-molecule` → hands off to `molecule-publish` |
| ... source is **Fusion 360** | `fusion-export-molecule` → `molecule-publish` |
| ... source is **Altium** | `altium-export-molecule` (direct-path redesign in progress — owner Barrett) |
| "I already have the files" (STEP + schematic + board) | straight to `molecule-publish` |
| "get/import molecule X to Hydrogen" | `adom-molecule-import` |
| "publish AND import" (full trip) | EDA skill → `molecule-publish` → `adom-molecule-import`, in order, verifying each stage before the next |
| "publish my board" — a plain KiCad/EAGLE board, staying a board | `molecule-publish` BOARD MODE (plain convert, tag `board`, APM render + deps; no anchoring gates) |
| plain PCB that should BECOME a molecule (add wings/machine pins) | `kicad-to-molecule` FIRST, then re-enter here |

Detect the source EDA by asking or by the files at hand: `.kicad_pcb`/`.kicad_sch`
→ KiCad; `.fbrd`/`.f3d`/`.brd`+`.sch` → Fusion; `.PcbDoc`/`.SchDoc` → Altium.

## Invariants (hold across every route)

1. **The full published set reaches the wiki** — shape-conditional:
   molecules = OCCT GLB + STEP + schematic + board + footprint/symbol JSON;
   plain boards = GLB + STEP + every schematic sheet + board + project file
   (no footprint/symbol — no machine pins). Both also carry APM's `render/`
   assets + component `dependencies`. A page missing its shape's set is
   incomplete.
2. **The only GLB is OCCT's.** EDA-native GLB export (KiCad, Fusion,
   service-kicad) is never used for molecules.
3. **STEP is exported on the design machine** so machine-pin/contact/marker
   models bake in.
4. **Every stage verifies before the next starts** — conversion stats gates,
   publish `model_3d_path` check, import wire-attach check. A failed gate
   stops the pipeline; it is never "probably fine".
5. **Import reuses, never regenerates** — `--no-optimize` with the published
   GLB.
6. **Every emitted GLB declares its up-axis** (`asset.extras.adomMolecule.upAxis`)
   — a consumer never infers orientation from geometry. A GLB pushed to a page
   by ANY tool (step2glb, `--render-board`, service-kicad) must be Z-up and
   stamped, or carry an explicit axis stamp consumers can key off
   (molecule-publish #13: an unstamped Y-up `render/board.glb` renders sideways
   on the wiki AND flat-wrong in APM — no single guess satisfies both).

## Why the layers are skills (not one mega-tool)

The middle (convert→package→publish) is deterministic and may become a CLI
verb once the step2glb CLI ships molecule flags (adom-step2glb #99). The
edges cannot be: EDA export needs laptop bridges + human-visible judgment,
and import needs owner/collision decisions. This router stays thin either
way — if a CLI absorbs the middle, only `molecule-publish` shrinks.

## Related

- `kicad-export-molecule`, `fusion-export-molecule`, `altium-export-molecule` — EDA front-ends
- `molecule-publish` — convert + package + publish (the middle)
- `adom-molecule-import` — wiki → Hydrogen (ships with adom/adom-molecule)
- `kicad-to-molecule` — molecule-ize a plain PCB first
- `adom-step2glb` — the conversion CLI/service underneath
