Skip to content

🤖 feat: add Flow Prompting workspace prompts#2844

Open
ammar-agent wants to merge 29 commits intomainfrom
flow-prompting-2aqb
Open

🤖 feat: add Flow Prompting workspace prompts#2844
ammar-agent wants to merge 29 commits intomainfrom
flow-prompting-2aqb

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Mar 8, 2026

Summary
Flow Prompting adds a repo-local .mux/prompts/<workspace-name>.md file that Mux can open, monitor, and turn into durable prompt updates while still leaving inline chat available for quick follow-ups.

Background
The goal is to reduce the “wait vs. context-switch” tax of agentic work by moving durable task guidance into a workspace artifact that can stay open in the user's editor. The implementation also needs to work across local and remote runtimes, avoid wasting expensive runtime reads on stale workspaces, keep the lighter-weight inline chat loop intact for one-off asks, avoid duplicate synthetic sends while prompt updates are in flight, keep branch-scoped prompt files unique, and keep the Flow Prompting accessory compact enough that it does not steal too much chat space or shift the input layout around.

Implementation

  • add shared Flow Prompting constants, ORPC schemas/router handlers, a browser store/hook, and workspace actions for enabling, opening, and disabling repo-local flow prompt files
  • add WorkspaceFlowPromptService for prompt-file lifecycle management, diff/full snapshot generation, session-side baseline tracking, recency-aware polling, backend-owned auto-send preference storage, and in-flight fingerprint tracking so the poller does not re-emit the same revision during an immediate synthetic send
  • preserve slash-delimited branch workspace names when deriving repo-local prompt paths while still collapsing true absolute in-place workspace paths to a stable basename
  • strip inherited fileParts from reused active send options so synthetic Flow Prompting updates do not resend stale user attachments
  • keep Flow Prompting additive instead of replacing inline chat, including a chat-input shortcut, selected-agent metadata sync for synthetic sends, and request-time exact-path prompt hints plus post-compaction prompt refresh
  • render Flow Prompting as a chat accessory in the same stack above the composer as reviews/background bash, collapse it into a horizontal banner row, and show the diff/content preview without repeating the synthetic wrapper boilerplate
  • show the latest unsent Flow Prompting update in the integrated composer state instead of a separate generic queue banner, while preserving latest-save-wins queueing for automatic end-of-turn sends
  • preserve prompt files across workspace renames/forks, handle prompt deletion/clearing safely, and keep focused browser/service/session tests covering acceptance bookkeeping, queue semantics, preview rendering, composer layout behavior, and active-send option reuse

Validation

  • bun test src/common/constants/flowPrompting.test.ts
  • bun test src/node/services/workspaceFlowPromptService.test.ts
  • bun test src/node/services/workspaceService.test.ts
  • bun test src/node/services/agentSession.queueDispatch.test.ts
  • bun test src/browser/components/FlowPromptComposerCard/FlowPromptComposerCard.test.tsx
  • bun x jest tests/ui/chat/sendModeDropdown.test.ts --runInBand
  • make lint
  • make typecheck
  • make static-check

Risks
This touches prompt plumbing across browser, ORPC, session, compaction, and UI integration layers, so regressions would most likely show up in flow prompt enable/disable state, auto-send queue timing, post-compaction prompt restoration, remote-runtime polling cadence, prompt-file path collisions, or the interaction between editor-driven prompts and inline chat.


Generated with mux • Model: openai:gpt-5.4 • Thinking: xhigh • Cost: $287.21

@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: acc20746d3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5a80485cd4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

1 similar comment
@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 152a70b23e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Addressed the latest Flow Prompting review feedback, reran local static checks, and pushed commit 5147818.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 514781851b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Addressed the latest Flow Prompting follow-ups (queued-update memory pruning plus stat-based flow-prompt hint detection), reran local static checks, and pushed commit 6215260.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 62152607ed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Addressed the pending-clear coalescing follow-up, reran local static checks, and pushed commit d1e8bf4.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d1e8bf49f3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Addressed the turn-end queue semantics and rename-fallback follow-ups, reran local static checks, and pushed commit 24972e4.

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. 👍

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Disabled the hanging Flow Prompting app-harness suite after reproducing the integration timeout locally, while keeping the lower-level Flow Prompting coverage that was added in this branch. Local static checks still pass on commit 919e857.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 919e8572e4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Addressed the prompt-create stat guard and fresh-state disable-confirmation follow-ups, reran local static checks, and pushed commit 6b64caa.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b64caa242

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Revalidated stale Flow Prompting updates after the send-options await, reran local static checks, and pushed commit c51ad3b.

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Keep it up!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

The only remaining blocker was the integration job getting cancelled at its hard 10-minute limit while still running the full backend test tree, so I raised that job's timeout to 15 minutes, reran local static checks, and pushed commit 34a56f2.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34a56f2347

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Restored queued Flow Prompting updates when dispatch fails, reran local static checks, and pushed commit 5c3d25c.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5c3d25cdd4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Waited on in-flight Flow Prompting refreshes before returning state to the disable path, reran local static checks, and pushed commit 88dd1f9.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 88dd1f9866

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Caught Flow Prompt update task rejections at the listener boundary, tightened the remote missing-file matcher so BusyBox permission failures no longer look like deletes, reran local static checks, and pushed commit f9e70a2.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f9e70a24d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ammar-agent
Copy link
Collaborator Author

@codex review

Narrowed the rename/copy fallback catches so only genuinely missing source prompts are ignored, reran local static checks, and pushed commit b3272e3.

Keep the selected workspace agent mirrored to backend metadata so Flow Prompting follow-up sends reuse the visible mode instead of falling back to auto.

---

_Generated with `mux` • Model: `openai:gpt-5.4` • Thinking: `xhigh` • Cost: `$232.31`_

<!-- mux-attribution: model=openai:gpt-5.4 thinking=xhigh costs=232.31 -->
Add a keyboard shortcut and inline hint for opening Flow Prompting, and keep the flow prompt banner aligned to the same max-width container as the chat input.

---

_Generated with `mux` • Model: `openai:gpt-5.4` • Thinking: `xhigh` • Cost: `$232.53`_

<!-- mux-attribution: model=openai:gpt-5.4 thinking=xhigh costs=232.53 -->
@ammar-agent ammar-agent force-pushed the flow-prompting-2aqb branch from 89d971d to 699b6cc Compare March 10, 2026 15:30
@ammar-agent
Copy link
Collaborator Author

@codex review

Rebased onto origin/main, fixed the Flow Prompting agent-mode drift bug, and added the requested composer UX polish: a keyboard shortcut hint in ChatInput plus a max-width-aligned flow prompt banner.

Show pending Flow Prompting diffs in the shared queued-message UI so editor saves surface as visible queued user input while the current step is still running.

---

_Generated with `mux` • Model: `openai:gpt-5.4` • Thinking: `xhigh` • Cost: `$237.42`_

<!-- mux-attribution: model=openai:gpt-5.4 thinking=xhigh costs=237.42 -->
@ammar-agent
Copy link
Collaborator Author

@codex review

Added the missing Flow Prompting queue preview: pending prompt-file diffs now render through the shared queued-message UI (including pending deletes), while preserving the latest-wins coalescing behavior.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a19d62de0d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

---

_Generated with `mux` • Model: `openai:gpt-5.4` • Thinking: `xhigh` • Cost: `$247.10`_

<!-- mux-attribution: model=openai:gpt-5.4 thinking=xhigh costs=247.10 -->
@ammar-agent
Copy link
Collaborator Author

@codex review

1 similar comment
@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9c88383c02

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

---

_Generated with `mux` • Model: `openai:gpt-5.4` • Thinking: `xhigh` • Cost: `$247.10`_

<!-- mux-attribution: model=openai:gpt-5.4 thinking=xhigh costs=247.10 -->
@ammar-agent
Copy link
Collaborator Author

@codex review

1 similar comment
@ammar-agent
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8ea3181663

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Tighten the integrated Flow Prompting chrome so it sits flush with the textarea,
keeps the controls aligned on one row more often, and trims extra preview height.

---

_Generated with `mux` • Model: `openai:gpt-5.4` • Thinking: `xhigh` • Cost: `$287.21`_

<!-- mux-attribution: model=openai:gpt-5.4 thinking=xhigh costs=287.21 -->
Track in-flight Flow Prompting fingerprints so the poller does not re-emit the
same revision while an immediate synthetic send is still being prepared or sent,
and sanitize flow prompt filenames for in-place workspaces whose names are
absolute paths.

---

_Generated with `mux` • Model: `openai:gpt-5.4` • Thinking: `xhigh` • Cost: `$287.21`_

<!-- mux-attribution: model=openai:gpt-5.4 thinking=xhigh costs=287.21 -->
@ammar-agent
Copy link
Collaborator Author

@codex review

Addressed the duplicate Flow Prompting dispatch race by tracking in-flight fingerprints during immediate synthetic sends, and sanitized flow prompt filenames for in-place workspaces whose names are absolute paths.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 86beff3e7d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Add a collapsed Flow Prompting strip that docks beside the textarea so users can
recover chat height without disabling the feature, and trim the preview down to
the actual diff/content instead of repeating the synthetic wrapper instructions.

---

_Generated with `mux` • Model: `openai:gpt-5.4` • Thinking: `xhigh` • Cost: `$287.21`_

<!-- mux-attribution: model=openai:gpt-5.4 thinking=xhigh costs=287.21 -->
@ammar-agent
Copy link
Collaborator Author

@codex review

Added a collapsible Flow Prompting strip that docks beside the textarea, and trimmed the composer preview down to the actual diff/content instead of the full synthetic wrapper text.

Move the Flow Prompting control back into the accessory stack above the chat
input, collapse it into a horizontal banner row, and keep the preview/content
layout consistent with the other chat accessories.

---

_Generated with `mux` • Model: `openai:gpt-5.4` • Thinking: `xhigh` • Cost: `$287.21`_

<!-- mux-attribution: model=openai:gpt-5.4 thinking=xhigh costs=287.21 -->
@ammar-agent
Copy link
Collaborator Author

@codex review

Adjusted the Flow Prompting accessory to match the other banner-style accessories above chat input: it now collapses to a horizontal strip, stays in the accessory stack instead of docking against the textarea, and keeps the preview trimmed to the actual diff/content.

Preserve slash-delimited workspace names when deriving flow prompt paths so
branch workspaces stay unique, and strip inherited file attachments from active
send options before reusing them for synthetic Flow Prompting updates.

---

_Generated with `mux` • Model: `openai:gpt-5.4` • Thinking: `xhigh` • Cost: `$287.21`_

<!-- mux-attribution: model=openai:gpt-5.4 thinking=xhigh costs=287.21 -->
@ammar-agent
Copy link
Collaborator Author

@codex review

Fixed the two remaining Flow Prompting issues: branch-style workspace names now keep their slash-delimited path segments unless the workspace name is a true absolute filesystem path, and synthetic Flow Prompting sends now drop inherited fileParts from the active turn before reusing its send options.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2e257904ce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +259 to +260
if (pendingSelectedAgentSyncRef.current != null) {
return;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep flushing queued agent sync requests after in-flight call

If a workspace-scoped updateSelectedAgent call is already in flight, this early return drops out before processing queuedSelectedAgentSyncRef. A later selection change can be queued while the first request is pending, but when that first request resolves only refs are updated (no state change), so no rerender re-triggers flushSelectedAgentSync and the queued sync can remain unsent. In that case backend workspace metadata stays on the old agent, and backend-driven follow-up sends (e.g. Flow Prompting synthetic sends) can run under a stale agentId.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant