jev-dev-harness 0.2.17 → 0.2.18
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/CHANGELOG.md +155 -145
- package/LICENSE +21 -21
- package/README.md +704 -687
- package/bin/jev-dev.js +2 -2
- package/bin/jev-mcp.js +7 -7
- package/dashboard/index.html +1122 -1122
- package/dist/cli/doctor.js +46 -46
- package/dist/context-ranker/stage-c-jev.d.ts.map +1 -1
- package/dist/context-ranker/stage-c-jev.js +2 -1
- package/dist/context-ranker/stage-c-jev.js.map +1 -1
- package/dist/hooks/index.js +73 -73
- package/dist/shared/agent-usage.d.ts.map +1 -1
- package/dist/shared/agent-usage.js +2 -1
- package/dist/shared/agent-usage.js.map +1 -1
- package/dist/shared/efficiency.d.ts +2 -0
- package/dist/shared/efficiency.d.ts.map +1 -1
- package/dist/shared/efficiency.js +8 -1
- package/dist/shared/efficiency.js.map +1 -1
- package/dist/shared/telemetry.d.ts.map +1 -1
- package/dist/shared/telemetry.js +3 -2
- package/dist/shared/telemetry.js.map +1 -1
- package/dist/shared/usage-comparison.d.ts.map +1 -1
- package/dist/shared/usage-comparison.js +7 -5
- package/dist/shared/usage-comparison.js.map +1 -1
- package/dist/shared/version.js +1 -1
- package/docs/RELEASING.md +256 -250
- package/docs/jev/DELEGATED-REVIEW.md +86 -86
- package/docs/jev/JEV-0.2.16-DEFAULTS.md +60 -60
- package/docs/jev/JEV-1.14-EVALUATION.md +99 -99
- package/docs/jev/MEASURED-USAGE.md +155 -155
- package/docs/jev/MULTI-HARNESS-USAGE.md +163 -163
- package/docs/jev/OPENROUTER-NATIVE.md +93 -93
- package/docs/jev/README.md +85 -85
- package/docs/jev/evaluation-jev-1.14-2026-10-15.json +1731 -1731
- package/package.json +139 -139
|
@@ -1,155 +1,155 @@
|
|
|
1
|
-
# Measured Codex task comparisons
|
|
2
|
-
|
|
3
|
-
For other clients, see the [multi-harness bridge and collectors](MULTI-HARNESS-USAGE.md).
|
|
4
|
-
|
|
5
|
-
This workflow compares observed usage, not file-count estimates. It runs locally,
|
|
6
|
-
does not upload rollout content and does not make new model requests. Codex
|
|
7
|
-
rollout JSONL is an observed local format, not a guaranteed public API. Unknown,
|
|
8
|
-
incomplete, reset or ambiguous counters are rejected rather than guessed.
|
|
9
|
-
|
|
10
|
-
## Developer workflow
|
|
11
|
-
|
|
12
|
-
1. Choose a small task with an objective validation (the same tests/checks on
|
|
13
|
-
both results). Start both runs from the same commit, with the same agent model,
|
|
14
|
-
reasoning effort, instructions and tool configuration, except the Jev change
|
|
15
|
-
being evaluated. Keep cache conditions comparable and document them.
|
|
16
|
-
2. Run the baseline with Jev disabled. Use separate chats; reused history is a
|
|
17
|
-
confounder. If a task uses several turns/subagents/reviewers, include every
|
|
18
|
-
related interval in the manifest. The importer does not discover completeness
|
|
19
|
-
or prove equivalence automatically.
|
|
20
|
-
3. Before the Jev run, start a unique ledger:
|
|
21
|
-
|
|
22
|
-
```sh
|
|
23
|
-
jev-dev efficiency begin --run-id auth-jev-001
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Include `measurementRunId: "auth-jev-001"` on **every** Jev MCP call during
|
|
27
|
-
that run. For CLI calls, set `JEV_MEASUREMENT_RUN_ID=auth-jev-001` in that
|
|
28
|
-
process. All model-based harnesses use the same scoped collector. Concurrent
|
|
29
|
-
MCP calls with different IDs stay isolated. Cache/heuristic calls do not
|
|
30
|
-
create model-request records. No state, prompts, answers or keys enter the
|
|
31
|
-
ledger. Missing/in-progress calls are not treated as zero usage.
|
|
32
|
-
4. Wait for all calls to complete, validate the task result, then close the ledger:
|
|
33
|
-
|
|
34
|
-
```sh
|
|
35
|
-
jev-dev efficiency finish --run-id auth-jev-001
|
|
36
|
-
jev-dev efficiency list --repo . --json
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
`list` finds local logs by repository and gives session/turn IDs, timestamps,
|
|
40
|
-
model, initial revision, counters and absolute rollout paths. It does not
|
|
41
|
-
print messages or infer a baseline. It scans at most 200 recent files; use
|
|
42
|
-
`--sessions-path` for a particular date or archived logs.
|
|
43
|
-
Internal `codex-auto-review` intervals are excluded from this list by default;
|
|
44
|
-
use `--include-internal` to locate them when reconciling task overhead.
|
|
45
|
-
5. Create the comparison manifest and validation receipts below. Your assistant
|
|
46
|
-
can assemble them after you identify the two runs; you need not find JSONL
|
|
47
|
-
files by hand. Run:
|
|
48
|
-
|
|
49
|
-
```sh
|
|
50
|
-
jev-dev efficiency compare --manifest comparison.json --json
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Codex can also call `jev_compare_usage` with `manifestPath`. The comparison is
|
|
54
|
-
recorded in local telemetry and shown as the latest paired task comparison in
|
|
55
|
-
the dashboard. `--no-record` prevents telemetry writes. Reimporting a pair
|
|
56
|
-
does not add its differences to a cumulative savings figure.
|
|
57
|
-
|
|
58
|
-
## Manifest and receipts
|
|
59
|
-
|
|
60
|
-
Illustrative manifest; replace the paths/IDs with actual records. Relative paths
|
|
61
|
-
are resolved against this manifest, not the caller's working directory.
|
|
62
|
-
|
|
63
|
-
```json
|
|
64
|
-
{
|
|
65
|
-
"schemaVersion": 1,
|
|
66
|
-
"taskId": "auth-validation",
|
|
67
|
-
"initialRevision": "exact-starting-commit-hash",
|
|
68
|
-
"environmentId": "same-model-tools-prompt-and-cache-conditions",
|
|
69
|
-
"allRelatedSessionsIncluded": true,
|
|
70
|
-
"baseline": {
|
|
71
|
-
"rollouts": [{ "path": "baseline.jsonl", "turnId": "baseline-turn-id" }],
|
|
72
|
-
"jevDisabled": true,
|
|
73
|
-
"validationReceipt": "baseline-validation.json"
|
|
74
|
-
},
|
|
75
|
-
"withJev": {
|
|
76
|
-
"rollouts": [{ "path": "with-jev.jsonl", "turnId": "jev-turn-id" }],
|
|
77
|
-
"validationReceipt": "jev-validation.json",
|
|
78
|
-
"measurementRunId": "auth-jev-001",
|
|
79
|
-
"ledgerPath": "path-to-auth-jev-001.jsonl",
|
|
80
|
-
"allJevCallsRecorded": true
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Each validation receipt is tied to its exact session/turn IDs:
|
|
86
|
-
|
|
87
|
-
```json
|
|
88
|
-
{
|
|
89
|
-
"taskId": "auth-validation",
|
|
90
|
-
"criterionId": "same-test-suite-and-functional-check",
|
|
91
|
-
"passed": true,
|
|
92
|
-
"runIds": ["actual-session-id:actual-turn-id"],
|
|
93
|
-
"evidenceReference": "actual-test-report-artifact"
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
These are explicit user/evaluator attestations. The importer verifies matching
|
|
98
|
-
IDs and fields, hashes the source files and checks the counters, but does not
|
|
99
|
-
execute the validation command or independently verify the task quality, disabled
|
|
100
|
-
Jev, declared environment equivalence or completeness of related sessions. Do
|
|
101
|
-
not declare them true before those conditions are verified.
|
|
102
|
-
|
|
103
|
-
## What the report means
|
|
104
|
-
|
|
105
|
-
- `agentTokenDelta`: baseline agent total minus Jev-run agent total, within the
|
|
106
|
-
imported intervals. Positive means lower observed consumption; negative means
|
|
107
|
-
higher. Repeated cumulative snapshots count once; earlier session usage is
|
|
108
|
-
subtracted. Forks without a prior baseline snapshot, counter resets, incomplete
|
|
109
|
-
turns, duplicate intervals, model/effort/revision mismatches and failed quality
|
|
110
|
-
receipts are rejected.
|
|
111
|
-
- Cached input is already included in input; reasoning is already included in
|
|
112
|
-
output. They are reported as breakdowns, not added again. Missing cache-write
|
|
113
|
-
details stay unknown. See [OpenAI usage definitions](https://developers.openai.com/api/docs/guides/agents-api/observability)
|
|
114
|
-
and [prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching).
|
|
115
|
-
- `pipelineTokenDelta`: agent delta minus **reported** Jev tokens. Available only
|
|
116
|
-
with a finished ledger, no request with unknown usage, and declared full Jev
|
|
117
|
-
coverage. Different tokenizers produce reported token units, not identical text
|
|
118
|
-
lengths. Provider-unreported retries/failures remain outside this figure.
|
|
119
|
-
- `moneyDeltaUsd`: unknown by default. Codex local token counters are not a bill
|
|
120
|
-
and do not establish how ChatGPT subscription limits are calculated. Full cost
|
|
121
|
-
for both runs must come from billing receipts, not fixed tokens-per-file or an
|
|
122
|
-
assumed rate. Jev's reported response cost remains separately visible with
|
|
123
|
-
coverage; it is not automatically a complete task cost.
|
|
124
|
-
|
|
125
|
-
Optional billing receipts, referenced by `billingReceipt` on each run, use:
|
|
126
|
-
|
|
127
|
-
```json
|
|
128
|
-
{
|
|
129
|
-
"runFingerprint": "fingerprint-returned-for-this-run-by-compare",
|
|
130
|
-
"currency": "USD",
|
|
131
|
-
"amount": 0.0123,
|
|
132
|
-
"coverage": "all_agent_and_jev_costs",
|
|
133
|
-
"sourceReference": "actual-provider-billing-export"
|
|
134
|
-
}
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
The amount above is an example only. Both receipts must include all agent,
|
|
138
|
-
subagent/reviewer, Jev and retry charges. Matching fingerprints prevent mixing
|
|
139
|
-
receipts with different logs/ledgers. Receipts are imported and explicitly marked
|
|
140
|
-
as not independently verified. Unknown cost is never zero; negative differences
|
|
141
|
-
are retained. A single pair describes that experiment, not causal proof or a
|
|
142
|
-
general savings claim. Repeat controlled pairs to evaluate consistency.
|
|
143
|
-
|
|
144
|
-
## Installation
|
|
145
|
-
|
|
146
|
-
The new importer is prepared for 0.2.10. Installing 0.2.9 fixes reporting but
|
|
147
|
-
does not add these commands. After installing the build containing this feature,
|
|
148
|
-
restart Codex's MCP process and confirm `jev_compare_usage` is listed. Do not
|
|
149
|
-
publish a changed artifact under the already published 0.2.9 version.
|
|
150
|
-
|
|
151
|
-
`JEV_MEASUREMENT_DIR` can redirect local ledgers; otherwise they live in
|
|
152
|
-
`~/.jev-dev/measurements`. Use a new run ID for each experiment. Collection is
|
|
153
|
-
opt-in and errors on invalid IDs, missing begun runs or closed ledgers. Check
|
|
154
|
-
local logs before sharing them: the original Codex rollout may contain private
|
|
155
|
-
prompts even though comparison results contain only selected metadata/usage.
|
|
1
|
+
# Measured Codex task comparisons
|
|
2
|
+
|
|
3
|
+
For other clients, see the [multi-harness bridge and collectors](MULTI-HARNESS-USAGE.md).
|
|
4
|
+
|
|
5
|
+
This workflow compares observed usage, not file-count estimates. It runs locally,
|
|
6
|
+
does not upload rollout content and does not make new model requests. Codex
|
|
7
|
+
rollout JSONL is an observed local format, not a guaranteed public API. Unknown,
|
|
8
|
+
incomplete, reset or ambiguous counters are rejected rather than guessed.
|
|
9
|
+
|
|
10
|
+
## Developer workflow
|
|
11
|
+
|
|
12
|
+
1. Choose a small task with an objective validation (the same tests/checks on
|
|
13
|
+
both results). Start both runs from the same commit, with the same agent model,
|
|
14
|
+
reasoning effort, instructions and tool configuration, except the Jev change
|
|
15
|
+
being evaluated. Keep cache conditions comparable and document them.
|
|
16
|
+
2. Run the baseline with Jev disabled. Use separate chats; reused history is a
|
|
17
|
+
confounder. If a task uses several turns/subagents/reviewers, include every
|
|
18
|
+
related interval in the manifest. The importer does not discover completeness
|
|
19
|
+
or prove equivalence automatically.
|
|
20
|
+
3. Before the Jev run, start a unique ledger:
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
jev-dev efficiency begin --run-id auth-jev-001
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Include `measurementRunId: "auth-jev-001"` on **every** Jev MCP call during
|
|
27
|
+
that run. For CLI calls, set `JEV_MEASUREMENT_RUN_ID=auth-jev-001` in that
|
|
28
|
+
process. All model-based harnesses use the same scoped collector. Concurrent
|
|
29
|
+
MCP calls with different IDs stay isolated. Cache/heuristic calls do not
|
|
30
|
+
create model-request records. No state, prompts, answers or keys enter the
|
|
31
|
+
ledger. Missing/in-progress calls are not treated as zero usage.
|
|
32
|
+
4. Wait for all calls to complete, validate the task result, then close the ledger:
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
jev-dev efficiency finish --run-id auth-jev-001
|
|
36
|
+
jev-dev efficiency list --repo . --json
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`list` finds local logs by repository and gives session/turn IDs, timestamps,
|
|
40
|
+
model, initial revision, counters and absolute rollout paths. It does not
|
|
41
|
+
print messages or infer a baseline. It scans at most 200 recent files; use
|
|
42
|
+
`--sessions-path` for a particular date or archived logs.
|
|
43
|
+
Internal `codex-auto-review` intervals are excluded from this list by default;
|
|
44
|
+
use `--include-internal` to locate them when reconciling task overhead.
|
|
45
|
+
5. Create the comparison manifest and validation receipts below. Your assistant
|
|
46
|
+
can assemble them after you identify the two runs; you need not find JSONL
|
|
47
|
+
files by hand. Run:
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
jev-dev efficiency compare --manifest comparison.json --json
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Codex can also call `jev_compare_usage` with `manifestPath`. The comparison is
|
|
54
|
+
recorded in local telemetry and shown as the latest paired task comparison in
|
|
55
|
+
the dashboard. `--no-record` prevents telemetry writes. Reimporting a pair
|
|
56
|
+
does not add its differences to a cumulative savings figure.
|
|
57
|
+
|
|
58
|
+
## Manifest and receipts
|
|
59
|
+
|
|
60
|
+
Illustrative manifest; replace the paths/IDs with actual records. Relative paths
|
|
61
|
+
are resolved against this manifest, not the caller's working directory.
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"schemaVersion": 1,
|
|
66
|
+
"taskId": "auth-validation",
|
|
67
|
+
"initialRevision": "exact-starting-commit-hash",
|
|
68
|
+
"environmentId": "same-model-tools-prompt-and-cache-conditions",
|
|
69
|
+
"allRelatedSessionsIncluded": true,
|
|
70
|
+
"baseline": {
|
|
71
|
+
"rollouts": [{ "path": "baseline.jsonl", "turnId": "baseline-turn-id" }],
|
|
72
|
+
"jevDisabled": true,
|
|
73
|
+
"validationReceipt": "baseline-validation.json"
|
|
74
|
+
},
|
|
75
|
+
"withJev": {
|
|
76
|
+
"rollouts": [{ "path": "with-jev.jsonl", "turnId": "jev-turn-id" }],
|
|
77
|
+
"validationReceipt": "jev-validation.json",
|
|
78
|
+
"measurementRunId": "auth-jev-001",
|
|
79
|
+
"ledgerPath": "path-to-auth-jev-001.jsonl",
|
|
80
|
+
"allJevCallsRecorded": true
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Each validation receipt is tied to its exact session/turn IDs:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"taskId": "auth-validation",
|
|
90
|
+
"criterionId": "same-test-suite-and-functional-check",
|
|
91
|
+
"passed": true,
|
|
92
|
+
"runIds": ["actual-session-id:actual-turn-id"],
|
|
93
|
+
"evidenceReference": "actual-test-report-artifact"
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
These are explicit user/evaluator attestations. The importer verifies matching
|
|
98
|
+
IDs and fields, hashes the source files and checks the counters, but does not
|
|
99
|
+
execute the validation command or independently verify the task quality, disabled
|
|
100
|
+
Jev, declared environment equivalence or completeness of related sessions. Do
|
|
101
|
+
not declare them true before those conditions are verified.
|
|
102
|
+
|
|
103
|
+
## What the report means
|
|
104
|
+
|
|
105
|
+
- `agentTokenDelta`: baseline agent total minus Jev-run agent total, within the
|
|
106
|
+
imported intervals. Positive means lower observed consumption; negative means
|
|
107
|
+
higher. Repeated cumulative snapshots count once; earlier session usage is
|
|
108
|
+
subtracted. Forks without a prior baseline snapshot, counter resets, incomplete
|
|
109
|
+
turns, duplicate intervals, model/effort/revision mismatches and failed quality
|
|
110
|
+
receipts are rejected.
|
|
111
|
+
- Cached input is already included in input; reasoning is already included in
|
|
112
|
+
output. They are reported as breakdowns, not added again. Missing cache-write
|
|
113
|
+
details stay unknown. See [OpenAI usage definitions](https://developers.openai.com/api/docs/guides/agents-api/observability)
|
|
114
|
+
and [prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching).
|
|
115
|
+
- `pipelineTokenDelta`: agent delta minus **reported** Jev tokens. Available only
|
|
116
|
+
with a finished ledger, no request with unknown usage, and declared full Jev
|
|
117
|
+
coverage. Different tokenizers produce reported token units, not identical text
|
|
118
|
+
lengths. Provider-unreported retries/failures remain outside this figure.
|
|
119
|
+
- `moneyDeltaUsd`: unknown by default. Codex local token counters are not a bill
|
|
120
|
+
and do not establish how ChatGPT subscription limits are calculated. Full cost
|
|
121
|
+
for both runs must come from billing receipts, not fixed tokens-per-file or an
|
|
122
|
+
assumed rate. Jev's reported response cost remains separately visible with
|
|
123
|
+
coverage; it is not automatically a complete task cost.
|
|
124
|
+
|
|
125
|
+
Optional billing receipts, referenced by `billingReceipt` on each run, use:
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"runFingerprint": "fingerprint-returned-for-this-run-by-compare",
|
|
130
|
+
"currency": "USD",
|
|
131
|
+
"amount": 0.0123,
|
|
132
|
+
"coverage": "all_agent_and_jev_costs",
|
|
133
|
+
"sourceReference": "actual-provider-billing-export"
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The amount above is an example only. Both receipts must include all agent,
|
|
138
|
+
subagent/reviewer, Jev and retry charges. Matching fingerprints prevent mixing
|
|
139
|
+
receipts with different logs/ledgers. Receipts are imported and explicitly marked
|
|
140
|
+
as not independently verified. Unknown cost is never zero; negative differences
|
|
141
|
+
are retained. A single pair describes that experiment, not causal proof or a
|
|
142
|
+
general savings claim. Repeat controlled pairs to evaluate consistency.
|
|
143
|
+
|
|
144
|
+
## Installation
|
|
145
|
+
|
|
146
|
+
The new importer is prepared for 0.2.10. Installing 0.2.9 fixes reporting but
|
|
147
|
+
does not add these commands. After installing the build containing this feature,
|
|
148
|
+
restart Codex's MCP process and confirm `jev_compare_usage` is listed. Do not
|
|
149
|
+
publish a changed artifact under the already published 0.2.9 version.
|
|
150
|
+
|
|
151
|
+
`JEV_MEASUREMENT_DIR` can redirect local ledgers; otherwise they live in
|
|
152
|
+
`~/.jev-dev/measurements`. Use a new run ID for each experiment. Collection is
|
|
153
|
+
opt-in and errors on invalid IDs, missing begun runs or closed ledgers. Check
|
|
154
|
+
local logs before sharing them: the original Codex rollout may contain private
|
|
155
|
+
prompts even though comparison results contain only selected metadata/usage.
|
|
@@ -1,163 +1,163 @@
|
|
|
1
|
-
# Measured usage across harnesses (0.2.11)
|
|
2
|
-
|
|
3
|
-
Jev measures its own calls in every MCP/CLI integration. Main-agent consumption
|
|
4
|
-
requires usage reported by the agent/provider: MCP cannot observe private client
|
|
5
|
-
inference. This feature provides shared import, comparison and optional proxy
|
|
6
|
-
collection, not automatic access to every editor's internal sessions.
|
|
7
|
-
|
|
8
|
-
## Supported data routes
|
|
9
|
-
|
|
10
|
-
| Client | Implemented route | External setup required |
|
|
11
|
-
| --- | --- | --- |
|
|
12
|
-
| Codex | Existing local rollout discovery/import | Equivalent completed runs and validation receipts |
|
|
13
|
-
| Antigravity | Common SDK/export bridge; Gemini adapter; configurable endpoint proxy | SDK hook/export wiring; IDE history is not automatically read |
|
|
14
|
-
| Cursor | Exported `cursor-event` adapter; common bridge/proxy | API access, stable request IDs, conversation/task filtering and all pages; no undocumented CSV parser |
|
|
15
|
-
| TRAE | Common export bridge/provider proxy | Actual reported usage source or configurable BYOK endpoint; no private log parser |
|
|
16
|
-
| VS Code/extensions | Library/MCP/CLI bridge and provider proxy | Wire provider completion hook; text-only APIs cannot supply measured usage |
|
|
17
|
-
| Other CLIs | OpenAI Chat/Responses, Anthropic and Gemini adapters | Export each real request, including workers/retries; or configure endpoint |
|
|
18
|
-
|
|
19
|
-
Native editor smoke tests were not run. Tests cover exports, normalization,
|
|
20
|
-
CLI/MCP entry points and local HTTP JSON/SSE forwarding. Closed services without
|
|
21
|
-
exports/configurable endpoints remain unknown. Quota percentages, tokenizers and
|
|
22
|
-
nominal price tables are not converted into measured tokens or bills.
|
|
23
|
-
|
|
24
|
-
## Common export contract
|
|
25
|
-
|
|
26
|
-
Illustrative structure; numbers below are not measurements of your task:
|
|
27
|
-
|
|
28
|
-
```json
|
|
29
|
-
{
|
|
30
|
-
"schemaVersion": 1, "kind": "agent_usage", "harness": "vscode-extension",
|
|
31
|
-
"sessionId": "independent-chat-id", "turnId": "task-interval-id",
|
|
32
|
-
"initialRevision": "exact-starting-commit", "model": "actual-model",
|
|
33
|
-
"effort": "actual-reasoning-configuration",
|
|
34
|
-
"startedAt": "2026-09-30T10:00:00Z", "endedAt": "2026-09-30T10:01:00Z",
|
|
35
|
-
"status": "completed", "coverage": "partial",
|
|
36
|
-
"includesJevUsage": false, "jevCallsObserved": true,
|
|
37
|
-
"events": [{
|
|
38
|
-
"requestId": "actual-provider-request-id", "provider": "actual-provider",
|
|
39
|
-
"format": "openai-responses",
|
|
40
|
-
"usage": { "input_tokens": 100, "output_tokens": 20, "total_tokens": 120 }
|
|
41
|
-
}]
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Record **one final usage per actual request**, never per stream chunk. Preserve
|
|
46
|
-
stable IDs on reimport. Convert cumulative session snapshots to interval
|
|
47
|
-
differences at the source, not sums. Record each retry with its own ID; attempts
|
|
48
|
-
with no usage must use `usage: null`. Split intervals using different models.
|
|
49
|
-
|
|
50
|
-
`coverage: complete` declares that all agent/worker/retry requests are included.
|
|
51
|
-
Partial coverage or missing totals blocks a task token difference. Reported
|
|
52
|
-
subtotals remain separately labeled. Missing cache, reasoning or cost stays null.
|
|
53
|
-
`includesJevUsage` must be false: Jev overhead is collected separately. Keep
|
|
54
|
-
harness, model, effort, initial commit, environment and validation equivalent.
|
|
55
|
-
|
|
56
|
-
Usage formats:
|
|
57
|
-
|
|
58
|
-
- `openai-chat` / `openai-responses`: the reported `usage` object; cache/reasoning
|
|
59
|
-
are subsets of primary input/output, never added again.
|
|
60
|
-
- `anthropic`: reported `usage`; total input adds uncached input, cache reads and
|
|
61
|
-
writes. Absent cache counters leave total input unknown.
|
|
62
|
-
- `gemini`: REST `usageMetadata` in camelCase. Total includes thinking;
|
|
63
|
-
contradictory totals or nonzero tool-use prompt counters require an explicit
|
|
64
|
-
normalized breakdown. Map SDK snake_case fields explicitly.
|
|
65
|
-
- `cursor-event`: one exported usage event; input adds uncached/read/write
|
|
66
|
-
counters. `chargedCents` is the reported USD charge; nominal `totalCents` and
|
|
67
|
-
request credits are not substituted. Missing token usage is unknown.
|
|
68
|
-
- `normalized`: `inputTokens`, `outputTokens`, `totalTokens`,
|
|
69
|
-
`cachedInputTokens`, `cacheWriteInputTokens`, `reasoningOutputTokens`.
|
|
70
|
-
Cache/reasoning are included in primary totals; fields may be null.
|
|
71
|
-
|
|
72
|
-
Optional `costUsd` must come from a reported charge. Cost coverage is returned as
|
|
73
|
-
costed/captured requests. A partial sum is not a full bill. Monetary comparisons
|
|
74
|
-
still require matching complete billing receipts, never prices inferred from tokens.
|
|
75
|
-
|
|
76
|
-
## Hooks and extensions
|
|
77
|
-
|
|
78
|
-
The package's existing public library exports `exportAgentUsage(path, run)`,
|
|
79
|
-
`importAgentUsage(path)` and `normalizeAgentUsage(format, usage)`:
|
|
80
|
-
|
|
81
|
-
```ts
|
|
82
|
-
import { exportAgentUsage } from "jev-dev-harness";
|
|
83
|
-
exportAgentUsage(outputPath, {
|
|
84
|
-
...completedTaskMetadata,
|
|
85
|
-
schemaVersion: 1, kind: "agent_usage", status: "completed",
|
|
86
|
-
includesJevUsage: false,
|
|
87
|
-
events: collectedResponses.map(response => ({
|
|
88
|
-
requestId: response.requestId, provider: response.provider,
|
|
89
|
-
format: "openai-responses", usage: response.usage ?? null,
|
|
90
|
-
})),
|
|
91
|
-
});
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
The export allowlists metadata/counters, strips response text/prompts/unknown
|
|
95
|
-
fields, rejects duplicate requests and refuses overwrite. Python/shell hooks can
|
|
96
|
-
write the same contract and sanitize it using:
|
|
97
|
-
|
|
98
|
-
```sh
|
|
99
|
-
jev-dev efficiency import --input agent-usage.json --output sanitized-usage.json
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Antigravity SDK total-only observations can map reported
|
|
103
|
-
`response.usage_metadata.total_token_count` to normalized `totalTokens`; leave
|
|
104
|
-
unreported fields null. VS Code text-only responses must use `usage: null` unless
|
|
105
|
-
the provider reports usage separately. Counting text is not actual request usage.
|
|
106
|
-
|
|
107
|
-
MCP: `jev_import_usage({inputPath, format: "agent_usage_v1"})` reads only specified
|
|
108
|
-
files without inference/writes. Restart installed MCP servers to expose the tool.
|
|
109
|
-
|
|
110
|
-
## Optional automatic capture through the existing proxy
|
|
111
|
-
|
|
112
|
-
Only for clients with configurable API endpoints; it does not intercept closed
|
|
113
|
-
services/TLS. Use a metadata JSON with the common identity/coverage fields above
|
|
114
|
-
(omit events, timestamps, kind/status; the proxy supplies them):
|
|
115
|
-
|
|
116
|
-
```sh
|
|
117
|
-
jev-dev efficiency begin --run-id task-jev-001
|
|
118
|
-
jev-dev proxy generic --upstream https://your-provider.example \
|
|
119
|
-
--usage-metadata task-metadata.json --usage-output agent-usage.json \
|
|
120
|
-
--measurement-run-id task-jev-001
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
Configure the client to use the proxy's localhost endpoint. The router's Jev calls
|
|
124
|
-
use this ledger; all other Jev tools must use the same measurement ID. Baselines
|
|
125
|
-
require `--no-routing` and `jevCallsObserved: false`. Routing-enabled captures
|
|
126
|
-
must declare Jev enabled. Metadata must not contain credentials.
|
|
127
|
-
|
|
128
|
-
Request model must match metadata (Gemini reads it from the models URL).
|
|
129
|
-
If the provider reports a different resolved model, the capture stays unknown;
|
|
130
|
-
use an exact model ID rather than an alias for controlled comparisons.
|
|
131
|
-
Stop gracefully with Ctrl+C/SIGTERM after all requests finish, then close the Jev ledger
|
|
132
|
-
with `efficiency finish`. A forced kill can lose in-memory observations; no
|
|
133
|
-
complete export is claimed. Empty captures are rejected. Capture one task at a time.
|
|
134
|
-
|
|
135
|
-
JSON/SSE responses are forwarded unchanged. Anthropic start/delta fields merge;
|
|
136
|
-
OpenAI/Gemini usage snapshots replace previous ones. Missing, invalid, oversized,
|
|
137
|
-
HTTP-error or failed response usage stays unknown. Only requests routed through
|
|
138
|
-
the proxy are observed; bypassed/hidden retries and external workers are outside
|
|
139
|
-
coverage. Multi-line SSE and unsupported protocols remain unknown. No request is
|
|
140
|
-
modified to force usage reporting: enable it in the client itself.
|
|
141
|
-
|
|
142
|
-
## Comparison compatibility
|
|
143
|
-
|
|
144
|
-
Use the existing [paired validation workflow](MEASURED-USAGE.md) with references:
|
|
145
|
-
|
|
146
|
-
```json
|
|
147
|
-
{"path": "agent-usage.json", "format": "agent_usage_v1"}
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
Missing `format` still means Codex JSONL, preserving 0.2.10 manifests.
|
|
151
|
-
`compareUsageRuns` is the general library function; `compareCodexRuns` remains an
|
|
152
|
-
alias. CLI `efficiency compare`, MCP `jev_compare_usage` and dashboard support
|
|
153
|
-
both sources. Codex-only comparisons retain schemaVersion 1; general comparisons
|
|
154
|
-
use schemaVersion 2 because primary counters and `agentTokenDelta` may be null.
|
|
155
|
-
Consumers must preserve unknown values. Do not sum repeated paired comparisons.
|
|
156
|
-
|
|
157
|
-
## Provider references
|
|
158
|
-
|
|
159
|
-
- [Anthropic cache accounting](https://platform.claude.com/docs/en/build-with-claude/prompt-caching)
|
|
160
|
-
- [Gemini UsageMetadata](https://ai.google.dev/api/generate-content#UsageMetadata)
|
|
161
|
-
- [Antigravity SDK usage](https://www.antigravity.google/docs/sdk/lifecycle/)
|
|
162
|
-
- [Cursor exported usage](https://cursor.com/docs/account/teams/admin-api)
|
|
163
|
-
- [VS Code model API](https://code.visualstudio.com/api/extension-guides/ai/language-model)
|
|
1
|
+
# Measured usage across harnesses (0.2.11)
|
|
2
|
+
|
|
3
|
+
Jev measures its own calls in every MCP/CLI integration. Main-agent consumption
|
|
4
|
+
requires usage reported by the agent/provider: MCP cannot observe private client
|
|
5
|
+
inference. This feature provides shared import, comparison and optional proxy
|
|
6
|
+
collection, not automatic access to every editor's internal sessions.
|
|
7
|
+
|
|
8
|
+
## Supported data routes
|
|
9
|
+
|
|
10
|
+
| Client | Implemented route | External setup required |
|
|
11
|
+
| --- | --- | --- |
|
|
12
|
+
| Codex | Existing local rollout discovery/import | Equivalent completed runs and validation receipts |
|
|
13
|
+
| Antigravity | Common SDK/export bridge; Gemini adapter; configurable endpoint proxy | SDK hook/export wiring; IDE history is not automatically read |
|
|
14
|
+
| Cursor | Exported `cursor-event` adapter; common bridge/proxy | API access, stable request IDs, conversation/task filtering and all pages; no undocumented CSV parser |
|
|
15
|
+
| TRAE | Common export bridge/provider proxy | Actual reported usage source or configurable BYOK endpoint; no private log parser |
|
|
16
|
+
| VS Code/extensions | Library/MCP/CLI bridge and provider proxy | Wire provider completion hook; text-only APIs cannot supply measured usage |
|
|
17
|
+
| Other CLIs | OpenAI Chat/Responses, Anthropic and Gemini adapters | Export each real request, including workers/retries; or configure endpoint |
|
|
18
|
+
|
|
19
|
+
Native editor smoke tests were not run. Tests cover exports, normalization,
|
|
20
|
+
CLI/MCP entry points and local HTTP JSON/SSE forwarding. Closed services without
|
|
21
|
+
exports/configurable endpoints remain unknown. Quota percentages, tokenizers and
|
|
22
|
+
nominal price tables are not converted into measured tokens or bills.
|
|
23
|
+
|
|
24
|
+
## Common export contract
|
|
25
|
+
|
|
26
|
+
Illustrative structure; numbers below are not measurements of your task:
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"schemaVersion": 1, "kind": "agent_usage", "harness": "vscode-extension",
|
|
31
|
+
"sessionId": "independent-chat-id", "turnId": "task-interval-id",
|
|
32
|
+
"initialRevision": "exact-starting-commit", "model": "actual-model",
|
|
33
|
+
"effort": "actual-reasoning-configuration",
|
|
34
|
+
"startedAt": "2026-09-30T10:00:00Z", "endedAt": "2026-09-30T10:01:00Z",
|
|
35
|
+
"status": "completed", "coverage": "partial",
|
|
36
|
+
"includesJevUsage": false, "jevCallsObserved": true,
|
|
37
|
+
"events": [{
|
|
38
|
+
"requestId": "actual-provider-request-id", "provider": "actual-provider",
|
|
39
|
+
"format": "openai-responses",
|
|
40
|
+
"usage": { "input_tokens": 100, "output_tokens": 20, "total_tokens": 120 }
|
|
41
|
+
}]
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Record **one final usage per actual request**, never per stream chunk. Preserve
|
|
46
|
+
stable IDs on reimport. Convert cumulative session snapshots to interval
|
|
47
|
+
differences at the source, not sums. Record each retry with its own ID; attempts
|
|
48
|
+
with no usage must use `usage: null`. Split intervals using different models.
|
|
49
|
+
|
|
50
|
+
`coverage: complete` declares that all agent/worker/retry requests are included.
|
|
51
|
+
Partial coverage or missing totals blocks a task token difference. Reported
|
|
52
|
+
subtotals remain separately labeled. Missing cache, reasoning or cost stays null.
|
|
53
|
+
`includesJevUsage` must be false: Jev overhead is collected separately. Keep
|
|
54
|
+
harness, model, effort, initial commit, environment and validation equivalent.
|
|
55
|
+
|
|
56
|
+
Usage formats:
|
|
57
|
+
|
|
58
|
+
- `openai-chat` / `openai-responses`: the reported `usage` object; cache/reasoning
|
|
59
|
+
are subsets of primary input/output, never added again.
|
|
60
|
+
- `anthropic`: reported `usage`; total input adds uncached input, cache reads and
|
|
61
|
+
writes. Absent cache counters leave total input unknown.
|
|
62
|
+
- `gemini`: REST `usageMetadata` in camelCase. Total includes thinking;
|
|
63
|
+
contradictory totals or nonzero tool-use prompt counters require an explicit
|
|
64
|
+
normalized breakdown. Map SDK snake_case fields explicitly.
|
|
65
|
+
- `cursor-event`: one exported usage event; input adds uncached/read/write
|
|
66
|
+
counters. `chargedCents` is the reported USD charge; nominal `totalCents` and
|
|
67
|
+
request credits are not substituted. Missing token usage is unknown.
|
|
68
|
+
- `normalized`: `inputTokens`, `outputTokens`, `totalTokens`,
|
|
69
|
+
`cachedInputTokens`, `cacheWriteInputTokens`, `reasoningOutputTokens`.
|
|
70
|
+
Cache/reasoning are included in primary totals; fields may be null.
|
|
71
|
+
|
|
72
|
+
Optional `costUsd` must come from a reported charge. Cost coverage is returned as
|
|
73
|
+
costed/captured requests. A partial sum is not a full bill. Monetary comparisons
|
|
74
|
+
still require matching complete billing receipts, never prices inferred from tokens.
|
|
75
|
+
|
|
76
|
+
## Hooks and extensions
|
|
77
|
+
|
|
78
|
+
The package's existing public library exports `exportAgentUsage(path, run)`,
|
|
79
|
+
`importAgentUsage(path)` and `normalizeAgentUsage(format, usage)`:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { exportAgentUsage } from "jev-dev-harness";
|
|
83
|
+
exportAgentUsage(outputPath, {
|
|
84
|
+
...completedTaskMetadata,
|
|
85
|
+
schemaVersion: 1, kind: "agent_usage", status: "completed",
|
|
86
|
+
includesJevUsage: false,
|
|
87
|
+
events: collectedResponses.map(response => ({
|
|
88
|
+
requestId: response.requestId, provider: response.provider,
|
|
89
|
+
format: "openai-responses", usage: response.usage ?? null,
|
|
90
|
+
})),
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The export allowlists metadata/counters, strips response text/prompts/unknown
|
|
95
|
+
fields, rejects duplicate requests and refuses overwrite. Python/shell hooks can
|
|
96
|
+
write the same contract and sanitize it using:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
jev-dev efficiency import --input agent-usage.json --output sanitized-usage.json
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Antigravity SDK total-only observations can map reported
|
|
103
|
+
`response.usage_metadata.total_token_count` to normalized `totalTokens`; leave
|
|
104
|
+
unreported fields null. VS Code text-only responses must use `usage: null` unless
|
|
105
|
+
the provider reports usage separately. Counting text is not actual request usage.
|
|
106
|
+
|
|
107
|
+
MCP: `jev_import_usage({inputPath, format: "agent_usage_v1"})` reads only specified
|
|
108
|
+
files without inference/writes. Restart installed MCP servers to expose the tool.
|
|
109
|
+
|
|
110
|
+
## Optional automatic capture through the existing proxy
|
|
111
|
+
|
|
112
|
+
Only for clients with configurable API endpoints; it does not intercept closed
|
|
113
|
+
services/TLS. Use a metadata JSON with the common identity/coverage fields above
|
|
114
|
+
(omit events, timestamps, kind/status; the proxy supplies them):
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
jev-dev efficiency begin --run-id task-jev-001
|
|
118
|
+
jev-dev proxy generic --upstream https://your-provider.example \
|
|
119
|
+
--usage-metadata task-metadata.json --usage-output agent-usage.json \
|
|
120
|
+
--measurement-run-id task-jev-001
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Configure the client to use the proxy's localhost endpoint. The router's Jev calls
|
|
124
|
+
use this ledger; all other Jev tools must use the same measurement ID. Baselines
|
|
125
|
+
require `--no-routing` and `jevCallsObserved: false`. Routing-enabled captures
|
|
126
|
+
must declare Jev enabled. Metadata must not contain credentials.
|
|
127
|
+
|
|
128
|
+
Request model must match metadata (Gemini reads it from the models URL).
|
|
129
|
+
If the provider reports a different resolved model, the capture stays unknown;
|
|
130
|
+
use an exact model ID rather than an alias for controlled comparisons.
|
|
131
|
+
Stop gracefully with Ctrl+C/SIGTERM after all requests finish, then close the Jev ledger
|
|
132
|
+
with `efficiency finish`. A forced kill can lose in-memory observations; no
|
|
133
|
+
complete export is claimed. Empty captures are rejected. Capture one task at a time.
|
|
134
|
+
|
|
135
|
+
JSON/SSE responses are forwarded unchanged. Anthropic start/delta fields merge;
|
|
136
|
+
OpenAI/Gemini usage snapshots replace previous ones. Missing, invalid, oversized,
|
|
137
|
+
HTTP-error or failed response usage stays unknown. Only requests routed through
|
|
138
|
+
the proxy are observed; bypassed/hidden retries and external workers are outside
|
|
139
|
+
coverage. Multi-line SSE and unsupported protocols remain unknown. No request is
|
|
140
|
+
modified to force usage reporting: enable it in the client itself.
|
|
141
|
+
|
|
142
|
+
## Comparison compatibility
|
|
143
|
+
|
|
144
|
+
Use the existing [paired validation workflow](MEASURED-USAGE.md) with references:
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{"path": "agent-usage.json", "format": "agent_usage_v1"}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Missing `format` still means Codex JSONL, preserving 0.2.10 manifests.
|
|
151
|
+
`compareUsageRuns` is the general library function; `compareCodexRuns` remains an
|
|
152
|
+
alias. CLI `efficiency compare`, MCP `jev_compare_usage` and dashboard support
|
|
153
|
+
both sources. Codex-only comparisons retain schemaVersion 1; general comparisons
|
|
154
|
+
use schemaVersion 2 because primary counters and `agentTokenDelta` may be null.
|
|
155
|
+
Consumers must preserve unknown values. Do not sum repeated paired comparisons.
|
|
156
|
+
|
|
157
|
+
## Provider references
|
|
158
|
+
|
|
159
|
+
- [Anthropic cache accounting](https://platform.claude.com/docs/en/build-with-claude/prompt-caching)
|
|
160
|
+
- [Gemini UsageMetadata](https://ai.google.dev/api/generate-content#UsageMetadata)
|
|
161
|
+
- [Antigravity SDK usage](https://www.antigravity.google/docs/sdk/lifecycle/)
|
|
162
|
+
- [Cursor exported usage](https://cursor.com/docs/account/teams/admin-api)
|
|
163
|
+
- [VS Code model API](https://code.visualstudio.com/api/extension-guides/ai/language-model)
|