Repository navigation
docs(telemetry): a prompt axis says what it cannot name - #769
Merged
Merged
Conversation
Four places called `by_prompt` "the one breakdown that is complete by construction", three of them backed by one measurement: 1073 of 1073 records of one real session carrying a `prompt_id`. Measured the following day on this machine's own sink, 30,714 records: 845 carry none, 2.75%, and every one of the nine sessions has at least one. Of those 845, 34 were written before the CLI stamped a version, 810 by one session's reader before this resolution shipped, and exactly one by the current reader — an assistant line whose `parentUuid` chain reaches no line naming a prompt. The original measurement is also no longer reproducible: that transcript holds 230 assistant lines today where 1,073 records were read from it. What is true is that `by_prompt` is the one breakdown no host limit can empty — it waits on no journal, no identity file, no declaration, no host naming a skill. That is not the same as complete, and the difference has a mechanism. `storeNewCandidates` treats a candidate whose turn is already stored as a correction only when it carries a larger counter. A field the stored record lacks is not a correction, so a reader that later learns to resolve something an earlier one could not names nothing already stored. A record's field set is fixed the first time its turn is seen. Now stated where that code lives. Left as it is, with the arithmetic: of the 811 measured against the transcripts on disk, 720 name a request no transcript still holds and 90 would resolve today. Roughly 90 records in 30,714 is the whole prize, and enriching would mean appending a line whose counters equal one already stored, which `collapseSupersededTurns` picks between by counter weight and then by serialized content — a preference it would have to learn, for 0.3%. Prose only. No behaviour moves, no envelope field, no version. The behaviour was already guarded, correctly, in both directions. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VWNxk63AGKkqE8HRqHLjGp
Merged
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.
What
Four places called
by_prompt"the one breakdown that is complete by construction", three of them backed by one measurement: 1073 of 1073 records of one real session carried aprompt_id.Measured the following day on this machine's own sink, 30,714 records:
prompt_id5.2.2parentUuidchain reaching no line that names a promptThe original measurement is also no longer reproducible: that session's transcript holds 230 assistant lines today where 1,073 records were read from it, so the figure describes a file state that no longer exists.
What is written instead
by_promptis the one breakdown no host limit can empty — it waits on no run journal, no identity file, no task declaration, no host naming the skill it is running. That is true, checkable, and not the same as complete.The mechanism, now stated where it lives
storeNewCandidatestreats a candidate whose turn is already stored as a correction only when it carries a larger counter. A field the stored record lacks is not a correction, so a reader that later learns to resolve something an earlier one could not names nothing already stored: the turn matches, the counters have not grown, the candidate is dropped. A record's field set is fixed the first time its turn is seen.Why that is left as it is
Roughly 90 records in 30,714 is the whole prize. Enriching would mean appending a line whose counters equal one already stored, which
collapseSupersededTurnspicks between by counter weight and then by serialized content — a preference it would have to learn, for 0.3%. The limit is stated atstoreNewCandidateswith that arithmetic and the condition to revisit it: a reader learning a field that matters more than a prompt id.Files
cost-report.ts,CostReportPromptRowcost-report-envelope.ts, version 13cost-report-contract.md, twice03-report.mdcost-report.unit.test.ts,aidd-telemetry-cost-skill.test.jsread-local-cost-use-case.tsNo new guard, and why
The behaviour is already guarded in both directions and nothing here changes what any guard asserts — the defect was in what the code claimed about itself, not in what it did.
claude-code-transcript.unit.test.tscovers a chain reaching no prompt, a parent the transcript does not hold, and a chain pointing back at itself;cost-report.unit.test.tscovers the unnamed row staying undated, placed last, and reconciling to the period total on every counter.Prose only: no behaviour moves, no envelope field, no version.
Gates: 3434 tests / 308 files,
tsc,biome ci(2 pre-existing warnings, 0 new), knip, jscpd, bundle 592.0 KB within budget, 369 repository script tests, 0 broken links, cli layering clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01VWNxk63AGKkqE8HRqHLjGp