codex-session-insights 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,199 @@
1
+ # codex-session-insights
2
+
3
+ Generate a report analyzing your Codex sessions.
4
+
5
+ `codex-session-insights` reads your local Codex history, extracts recurring patterns from your sessions, and renders a narrative report as both HTML and JSON.
6
+
7
+ ![codex-session-insights screenshot](https://raw.githubusercontent.com/cosformula/codex-session-insights/main/assets/screenshot-1.png)
8
+
9
+ ## Quick Start
10
+
11
+ Run it directly:
12
+
13
+ ```bash
14
+ npx codex-session-insights
15
+ ```
16
+
17
+ The default flow is:
18
+
19
+ 1. Read your local Codex thread index
20
+ 2. Estimate likely analysis token usage
21
+ 3. Let you confirm the plan in an interactive terminal
22
+ 4. Generate `report.html` and `report.json`
23
+ 5. Try to open the HTML report in your browser
24
+
25
+ If you only want the estimate first:
26
+
27
+ ```bash
28
+ npx codex-session-insights --estimate-only
29
+ ```
30
+
31
+ If you already know what you want and do not want the confirmation flow:
32
+
33
+ ```bash
34
+ npx codex-session-insights --yes
35
+ ```
36
+
37
+ ## What You Get
38
+
39
+ By default the tool writes:
40
+
41
+ - `~/.codex/usage-data/report.html`
42
+ - `~/.codex/usage-data/report.json`
43
+
44
+ The HTML report includes these sections:
45
+
46
+ - `At a Glance`
47
+ - `What You Work On`
48
+ - `How You Use Codex`
49
+ - `Impressive Things You Did`
50
+ - `Where Things Go Wrong`
51
+ - `Features to Try`
52
+ - `On the Horizon`
53
+ - `One More Thing`
54
+
55
+ ## Typical Usage
56
+
57
+ Default run:
58
+
59
+ ```bash
60
+ npx codex-session-insights
61
+ ```
62
+
63
+ Estimate first, then decide:
64
+
65
+ ```bash
66
+ npx codex-session-insights --days 7 --limit 20 --facet-limit 8 --estimate-only
67
+ ```
68
+
69
+ Use a custom output directory:
70
+
71
+ ```bash
72
+ npx codex-session-insights --out-dir ./insights-output
73
+ ```
74
+
75
+ Emit JSON to stdout instead of a terminal summary:
76
+
77
+ ```bash
78
+ npx codex-session-insights --stdout-json
79
+ ```
80
+
81
+ Include archived threads:
82
+
83
+ ```bash
84
+ npx codex-session-insights --include-archived
85
+ ```
86
+
87
+ Include sub-agent threads as well as main threads:
88
+
89
+ ```bash
90
+ npx codex-session-insights --include-subagents
91
+ ```
92
+
93
+ Choose the report language explicitly:
94
+
95
+ ```bash
96
+ npx codex-session-insights --lang zh-CN
97
+ npx codex-session-insights --lang en
98
+ ```
99
+
100
+ Use the OpenAI API instead of your local Codex CLI login:
101
+
102
+ ```bash
103
+ npx codex-session-insights --provider openai --api-key $OPENAI_API_KEY
104
+ ```
105
+
106
+ ## Defaults
107
+
108
+ Current default analysis plan:
109
+
110
+ - `days`: `30`
111
+ - `limit`: `50`
112
+ - `facet-limit`: `20`
113
+ - `provider`: `codex-cli`
114
+ - `facet-model`: `gpt-5.4-mini`
115
+ - `fast-section-model`: `gpt-5.4-mini`
116
+ - `insight-model`: `gpt-5.4`
117
+ - `facet-effort`: `low`
118
+ - `fast-section-effort`: `low`
119
+ - `insight-effort`: `high`
120
+
121
+ Important behavior defaults:
122
+
123
+ - Report language follows a best-effort system locale check
124
+ - Main-thread analysis is the default; sub-agent threads are excluded unless you pass `--include-subagents`
125
+ - The CLI shows an estimate before running in interactive terminals
126
+ - The CLI tries to open the generated HTML report in your browser after generation
127
+
128
+ ## What It Reads
129
+
130
+ - `~/.codex/state_*.sqlite` for the thread index
131
+ - `~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl` for rollout events
132
+
133
+ ## Requirements
134
+
135
+ - Node.js `>=18`
136
+ - `sqlite3` available on your system `PATH`
137
+ - Codex CLI installed if you use the default `codex-cli` provider
138
+
139
+ Supported platform status:
140
+
141
+ - macOS: expected to work
142
+ - Linux: expected to work if `sqlite3` and `codex` are installed
143
+ - Windows: not yet verified
144
+
145
+ ## Privacy
146
+
147
+ The tool reads local Codex data from your machine.
148
+
149
+ - With `provider=codex-cli`, analysis is performed through your local Codex CLI session
150
+ - With `provider=openai`, prompts are sent through the OpenAI Responses API
151
+ - Generated reports may contain project paths, thread titles, summaries, and other local development context
152
+
153
+ Review `report.html` and `report.json` before sharing them.
154
+
155
+ ## Limitations
156
+
157
+ - Rollout event schemas may drift across Codex versions
158
+ - Token estimates are conservative, not billing-accurate
159
+ - The tool is designed around Codex local storage layout and is not a generic agent log analyzer
160
+ - Windows support is not yet verified
161
+
162
+ ## Advanced Overrides
163
+
164
+ If you want to override the default model split manually:
165
+
166
+ ```bash
167
+ npx codex-session-insights \
168
+ --facet-model gpt-5.4-mini \
169
+ --fast-section-model gpt-5.4-mini \
170
+ --insight-model gpt-5.4 \
171
+ --facet-effort low \
172
+ --fast-section-effort low \
173
+ --insight-effort high
174
+ ```
175
+
176
+ To suppress browser opening:
177
+
178
+ ```bash
179
+ npx codex-session-insights --no-open
180
+ ```
181
+
182
+ To force browser opening:
183
+
184
+ ```bash
185
+ npx codex-session-insights --open
186
+ ```
187
+
188
+ ## For Contributors
189
+
190
+ Useful local commands:
191
+
192
+ ```bash
193
+ npm install
194
+ npm test
195
+ npm run check
196
+ npm run generate:test-report
197
+ ```
198
+
199
+ `npm run generate:test-report` writes a deterministic sample report page to `test-artifacts/sample-report/`.
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { runCli } from '../lib/cli.js'
4
+
5
+ runCli(process.argv.slice(2)).catch(error => {
6
+ const message = error instanceof Error ? error.message : String(error)
7
+ console.error(`codex-session-insights: ${message}`)
8
+ process.exitCode = 1
9
+ })