rspace-online/backlog/tasks/task-148 - Concentration-al...

53 lines
1.9 KiB
Markdown

---
id: TASK-148
title: Concentration alerts for space admins
status: To Do
assignee: []
created_date: '2026-04-16 18:56'
labels:
- governance
- encryptid
- power-indices
- notifications
dependencies:
- TASK-144
references:
- src/encryptid/power-indices.ts
- src/encryptid/trust-engine.ts
- src/encryptid/server.ts
priority: medium
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
Alert space admins when power concentration exceeds healthy thresholds.
## What
The power indices engine already computes Gini coefficient and HHI per space+authority every 5 minutes. Surface warnings when:
- HHI > 0.25 (highly concentrated — fewer than ~4 effective voters)
- Gini > 0.6 (severe inequality — top players hold most power)
- Single player Banzhaf > 0.5 (near-dictator — one person controls majority)
## Primitive: Concentration Monitor
- New function `checkConcentrationAlerts(spaceSlug)` in `power-indices.ts`
- Called after `computeSpacePowerIndices()` in trust engine cycle
- When threshold crossed: create notification via existing `createNotification()` for space admins
- Notification: category='system', event_type='power_concentration_warning'
- Debounce: only alert once per 24h per space+authority (store `last_alert_at` in power_indices or separate field)
## Implementation
- `src/encryptid/power-indices.ts`: Add `checkConcentrationAlerts()` function
- `src/encryptid/trust-engine.ts`: Call after power index computation
- Uses existing notification system — zero new infrastructure
- ~40 lines, zero new files, zero new tables
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [ ] #1 Alert when HHI > 0.25, Gini > 0.6, or single-player Banzhaf > 0.5
- [ ] #2 Notification sent to space admins via existing notification system
- [ ] #3 24h debounce per space+authority to avoid spam
- [ ] #4 Notification includes specific metric + suggestion (e.g. 'encourage more delegation diversity')
<!-- AC:END -->