You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
## Unreleased
4
4
5
5
- Remove low-value call/thread anchor diagnostics from the experimental call investigator to avoid an extra source-log scan per context load.
6
+
- Persist call-origin metadata as categorical aggregate fields during indexing so normal dashboard payloads do not reopen source JSONL logs to infer user-vs-Codex initiation.
Copy file name to clipboardExpand all lines: docs/architecture.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,8 @@ Codex Usage Tracker is a local sidecar app. It reads aggregate token counters fr
4
4
5
5
## Boundaries
6
6
7
-
-`parser.py` converts local JSONL events into aggregate `UsageEvent` records. It must not persist prompts, assistant text, tool output, or transcript snippets.
7
+
-`parser.py` converts local JSONL events into aggregate `UsageEvent` records. It also attaches metadata-only call-origin categories such as user message, tool result, post-compaction, and agent continuation. It must not persist prompts, assistant text, tool output, or transcript snippets.
8
+
-`call_origin.py` owns the pure call-origin classifier and migrated-row fallback. It must not open source JSONL files; source-log reads belong in parser refresh or explicit context loading only.
8
9
-`schema.py` owns persisted `usage_events` columns. Add columns there before changing SQLite migrations or export behavior.
-`reports.py` is the application-service layer for summaries, expensive-call reports, recommendations, pricing coverage, and filtered query payloads. CLI and MCP should call this layer instead of duplicating report assembly.
@@ -28,7 +29,7 @@ Codex Usage Tracker is a local sidecar app. It reads aggregate token counters fr
28
29
4. Add dashboard-only interactions in `plugin_data/dashboard/dashboard.js` and keep URL state in `dashboard_state.js`.
29
30
5. Keep all examples, screenshots, mocks, and tests synthetic. Never derive fixtures from real logs.
30
31
6. When editing skill instructions, update both the source `skills/...` file and the bundled `src/codex_usage_tracker/plugin_data/skills/...` copy. `scripts/check_release.py` verifies that installable plugin assets stay complete and synced.
31
-
7. When adding fields derived from `cwd`, Git metadata, or source paths, decide how they behave in `normal`, `redacted`, and `strict` privacy modes before exposing them in dashboard, JSON, CSV, MCP, or support-bundle output.
32
+
7. When adding fields derived from `cwd`, Git metadata, source paths, or log-event metadata, decide how they behave in `normal`, `redacted`, and `strict` privacy modes before exposing them in dashboard, JSON, CSV, MCP, or support-bundle output.
-`src/codex_usage_tracker/call_origin.py`groups rows by `source_file` and opens each JSONL file to infer call origin.
43
-
-`src/codex_usage_tracker/server.py` serves `/api/usage` by calling `dashboard_payload`, so live refresh inherits the source-log scan.
41
+
-M3 removed the `dashboard_payload` source-log call-origin scan. Call origin is now persisted as aggregate categorical metadata during parser refresh, with a cheap fallback for migrated rows.
42
+
-M3 converted `src/codex_usage_tracker/call_origin.py`to pure classifiers that do not open source JSONL files.
43
+
-`src/codex_usage_tracker/server.py` serves `/api/usage` by calling `dashboard_payload`; after M3, this no longer inherits call-origin source-log reads.
44
44
- M2 removed `_read_call_anchors(...)` from `load_call_context`, so explicit context loading no longer performs the extra anchor scan.
45
45
- M2 removed all dashboard reads of `payload.call_anchors` and `payload.thread_anchors`.
46
46
-`src/codex_usage_tracker/plugin_data/dashboard/dashboard_data.js` builds helper indexes, but adjacent-call lookup and render paths still need a focused large-history review.
@@ -59,7 +59,7 @@ Already implemented before this branch:
59
59
-[x] M0.1 contain calls-table horizontal overflow inside the table card.
60
60
-[x] M1 validate and package the call investigator dashboard asset in CI, docs, and release checks.
61
61
-[x] M2 remove low-value call/thread anchor diagnostics and their extra context source scan.
62
-
-[] M3 persist aggregate call-origin metadata during indexing so dashboard payloads do not scan source logs.
62
+
-[x] M3 persist aggregate call-origin metadata during indexing so dashboard payloads do not scan source logs.
-`python -m pytest tests/test_call_origin.py tests/test_parser.py::test_parser_ignores_known_non_token_context_compaction_event tests/test_parser.py::test_parser_persists_call_origin_from_metadata_segments tests/test_store_dashboard_mcp.py::test_dashboard_payload_uses_persisted_call_origin_without_source_scan -q` failed before implementation because the pure classifier API was missing.
- None yet. M3 removed a source-log scan path and added regression tests; benchmark coverage starts in M8.
133
149
134
150
## Known Remaining Slow Paths
135
151
136
-
- Normal `dashboard_payload`currently runs source-file call-origin annotation.
137
-
- Live `/api/usage`currently calls `dashboard_payload` and inherits that work.
152
+
- Normal `dashboard_payload`no longer runs source-file call-origin annotation.
153
+
- Live `/api/usage`still calls `dashboard_payload`, but after M3 it should not open source JSONL files for call-origin metadata.
138
154
- Context loading still does selected-turn evidence and serialized-evidence work; Milestone 6 must verify whether that can be reduced to one source-file pass.
139
155
- Large-history live dashboard still ships broad payloads before the SQLite-backed API slice work.
140
156
141
157
## Privacy Notes
142
158
143
159
- Milestone 0 made no product behavior changes.
144
160
- The branch must keep all test data synthetic and must not persist raw transcript content.
145
-
- Persisted call-origin work must store only categorical labels, reasons, and confidence values.
161
+
- Persisted call-origin stores only categorical labels, reasons, and confidence values. Parser tests and privacy tests cover this with synthetic secret-bearing message/tool/compaction payloads.
146
162
147
163
## Merge Blockers
148
164
149
-
-`dashboard_payload` and `/api/usage` must stop opening source JSONL files.
165
+
-`dashboard_payload` and `/api/usage` must stop opening source JSONL files. M3 covers the call-origin path; future milestones must preserve that invariant as APIs are split.
150
166
- The call investigator asset must be syntax-checked in CI and release validation.
151
167
- Raw call/thread anchors are removed; keep regression tests proving `call_anchors` and `thread_anchors` stay out of context payloads.
152
168
- Focused privacy tests must prove no raw prompts, assistant messages, tool output, replacement history, or raw JSONL fragments are persisted by default.
Copy file name to clipboardExpand all lines: docs/privacy.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,7 @@ The local SQLite database is stored at `~/.codex-usage-tracker/usage.sqlite3` by
10
10
- model, reasoning effort, context window
11
11
- token counts and derived efficiency ratios
12
12
- subagent source, role, nickname, parent session id, and parent thread name when present
13
+
- call-origin category, reason, and confidence labels derived from event metadata during indexing
13
14
- pricing, credit, allowance, recommendation, and project metadata derived from aggregate fields
14
15
15
16
## Not Stored
@@ -25,6 +26,8 @@ The parser intentionally does not store:
25
26
26
27
Those fields are not written to SQLite, CSV exports, generated dashboard HTML, or synthetic screenshots.
27
28
29
+
Call-origin metadata is heuristic and confidence-labeled. It stores categories such as `user`, `codex`, or `unknown` plus a reason such as `user_message`, `tool_result`, `post_compaction`, or `agent_continuation`. It does not store the message text, tool output, compaction replacement text, or raw JSONL fragment that produced the category.
30
+
28
31
## On-Demand Context
29
32
30
33
`usage_call_context`, `codex-usage-tracker context`, and the `serve-dashboard` context endpoint read a single source JSONL file only when explicitly requested. Returned context is redacted for common secret patterns and capped in size by default for CLI/MCP requests. The call investigator uses the same endpoint at runtime and requests full redacted evidence for the selected call when the local context API is enabled; that still does not persist raw context into SQLite, CSV, support bundles, or generated dashboard HTML.
0 commit comments