4 +title: Deliver pivi transcript presentation and navigation
5 +spec: NL-SPEC-GMWDCMJZ
11 +#
Deliver pivi transcript presentation and navigation 15 +Deliver the transcript presentation and navigation behavior of
16 +[NL-SPEC-GMWDCMJZ](../../specs/NL-SPEC-GMWDCMJZ-pivi-native-neovim-integration/index.md).
18 +[NL-PLAN-CEJPO_XF](../NL-PLAN-CEJPO_XF-deliver-pivi-native-neovim-integration/index.md) delivered a working transcript that appends plain text and mixes pivi's own framing into the content.
19 +This plan makes the transcript the conversation document it already is: addressable entries, message text as authored, rendered formatting, and ordinary motion.
21 +Placement continues from the earlier plan: `lua/bugabinga/pivi/`, with module-level testing rules in that directory's `AGENTS.md`.
23 +Measured constraint, not assumption: a transcript that reparses on every streamed delta costs roughly five hundred times a transcript that lets redraw drive parsing.
24 +Presentation must therefore never force parsing per delta.
30 + session["bugabinga.pivi.session"] --> entry["bugabinga.pivi.entry"]
31 + entry --> transcript["bugabinga.pivi.transcript"]
32 + transcript --> render["bugabinga.pivi.render"]
33 + entry --> fold["bugabinga.pivi.fold"]
34 + entry --> navigate["bugabinga.pivi.navigate"]
35 + navigate --> follow["bugabinga.pivi.follow"]
36 + navigate --> detail["bugabinga.pivi.detail"]
37 + command["bugabinga.pivi.command"] --> navigate
41 +| Module | Responsibility |
43 +| `bugabinga.pivi.entry` | Entry identity, kind, bounds, metadata, and lifecycle over a transcript buffer |
44 +| `bugabinga.pivi.transcript` | Buffer ownership; message text only, with framing delegated to presentation |
45 +| `bugabinga.pivi.render` | Formatting, embedded language presentation, and framing decoration |
46 +| `bugabinga.pivi.fold` | Collapsed and expanded presentation of an entry |
47 +| `bugabinga.pivi.navigate` | Motion between entries and tool calls, and reaching a referenced location |
48 +| `bugabinga.pivi.detail` | Detailed inspection of one entry without leaving the transcript |
49 +| `bugabinga.pivi.session` | Emits entries instead of writing framing text |
50 +| `bugabinga.pivi.command` | `:Pi` subcommands and `<Plug>` mappings for the new behavior |
56 + s1["1 Addressable entries"] --> s2["2 Pure message text"]
57 + s1 --> s3["3 Collapse and expand"]
58 + s2 --> s4["4 Rendered formatting"]
59 + s1 --> s5["5 Motion between entries"]
60 + s5 --> s6["6 Reach a referenced location"]
61 + s3 --> s7["7 Detailed inspection"]
64 +| # | Observable behavior | Modules touched | Verified by |
65 +| --- | --- | --- | --- |
66 +| 1 | Every appended submission, answer, tool call, result, and error is an addressable entry with stable bounds that survive later appends | `bugabinga.pivi.entry`, `bugabinga.pivi.transcript`, `bugabinga.pivi.session` | Entry bounds spec under streaming appends and buffer growth |
67 +| 2 | Transcript text is the message as authored; copying an answer yields the original text without framing | `bugabinga.pivi.transcript`, `bugabinga.pivi.render`, `bugabinga.pivi.session` | Copy spec comparing buffer text with recorded message content |
68 +| 3 | A tool result arrives collapsed to one readable line and expands on request; entry state never alters session history | `bugabinga.pivi.fold`, `bugabinga.pivi.entry`, `bugabinga.pivi.command` | Collapse spec asserting unchanged session entries and message state |
69 +| 4 | Message formatting renders rather than showing markup, embedded code appears in its own language, and unknown formats stay plain | `bugabinga.pivi.render` | Rendering spec plus a streaming budget assertion over a recorded answer |
70 +| 5 | Ordinary motions move between entries and between tool calls in both directions | `bugabinga.pivi.navigate`, `bugabinga.pivi.command` | Motion spec over a replayed recorded run |
71 +| 6 | An entry that names a location navigates there, reusing the existing follow surfaces | `bugabinga.pivi.navigate`, `bugabinga.pivi.follow` | Navigation spec asserting the working window is preserved |
72 +| 7 | An entry can be inspected in full, including tool arguments and results, without leaving the transcript | `bugabinga.pivi.detail`, `bugabinga.pivi.entry` | Inspection spec asserting the transcript window and cursor are unchanged |
74 +Slice 1 is the walking skeleton; every later slice keeps the whole suite green before the next begins.
78 +- Entry bounds must be extmark-backed, because text appended later shifts every fixed line number.
79 +- Presentation is driven by redraw, never by a forced parse per streamed delta.
80 +- Framing lives in decoration, so the buffer stays copyable message text.
81 +- Collapsing is presentation only; the session transcript and Pi history are untouched.
82 +- Location navigation reuses follow-mode surfaces rather than introducing a second window policy.
86 +| Risk | Slice | Mitigation |
88 +| Entry bounds drift as the transcript grows | 1 | Extmark-backed ranges, asserted after appends and after edits to earlier entries |
89 +| Moving framing out of the text loses scannability | 2 | Replace it with decoration in the same slice, and assert both text purity and visible framing |
90 +| Rendering cost grows with a long answer | 4 | Assert a streaming budget over a recorded answer; keep parsing redraw-driven |
91 +| Collapsed entries hide errors the user needs | 3 | Collapse voluminous results only; keep errors expanded |
92 +| New mappings collide with user keys | 3, 5, 7 | Buffer-local mappings in pivi buffers plus `<Plug>` mappings; no global keys |