Repository navigation
Description
Problem
Reviewing a builder's changes today is a slow per-file loop: open the unified diff (codev.viewDiff), read a file, switch to the builder terminal, retype the file path (and maybe line numbers) into a message, type the feedback, hit enter; repeat. The path-retyping step is the bottleneck — it's manual, error-prone, and forces a context switch out of the diff.
The existing codev.referenceIssueInArchitect (extension.ts:505) solves the equivalent problem for backlog issues → architect terminal: clicking an inline action injects #<id> into the architect's prompt buffer (no Enter), the human types the rest. We want the same mechanic for file/hunk references → builder terminal.
Current state
codev.viewDiffopens a multi-file unified diff editor for<base>...HEADof the builder's branch (commands/view-diff.ts).- Per-file diffs already exist (
codev.openBuilderFileDiff,extension.ts:516), but the friction isn't opening — it's getting the path/line range into the builder's chat without retyping. codev.referenceIssueInArchitectis the proven inject-into-prompt pattern (no Enter, no afx-send round-trip — direct terminal write).- The unified diff editor knows the builder it was opened for (the builder's
worktreePathandbaseRefare already in scope for eachChangeEntry).
Proposed behavior
Add codelens lines inside the unified diff editor (viewDiff):
- Above each file header —
> Send to builder PTYcodelens. Click → injects the file path (plus a trailing space) into the corresponding builder's prompt buffer. No Enter pressed. - Above each hunk header —
> Send to builder PTY (lines <start>-<end>)codelens. Click → injects<path>:L<start>-L<end>(new-side line range from the hunk header) into the prompt buffer.
The user adds feedback after the injected reference and submits when ready. The builder's terminal is revealed (focused) as part of the inject, same as the architect-reference pattern. The action is direct PTY write — no afx send, no message wrapper.
Targeting: the builder is taken from the diff's owning builder context (the diff is already opened against a specific builder). No builder picker.
Acceptance criteria
- In the unified diff editor opened by
codev.viewDiff, a codelens labeled "Send to builder PTY" appears above every file header. - A codelens labeled "Send to builder PTY (lines N-M)" appears above every hunk header.
- Clicking the file codelens injects
<repo-relative-path>into the builder's PTY prompt buffer; no Enter is sent. - Clicking a hunk codelens injects
<repo-relative-path>:L<start>-L<end>using the new-side line range from the hunk header. - The builder's terminal is revealed (focused) when injection happens.
- No new command is exposed in the command palette (codelens-only entry point).
- If the builder has no active terminal, fall back to the existing
terminal-manageropen-terminal flow before injecting.
Out of scope
- File-tree row right-click action (intentionally rejected — codelens only).
- Sessions / queues / multi-file submission flow (intentionally — this is a per-click inject, not a review session).
- Auto-sending the message (the architect always types their feedback after the reference and submits manually).
- Routing through
afx send(intentionally — direct PTY write matches the architect-reference precedent).
Activity
amrmelsayed commentedon Jun 9, 2026
On it! Working on this with the PIR protocol (plan + dev-approval gates before PR).
[PIR #789] Plan draft
[PIR #789] Plan revised: add coexistence/no-collision note
[PIR #789] Add diff-inject ref helpers + CodeLens provider
[PIR #789] terminal-manager: injectBuilderText + return resolved id f…
[PIR #789] Wire viewDiff registry + register palette-hidden inject co…
[PIR #789] Update thread: implement phase complete
[PIR #789] Option A: lenses on per-file diff + diffEditor.codeLens pr…
[PIR #789] Thread: pivot to Option A (per-file diff)
[PIR #789] Anchor hunk lenses on the first changed line, not the cont…
9 remaining items
[PIR #789] Restore per-hunk lenses alongside symbol lenses (option B)
[PIR #789] Plan + thread: record option B (hunk + symbol lenses)
[PIR #789] Open diffs before computing hunks (fix open-delay regression)
[PIR #789] One change-lens per contiguous changed run, not per git hunk
[PIR #789] Show line range in symbol lens labels too
[PIR #789] Cache document symbols per version (fix ~100% CPU spin)
[PIR #789] Remove symbol cache (misdiagnosed; risked pinning empty sy…
[PIR #789] Enable diffEditor.codeLens at Global scope (personal edito…
[PIR #789] Review + retrospective; lessons-learned (diff CodeLens con…
[PIR #789] Re-sync builder-file context key on registry change (consu…
Merge pull request #1023 from cluesmith/builder/pir-789
vscode CHANGELOG + release notes: #789 codelens injects file/hunk ref…
release notes: rename UNRELEASED.md to v3.2.0-karnak.md and add relea…
[PIR #1037] Flip diffCodelensMode default to forward (preserve #789 f…