codex-usage-insights
Analyze local Codex session logs over a selectable date range, summarize usage by skill, identify skills with no observed use, and generate an animated HTML report plus JSON data. Use when the user asks for Codex usage analytics, skill adoption reports, recent activity summaries, or a visual static dashboard generated with Python.
- License 许可
- MIT
- 最近更新
- 2026-08-09
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- codex-usage-insights
- description
- Analyze local Codex session logs over a selectable date range, summarize usage by skill, identify skills with no observed use, and generate an animated HTML report plus JSON data. Use when the user asks for Codex usage analytics, skill adoption reports, recent activity summaries, or a visual static dashboard generated with Python.
02 资源文件 4
- 参考文档agents/openai.yaml225 B
- 资产文件assets/codex-icon.png41.9 KB
- 资产文件assets/report.html27.8 KB
- 脚本scripts/codex_usage_report.py16.7 KB
03 SKILL.md 正文
Codex Usage Insights
Use the bundled Python CLI to turn local Codex JSONL session logs into a
portable report. The default window is the last seven calendar days; pass
--days, or an inclusive --start and --end, when a different window is
needed.
Quick start
python3 /path/to/codex-usage-insights/scripts/codex_usage_report.py
The command writes an HTML file and, when --data-output is supplied, a JSON
file beside it. The page fetches that JSON when served over HTTP and keeps an
embedded fallback for direct file previews. Use --output to choose another
HTML path.
When running in the Codex desktop app, after the command succeeds, prioritize showing the generated report in the right sidebar browser before replying:
codex_app__open_in_codex({
placement: "right",
target: {
type: "browser",
url: "file:///absolute/path/to/codex-usage-insights/report.html"
}
})
Use the resolved absolute path and a URL-encoded file:// URL. If the sidebar
browser cannot open the local file, retry with the same path as a type: "file"
target. In non-desktop environments, report the absolute output path instead;
do not open a separate system browser first.
Workflow
- Discover
.jsonlfiles under~/.codex/sessionsand~/.codex/archived_sessionsunless--sessions-rootis supplied. - Read event timestamps and user/assistant
response_itemcontent. Ignoresession_meta,turn_context, tool schemas, and system instructions. - Detect explicit skill references (
$skill-name,/skill-name, askills/<name>/SKILL.mdpath, or a known skill name in a user/assistant message). Aggregate mentions, sessions, and first/last seen timestamps. - Discover installed skills from the default Codex skill roots plus any
repeated
--skills-rootvalues. Match their frontmatternamevalues against observed usage to produceunused_skills. - Render the result through
assets/report.html; preserve the report data contract when customizing the visual layer. - After a successful render, open the output in the Codex sidebar browser as described above before returning the completion message.
Evidence and limits
The report is an observation of local JSONL logs, not a billing or server-side usage record. A skill is considered used only when its name is explicitly observable in a message during the selected window. Tool calls that omit a skill name remain unclassified. The report always displays the source roots, file count, and coverage window so the result is auditable.
Custom report data
The renderer consumes a single JSON object with period, generated_at,
totals, skill_usage, projects, unused_skills, timeline, and sources
fields. Each timeline item contains a projects map keyed by the stable
project ID; each project value contains messages, sessions, and a skills
counter. Keep these fields when replacing the template or adding a new
renderer so project/skill trend filters remain functional.