Skip to content

query-transcript: a question put to a past session's transcript, one segment at a time - #512

Merged
SSFSKIM merged 6 commits into
mainfrom
query-transcript
Nov 18, 2026
Merged

SSFSKIM merged 6 commits into
mainfrom
query-transcript

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

query-transcript <session> "<query>" puts a question to a haiku holding one segment of a past session's transcript (the stretch between two compactions, or up to a chosen moment with --until) in its context. The answerer reads the visible record as an investigator; the tool checks every quote it gives against the record and stamps it with the row's time, kind and uuid, or marks it not found. Design: docs/doperpowers/specs/2026-11-17-query-transcript-design.md.

What's in it

  • skills/query-transcript/scripts/query_transcript.py (stdlib only) and its launcher bin/query-transcript, on every session's Bash PATH.
  • skills/query-transcript/SKILL.md: when to reach for it, how to read an answer (inference from the record, never recovered thinking; what a quote that isn't found means), --until for decisions, cost.
  • tests/query-transcript/: 38 unit tests against a stand-in claude (no model calls), a new query-transcript gate, and live-check.py, kept out of the gates.
  • A row in docs/whats-inside.md, a bin/ row and the skill count in the root CLAUDE.md, and doperpowers 7.221.0.

Live runs (haiku, about $1.40 across 8 calls, including the ones that found the problems below)

  • Segment 0 of the CI-opt session: both known answers, abfb63cb3b678267d and 공용 CI 킷 (Recommended), came back with stamped quotes ($0.11, 18 s). The 5-question live check passed ($0.12).
  • With --until 2026-10-15T20:03Z, nothing after the cut was known. The answer labelled the replay's closing notices as added by the replay, and the quote check marked them not found.
  • --all on a two-segment session: the segment holding the answer answered with 7 stamped quotes, and the other said the record does not hold it.
  • After every run, the work folder was empty.

Departures from the design (recorded in its "As built" section)

  • No nothing relevant reply. When it was offered, haiku gave it to every segment instantly, the segment holding the answer included.
  • The copy leaves out cost-state rows. On resume they add the session's running cost to the fork's: a $0.13 call reported $199.01.
  • From review (reviewer-medium, two rounds):
    • A segment now includes the rows its compaction kept from before its boundary (preservedMessages, and the preservedSegment chain). They are found through one shared index: 3.9 s for all 83 boundaries of a 764 MB transcript. Checked live: a cut just past segment 1's boundary quotes its kept reply, stamped.
    • --until no longer assumes timestamps rise in file order.
    • The quote check no longer treats * and backticks as removable markup.

Sminos-Session: transcript-segment-query-tool#ed555cef (doperpowers on macbook)

…e context)

Sminos-Session: doperpowers-3c#ed555cef (doperpowers on macbook)
…d-in claude

Sminos-Session: transcript-segment-query-tool#ed555cef (doperpowers on macbook)
… rows, the last segment's real usage

Live on a two-segment session, a "nothing relevant" reply offered to the
segments without the answer was given by every segment at once (8 output
tokens, no thinking), the one holding the answer included; without it both
answer, the one without saying the record does not hold it. A resume adds
the cost-state rows' running total to the fork's cost ($199.01 reported for
a $0.13 call). The last segment's tokens skip the zero usage of engine-made
replies.

Sminos-Session: transcript-segment-query-tool#ed555cef (doperpowers on macbook)
The skill was checked against a control holding only --help (sonnet, 3 reps
each): both cut at the decision with --until and set aside a quote not found;
only the skill's readers framed a "why" as another model's inference from the
record and put their questions in one call.

Sminos-Session: transcript-segment-query-tool#ed555cef (doperpowers on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-17T23:46:59.818198Z 3e891c7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3e891c7bcd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

for _, raw in stretch_lines(path, start, end):
if raw.startswith(b'{"type":"cost-state"'):
continue
raw = SESSION_FIELD.sub(field, raw)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Rewrite only the transcript row's session identifier

When a recorded tool call contains a nested sessionId field in its input, this unrestricted substitution replaces that value with the replay's newly generated ID too. For example, message.content[0].input.sessionId changes even when it identifies a different target session. This silently alters the evidence presented to the answerer, so questions about which session a tool targeted can receive incorrect answers, and quotes of the altered value will fail verification against the original record. Parse each row and update only its top-level transcript sessionId, leaving historical message and tool payloads unchanged.

Useful? React with 👍 / 👎.

hits = []
for loose in (False, True):
f = _loose if loose else _norm
pieces = [f(p.strip(OUTER + " ")) for p in ELLIPSIS.split(q.strip(OUTER + " "))]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve meaningful trailing delimiters when checking quotes

When an answer quotes code ending in a string delimiter, strip(OUTER + " ") removes that delimiter even though it is part of the passage rather than an enclosing quotation mark. For example, a record containing only const role = "administrator"; incorrectly verifies the answer's const role = "admin": removing the closing quote turns the search into a matching prefix. The tool consequently stamps a materially different statement as verified evidence. Preserve unmatched trailing delimiters and remove enclosing quotation marks only when they form an actual wrapper around the passage.

Useful? React with 👍 / 👎.

hits = []
for loose in (False, True):
f = _loose if loose else _norm
pieces = [f(p.strip(OUTER + " ")) for p in ELLIPSIS.split(q.strip(OUTER + " "))]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve meaningful trailing delimiters when checking quotes

When an answer quotes code ending in a string literal, strip(OUTER + " ") removes its closing quote even if there is no corresponding enclosing quote around the passage. For example, a record containing const role = "administrator"; incorrectly verifies the answer's const role = "admin", because the search becomes the matching prefix const role = "admin. The resulting timestamp and UUID falsely certify a materially different statement as verbatim evidence. Preserve unmatched trailing delimiters and remove quotation marks only when they form an actual enclosing wrapper.

Useful? React with 👍 / 👎.

…amps, no markup tolerance in quotes

From review: a compaction keeps a few rows from before its boundary
(compactMetadata.preservedMessages), which the resume puts back after the
summary, and a copy from the boundary dropped them; a time cut stopped at
the first later stamp, though stamps are not in file order everywhere; and
the loose quote match removed * and backticks, certifying 2 * 3 against
2 ** 3. Live: a cut just past segment 1's boundary quotes its kept reply,
stamped 21:10:36.

Sminos-Session: transcript-segment-query-tool#ed555cef (doperpowers on macbook)
…alked from its ends

From the second review round: preservedSegment names its chain by head and
tail, so the rows between were missed when no preservedMessages list came with
it; and each segment rescanned the file up to its boundary (71 s for --all's
lookups on a 764 MB transcript, 3.9 s now).

Sminos-Session: transcript-segment-query-tool#ed555cef (doperpowers on macbook)
@SSFSKIM
SSFSKIM merged commit 47dae0a into main Nov 18, 2026
46 of 48 checks passed
@SSFSKIM
SSFSKIM deleted the query-transcript branch November 18, 2026 00:42
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