Who it is forA developer running several delegated Agents who wants to know how much a task used before starting the next one.
The problemDelegated work spreads across many sessions, so the total token use and cost are hard to see in one place.
The outcomeThe Session stats view shows usage for the current session and its owned Agents, and for assigned Leads when a Manager is active.
What you need first
- Linux or macOS for the released install script
- Pi and herdr installed, or the install script to set them up
- A Git project to work in
Steps
- Run
pi install npm:pi-herdsman - Run
herdr integration install pi - Start a session with
piinside a herdr pane - Type
/agentsand open the Session stats view - Compare the totals with the Agents you delegated
Prompt for your agent
Using the pi-herdsman repo, run a task that delegates work to <number> Agents in <project path>, then open the /agents Session stats view. Expected output: token usage and cost totals for the Lead session and its owned Agent sessions. Verify that the totals include each delegated Agent.
Caveat. The README says usage covers Pi-native token usage and cost for owned sessions, so it does not cover sessions outside the Lead ownership tree.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for boadij/pi-herdsman and "Check token usage and cost for a session and its Agents"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer