codex-usage-api

GitHub

作为 Codex 使用追踪器的证据优先分析助手,通过 MCP 工具诊断 Token 浪费、缓存问题及限额变化。提供从聚合数据到本地索引的深入调查能力,生成假设并给出具体优化建议。

src/codex_usage_tracker/plugin_data/skills/codex-usage-api/SKILL.md douglasmonsky/codex-usage-tracker

触发场景

用户希望讨论或改进 Codex 的使用效率 需要分析 Token 消耗、上下文缓存或限额情况 请求查看使用仪表盘或进行深度使用调查

安装

npx skills add douglasmonsky/codex-usage-tracker --skill codex-usage-api -g -y
更多选项

非标准路径

npx skills add https://github.com/douglasmonsky/codex-usage-tracker/tree/main/src/codex_usage_tracker/plugin_data/skills/codex-usage-api -g -y

不安装直接使用

npx skills use douglasmonsky/codex-usage-tracker@codex-usage-api

指定 Agent (Claude Code)

npx skills add douglasmonsky/codex-usage-tracker --skill codex-usage-api -a claude-code -g -y

安装 repo 全部 skill

npx skills add douglasmonsky/codex-usage-tracker --all -g -y

预览 repo 内 skill

npx skills add douglasmonsky/codex-usage-tracker --list

SKILL.md

Frontmatter
{
    "name": "codex-usage-api",
    "description": "Use when the user wants to discuss, investigate, compare, explain, or improve Codex usage with Codex Usage Tracker API or MCP tools, including token waste, cache\/context problems, allowance or limit changes, pricing confidence, dashboard evidence, and local content-index investigations."
}

Codex Usage API Companion

Act as an evidence-first analyst for Codex Usage Tracker data. Prefer MCP JSON payloads, answer from structured evidence, and keep the user-facing result concise.

Operating Rules

  • For "Open dashboard" style requests, start the live localhost dashboard with codex-usage-tracker serve-dashboard --context-api explicit --open. Refresh is the default for dashboard launch commands. Use open-dashboard only when the user explicitly wants a static/offline snapshot or the environment cannot keep a server alive. Say the result is static and Live requires serve-dashboard.
  • Refresh with refresh_usage_index unless the user asks for a static historical snapshot.
  • Start with aggregate/shareable tools. Do not expose prompts, assistant messages, raw tool output, pasted secrets, raw commands, full paths, or transcript snippets unless the user explicitly asks for local content or raw context.
  • Check top-level schema, content_mode, includes_indexed_content, includes_raw_fragments, row counts, truncation, and caveats before interpreting payloads.
  • Name scope: time window, project/thread/model filters, included archived state, row limit, detail mode, and whether results are estimates.
  • Separate exact facts from estimates. Call out pricing_estimated, missing pricing_model, usage_credit_confidence, missing allowance windows, and outside-usage caveats.
  • For broad asks, give diagnosis plus remediation: Evidence, Hypothesis result, Likely waste pattern, Next action, How to verify.

Agentic Investigation Loop

Use this loop for "look through my usage", "make recommendations", "test hypotheses", "what else should I inspect?", and token-waste discovery:

  1. Start with usage_suggest_investigations(goal=...) when the user needs ideas, otherwise call usage_investigate(goal=...) directly.
  2. Convert findings into explicit hypotheses: I'd like to be able to..., I will accomplish it using..., I'm missing access to..., My hypothesis was true/false/inconclusive because....
  3. Drill into recommended tools such as usage_large_low_output_calls, usage_shell_churn, usage_repeated_file_rediscovery, usage_allowance_diagnostics, usage_threads, or usage_calls.
  4. Recommend concrete fixes, not just summaries: shorter handoff, split thread, preserved cache context, lower effort on routine tasks, targeted script, repo note, skill update, or an existing tool such as Headroom when available and relevant.
  5. End with the verification tool/query the user should run after changing behavior.

For maintainer dogfood or plugin-quality checks, prefer the MCP polling flow when available: call usage_dogfood_start(privacy_mode="strict"), poll usage_dogfood_status(job_id) until completed or failed, then call usage_dogfood_result(job_id). After one fresh run, use usage_dogfood_start(refresh=False, use_cache=True, privacy_mode="strict") for repeated checks on unchanged data and confirm result_cache.hit. Use the blocking CLI fallback only when MCP polling tools are unavailable: codex-usage-tracker dogfood-agentic --privacy-mode strict --json. Treat the output as a compact aggregate QA artifact that must not include raw prompts, raw tool output, full paths, or indexed fragments.

Router

  1. If the user asks what to inspect, wants suggestions, or is unsure where to start, call usage_suggest_investigations(goal=...).
  2. If the user asks broadly to look through usage, find waste, explain expensive usage, improve efficiency, or recommend changes, call usage_investigate(goal="token_waste") or usage_investigate(goal="overview") first, then drill into its recommended_next_tools.
  3. If the user frames the work as hypotheses, asks for true/false/partial decisions, or wants "I'd like to / I will use / I'm missing / hypothesis result" output, call usage_test_hypotheses(question=..., hypotheses=...).
  4. If the user asks whether limits/allowance changed, whether they are throttled, why weekly usage moved, or why the 5-hour counter looks weird, call usage_investigate(goal="allowance_change"), then usage_allowance_diagnostics(window_kind="weekly", privacy_mode="strict") when evidence is needed. Use usage_allowance_export(...) for manually shareable evidence.
  5. If the user asks about cache misses, cold resumes, context bloat, or low-output expensive calls, call usage_investigate(goal="cache_failure"), then inspect usage_large_low_output_calls(...), usage_calls(...), usage_report_pack(...), or usage_context_bloat_scan(...).
  6. If the user asks about repeated shell probing, repeated file rediscovery, or workflow churn, call usage_investigate(goal="workflow_churn"), then inspect usage_shell_churn(...), usage_repeated_file_rediscovery(...), or usage_investigation_walk(question=...).
  7. If the user asks a precise dashboard/API question, use the direct tool: usage_calls, usage_call_detail, usage_threads, usage_summary, usage_query, session_usage, usage_report_pack, usage_dashboard_recommendations, usage_recommendations, most_expensive_usage_calls, usage_pricing_coverage, or usage_source_coverage.
  8. Use usage_content_search(...) and usage_thread_trace(...) only for explicit local content-index exploration when the user agrees transcript-level indexed snippets are needed.
  9. Use usage_call_context(...) only when the user explicitly asks for raw local context and the MCP server has raw context enabled.

Tool Stance

  • usage_suggest_investigations is the front door for ideas. It should return a short, goal-led menu with adjacent safe next options.
  • usage_investigate is the first stop for broad agentic analysis. The default detail_mode="compact" returns evidence summaries and compact rows; use detail_mode="full" only when full underlying diagnostic rows are necessary.
  • usage_test_hypotheses is the first-class hypothesis runner. Use it when the user wants explicit true, false, partially_true, or insufficient_evidence decisions and the "I would like / I will use / I'm missing" framing.
  • usage_allowance_diagnostics is the main allowance-change evidence tool. Treat weekly windows as the primary signal and 5-hour windows as noisy rolling-window context.
  • usage_large_low_output_calls, usage_shell_churn, and usage_repeated_file_rediscovery are the most actionable token-waste probes. Use them to turn broad findings into concrete next steps.
  • usage_investigation_walk can use local content/event-index signals for deeper pattern scans, but it is not the default shareable report.
  • If MCP tools are unavailable, use CLI JSON equivalents documented in docs/cli-json-schemas.md.

Remediation Guidance

Recommend fixes only when supported by evidence. Useful categories include:

  • Dashboard inspection: open Calls, Threads, Call Investigator, Diagnostics Notebook, or Allowance Intelligence around specific evidence rows.
  • Workflow changes: split long threads after planning, preserve handoff summaries, avoid broad rediscovery, lower effort for routine tasks, and narrow test selection before final gates.
  • Existing tools: suggest Headroom when context pressure or handoff timing appears relevant and the tool is available.
  • Custom local solutions: suggest a small script, command, repo note, or skill update when the same file discovery, shell loop, or validation sequence keeps recurring.

Answer Style

  • Lead with the direct answer and strongest metric.
  • Use at most one short progress update, such as "Refreshing aggregate usage, then ranking likely waste patterns."
  • Keep explanations tied to aggregate fields or clearly labeled local-index evidence.
  • Do not guess conversation content from token patterns.
  • For allowance-change answers, separate local evidence from public claims, quote the evidence grade, and say when outside usage or missing observations could explain movement.

版本历史

  • b89f0ca 当前 2026-07-11 18:35

    新增异步 Dogfood 结果缓存与进度轮询功能;重构为智能体调查循环,支持假设驱动的诊断;新增 Shell churn、重复文件发现及低输出调用等 MCP 诊断报告;强化隐私边界与本地内容索引探索能力。

  • 2e3e744 2026-07-05 10:45

同 Skill 集合

skills/codex-usage-api/SKILL.md
skills/codex-usage-tracker/SKILL.md
src/codex_usage_tracker/plugin_data/skills/codex-usage-tracker/SKILL.md

元信息

文件数
0
版本
b89f0ca
Hash
478e24bc
收录时间
2026-07-05 10:45

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-13 18:20
浙ICP备14020137号-1 $访客地图$