Skip to content

patterns: add a trace panel to session-explainer - #47

Merged
utsengar merged 1 commit into
mainfrom
session-explainer-trace-panel
Aug 24, 2026
Merged

patterns: add a trace panel to session-explainer#47
utsengar merged 1 commit into
mainfrom
session-explainer-trace-panel

Conversation

@utsengar

Copy link
Copy Markdown
Owner

Why

Highlights is my editorial gloss. The dead-end cards are narrative. Neither shows what actually happened, in sequence — which is the first thing a reader asks for, and the part hardest to fake.

A third tab now carries it.

The design came from counting, not taste

Human side of the session 38 prompts, ~1,600 words
Transcript 12.2 MB
Human share of the bytes ~0.08%

So the rule is ship the input whole and budget the output:

  • every prompt appears complete (collapsed above ~40 words, never truncated away)
  • the agent's reply is collapsed, first line as preview, word count on the toggle
  • tool results are excluded — nearly all of the weight, almost none of the meaning

"Verbatim" is dropped as the promise

It doesn't survive a real session: prompts have typos, and sessions occasionally touch things that shouldn't be published. Three problems, three answers, stated on the page:

typos, dropped words fixed silently — no information in a misspelling
rambling, changes of mind kept — that IS the thinking trail
sensitive spans cut and marked, never silently reworded

An unmarked edit makes every other line on the page unverifiable, which costs more credibility than the cut saves. Touched turns carry a per-turn marker.

The redaction floor now covers the agent's side

This is the find worth reading. Building the panel leaked an employer name, a job title, a customer's real name and an internal URL on the very first render — every one from a reply, not a prompt, because the agent restated them while being helpful.

Prompts get read carefully; they're short and the human wrote them. The agent's side is 15× longer and nobody re-reads it. The floor now says to scan both, and third parties plus the human's own employer are cut by default.

The tab bug this exposed

Adding a third tab left two tabs highlighted. Cause: the default-active rule is .tabs:not(:has(#p2:target)):not(:has(.card:target)) … a.h, and :not(:has(#id)) inherits the id's specificity — so it outranks any later override that tries to switch Highlights off.

Fixed by making the condition correct rather than patching over it, and the e2e asserts the :not() chain rather than the symptom, so the next tab can't repeat it.

Verification

  • npx tsc --noEmit clean
  • npm run test:e2eall 152 checks pass (was 148)
  • Template renders and passes the pattern's own conformance list per tab
  • 36-turn panel built from a real transcript: no horizontal scroll at 360px in any of the three tabs, one active tab in every state

Companion CLI PR vendors the updated pattern + template.

🤖 Generated with Claude Code

Highlights is an editorial gloss and the dead-end cards are narrative.
Neither shows what happened in sequence, which is what a reader asks for
first and the part hardest to fake. A third tab now carries that.

The design came out of counting rather than taste. In the session that
produced this pattern the human's side is 38 prompts and ~1,600 words,
against a 12.2 MB transcript: about 0.08% of the bytes. So the rule is
ship the input whole and budget the output. Every prompt appears
complete; the agent's reply is collapsed with its first line as the
preview and a word count on the toggle; tool results are excluded
entirely, because they are nearly all of the weight and almost none of
the meaning.

"Verbatim" is dropped as the promise, because it can't survive contact
with a real session. Three problems, three answers, and the page has to
say which it used:

  typos                     fixed silently, no information in them
  rambling, changes of mind kept — that IS the thinking trail
  sensitive spans           cut and MARKED, never silently reworded

An unmarked edit makes every other line unverifiable, which costs more
than the cut saves. Turns that were touched carry a per-turn marker.

The redaction floor now says to scan the agent's replies, not just the
prompts. That is the part that gets missed, and building this panel
proved it: the first render leaked an employer name, a job title, a
customer's real name and an internal URL — every one of them from a
reply rather than a prompt, because the agent restated them while being
helpful. Third parties and the human's own employer are now cut by
default.

Template: third tab, the trace styles, and a one-turn skeleton to copy.
The default-active tab rule now excludes #p3 explicitly. It has to:
`:not(:has(#id))` inherits the id's specificity, so adding a tab without
adding it to that chain leaves two tabs highlighted, which is exactly
what happened. The e2e asserts the chain rather than the symptom.

Verified: tsc clean, 152 e2e checks pass (was 148).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🚀 Cloudflare preview

URL: https://1a018ace-htmlbin.utkarsh2012.workers.dev

Built from commit 9b6ff5643c58e1833f5227563f6ff61d985e9b5f.

Note: bindings (D1, KV, AI) are shared with production.
Avoid destructive PR tests on real data.

@utsengar
utsengar merged commit ac00be7 into main Aug 24, 2026
1 check passed
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