---
skill_id: SKILL_002
version: 2.0
last_updated: 2025-12-07
type: loader
code_dependencies: []
requires_skills:
  - SKILL_000
---

# Atomizer Context Loader

**Version**: 2.0
**Updated**: 2025-12-07
**Purpose**: Define what documentation to load based on task type. Ensures LLM sessions have exactly the context needed.

---

## Context Loading Philosophy

1. **Minimal by default**: Don't load everything; load what's needed
2. **Expand on demand**: Load additional modules when signals detected
3. **Single source of truth**: Each concept defined in ONE place
4. **Layer progression**: Bootstrap → Operations → System → Extensions
5. **Learn from history**: Query LAC for relevant prior knowledge

---

## Knowledge Base Query (LAC)

**Before starting any task**, check LAC for relevant insights:

```python
from knowledge_base.lac import get_lac
lac = get_lac()

# Query relevant insights for the task
insights = lac.get_relevant_insights("bracket mass optimization")

# Check similar past optimizations
similar = lac.query_similar_optimizations("bracket", ["mass"])

# Get method recommendation
rec = lac.get_best_method_for("bracket", n_objectives=1)
```

**Full LAC documentation**: `.claude/skills/modules/learning-atomizer-core.md`

---

## Task-Based Loading Rules

### CREATE_STUDY

**Trigger Keywords**: "new", "set up", "create", "optimize", "study"

**Always Load**:
```
.claude/skills/core/study-creation-core.md  (SKILL_CORE_001)
```

**Load If**:
| Condition | Load |
|-----------|------|
| User asks about extractors | `docs/protocols/system/SYS_12_EXTRACTOR_LIBRARY.md` |
| Telescope/mirror/optics mentioned | `modules/zernike-optimization.md` |
| >50 trials OR "neural" OR "surrogate" | `docs/protocols/system/SYS_14_NEURAL_ACCELERATION.md` |
| Multi-objective (2+ goals) | `docs/protocols/system/SYS_11_MULTI_OBJECTIVE.md` |
| Method selection needed | `docs/protocols/system/SYS_15_METHOD_SELECTOR.md` |

**Example Context Stack**:
```
# Simple bracket optimization
core/study-creation-core.md
SYS_12_EXTRACTOR_LIBRARY.md

# Mirror optimization with neural acceleration
core/study-creation-core.md
modules/zernike-optimization.md
SYS_14_NEURAL_ACCELERATION.md
SYS_15_METHOD_SELECTOR.md
```

---

### RUN_OPTIMIZATION

**Trigger Keywords**: "start", "run", "execute", "begin", "launch"

**Always Load**:
```
docs/protocols/operations/OP_02_RUN_OPTIMIZATION.md
```

**Load If**:
| Condition | Load |
|-----------|------|
| "adaptive" OR "characterization" | `docs/protocols/system/SYS_10_IMSO.md` |
| "dashboard" OR "real-time" | `docs/protocols/system/SYS_13_DASHBOARD_TRACKING.md` |
| "resume" OR "continue" | OP_02 has resume section |
| Errors occur | `docs/protocols/operations/OP_06_TROUBLESHOOT.md` |

---

### MONITOR_PROGRESS

**Trigger Keywords**: "status", "progress", "how many", "trials", "check"

**Always Load**:
```
docs/protocols/operations/OP_03_MONITOR_PROGRESS.md
```

**Load If**:
| Condition | Load |
|-----------|------|
| Dashboard questions | `docs/protocols/system/SYS_13_DASHBOARD_TRACKING.md` |
| Pareto/multi-objective | `docs/protocols/system/SYS_11_MULTI_OBJECTIVE.md` |

---

### ANALYZE_RESULTS

**Trigger Keywords**: "results", "best", "compare", "pareto", "report"

**Always Load**:
```
docs/protocols/operations/OP_04_ANALYZE_RESULTS.md
```

**Load If**:
| Condition | Load |
|-----------|------|
| Multi-objective/Pareto | `docs/protocols/system/SYS_11_MULTI_OBJECTIVE.md` |
| Surrogate accuracy | `docs/protocols/system/SYS_14_NEURAL_ACCELERATION.md` |

---

### EXPORT_TRAINING_DATA

**Trigger Keywords**: "export", "training data", "neural network data"

**Always Load**:
```
docs/protocols/operations/OP_05_EXPORT_TRAINING_DATA.md
modules/neural-acceleration.md
```

---

### TROUBLESHOOT

**Trigger Keywords**: "error", "failed", "not working", "crashed", "help"

**Always Load**:
```
docs/protocols/operations/OP_06_TROUBLESHOOT.md
```

**Load If**:
| Error Type | Load |
|------------|------|
| NX/solve errors | NX solver section of core skill |
| Extractor errors | `modules/extractors-catalog.md` |
| Dashboard errors | `docs/protocols/system/SYS_13_DASHBOARD_TRACKING.md` |
| Neural errors | `docs/protocols/system/SYS_14_NEURAL_ACCELERATION.md` |

---

### UNDERSTAND_PROTOCOL

**Trigger Keywords**: "what is", "how does", "explain", "protocol"

**Load Based on Topic**:
| Topic | Load |
|-------|------|
| Protocol 10 / IMSO / adaptive | `docs/protocols/system/SYS_10_IMSO.md` |
| Protocol 11 / multi-objective / NSGA | `docs/protocols/system/SYS_11_MULTI_OBJECTIVE.md` |
| Extractors / physics extraction | `docs/protocols/system/SYS_12_EXTRACTOR_LIBRARY.md` |
| Protocol 13 / dashboard / real-time | `docs/protocols/system/SYS_13_DASHBOARD_TRACKING.md` |
| Protocol 14 / neural / surrogate | `docs/protocols/system/SYS_14_NEURAL_ACCELERATION.md` |

---

### EXTEND_FUNCTIONALITY

**Trigger Keywords**: "create extractor", "add hook", "new protocol", "extend"

**Requires**: Privilege check first (see 00_BOOTSTRAP.md)

| Extension Type | Load | Privilege |
|----------------|------|-----------|
| New extractor | `docs/protocols/extensions/EXT_01_CREATE_EXTRACTOR.md` | power_user |
| New hook | `docs/protocols/extensions/EXT_02_CREATE_HOOK.md` | power_user |
| New protocol | `docs/protocols/extensions/EXT_03_CREATE_PROTOCOL.md` | admin |
| New skill | `docs/protocols/extensions/EXT_04_CREATE_SKILL.md` | admin |

**Always Load for Extractors**:
```
modules/nx-docs-lookup.md    # NX API documentation via MCP
```

---

### NX_DEVELOPMENT

**Trigger Keywords**: "NX Open", "NXOpen", "NX API", "Simcenter", "Nastran card", "NX script"

**Always Load**:
```
modules/nx-docs-lookup.md
```

**MCP Tools Available**:
| Tool | Purpose |
|------|---------|
| `siemens_docs_search` | Search NX Open, Simcenter, Teamcenter docs |
| `siemens_docs_fetch` | Fetch specific documentation page |
| `siemens_auth_status` | Check Siemens SSO session status |
| `siemens_login` | Re-authenticate if session expired |

**Use When**:
- Building new extractors that use NX Open APIs
- Debugging NX automation errors
- Looking up Nastran card formats
- Finding correct method signatures

---

## Signal Detection Patterns

Use these patterns to detect when to load additional modules:

### Zernike/Mirror Detection
```
Signals: "mirror", "telescope", "wavefront", "WFE", "Zernike",
         "RMS", "polishing", "optical", "M1", "surface error"

Action: Load modules/zernike-optimization.md
```

### Neural Acceleration Detection
```
Signals: "neural", "surrogate", "NN", "machine learning",
         "acceleration", ">50 trials", "fast", "GNN"

Action: Load modules/neural-acceleration.md
```

### Multi-Objective Detection
```
Signals: Two or more objectives with different goals,
         "pareto", "tradeoff", "NSGA", "multi-objective",
         "minimize X AND maximize Y"

Action: Load SYS_11_MULTI_OBJECTIVE.md
```

### High-Complexity Detection
```
Signals: >10 design variables, "complex", "many parameters",
         "adaptive", "characterization", "landscape"

Action: Load SYS_10_IMSO.md
```

### NX Open / Simcenter Detection
```
Signals: "NX Open", "NXOpen", "NX API", "FemPart", "CAE.",
         "Nastran", "CQUAD", "CTRIA", "MAT1", "PSHELL",
         "mesh", "solver", "OP2", "BDF", "Simcenter"

Action: Load modules/nx-docs-lookup.md
        Use MCP tools: siemens_docs_search, siemens_docs_fetch
```

---

## Context Stack Examples

### Example 1: Simple Bracket Optimization
```
User: "Help me optimize my bracket for minimum weight"

Load Stack:
1. core/study-creation-core.md    # Core study creation logic
```

### Example 2: Telescope Mirror with Neural
```
User: "I need to optimize my M1 mirror's wavefront error with 200 trials"

Load Stack:
1. core/study-creation-core.md         # Core study creation
2. modules/zernike-optimization.md     # Zernike-specific patterns
3. SYS_14_NEURAL_ACCELERATION.md       # Neural acceleration for 200 trials
4. SYS_15_METHOD_SELECTOR.md           # Method recommendation
```

### Example 3: Multi-Objective Structural
```
User: "Minimize mass AND maximize stiffness for my beam"

Load Stack:
1. core/study-creation-core.md      # Core study creation
2. SYS_11_MULTI_OBJECTIVE.md        # Multi-objective protocol
```

### Example 4: Debug Session
```
User: "My optimization failed with NX timeout error"

Load Stack:
1. OP_06_TROUBLESHOOT.md            # Troubleshooting guide
```

### Example 5: Create Custom Extractor
```
User: "I need to extract thermal gradients from my results"

Load Stack:
1. EXT_01_CREATE_EXTRACTOR.md          # Extractor creation guide
2. SYS_12_EXTRACTOR_LIBRARY.md         # Reference existing patterns
```

---

## Loading Priority Order

When multiple modules could apply, load in this order:

1. **Core skill** (always first for creation tasks)
2. **Primary operation protocol** (OP_*)
3. **Required system protocols** (SYS_*)
4. **Optional modules** (modules/*)
5. **Extension protocols** (EXT_*) - only if extending

---

## Anti-Patterns (Don't Do)

1. **Don't load everything**: Only load what's needed for the task
2. **Don't load extensions for users**: Check privilege first
3. **Don't skip core skill**: For study creation, always load core first
4. **Don't mix incompatible protocols**: P10 (single-obj) vs P11 (multi-obj)
5. **Don't load deprecated docs**: Only use docs/protocols/* structure
6. **Don't skip LAC query**: Always check prior knowledge before starting
