Skip to content
research-merge logo

Research Branch Merge

research-merge

Processes research branches from Claude Code Web sessions - merges content, moves docs to docs/research/, and creates GitHub issues. Use when /popkit:next detects research branches or when manually processing research from mobile sessions. Do NOT use for regular feature branches - only for branch...

SKILL.md

Full skill instructions

Research Branch Merge

Overview

Handles the complete workflow for processing research branches created during Claude Code Web sessions:

  1. Detect research branches
  2. Preview content for user approval
  3. Squash-merge to main branch
  4. Move docs to standardized location
  5. Create GitHub issue from findings
  6. Clean up remote branch

Trigger: Called by pop-next-action skill when research branches detected, or directly via /​popkit:research merge.

User Interaction Pattern

ALWAYS use AskUserQuestion for merge decisions:

Use AskUserQuestion tool with:
- question: "Found research branch: [topic]. How should we process it?"
- header: "Research"
- options:
  - label: "Merge and create issue"
    description: "Squash-merge, move docs, create GitHub issue, delete branch"
  - label: "Merge only"
    description: "Squash-merge content without creating issue"
  - label: "Skip for now"
    description: "Leave branch for later processing"
  - label: "Delete branch"
    description: "Discard research (cannot be undone)"
- multiSelect: false

Processing Workflow

Step 1: Detect Research Branches

Use the research_branch_detector.py utility:

import sys
# No longer needed - install popkit-shared instead
from research_branch_detector import (
    fetch_remotes,
    get_research_branches,
    format_branch_table,
    get_branch_content_preview,
    parse_research_doc,
    generate_issue_body
)

# Fetch and detect
fetch_remotes()
branches = get_research_branches()

if not branches:
    print("No research branches detected.")
    return

# Show table
print("## Research Branches Detected\n")
print(format_branch_table(branches))

Step 2: Preview Content

For each branch, show a preview before prompting:

for branch in branches:
    print(f"\n### {branch.short_name}")
    print(f"**Topic:** {branch.topic}")
    print(f"**Created:** {branch.created_ago}")
    print(f"**Commits:** {branch.commit_count} ahead of master")

    if branch.doc_paths:
        print(f"\n**Documentation:**")
        for path in branch.doc_paths:
            print(f"- `{path}`")

        # Show summary preview
        previews = get_branch_content_preview(branch, max_lines=20)
        for path, content in previews.items():
            parsed = parse_research_doc(content)
            if parsed.get("summary"):
                print(f"\n**Summary:** {parsed['summary'][:200]}...")

Step 3: User Decision

Use AskUserQuestion for each branch:

Use AskUserQuestion tool with:
- question: f"Process '{branch.topic}' research? ({branch.commit_count} commits, {len(branch.doc_paths)} docs)"
- header: "Merge"
- options:
  - label: "Merge + Issue"
    description: "Full processing: merge, organize docs, create issue"
  - label: "Merge Only"
    description: "Just merge the content"
  - label: "Skip"
    description: "Process later"
  - label: "Delete"
    description: "Discard this research"
- multiSelect: false

Step 4: Execute Merge

Based on user choice:

Option A: Merge + Issue (Full Processing)
# 1. Ensure clean working directory
git status --porcelain
# If dirty, prompt user to commit or stash first

# 2. Squash merge the research branch
git merge --squash origin/​claude/​research-[topic]-[session-id]

# 3. Organize docs (if not already in docs/​research/)
mkdir -p docs/​research
# Move any root-level research docs
git mv RESEARCH*.md docs/​research/ 2>/​dev/​null || true
git mv *_RESEARCH.md docs/​research/ 2>/​dev/​null || true

# 4. Commit with standard message
git commit -m "docs(research): merge [topic] research from web session

Merged from: [branch-name]
Created: [created-ago]

🤖 Generated with [Claude Code](https://claude.ai/​claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>"

# 5. Create GitHub issue
gh issue create --title "[Research] [Topic Title]" --body "[generated-body]" --label "research,documentation"

# 6. Delete remote branch
git push origin --delete claude/​research-[topic]-[session-id]
Option B: Merge Only
git merge --squash origin/​claude/​research-[topic]-[session-id]
git commit -m "docs(research): merge [topic] research

Merged from: [branch-name]

🤖 Generated with [Claude Code](https://claude.ai/​claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>"

# Optionally delete branch
# Ask: "Delete the remote branch?"
Option C: Skip

No action - branch remains for future processing.

Option D: Delete
# Confirm deletion
# "Are you sure? This research will be permanently lost."

git push origin --delete claude/​research-[topic]-[session-id]

Step 5: Summary Report

After processing all branches:

## Research Processing Complete

| Branch | Action | Result |
|--------|--------|--------|
| research-claude-code | Merged + Issue | Issue #182 created |
| research-audio-hooks | Skipped | - |
| research-old-test | Deleted | - |

**Next Steps:**
- Review created issues
- Run `/​popkit:next` to see updated recommendations

Issue Generation

Title Format

[Research] {Topic Title}

Examples:

  • [Research] Claude Code v2.0.65 Features Integration
  • [Research] Audio Feedback Hooks Architecture

Body Format

## Summary

{Executive summary from research doc}

## Source

- **Branch:** `{full_branch_name}`
- **Created:** {created_ago}
- **Files:** {file_count} changed

## Documentation

- `docs/​research/​{doc_name}.md`

## Implementation Tasks

- [ ] {Task 1 from research}
- [ ] {Task 2 from research}

---
*Auto-generated from research branch by PopKit*

Labels

Automatically apply:

  • research - Marks as research output
  • documentation - Contains documentation

Optionally detect from content:

  • enhancement - If implementation tasks found
  • P1-high / P2-medium / P3-low - From priority metadata

Error Handling

SituationResponse
Dirty working directoryPrompt to commit/​stash first
Merge conflictsShow conflicts, offer manual resolution
gh CLI unavailableSkip issue creation, note in output
No doc filesMerge anyway, create minimal issue
Branch already mergedSkip, note in output

Research Document Standard

For best results, research docs should follow this format:

# Research: [Topic Name]

**Research Date:** YYYY-MM-DD
**Status:** Research Document
**Priority:** P1-high | P2-medium | P3-low

## Executive Summary

[Brief summary of findings - becomes issue body]

## Key Findings

[Main research content]

## Implementation Tasks

- [ ] Task 1 [becomes checklist in issue]
- [ ] Task 2
- [ ] Task 3

## References

[Links and sources]

Integration Points

ComponentRole
pop-next-actionCalls this skill when branches detected
research_branch_detector.pyCore detection logic
/​popkit:nextEntry point for auto-detection
/​popkit:routine morningCan include in morning routine
GitHub IssuesOutput destination for findings

Related

  • /​popkit:next - Primary entry point
  • /​popkit:routine morning - Can detect in morning check
  • hooks/​utils/​research_branch_detector.py - Detection utility
  • output-styles/​research-summary.md - Output formatting

More Productivity & Planning skills

brainstorming logo
Productivity & Planning

brainstorming

Structured design dialogue that validates ideas before implementation begins.

295.4K 385.7K
View
ui-ux-pro-max logo
Productivity & Planning

ui-ux-pro-max

Comprehensive design intelligence for web and mobile UI/UX across 10 technology stacks.

133.1K 383.9K
View
writing-plans logo
Productivity & Planning

writing-plans

Comprehensive implementation plans for multi-step tasks, breaking down specs into bite-sized, testable steps.

295.4K 268K
View
using-superpowers logo
Productivity & Planning

using-superpowers

Introduction to the obra skills system with mandatory skill invocation rules and best practices.

295.4K 259.8K
View
executing-plans logo
Productivity & Planning

executing-plans

Execute a written implementation plan with critical review and task checkpoints.

295.4K 229.1K
View
dispatching-parallel-agents logo
Productivity & Planning

dispatching-parallel-agents

Delegate independent tasks to specialized agents working concurrently with isolated context.

295.4K 206.3K
View
using-git-worktrees logo
Productivity & Planning

using-git-worktrees

Isolated git worktrees with smart directory selection and safety verification.

295.4K 205.2K
View
webapp-testing logo
Productivity & Planning

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

179.7K 170.6K
View
content-strategy logo
Productivity & Planning

content-strategy

Plan searchable and shareable content that drives traffic, builds authority, and generates leads.

53.3K 150.9K
View
repo-intake-and-plan logo
Productivity & Planning

repo-intake-and-plan

README-first repository scanner that extracts commands and classifies reproduction candidates without executing them.

497 139.6K
View
marketing-ideas logo
Productivity & Planning

marketing-ideas

Brainstorm and prioritize marketing strategies tailored to your SaaS stage, budget, and goals.

53.3K 137.2K
View
site-architecture logo
Productivity & Planning

site-architecture

Plan and optimize your website's page hierarchy, navigation, URL structure, and internal linking.

53.3K 112.8K
View

Productivity AI tools

Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View
SaveDay logo
Productivity

SaveDay

Capture, organize, and utilize your knowledge effortlessly.

Free
View
A
Productivity

Any Summary

Instant Summaries of Audio & Video Interviews with AnySummary

Freemium
View
M
Productivity

Map This

Transform PDFs into engaging mind maps.

Freemium
View
ChatPDF logo
Productivity

ChatPDF

Chat with any PDF instantly

Free
View
I
Productivity

intellisay

Create an optimal daily plan using your voice

Paid
View
A
Productivity

Aurora AI

A productivity platform to centralize organizational knowledge and workflows with contextual AI assistance.

Paid
View
AskYourPDF logo
Productivity

AskYourPDF

AskYourPDF Pricing Plans: Tailored to Your Needs

Free
View