원클릭으로
catmonitor-subagents
Check status of running subagents including token usage and context limits
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Check status of running subagents including token usage and context limits
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Guide for writing clear, descriptive commit messages
Merge task branch to base branch with linear history (works from task worktree)
MANDATORY: Use instead of `git rebase` - provides automatic backup and conflict recovery
MANDATORY: Use instead of `git rebase -i` for squashing - unified commit messages
Analyze mistakes with conversation length as potential cause (CAT-specific)
Run scheduled retrospective analysis, derive action items, and track effectiveness
| name | cat:monitor-subagents |
| description | Check status of running subagents including token usage and context limits |
Track the status of active subagents, monitor their token consumption, detect context limit approaches, and identify compaction events. Enables the parent agent to make informed decisions about intervention or result collection.
Use the optimized monitoring script for minimal context impact:
/workspace/cat/scripts/monitor-subagents.sh
Output format:
{
"subagents": [
{"id": "a1b2c3d4", "task": "1.2-parser", "status": "running", "tokens": 45000, "compactions": 0},
{"id": "b2c3d4e5", "task": "1.3-formatter", "status": "warning", "tokens": 85000, "compactions": 1}
],
"summary": {"total": 2, "running": 1, "complete": 0, "warning": 1}
}
Status values:
running - Active, tokens below thresholdwarning - Tokens >= 80K (40% of context), consider interventioncomplete - Completion marker (.completion.json) found in worktreeToken Metric Source:
The tokens field in monitor output comes from:
.completion.json if subagent has completed (preferred)For accurate token metrics on completed subagents, use /cat:token-report which extracts
totalTokens from Task tool completions. This metric matches the CLI "Done" display and
represents actual context processed, not cumulative API response tokens.
If status = "warning":
/cat:token-reportcollect-resultsIf status = "complete":
.completion.json in worktree for detailsIf compactions > 0:
# Single command returns all subagent status
/workspace/cat/scripts/monitor-subagents.sh
# Filter output with jq
/workspace/cat/scripts/monitor-subagents.sh | jq '.subagents[] | select(.id == "a1b2c3d4")'
# Get summary counts only
/workspace/cat/scripts/monitor-subagents.sh | jq '.summary'
# ❌ Running jq manually each poll (accumulates tool call overhead)
jq -s '[...] | add' "${SESSION_FILE}"
jq -s '[...] | length' "${SESSION_FILE}"
# ✅ Single script call returns all data
/workspace/cat/scripts/monitor-subagents.sh
# ❌ Checking every second
while true; do
/workspace/cat/scripts/monitor-subagents.sh
sleep 1
done
# ✅ Reasonable polling interval (30-60 seconds)
while true; do
/workspace/cat/scripts/monitor-subagents.sh
sleep 60
done
# ❌ Ignoring compaction
if [ "${COMPACTIONS}" -gt 0 ]; then
echo "Compaction detected, continuing anyway..."
fi
# ✅ Treat compaction as intervention signal
if [ "${COMPACTIONS}" -gt 0 ]; then
echo "Compaction detected - initiating result collection"
# Trigger collect-results
fi
# ❌ Assuming worktree = active subagent
ACTIVE_COUNT=$(git worktree list | grep -c "-sub-")
# ✅ Verify session activity
for worktree in $(get_subagent_worktrees); do
if is_session_active "${worktree}"; then
ACTIVE_COUNT=$((ACTIVE_COUNT + 1))
fi
done
cat:spawn-subagent - Launch new subagentscat:collect-results - Gather completed subagent workcat:token-report - Detailed token analysiscat:parallel-execute - Orchestrate multiple subagents