Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .memory/chat-fork.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Chat fork from any message — 2026-10-05

Plan: `docs/plans/chat-fork-plan.md` (five PRs). This note tracks what has landed.

## PR 1 — desktop fork (branch `feat/chat-fork-desktop`)

- **Cut points.** `chatStore.copyVisibleHistory` takes `forkAt: { messageId, position }`. `after` keeps a settled assistant reply. `before` keeps everything strictly before a user prompt, which is how Edit in fork works. The legacy `throughAssistantMessageId` input remains for Bot copies and records no lineage.
- **Lineage.** `ChatMeta.forkedFrom` is a `ChatForkLineageV1 { chatId, messageId, position, at }`, parsed strictly by `parseChatForkLineageV1` in `renderer/shared/chat-copy-contract.ts`.
- `readChat` drops an invalid lineage instead of letting `isValidMeta` hide the chat.
- Bot chats never get a lineage.
- **Titles.** Forks are named `Title (fork)`, then `(fork N)`, numbered past the highest sibling in the destination workspace. Forks of forks reuse the base title. Clones keep the `(copy)` suffix.
- **IPC.** `chats:copyVisibleHistory` accepts three request shapes:
- `{chatId}` → clone;
- `{chatId, throughMessageId}` → legacy fork after a reply;
- `{chatId, messageId, position}` → fork at the given cut.

Bot chats reject `before`.
- **UI.**
- Hover actions: settled replies show "Fork from here" (in `MessageActions`); sent prompts show "Edit in fork" (next to Copy). Both use the `ForkMessageButton` component.
- `MessageList` forwards `onFork` through a ref so settled rows stay memoized. The streaming row and Bot chats get no actions.
- While the chat is busy or needs recovery, the buttons are `aria-disabled` and their title gives the reason.
- `/fork` picker rows also get "Edit in fork".
- **Pre-fill.** Edit in fork seeds the new chat's composer: the text goes to the localStorage draft, and the attachments go to a one-shot in-memory seed (`seedComposerAttachments` / `takeComposerAttachmentSeed`; bytes are never persisted). Editing the *first* prompt opens a renderer-only chat draft instead, so no empty chat is persisted.
- **Lineage UI.** The chat header shows a second line with "Forked from “X”", which links to the source, or "Forked from a deleted chat". Sidebar rows get a `GitFork` glyph, a tooltip, and `aria-description`.
- **Deferred.**
- Moving fork into `ChatApplicationService` waits for PR 4 (Remote).
- The right-click context menu and skill pre-fill are not built.
- The Pi journal is not forked yet (PR 2), so the forked model context is rebuilt from visible messages only.
- **Tests.**
- `chat-session-copy.test.ts`: cuts, titles, lineage survival, and corrupt lineage being dropped.
- `chat-copy-contract.test.ts` (registered in `test:slash-commands`).
- The parser test and `chat-copy-view.test.ts`.
- `message-bubble.test.tsx`: which rows show fork actions.
- `tests/e2e/chat-fork.spec.ts`: the real flow against the fake LM Studio.
- **CI note.** Renderer-only PRs skip the Linux packaging jobs, so the required Linux checks never post. #342 (prompt selection) was therefore landed through this branch.
1 change: 1 addition & 0 deletions docs/plans/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Last refreshed 2026-10-01 against `main` at `d2197dfef` (0.51.0 plus later merge
| [Bot-First Aiden On The Go](bot-first-aiden-on-the-go-plan.md) | Active | Phases 0–9 are implemented. Native approval/Stop hardening merged in PR #218, and mid-flight Steer/Queue, question prompts and quiet chat merged in PR #251. Bot chat deep links (`aiden-otg://bot/{id}/chat`) merged in PR #276 and are on main. Every Bot has one persistent chat and one contact row; Favorites are a pinned placement, Bot chat reuses the shared runtime with Messages-inspired identity/bubbles and Aiden's existing composer, and New/Edit Bot exclusively own its durable model. Remote open-or-create, immediate exact-cache chat entry, optimistic favorites, shaped skeleton loading, stable photos, atomic desktop creation, fresh-inventory save retries, conflict-safe Mac/iOS draft rebasing, final-only Bot replies with expandable progress, native-or-companion image handling, and internal TestFlight build 22 are green. Eligible Apple Intelligence hardware, physical iPad, multi-device/Mac, packaged rollback, live Telegram, wider staged TestFlight, Xcode 27, accessibility, and App Store owner gates remain open. |
| [Aiden Manual Pairing](aiden-manual-pairing-plan.md) | Implemented | The reviewed 100-bit setup-code path, shared one-use QR window, staged iOS activation, and adversarial coverage ship; hands-on LAN/Tailscale UI and physical-iPad acceptance remain open. |
| [Compaction](compaction-plan.md) | Partial | Pi-native checkpoints, lifecycle/crash recovery, and exact audited-upstream compatibility ship; durable memory and provider-native paths remain open. |
| [Fork a chat from any message](chat-fork-plan.md) | In progress | PR 1 (desktop Fork from here / Edit in fork, lineage, `(fork N)` titles) implemented 2026-10-05; Pi journal fork, Fork with summary, Remote and mobile follow. Decisions approved 2026-10-05: per-message Fork from here / Edit in fork (after-reply and before-prompt cut points), optional Fork with summary via Pi branch summarization, `forkedFrom` lineage with a flat sidebar glyph, Pi journal fork, busy chats still refused, Remote `POST /chats/{id}/fork` (revision 21, `chat-fork-v1`), iOS/Android menus and CLI daemon. Extends the existing desktop `/fork` and `/clone`. |
| [Designer Mode](designer-mode-plan.md) | Planned | Phase 0 validation has not started in the runtime. |
| [Dynamic Model Catalog](dynamic-model-catalog-plan.md) | Implemented | Validated pi.dev overlays, offline `0600` cache hydration, scoped setup refresh, four-hour launch refresh, force refresh, Pi metadata fallback, and Mac/iOS projection ship; Pi is now pinned to 0.87.1 (PR #246). |
| [Generative UI Artifacts](generative-ui-artifacts-plan.md) | Active | Phases 0–6 shipped: chat-scoped `render_artifact`, strict sandboxed preview/export hosts, verified vendored Chart.js/Plotly/KaTeX, permission-aware `/visualize`, crash-recoverable authoritative storage/copies, descriptor-relative workspace reads, one-iframe handoff/expansion, visible failure states, and route-stable Responding/Visualizing activity. Three-agent PR review findings are remediated with focused regression coverage. |
Expand Down
Loading
Loading