ワンクリックで
token-data-sources
When debugging why the analysis page shows missing or zero token data, or when adding new cost/usage visualizations.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
When debugging why the analysis page shows missing or zero token data, or when adding new cost/usage visualizations.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
How the multi-backend adapter system works — AgentAdapter interface, ACP protocol, session resume, and how to add new provider adapters
When debugging why an agent has the wrong provider/model, or when modifying agent creation or delegation flows.
How to get agents to use group chats for peer coordination in flightdeck-based crews. Covers hub-and-spoke anti-pattern, auto-grouping triggers, and file-lock-linked groups. Use when setting up multi-agent crews with 3+ agents or diagnosing why agents aren't collaborating directly.
When fetching from the `/coordination/activity` API and you only need specific action types (e.g., `progress_update`, `task_completed`, `delegated`).
When fetching activity data for UI display, or debugging why activity-based features show empty/stale data.
Architecture decisions and patterns from Flightdeck development (Phases 2–4). Covers feature architecture, state management, component patterns, and API design.
| name | token-data-sources |
| description | When debugging why the analysis page shows missing or zero token data, or when adding new cost/usage visualizations. |
When to use: When debugging why the analysis page shows missing or zero token data, or when adding new cost/usage visualizations.
The analysis page has two independent data sources for token information. Understanding which is active and when is critical.
AnalysisPage.tsx reads agent.inputTokens / agent.outputTokens from the app storeagent:usage events → appStore updates agent objects in memoryCostBreakdown.tsx fetches /costs/by-agent and /costs/by-task API endpointsCostTracker.recordUsage() → writes to task_cost_records DB tableIn AgentManager.ts, token usage recording has a gate condition:
// packages/server/src/agents/AgentManager.ts ~line 725
if (dagTaskId && agent.parentId) {
tracker.recordUsage(agent.id, dagTaskId, ...);
}
This requires BOTH:
dagTaskId — agent must have an active DAG taskagent.parentId — agent must have a parent (not be the lead)Problem: The lead agent (which has no parentId) never records usage. And child agents only record when they have an active DAG task. This means task_cost_records is often empty → "No token attribution data yet."
Meanwhile, emit('agent:usage') at line ~730 fires unconditionally, so the time-series chart works fine.
agent.id or a session-level bucket/costs/by-agent instead of reading from in-memory agent objects| File | Lines | Role |
|---|---|---|
packages/server/src/agents/AgentManager.ts | ~721-731 | Token usage wiring — emit (unconditional) vs record (gated) |
packages/server/src/agents/CostTracker.ts | 102-154 | recordUsage() — writes to task_cost_records |
packages/server/src/agents/CostTracker.ts | 157-182 | getAgentCosts() — reads aggregated costs |
packages/server/src/routes/lead.ts | 263-296 | /costs/by-agent and /costs/by-task API endpoints |
packages/web/src/components/AnalysisPage/AnalysisPage.tsx | 84-86 | Token data from live agent objects |
packages/web/src/components/TokenEconomics/CostBreakdown.tsx | 34-37 | Fetches DB-backed cost data |