feat(agents): use claude --prefill for Use direct-launch draft#926
Open
feat(agents): use claude --prefill for Use direct-launch draft#926
Conversation
The "Use" flow on the Task page creates a workspace and pastes the GitHub issue/PR URL into the agent's input box as a reviewable draft (no submit). That's implemented via a post-launch bracketed-paste after waiting on agent readiness — works, but has a race and a 120ms settle. Claude Code's CLI exposes `--prefill <text>`, which launches the TUI with the text already sitting in the input box and nothing submitted. Using it removes the readiness race entirely for Claude users and keeps the "draft, don't send" contract. - Add optional `draftPromptFlag` to `TuiAgentConfig`; set `--prefill` on claude only. No other installed agent CLI (codex, cursor-agent, droid, gemini, copilot, pi, opencode, aider) exposes an equivalent today. - `buildAgentDraftLaunchPlan` in `tui-agent-startup` returns a launch command when the agent has the flag, null otherwise. - `launch-work-item-direct` prefers the draft plan and skips the paste-after-ready path when it is used (pasting again would duplicate the URL). Every other agent keeps today's behavior unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The "Use" CTA on the Task page creates a workspace and drops the GitHub issue/PR URL into the agent's input box as a reviewable draft (not submitted). Today that's done via a post-launch bracketed-paste after
waitForAgentReady+ a 120ms settle — it works, but there's a real race window.Claude Code exposes
--prefill <text>, which launches the TUI with the text already in the input box and nothing submitted. For Claude users this replaces the readiness + paste dance entirely while preserving the "draft, don't send" contract.Changes
src/shared/tui-agent-config.ts— add optionaldraftPromptFlagtoTuiAgentConfig; set'--prefill'onclaudeonly.src/renderer/src/lib/tui-agent-startup.ts— newbuildAgentDraftLaunchPlanhelper. Returns a launch command when the agent has a prefill flag,nullotherwise.src/renderer/src/lib/launch-work-item-direct.ts— prefer the draft plan; skip the post-launch paste when one is used (pasting again would duplicate the URL). Every other agent keeps today's paste-after-ready path unchanged.cmdOverrideshonoring.Agent CLI survey
Checked every CLI we could run locally (codex, cursor-agent, droid, gemini, copilot, pi, opencode, aider) — Claude is the only one with a documented "prefill but don't submit" flag today.
gemini -i/--prompt-interactiveandcopilot -i/--interactiveboth auto-execute. ThedraftPromptFlagshape lets us drop in additional agents as one-liners when they ship the equivalent.Test plan
pnpm typecheckpnpm lint(no new warnings)pnpm exec vitest run src/renderer/src/lib/tui-agent-startup.test.ts— 14 tests pass