Skip to content
update-graft-inventory logo

Update Graft Inventory Skill

update-graft-inventory

Update the graft (feature flag) inventory when flags are added or removed. Use when adding new grafts via migrations, after CI flags inventory mismatches, or periodically to ensure docs match production D1.

NeverSight/skills_feed0installs215stars

SKILL.md

Full skill instructions

Update Graft Inventory Skill

When to Activate

Activate this skill when:

  • Adding new feature flags via SQL migrations
  • Removing or deprecating grafts
  • The graft-inventory CI check fails
  • You want to verify inventory matches production D1
  • After applying migrations that add grafts

Files Involved

FilePurpose
.github/​graft-inventory.jsonSource of truth for graft counts and metadata
packages/​engine/​migrations/​*.sqlMigration files that define grafts
packages/​engine/​src/​lib/​feature-flags/​grafts.tsType definitions (KnownGraftId)
docs/​guides/​adding-grafts-and-flags.mdDeveloper guide

Inventory Structure

The inventory tracks grafts with full metadata:

{
  "grafts": {
    "total": 10,
    "breakdown": {
      "platform": 8,
      "greenhouse": 2
    },
    "byType": {
      "boolean": 9,
      "number": 1
    }
  },
  "flags": [
    {
      "id": "fireside_mode",
      "name": "Fireside Mode",
      "type": "boolean",
      "greenhouseOnly": true,
      "migration": "040_fireside_scribe_grafts.sql",
      "description": "AI-assisted writing prompts"
    }
  ]
}

Step-by-Step Process

1. List Grafts from Migrations

# Extract all flag IDs from migration INSERT statements
grep -hoP "INSERT OR IGNORE INTO feature_flags.*?VALUES\s*\(\s*'\K[a-z_]+" packages/​engine/​migrations/​*.sql | sort -u

2. Query Production D1

# Get actual flags from production database
npx wrangler d1 execute grove-engine-db --remote --command="SELECT id, name, flag_type, greenhouse_only, enabled FROM feature_flags ORDER BY id;"

3. Compare with Inventory

# Read current inventory
cat .github/​graft-inventory.json | jq '.flags[].id' | sort

4. Identify Discrepancies

Look for:

  • New grafts: In migrations/​D1 but not in inventory
  • Removed grafts: In inventory but not in D1
  • Changed metadata: Type, greenhouse_only, or description changed

5. Update Inventory JSON

Edit .github/​graft-inventory.json:

  1. Update counts:

    "grafts": {
      "total": <new count>,
      "breakdown": {
        "platform": <non-greenhouse count>,
        "greenhouse": <greenhouse_only count>
      }
    }
    
  2. Add/​remove flag entries:

    "flags": [
      {
        "id": "new_flag_id",
        "name": "Human Readable Name",
        "type": "boolean",
        "greenhouseOnly": false,
        "migration": "XXX_migration_name.sql",
        "description": "What this flag controls"
      }
    ]
    
  3. Update metadata:

    "lastUpdated": "YYYY-MM-DD",
    "lastAuditedBy": "claude/<context>"
    

6. Update KnownGraftId Type

Edit packages/​engine/​src/​lib/​feature-flags/​grafts.ts:

export type KnownGraftId =
  | "fireside_mode"
  | "scribe_mode"
  | "meadow_access"
  | "jxl_encoding"
  | "jxl_kill_switch"
  | "new_flag_id";  // Add new flag

7. Commit Changes

git add .github/​graft-inventory.json packages/​engine/​src/​lib/​feature-flags/​grafts.ts
git commit -m "docs: update graft inventory

- Add <flag_id> to inventory
- Update total: X -> Y
- Update KnownGraftId type"

Quick Reference Commands

# Count grafts in migrations
grep -c "INSERT OR IGNORE INTO feature_flags" packages/​engine/​migrations/​*.sql | awk -F: '{sum+=$2} END {print sum}'

# List all flag IDs
grep -hoP "INSERT OR IGNORE INTO feature_flags.*?VALUES\s*\(\s*'\K[a-z_]+" packages/​engine/​migrations/​*.sql | sort -u

# Count greenhouse-only grafts
npx wrangler d1 execute grove-engine-db --remote --command="SELECT COUNT(*) FROM feature_flags WHERE greenhouse_only = 1;"

# Full flag details from production
npx wrangler d1 execute grove-engine-db --remote --command="SELECT * FROM feature_flags ORDER BY id;"

# Check which migrations haven't been applied
# Compare migration file flag IDs vs production D1 flag IDs

Adding a New Graft (Full Checklist)

When adding a new graft:

  • Create migration file: packages/​engine/​migrations/​XXX_name.sql
  • Apply migration: npx wrangler d1 execute grove-engine-db --remote --file=...
  • Add to KnownGraftId type in grafts.ts
  • Add entry to .github/​graft-inventory.json flags array
  • Update inventory counts (total, breakdown.platform/​greenhouse, byType)
  • Update lastUpdated and lastAuditedBy
  • Commit all changes together

Verifying Production Sync

After updating, verify production matches:

# Expected count
jq '.grafts.total' .github/​graft-inventory.json

# Actual count in production
npx wrangler d1 execute grove-engine-db --remote --command="SELECT COUNT(*) as count FROM feature_flags;"

If they don't match, migrations may need to be applied:

# Apply a specific migration
npx wrangler d1 execute grove-engine-db --remote --file=packages/​engine/​migrations/​XXX_name.sql

CI Integration

The .github/​workflows/​graft-inventory.yml workflow:

  • Runs on PRs touching packages/​engine/​migrations/​*.sql
  • Runs on PRs touching packages/​engine/​src/​lib/​feature-flags/​**
  • Parses migrations for INSERT statements
  • Compares count to inventory
  • Comments on PRs when there's a mismatch
  • Creates issues for drift on scheduled runs (Wednesdays)

When CI fails, run this skill to fix the mismatch.

Checklist

Before finishing:

  • Production D1 graft count matches inventory total
  • All flags in D1 have entries in inventory flags array
  • KnownGraftId type includes all flag IDs
  • lastUpdated date is today
  • Counts add up: total = platform + greenhouse
  • Type breakdown is accurate
  • Changes committed with descriptive message

More skills from NeverSight

devops-deployer logo
NeverSight/skills_feed

devops-deployer

Comprehensive DevOps and deployment workflow that orchestrates infrastructure automation, CI/CD pipelines, container orchestration, and cloud deployment. Handles everything from infrastructure as code and pipeline setup to monitoring, scaling, and disaster recovery.

215 1
View
avnu logo
NeverSight/skills_feed

avnu

Integrate avnu SDK for Starknet DeFi: token swaps with best-price routing, DCA recurring buys, native staking, gasless transactions via paymaster, and market data. Use when building Starknet trading, DEX aggregation, or DeFi automation features.

215 0
View
post-to-x logo
NeverSight/skills_feed

post-to-x

发布内容和文章到 X (Twitter)。支持带图片的普通推文和 X Articles(长文)。使用真实的 Chrome 和 CDP 来绕过自动化检测。

215 0
View
ralph-prompt-builder logo
NeverSight/skills_feed

ralph-prompt-builder

Master orchestrator for generating Ralph Wiggum-compatible prompts. Analyzes task requirements and routes to appropriate generator (single-task, multi-task, project, or research). Use when you need to create any Ralph loop prompt and want automatic selection of the right generator.

215 0
View
branch-comparison logo
NeverSight/skills_feed

branch-comparison

Use when the user asks to compare branches, analyze git diffs, review changes between branches, update specifications based on code changes, or analyze what changed. Triggers on keywords like "compare branches", "git diff", "what changed", "branch comparison", "code changes", "spec update".

215 0
View
fastapi-development logo
NeverSight/skills_feed

fastapi-development

Build high-performance FastAPI applications with async routes, validation, dependency injection, security, and automatic API documentation. Use when developing modern Python APIs with async support, automatic OpenAPI documentation, and high performance requirements.

215 0
View
zendesk-chat logo
NeverSight/skills_feed

zendesk-chat

Enables Claude to manage Zendesk Chat conversations, support tickets, and customer service operations

215 0
View
forge logo
NeverSight/skills_feed

forge

Mine transcripts for knowledge - decisions, learnings, failures, patterns. Triggers: "forge insights", "mine transcripts", "extract knowledge".

215 0
View
mixpanel logo
NeverSight/skills_feed

mixpanel

Track product analytics and user behavior with Mixpanel's event-based platform.

215 0
View
ocpp logo
NeverSight/skills_feed

ocpp

OCPP protocol reference for EV charging infrastructure development. Covers OCPP 2.0.1 and OCPP 1.6J. Use when working with OCPP messages, charging station code, CSMS/Central System backends, smart charging, transaction handling, or EV charging protocols. Activates on keywords: OCPP, charging stat...

215 0
View
bee-collect logo
NeverSight/skills_feed

bee-collect

Gather scattered ideas into organized GitHub issues. The bee collects pollen from every flower, checks if the hive already has it, and carefully deposits new work in the comb for later. Never edits code—only organizes the work ahead. Use when creating issues from TODOs or planning work.

215 0
View
vercel-react-native-skills logo
NeverSight/skills_feed

vercel-react-native-skills

Comprehensive best practices for React Native and Expo applications. Contains rules across multiple categories covering performance, animations, UI patterns, and platform-specific optimizations.

215 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View