Gather results from completed subagent including commits, metrics, and state updates
Gathers completed subagent work including commits, metrics, and state updates for integration.
/plugin marketplace add cowwoc/claude-code-dog/plugin install dog@claude-code-dogThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Extract work products from a completed subagent's worktree, including commit history, code changes, token metrics, and status information. Prepares the subagent's work for integration back into the parent task branch.
Check that the subagent has finished or is in a state where results can be collected:
WORKTREE=".worktrees/${TASK}-sub-${UUID}"
SESSION_FILE="/home/node/.config/claude/projects/-workspace/${SESSION_ID}.jsonl"
# Check for completion marker in session
jq -s 'last | select(.type == "result" or .content | contains("COMPLETED"))' "${SESSION_FILE}"
cd "${WORKTREE}"
# Get commits made by subagent (since branch creation)
git log --oneline origin/HEAD..HEAD
# Get detailed commit info
git log --format="%H %s" origin/HEAD..HEAD > /tmp/subagent-commits.txt
# Read session file for metrics
SESSION_FILE="/home/node/.config/claude/projects/-workspace/${SESSION_ID}.jsonl"
# Total tokens used
TOTAL_TOKENS=$(jq -s '[.[] | select(.type == "assistant") | .message.usage |
(.input_tokens + .output_tokens)] | add' "${SESSION_FILE}")
# Input vs output breakdown
INPUT_TOKENS=$(jq -s '[.[] | select(.type == "assistant") |
.message.usage.input_tokens] | add' "${SESSION_FILE}")
OUTPUT_TOKENS=$(jq -s '[.[] | select(.type == "assistant") |
.message.usage.output_tokens] | add' "${SESSION_FILE}")
# Compaction events
COMPACTIONS=$(jq -s '[.[] | select(.type == "summary")] | length' "${SESSION_FILE}")
cd "${WORKTREE}"
# List modified files
git diff --name-only origin/HEAD..HEAD
# Get full diff for review
git diff origin/HEAD..HEAD > /tmp/subagent-changes.diff
If subagent maintained a STATE.md or status file:
# Read subagent's final state
cat "${WORKTREE}/.claude/dog/tasks/${TASK}/STATE.md"
# Or check for completion report
cat "${WORKTREE}/COMPLETION_REPORT.md" 2>/dev/null
Record collection results in parent's tracking:
subagents:
- id: a1b2c3d4
task: 1.2-implement-parser
status: collected # Changed from 'running'
collected_at: 2026-01-10T15:00:00Z
results:
commits: 5
files_changed: 12
lines_added: 450
lines_removed: 120
metrics:
total_tokens: 65000
input_tokens: 45000
output_tokens: 20000
compaction_events: 0
ready_for_merge: true
# Ensure subagent branch is up to date
cd "${WORKTREE}"
git status
# Note any uncommitted changes
if [ -n "$(git status --porcelain)" ]; then
echo "WARNING: Uncommitted changes in subagent worktree"
git status --short
fi
collection_report:
subagent_id: a1b2c3d4
task: 1.2-implement-parser
collection_status: success
commits:
- hash: abc123
message: "feature: implement basic parser structure"
- hash: def456
message: "feature: add expression parsing"
- hash: ghi789
message: "test: add parser unit tests"
metrics:
total_tokens: 65000
efficiency: 0.89 # commits per 10K tokens
compactions: 0
files_summary:
- src/parser/Parser.java (new)
- src/parser/ExpressionParser.java (new)
- test/parser/ParserTest.java (new)
next_action: ready_for_merge
collection_report:
subagent_id: b2c3d4e5
task: 1.3-implement-formatter
collection_status: partial
reason: context_limit_reached
compaction_events: 2
commits:
- hash: jkl012
message: "feature: implement basic formatter"
# Only 1 of 3 planned commits completed
remaining_work:
- "Implement indent handling"
- "Add line wrapping"
metrics:
total_tokens: 195000
efficiency: 0.05 # Low due to compaction overhead
next_action: decompose_remaining
recommendation: "Spawn new subagent for remaining work"
# ❌ Interrupting active work
collect-results "${SUBAGENT}" # Still processing!
# ✅ Wait for completion or explicit intervention reason
if is_complete "${SUBAGENT}" || needs_intervention "${SUBAGENT}"; then
collect-results "${SUBAGENT}"
fi
# ❌ Proceeding with dirty worktree
collect-results "${SUBAGENT}"
merge-subagent "${SUBAGENT}"
# ✅ Handle uncommitted work
if has_uncommitted_changes "${SUBAGENT}"; then
echo "WARNING: Uncommitted changes detected"
# Either commit them or document as lost
fi
# ❌ Only grabbing commits
git log --oneline > results.txt
# Done!
# ✅ Full metrics for learning
collect_commits "${SUBAGENT}"
collect_token_metrics "${SUBAGENT}"
collect_compaction_events "${SUBAGENT}"
update_parent_state "${SUBAGENT}"
# ❌ Discarding incomplete work
if [ "${STATUS}" != "complete" ]; then
echo "Incomplete, discarding"
cleanup_worktree "${SUBAGENT}"
fi
# ✅ Preserve partial progress
if [ "${STATUS}" != "complete" ]; then
echo "Collecting partial results"
document_remaining_work "${SUBAGENT}"
# Results can still be merged
fi
dog:monitor-subagents - Check if subagent is ready for collectiondog:merge-subagent - Merge collected results to task branchdog:token-report - Detailed analysis of token usagedog:decompose-task - Split remaining work after partial collectionThis skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.