| description |
|---|
Recap a task (/recap <session-id>) |
Perform comprehensive recap by analyzing local files, Claude Code session, and comments on Pull Request.
You must verify all of the following conditions before proceeding:
session_idargument is provided by the user (e.g. 2553e5ed-62fd-4b2e-897c-911ab22128ae)- Template file exists at
~/obsidian/templates/recap.md - Context file exists at
./tmp/context.md - Implementation plan file exists at
./tmp/plan.md
If any condition is not met:
- Stop the process immediately
- Notify the user which condition failed
- Do not proceed with any operations
Read ~/obsidian/templates/recap.md and understand what information should you collect.
Specify task title and overview that described by three lines.
- Read
./tmp/context.md- Initial requirements that user provided - Read
./tmp/plan.md- Implementation plan that served as the basis for actual implementation
Collect file changes from Git to understand key features and technical decisions.
# Get current branch
current_branch=$(git branch --show-current)
# Check if Pull Request exists for current branch
pr_number=$(gh pr list --head "$current_branch" --state all --json number --jq '.[0].number')
# Verify Pull Request exists
if [ "$pr_number" = "null" ] || [ -z "$pr_number" ]; then
exit 1
fi
# Get base branch
base_branch=$(gh pr view "$pr_number" --json baseRefName --jq '.baseRefName')
# Get commits since diverging from base branch
git log --oneline "$base_branch..$current_branch"
# Get diff
changed_files=$(git diff --name-only ${base_branch}...HEAD)
git_diff=$(git diff ${base_branch}...HEAD)Specify the session file path based on Claude Code's storage pattern:
# Get current working directory and encode it
current_dir=$(pwd)
encoded_dir=$(echo "$current_dir" | sed 's/\//-/g')
session_file="~/.claude/projects/${encoded_dir}/${session_id}.jsonl"Check if session file exists:
if [[ -f "$session_file" ]]; then
echo "Session file found: $session_file"
else
echo "Error: No session file found for ID: ${session_id}"
fiRead the session file (JSONL format) to understand:
- Instructions that user said repeatedly
- Issues that AI-agent tried to solve over and over again, and how to solve it
If Pull Request exists, gather feedback using GitHub CLI.
# View Pull Request details
gh pr view
# Get Pull Request comments and review feedback
repo=$(gh repo view --json owner,name)
owner=$(echo "$repo" | jq -r '.owner.login')
repo_name=$(echo "$repo" | jq -r '.name')
gh api repos/${owner}/${repo_name}/pulls/${pr_number}/comments
gh api repos/${owner}/${repo_name}/pulls/${pr_number}/reviewsExtract:
- Reviewer (@<github_accounts>)
- Review comment
- (If answer exists) Response to the comment
- How did it turned out?
Create comprehensive recap report in ./tmp/recap.md.
Structure your findings in the following format: ~/obsidian/templates/recap.md.
IMPORTANT: Follow Template Structure exactly
Provide summary to user:
- Summarize the task
- Output file