Matrix: M28M29
Open in panel — /app/shaping
Sending

Kumo Shaping

Kumo Shaping is PostMTA's epoch-based sending-rate control system. It replaces iptables-based throttling with a Kumo-native engine that models ISP delivery windows, reputation tiers, and warmup curves as first-class primitives. Every subuser operates inside a shaping epoch that governs how many messages per day may be injected into the transport layer.

Matrix refs: M28 (Shaping Policy)   M29 (Warmup Ladder)

Kumo-Native vs iptables

Legacy MTA shaping used iptables rules to meter connection counts and message injection rates at the kernel level. This approach is opaque, stateless, and ISP-agnostic. Kumo Shaping runs entirely in user space and exposes a programmable API.

Dimensioniptables ThrottlingKumo Shaping
StatefulnessStateless countersEpoch-aware state machine per subuser
ISP modellingNonePer-ISP delivery windows and hourly buckets
Reputation couplingIndirect, manualAutomatic: reputation score gates epoch progression
API surfaceNone (CLI only)REST: apply policy, override, rollback
WarmupSeparate scriptBuilt into epoch ladder
Audit trailsyslog onlyFull event log with operator identity

Epoch Model

Each subuser occupies exactly one active epoch at any given time. The epoch encodes three signals:

Epoch State Fields

FieldTypeDescription
subuser_idstringSubuser that owns this epoch
sent_todayintegerMessages injected today (resets at 00:00 UTC)
epoch_numberinteger 1–10Current warmup tier
next_epoch_atISO 8601Scheduled epoch transition time
rate_limitintegerMessages-per-day cap for current epoch
warmup_stagestringNamed stage (stage_1 … stage_10)
reputation_scorefloat 0–1Latest computed reputation score
policystringActive policy name (conservative / moderate / aggressive)

Apply Shaping Policy via API

Operators can apply a named shaping policy to a subuser. Valid policy names are conservative, moderate, and aggressive. Each policy encodes a different warmup ladder trajectory.

POST /v1/shaping/apply
Content-Type: application/json
Authorization: Bearer pmta_live_...

{
  "subuser_id": "sub_usr_01HX...",
  "policy": "aggressive",
  "override": false,
  "reason": "campaign_launch"
}

Response:

{
  "epoch_id": "ep_01HX9P7N3M4Q6R8T2V4W6Y8",
  "subuser_id": "sub_usr_01HX...",
  "policy": "aggressive",
  "sent_today": 0,
  "epoch_number": 1,
  "next_epoch_at": "2026-07-18T12:00:00Z",
  "rate_limit": 5000,
  "warmup_stage": "stage_1",
  "applied_by": "operator@example.com",
  "applied_at": "2026-07-18T00:00:00Z"
}

Warmup Ladder

New subusers or subusers with degraded reputation start at epoch 1. Each epoch has a defined daily send cap and a minimum dwell time before promotion is allowed. Promotion requires a positive reputation delta and no active suppression flags. Demotion occurs automatically if hard bounce rate exceeds 3% or complaint rate exceeds 0.1% over a rolling 7-day window.

EpochStage NameDaily CapMin Dwell (days)Reputation Floor
1cold_start10010.00
2seed_150020.10
3seed_22,00030.25
4seed_35,00040.40
5early_volume15,00050.55
6growth_140,00070.65
7growth_2100,000100.75
8mid_volume250,000140.82
9high_volume500,000210.90
10full_warmunlimited0.95
Promotion gates: To advance from epoch N to N+1, a subuser must satisfy all of: (a) minimum dwell time elapsed, (b) rolling 7-day hard bounce rate below 2%, (c) complaint rate below 0.05%, (d) at least 50% of current daily cap used on average over the last 3 days.

Manual Epoch Override

Operators may manually promote or demote a subuser's epoch using the override endpoint. Overrides trigger a mandatory cooldown period of 30 minutes (promotions) or 120 minutes (demotions) before another override can be issued, preventing accidental rapid cycling.

POST /v1/shaping/override
Content-Type: application/json
Authorization: Bearer pmta_live_...

{
  "subuser_id": "sub_usr_01HX...",
  "target_epoch": 5,
  "reason": "emergency_auction_reminder",
  "duration_minutes": 60
}

Response:

{
  "override_id": "ovr_01HX...",
  "subuser_id": "sub_usr_01HX...",
  "previous_epoch": 3,
  "target_epoch": 5,
  "cooldown_until": "2026-07-18T04:30:00Z",
  "reason": "emergency_auction_reminder",
  "applied_at": "2026-07-18T03:30:00Z"
}
Cooldown enforcement: Override requests made during cooldown return HTTP 429 with cooldown_active and a retry_after timestamp. Always check cooldown_until before issuing consecutive overrides.

Suppression Pipeline Order

When a message is submitted to Kumo Shaping, it passes through a deterministic filter stack. The order matters:

  1. Global blocklist — Hard blocks from internal blocklists, RFC 2606 reserves, and PMH-SEC-026 policy.
  2. Subuser suppression list — Recipient addresses explicitly suppressed by the subuser.
  3. Complaint cache — FBL-derived complaints with a 30-day TTL from last seen date.
  4. Bounce cache — Known hard/soft bounces with TTLs of 7 days (hard) and 1 day (soft).
  5. Epoch check — Is sent_today below current epoch cap? If yes, proceed; otherwise queue.
  6. Reputation gate — Is reputation_score ≥ epoch_number × 0.1? If yes, proceed.
  7. ISP-specific routing — Apply per-ISP delivery windows and concurrency limits.
  8. Inject to transport — Message is handed off to the MTA transport layer.

Messages that fail the epoch check or reputation gate are held in the shaping queue and retried at the next epoch window boundary (top of each UTC hour) without 计 time penalty against the subuser.

Reputation-Shape Coupling

Kumo Shaping enforces a hard coupling between the reputation score and the maximum accessible epoch. This prevents high-volume subusers from continuing to send at full capacity when their reputation is degrading.

Checking Epoch Status via SQL

SELECT
  subuser_id,
  sent_today,
  epoch_number,
  next_epoch_at,
  warmup_stage,
  reputation_score
FROM shaping_epochs
WHERE subuser_id = 'sub_usr_01HX...'
  AND date(next_epoch_at) = CURRENT_DATE
ORDER BY epoch_number DESC
LIMIT 10;

ISP-Specific Delivery Windows

Kumo Shaping enforces per-ISP delivery windows that reflect each ISP's accepted sending patterns. These windows are hard limits enforced at the transport layer, not just shaping limits.

ISPPeak WindowOff-Peak CapConcurrency LimitNotes
Gmail06:00–22:00 local recipient TZ1,000/hr off-peak100 simultaneous connectionsEnforces RFC 5321 size limits (50 MB)
Microsoft / Outlook07:00–21:00 local500/hr off-peak50 connectionsThrottles at 3rd sequential day of high volume
Yahoo08:00–20:00 local300/hr off-peak30 connectionsRequires DMARC p=reject for best routing
Apple iCloud07:00–22:00 local200/hr off-peak20 connectionsStrict spam button threshold (0.08%)
Generic / OtherNo restrictionNo restrictionUnlimitedFollows domain MX record TTLs
Local timezone detection: ISP delivery windows use the recipient domain MX record's geographic cluster to infer local time. This is approximate; for compliance-critical sends (e.g., appointment reminders) explicitly schedule within the known recipient time zone.

Queue Priority Tiers

Messages held by Kumo Shaping (waiting for epoch window or reputation gate) are ordered by queue priority. Priority is set at injection time and cannot be changed while in queue. Higher priority messages are processed first when the shaping gate opens.

PriorityNameSourceMax Queue Time
1 (highest)criticalSystem-generated (e.g., MFA tokens, password resets)15 minutes
2transactionalAPI messages with priority: transactional1 hour
3standardDefault for all normal sends24 hours
4marketingCampaign sends with priority: marketing72 hours
5 (lowest)batchBulk imports and list uploads7 days

Messages that exceed their maximum queue time are moved to the DLQ with reason max_queue_time_exceeded. Transactional and critical messages are never downqueued to a lower priority tier.

Monitoring Shaping State

Real-time Metrics API

GET /v1/shaping/metrics?subuser_id=sub_usr_01HX...
Authorization: Bearer pmta_live_...

{
  "subuser_id": "sub_usr_01HX...",
  "current_epoch": 5,
  "sent_today": 8432,
  "epoch_cap": 15000,
  "pct_used": 56.2,
  "reputation_score": 0.72,
  "epoch_promotion_due": "2026-07-19T00:00:00Z",
  "active_queue_messages": 312,
  "queue_breakdown": {
    "critical": 0,
    "transactional": 12,
    "standard": 245,
    "marketing": 55,
    "batch": 0
  },
  "suppression_snapshot": {
    "addresses_suppressed": 1842,
    "addresses_suppressed_today": 14
  }
}

Promotion and Demotion Alerts

Configure alerting on the following shaping events to monitor subuser health:

Policy Reference

PolicyWarmup DurationStarting EpochAuto-promotion
conservative45 days1Enabled, slower dwell
moderate21 days2Enabled, standard dwell
aggressive7 days3Enabled, fast dwell
manualNoneCurrent epochDisabled — operator-driven only