feat: Integrate Learning Atomizer Core (LAC) and master instructions
Add persistent knowledge system that enables Atomizer to learn from every session and improve over time. ## New Files - knowledge_base/lac.py: LAC class with optimization memory, session insights, and skill evolution tracking - knowledge_base/__init__.py: Package initialization - .claude/skills/modules/learning-atomizer-core.md: Full LAC skill documentation - docs/07_DEVELOPMENT/ATOMIZER_CLAUDE_CODE_INSTRUCTIONS.md: Master instructions ## Updated Files - CLAUDE.md: Added LAC section, communication style, AVERVS execution framework, error classification, and "Atomizer Claude" identity - 00_BOOTSTRAP.md: Added session startup/closing checklists with LAC integration - 01_CHEATSHEET.md: Added LAC CLI and Python API quick reference - 02_CONTEXT_LOADER.md: Added LAC query section and anti-pattern ## LAC Features - Query similar past optimizations before starting new ones - Record insights (failures, success patterns, workarounds) - Record optimization outcomes for future reference - Suggest protocol improvements based on discoveries - Simple JSONL storage (no database required) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,12 +19,44 @@ requires_skills: []
|
||||
|
||||
**Atomizer** = LLM-first FEA optimization framework using NX Nastran + Optuna + Neural Networks.
|
||||
|
||||
**Your Role**: Help users set up, run, and analyze structural optimization studies through conversation.
|
||||
**Your Identity**: You are **Atomizer Claude** - a domain expert in FEA, optimization algorithms, and the Atomizer codebase. Not a generic assistant.
|
||||
|
||||
**Core Philosophy**: "Talk, don't click." Users describe what they want; you configure and execute.
|
||||
|
||||
---
|
||||
|
||||
## Session Startup Checklist
|
||||
|
||||
On **every new session**, complete these steps:
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────────┐
|
||||
│ SESSION STARTUP │
|
||||
├─────────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ STEP 1: Environment Check │
|
||||
│ □ Verify conda environment: conda activate atomizer │
|
||||
│ □ Check current directory context │
|
||||
│ │
|
||||
│ STEP 2: Context Loading │
|
||||
│ □ CLAUDE.md loaded (system instructions) │
|
||||
│ □ This file (00_BOOTSTRAP.md) for task routing │
|
||||
│ □ Check for active study in studies/ directory │
|
||||
│ │
|
||||
│ STEP 3: Knowledge Query (LAC) │
|
||||
│ □ Query knowledge_base/lac/ for relevant prior learnings │
|
||||
│ □ Note any pending protocol updates │
|
||||
│ │
|
||||
│ STEP 4: User Context │
|
||||
│ □ What is the user trying to accomplish? │
|
||||
│ □ Is there an active study context? │
|
||||
│ □ What privilege level? (default: user) │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Task Classification Tree
|
||||
|
||||
When a user request arrives, classify it:
|
||||
@@ -213,3 +245,62 @@ docs/protocols/
|
||||
2. If unclear → Ask user clarifying question
|
||||
3. If complex task → Read `01_CHEATSHEET.md` for quick reference
|
||||
4. If need detailed loading rules → Read `02_CONTEXT_LOADER.md`
|
||||
|
||||
---
|
||||
|
||||
## Session Closing Checklist
|
||||
|
||||
Before ending a session, complete:
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────────────┐
|
||||
│ SESSION CLOSING │
|
||||
├─────────────────────────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ 1. VERIFY WORK IS SAVED │
|
||||
│ □ All files committed or saved │
|
||||
│ □ Study configs are valid │
|
||||
│ □ Any running processes noted │
|
||||
│ │
|
||||
│ 2. RECORD LEARNINGS TO LAC │
|
||||
│ □ Any failures and their solutions → failure.jsonl │
|
||||
│ □ Success patterns discovered → success_pattern.jsonl │
|
||||
│ □ User preferences noted → user_preference.jsonl │
|
||||
│ □ Protocol improvements → suggested_updates.jsonl │
|
||||
│ │
|
||||
│ 3. RECORD OPTIMIZATION OUTCOMES │
|
||||
│ □ If optimization completed, record to optimization_memory/ │
|
||||
│ □ Include: method, geometry_type, converged, convergence_trial │
|
||||
│ │
|
||||
│ 4. SUMMARIZE FOR USER │
|
||||
│ □ What was accomplished │
|
||||
│ □ Current state of any studies │
|
||||
│ □ Recommended next steps │
|
||||
│ │
|
||||
└─────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### Session Summary Template
|
||||
|
||||
```markdown
|
||||
# Session Summary
|
||||
|
||||
**Date**: {YYYY-MM-DD}
|
||||
**Study Context**: {study_name or "General"}
|
||||
|
||||
## Accomplished
|
||||
- {task 1}
|
||||
- {task 2}
|
||||
|
||||
## Current State
|
||||
- Study: {status}
|
||||
- Trials: {N completed}
|
||||
- Next action needed: {action}
|
||||
|
||||
## Learnings Recorded
|
||||
- {insight 1}
|
||||
|
||||
## Recommended Next Steps
|
||||
1. {step 1}
|
||||
2. {step 2}
|
||||
```
|
||||
|
||||
@@ -174,6 +174,41 @@ python -c "import optuna; s=optuna.load_study('my_study', 'sqlite:///2_results/s
|
||||
|
||||
---
|
||||
|
||||
## LAC (Learning Atomizer Core) Commands
|
||||
|
||||
```bash
|
||||
# View LAC statistics
|
||||
python knowledge_base/lac.py stats
|
||||
|
||||
# Generate full LAC report
|
||||
python knowledge_base/lac.py report
|
||||
|
||||
# View pending protocol updates
|
||||
python knowledge_base/lac.py pending
|
||||
|
||||
# Query insights for a context
|
||||
python knowledge_base/lac.py insights "bracket mass optimization"
|
||||
```
|
||||
|
||||
### Python API Quick Reference
|
||||
```python
|
||||
from knowledge_base.lac import get_lac
|
||||
lac = get_lac()
|
||||
|
||||
# Query prior knowledge
|
||||
insights = lac.get_relevant_insights("bracket mass")
|
||||
similar = lac.query_similar_optimizations("bracket", ["mass"])
|
||||
rec = lac.get_best_method_for("bracket", n_objectives=1)
|
||||
|
||||
# Record learning
|
||||
lac.record_insight("success_pattern", "context", "insight", confidence=0.8)
|
||||
|
||||
# Record optimization outcome
|
||||
lac.record_optimization_outcome(study_name="...", geometry_type="...", ...)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Error Quick Fixes
|
||||
|
||||
| Error | Likely Cause | Quick Fix |
|
||||
|
||||
@@ -22,6 +22,29 @@ requires_skills:
|
||||
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`
|
||||
|
||||
---
|
||||
|
||||
@@ -321,3 +344,4 @@ When multiple modules could apply, load in this order:
|
||||
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
|
||||
|
||||
234
.claude/skills/modules/learning-atomizer-core.md
Normal file
234
.claude/skills/modules/learning-atomizer-core.md
Normal file
@@ -0,0 +1,234 @@
|
||||
---
|
||||
skill_id: SKILL_MODULE_LAC
|
||||
version: 1.0
|
||||
last_updated: 2025-12-11
|
||||
type: module
|
||||
code_dependencies:
|
||||
- knowledge_base/lac.py
|
||||
requires_skills:
|
||||
- SKILL_000
|
||||
---
|
||||
|
||||
# Learning Atomizer Core (LAC) Integration
|
||||
|
||||
**Version**: 1.0
|
||||
**Updated**: 2025-12-11
|
||||
**Purpose**: Enable Claude to learn from every session and improve over time.
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
LAC is Atomizer's persistent memory system. It stores:
|
||||
- **Optimization outcomes** - What methods worked for what problems
|
||||
- **Session insights** - Learnings, failures, and workarounds
|
||||
- **Skill evolution** - Suggested protocol improvements
|
||||
|
||||
---
|
||||
|
||||
## Directory Structure
|
||||
|
||||
```
|
||||
knowledge_base/lac/
|
||||
├── optimization_memory/ # What worked for what geometry
|
||||
│ ├── bracket.jsonl
|
||||
│ ├── beam.jsonl
|
||||
│ └── mirror.jsonl
|
||||
├── session_insights/ # Learnings from sessions
|
||||
│ ├── failure.jsonl
|
||||
│ ├── success_pattern.jsonl
|
||||
│ ├── user_preference.jsonl
|
||||
│ └── protocol_clarification.jsonl
|
||||
└── skill_evolution/ # Protocol improvements
|
||||
└── suggested_updates.jsonl
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## When to Use LAC
|
||||
|
||||
### At Session Start
|
||||
Query LAC for relevant prior knowledge:
|
||||
|
||||
```python
|
||||
from knowledge_base.lac import get_lac
|
||||
|
||||
lac = get_lac()
|
||||
|
||||
# Before starting a bracket optimization
|
||||
similar = lac.query_similar_optimizations(
|
||||
geometry_type="bracket",
|
||||
objectives=["mass"],
|
||||
converged_only=True
|
||||
)
|
||||
|
||||
# Get method recommendation
|
||||
rec = lac.get_best_method_for("bracket", n_objectives=1)
|
||||
if rec:
|
||||
print(f"Recommended: {rec['method']} (success rate: {rec['success_rate']:.0%})")
|
||||
|
||||
# Get relevant insights
|
||||
insights = lac.get_relevant_insights("bracket mass optimization")
|
||||
```
|
||||
|
||||
### During Session
|
||||
Record learnings as they occur:
|
||||
|
||||
```python
|
||||
# Record a failure and its solution
|
||||
lac.record_insight(
|
||||
category="failure",
|
||||
context="Modal analysis with CMA-ES sampler",
|
||||
insight="CMA-ES struggles with discrete frequency targets. TPE works better.",
|
||||
confidence=0.8,
|
||||
tags=["cma-es", "modal", "frequency"]
|
||||
)
|
||||
|
||||
# Record a success pattern
|
||||
lac.record_insight(
|
||||
category="success_pattern",
|
||||
context="Bracket optimization with 5+ design variables",
|
||||
insight="20 startup trials before TPE improves convergence by 30%",
|
||||
confidence=0.85,
|
||||
tags=["tpe", "startup_trials", "bracket"]
|
||||
)
|
||||
|
||||
# Record user preference
|
||||
lac.record_insight(
|
||||
category="user_preference",
|
||||
context="Report generation",
|
||||
insight="User prefers Pareto plots with actual values instead of normalized",
|
||||
confidence=0.9,
|
||||
tags=["plotting", "pareto", "reporting"]
|
||||
)
|
||||
```
|
||||
|
||||
### At Session End
|
||||
Record optimization outcomes:
|
||||
|
||||
```python
|
||||
lac.record_optimization_outcome(
|
||||
study_name="bracket_v3",
|
||||
geometry_type="bracket",
|
||||
method="TPE",
|
||||
objectives=["mass"],
|
||||
design_vars=4,
|
||||
trials=100,
|
||||
converged=True,
|
||||
convergence_trial=67,
|
||||
best_value=2.34,
|
||||
notes="Good convergence with 20 startup trials"
|
||||
)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Insight Categories
|
||||
|
||||
| Category | Use When | Example |
|
||||
|----------|----------|---------|
|
||||
| `failure` | Something failed and you found the cause | "CMA-ES fails on discrete targets" |
|
||||
| `success_pattern` | An approach worked particularly well | "TPE with n_startup=20 converges faster" |
|
||||
| `user_preference` | User expressed a preference | "User prefers minimal output" |
|
||||
| `protocol_clarification` | A protocol needed interpretation | "SYS_12 unclear on Zernike subcase numbering" |
|
||||
| `performance` | Performance-related observation | "GNN inference 100x faster than FEA" |
|
||||
| `workaround` | Found a workaround for a known issue | "Load _i.prt before UpdateFemodel()" |
|
||||
|
||||
---
|
||||
|
||||
## Protocol Update Suggestions
|
||||
|
||||
When you discover a protocol could be improved:
|
||||
|
||||
```python
|
||||
lac.suggest_protocol_update(
|
||||
protocol="SYS_15_METHOD_SELECTOR.md",
|
||||
section="Modal Optimization",
|
||||
current_text="Use TPE or CMA-ES for frequency optimization",
|
||||
suggested_text="Use TPE for frequency optimization. CMA-ES struggles with discrete frequency targets.",
|
||||
reason="Discovered during bracket_modal study - CMA-ES failed to converge"
|
||||
)
|
||||
```
|
||||
|
||||
Review pending updates:
|
||||
```python
|
||||
pending = lac.get_pending_updates()
|
||||
for p in pending:
|
||||
print(f"- {p['protocol']}: {p['reason']}")
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## CLI Commands
|
||||
|
||||
```bash
|
||||
# View LAC statistics
|
||||
python knowledge_base/lac.py stats
|
||||
|
||||
# Generate full report
|
||||
python knowledge_base/lac.py report
|
||||
|
||||
# View pending protocol updates
|
||||
python knowledge_base/lac.py pending
|
||||
|
||||
# Query insights for a context
|
||||
python knowledge_base/lac.py insights "bracket mass optimization"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Integration with Protocols
|
||||
|
||||
### Method Selection (SYS_15)
|
||||
Before recommending a method, check LAC:
|
||||
```python
|
||||
rec = lac.get_best_method_for(geometry_type, n_objectives)
|
||||
# Use recommendation if available, else fall back to protocol defaults
|
||||
```
|
||||
|
||||
### Troubleshooting (OP_06)
|
||||
Check if this error has been seen before:
|
||||
```python
|
||||
insights = lac.get_relevant_insights(error_message, categories=["failure", "workaround"])
|
||||
```
|
||||
|
||||
### Study Creation (OP_01)
|
||||
Query similar past studies for configuration hints:
|
||||
```python
|
||||
similar = lac.query_similar_optimizations(geometry_type, objectives)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Record failures immediately** - Don't wait until session end
|
||||
2. **Be specific** - Include enough context to be useful later
|
||||
3. **Tag appropriately** - Tags enable better retrieval
|
||||
4. **Set confidence** - Low (0.5) for hunches, high (0.9) for verified patterns
|
||||
5. **Suggest protocol updates** - Don't just note issues, propose fixes
|
||||
|
||||
---
|
||||
|
||||
## Example Session Flow
|
||||
|
||||
```
|
||||
SESSION START
|
||||
│
|
||||
├── Query LAC for similar optimizations
|
||||
├── Query LAC for relevant insights
|
||||
├── Note any pending protocol updates
|
||||
│
|
||||
├── [User requests work]
|
||||
│
|
||||
├── During work:
|
||||
│ ├── Encounter issue? → Record to failure.jsonl
|
||||
│ ├── Find workaround? → Record to workaround.jsonl
|
||||
│ ├── User states preference? → Record to user_preference.jsonl
|
||||
│ └── Protocol unclear? → Record to protocol_clarification.jsonl
|
||||
│
|
||||
└── SESSION END
|
||||
├── Record optimization outcome (if optimization ran)
|
||||
├── Suggest any protocol updates discovered
|
||||
└── Summarize learnings for user
|
||||
```
|
||||
Reference in New Issue
Block a user