Skip to content

Conversation

@kylecarbs
Copy link
Member

Overview

Make workspace creation automatic and invisible. When no workspace exists, typing and sending a message creates one with an AI-generated title and branch name based on the message content.

Changes

Backend

  • New service: workspaceTitleGenerator.ts - Generates workspace titles and branch names using AI
    • Uses structured output with Zod schema validation
    • Prefers cheap models (Haiku → GPT-4o-mini)
    • Falls back to timestamp-based names if AI fails
  • New IPC handler: sendFirstMessage - Creates workspace and sends message in one operation
  • Updated IPC types and constants

Frontend

  • New component: ProjectSelector - Dropdown for selecting project (auto-hides if single project)
  • New component: FirstMessageInput - Simplified input for first message
  • Updated App.tsx to render empty state with project selector + chat input
  • Added mock API stubs for stories and browser tests

User Flow

Before:

  1. Click "Add Workspace"
  2. Fill out modal (branch name, trunk, runtime)
  3. Click "Create"
  4. Type message

After:

  1. Type message
  2. Hit Cmd+Enter
  3. ✨ Workspace auto-created with AI-generated title and branch

Key Design Decisions

Title vs Branch Name:

  • Git branch: AI-generated git-safe name (e.g., user-auth-rest-api)
  • Display name: Human-readable title (e.g., "Building user authentication REST API")

Graceful Degradation:

  • No API keys? Falls back to Chat ${timestamp}
  • AI generation fails? Same fallback
  • No user-facing errors (logged only)

Backwards Compatibility:

  • Existing workspaces: name equals branch name (unchanged)
  • Manual creation: User's name used for both title and branch
  • Only lazy creation uses AI generation

Testing

  • ✅ Typecheck passes
  • ✅ Lint passes
  • ✅ All mock APIs updated

Generated with cmux

- Add workspaceTitleGenerator service using Vercel AI SDK
- Generate human-readable titles and git-safe branch names
- Add sendFirstMessage IPC handler that creates workspace automatically
- Add ProjectSelector and FirstMessageInput components for empty state
- Update App.tsx to show project selector when no workspace exists
- Gracefully fall back to timestamp names if AI generation fails

Users can now type a message and hit send to create a workspace
with an AI-generated title and branch name based on their message.

Generated with `cmux`
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.

ℹ️ 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".

The 'name' field is used throughout the backend to compute filesystem
paths (e.g., runtime.getWorkspacePath uses metadata.name as the directory).
Storing the AI-generated title there would break path resolution.

Solution:
- Add optional 'displayName' field to WorkspaceMetadata
- Store git-safe branch name in 'name' (used for paths)
- Store human-readable title in 'displayName' (used for display)
- UI prefers displayName over name when rendering

This maintains backward compatibility - existing workspaces without
displayName continue to work, showing the branch name as before.

Generated with `cmux`
FirstMessageInput was using useSendMessageOptions which internally uses
useThinking hook, causing 'useThinking must be used within a
ThinkingProvider' error in E2E tests when empty state was rendered.

Instead, directly use useModelLRU to get the most recent model without
requiring context providers.

Generated with `cmux`
Instead of showing a project selector dropdown when no workspace is
selected, we now:
- If only one project exists: Show FirstMessageInput immediately
- If multiple projects exist: Show welcome message asking user to
  select/create workspace via sidebar

This is cleaner UX - users already interact with projects via the
left sidebar, no need for duplicate selection UI.

Generated with `cmux`
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