Repository navigation
query-transcript: a question put to a past session's transcript, one segment at a time - #512
Conversation
…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)
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 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) |
There was a problem hiding this comment.
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 + " "))] |
There was a problem hiding this comment.
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 + " "))] |
There was a problem hiding this comment.
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)
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 launcherbin/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),--untilfor decisions, cost.tests/query-transcript/: 38 unit tests against a stand-inclaude(no model calls), a newquery-transcriptgate, andlive-check.py, kept out of the gates.docs/whats-inside.md, abin/row and the skill count in the rootCLAUDE.md, and doperpowers 7.221.0.Live runs (haiku, about $1.40 across 8 calls, including the ones that found the problems below)
abfb63cb3b678267dand공용 CI 킷 (Recommended), came back with stamped quotes ($0.11, 18 s). The 5-question live check passed ($0.12).--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.--allon a two-segment session: the segment holding the answer answered with 7 stamped quotes, and the other said the record does not hold it.Departures from the design (recorded in its "As built" section)
nothing relevantreply. When it was offered, haiku gave it to every segment instantly, the segment holding the answer included.cost-staterows. On resume they add the session's running cost to the fork's: a $0.13 call reported $199.01.reviewer-medium, two rounds):preservedMessages, and thepreservedSegmentchain). 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.--untilno longer assumes timestamps rise in file order.*and backticks as removable markup.Sminos-Session: transcript-segment-query-tool#ed555cef (doperpowers on macbook)