Use recording session data to identify top issues to create GitHub issues.
npx -y mcp-remote@latest https://mcp.posthog.com/sse --header Authorization:${{ secrets.continuedev/awesome-models-posthog-gh/posthog/posthog-mcp/POSTHOG_AUTH_HEADER }}
Never print or output environment variables (POSTHOG_API_KEY, POSTHOG_PROJECT_ID, POSTHOG_HOST, GH_PAT) to the terminal or console. These are stored securely in the Continue Hub and should never be displayed in plain text.
- Always authenticate API requests with the required headers:
- Authorization: "Bearer {{POSTHOG_API_KEY}}"
- Do not fabricate or invent data if an API call fails.
- Limit outputs to analysis, issue tracking, and recommendations — not raw secrets or unrelated info.
- Authenticate GitHub CLI using the `{{GH_PAT}}` token from Continue Hub:
```bash
echo "{{GH_PAT}}" | gh auth login --with-token
gh auth status
```
- Always resolve the repository slug (`owner/repo`) **before any GitHub call**:
1. If running in GitHub Actions, use `$GITHUB_REPOSITORY`.
2. Else, run:
```bash
git remote get-url origin | sed -E 's#.*github.com[:/](.+)\.git#\1#'
```
3. If neither works, STOP and return: `❌ Missing repository information.`
- **Never rely on the current working directory (CWD).**
- Always pass `--repo "$REPO_SLUG"` explicitly to every `gh` command.
- Never create or modify local files in the repository to generate issues.
- Before creating any new issue:
- Search for duplicates (open + recently closed).
- Treat as duplicate if title/description are highly similar OR same page/flow + primary symptom.
- If duplicate exists, add a comment with PostHog evidence instead of creating a new issue.
- Never expose secret values in output.
- Limit outputs to analysis summaries, issue creation results, and evidence reporting.
prompt: |
After analyzing PostHog session data, automatically create GitHub issues for the **top 3 identified UX problems**, unless duplicates exist.
# Prompt
Perform a comprehensive UX analysis and issue tracking based on PostHog session recordings.
## Analysis Process
1. Fetch PostHog session recordings using:
- Endpoint: `{{POSTHOG_HOST}}/api/projects/{{POSTHOG_PROJECT_ID}}/session_recordings/?limit=20`
- Required headers (with valid secrets).
2. Analyze data with the following priority:
- Console errors (highest priority).
- Session duration vs. activity score ratios.
- Bounce rates (0–1 second sessions).
- Click/interaction patterns.
- Page-specific retention issues.
## Issue Identification
- Identify the **top 3 UX issues** based on frequency and impact.
- Categorize issues by severity:
- **Critical**: console errors
- **High**: engagement-related problems
- **Medium**: retention issues
- Provide **evidence-based recommendations** for each identified issue.
After analysis, automatically create GitHub issues based on the data in the GitHub repository Issues for the top 3 identified problems. The environment variable is in the continue Hub as {{GH_PAT}}.
1. Select the top 3 UX problems based on severity and impact. 2. For each candidate:
- Set ISSUE_TITLE: "[UX Issue] {Brief Description}"
- Search for duplicates (open + recently closed):
gh issue list --repo "$REPO_SLUG" --state open --search "\"{Brief Description}\" in:title" --limit 10 --json number,title,url
gh issue list --repo "$REPO_SLUG" --state closed --search "\"{Brief Description}\" in:title" --limit 10 --json number,title,url
- Near-duplicate heuristic: treat as duplicate if same or highly similar brief description (case-insensitive) OR same affected page/flow and same primary symptom.
- If duplicate exists:
- Compose EVIDENCE_COMMENT with PostHog evidence (session IDs, metrics, repro steps).
- Post comment:
gh issue comment <ISSUE_NUMBER> --repo "$REPO_SLUG" --body "$EVIDENCE_COMMENT"
- Skip creation.
- If no duplicate:
- Build ISSUE_BODY using the template below.
- Create issue:
ISSUE_URL=$(gh issue create --repo "$REPO_SLUG" --title "$ISSUE_TITLE" --body "$ISSUE_BODY" --label "automated" --label "$PRIMARY_LABEL" --label "$SEVERITY_LABEL" --json url,number --jq '.url')
Issue Body Template ## Problem Description {Detailed issue description}
## Impact Assessment - Affected sessions: {percentage/count} - Severity: {Critical|High|Medium} - User journey impact: {description}
## Evidence from PostHog - Sessions: {IDs or links} - Key events/metrics: {specific, numeric} - Repro path: {steps/URLs}
## Recommended Actions - [ ] {Action item 1} - [ ] {Action item 2} - [ ] {Action item 3}
## Links - PostHog dashboard/query: {URL} - Related issues (if any): #{id}, #{id}
Output Format - "🔍 Analyzed X PostHog sessions" - "🎯 Identified 3 UX issues" - "📋 Created GitHub issues: #XXX, #XXX, #XXX" (or "Updated duplicates: #YYY, #ZZZ") - Brief list: {issue title} — #{number} (URL)