Skip to main content
Version: 1.0.0
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 hookuseFeatureFlag (client-side, TanStack Query–backed)
  • RPCpf_check_feature_flag (server-side / edge functions)
All flags are tenant-scoped or global. The system fails safe — if evaluation errors, 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

Variants are configured as { 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

or

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


  • 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