codex-session-insights
v0.2.3
Published
Generate a report analyzing your Codex sessions.
Maintainers
Readme
codex-session-insights
Generate a report analyzing your Codex sessions.
codex-session-insights reads your local Codex history, extracts recurring patterns from your sessions, and renders a narrative report as both HTML and JSON.

Quick Start
Run it directly:
npx codex-session-insightsThe default flow is:
- Read your local Codex thread index
- Estimate likely analysis token usage
- Let you confirm the plan in an interactive terminal
- Generate
report.htmlandreport.json - Try to open the HTML report in your browser
If you only want the estimate first:
npx codex-session-insights --estimate-onlyIf you already know what you want and do not want the confirmation flow:
npx codex-session-insights --yesWhat You Get
By default the tool writes:
~/.codex/usage-data/report.html~/.codex/usage-data/report.json
The HTML report includes these sections:
At a GlanceWhat You Work OnHow You Use CodexImpressive Things You DidWhere Things Go WrongFeatures to TryOn the HorizonOne More Thing
Typical Usage
Default run:
npx codex-session-insightsLite local run for prompt and layout testing:
npx codex-session-insights --preset liteEstimate first, then decide:
npx codex-session-insights --days 7 --limit 20 --facet-limit 8 --estimate-onlyUse a custom output directory:
npx codex-session-insights --out-dir ./insights-outputEmit JSON to stdout instead of a terminal summary:
npx codex-session-insights --stdout-jsonInclude archived threads:
npx codex-session-insights --include-archivedInclude sub-agent threads as well as main threads:
npx codex-session-insights --include-subagentsChoose the report language explicitly:
npx codex-session-insights --lang zh-CN
npx codex-session-insights --lang enUse the OpenAI API instead of your local Codex CLI login:
npx codex-session-insights --provider openai --api-key $OPENAI_API_KEYDefaults
Current default analysis plan:
days:30limit:200facet-limit:50provider:codex-clifacet-model:gpt-5.4-minifast-section-model:gpt-5.4-miniinsight-model:gpt-5.4facet-effort:lowfast-section-effort:lowinsight-effort:high
Important behavior defaults:
--preset litemaps todays=7,limit=20,facet-limit=8,preview=10limitmeans the target number of substantive threads to include in the report, not just the first 50 indexed threadsfacet-limitmeans the max number of uncached per-thread facet analyses to run in a single report- Report language follows a best-effort system locale check
- Main-thread analysis is the default; sub-agent threads are excluded unless you pass
--include-subagents - The CLI shows an estimate before running in interactive terminals
- The CLI tries to open the generated HTML report in your browser after generation
What It Reads
~/.codex/state_*.sqlitefor the thread index~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonlfor rollout events
Requirements
- Node.js
>=18 sqlite3available on your systemPATH- Codex CLI installed if you use the default
codex-cliprovider
Supported platform status:
- macOS: expected to work
- Linux: expected to work if
sqlite3andcodexare installed - Windows: not yet verified
Privacy
The tool reads local Codex data from your machine.
- With
provider=codex-cli, analysis is performed through your local Codex CLI session - With
provider=openai, prompts are sent through the OpenAI Responses API - Generated reports may contain project paths, thread titles, summaries, and other local development context
Review report.html and report.json before sharing them.
Limitations
- Rollout event schemas may drift across Codex versions
- Token estimates are conservative, not billing-accurate
- The tool is designed around Codex local storage layout and is not a generic agent log analyzer
- Windows support is not yet verified
Advanced Overrides
If you want to override the default model split manually:
npx codex-session-insights \
--facet-model gpt-5.4-mini \
--fast-section-model gpt-5.4-mini \
--insight-model gpt-5.4 \
--facet-effort low \
--fast-section-effort low \
--insight-effort highTo suppress browser opening:
npx codex-session-insights --no-openTo force browser opening:
npx codex-session-insights --openFor Contributors
Useful local commands:
npm install
npm test
npm run check
npm run report:lite
npm run generate:test-reportnpm run report:lite runs a smaller local analysis preset for testing prompt and layout changes without paying the full 200/50 default cost.
npm run generate:test-report writes a deterministic sample report page to test-artifacts/sample-report/.
