Skip to content

feat(feature-flags): add the wizard feature-flags command - #1322

Merged
johncwaters merged 13 commits into
mainfrom
johnw/feature-flags-command
Oct 14, 2026
Merged

johncwaters merged 13 commits into
mainfrom
johnw/feature-flags-command

Conversation

@johncwaters

@johncwaters johncwaters commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Feedback wanted: ready to merge. Approve or request changes. The command works once context-mill 1.57.0 (PostHog/context-mill#426) is published and PostHog/charts#16288 is deployed.

Setting up a first feature flag means creating it in PostHog, installing the right SDKs, and evaluating it correctly: once per request, with the identified distinct id, the key in one place, and the evaluation reported back. The wizard has no command for this.

Companion PRs: context-mill agents (PostHog/context-mill#428, merged), context-mill step skill (PostHog/context-mill#405, merged), wizard-workbench grading (PostHog/wizard-workbench#4483, merged), and gateway admission (https://github.com/PostHog/charts/pull/16288).

Changes

  • wizard feature-flags: a native command running the feature-flags orchestrator flow. Its agents (seed, install, init, create-flag, evaluate, report) are fetched from context-mill like every other flow.
  • The seed decides which sides the app has, backend and/or frontend. A side counts only when the app already has code there, so server-rendered templates that load no JavaScript are backend-only.
  • create-flag makes one example flag per side, wizard-example-backend-flag and wizard-example-frontend-flag, inactive at 0% rollout, and reuses an existing flag with the same key unchanged.
  • evaluate adds one evaluation per flag on its own side, with the keys in a constants module and the same distinct id on both sides, using the integration-v2-feature-flags-step skill for the framework's flag docs.
  • report publishes the setup report to a PostHog notebook (handoffNotebook), and the outro links it. The outro's next steps say how to trigger an evaluation, find it on the flag's page, and turn the flags on.
  • TUI: a feature-flags-intro screen and a run-screen learn deck explaining what flags are (gating code, gradual rollout, targeting, the off switch, experiments) and what the run sets up. The intro offers only Cancel while detection runs, when no framework is detected, when the framework version is unsupported, or for Kotlin Multiplatform, so a run never reaches login without a supported framework. Headless runs abort the same cases in ciPreRun.
  • The command gets its own OAuth scope list (feature_flag:read, feature_flag:write), registry entry, and e2e profile.

Before merge: feature-flags must be in WIZARD_GATEWAY_PROGRAM_IDS (PostHog/charts#16288), and a gateway operator must add a wizard:feature-flags budget row. Until then the gateway refuses the mint with program_unknown.

Test plan

  • pnpm typecheck, pnpm lint, and pnpm test pass.
  • wizard-workbench pnpm wizard-ci feature-flags/<app> --e2e, served feat(feature-flags): add the feature-flags orchestrator agents context-mill#428 locally, passed every check:
    • next-js/15-app-router-saas created both flags inactive at 0% with the keys in lib/posthog-feature-flags.ts.
    • django/django3-saas created only the backend flag, with the key in dashboard/feature_flags.py.
    • Both outros linked the report notebook and listed the three next steps, and neither run wrote a report file.
  • Checked the intro, learn deck, and outro in the e2e snapshots.

LLM context

Written with Claude Code.

@github-actions

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci ai-observability
  • /wizard-ci basic-integration
  • /wizard-ci mcp-analytics
  • /wizard-ci replay-vision
  • /wizard-ci revenue
  • /wizard-ci self-driving
  • /wizard-ci warehouse
  • /wizard-ci warehouse-seeded

Test an individual app:

  • /wizard-ci ai-observability/anthropic
  • /wizard-ci ai-observability/google-adk
  • /wizard-ci ai-observability/groq
Show more apps
  • /wizard-ci ai-observability/manual-capture
  • /wizard-ci ai-observability/openai
  • /wizard-ci ai-observability/openai-agents
  • /wizard-ci ai-observability/opentelemetry
  • /wizard-ci ai-observability/vercel-ai
  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/flutter
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci replay-vision/javascript-node
  • /wizard-ci replay-vision/next-js
  • /wizard-ci replay-vision/react-vite
  • /wizard-ci revenue/stripe
  • /wizard-ci self-driving/astro
  • /wizard-ci self-driving/fastapi
  • /wizard-ci self-driving/nuxt
  • /wizard-ci self-driving/react-router
  • /wizard-ci self-driving/sveltekit
  • /wizard-ci warehouse/monorepo-env
  • /wizard-ci warehouse/multi-source-next
  • /wizard-ci warehouse/stripe-node
  • /wizard-ci warehouse/zero-source
  • /wizard-ci warehouse-seeded/next-stripe
  • /wizard-ci warehouse-seeded/next-stripe-declined

Test against a Context Mill branch:

  • /wizard-ci all context-mill:my-branch

Add context-mill:<branch> to any command above to pin the Context Mill branch. It defaults to main.

Results will be posted here when complete.

@johncwaters
johncwaters force-pushed the johnw/feature-flags-command branch from adab746 to f3eb515 Compare September 23, 2026 22:24
@johncwaters
johncwaters force-pushed the johnw/feature-flags-command branch 2 times, most recently from 34213e2 to b70460a Compare September 24, 2026 18:55
@johncwaters
johncwaters marked this pull request as ready for review September 24, 2026 20:38
@johncwaters
johncwaters requested a review from a team as a code owner September 24, 2026 20:38
@johncwaters
johncwaters force-pushed the johnw/feature-flags-command branch 2 times, most recently from b977652 to e745ea0 Compare September 28, 2026 13:42
Comment thread src/programs/feature-flags/prompts.ts Resolved
@veria-ai

veria-ai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

@johncwaters
johncwaters force-pushed the johnw/feature-flags-command branch 2 times, most recently from 12287c0 to 31a9b18 Compare September 30, 2026 12:37
@johncwaters johncwaters mentioned this pull request Sep 30, 2026
Adds `wizard feature-flags`: an orchestrator flow with bundled prompts that creates one example flag per side of the app (backend, frontend), inactive at 0%, evaluates each once on its own side, and writes a report with an optional check that the evaluations reach PostHog.
The feature-flags program gets its own intro screen, a run-screen learn deck explaining what flags are and what the run sets up, and sidebar tips, in place of the generic agent-skill screens.
Give feature-flags its own OAuth scope list and share the step skill id
between the evaluate prompt and the intro screen.
A Django run whose templates load no app JavaScript added a PostHog
snippet to host the frontend flag. The seed now defines the frontend by
JavaScript the app owns and loads, including through import maps or
Vite, and names script-less server templates as backend-only.
Point the feature-flags program, deck, intro screen and test at the
paths #1375 moved them to, and register the command in main.ts.
@johncwaters
johncwaters force-pushed the johnw/feature-flags-command branch from 31a9b18 to 52c59db Compare October 2, 2026 11:14
johncwaters added a commit to johncwaters/glimmervoid that referenced this pull request Oct 8, 2026
A live repair on PostHog/wizard#1322 committed its merge on keep-mergeable
through a temporary worktree, because the sandbox blocked writing the
repo's tracked .claude/skills files, and left the checkout HEAD detached at
the old pull request head. The handoff read HEAD and reported no-change.
The prompt tells the session to commit on keep-mergeable, so the handoff
now reads, bundles and fetches refs/heads/keep-mergeable.

Not-tested: a session that commits on a branch other than keep-mergeable is still dropped as no-change (review NIT, low confidence)
Confidence: high
Scope-risk: narrow
johncwaters and others added 2 commits October 8, 2026 17:39
Route feature-flags in the registry binding test, export the prompt parser
from the @agent entry for the bundled-prompt test, and tidy comments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@gewenyu99 gewenyu99 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall much better than the initial version!

I have some copy suggestions + questions about why there's another agent prompt pass in. I can't quite figure out why we needed this exception here.

I labelled my bot comments for your bot to address.

I think we can land this after these tweaks, great work!

Comment thread src/programs/feature-flags/index.ts Resolved
Comment thread src/programs/feature-flags/index.ts Resolved
Comment thread src/programs/feature-flags/prompts.ts Resolved
Comment thread src/programs/feature-flags/prompts.ts Resolved
johncwaters and others added 3 commits October 13, 2026 18:01
# Conflicts:
#	src/programs/program-step.ts
The feature-flags test imported @programs/program-registry, which lives in
the entry project that references feature-flags, so tsc -b failed with
TS6307 in the Lint job. Assert the program's own oauthScopeAdditions there
and move the registry-level scope check into program-registry.test.ts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tebook

Review on #1322 asked why feature-flags shipped its agent prompts inside the
wizard. Every other orchestrator flow loads them from context-mill, so the
bundled agentPrompts seam is gone and the agent layer, program-step.ts and
run-program.ts match main again. The prompts move to
context-mill/context/agents/feature-flags.

The report now goes through publish_handoff into a PostHog notebook
(handoffNotebook) instead of a file, and the in-run verify-flag check is
gone: it sat on a running agent and ingestion lag made it flaky. The outro
next steps say how to find the evaluation in PostHog instead.

KMP aborts before login, as in error-tracking, since its skill variants
carry no framework tag. The intro shows the Program row and the shorter
tagline, and the run deck follows the posthog-integration deck: third-person
voice, the status hint first, and a blank line above each code example.

Constraint: run.reportFile stays because ProgramRun requires it; the orchestrated outro never reads it
Constraint: needs the context-mill feature-flags prompts published before a run can start
Rejected: shared abortUnsupportedPlatform helper | would touch error-tracking and replay-vision, out of scope
Confidence: medium
Scope-risk: moderate
Not-tested: workbench e2e against the context-mill prompts branch, which does not exist yet
Ticket: feature-flags-review-update/U1
Ticket: feature-flags-review-update/U4

@edwinyjlim edwinyjlim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ship after addressing Vincent's comments. We can improve after it's in prod since we aren't promoting this program yet

@johncwaters
johncwaters requested a review from gewenyu99 October 14, 2026 17:14
@johncwaters
johncwaters dismissed gewenyu99’s stale review October 14, 2026 17:25

Every comment is addressed in 2d405ae and PostHog/context-mill#428; replies are on each thread.

@johncwaters
johncwaters merged commit 0a66b33 into main Oct 14, 2026
19 checks passed
@johncwaters
johncwaters deleted the johnw/feature-flags-command branch October 14, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants