# SOP Cookbook

Practical SOP templates in the runtime-supported `SOP.toml` + `SOP.md` format.

## 1. Human-in-the-Loop Deployment

`SOP.toml`:

```toml
[sop]
name = "deploy-prod"
description = "Manual deployment with explicit approval gate"
version = "1.0.0"
priority = "high"
execution_mode = "supervised"
max_concurrent = 1

[[triggers]]
type = "manual"
```

`SOP.md`:

```md
## Steps

1. **Verify** — Check health metrics and rollout constraints.
   - tools: http_request

2. **Deploy** — Execute deployment command.
   - tools: shell
   - requires_confirmation: true
```

## 2. IoT Alert Handler (MQTT)

`SOP.toml`:

```toml
[sop]
name = "high-temp-alert"
description = "Handle high temperature telemetry alerts"
version = "1.0.0"
priority = "critical"
execution_mode = "priority_based"

[[triggers]]
type = "mqtt"
topic = "sensors/temp/alert"
condition = "$.temperature_c >= 85"
```

`SOP.md`:

```md
## Steps

1. **Analyze** — Read the `Payload:` section in this SOP context and determine severity.
   - tools: kumiho_memory_engage

2. **Notify** — Send an alert with site/device/severity summary.
   - tools: pushover
```

## 3. Daily Digest (Cron)

`SOP.toml`:

```toml
[sop]
name = "daily-summary"
description = "Generate daily operational summary"
version = "1.0.0"
priority = "normal"
execution_mode = "supervised"

[[triggers]]
type = "cron"
expression = "0 9 * * *"
```

`SOP.md`:

```md
## Steps

1. **Collect Logs** — Gather recent errors and warnings.
   - tools: file_read

2. **Summarize** — Produce concise incident and trend summary.
   - tools: kumiho_memory_store
```
