codex-agent-hour-tracker 0.2.2__tar.gz → 0.4.0__tar.gz
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.
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/CHANGELOG.md +15 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/PKG-INFO +78 -6
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/README.md +75 -3
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/community/api.js +15 -6
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/community/db.js +28 -11
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/community/score.js +4 -2
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/docs/community.md +5 -3
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/docs/exports.md +15 -4
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/docs/methodology.md +16 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/functions/community/_middleware.js +2 -2
- codex_agent_hour_tracker-0.4.0/migrations/0002_provider_scores.sql +21 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/pyproject.toml +3 -3
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/site/_headers +1 -2
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/site/app.js +17 -4
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/site/benchmarks/index.html +6 -5
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/site/community/index.html +10 -4
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/site/community.js +19 -7
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/site/index.html +35 -16
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/site/score.mjs +12 -6
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/site/styles.css +8 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/skills/codex-agent-hour-tracker/SKILL.md +17 -6
- codex_agent_hour_tracker-0.4.0/src/agent_hour_tracker/__init__.py +6 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/src/agent_hour_tracker/archive.py +66 -55
- codex_agent_hour_tracker-0.4.0/src/agent_hour_tracker/claude_scanner.py +220 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/src/agent_hour_tracker/cli.py +124 -52
- codex_agent_hour_tracker-0.4.0/src/agent_hour_tracker/google_timing.py +175 -0
- codex_agent_hour_tracker-0.4.0/src/agent_hour_tracker/google_usage.py +216 -0
- codex_agent_hour_tracker-0.4.0/src/agent_hour_tracker/muse_usage.py +270 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/src/agent_hour_tracker/report.py +17 -2
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/src/agent_hour_tracker/scanner.py +1 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/src/agent_hour_tracker/share.py +21 -4
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/community-api.mjs +44 -1
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/community-auth.mjs +1 -1
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/community-database.mjs +49 -1
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/community-headers.mjs +4 -2
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/community-runtime.mjs +1 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/community-score.mjs +17 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/community-security-auth.mjs +1 -4
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/site-local.mjs +13 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/site-score.mjs +24 -3
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/site-ui.mjs +70 -1
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/test_archive.py +1 -1
- codex_agent_hour_tracker-0.4.0/tests/test_claude_scanner.py +229 -0
- codex_agent_hour_tracker-0.4.0/tests/test_google_usage.py +200 -0
- codex_agent_hour_tracker-0.4.0/tests/test_muse_usage.py +212 -0
- codex_agent_hour_tracker-0.4.0/tests/test_provider_integration.py +180 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/test_public_files.py +4 -3
- codex_agent_hour_tracker-0.4.0/tests/test_public_share.py +71 -0
- codex_agent_hour_tracker-0.2.2/src/agent_hour_tracker/__init__.py +0 -6
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/.gitignore +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/LICENSE +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/SECURITY.md +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/community/auth.js +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/community/cookies.js +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/community/crypto.js +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/community-env.d.ts +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/docs/account-usage.md +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/functions/api/community/[[path]].js +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/migrations/0001_community.sql +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/package-lock.json +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/package.json +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/scripts/export_account_usage.py +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/scripts/sync_benchmarks.py +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/site/benchmarks-data.js +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/site/benchmarks.js +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/site/favicon.png +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/site/favicon.svg +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/site/social-card.png +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/skills/codex-agent-hour-tracker/agents/openai.yaml +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/src/agent_hour_tracker/__main__.py +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/src/agent_hour_tracker/account_usage.py +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/src/agent_hour_tracker/benchmarks.json +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/src/agent_hour_tracker/benchmarks.py +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/src/agent_hour_tracker/metrics.py +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/src/agent_hour_tracker/session_io.py +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/test_account_usage_exporter.py +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/test_cli.py +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/test_compressed_sessions.py +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/test_metrics.py +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/test_report.py +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/test_scanner.py +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/tests/test_v020_reports.py +0 -0
- {codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/wrangler.jsonc +0 -0
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
- Add `agent-hours usage` for private daily token and measured-hours reports for Antigravity and Muse Code. Read retained local journals for Muse Code and show available results when a provider's data is missing.
|
|
6
|
+
- Add `agent-hours google-usage` as an Antigravity-only alias.
|
|
7
|
+
|
|
8
|
+
## 0.3.0
|
|
9
|
+
|
|
10
|
+
- Add Claude Code native main and completed foreground-agent timing scans and Codex, Claude, or combined local reports.
|
|
11
|
+
- Add repeatable Claude roots, provider breakdowns, and combined CSV provider columns.
|
|
12
|
+
- Write provider-aware private archive schema v2. Continue reading v1 as Codex and deduplicate copied histories within each provider.
|
|
13
|
+
- Add Claude and combined `--share` text and public JSON schema v2 with an explicit provider. Preserve Codex public JSON schema v1.
|
|
14
|
+
- Add provider selections to share cards and separate community boards by provider and session scope. Preserve the shared five-post account quota and aggregate-only public fields.
|
|
15
|
+
- Keep historical benchmarks Codex-only. Label Claude main-session origin as unverified in Claude and combined views.
|
|
16
|
+
- Exclude Claude history without native timing and unverified human initiation from human-root statistics.
|
|
17
|
+
|
|
3
18
|
## 0.2.2
|
|
4
19
|
|
|
5
20
|
- Add `agent-hours account-usage` for private, service-reported ChatGPT account usage JSON and daily CSV.
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: codex-agent-hour-tracker
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Measure cumulative Codex agent runtime without decoding conversation content.
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Measure cumulative Codex and Claude Code agent runtime without decoding conversation content.
|
|
5
5
|
Project-URL: Homepage, https://agenthours.dev
|
|
6
6
|
Project-URL: Repository, https://github.com/tim-osterhus/codex-agent-hour-tracker
|
|
7
7
|
Project-URL: Issues, https://github.com/tim-osterhus/codex-agent-hour-tracker/issues
|
|
8
8
|
Author-email: Tim Osterhus <tim@millrace.ai>
|
|
9
9
|
License-Expression: MIT
|
|
10
10
|
License-File: LICENSE
|
|
11
|
-
Keywords: agents,analytics,codex,privacy
|
|
11
|
+
Keywords: agents,analytics,claude-code,codex,privacy
|
|
12
12
|
Classifier: License :: OSI Approved :: MIT License
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -27,7 +27,7 @@ Description-Content-Type: text/markdown
|
|
|
27
27
|
|
|
28
28
|
# Agent Hours
|
|
29
29
|
|
|
30
|
-
Agent Hours is a local CLI that measures
|
|
30
|
+
Agent Hours is a local CLI that measures Codex and Claude Code agent-hours. It also reports local token counts and measured runtime for Antigravity and Muse Code.
|
|
31
31
|
|
|
32
32
|
See your runtime across profiles and machines, calculate optional Agent Leverage, and make a share card at [agenthours.dev](https://agenthours.dev).
|
|
33
33
|
|
|
@@ -43,7 +43,7 @@ The score is mean cumulative runtime across the 30 most recent completed local c
|
|
|
43
43
|
|
|
44
44
|
If today is March 1 in a non-leap year, the window is January 30 through February 28. Custom date ranges produce reports, not canonical scores.
|
|
45
45
|
|
|
46
|
-
The default `interactive-only` scope excludes exec/batch files. It includes delegated turns and non-batch turns with uncertain source metadata. Use `--include-exec` to count exec/batch work as well. Every score states its scope.
|
|
46
|
+
The default Codex `interactive-only` scope excludes exec/batch files. It includes delegated turns and non-batch turns with uncertain source metadata. Use `--include-exec` to count exec/batch work as well. Every score states its scope.
|
|
47
47
|
|
|
48
48
|
## Install once
|
|
49
49
|
|
|
@@ -61,6 +61,72 @@ codex-agent-hour-tracker --share
|
|
|
61
61
|
|
|
62
62
|
Both command names invoke the same tool. Upgrade an existing uv installation with `uv tool upgrade codex-agent-hour-tracker`.
|
|
63
63
|
|
|
64
|
+
## Claude Code and combined reports
|
|
65
|
+
|
|
66
|
+
Codex remains the default. Select Claude Code or combine both providers:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
agent-hours --provider claude
|
|
70
|
+
agent-hours --provider all --monthly
|
|
71
|
+
agent-hours --provider all --sessions-dir ~/.codex/sessions --claude-sessions-dir ~/.claude/projects
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Both directory options are repeatable. Explicit Claude roots select Claude when `--provider` is omitted. Supplying both root options selects both providers.
|
|
75
|
+
|
|
76
|
+
Claude discovery uses `$CLAUDE_CONFIG_DIR/projects`, or `~/.claude/projects` when the variable is unset. Combined discovery skips missing default roots. Explicit missing roots produce errors.
|
|
77
|
+
|
|
78
|
+
Claude main totals use native `system` / `turn_duration` records with `durationMs`, a timestamp, and an immutable UUID. Delegated totals use completed foreground-agent summaries with `totalDurationMs`, agent ID, completion UUID, and timestamp. The start is the recorded end minus the native duration. Async launches and histories without either timing source contribute no runtime. Child-native timers are excluded to avoid counting the same delegated run twice. Transcript gaps, prompts, and assistant timestamps never supply estimated durations. Claude main-session human initiation is unverified, so those turns do not enter human-initiated statistics. Claude native totals may include SDK or headless activity because origin cannot be verified.
|
|
79
|
+
|
|
80
|
+
Combined reports show provider subtotals and add concurrent runtime across both providers. Combined CSV appends provider hours and turn counts to the aggregate columns. Single-provider CSV retains the existing three columns.
|
|
81
|
+
|
|
82
|
+
Public `--share` output supports Codex, Claude Code, and combined totals. Historical published benchmarks remain Codex-only. Claude and combined scores retain the timing coverage and origin limits described above.
|
|
83
|
+
|
|
84
|
+
For four machines, run this export on each machine with a distinct label and filename:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
agent-hours --provider all --export reports/machine1.agent-hours-private.json --label machine1
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Privately transfer the four archives, then combine them:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
agent-hours --provider all --timezone Pacific/Honolulu --monthly \
|
|
94
|
+
--merge reports/machine1.agent-hours-private.json \
|
|
95
|
+
--merge reports/machine2.agent-hours-private.json \
|
|
96
|
+
--merge reports/machine3.agent-hours-private.json \
|
|
97
|
+
--merge reports/machine4.agent-hours-private.json
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Use the same imports with `--provider codex` or `--provider claude` for separate totals. Merge-only commands do not scan local defaults. Copied histories are deduplicated within each provider. Keep archives private. See [export contracts](docs/exports.md).
|
|
101
|
+
|
|
102
|
+
## Antigravity
|
|
103
|
+
|
|
104
|
+
Install [ccusage](https://ccusage.com/guide/installation) v20.0.51 or later for local token counts, including cached tokens. Agent Hours runs it offline. The command defaults to the last 30 completed days.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
npm install -g ccusage
|
|
108
|
+
agent-hours google-usage
|
|
109
|
+
agent-hours usage --provider antigravity --format csv --timezone Pacific/Honolulu
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Use `--ccusage EXECUTABLE` if ccusage is outside your PATH. Set `ANTIGRAVITY_DATA_DIR` for a custom data root. Keep daily reports private.
|
|
113
|
+
|
|
114
|
+
Antigravity hours come from recorded generation and execution intervals in local conversation database metadata. Overlapping intervals count once within a conversation, and separate conversations add independently. Each interval is attributed to its start date. Missing timing is displayed as unavailable (a blank CSV cell). These hours are separate from the public Agent-Hour Score.
|
|
115
|
+
|
|
116
|
+
## Muse Code and combined usage
|
|
117
|
+
|
|
118
|
+
`agent-hours usage` reports Antigravity and Muse Code in one private report. The `google-usage` alias reports Antigravity alone. Use repeatable `--muse-sessions-dir PATH` to specify existing Muse Code session roots, or omit it to use default Muse Code session discovery.
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
agent-hours usage --provider muse
|
|
122
|
+
agent-hours usage --provider muse --muse-sessions-dir ~/private/muse-sessions --format csv
|
|
123
|
+
agent-hours usage --provider all
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Muse Code runs without ccusage. With `--provider all`, missing ccusage makes Antigravity and combined token totals unavailable. The report still shows Muse Code usage and available measured hours, and the command exits with status 1. A failed token read for any requested provider also exits with status 1.
|
|
127
|
+
|
|
128
|
+
Muse Code figures come from retained local session logs. Measured hours cover recorded model and tool execution. The report shows Muse Code tokens as unavailable when it finds no readable logs. Skipped or unsupported records produce a partial-coverage warning. [Meta's session audit guide](https://dev.meta.ai/docs/cookbook/audit-agent-sessions)
|
|
129
|
+
|
|
64
130
|
## Private ChatGPT account usage
|
|
65
131
|
|
|
66
132
|
```bash
|
|
@@ -91,19 +157,25 @@ Agent Leverage divides agent runtime by human hours over the same period. A week
|
|
|
91
157
|
|
|
92
158
|
```bash
|
|
93
159
|
agent-hours --share --format json
|
|
160
|
+
agent-hours --provider claude --share --format json
|
|
161
|
+
agent-hours --provider all --share --format json
|
|
94
162
|
```
|
|
95
163
|
|
|
96
164
|
Upload or paste this sanitized aggregate JSON into the [share studio](https://agenthours.dev/#share). Preview and download a square or landscape PNG/SVG in your browser. Importing a score and making a card run locally. The website accepts only the public score schema.
|
|
97
165
|
|
|
166
|
+
Codex public JSON keeps schema v1. Claude and combined JSON use schema v2 with an explicit provider. Combined public scores contain one aggregate. The `scope` field selects Codex source eligibility. Claude native turns retain unverified main-session origin under either scope. See [export contracts](docs/exports.md).
|
|
167
|
+
|
|
98
168
|
`--share` is the safe default for sharing, but dates, counts, durations, timezone, and optional human-hours assumptions remain a deliberate aggregate disclosure. Review the card before posting it.
|
|
99
169
|
|
|
100
170
|
## Join the community scoreboard
|
|
101
171
|
|
|
102
172
|
The separate [community page](https://agenthours.dev/community/) shows self-reported scores. GitHub sign-in identifies the person posting, but does not verify their runtime. Scores can be edited or inflated.
|
|
103
173
|
|
|
174
|
+
Codex, Claude, and combined scores have separate boards for each session scope. Posting replaces your score for that provider and scope. Historical Codex benchmarks do not establish Claude or combined rankings.
|
|
175
|
+
|
|
104
176
|
After importing your score, choose **Share to community**. Review the public fields, sign in with GitHub, and confirm the post. Importing a file never posts it. The community score omits Agent Leverage and human-hours assumptions.
|
|
105
177
|
|
|
106
|
-
Each GitHub account can make five successful posts in a rolling 30-day window. Updating a score counts as a post. Deleting it does not refund a slot. The page warns you after your fourth post and shows when a slot opens.
|
|
178
|
+
Each GitHub account can make five successful posts in a rolling 30-day window across all providers and session scopes. Updating a score counts as a post. Deleting it does not refund a slot. The page warns you after your fourth post and shows when a slot opens.
|
|
107
179
|
|
|
108
180
|
The local card tool works without an account or community access. Hosting and privacy details are in the [community guide](docs/community.md).
|
|
109
181
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Agent Hours
|
|
2
2
|
|
|
3
|
-
Agent Hours is a local CLI that measures
|
|
3
|
+
Agent Hours is a local CLI that measures Codex and Claude Code agent-hours. It also reports local token counts and measured runtime for Antigravity and Muse Code.
|
|
4
4
|
|
|
5
5
|
See your runtime across profiles and machines, calculate optional Agent Leverage, and make a share card at [agenthours.dev](https://agenthours.dev).
|
|
6
6
|
|
|
@@ -16,7 +16,7 @@ The score is mean cumulative runtime across the 30 most recent completed local c
|
|
|
16
16
|
|
|
17
17
|
If today is March 1 in a non-leap year, the window is January 30 through February 28. Custom date ranges produce reports, not canonical scores.
|
|
18
18
|
|
|
19
|
-
The default `interactive-only` scope excludes exec/batch files. It includes delegated turns and non-batch turns with uncertain source metadata. Use `--include-exec` to count exec/batch work as well. Every score states its scope.
|
|
19
|
+
The default Codex `interactive-only` scope excludes exec/batch files. It includes delegated turns and non-batch turns with uncertain source metadata. Use `--include-exec` to count exec/batch work as well. Every score states its scope.
|
|
20
20
|
|
|
21
21
|
## Install once
|
|
22
22
|
|
|
@@ -34,6 +34,72 @@ codex-agent-hour-tracker --share
|
|
|
34
34
|
|
|
35
35
|
Both command names invoke the same tool. Upgrade an existing uv installation with `uv tool upgrade codex-agent-hour-tracker`.
|
|
36
36
|
|
|
37
|
+
## Claude Code and combined reports
|
|
38
|
+
|
|
39
|
+
Codex remains the default. Select Claude Code or combine both providers:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
agent-hours --provider claude
|
|
43
|
+
agent-hours --provider all --monthly
|
|
44
|
+
agent-hours --provider all --sessions-dir ~/.codex/sessions --claude-sessions-dir ~/.claude/projects
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Both directory options are repeatable. Explicit Claude roots select Claude when `--provider` is omitted. Supplying both root options selects both providers.
|
|
48
|
+
|
|
49
|
+
Claude discovery uses `$CLAUDE_CONFIG_DIR/projects`, or `~/.claude/projects` when the variable is unset. Combined discovery skips missing default roots. Explicit missing roots produce errors.
|
|
50
|
+
|
|
51
|
+
Claude main totals use native `system` / `turn_duration` records with `durationMs`, a timestamp, and an immutable UUID. Delegated totals use completed foreground-agent summaries with `totalDurationMs`, agent ID, completion UUID, and timestamp. The start is the recorded end minus the native duration. Async launches and histories without either timing source contribute no runtime. Child-native timers are excluded to avoid counting the same delegated run twice. Transcript gaps, prompts, and assistant timestamps never supply estimated durations. Claude main-session human initiation is unverified, so those turns do not enter human-initiated statistics. Claude native totals may include SDK or headless activity because origin cannot be verified.
|
|
52
|
+
|
|
53
|
+
Combined reports show provider subtotals and add concurrent runtime across both providers. Combined CSV appends provider hours and turn counts to the aggregate columns. Single-provider CSV retains the existing three columns.
|
|
54
|
+
|
|
55
|
+
Public `--share` output supports Codex, Claude Code, and combined totals. Historical published benchmarks remain Codex-only. Claude and combined scores retain the timing coverage and origin limits described above.
|
|
56
|
+
|
|
57
|
+
For four machines, run this export on each machine with a distinct label and filename:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
agent-hours --provider all --export reports/machine1.agent-hours-private.json --label machine1
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Privately transfer the four archives, then combine them:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
agent-hours --provider all --timezone Pacific/Honolulu --monthly \
|
|
67
|
+
--merge reports/machine1.agent-hours-private.json \
|
|
68
|
+
--merge reports/machine2.agent-hours-private.json \
|
|
69
|
+
--merge reports/machine3.agent-hours-private.json \
|
|
70
|
+
--merge reports/machine4.agent-hours-private.json
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Use the same imports with `--provider codex` or `--provider claude` for separate totals. Merge-only commands do not scan local defaults. Copied histories are deduplicated within each provider. Keep archives private. See [export contracts](docs/exports.md).
|
|
74
|
+
|
|
75
|
+
## Antigravity
|
|
76
|
+
|
|
77
|
+
Install [ccusage](https://ccusage.com/guide/installation) v20.0.51 or later for local token counts, including cached tokens. Agent Hours runs it offline. The command defaults to the last 30 completed days.
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm install -g ccusage
|
|
81
|
+
agent-hours google-usage
|
|
82
|
+
agent-hours usage --provider antigravity --format csv --timezone Pacific/Honolulu
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Use `--ccusage EXECUTABLE` if ccusage is outside your PATH. Set `ANTIGRAVITY_DATA_DIR` for a custom data root. Keep daily reports private.
|
|
86
|
+
|
|
87
|
+
Antigravity hours come from recorded generation and execution intervals in local conversation database metadata. Overlapping intervals count once within a conversation, and separate conversations add independently. Each interval is attributed to its start date. Missing timing is displayed as unavailable (a blank CSV cell). These hours are separate from the public Agent-Hour Score.
|
|
88
|
+
|
|
89
|
+
## Muse Code and combined usage
|
|
90
|
+
|
|
91
|
+
`agent-hours usage` reports Antigravity and Muse Code in one private report. The `google-usage` alias reports Antigravity alone. Use repeatable `--muse-sessions-dir PATH` to specify existing Muse Code session roots, or omit it to use default Muse Code session discovery.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
agent-hours usage --provider muse
|
|
95
|
+
agent-hours usage --provider muse --muse-sessions-dir ~/private/muse-sessions --format csv
|
|
96
|
+
agent-hours usage --provider all
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Muse Code runs without ccusage. With `--provider all`, missing ccusage makes Antigravity and combined token totals unavailable. The report still shows Muse Code usage and available measured hours, and the command exits with status 1. A failed token read for any requested provider also exits with status 1.
|
|
100
|
+
|
|
101
|
+
Muse Code figures come from retained local session logs. Measured hours cover recorded model and tool execution. The report shows Muse Code tokens as unavailable when it finds no readable logs. Skipped or unsupported records produce a partial-coverage warning. [Meta's session audit guide](https://dev.meta.ai/docs/cookbook/audit-agent-sessions)
|
|
102
|
+
|
|
37
103
|
## Private ChatGPT account usage
|
|
38
104
|
|
|
39
105
|
```bash
|
|
@@ -64,19 +130,25 @@ Agent Leverage divides agent runtime by human hours over the same period. A week
|
|
|
64
130
|
|
|
65
131
|
```bash
|
|
66
132
|
agent-hours --share --format json
|
|
133
|
+
agent-hours --provider claude --share --format json
|
|
134
|
+
agent-hours --provider all --share --format json
|
|
67
135
|
```
|
|
68
136
|
|
|
69
137
|
Upload or paste this sanitized aggregate JSON into the [share studio](https://agenthours.dev/#share). Preview and download a square or landscape PNG/SVG in your browser. Importing a score and making a card run locally. The website accepts only the public score schema.
|
|
70
138
|
|
|
139
|
+
Codex public JSON keeps schema v1. Claude and combined JSON use schema v2 with an explicit provider. Combined public scores contain one aggregate. The `scope` field selects Codex source eligibility. Claude native turns retain unverified main-session origin under either scope. See [export contracts](docs/exports.md).
|
|
140
|
+
|
|
71
141
|
`--share` is the safe default for sharing, but dates, counts, durations, timezone, and optional human-hours assumptions remain a deliberate aggregate disclosure. Review the card before posting it.
|
|
72
142
|
|
|
73
143
|
## Join the community scoreboard
|
|
74
144
|
|
|
75
145
|
The separate [community page](https://agenthours.dev/community/) shows self-reported scores. GitHub sign-in identifies the person posting, but does not verify their runtime. Scores can be edited or inflated.
|
|
76
146
|
|
|
147
|
+
Codex, Claude, and combined scores have separate boards for each session scope. Posting replaces your score for that provider and scope. Historical Codex benchmarks do not establish Claude or combined rankings.
|
|
148
|
+
|
|
77
149
|
After importing your score, choose **Share to community**. Review the public fields, sign in with GitHub, and confirm the post. Importing a file never posts it. The community score omits Agent Leverage and human-hours assumptions.
|
|
78
150
|
|
|
79
|
-
Each GitHub account can make five successful posts in a rolling 30-day window. Updating a score counts as a post. Deleting it does not refund a slot. The page warns you after your fourth post and shows when a slot opens.
|
|
151
|
+
Each GitHub account can make five successful posts in a rolling 30-day window across all providers and session scopes. Updating a score counts as a post. Deleting it does not refund a slot. The page warns you after your fourth post and shows when a slot opens.
|
|
80
152
|
|
|
81
153
|
The local card tool works without an account or community access. Hosting and privacy details are in the [community guide](docs/community.md).
|
|
82
154
|
|
|
@@ -147,7 +147,7 @@ async function boundedRequestText(request, maxBytes = MAX_BODY_BYTES) {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
async function readJsonBody(request, expectedKeys) {
|
|
150
|
+
async function readJsonBody(request, expectedKeys, optionalKeys = []) {
|
|
151
151
|
const contentType = request.headers.get("Content-Type") ?? "";
|
|
152
152
|
if (!/^application\/json(?:\s*;|$)/i.test(contentType)) {
|
|
153
153
|
throw error("request_invalid", 400, "The request must use JSON.");
|
|
@@ -163,7 +163,7 @@ async function readJsonBody(request, expectedKeys) {
|
|
|
163
163
|
body === null ||
|
|
164
164
|
typeof body !== "object" ||
|
|
165
165
|
Array.isArray(body) ||
|
|
166
|
-
Object.keys(body).
|
|
166
|
+
Object.keys(body).some((key) => !expectedKeys.includes(key) && !optionalKeys.includes(key)) ||
|
|
167
167
|
expectedKeys.some((key) => !Object.hasOwn(body, key))
|
|
168
168
|
) {
|
|
169
169
|
throw error("request_invalid", 400, "The request fields are invalid.");
|
|
@@ -313,14 +313,15 @@ async function postScore(request, env, { now, fetchImpl }) {
|
|
|
313
313
|
|
|
314
314
|
async function deleteScore(request, env, { now }) {
|
|
315
315
|
const session = await requireMutationSession(request, env, now);
|
|
316
|
-
const body = await readJsonBody(request, ["scope"]);
|
|
316
|
+
const body = await readJsonBody(request, ["scope"], ["provider"]);
|
|
317
|
+
const provider = providerValue(body.provider);
|
|
317
318
|
if (body.scope !== "interactive-only" && body.scope !== "including-exec") {
|
|
318
319
|
throw error("request_invalid", 400, "The score scope is invalid.");
|
|
319
320
|
}
|
|
320
321
|
if (!(await consumeWriteRateLimit(dbRequired(env), env, request, now))) {
|
|
321
322
|
throw error("rate_limited", 429, "Too many community requests. Try again shortly.");
|
|
322
323
|
}
|
|
323
|
-
await deleteOwnScore(dbRequired(env), { githubId: session.githubId, scope: body.scope });
|
|
324
|
+
await deleteOwnScore(dbRequired(env), { githubId: session.githubId, scope: body.scope, provider });
|
|
324
325
|
return responseJson({ ok: true });
|
|
325
326
|
}
|
|
326
327
|
|
|
@@ -353,16 +354,24 @@ async function session(request, env, now) {
|
|
|
353
354
|
});
|
|
354
355
|
}
|
|
355
356
|
|
|
357
|
+
function providerValue(value = "codex") {
|
|
358
|
+
if (value !== "codex" && value !== "claude" && value !== "all") {
|
|
359
|
+
throw error("request_invalid", 400, "The score provider is invalid.");
|
|
360
|
+
}
|
|
361
|
+
return value;
|
|
362
|
+
}
|
|
363
|
+
|
|
356
364
|
async function board(url, env, now) {
|
|
357
365
|
const db = dbRequired(env);
|
|
358
|
-
if (url.searchParams.getAll("scope").length !== 1 || [...url.searchParams.keys()].some((key) => key !== "scope")) {
|
|
366
|
+
if (url.searchParams.getAll("scope").length !== 1 || url.searchParams.getAll("provider").length > 1 || [...url.searchParams.keys()].some((key) => key !== "scope" && key !== "provider")) {
|
|
359
367
|
throw error("request_invalid", 400, "A score scope is required.");
|
|
360
368
|
}
|
|
361
369
|
const scope = url.searchParams.get("scope");
|
|
362
370
|
if (scope !== "interactive-only" && scope !== "including-exec") {
|
|
363
371
|
throw error("request_invalid", 400, "The score scope is invalid.");
|
|
364
372
|
}
|
|
365
|
-
|
|
373
|
+
const provider = providerValue(url.searchParams.has("provider") ? url.searchParams.get("provider") : undefined);
|
|
374
|
+
return responseJson({ scores: await getPublicScores(db, scope, { now, limit: 50, provider }) }, 200, { cache: "public, max-age=60" });
|
|
366
375
|
}
|
|
367
376
|
|
|
368
377
|
const AUTH_MESSAGES = Object.freeze({
|
|
@@ -27,6 +27,13 @@ function normalizedScope(scope) {
|
|
|
27
27
|
return scope;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
function normalizedProvider(provider = "codex") {
|
|
31
|
+
if (provider !== "codex" && provider !== "claude" && provider !== "all") {
|
|
32
|
+
throw new DatabaseError();
|
|
33
|
+
}
|
|
34
|
+
return provider;
|
|
35
|
+
}
|
|
36
|
+
|
|
30
37
|
async function requestRow(db, requestId) {
|
|
31
38
|
return db
|
|
32
39
|
.prepare(
|
|
@@ -103,6 +110,7 @@ export async function recordAcceptedScore(
|
|
|
103
110
|
}
|
|
104
111
|
if (typeof requestId !== "string" || !requestId) throw new DatabaseError();
|
|
105
112
|
const scope = normalizedScope(score?.scope);
|
|
113
|
+
const provider = normalizedProvider(score?.provider);
|
|
106
114
|
const nowMs = assertNow(now);
|
|
107
115
|
const digest = await scoreDigest(score);
|
|
108
116
|
const existing = await requestRow(db, requestId);
|
|
@@ -134,9 +142,11 @@ export async function recordAcceptedScore(
|
|
|
134
142
|
.bind(requestId, githubId, scope, digest, nowMs),
|
|
135
143
|
db
|
|
136
144
|
.prepare(
|
|
137
|
-
|
|
145
|
+
provider === "codex"
|
|
146
|
+
? "INSERT INTO community_scores (github_id, scope, login, score_json, score_digest, window_end, window_timezone, eligible_until, agent_hours_per_day, updated_at, request_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT(github_id, scope) DO UPDATE SET login = excluded.login, score_json = excluded.score_json, score_digest = excluded.score_digest, window_end = excluded.window_end, window_timezone = excluded.window_timezone, eligible_until = excluded.eligible_until, agent_hours_per_day = excluded.agent_hours_per_day, updated_at = excluded.updated_at, request_id = excluded.request_id"
|
|
147
|
+
: "INSERT INTO community_provider_scores (github_id, scope, login, score_json, score_digest, window_end, window_timezone, eligible_until, agent_hours_per_day, updated_at, request_id, provider) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ON CONFLICT(github_id, scope, provider) DO UPDATE SET login = excluded.login, score_json = excluded.score_json, score_digest = excluded.score_digest, window_end = excluded.window_end, window_timezone = excluded.window_timezone, eligible_until = excluded.eligible_until, agent_hours_per_day = excluded.agent_hours_per_day, updated_at = excluded.updated_at, request_id = excluded.request_id",
|
|
138
148
|
)
|
|
139
|
-
.bind(
|
|
149
|
+
.bind(...[
|
|
140
150
|
githubId,
|
|
141
151
|
scope,
|
|
142
152
|
login,
|
|
@@ -148,7 +158,8 @@ export async function recordAcceptedScore(
|
|
|
148
158
|
score.metrics.agent_hours_per_day,
|
|
149
159
|
updatedAt,
|
|
150
160
|
requestId,
|
|
151
|
-
|
|
161
|
+
...(provider === "codex" ? [] : [provider]),
|
|
162
|
+
]),
|
|
152
163
|
]);
|
|
153
164
|
if (!Array.isArray(results) || !results[2]) throw new DatabaseError();
|
|
154
165
|
} catch (error) {
|
|
@@ -167,20 +178,23 @@ export async function recordAcceptedScore(
|
|
|
167
178
|
};
|
|
168
179
|
}
|
|
169
180
|
|
|
170
|
-
export async function deleteOwnScore(db, { githubId, scope }) {
|
|
181
|
+
export async function deleteOwnScore(db, { githubId, scope, provider = "codex" }) {
|
|
171
182
|
normalizedScope(scope);
|
|
183
|
+
normalizedProvider(provider);
|
|
172
184
|
await db
|
|
173
|
-
.prepare(
|
|
174
|
-
|
|
185
|
+
.prepare(provider === "codex"
|
|
186
|
+
? "DELETE FROM community_scores WHERE github_id = ? AND scope = ?"
|
|
187
|
+
: "DELETE FROM community_provider_scores WHERE github_id = ? AND scope = ? AND provider = ?")
|
|
188
|
+
.bind(...[githubId, scope, ...(provider === "codex" ? [] : [provider])])
|
|
175
189
|
.run();
|
|
176
190
|
}
|
|
177
191
|
|
|
178
192
|
export async function getUserScores(db, githubId) {
|
|
179
193
|
const rows = await db
|
|
180
194
|
.prepare(
|
|
181
|
-
"SELECT login, score_json, updated_at FROM community_scores WHERE github_id = ? ORDER BY scope ASC",
|
|
195
|
+
"SELECT login, score_json, updated_at, scope, 'codex' AS provider FROM community_scores WHERE github_id = ? UNION ALL SELECT login, score_json, updated_at, scope, provider FROM community_provider_scores WHERE github_id = ? ORDER BY scope ASC, provider ASC",
|
|
182
196
|
)
|
|
183
|
-
.bind(githubId)
|
|
197
|
+
.bind(githubId, githubId)
|
|
184
198
|
.all();
|
|
185
199
|
return (rows.results ?? []).flatMap((row) => {
|
|
186
200
|
try {
|
|
@@ -191,15 +205,18 @@ export async function getUserScores(db, githubId) {
|
|
|
191
205
|
});
|
|
192
206
|
}
|
|
193
207
|
|
|
194
|
-
export async function getPublicScores(db, scope, { now, limit = MAX_BOARD_ROWS } = {}) {
|
|
208
|
+
export async function getPublicScores(db, scope, { now, limit = MAX_BOARD_ROWS, provider = "codex" } = {}) {
|
|
195
209
|
normalizedScope(scope);
|
|
210
|
+
normalizedProvider(provider);
|
|
196
211
|
const nowMs = assertNow(now);
|
|
197
212
|
const boundedLimit = Math.min(MAX_BOARD_ROWS, Math.max(1, Number(limit) || MAX_BOARD_ROWS));
|
|
198
213
|
const rows = await db
|
|
199
214
|
.prepare(
|
|
200
|
-
|
|
215
|
+
provider === "codex"
|
|
216
|
+
? "SELECT login, score_json, updated_at FROM community_scores WHERE scope = ? AND eligible_until > ? ORDER BY agent_hours_per_day DESC, login ASC LIMIT ?"
|
|
217
|
+
: "SELECT login, score_json, updated_at FROM community_provider_scores WHERE scope = ? AND eligible_until > ? AND provider = ? ORDER BY agent_hours_per_day DESC, login ASC LIMIT ?",
|
|
201
218
|
)
|
|
202
|
-
.bind(scope, nowMs, boundedLimit)
|
|
219
|
+
.bind(...[scope, nowMs, ...(provider === "codex" ? [] : [provider]), boundedLimit])
|
|
203
220
|
.all();
|
|
204
221
|
return (rows.results ?? []).flatMap((row) => {
|
|
205
222
|
try {
|
|
@@ -3,6 +3,7 @@ const MAX_SCORE_BYTES = 32_768;
|
|
|
3
3
|
const MAX_HOURS_PER_DAY = 1_000_000_000;
|
|
4
4
|
const MAX_TOTAL_HOURS = 30_000_000_000;
|
|
5
5
|
const MAX_TURNS = 100_000_000;
|
|
6
|
+
const PROVIDERS = new Set(["codex", "claude", "all"]);
|
|
6
7
|
const SCOPES = new Set(["interactive-only", "including-exec"]);
|
|
7
8
|
|
|
8
9
|
const TOP_LEVEL_KEYS = [
|
|
@@ -168,10 +169,11 @@ export function parseScore(input, { now = Date.now() } = {}) {
|
|
|
168
169
|
invalid("Public score JSON must be 32 KB or smaller.");
|
|
169
170
|
}
|
|
170
171
|
|
|
171
|
-
exactKeys(score, TOP_LEVEL_KEYS);
|
|
172
|
+
exactKeys(score, score.schema_version === 2 ? [...TOP_LEVEL_KEYS, "provider"] : TOP_LEVEL_KEYS);
|
|
172
173
|
if (
|
|
173
174
|
score.schema !== "agent-hours-score" ||
|
|
174
|
-
score.schema_version !== 1 ||
|
|
175
|
+
(score.schema_version !== 1 && score.schema_version !== 2) ||
|
|
176
|
+
(score.schema_version === 2 && !PROVIDERS.has(score.provider)) ||
|
|
175
177
|
typeof score.tracker_version !== "string" ||
|
|
176
178
|
!/^\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(score.tracker_version) ||
|
|
177
179
|
score.methodology_version !== "1" ||
|
|
@@ -12,18 +12,20 @@ A post contains your GitHub login, posting time, and these score fields:
|
|
|
12
12
|
|
|
13
13
|
- Average, total, and peak daily agent-hours.
|
|
14
14
|
- Completed turns and active days.
|
|
15
|
-
-
|
|
15
|
+
- Provider, window dates, timezone, and session scope.
|
|
16
16
|
- Tracker, methodology, and schema versions.
|
|
17
17
|
|
|
18
18
|
Human-hours assumptions and Agent Leverage are omitted. Private archives, daily rows, machine names, and session identifiers are rejected.
|
|
19
19
|
|
|
20
|
-
The board has separate
|
|
20
|
+
The board defaults to Codex. Select Claude or Combined (Codex + Claude) to view those scores. Each provider has separate interactive-only and exec-inclusive lists. Each list shows up to 50 recent scores, sorted by hours per day. A new post replaces your current score for that provider and session scope.
|
|
21
|
+
|
|
22
|
+
Public score schema v1 means Codex. Schema v2 requires `provider` with `codex`, `claude`, or `all`. Both accept only the public aggregate fields. Private archive schema v2 is a different format and is rejected. Generate an export with `agent-hours --provider claude --share --format json`, or select `codex` or `all`. Combined scores add provider runtime. The historical Codex benchmarks do not establish Claude or combined rankings.
|
|
21
23
|
|
|
22
24
|
Scores cover 30 completed calendar days. When posted, their end date must be yesterday or one of the seven days before yesterday, in the score's timezone. Old scores leave the recent list. Numeric checks reject malformed data, not dishonest claims.
|
|
23
25
|
|
|
24
26
|
## Five posts in 30 days
|
|
25
27
|
|
|
26
|
-
Each GitHub account gets five accepted posts in a rolling 30 × 24-hour window, across
|
|
28
|
+
Each GitHub account gets five accepted posts in a rolling 30 × 24-hour window, across all providers and session lists. This is not a calendar-month reset.
|
|
27
29
|
|
|
28
30
|
After the fourth post, the page says you have one left and shows when the next slot opens. After the fifth, you must wait. Each slot opens exactly 30 days after its post was accepted.
|
|
29
31
|
|
|
@@ -2,39 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
Agent Hours has two JSON formats. They serve different purposes and are not interchangeable.
|
|
4
4
|
|
|
5
|
-
## Public score: `agent-hours-score`, schema
|
|
5
|
+
## Public score: `agent-hours-score`, schema versions 1 and 2
|
|
6
6
|
|
|
7
7
|
Create with `agent-hours --share --format json`. The CLI fixes the window to 30 completed calendar days ending yesterday.
|
|
8
8
|
|
|
9
9
|
| Field | Contents |
|
|
10
10
|
| --- | --- |
|
|
11
11
|
| `schema`, `schema_version` | Format identity and version |
|
|
12
|
+
| `provider` | Required in version 2: `codex`, `claude`, or `all`. Absent in version 1 (Codex) |
|
|
12
13
|
| `tracker_version`, `methodology_version` | Software and timing-rule versions |
|
|
13
14
|
| `window` | `start`, `end`, `days`, and IANA `timezone` |
|
|
14
15
|
| `scope` | `interactive-only` or `including-exec` |
|
|
15
16
|
| `metrics` | `agent_hours_per_day`, `total_agent_hours`, `peak_day_agent_hours`, `completed_turns`, `active_days` |
|
|
16
17
|
| `leverage` | `null`, or `ratio`, `human_hours`, `basis`, and `human_hours_per_week` |
|
|
17
18
|
|
|
19
|
+
Codex exports keep version 1 for compatibility. `agent-hours --provider claude --share --format json` and `agent-hours --provider all --share --format json` write version 2. Readers also accept version 2 with `provider: "codex"`. Combined scores contain one aggregate across both providers, with no provider subtotals. Both versions reject unexpected fields.
|
|
20
|
+
|
|
21
|
+
The `scope` enum controls Codex source selection: `interactive-only` excludes Codex exec/batch sources, while `including-exec` includes them. Claude scores include native recorded turns with unverified main-session origin under either scope. They can include SDK or headless activity. A combined score adds these Claude observations to the selected Codex sources. Neither Claude nor combined scores assert that all activity was human initiated.
|
|
22
|
+
|
|
18
23
|
Leverage basis is `reported-period` or `estimated-weekly`. Reported-period leverage has a null weekly-hours field. Numeric values are finite and nonnegative. Supplied human hours are positive.
|
|
19
24
|
|
|
20
25
|
The schema excludes daily rows, machine labels, account details, paths, identifiers, and diagnostics. The browser rejects private exports and unexpected fields. Imported scores are self-reported, not independently verified. A user can edit JSON, so scores do not attest to an account's activity.
|
|
21
26
|
|
|
22
27
|
Pasting a score does not submit it to a server. PNG/SVG generation uses the same local renderer as the card preview. Exported images disclose the fields shown on the preview.
|
|
23
28
|
|
|
24
|
-
Community posting is a separate, confirmed action. The server accepts this schema with `leverage: null` and links it to the signed-in GitHub login. It checks the date window and numeric bounds, not whether the claimed runtime happened.
|
|
29
|
+
Community posting is a separate, confirmed action. The server accepts this schema with `leverage: null` and links it to the signed-in GitHub login. It checks the date window and numeric bounds, not whether the claimed runtime happened. Provider and scope selections have separate boards. See [community rules](community.md).
|
|
25
30
|
|
|
26
|
-
## Private archive: `agent-hours-archive`, schema version
|
|
31
|
+
## Private archive: `agent-hours-archive`, schema version 2
|
|
27
32
|
|
|
28
33
|
Create with `agent-hours --export reports/machine.agent-hours-private.json --label machine`. Export collects available timing observations across the selected directories, including exec/batch observations. It is not a date-bounded public score.
|
|
29
34
|
|
|
30
35
|
Scans and exports accept both `.jsonl` and `.jsonl.zst` rollouts. Merge exports created by version 0.2.1 with Agent Hours 0.2.1 or newer. Version 0.2.0 rejects the new `decompression_errors` diagnostic field. Version 0.2.1 still reads older private exports.
|
|
31
36
|
|
|
32
|
-
The archive contains a methodology version, optional user label, compact observations, and diagnostics. Each observation includes a deterministic hash of the typed turn identifier, start timestamp, duration, timing usability, and source class. It contains no conversation payloads or raw turn identifiers.
|
|
37
|
+
The archive contains a methodology version, optional user label, compact observations, and diagnostics. Each version 2 observation includes `provider` (`codex` or `claude`), a deterministic hash of the typed turn identifier, start timestamp, duration, timing usability, and source class. It contains no conversation payloads or raw turn identifiers.
|
|
33
38
|
|
|
34
39
|
Retaining the best observation per source class lets a later merge apply source selection before deduplication. It also preserves the independent human-root sample. The merge rejects incompatible versions and malformed data rather than silently reinterpreting them.
|
|
35
40
|
|
|
36
41
|
Precise timestamps and persistent hashes reveal activity patterns and permit correlation between exports. Hashing does not make this public-safe. Transfer archives only between machines or people you intend to grant this access. Store them under ignored `reports/` paths. Never paste a private archive into the public share studio.
|
|
37
42
|
|
|
43
|
+
Version 0.3.0 writes schema version 2 and reads version 1 as Codex. Older versions cannot read version 2. Existing Codex hashes remain unchanged. Merge deduplication uses the provider and hash, so a Codex identifier cannot collide with a Claude identifier.
|
|
44
|
+
|
|
45
|
+
Use `--provider all` to collect or report both providers. Provider selection also filters imported archives. Public score schema version 1 remains Codex-only. Claude and combined `--share` selections use public schema version 2.
|
|
46
|
+
|
|
47
|
+
Claude observations require main native duration records or completed foreground-agent summaries. Missing timing contributes no runtime. Child-native timers are excluded to prevent duplicate delegated runtime. Diagnostics report coverage gaps and unverified main-session origin. These labels disclose no paths or transcript content.
|
|
48
|
+
|
|
38
49
|
## Reproduction
|
|
39
50
|
|
|
40
51
|
Use the same methodology, scope, date bounds, timezone, and input archives to reproduce a report. Individual input subtotals may overlap. Use the globally deduplicated combined total. Session histories that have been removed or rewritten can change later measurements.
|
|
@@ -85,3 +85,19 @@ The CLI reports malformed candidate lines and affected file counts. It reports i
|
|
|
85
85
|
- Batch detection is file-level. One batch classification excludes all completed turns in that file under the default scope.
|
|
86
86
|
|
|
87
87
|
- Malformed records, incomplete turns, unmatched completions, and invalid metadata do not contribute to totals. Diagnostics expose counts, not the discarded content.
|
|
88
|
+
|
|
89
|
+
## Claude Code coverage
|
|
90
|
+
|
|
91
|
+
Claude Code uses separate native timing sources. Main-session `system` / `turn_duration` records require finite `durationMs`, a timestamp, and an immutable UUID. Completed foreground-agent summaries require direct `user.toolUseResult` metadata with `status: completed`, `totalDurationMs`, and an agent ID. Their outer completion records require a UUID and timestamp.
|
|
92
|
+
|
|
93
|
+
The start timestamp is the recorded end minus the native duration. Native durations are retained without the Codex event-gap cap. Child-native sidechain timers are excluded to avoid counting a delegated run through both representations. Async launches without completion timing contribute no runtime. Child-native-only histories are unsupported.
|
|
94
|
+
|
|
95
|
+
Files without either supported timing source contribute no runtime. The scanner does not estimate durations from transcript gaps, user messages, assistant messages, or filesystem timestamps. Tool and conversation content are structurally skipped without decoding. Only approved direct scalar metadata fields are decoded.
|
|
96
|
+
|
|
97
|
+
Main-session human initiation is unverified. Native Claude totals may include SDK or headless activity. Main observations have unknown source and contribute to runtime, but not human-initiated top-level statistics. Completed foreground-agent summaries are delegated. Immutable event UUIDs deduplicate copied and forked histories within Claude. Completion UUID plus agent ID distinguishes resumed delegated runs. Provider-scoped identity prevents collisions with Codex.
|
|
98
|
+
|
|
99
|
+
A parent main timer and its delegated agent summary count as separate agent runtime. Combined totals add completed runtime across providers, including overlap. Provider totals use the same date range and timezone.
|
|
100
|
+
|
|
101
|
+
Public scores identify Codex, Claude Code, or combined activity. Version 1 public scores and published Codex benchmarks retain their Codex-only interpretation. Version 2 public scores carry a provider selection. Their scope enum controls Codex source selection. Claude native recorded turns retain unverified main-session origin under either scope. Claude and combined scores do not imply human-only activity.
|
|
102
|
+
|
|
103
|
+
Diagnostics report files without a main native timer, files with unverified main origin, ignored child-native timer records, and async launches without completion timing. These coverage counts do not measure missing runtime.
|
{codex_agent_hour_tracker-0.2.2 → codex_agent_hour_tracker-0.4.0}/functions/community/_middleware.js
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Only the community page can contact the API and load the bot check.
|
|
2
2
|
// Replace the inherited policy: appending would retain connect-src 'none'.
|
|
3
|
-
const COMMUNITY_CSP = "default-src 'self'; script-src 'self' https://challenges.cloudflare.com; style-src 'self'; img-src 'self' data:; connect-src 'self'; frame-src https://challenges.cloudflare.com; font-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors
|
|
3
|
+
const COMMUNITY_CSP = "default-src 'self'; script-src 'self' https://challenges.cloudflare.com; style-src 'self'; img-src 'self' data:; connect-src 'self'; frame-src https://challenges.cloudflare.com; font-src 'self'; object-src 'none'; base-uri 'none'; frame-ancestors https://timosterhus.com; form-action 'none'";
|
|
4
4
|
|
|
5
5
|
export async function onRequest(context) {
|
|
6
6
|
const downstream = await context.next();
|
|
@@ -8,7 +8,7 @@ export async function onRequest(context) {
|
|
|
8
8
|
response.headers.set('Content-Security-Policy', COMMUNITY_CSP);
|
|
9
9
|
response.headers.set('Referrer-Policy', 'no-referrer');
|
|
10
10
|
response.headers.set('X-Content-Type-Options', 'nosniff');
|
|
11
|
-
response.headers.
|
|
11
|
+
response.headers.delete('X-Frame-Options');
|
|
12
12
|
response.headers.set('Permissions-Policy', 'camera=(), microphone=(), geolocation=()');
|
|
13
13
|
return response;
|
|
14
14
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* Expand-only: legacy Codex rows and quota ledger remain unchanged. */
|
|
2
|
+
CREATE TABLE IF NOT EXISTS community_provider_scores (
|
|
3
|
+
github_id INTEGER NOT NULL REFERENCES github_users(github_id) ON DELETE CASCADE,
|
|
4
|
+
provider TEXT NOT NULL CHECK (provider IN ('claude', 'all')),
|
|
5
|
+
scope TEXT NOT NULL CHECK (scope IN ('interactive-only', 'including-exec')),
|
|
6
|
+
login TEXT NOT NULL,
|
|
7
|
+
score_json TEXT NOT NULL,
|
|
8
|
+
score_digest TEXT NOT NULL,
|
|
9
|
+
window_end TEXT NOT NULL,
|
|
10
|
+
window_timezone TEXT NOT NULL,
|
|
11
|
+
eligible_until INTEGER NOT NULL,
|
|
12
|
+
agent_hours_per_day REAL NOT NULL,
|
|
13
|
+
updated_at TEXT NOT NULL,
|
|
14
|
+
request_id TEXT NOT NULL UNIQUE,
|
|
15
|
+
PRIMARY KEY (github_id, scope, provider)
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
CREATE INDEX IF NOT EXISTS community_provider_scores_board_idx
|
|
19
|
+
ON community_provider_scores(provider, scope, agent_hours_per_day DESC, login ASC);
|
|
20
|
+
CREATE INDEX IF NOT EXISTS community_provider_scores_window_idx
|
|
21
|
+
ON community_provider_scores(provider, scope, eligible_until);
|
|
@@ -4,15 +4,15 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "codex-agent-hour-tracker"
|
|
7
|
-
version = "0.
|
|
8
|
-
description = "Measure cumulative Codex agent runtime without decoding conversation content."
|
|
7
|
+
version = "0.4.0"
|
|
8
|
+
description = "Measure cumulative Codex and Claude Code agent runtime without decoding conversation content."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
11
11
|
license = "MIT"
|
|
12
12
|
authors = [
|
|
13
13
|
{ name = "Tim Osterhus", email = "tim@millrace.ai" },
|
|
14
14
|
]
|
|
15
|
-
keywords = ["codex", "agents", "analytics", "privacy"]
|
|
15
|
+
keywords = ["codex", "claude-code", "agents", "analytics", "privacy"]
|
|
16
16
|
dependencies = [
|
|
17
17
|
"backports.zstd>=1.0,<2; python_version < '3.14'",
|
|
18
18
|
"tzlocal>=5.3,<6",
|