Make Prompt Stash server-authoritative across clients #7626
Summary#
Move Prompt Stash from browser-local state to durable state owned by the target T3 execution environment, so stashed prompts follow the same environment across desktop, web, mobile, or another controlling machine.
This should happen after #6276 because that PR establishes the server-side attachment model this design should reuse instead of inventing another blob-sync path.
Depends on: #6276
Why#
Today the stash is globally provider-agnostic, but apps/web/src/promptStashStore.ts still treats browser localStorage as the authoritative store. That means the same execution environment can have different stash queues depending on which client/browser is connected.
#6276 fixes the harder attachment half by uploading attachment bytes to the server and persisting references by ID. Once that lands, stash metadata can move server-side while continuing to reference those existing attachment IDs.
Proposed architecture#
The target execution environment/server should be the single source of truth for Prompt Stash.
- Persist stash metadata durably on the server, scoped to the environment rather than a thread or provider.
- Add idempotent mutations for creating, taking, and deleting stash entries.
takeshould be atomic so two clients cannot restore the same entry. - Expose a dedicated environment-level stash snapshot/subscription rather than piggybacking on
subscribeThread, because stash is intentionally thread- and provider-agnostic. - Put replicated client state in
packages/client-runtimeso web and mobile consume the same canonical model. - Reuse the attachment IDs introduced by #6276. Sync references, not base64/blob payloads.
- Keep client storage only as an optional offline pending-outbox layer, not as canonical stash state.
- Clear the composer only after the target server acknowledges a durable stash write.
- Keep T3 Connect as transport to the execution environment, not a second state authority.
Possible RPC/command shape, names illustrative:
prompt-stash.createprompt-stash.takeprompt-stash.deleteprompt-stash.subscribe/ snapshot
Correctness requirements#
- Two connected clients see the same stash ordering and updates.
- Taking an entry from one client removes it everywhere exactly once.
- Concurrent restore attempts cannot duplicate a stash entry.
- Server restart preserves the queue.
- Attachment references remain valid after stash/create/take flows.
- A failed durable write leaves the composer and attachments unchanged.
- Existing local-only stash data has an explicit migration or retirement policy.
- Offline behavior cannot overwrite newer canonical server state silently.
Out of scope#
- Making T3 Connect the canonical storage layer.
- Reworking the attachment upload protocol already covered by #6276.
- Making stash thread- or provider-scoped again.
Implementation order#
Do not start this until #6276 is merged or its attachment contract is otherwise stable enough to build against. The implementation should then be a focused follow-up PR rather than expanding #6276 further.
Related discussion: https://github.com/pingdotgg/t3code/pull/6276#issuecomment-5350255834
Note
🤖 GPT-6 responding on behalf of Elliot
This is still relevant on current main (
60b35a1ee0): Prompt Stash remains browser-local. #8048 is merged and supersedes the #6276 prerequisite; the follow-up should reuse its attachment upload/reference contract.Before implementing, could maintainers approve this minimal scope?
- One durable, environment-owned queue shared by desktop, web and phone, with atomic take and an independent stash subscription. Clear the composer only after the server acknowledges the durable write.
- Keep existing browser stashes local and recoverable, with no automatic uploads or assignment to a connected environment.
- Retain new shared attachments while stashed and after restore until sent or explicitly discarded, reusing existing upload IDs and dispatch behavior. Pending uploads currently expire after 24 hours, so metadata alone would not preserve attachments.
The retention tradeoff is longer server storage of potentially sensitive files, including abandoned restored drafts; cleanup/storage limits need agreement without silently expiring acknowledged stash attachments. No offline sync engine or new upload protocol is proposed.
Does this direction fit the intended MVP, including the local-only legacy policy and attachment lifetime? Implementation will wait for scope agreement.
Note
🤖 Claude Opus 5.5 responding on behalf of Sam
Please also add stash to the mobile app. Syncing alone won't help on a phone, because the mobile app has no stash at all today and phones have no
Ctrl+S.Implementation ideas:
- Save: a stash button in the composer toolbar (
ComposerToolbar.tsx), or a long press on Send. - Restore: tap the button with an empty composer to open a bottom sheet with the stash list. Tap an entry to restore it, swipe to delete it.
- Badge: show the stash count on the button, like
ComposerStashBadgeon web, so a prompt stashed on desktop is easy to find on the phone. - Shared code: put the stash state in
packages/client-runtimeso web and mobile use the same logic.
- Save: a stash button in the composer toolbar (
tanstack-source added labelsfeature
Thanks for writing this up. It asks for new behaviour rather than reporting a defect, so it does not belong in the bug tracker and I'm closing it as not planned here. Feature ideas are discussed in Discussions: please post it there.
juliusmarminge closed this
Sign in to join this conversation.
Note
This is an automated response from a bot acting on maria's behalf. This issue has had no activity since 2026-08-20. Is it still relevant on the current version? If so, your version and OS would help.