---
applyTo: "MainShell/Recipe/**/*.cs,MainShell/Parameter/**/*.cs,MainShell/Log/**/*.cs,MainShell/Filewritable/**/*.cs,MainShell/Process/**/*.cs"
---

# Recipe, Persistence, and Logging Instructions

## Recipe System
Recipe hierarchy includes:
- IRecipe
- RecipeBase
- SubstrateRecipe
- WaferRecipe
- CarrierRecipe
- ProcessRecipe

Use existing recipe abstractions and managers:
- RecipeManager
- RecipeWrapManager

Do not bypass repository recipe patterns by creating incompatible configuration systems.

## 中文说明
配方系统遵循现有层级：
- `IRecipe`
- `RecipeBase`
- `SubstrateRecipe`
- `WaferRecipe`
- `CarrierRecipe`
- `ProcessRecipe`

应优先复用：
- `RecipeManager`
- `RecipeWrapManager`

不要绕开现有配方体系再新建一套不兼容的配置系统。

## Parameter and Process Input Rules
- Prefer reading process inputs from recipe objects and formal managers
- Do not pull process parameters from UI state when repository recipe/domain objects already exist
- Keep process input sources explicit and traceable

## 中文说明
参数和流程输入规则：
- 优先从配方对象和正式管理器中读取流程输入
- 如果已有正式领域对象，不要从 UI 状态中取流程参数
- 输入来源要明确、可追踪

## File Persistence Rules
Persistence follows:
- IFileWritable
- FileWriteBase
- JsonFileWritableBase

Use:
- FileWriteQueue for async queued file writes
- Newtonsoft.Json for JSON serialization

Reuse IgnorePropertiesResolver when selective serialization is needed.

## 中文说明
文件持久化遵循现有架构：
- `IFileWritable`
- `FileWriteBase`
- `JsonFileWritableBase`

应优先使用：
- `FileWriteQueue` 进行异步写入队列管理
- `Newtonsoft.Json` 进行 JSON 序列化
- 需要选择性序列化时复用 `IgnorePropertiesResolver`

## Logging Rules
- Use `LogNameDefine` for log names
- Use `LogManager` for unified log management
- Keep logs consistent with existing MaxWellGeneralLog usage

## 中文说明
日志规则：
- 日志名称统一在 `LogNameDefine` 中定义
- 通过 `LogManager` 统一管理
- 保持与现有 `MaxWellGeneralLog` 用法一致

## Logging Expectations
Generated code should:
- log major workflow and hardware steps
- log failures with enough context
- preserve traceability for production and troubleshooting

## 中文说明
生成代码时，日志应满足：
- 关键流程步骤和硬件动作有日志
- 失败日志包含足够上下文
- 能支持生产追溯和现场排障
