scopes: Command for Claude Code

.claude/commands/pm/epic-merge.md

epic-merge is a command for Claude Code from kamiazya/scopes. It costs 0 tokens per session (1,308 once invoked), scanned B, original, Apache-2.0.

A command that merges a finished development project from a separate Git worktree into the main branch.

In plain words
What is it for?
Use it to validate, optionally test, update epic records, and merge an epic branch back into the main project.
Why use it?
It checks for unfinished changes and active agents before merging, reducing the chance of combining incomplete work.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

This is kamiazya/scopes's own configuration. It tells Claude Code how to work on scopes itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything scopes configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is cd ../epic-$ARGUMENTS.

Reuse

Borrowing it

Nothing to install: this file belongs to kamiazya/scopes. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/kamiazya/scopes/main/.claude/commands/pm/epic-merge.md
Clone the repo
git clone --depth 1 https://github.com/kamiazya/scopes

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for epic-merge

README.md
[![agentmods](https://agentmods.dev/badge/commands/kamiazya/scopes/epic-merge.svg)](https://agentmods.dev/commands/kamiazya/scopes/epic-merge)
Your own site
<a href="https://agentmods.dev/commands/kamiazya/scopes/epic-merge"><img src="https://agentmods.dev/badge/commands/kamiazya/scopes/epic-merge.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,308 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.01308
Opus 5 $0.00000 $0.00654
Sonnet 5 $0.00000 $0.00262
Haiku 4.5 $0.00000 $0.00131

Measured 6d ago against content hash c848111c2598, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade B, and why

epic-merge scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

Closes epic #$(grep 'github:' .claude/epics/$ARGUMENTS/epic.md | grep -oE '#[0-9]+')"
.claude/commands/pm/epic-merge.md · 212 lines

How it starts

The opening of the file, as written. The whole thing — 212 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Epic Merge

Merge completed epic from worktree back to main branch.

Usage

/pm:epic-merge <epic_name>

Quick Check

  1. Verify worktree exists:

    git worktree list | grep "epic-$ARGUMENTS" || echo "❌ No worktree for epic: $ARGUMENTS"
    
  2. Check for active agents: Read .claude/epics/$ARGUMENTS/execution-status.md If active agents exist: "⚠️ Active agents detected. Stop them first with: /pm:epic-stop $ARGUMENTS"

Instructions

1. Pre-Merge Validation

Navigate to worktree and check status:

cd ../epic-$ARGUMENTS

# Check for uncommitted changes
if [[ $(git status --porcelain) ]]; then
  echo "⚠️ Uncommitted changes in worktree:"
  git status --short
  echo "Commit or stash changes before merging"
  exit 1
fi

# Check branch status
git fetch origin
git status -sb

2. Run Tests (Optional but Recommended)

# Look for test commands
if [ -f package.json ]; then
  npm test || echo "⚠️ Tests failed. Continue anyway? (yes/no)"
elif [ -f Makefile ]; then
  make test || echo "⚠️ Tests failed. Continue anyway? (yes/no)"
fi

3. Update Epic Documentation

Get current datetime: date -u +"%Y-%m-%dT%H:%M:%SZ"

Update .claude/epics/$ARGUMENTS/epic.md:

  • Set status to "completed"
  • Update completion date
  • Add final summary

4. Attempt Merge

# Return to main repository
cd {main-repo-path}

# Ensure main is up to date
git checkout main
git pull origin main

# Attempt merge
echo "Merging epic/$ARGUMENTS to main..."
git merge epic/$ARGUMENTS --no-ff -m "Merge epic: $ARGUMENTS

Completed features:
$(cd .claude/epics/$ARGUMENTS && ls *.md | grep -E '^[0-9]+' | while read f; do
  echo "- $(grep '^name:' $f | cut -d: -f2)"
done)

Closes epic #$(grep 'github:' .claude/epics/$ARGUMENTS/epic.md | grep -oE '#[0-9]+')"

5. Handle Merge Conflicts

If merge fails with conflicts:

# Check conflict status
git status

echo "
❌ Merge conflicts detected!

Conflicts in:
$(git diff --name-only --diff-filter=U)

Options:
1. Resolve manually:
   - Edit conflicted files
   - git add {files}
   - git commit
   
2. Abort merge:
   git merge --abort
   
3. Get help:
   /pm:epic-resolve $ARGUMENTS

Worktree preserved at: ../epic-$ARGUMENTS
"
exit 1

Read the full file on GitHub · 212 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 212 lines · 0 tokens per session scan B c848111c2598

Subscribe to this mod's changes

epic-merge is a command published in the GitHub repository kamiazya/scopes (2 stars, last pushed 9mo ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 1,308 tokens. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.