Summary
Bring Agent Mode's prompt input sizing behavior into parity with Chat Mode:
- Automatically grow and shrink the Agent composer as its content changes on both the new-chat screen and existing chat detail screens.
- Add Chat Mode's large Expand/Collapse behavior to the Agent Mode new-chat screen only.
- Persist the Agent expansion preference independently from Chat Mode.
Chat Mode is the behavioral reference. This should be implemented as an Agent-focused change; avoid modifying Chat Mode unless it is genuinely unavoidable.
Current behavior
Agent Mode uses the same AgentComposer on both surfaces:
- the empty/new-chat state
- the fixed composer beneath an existing agent timeline
The composer already reuses ChatComposerSurface and CHAT_COMPOSER_TEXTAREA_CLASS, including the normal minimum and maximum height styles. However, its textarea remains at its initial height as text wraps or new lines are added.
The relevant difference is behavioral:
- Chat Mode holds a textarea ref and recalculates its inline height from
scrollHeight whenever the input changes.
AgentComposer renders a one-row textarea but has no equivalent auto-sizing behavior.
- A CSS
max-height constrains growth but does not cause a textarea to grow by itself.
Chat Mode also has a large composer toggle on its new-chat screen. Agent Mode has no equivalent.
Desired behavior
Automatic sizing on both Agent Mode screens
The Agent textarea should behave like the normal Chat Mode textarea:
- Start at the existing compact height.
- Grow as entered or pasted text wraps onto additional lines.
- Shrink again when lines are removed or the input is cleared.
- Stop growing at the same normal maximum height used by Chat Mode.
- Normal layouts: 200px.
landscape-short: preserve the effective 100px cap from the shared styling.
- Once capped, keep the composer stable and allow the textarea itself to scroll vertically.
- Avoid page or timeline layout overflow while resizing.
This behavior must apply to:
- Agent Mode's new-chat/empty-session composer.
- The composer on an existing agent chat detail screen, including a previously loaded session.
Large Expand/Collapse mode on Agent new chat
Add the same large composer affordance used by Chat Mode to the Agent Mode new-chat screen.
When expanded:
- Use the same overall sizing behavior as Chat Mode (approximately
70vh, capped at 800px).
- Let the textarea fill the available vertical space.
- Keep the Agent-specific control row—model, permission mode, project selector, and send button—anchored at the bottom of the composer.
- Use the corresponding Expand/Shrink icon treatment, transition, placement, and accessible toggle labeling from Chat Mode.
- Hide the new-chat heading and privacy message while expanded, matching Chat Mode.
- Apply the same wider expanded layout treatment as Chat Mode.
When collapsed, return to normal auto-sizing behavior.
The manual Expand/Collapse control should appear only on the new-chat/empty-session screen. It should not appear on existing chat detail screens.
Persistence and session transitions
Follow Chat Mode's persistence behavior, but keep the two modes independent:
- Store the Agent preference separately from
chatFullscreen; agentFullscreen is the suggested key.
- Reloading or returning to a new Agent chat should restore the last Agent expansion preference.
- Chat Mode's expansion preference must not change Agent Mode, and vice versa.
- Sending the first prompt from an expanded new-chat screen should transition to the normal compact detail composer.
- The saved expanded preference should remain intact, so the next new/empty Agent session opens expanded.
Technical direction
Prefer the smallest Agent-only implementation:
- Add the auto-sizing ref/effect once inside
AgentComposer, since that component already serves both new-chat and detail surfaces.
- Add Agent-specific expanded state and persistence at the level that survives the new-chat-to-detail transition.
- Pass explicit expansion/toggle props only where the new-chat composer needs them.
- Continue reusing the existing shared
ChatComposerSurface and textarea styling.
- Adjust
EmptyAgentState layout as needed so the expanded composer can match Chat Mode's height, width, and hidden heading/privacy behavior.
Do not turn this into a universal Chat/Agent composer rewrite. The action rows, locking rules, attachments, and send behavior differ substantially between the modes. A small shared primitive is acceptable if it is clearly low-risk, but extracting or rewriting Chat Mode is not required and should be avoided if the Agent implementation can remain self-contained.
Preserve existing behavior
This change must not alter:
- Desktop Enter-to-send and Shift+Enter-for-newline behavior.
- Existing compact-layout/mobile keyboard behavior.
- Agent model, permission mode, and project selection behavior.
- Send, cancel, initialization, loading, and disabled states.
- Timeline scrolling or session switching behavior.
- Chat Mode's current appearance, auto-sizing, expansion behavior, or persisted preference.
Acceptance criteria
Summary
Bring Agent Mode's prompt input sizing behavior into parity with Chat Mode:
Chat Mode is the behavioral reference. This should be implemented as an Agent-focused change; avoid modifying Chat Mode unless it is genuinely unavoidable.
Current behavior
Agent Mode uses the same
AgentComposeron both surfaces:The composer already reuses
ChatComposerSurfaceandCHAT_COMPOSER_TEXTAREA_CLASS, including the normal minimum and maximum height styles. However, its textarea remains at its initial height as text wraps or new lines are added.The relevant difference is behavioral:
scrollHeightwhenever the input changes.AgentComposerrenders a one-row textarea but has no equivalent auto-sizing behavior.max-heightconstrains growth but does not cause a textarea to grow by itself.Chat Mode also has a large composer toggle on its new-chat screen. Agent Mode has no equivalent.
Desired behavior
Automatic sizing on both Agent Mode screens
The Agent textarea should behave like the normal Chat Mode textarea:
landscape-short: preserve the effective 100px cap from the shared styling.This behavior must apply to:
Large Expand/Collapse mode on Agent new chat
Add the same large composer affordance used by Chat Mode to the Agent Mode new-chat screen.
When expanded:
70vh, capped at 800px).When collapsed, return to normal auto-sizing behavior.
The manual Expand/Collapse control should appear only on the new-chat/empty-session screen. It should not appear on existing chat detail screens.
Persistence and session transitions
Follow Chat Mode's persistence behavior, but keep the two modes independent:
chatFullscreen;agentFullscreenis the suggested key.Technical direction
Prefer the smallest Agent-only implementation:
AgentComposer, since that component already serves both new-chat and detail surfaces.ChatComposerSurfaceand textarea styling.EmptyAgentStatelayout as needed so the expanded composer can match Chat Mode's height, width, and hidden heading/privacy behavior.Do not turn this into a universal Chat/Agent composer rewrite. The action rows, locking rules, attachments, and send behavior differ substantially between the modes. A small shared primitive is acceptable if it is clearly low-risk, but extracting or rewriting Chat Mode is not required and should be avoided if the Agent implementation can remain self-contained.
Preserve existing behavior
This change must not alter:
Acceptance criteria
landscape-shortlayouts remain usable without viewport overflow.