# Cosmic Plugin Decision Matrix

Use this matrix for Cangqiong, Xinghan, and Xingkong Flagship.

## UI and Form Plugins

- Form UI, field linkage, control interaction: form plugin.
- Bill UI, submit/audit button behavior, bill page logic: bill plugin.
- List selection, batch operation entry points, list filters: list plugin.
- Left-tree-right-table scenes: tree list plugin.
- UI control state belongs to the view layer. Data read/write belongs to the model layer.
- Register listeners in listener registration lifecycle, not in initialization.

## Operation and Data Plugins

- Save, audit, submit, status transition, validation, rollback: operation plugin or validator.
- Operation plugins do not have UI context; do not call `getView()` from operation service plugins.
- Declare required fields in operation preparation hooks before reading them in validators or operation plugins.
- Modify the transaction data packet directly inside operation transaction hooks; do not call independent save APIs inside the same hook unless explicitly required and reviewed.

## Conversion and Writeback

- Push/downstream conversion/source tracing: convert plugin.
- BOTP writeback stage: writeback plugin.
- Verify source and target entity metadata before field mapping.

## Backend and Integration

- Scheduled jobs and background tasks: task plugin.
- Workflow/approval flow hooks: workflow plugin.
- External integration: OpenAPI controller or service layer, depending on entry point.
- Reports and data analysis: report form plugin or report data plugin.

## Data Access

- Existence check: query an ID rather than loading a full data package.
- Small field reads: use query APIs.
- Full hierarchical package: load business data package.
- Large data streams: use DataSet and close resources.
- Batch load outside loops; avoid per-row service calls.
