Berechnet den Token-Verbrauch für spezifische Codex-Threads mithilfe lokaler Deeplinks oder UUIDs durch die Analyse von SQLite-Snapshots und Rollout JSONL-Dateien.
- GitHub Stars
- 72
- Dateien
- 18
- Letzter Commit
- 10. Nov. 2026
- Lizenz
- MIT
- Erlaubte Tools
- —
Was macht der lov-codex-thread-usage Skill?
Berechnet den Token-Verbrauch für spezifische Codex-Threads mithilfe lokaler Deeplinks oder UUIDs durch die Analyse von SQLite-Snapshots und Rollout JSONL-Dateien.
Zusammenfassung erzeugt aus der SKILL.md des Skills.
Über den lov-codex-thread-usage skill
Dieser Skill ermöglicht es Entwicklern und Nutzern, die lokale Codex-Datenverwaltung zu optimieren, indem er den Token-Verbrauch für spezifische Codex-Threads berechnet. Durch die Angabe eines lokalen Deeplinks oder einer Thread-UUID kann ein Agent SQLite-Snapshots und Rollout JSONL-Dateien untersuchen, um detaillierte Nutzungsberichte zu erstellen. Das Tool ist darauf ausgelegt, zwischen verschiedenen Metriken zu unterscheiden, wie etwa historischen Gesamttokens, dem aktuellsten kumulativen SQLite-Snapshot, gecachten Input-Tokens und Reasoning-Output-Tokens.
Ein Agent sollte diesen Skill laden, wenn ein Nutzer die Nutzung eines Codex-Threads untersuchen oder Tokens für einen spezifischen Deeplink berechnen möchte. Er setzt eine Python 3.9+ Umgebung und die Ausführung des Skripts codex_thread_usage.py voraus. Der Skill erstellt je nach gewünschtem Format entweder einen Textbericht oder einen maschinenlesbaren JSON-Bericht. Er ist speziell für die lokale Diagnose konzipiert und übernimmt keine Account-Subscription-Limits, Abrechnungsschätzungen oder netzwerkbasierte Anfragen.
Was ein agent damit machen kann
- 1Nutzungsstatistiken generierenErstellt eine statistische Aufschlüsselung der Tokens innerhalb eines bestimmten Threads.
- 2Detaillierte Token-Typen untersuchenErhalte einen detaillierten Bericht inklusive Reasoning-Output und gecachten Input-Tokens für eine Thread-UUID.
Geschrieben basierend auf dem SKILL.md des skills. Jeder use case wurde gegen ein zitat daraus geprüft.
So installierst du den lov-codex-thread-usage Skill
Jeder Befehl kopiert den Skill-Ordner in das Skills-Verzeichnis des Clients. Starte den Client neu oder beginne eine neue Session, um ihn zu laden.Den lov-codex-thread-usage Skill in Plugin installieren
/plugin marketplace add lovstudio/skills /plugin install dev-tools@lovstudio
Den lov-codex-thread-usage Skill in Claude Code installieren
~/.claude/skills/lov-codex-thread-usage/SKILL.md
$ npx degit lovstudio/skills/skills/codex-thread-usage ~/.claude/skills/lov-codex-thread-usageDen lov-codex-thread-usage Skill in Claude Code (project) installieren
.claude/skills/lov-codex-thread-usage/SKILL.md
$ npx degit lovstudio/skills/skills/codex-thread-usage .claude/skills/lov-codex-thread-usageDen lov-codex-thread-usage Skill in Codex installieren
~/.agents/skills/lov-codex-thread-usage/SKILL.md
$ npx degit lovstudio/skills/skills/codex-thread-usage ~/.agents/skills/lov-codex-thread-usageDen lov-codex-thread-usage Skill in Gemini CLI installieren
~/.gemini/skills/lov-codex-thread-usage/SKILL.md
$ npx degit lovstudio/skills/skills/codex-thread-usage ~/.gemini/skills/lov-codex-thread-usageDen lov-codex-thread-usage Skill in Claude.ai installieren
npx degit lovstudio/skills/skills/codex-thread-usage lov-codex-thread-usage && zip -r lov-codex-thread-usage.zip lov-codex-thread-usage # claude.ai → Customize → Skills → + → Create skill → Upload a skill → lov-codex-thread-usage.zip
Automatisierte Checks
Geluften am 14. Nov. 2026Vollständiger Bericht →Hat unsere automatischen Prüfungen bestanden. Das ist kein Sicherheitsaudit: Lesen Sie die Skripte, bevor ein Agent sie ausführt. Wie die Checks funktionieren · Was du für mehr Punkte verbessern kannst
- Source Repository verknüpft und erreichbarlovstudio/skills/skills/codex-thread-usage is public and reachablegithub.com/lovstudio/skills/tree/HEAD/skills/codex-thread-us ↗Bestanden
- Open Source Lizenz (OSI)MITspdx.org/licenses/MIT.html ↗Bestanden
- Commit oder Release im letzten JahrLast commit 2026-11-10github.com/lovstudio/skills/commits ↗Bestanden
- Keine Download-und-Ausführen-Muster oder Zugangsdatendiebstahl in Skripten4 scripts read; no download-and-run, remote eval, base64 execution or credential uploadBestanden
- Keine versteckten Anweisungen in SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/lovstudio/skills/blob/HEAD/skills/codex-thread-us ↗Bestanden
- Vorab erlaubte Tools sind eingeschränktNo pre-approved tools; the agent asks before using onegithub.com/lovstudio/skills/blob/HEAD/skills/codex-thread-us ↗Bestanden
- SKILL.md folgt dem Agent-Skills-Formatthe description does not say when to use the skill; name "lov-codex-thread-usage" differs from the folder "codex-thread-usage"github.com/lovstudio/skills/blob/HEAD/skills/codex-thread-us ↗Befund
SKILL.md
Auf GitHub ansehenCodex 用量账本 · Codex Usage Ledger
把一个本地 Codex deeplink 解析成 thread ID,以只读方式检查 SQLite 快照和 rollout JSONL,给出整个线程、最新计数段和 token 类型的可核验统计。
Triggers
Activate when
- 用户说“查这个 Codex 任务消耗”“这个 deeplink 用了多少 token”或“统计 thread tokens”。
- The user asks to “inspect Codex thread usage” or “calculate tokens for this Codex deeplink”.
- 输入是
codex://threads/<uuid>或 Codex thread UUID,并要求 token 明细或统计口径。
Do not activate when
- 用户询问账户订阅额度、五小时/周限额或 reset credits;这些是账户 rate limit,不是单线程 token 统计。
- 用户要求估算 API 账单金额;本 Skill 不内置会变化的模型价格,也不把 cached token 当作免费 token。
- 用户只想打开或导航到 deeplink;应使用宿主的任务导航能力。
User Profile (cross-session)
Read skill.yaml on every run and resolve the shared user-profile/v1 context.
Current request and explicit flags take precedence over Skill records and shared
preferences. Persist only direct durable user statements through
scripts/profile_store.py; never persist thread IDs, transcripts, credentials,
or inferred private paths.
Skill Group Composition
Read references/skill-composition.md before composing adjacent capabilities.
This Skill owns the local deeplink-to-usage result and has no required sibling
Skill dependency.
Workflow (MANDATORY)
Step 0: Resolve runtime
- Resolve
SKILL_DIRfrom the active Skill context. - Read
skill.yaml,references/token-semantics.md, andreferences/skill-composition.mdcompletely. - Confirm Python 3.9+ and
scripts/codex_thread_usage.pyare available.
Step 1: Restate the requested metric
Distinguish these values before reporting:
historical.total_tokens: processed input plus output across all detected monotonic counter segments in the rollout.state_snapshot.tokens_used: the most recent SQLite cumulative snapshot; it can reset after resume or a new Codex process.cached_input_tokens: a subset of input, not an additional quantity.reasoning_output_tokens: a subset of output, not an additional quantity.tui_style_total_tokens: non-cached input plus output; useful for parity with the Codex TUI display, but not a billing estimate.
Step 2: Run the deterministic inspector
Text report:
python3 "$SKILL_DIR/scripts/codex_thread_usage.py" \
'codex://threads/<uuid>' --details
Machine-readable report:
python3 "$SKILL_DIR/scripts/codex_thread_usage.py" \
'<thread-uuid>' --json
Use --codex-home <directory> only when the user explicitly supplies a
non-default Codex data directory. The script reads message envelopes and token
fields but never emits message bodies.
Step 3: Evaluate evidence and boundaries
- Verify the rollout
session_meta.payload.idmatches the deeplink UUID. - Compare
state_snapshot.tokens_usedwith the last segment total. - If there is more than one segment, explain that the SQLite value is only the latest counter, while the historical value sums segment terminals.
- If
estimated_segmentsis nonzero, label the total as accumulated or estimated rather than exact billing usage. - If
raw_response_completed.eventsis nonzero, report it separately; it is exact per event but may be incomplete for older or provider-specific runs.
Step 4: Answer concisely
Lead with historical processed tokens, then show input, cached input, output,
reasoning output, the latest SQLite snapshot, segment/reset count, and quality.
Never add cached or reasoning subsets to total_tokens. Do not infer money or
subscription quota from these fields.
Validation
PYTHONDONTWRITEBYTECODE=1 python3 "$SKILL_DIR/scripts/test_codex_thread_usage.py"
python3 "$SKILL_DIR/scripts/validate_skill.py" "$SKILL_DIR"
The documented activation phrase must route here; “查看 Codex 账户剩余额度” must remain outside this Skill.
Dependencies
- Python 3.9+ standard library only.
- Read access to the local Codex data directory.
- No credentials, network access,
jq, or SQLite CLI required at runtime.
Dateien in diesem Skill
18lov-codex-thread-usage Skill-Fragen
Wie installiere ich den lov-codex-thread-usage Skill in Claude Code?
Führe npx degit lovstudio/skills/skills/codex-thread-usage ~/.claude/skills/lov-codex-thread-usage aus. Claude Code lädt Skills aus ~/.claude/skills (alle Projekte) oder .claude/skills (ein Projekt) und nutzt einen Skill, wenn seine Beschreibung zur Aufgabe passt.
Welche Clients können den lov-codex-thread-usage Skill nutzen?
Jeder Client, der das Agent Skills-Format liest: Claude Code, Codex, Gemini CLI und claude.ai (als ZIP hochladen). Skripte im Skill laufen nur dort, wo der Client Codeausführung erlaubt.
Kann dieser Skill mein Kontoguthaben oder wöchentliche Limits prüfen?
Nein, dieser Skill dient der Token-Statistik für einzelne Threads und verwaltet keine Account-Rate-Limits, Subscription-Credits oder Resets.
Liefert der Skill geschätzte Abrechnungsbeträge?
Nein, der Skill enthält keine Modellpreise und behandelt gecachte Tokens für die Schätzung von Abrechnungsbeträgen nicht als kostenlos.