Skip to content

Annotate mode: extend the version diff to folder sessions #1104

Description

@BenNewman100

Summary

#960 / #961 brought the version diff to annotate mode — but only for single-file sessions. Folder sessions (plannotator annotate <dir>) still serve every file as a plain render: the file tree's only change signal is the git-based workspace status (uncommitted changes), so a committed-clean folder shows no change signal anywhere, and opening a file never shows what changed since the last round.

This closes the same iterative-loop gap #960 described, for multi-doc reviews: annotate a docs folder → the agent revises several files → reopen the folder and see the highlighted changes per file before the next round. Today that loop forces a choice between the folder's navigation and the single file's diff.

Request

Run the existing history pipeline for eligible files in folder sessions:

  • Snapshot on first open — when a folder session first serves an eligible file, save it to the per-file version history (lazily, memoized per server launch; the existing saveToHistory dedupe keeps unchanged files from minting versions).
  • Serve the diff fields on the doc responsepreviousPlan/versionInfo alongside the doc content, same fields single-file sessions use.
  • Render the existing diff UI in the doc view — inline highlights and the +N/-M badge via the same PlanDiffViewer machinery, plus per-file version browsing.

Notes / constraints

  • History stays continuous across modes. Reuse the existing path-keyed annotate slug, so a file has one version thread whether opened solo or via its folder. No new storage concept.
  • v1 scope: .md / .txt only — HTML deferred, mirroring how feat(annotate): per-file version diff for .md and .html (rendered HTML highlights) #961 landed markdown-first.
  • No history-based tree badges — the git workspace-status badges are untouched; the diff renders in the file view only.
  • Same gates as single-file sessions — the annotatable-file size cap, the annotateHistory config toggle, and graceful degradation to a plain render if history storage is unavailable.
  • Per CLAUDE.md, lands in both the Bun (packages/server/annotate.ts) and Pi (apps/pi-extension/server/serverAnnotate.ts) runtimes.

One question: is it right for this to ride the existing annotateHistory toggle (default-on), or would you prefer a separate opt-in for folder sessions?

Happy to contribute this — PR incoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions