Skip to content

Let a citation take the reader to its place — an answer's 'paper.pdf, page 12' opens the file at page 1 today, and no path reaches the page it named #192

Closed

Description

@bencode

Problem

The system prompt tells the assistant exactly what a good reading answer contains: "Cite file paths and useful page, line or cell references" (ui-packages/web/src/features/assistant/system-prompt.ts:5). So the answers come back as "the method is described in paper.pdf, page 12" — and there the citation stops being useful. The reader's only path to that place is to leave the conversation, find the file in Files, open it, and navigate by hand; in a long PDF the navigation itself is what #177 calls dragging blind.

The moment that should complete the citation exists and is deliberately constrained: the open tool, whose description says "open a file only when the reader asks or a task needs it active" (ui-packages/web/src/features/assistant/tools.ts:112-116). But its schema is Type.Object({ fileId }) — no place. A reader who says "take me there" gets the file opened at page 1, and the answer's "page 12" lands nowhere.

Everything the missing half needs is already built and already speaks the vocabulary:

  • read takes one-based inclusive line and PDF page ranges (tools.ts:44-46) — the assistant already names places in exactly these terms.
  • openFile(fileId, place) plus the reveal actions handle page, sheet and scroll targets generically (ui-packages/web/src/features/workspace/workspace-context.tsx:153-157), and the PDF reader lands on a revealed page (ui-packages/web/src/features/reader/pdf-reader.tsx:27-34).
  • A note's [[paper.pdf#page=12]] jumps straight to page 12 — the same place the chat answer names is clickable from a note (Let readers follow the links in their own notes — [[wiki-links]] render as plain text while the assistant walks the graph #95) and inert from a conversation, where anchors only render for http(s) (ui-packages/web/src/components/markdown.tsx:56-60).

Proposal

  • Give open an optional place — the page, line or cell reference the tools already use — forwarded to the existing openFile(fileId, place) reveal path, so the licensed "open when the reader asks" lands where the answer said.
  • Say so in the tool description and the citation line of the system prompt: when the reader asks to see a cited place, open it at that place.

Goal

After this, "take me there" opens the cited file at the exact page, line or cell the answer named — the citation the assistant already writes and the reader's landing place become the same place, with no hand navigation in between.

Verification

grep -n -A3 "'open'," ui-packages/web/src/features/assistant/tools.ts | grep -qE 'page|place'
pnpm --filter @gamma-reader/web test --silent
pnpm check

Refs

Activity

  1. added
    enhancement
    source:scheduled
    on Oct 23, 2026
  2. bencode commented on Oct 23, 2026

    @bencode
    OwnerAuthor

    Independent review — posted by the scheduled issue-reviewer loop (a session separate from the one that files these issues), under the maintainer's standing instruction to evaluate, sharpen, or retire source:scheduled proposals. Audited against main@fc25139.

    Evidence audit: substance fully confirmed; one citation drifted by a few lines.

    Sensor: lint ✓; verify ✗ on main → stays open. The anchor (page|place within 3 lines of the 'open', bind) is deliverable-shaped — bind's fixed structure (name → description → schema) puts any place/page addition in range.

    Sharpening, one scope note: markdown.tsx:56-60 is the display-side face of the same gap — even with the tool fixed, a [[paper.pdf#page=12]] written by the assistant in chat stays inert because chat anchors only render http(s). The proposal correctly fixes the tool path ("take me there"); if the maintainer also wants citations clickable in the transcript, that is a second, separable change (rendering reader-fragment/wikilink anchors in the chat variant) worth its own decision rather than scope creep here.

    Verdict: valid, keep open. No commit implements or invalidates it.

  3. bencode commented on Oct 24, 2026

    @bencode
    OwnerAuthor

    Independent re-review — posted by the scheduled issue-reviewer loop, independent of the session that authored this issue. Audited against main@90b046f; last review stood at main@fc25139.

    Drift check: 15 commits since the last review; two touch the cited area — 6d92ea4 (read_conversation tool) and 7a022aa (document-access.ts refactor). Neither implements the proposal.

    Evidence audit: substance intact; anchors moved 1–2 lines —

    • tools.ts — open now binds at :105-108: description with "open a file only when the reader asks or a task needs it active" verbatim at :106, schema still Type.Object({ fileId }) at :107. The issue's cited :112-116 anchors the move tool (drift the prior review already flagged, +1 from read_conversation). read's "one-based inclusive line or PDF page range" at :44-46 — exact ✓
    • workspace-context.tsx — openFile(fileId, place) now at :154-158 (cited :153-157) ✓; pdf-reader.tsx:27-34 reveal-page open ✓; system-prompt.ts:5 citation line verbatim ✓; markdown.tsx:56-61 — chat anchors still render only reader #-fragments and http(s) ✓

    Duplicate check (open + closed titles): none.

    Sensor: lint ✓; verify ✗ on main — no page|place near the open bind, so not implemented.

    New sharpening from the refactor: 7a022aa moved the assistant's open execution into createReaderDocumentAccess — document-access.ts:31 is open: async (fileId, signal), no place. The fix now crosses that module boundary: thread place through the access module, or fire the existing openFile(fileId, place) reveal path from the bind. The prior review's display-side note stands unchanged (assistant-written [[paper.pdf#page=12]] stays inert in chat, markdown.tsx:57-61).

    Verdict: still valid, keep open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsource:scheduled

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions