backnotprop / backnotprop/plannotator

[Feature Request] Ask AI: optionally fork the invoking agent session so the sidebar inherits its conversation history

Open
#1,519 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
8.7k
Forks
649
Avg merge
11h 12m
Merged PRs (30d)
109

Description

## Summary

When Plannotator is invoked from an agent session (plan review via hook, `/plannotator-last`, `/plannotator-annotate`), the Ask AI sidebar always starts a fresh provider session. It receives the document/diff content as a system prompt, but has none of the conversation history from the session that produced the work; the agent's reasoning, exploration, and rejected alternatives. This is especially important if we are reviewing a document that was created at the end of a very, very long session with many other back-and-forths.

The fork machinery for this was merged in #363, but no client passes a parent session, so it's currently unreachable...

## Current behaviour

Every Ask AI session is created fresh. `context.parent` is never populated by any surface:

- `packages/editor/App.tsx` (plan-review and annotate modes) builds `AIContext` without `parent`.
- `packages/review-editor/hooks/useAIChat.ts` (code-review mode) builds `AIContext` without `parent`.

As a result, the `shouldFork` branch in `packages/ai/endpoints.ts` (`context.parent && provider.capabilities.fork`) is always false.

What the fresh session does get is the static snapshot: plan/document content, annotations so far, version info, and (code review) the changeset as a git command or pasted diff. What it can't answer is anything about how the work came to be.

## Requested behaviour

Optionally, fork the invoking parent to answer questions. Optional, because it might be advantageous to start with a fresh session.

Contributor guide

Open the contributing guide

Research direction

Start with the existing fork machinery in packages/ai/endpoints.ts, then trace AIContext construction in packages/editor/App.tsx and packages/review-editor/hooks/useAIChat.ts. Determine how each invoking surface can optionally provide the parent session while preserving fresh sessions; done means the shouldFork path is reachable when the provider supports forking.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ai, backend-api-design, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.