Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Renames 'Compact Here' to 'Start Here' and makes it available on both Plans and final Assistant messages.

Changes

Shared utilities (DRY):

  • src/utils/startHere.ts: Core logic for replacing chat history
  • src/hooks/useStartHere.ts: React hook for Start Here button state
  • src/constants/ui.ts: Shared COMPACTED_EMOJI constant (📦)

Component updates:

  • ProposePlanToolCall: Uses shared hook, removes ~30 lines of duplicate logic
  • AssistantMessage: Adds Start Here button to final messages
  • MessageWindow: Adds disabled property to ButtonConfig

Behavior:

  • Start Here button disabled when message is already compacted
  • Consistent emoji (📦) across compacted badge and Start Here button
  • Only shows on final (non-streaming) messages

Documentation:

  • Updated docs/context-management.md to reflect new naming and availability

Testing

make build  # ✓ Passes

Generated with cmux

- Extract Start Here functionality into reusable utilities:
  - src/utils/startHere.ts: Core logic for replacing chat history
  - src/hooks/useStartHere.ts: React hook for Start Here button state

- Update ProposePlanToolCall to use shared hook (DRY)
- Add Start Here button to final Assistant messages
- Update MessageWindow ButtonConfig to support disabled state
- Update documentation to reflect new 'Start Here' naming and availability

This allows users to restart conversations from either plans or
final assistant responses, providing more flexibility in context management.

_Generated with `cmux`_
- Create src/constants/ui.ts with COMPACTED_EMOJI constant (📦)
- Update all uses of compacted emoji to use shared constant:
  - AssistantMessage compacted badge
  - Start Here button label
- Add isCompacted parameter to useStartHere hook
- Disable Start Here button if message is already compacted
- Pass isCompacted flag from AssistantMessage to hook

This prevents confusion from trying to 'Start Here' on a message
that's already the result of a Start Here operation, and ensures
the emoji is consistent across all compacted-related UI elements.

_Generated with `cmux`_
The button was showing as disabled on compacted messages, but it should
be completely hidden. Updated the conditional to check !isCompacted
before adding the button to the buttons array.

_Generated with `cmux`_
**UX Improvements:**
- Emoji (📦) now shows only on hover to reduce visual clutter
- Added tooltip explaining what Start Here does
- Added countdown modal with 3s delay before execution
- ESC or Cancel button aborts the operation
- Confirm Now button skips countdown

**Implementation:**
- Created StartHereModal component with countdown timer
- Updated useStartHere hook to return modal state management
- Extended ButtonConfig to support emoji and tooltip
- Created ButtonWithHoverEmoji component for hover effect
- Integrated TooltipWrapper for helpful tooltips

**Safety:**
- Users have 3 seconds to cancel
- Clear warning about irreversibility
- ESC key cancels operation at any time

_Generated with `cmux`_
- Removed Cancel and Confirm Now buttons
- Simple centered layout with "Compacting in" + large countdown number
- ESC still cancels (built into Modal component)
- Much cleaner, less overwhelming UX

_Generated with `cmux`_
- Removed countdown timer entirely
- Simple confirmation dialog with centered OK and Cancel buttons
- Much more straightforward UX
- Still shows warning that action cannot be undone
- ESC still cancels (built into Modal component)

_Generated with `cmux`_
The subtitle already explains what the action does, so the additional
warning text was redundant. Modal is now cleaner and more concise.

_Generated with `cmux`_
- useStartHere hook now returns a pre-configured 'modal' component
- Both AssistantMessage and ProposePlanToolCall just render {modal}
- Removed duplicate StartHereModal imports and configuration
- Single source of truth for modal behavior

**Before:**
- Both components imported StartHereModal
- Both manually wired up isModalOpen, onClose, onConfirm

**After:**
- Hook returns ready-to-render modal
- Components just use {modal}
- Less boilerplate, better encapsulation

_Generated with `cmux`_
Since startHereWithMessage is only called by useStartHere, it makes
more sense to colocate them. This reduces indirection and makes the
code easier to follow.

Changes:
- Moved startHereWithMessage from src/utils/startHere.ts into src/hooks/useStartHere.ts
- Made it a private function (not exported)
- Deleted src/utils/startHere.ts

_Generated with `cmux`_
@ammario ammario enabled auto-merge October 10, 2025 19:10
_Generated with `cmux`_
@ammario ammario added this pull request to the merge queue Oct 10, 2025
Merged via the queue into main with commit 492d2d5 Oct 10, 2025
9 checks passed
@ammario ammario deleted the start-here branch October 10, 2025 19:45
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.

2 participants