Skip to content

Comments

feat(commit-push-pr): include plan/prompt context in PR body#428

Closed
m-abboud wants to merge 1 commit intoanthropics:mainfrom
m-abboud:add-plan-context-to-pr-body
Closed

feat(commit-push-pr): include plan/prompt context in PR body#428
m-abboud wants to merge 1 commit intoanthropics:mainfrom
m-abboud:add-plan-context-to-pr-body

Conversation

@m-abboud
Copy link

Summary

  • Adds a Plan/prompt context section to the /commit-push-pr command that automatically reads the task's plan or original prompt and injects it into the PR body
  • Plan file is resolved in priority order: explicit argument → PLAN.md.plan.md → most recently modified file in ~/.claude/plans/
  • Updates README to document the new argument-hint and the plan-file lookup behaviour

Motivation

When Claude completes a task and opens a PR, reviewers currently only see a diff-based summary with no record of why the work was done or what the original requirements were. Including the plan/prompt context directly in the PR body gives reviewers and future readers full context without having to dig through a separate chat history or planning document.

How it works

The new context line in the command:

- Plan/prompt context: !`cat "$ARGUMENTS" 2>/dev/null || cat PLAN.md 2>/dev/null || cat .plan.md 2>/dev/null || ls -t ~/.claude/plans/*.md 2>/dev/null | head -1 | xargs cat 2>/dev/null || echo ""`

resolves to the first non-empty result from:

  1. The file passed as an argument to the command (e.g. /commit-push-pr PLAN.md)
  2. PLAN.md in the current working directory
  3. .plan.md in the current working directory
  4. The most recently modified Markdown file in ~/.claude/plans/ (written during Claude's plan mode)

If no plan file is found the field is empty and the PR body is generated from the diff as before.

Test plan

  • Run /commit-push-pr with no argument in a repo that has a PLAN.md — verify plan content appears under ## Context in the PR body
  • Run /commit-push-pr path/to/custom-plan.md — verify the specified file is used
  • Run /commit-push-pr with no plan file present — verify PR is still created normally without a ## Context section
  • Confirm .plan.md fallback works when PLAN.md does not exist
  • Confirm ~/.claude/plans/ fallback is used when no local plan file exists

🤖 Generated with Claude Code

When running /commit-push-pr, automatically surface the original task
context (plan file or prompt) in the PR description so reviewers have
full context without digging through chat history.

Plan file is resolved in priority order:
1. Explicit argument path (e.g. /commit-push-pr PLAN.md)
2. PLAN.md in the current directory
3. .plan.md in the current directory
4. Most recently modified file in ~/.claude/plans/

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link

Thanks for your interest! This repo only accepts contributions from Anthropic team members. If you'd like to submit a plugin to the marketplace, please submit your plugin here.

@github-actions github-actions bot closed this Feb 19, 2026
@m-abboud m-abboud deleted the add-plan-context-to-pr-body branch February 19, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant