72hanalysis window
14/14exact sessions
49.9Mtokens measured
0telemetry gaps
01
1Cache
Start Compact
Every run starts from a small precheck artifact instead of reopening the whole task and session universe.
Entry point
1
Read the latest run state
codex_usage_precheck.py fetches the newest analysis_runs row, top sessions, repo totals, and recommendation status from the metrics database.
2
Reuse fresh artifacts
The precheck uses latest.json when it is under 900 seconds old, then writes compact Markdown and JSON when a refresh is needed.
3
Keep memory narrow
Only memory tails and run-plan tails are included, so the next agent sees the decision context without dragging full transcripts forward.
then decide whether a new analysis is needed
900sprecheck freshness
latestrun id and quality
Do not rescanwhen the cached summary answers the question
02
2Analyze
Measure Precisely
The analyzer scans only bounded session telemetry, separates exact counters from estimates, and names every skipped source.
Bounded gates
1
Limit to the requested window Session JSONL files are selected by modification time, latest first, for the 72-hour window.
SCAN
2
Skip incomplete work Sessions still marked in_progress are logged as skipped instead of polluting totals.
SKIP
3
Prefer exact token_count events Latest exact snapshots populate input, output, and cached token fields.
EXACT
4
Estimate only with disclosure Fallback math uses event, tool, shell, read, write, and long-output counts, then writes a gap report.
DISCLOSE
All exact
Confidence is high and no rollout fallback is needed.
Any sparse
Telemetry gaps become a named artifact, not hidden uncertainty.
Metric store
i
analysis_runs stores the window, totals, session count, and metric quality.
i
session_metrics stores per-session tokens, tool calls, file reads, long outputs, and repo notes.
i
workflow_recommendations keeps every recommendation traceable to evidence and status.
03
3Act
LIVE
Turn Findings
Into Habits
Recommendations become helper scripts, command manifests, compact reports, and task-workflow rules that future runs can reuse.
Operational response
A
Write compact artifacts
Reports stay under control; large command outputs move to evidence_artifact.py with hashes and previews.
B
Shape repeated commands
command-manifest.md points agents to canonical precheck, analyzer, evidence, and polling commands.
C
Feed the task workflow
Project Manager keeps Linear as task authority while SQLite stores run history, metrics, and memory summaries.
repeatable savings without weaker verification
Priority ladder
P1 !
Production or destructive risk
Do not optimize away confirmation, conflict checks, or safety context.
P2 ?
Missing exact telemetry
Name the gap, estimate separately, and write the gap report for follow-up.
P3 +
Reusable pattern found
Promote it into a helper, manifest, instruction file, or Linear-backed task rule.