feat: Implement Study Interview Mode as default study creation method

Study Interview Mode is now the DEFAULT for all study creation requests.
This intelligent Q&A system guides users through optimization setup with:

- 7-phase interview flow: introspection → objectives → constraints → design_variables → validation → review → complete
- Material-aware validation with 12 materials and fuzzy name matching
- Anti-pattern detection for 12 common mistakes (mass-no-constraint, stress-over-yield, etc.)
- Auto extractor mapping E1-E24 based on goal keywords
- State persistence with JSON serialization and backup rotation
- StudyBlueprint generation with full validation

Triggers: "create a study", "new study", "optimize this", any study creation intent
Skip with: "skip interview", "quick setup", "manual config"

Components:
- StudyInterviewEngine: Main orchestrator
- QuestionEngine: Conditional logic evaluation
- EngineeringValidator: MaterialsDatabase + AntiPatternDetector
- InterviewPresenter: Markdown formatting for Claude
- StudyBlueprint: Validated configuration output
- InterviewState: Persistent state management

All 129 tests passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-03 11:06:07 -05:00
parent b1ffc64407
commit 32caa5d05c
27 changed files with 9737 additions and 11 deletions

View File

@@ -1,8 +1,8 @@
# Atomizer: Intelligent FEA Optimization & NX Configuration Framework
## Complete Technical Briefing Document for Podcast Generation
**Document Version:** 2.1
**Generated:** December 31, 2025
**Document Version:** 2.2
**Generated:** January 2, 2026
**Purpose:** NotebookLM/AI Podcast Source Material
---
@@ -290,7 +290,143 @@ This ensures:
---
# PART 4: MCP-FIRST DEVELOPMENT APPROACH
# PART 4: STUDY INTERVIEW MODE - INTELLIGENT STUDY CREATION
## The Problem: Configuration Complexity
Creating an optimization study traditionally requires:
- Understanding optimization_config.json schema
- Knowing which extractor (E1-E24) maps to which physics
- Setting appropriate bounds for design variables
- Choosing the right sampler and trial count
- Avoiding common anti-patterns (mass optimization without constraints)
**Most engineers aren't optimization experts.** They know their physics, not Optuna samplers.
## The Solution: Guided Interview
Instead of asking users to fill out JSON files, Atomizer now **interviews them through natural conversation**.
### How It Works
```
┌─────────────────────────────────────────────────────────────────┐
│ STUDY INTERVIEW MODE (DEFAULT for all study creation) │
├─────────────────────────────────────────────────────────────────┤
│ │
│ User: "I want to create a study for my bracket" │
│ │
│ Atomizer: "I'll help you set up your optimization study. │
│ Let me ask a few questions..." │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ PHASE 1: INTROSPECTION (automatic) │ │
│ │ • Analyze NX model expressions │ │
│ │ • Detect materials from simulation │ │
│ │ • Identify candidate design variables │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ PHASE 2: PROBLEM DEFINITION │ │
│ │ Q: "What are you trying to optimize?" │ │
│ │ A: "Minimize mass while keeping stress low" │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ PHASE 3: OBJECTIVES (auto-mapped to extractors) │ │
│ │ • Mass → E4 (BDF mass extractor) │ │
│ │ • Stress → E3 (Von Mises stress) │ │
│ │ • No manual extractor selection needed! │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ PHASE 4: CONSTRAINTS (material-aware validation) │ │
│ │ Q: "What's the maximum stress limit?" │ │
│ │ A: "200 MPa" │ │
│ │ │ │
│ │ ⚠️ "Your model uses Aluminum 6061-T6 (yield: 276 MPa). │ │
│ │ 200 MPa is close to yield. Consider 184 MPa (SF=1.5)"│ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ PHASE 5: DESIGN VARIABLES (from introspection) │ │
│ │ "I found these expressions in your model: │ │
│ │ • thickness (current: 5mm) │ │
│ │ • rib_height (current: 10mm) │ │
│ │ Which should we optimize?" │ │
│ │ │ │
│ │ → Auto-suggests bounds: 2.5-7.5mm (±50% of current) │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
│ ┌──────────────────────────────────────────────────────────┐ │
│ │ PHASE 6: REVIEW & GENERATE │ │
│ │ Shows complete blueprint, asks for confirmation │ │
│ │ → Generates optimization_config.json │ │
│ │ → Generates run_optimization.py │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────┘
```
### Anti-Pattern Detection
The interview includes an **Engineering Validator** that catches common mistakes:
| Anti-Pattern | Detection | Warning |
|--------------|-----------|---------|
| `mass_no_constraint` | Mass objective without stress/displacement limit | "This typically produces paper-thin designs" |
| `stress_over_yield` | Stress limit > material yield | "Consider safety factor 1.5-2.0" |
| `bounds_too_wide` | Variable range > 100x | "Wide bounds = slow convergence" |
| `too_many_objectives` | >3 objectives | "Focus on key goals for tractable optimization" |
### Materials Database
Built-in knowledge of engineering materials:
- **12 common materials** (aluminum, steel, titanium, composites)
- **Fuzzy name matching**: "Al 6061", "6061-T6", "aluminum" → all work
- **Safety factors** by application (static, fatigue, impact)
- **Yield/ultimate stress** validation
### Key Benefits
1. **Zero configuration knowledge needed** - Just describe what you want
2. **Material-aware validation** - Catches stress limits vs. yield
3. **Auto extractor mapping** - Goals → E1-E24 automatically
4. **Anti-pattern detection** - Warns about common mistakes
5. **State persistence** - Resume interrupted interviews
6. **Blueprint validation** - Complete config before generation
### Trigger Phrases
Any of these start Interview Mode (now the DEFAULT):
- "Create a study", "new study", "set up study"
- "Optimize this", "optimize my model"
- "I want to minimize mass"
To skip Interview Mode (power users only):
- "Quick setup", "skip interview", "manual config"
### Technical Implementation
```
optimization_engine/interview/
├── study_interview.py # Main orchestrator (StudyInterviewEngine)
├── question_engine.py # Conditional logic, dynamic options
├── interview_state.py # Persistent state, JSON serialization
├── interview_presenter.py # ClaudePresenter, DashboardPresenter
├── engineering_validator.py # Materials DB, anti-pattern detector
├── study_blueprint.py # Validated configuration generation
└── schemas/
├── interview_questions.json # 17 questions, 7 phases
├── materials_database.json # 12 materials with properties
└── anti_patterns.json # 12 anti-pattern definitions
```
**All 129 tests passing.**
---
# PART 5: MCP-FIRST DEVELOPMENT APPROACH
## When Functions Don't Exist: How Atomizer Develops New Capabilities
@@ -754,6 +890,7 @@ Automatic markdown reports with:
4. **MCP-first development** - Documentation-driven, not guessing
5. **Simulation focus** - Not CAD, not mesh - optimization of simulation performance
6. **Self-aware surrogates (SAT)** - Know when predictions are uncertain, validated WS=205.58
7. **Interview Mode (NEW)** - Zero-config study creation through natural conversation
## Sound Bites for Podcast
@@ -764,6 +901,7 @@ Automatic markdown reports with:
- "Every study makes the system smarter. That's not marketing - that's LAC."
- "SAT knows when it doesn't know. A surrogate that's confidently wrong is worse than no surrogate at all."
- "V5 surrogate said WS=280. FEA said WS=376. That's a 30% error from extrapolating into the unknown. SAT v3 fixed that - WS=205.58."
- "Just say 'create a study' and Atomizer interviews you. No JSON, no manuals, just conversation."
## The Core Message
@@ -783,10 +921,11 @@ This isn't just automation - it's **accumulated engineering intelligence**.
---
**Document Statistics:**
- Sections: 12
- Sections: 13
- Focus: Simulation optimization (not CAD/mesh)
- Key additions: Study characterization, protocol evolution, MCP-first development, SAT v3
- Key additions: Study characterization, protocol evolution, MCP-first development, SAT v3, **Study Interview Mode**
- Positioning: Optimizer & NX configurator, not "LLM-first"
- SAT Performance: Validated WS=205.58 (best ever, beating V7 TPE at 218.26)
- Interview Mode: 129 tests passing, 12 materials, 12 anti-patterns, 7 phases
**Prepared for NotebookLM/AI Podcast Generation**

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,297 @@
# Study Interview Mode - Implementation TODO
**Created**: 2026-01-02
**Source**: [ATOMIZER_STUDY_INTERVIEW_MODE_IMPLEMENTATION_PLAN.md](ATOMIZER_STUDY_INTERVIEW_MODE_IMPLEMENTATION_PLAN.md)
**Status**: COMPLETE - All Tasks Done
---
## Overview
This document tracks the Interview Mode implementation. **All core components have been implemented and tests pass (129/129).**
---
## Phase 1: Foundation - COMPLETE
### 1.1 Directory Structure Setup
**Status**: `[x]` COMPLETE
**Files Created**:
```
optimization_engine/interview/
├── __init__.py
├── study_interview.py
├── question_engine.py
├── interview_state.py
├── interview_presenter.py
├── interview_intelligence.py
├── engineering_validator.py
├── study_blueprint.py
└── schemas/
├── interview_questions.json
├── materials_database.json
└── anti_patterns.json
tests/interview/
├── __init__.py
├── test_interview_state.py
├── test_question_engine.py
├── test_interview_presenter.py
├── test_engineering_validator.py
├── test_study_blueprint.py
└── test_study_interview.py
```
---
### 1.2 InterviewState Dataclass
**Status**: `[x]` COMPLETE
Implemented in `interview_state.py`:
- InterviewState dataclass with all fields
- JSON serialization (to_json(), from_json())
- InterviewPhase enum with transitions
- Helper methods: is_complete(), progress_percentage(), add_warning(), etc.
- AnsweredQuestion and LogEntry dataclasses
---
### 1.3 InterviewStateManager
**Status**: `[x]` COMPLETE
Implemented in `interview_state.py`:
- Directory creation (.interview/, .interview/backups/)
- Atomic save with backup rotation
- Lock file mechanism
- Log file appending (INTERVIEW_LOG.md)
- History tracking
---
## Phase 2: Question Engine - COMPLETE
### 2.1 Question Schema
**Status**: `[x]` COMPLETE
Created `schemas/interview_questions.json`:
- 17 questions across 7 categories
- Conditional logic definitions
- Dynamic option population support
- Engineering guidance per question
---
### 2.2 QuestionEngine
**Status**: `[x]` COMPLETE
Implemented in `question_engine.py`:
- Schema loading and parsing
- Conditional evaluation (and/or/not/equals/contains/introspection_has)
- Dynamic option population from introspection
- Answer validation
- Category ordering
---
### 2.3 Interview Presenters
**Status**: `[x]` COMPLETE
Implemented in `interview_presenter.py`:
- InterviewPresenter abstract base class
- ClaudePresenter (markdown formatting)
- DashboardPresenter (JSON events)
- CLIPresenter (plain text)
- Response parsing for all question types
---
## Phase 3: Intelligence Layer - COMPLETE
### 3.1 ExtractorMapper
**Status**: `[x]` COMPLETE
Implemented in `interview_intelligence.py`:
- GOAL_MAP for goal-to-extractor mapping
- Support for all extractors E1-E10
- Auto-assignment based on optimization goal
---
### 3.2 Materials Database
**Status**: `[x]` COMPLETE
Created `schemas/materials_database.json`:
- 12 common engineering materials
- Properties: yield stress, ultimate stress, density, modulus
- Safety factors by application
- Fuzzy name matching implemented
---
### 3.3 Anti-Pattern Detector
**Status**: `[x]` COMPLETE
Created `schemas/anti_patterns.json` and implemented in `engineering_validator.py`:
- 12 anti-pattern definitions
- Severity levels (error, warning, info)
- Fix suggestions
- Pattern detection logic
---
### 3.4 Engineering Validator
**Status**: `[x]` COMPLETE
Implemented in `engineering_validator.py`:
- MaterialsDatabase class with fuzzy matching
- AntiPatternDetector class
- EngineeringValidator combining both
- Constraint validation (stress, displacement, frequency)
- Bounds suggestion
---
### 3.5 Interview Intelligence
**Status**: `[x]` COMPLETE
Implemented in `interview_intelligence.py`:
- Complexity determination (simple/moderate/complex)
- Question estimation
- Recommended settings generation
---
## Phase 4: Blueprint & Generation - COMPLETE
### 4.1 StudyBlueprint
**Status**: `[x]` COMPLETE
Implemented in `study_blueprint.py`:
- DesignVariable, Objective, Constraint dataclasses
- StudyBlueprint with all configuration
- to_config_json() for optimization_config.json format
- to_markdown() for summary display
- Validation methods
---
### 4.2 BlueprintBuilder
**Status**: `[x]` COMPLETE
Implemented in `study_blueprint.py`:
- from_interview_state() method
- Automatic extractor assignment
- Trial count calculation
- Sampler selection
---
### 4.3 StudyInterviewEngine
**Status**: `[x]` COMPLETE
Implemented in `study_interview.py`:
- Main orchestrator class
- start_interview() with resume support
- get_first_question() / process_answer() flow
- Warning acknowledgment
- Blueprint generation and modification
- State persistence
---
## Phase 5: Integration - COMPLETE
### 5.1 Skill File
**Status**: `[x]` COMPLETE
Created `.claude/skills/modules/study-interview-mode.md`:
- Usage documentation
- Example conversation
- Integration guide
---
### 5.2 Protocol Updates
**Status**: `[x]` COMPLETE
Completed:
- [x] Update OP_01_CREATE_STUDY.md with interview phase
- [x] Update 00_BOOTSTRAP.md task routing
- [x] Update CLAUDE.md with interview instructions
---
## Phase 6: Testing - COMPLETE
### 6.1 Unit Tests
**Status**: `[x]` COMPLETE
All tests pass: **129/129**
Test files created:
- test_interview_state.py (23 tests)
- test_question_engine.py (20 tests)
- test_interview_presenter.py (16 tests)
- test_engineering_validator.py (32 tests)
- test_study_blueprint.py (22 tests)
- test_study_interview.py (16 tests)
---
### 6.2 Integration Tests
**Status**: `[x]` COMPLETE
Integration tests in test_study_interview.py:
- Full interview flow
- Resume functionality
- Blueprint generation
- Warning handling
---
## Summary
| Phase | Status | Completion |
|-------|--------|------------|
| 1. Foundation | COMPLETE | 100% |
| 2. Question Engine | COMPLETE | 100% |
| 3. Intelligence | COMPLETE | 100% |
| 4. Blueprint | COMPLETE | 100% |
| 5. Integration | COMPLETE | 100% |
| 6. Testing | COMPLETE | 100% |
**Overall**: 100% Complete
**All Tasks Done**:
- [x] All 129 tests passing
- [x] All protocol updates complete
- [x] Skill file created
---
## Quick Start
```python
from optimization_engine.interview import StudyInterviewEngine
# Create engine
engine = StudyInterviewEngine(study_path)
# Start interview
session = engine.start_interview("my_study", introspection=introspection_data)
# Get first question
action = engine.get_first_question()
print(action.message)
# Process answers in loop
while action.action_type == "ask_question":
user_response = input()
action = engine.process_answer(user_response)
# When complete
if action.action_type == "show_summary":
blueprint = action.blueprint
config = blueprint.to_config_json()
```

View File

@@ -136,7 +136,59 @@ See `studies/M1_Mirror/README.md` for a complete parent README example.
---
## Detailed Steps
## Interview Mode (DEFAULT)
**Study creation now uses Interview Mode by default.** This provides guided study creation with intelligent validation.
### Triggers (Any of These Start Interview Mode)
- "create a study", "new study", "set up study"
- "create a study for my bracket"
- "optimize this model"
- "I want to minimize mass"
- Any study creation request without "skip interview" or "manual"
### When to Skip Interview Mode (Manual)
Use manual mode only when:
- Power user who knows the exact configuration
- Recreating a known study configuration
- User explicitly says "skip interview", "quick setup", or "manual config"
### Starting Interview Mode
```python
from optimization_engine.interview import StudyInterviewEngine
engine = StudyInterviewEngine(study_path)
# Run introspection first (if model available)
introspection = {
"expressions": [...], # From part introspection
"model_path": "...",
"sim_path": "..."
}
session = engine.start_interview(study_name, introspection=introspection)
action = engine.get_first_question()
# Present action.message to user
# Process answers with: action = engine.process_answer(user_response)
```
### Interview Benefits
- **Material-aware validation**: Checks stress limits against yield
- **Anti-pattern detection**: Warns about mass minimization without constraints
- **Auto extractor mapping**: Maps goals to correct extractors (E1-E10)
- **State persistence**: Resume interrupted interviews
- **Blueprint generation**: Creates validated configuration
See `.claude/skills/modules/study-interview-mode.md` for full documentation.
---
## Detailed Steps (Manual Mode - Power Users Only)
### Step 1: Gather Requirements