By posthog
Official PostHog plugin for AI clients. Access PostHog products directly from your AI coding tool.
Trending marketplaces
7-day visitors to each marketplace page
npx claudepluginhub posthog/ai-pluginAccess PostHog analytics, feature flags, experiments, error tracking, and insights directly from your AI coding tool. Optionally capture Claude Code sessions to PostHog LLM Analytics.
Send Claude Code sessions to PostHog LLM analytics. Hooks only: no skills, no commands, no MCP server. Install this instead of the PostHog plugin, not alongside it.
Official PostHog plugin for AI clients. Access PostHog products directly from your AI coding tool.
Install the plugin:
claude plugin install posthog
Or install from this repo as a marketplace:
claude plugin marketplace add PostHog/ai-plugin
claude plugin install posthog@posthog
Authenticate via OAuth:
# Just enter Claude Code anywhere
claude
# Then, use the /mcp command within Claude, select plugin:posthog:posthog, and press Enter
/mcp
Then follow the browser prompts to log into PostHog.
(Optional) Send Claude Code sessions to PostHog LLM Analytics.
Add to ~/.claude/settings.json (global) or .claude/settings.local.json (per-project):
{
"env": {
"POSTHOG_LLMA_CC_ENABLED": "true",
"POSTHOG_API_KEY": "phc_...",
"POSTHOG_HOST": "https://eu.i.posthog.com"
}
}
Both POSTHOG_LLMA_CC_ENABLED=true and POSTHOG_API_KEY are required. Sessions are sent when Claude Code exits. Set POSTHOG_LLMA_PRIVACY_MODE=true to redact prompt/output content. Add custom properties to all events with POSTHOG_LLMA_CUSTOM_PROPERTIES (JSON string, e.g. '{"ai_product": "my-app"}'). Set POSTHOG_AI_PURPOSE to declare what the session is doing relative to the repo — documented values are authoring and review, emitted as $ai_purpose. Useful when a harness wraps an agent it can't modify (e.g. a CI job running Claude Code as a reviewer); left unset the property is omitted.
The plugin asks before sensitive PostHog writes, such as deletions.
In Claude Code's bypassPermissions mode, the hook skips its prompt.
Install python3 to skip prompts for large or complex inputs.
POSTHOG_MCP_EXEC_GATE_DISABLE=1 turns off the gate.POSTHOG_MCP_EXEC_GATE_DENY replaces the default set. Use * for all writes.POSTHOG_MCP_EXEC_GATE_ALLOW exempts matching tools and takes precedence.Both lists take comma-separated shell globs, such as annotation-*.
Known reads pass through, and cross-project calls prompt while the gate is on.
A PostHog MCP connection you add yourself with split_writes=true lists exec-read and exec-write instead of exec. The plugin's own connection keeps exec. exec-read calls pass through because the server refuses writes there. Every exec-write call prompts, whatever tool it runs. POSTHOG_MCP_EXEC_GATE_ALLOW, POSTHOG_MCP_EXEC_GATE_DISABLE and bypassPermissions mode skip that prompt, but only the last two skip it for cross-project calls.
To send Claude Code sessions to PostHog LLM analytics without the slash commands or the MCP server, install the capture plugin on its own:
claude plugin marketplace add PostHog/ai-plugin
claude plugin install posthog-telemetry@posthog
It registers one SessionEnd hook and nothing else, so it adds nothing to the context of a session. It needs only the Python standard library, and it reads the same environment variables as step 3 above.
Install it instead of the posthog plugin, not alongside it. Both register the same hook, so running both parses and uploads every session twice. PostHog dedupes the events themselves, because their UUIDs are derived from the session, but the two hooks race on the status file.
Install from the Cursor Marketplace or add manually in Cursor Settings > Plugins.
The plugin installs the PostHog MCP server. Claude Code's session capture and the write-command gate don't run in Cursor.
In Cursor IDE, the MCP connection runs through Cursor's hosted service, so Cursor holds your PostHog sign-in and you may need to sign in again after updating the plugin.
Grok Bot (desktop and mobile) lists the same plugin from the Cursor Marketplace. Open Plugins, search for PostHog, install it, and log into PostHog when prompted.
Add the marketplace:
codex plugin marketplace add PostHog/ai-plugin
Install the plugin from inside Codex:
codex
# Then run /plugins, select PostHog, and install
/plugins
7-day visitors to each marketplace page
Anthropic's Claude Code plugins, installed from the claude-plugins-official repository
RuFlo Marketplace: Claude Code native agents, swarms, workers, and MCP tools for continuous software engineering
Claude Code marketplace entries for the plugin-safe Agentic Awesome Skills library and its compatible editorial bundles.