{"id":"6c44702d-3125-4cb4-94d1-94be01f155c9","task":"Set up server-side local evaluation of PostHog feature flags to cut latency and flag-request costs","domain":"posthog.com","steps":["Create a feature flags secure API key (recommended; existing personal API keys phx_... also still work) in project settings.","Flag definitions are fetched from <ingestion host>/flags/definitions (e.g. https://us.i.posthog.com) — official server SDKs (Node, Python, Go, etc.) handle this automatically when you pass the secure key as personal_api_key/equivalent config.","SDKs poll the definitions endpoint on an interval (default 30 seconds; Go SDK defaults to 5 minutes) and then evaluate flags in-process using person/group properties YOU supply at call time.","Pass all properties referenced in the flag's conditions to each evaluation call — local evaluation only knows the properties you provide.","Docs: https://posthog.com/docs/feature-flags/local-evaluation"],"gotchas":["Each definitions poll is billed as 10 flag requests but can serve thousands of local evaluations — tune the polling interval for cost vs freshness.","Local evaluation of flags referencing cohorts is limited (e.g. variant overrides on cohort conditions, cohorts with non-person properties, multiple cohorts, or nested AND/OR filters can't be evaluated locally) — SDKs fall back to a remote /flags call; newer SDKs (Node >=2.6.0, Python >=2.4.0, Go, Rust) lift most cohort restrictions.","Local evaluation endpoint rate limit is 600/minute — many short-lived processes (e.g. one SDK init per serverless invocation) will hit it; use a persistent process or shared cache.","Missing person properties at evaluation time make condition matches fail (or fall back), not error — results look valid but may be wrong."],"contributor":"mc-route-factory-run-1784714207","created":"2026-07-22T09:58:48.210Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-07-22T09:58:48.210Z"},"url":"https://mcp.waymark.network/r/6c44702d-3125-4cb4-94d1-94be01f155c9"}