<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->

# API Reference — Implementing Secure Email Gateway Tuning

## Agent Script

### Commands

| Command | Description |
|---|---|
| `node agent.js audit-config --platform <provider> --config-export <json>` | Audit SEG config |
| `node agent.js audit-lists --allow-list <csv> --block-list <csv>` | Audit allow/block lists |
| `node agent.js analyze-quarantine --quarantine-log <csv>` | Analyze quarantine |
| `node agent.js optimize-policies --config <json> --incident-log <csv>` | Optimize policies |
| `node agent.js tune-impersonation --vip-list <file> --platform <provider>` | Tune impersonation |
| `node agent.js generate-transport-rules --gap-type <type>` | Generate transport rules |
| `node agent.js analyze-fp --quarantine-log <csv> --release-log <csv>` | Analyze false positives |
| `node agent.js generate-allow-rule --sender <email> --scope <email> --reason <text>` | Scoped allow rule |
| `node agent.js tuning-report --metrics <json> --period <period> --output <file>` | Tuning report |
| `node agent.js compare-tuning --before <json> --after <json>` | Compare pre/post tuning |

### Examples

```bash
node agent.js audit-config --platform m365 --config-export /tmp/config.json
node agent.js audit-lists --allow-list /tmp/allow.csv --block-list /tmp/block.csv
node agent.js generate-transport-rules --gap-type external-reply-to
node agent.js generate-allow-rule --sender "news@vendor.com" --scope "marketing@co.com" --reason "Newsletter"
```
