You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
What would it take to let behavior drive Workflows? #215
What would it take to let behavior drive Workflows: trigger on entering or leaving a cohort, trigger when a person goes inactive for N days, and use behavioral cohorts as Broadcast audiences?
Why behavioral cohorts are rejected as Broadcast audiences today, and what calculating them at send time would cost.
What the CDP has for scheduled or batch triggers and cohort membership changes, and what an "inactive for N days" trigger needs (a scheduled query per team, a per-person timer, or something else).
Whether a person-level feature flag condition in a workflow is cheap to add.
Answer with a design option per capability, each with its rough size and its main risk.
Lane orphaned: the worker's temporary worktree was removed while its sub-agents ran. Unassigned; the conductor redispatches it in a persistent worktree.
Sizes are guesses (S about a week, M two to three weeks). Evidence is the code on master.
Capability
Design option
Size
Main risk
Behavioral cohorts as Broadcast audiences
Recalculate the cohort when the send starts, then pin that version for every audience page. Today the audience query reads precalculated raw_cohort_people, recalculated oldest-first at most every 15 min, so relative-time behavior drifts. Where realtime cohorts run, read the fresh cohort_membership store instead.
M
The send waits on a cohort calculation; a slow or failing calculation delays or blocks the broadcast
Trigger on entering or leaving a cohort
New cohort trigger: a consumer on the existing cohort_membership_changed stream (realtime cohort pipeline already emits per-person entered/left), live changes only, builds invocations with the batch resolver's helper and trigger masking
M
Only realtime-eligible cohorts (performed_event/performed_event_multiple plus person properties) on teams the realtime pipeline covers
Inactive for N days
A preset on the cohort trigger: realtime cohort "did not perform X in last N days", trigger on entered. The pipeline's sweep already moves people out when a window expires. Fallback without realtime: daily schedule trigger with an audience on persons.last_seen_at plus "One time" masking
S on top of the cohort trigger (fallback S–M)
Same coverage limit; the fallback depends on the opt-in person_last_seen_at_enabled setting
Person-level feature flag condition
New feature_flag condition in conditional_branch, evaluated in the CDP by calling the flags service /flags for the run's distinct_id, lazily like cohort membership
S–M
A network call per evaluation on the run path, and the CDP needs a flags service credential
Two traps found: a flag property filter compiles to constant true in property_to_expr, so a flag condition must not go through the normal filter path; and seed/reconcile membership changes must never fire the cohort trigger, or a new cohort enrolls every member at once.
Suggested order: cohort trigger, inactivity preset, flag condition, then behavioral Broadcast audiences.
Open questions for Michael: how far the realtime cohort pipeline reaches today, and how a flags service credential gets to the CDP.
Activity
Silthus commentedon Oct 3, 2026
Claimed by a Claude Code research worker (Opus 5.5)
Silthus commentedon Oct 3, 2026
Lane orphaned: the worker's temporary worktree was removed while its sub-agents ran. Unassigned; the conductor redispatches it in a persistent worktree.
Silthus commentedon Oct 3, 2026
Claimed by a Claude Code research worker (Opus 5.5), redispatch
Silthus commentedon Oct 3, 2026
Resolution. Full findings with code citations: https://github.com/Silthus/posthog/blob/research/behavioral-triggers/research-behavioral-triggers.md
Sizes are guesses (S about a week, M two to three weeks). Evidence is the code on
master.raw_cohort_people, recalculated oldest-first at most every 15 min, so relative-time behavior drifts. Where realtime cohorts run, read the freshcohort_membershipstore instead.cohorttrigger: a consumer on the existingcohort_membership_changedstream (realtime cohort pipeline already emits per-personentered/left), live changes only, builds invocations with the batch resolver's helper and trigger maskingperformed_event/performed_event_multipleplus person properties) on teams the realtime pipeline coversentered. The pipeline's sweep already moves people out when a window expires. Fallback without realtime: dailyscheduletrigger with an audience onpersons.last_seen_atplus "One time" maskingperson_last_seen_at_enabledsettingfeature_flagcondition inconditional_branch, evaluated in the CDP by calling the flags service/flagsfor the run's distinct_id, lazily like cohort membershipTwo traps found: a
flagproperty filter compiles to constant true inproperty_to_expr, so a flag condition must not go through the normal filter path; and seed/reconcile membership changes must never fire the cohort trigger, or a new cohort enrolls every member at once.Suggested order: cohort trigger, inactivity preset, flag condition, then behavioral Broadcast audiences.
Open questions for Michael: how far the realtime cohort pipeline reaches today, and how a flags service credential gets to the CDP.