Skip to content

docs(telemetry): a prompt axis says what it cannot name - #769

Merged
blafourcade merged 1 commit into
nextfrom
docs/a-prompt-axis-says-what-it-cannot-name
Sep 4, 2026
Merged

blafourcade merged 1 commit into
nextfrom
docs/a-prompt-axis-says-what-it-cannot-name

Conversation

@blafourcade

Copy link
Copy Markdown
Contributor

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 a prompt_id.

Measured the following day on this machine's own sink, 30,714 records:

Records
carry a prompt_id 29,869
carry none 845 (2.75%) every one of the nine sessions has at least one
— stored before the CLI stamped a version 34 an older reader
— one session under 5.2.2 810 stored before this resolution shipped
— written by the current reader 1 a parentUuid chain reaching no line that names a prompt

The 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_prompt is 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

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: 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

Of the 811 measured against the transcripts on disk Records
still in a transcript, a prompt resolves today 90
still in a transcript, the chain reaches no prompt 1
in no transcript on disk at all 720

Roughly 90 records in 30,714 is the whole prize. 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%. The limit is stated at storeNewCandidates with that arithmetic and the condition to revisit it: a reader learning a field that matters more than a prompt id.

Files

File Was
cost-report.ts, CostReportPromptRow the claim and the 1073 of 1073 measurement
cost-report-envelope.ts, version 13 the same claim, the same measurement
cost-report-contract.md, twice the same claim; the remainder row described as a host limitation only
03-report.md "since every record the reader stores already carries the turn it came from"
cost-report.unit.test.ts, aidd-telemetry-cost-skill.test.js the claim repeated in two comments
read-local-cost-use-case.ts the frozen field set undocumented

No 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.ts covers a chain reaching no prompt, a parent the transcript does not hold, and a chain pointing back at itself; cost-report.unit.test.ts covers 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

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
@blafourcade
blafourcade requested a review from a team as a code owner September 4, 2026 22:36
@blafourcade
blafourcade merged commit aee5721 into next Sep 4, 2026
17 checks passed
@blafourcade
blafourcade deleted the docs/a-prompt-axis-says-what-it-cannot-name branch September 6, 2026 06:22
@aidd-bot aidd-bot Bot mentioned this pull request Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant