Repository navigation
fix(cost): read Workflow-tool agents and complete their output tokens - #9
Merged
Merged
Conversation
A real run showed that Workflow-tool agents sit in subagents/workflows/<run>/ (the reader and the ledger hook only scanned subagents/) and that their transcripts keep only a streaming snapshot of output_tokens. - scan agent transcripts at any depth and take the phase from meta.workflowPhase - keep requests without stop_reason (final: false); complete their output exactly from telemetry api_request events (--otel, bundled otel-sink.mjs) or from cost-state by text length, reported as estimated - resolve composite dispatch labels (Call_R1/R_4) and list every dispatchable element in the cost map, not only skills - record the pilot findings in spike.md Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Worum es geht
Der Pilotlauf von
product-vision-to-user-storiesim Factory-Repo (15 Agents, 10,02 USD) hat zwei Annahmen aus PR #8 widerlegt. Ohne diesen Fix hätte der Bericht für Workflow-Läufe nur 0,16 von 10,02 USD gesehen. Befunde:docs/plans/laufkosten/spike.md, Abschnitt „Pilotlauf mit dem Workflow-Tool“.subagents/workflows/<run>/, nicht insubagents/. Leser und Ledger-Hook scannen jetzt jede Tiefe; die Phase kommt ausmeta.workflowPhase.cost-report.mjs --otel <datei>nimmt jerequest_iddie Werte aus denapi_request-Ereignissen und führt die 52 Hilfsaufrufe (WebSearch/WebFetch) als eigene Zeilen. Dafür liegtotel-sink.mjsbei.cost-statefehlende Ausgabe ist je Modell exakt bekannt, wenn Eingabe und Cache übereinstimmen. Sie wird nach Textlänge verteilt und als geschätzt ausgewiesen; sonst gibt es nur eine Untergrenze mit Hinweis. Gesamtsumme exakt, am Pilot je Element zusammen 1,8 % der Kosten daneben.Call_R1/R_4gelten für den inneren Schritt; die Kostenkarte führt alle ausführbaren Elemente, weil die Fabrik auchhook- undorchestrator-Elemente als Agent ausführt.final: falseund schreibt eine Anfrage neu, wenn sie besser wird.Ergebnis am Pilot
Mit
--otel: 10,0193 USD, nichts geschätzt, identisch mitcost-stateund der Summe vonclaude_code.cost.usage. Der Hook hat alle 15SubagentStop-Ereignisse bekommen; 15 von 15 Labels beginnen mit einer Element-ID. Teuerster Schritt:R_3b„Claims extrahieren & Abdeckung prüfen“ mit 2,76 USD (27 % des Laufs).Prüfung
npm run validategrün,regenerate.shmitRESULT: PASSund allen erwarteten Zeilen, verify aufuser-story-refinement(Kostenkarte neu erzeugt)PASS.🤖 Generated with Claude Code