Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Need to ship the skills first before merging the PR.
TLDR:
This PR ships the embedded plugin for Claude Code and skills sync to Codex (as Codex doesn't have a plugin system yet). Skills are automatically pulled from
posthog/posthog. The next step might be to reuse the same service for Wizard.Also a few important changes:
Problem
Twig agents (Claude Code, Codex) need access to PostHog-specific skills, but currently there's no mechanism to deliver or update these skills. We need a plugin system that:
~/.agents/skills/)Changes
New PostHog plugin system (
plugins/posthog/) — a directory-based plugin format withplugin.json, MCP/LSP configs, and skill directories. Skills are markdown files (SKILL.md) that get passed to agents as context.Three-tier skill sourcing with priority layering:
plugins/posthog/skills/(committed)skills.zip)plugins/posthog/local-skills/(gitignored)PosthogPluginService(apps/twig/src/main/services/posthog-plugin/service.ts) — injectable singleton that manages the full plugin lifecycle at runtime:userData, overlays any cached remote skills, syncs to Codex directory, starts a 30-minute update timerskills.zip, extracts with atomic swap (.new/.olddirs to avoid partial states), re-assembles the runtime plugin, re-syncs to CodexBuild-time Vite plugin (
copyPosthogPlugininvite.main.config.mts) — at bundle time, copies the plugin directory to the build output, downloads and overlays remote skills, and in dev mode overlayslocal-skills/on top. Watches all three sources for hot-reload.Agent integration (
AgentService) — injectsPosthogPluginServiceand passesgetPluginPath()to Claude Code sessions via thepluginsoption. Also addsx-posthog-mcp-version: 2header to the PostHog MCP server config, and setsENABLE_EXPERIMENTAL_MCP_CLIenv var.Dev tooling —
pnpm skills:pullscript (scripts/pull-skills.mjs) downloads remote skills intolocal-skills/for local editing and iteration.Packaging — updated Forge config to unpack
plugins/posthog/**from ASAR so the plugin directory is accessible at runtime.Tests
Manual testing & service unit tests