Skip to content

feat: enable GrowthBook local gate defaults for P0/P1 features#151

Closed
amDosion wants to merge 1 commit intoclaude-code-best:mainfrom
amDosion:feat/growthbook-enablement
Closed

feat: enable GrowthBook local gate defaults for P0/P1 features#151
amDosion wants to merge 1 commit intoclaude-code-best:mainfrom
amDosion:feat/growthbook-enablement

Conversation

@amDosion
Copy link
Copy Markdown
Contributor

@amDosion amDosion commented Apr 6, 2026

Summary

  • Add LOCAL_GATE_DEFAULTS mapping in growthbook.ts with 25+ feature gate defaults
  • Modify 4 getter functions (getFeatureValueInternal, getFeatureValue_CACHED_MAY_BE_STALE, checkStatsigFeatureGate_CACHED_MAY_BE_STALE, checkGate_CACHED_OR_BLOCKING) to check local defaults when GrowthBook is not connected
  • Add 8 new compile-time feature flags to build.ts and scripts/dev.ts
  • Include scripts/verify-gates.ts for programmatic gate verification (30/30 PASS)

Features Enabled

P0 — Pure local (no external dependencies):
Custom keybindings, streaming tool execution, cron tasks, JSON tools (~4.5% token savings), immediate model switch, ultrathink, built-in Explore/Plan agents, deep link protocol, MCP delta, leaf pruning, message smooshing, auto-background agents, fine-grained tool state

P1 — API-dependent (works with any valid API key):
Session memory, auto memory extraction, prompt suggestions, verification agent, brief mode, away summary, auto dream, idle return prompt

Kill switches (10 gates kept true):
Prevent remote disable of ultrathink, explore/plan agents, agent teams, bash security analysis, clipboard, cache prefix, durable cron, attribution, agent progress

New Compile Flags

AGENT_TRIGGERS, ULTRATHINK, BUILTIN_EXPLORE_PLAN_AGENTS, LODESTONE, EXTRACT_MEMORIES, VERIFICATION_AGENT, KAIROS_BRIEF, AWAY_SUMMARY

Safety

  • Bypass all local defaults: CLAUDE_CODE_DISABLE_LOCAL_GATES=1
  • Build: ✅ 480 files
  • Tests: ✅ 2061 pass / 23 fail (pre-existing) / 0 new failures
  • Gate verification: ✅ 30/30 PASS

Test plan

  • bun run build passes (480 files)
  • bun test — no new failures
  • NODE_ENV=test bun run scripts/verify-gates.ts — 30/30 PASS
  • Manual: bun run dev → type "ultrathink" → verify extended thinking activates
  • Manual: /keybindings → verify custom keybinding UI loads
  • Manual: /brief → verify brief mode toggles
  • Manual: verify prompt suggestions appear after task completion

Summary by CodeRabbit

  • New Features

    • Added 8 new feature gates: Agent Triggers, Ultrathink, Builtin Explore Plan Agents, Lodestone, Extract Memories, Verification Agent, Kairos Brief, and Away Summary.
    • Improved offline fallback behavior with local gate defaults.
  • Documentation

    • Enhanced feature enablement documentation with implementation roadmap and configuration details.
    • Updated feature flag audit and status tracking documentation.

Add LOCAL_GATE_DEFAULTS mapping in growthbook.ts to enable 25+ features
when GrowthBook is not connected. Modify 4 getter functions to check
local defaults before returning hard-coded false.

P0 (local): keybindings, streaming tool exec, cron, JSON tools, ultrathink
P1 (API): session memory, auto memory, prompt suggestions, brief mode
Kill switches: 10 gates kept true to prevent remote disable

New compile flags: AGENT_TRIGGERS, ULTRATHINK, BUILTIN_EXPLORE_PLAN_AGENTS,
LODESTONE, EXTRACT_MEMORIES, VERIFICATION_AGENT, KAIROS_BRIEF, AWAY_SUMMARY

Bypass: CLAUDE_CODE_DISABLE_LOCAL_GATES=1
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 6, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8ef2858f-8c82-42c9-84a3-6b668a7bba76

📥 Commits

Reviewing files that changed from the base of the PR and between ca63048 and dc94e16.

📒 Files selected for processing (7)
  • DEV-LOG.md
  • build.ts
  • docs/features/feature-flags-audit-complete.md
  • docs/features/growthbook-enablement-plan.md
  • scripts/dev.ts
  • scripts/verify-gates.ts
  • src/services/analytics/growthbook.ts

📝 Walkthrough

Walkthrough

This PR introduces local GrowthBook gate defaults for offline scenarios, expands feature flag compilations in build/dev configurations, adds comprehensive GrowthBook enablement documentation, and includes a new gate verification script that validates gate behavior against expected values.

Changes

Cohort / File(s) Summary
Documentation Updates
DEV-LOG.md, docs/features/feature-flags-audit-complete.md, docs/features/growthbook-enablement-plan.md
Added changelog entry for GrowthBook local gates; updated feature audit date and added references to enablement plan; created new comprehensive guide documenting three-tier gating strategy, phase rollout, gate configurations, and privacy implications.
Build & Dev Configuration
build.ts, scripts/dev.ts
Extended DEFAULT_BUILD_FEATURES and DEFAULT_FEATURES lists with 8 new compile-time flags: AGENT_TRIGGERS, ULTRATHINK, BUILTIN_EXPLORE_PLAN_AGENTS, LODESTONE, EXTRACT_MEMORIES, VERIFICATION_AGENT, KAIROS_BRIEF, AWAY_SUMMARY.
GrowthBook Gate Fallback Logic
src/services/analytics/growthbook.ts
Added LOCAL_GATE_DEFAULTS mapping and updated four gate getter/checker functions (getFeatureValueInternal, getFeatureValue_CACHED_MAY_BE_STALE, checkStatsigFeatureGate_CACHED_MAY_BE_STALE, checkGate_CACHED_OR_BLOCKING) to return local defaults when GrowthBook is disabled (unless CLAUDE_CODE_DISABLE_LOCAL_GATES env var is set).
Gate Verification
scripts/verify-gates.ts
New script to validate GrowthBook gate defaults and compile-time feature flag availability, categorized by priority (P0, P1, KS), with colorized pass/fail logging and exit code signaling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • KonghaYao

Poem

🐰 Local gates now have default dreams,
When GrowthBook sleeps and silence gleams!
Eight new features bundled tight,
Verified by scripts through the night.
Documentation maps the way,
Feature flags dance and play! 🎉

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@amDosion amDosion closed this Apr 6, 2026
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.

1 participant