Status: ✅ Complete
Module: PF (Platform Foundation)
Spec:
specs/pf/specs/PF-45-feature-flags-experimentation.md
Overview
PF-45 provides a centralized feature flag system for progressive rollouts, kill-switches, and A/B testing across all cores. Flags are evaluated via:- React hook —
useFeatureFlag(client-side, TanStack Query–backed) - RPC —
pf_check_feature_flag(server-side / edge functions)
enabled defaults to false.
Consumer Guide: React Hook
Import
Signature
Caching
Examples
Boolean flag (kill-switch / feature gate)
Percentage rollout
A/B test with variants
{ key: string; weight: number }[] on the flag. The RPC assigns a variant based on weighted random distribution, deterministic per user.
Consumer Guide: RPC (Edge Functions / Server-Side)
Function
Return shape
Usage from an edge function
Flag Key Convention
All flag keys follow the pattern:
Keys must be lowercase, underscore-separated, and prefixed with the owning core abbreviation.
Consuming Cores
Anti-Patterns
❌ Direct table query from another core
❌ Separate caching layer
❌ Hardcoded flag checks
❌ Flag evaluation in render-critical paths without loading state
Related Documentation
- Spec:
specs/pf/specs/PF-45-feature-flags-experimentation.md - Plan:
specs/pf/plans/PF-45-feature-flags-experimentation-PLAN.md - Tasks:
specs/pf/tasks/PF-45-TASKS.md - Platform AGENTS:
src/platform/AGENTS.md§ Feature Flags - Cross-core integrations:
docs/architecture/integrations/CROSS_CORE_INTEGRATIONS.md