Subagent metrics bridging

From ychampion/cskill-agents · View interactive version

Subagent metrics bridging is an AI agent skill from the GitHub repository ychampion/cskill-agents. Translate a streaming subagent run into task progress, analytics, and notifications while keeping partial results and cleanup tidy.

How to use this skill

Skill file

SKILL: Subagent Metrics Bridging

Domain: metrics-bridging

Trigger: Use when an async subagent loop needs to feed its token/tool-use counts, progress, and completion status back into the host task/analytics stack.

Source Pattern: Distilled from reviewed async subagent lifecycle, task-progress, and analytics bridge implementations.

Core Method

Drive the async child-agent lifecycle through one progress bridge that feeds task UI, analytics, and notifications from the same stream. As messages arrive, update visible progress, token counts, and the last-active tool so the host can show meaningful live state. When the stream finishes, finalize the result once, record analytics from that finalized snapshot, and then emit completion notifications or warnings. Heavy post-processing should happen after the task is already marked complete so diagnostics do not block the visible lifecycle.

Key Rules

Example Application

When adding a new background worker that prefetches repo data for the user, follow this pattern to link its stream to the task UI/notification system and guarantee the analytics pipeline records its token tally even if it aborts midflight.

Anti-Patterns (What NOT to do)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.