Skip to content

🤖 feat: project-less scratch chats#3723

Open
ibetitsmike wants to merge 12 commits into
mainfrom
mike/scratch-chats
Open

🤖 feat: project-less scratch chats#3723
ibetitsmike wants to merge 12 commits into
mainfrom
mike/scratch-chats

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds project-less "scratch" chats: lightweight chat workspaces that live outside any project, backed by an app-owned workdir at ~/.mux/scratch/<workspaceId> on the local runtime, with no git and all git UI capability-gated away.

Background

Chat state (history, costs, timing, model settings) is already keyed by workspace ID and is project-independent; the only coupling was persistence (config.projects buckets), required projectPath/projectName metadata, and a handful of services asserting a project exists. This PR breaks that narrow coupling so users can start a chat without creating or opening a project. Full design rationale, prior-art research, and rejected alternatives are captured in the plan (hidden _scratch system bucket mirroring the _multi precedent, explicit kind: "scratch" discriminant, no silent git init).

Implementation

  • Persistence: scratch workspaces live in a hidden _scratch system project bucket (projectKind: "system"), keyed by a sentinel constant (src/common/constants/scratch.ts). Metadata keeps required projectPath = per-chat workdir, projectName = "Scratch", plus optional kind: "scratch" used for all gating (optional keeps downgrade compatibility).

  • Lifecycle: workspace.createScratch oRPC route creates ~/.mux/scratch/<id> and persists the config; removal deletes the workdir only after a strict path-safety check (under scratch root, basename equals workspace ID); a best-effort startup sweep removes orphaned scratch dirs.

  • Runtime: reuses local runtime; directory ownership (create/delete) lives in WorkspaceService, so LocalRuntime's never-delete semantics stay intact.

  • Backend gating: git status, patch artifacts, and task forking skip scratch workspaces; system message renders a scratch context block instead of project context.

  • Frontend: getWorkspaceCapabilities(metadata) helper gates UI; sidebar "Chats" section above project rows; draft-first creation page (ScratchPage) mirroring project creation without branch/trunk/runtime controls; command palette entry + keyboard shortcut; WorkspaceMenuBar shows a Scratch label instead of branch/git controls; Review tab filtered out via the tab registry.

  • Docs: docs/workspaces/scratch-chats.mdx.

  • Review hardening (11 Codex rounds): policy gate for createScratch (local runtime must be allowed), scratch-aware trust (isWorkspaceProjectTrusted, shared-execution trust), workdir deletion ownership guard (basename must match the workspace or a task ancestor), capability gating extended to the response-level Fork button, sidebar row fork action, palette create action, and Ctrl+N; scratch draft routes resolve statically after reload; scratch pinned rows reorder as one block; devcontainer preflight skipped for scratch creation.

Validation

  • Browser UAT on a clean sandbox: creation (palette, shortcut, sidebar, empty state), terminal, persistence across restart, direct links, archive/restore, deletion (workdir removed), desktop + 375x812 mobile. 3 defects found during UAT were fixed and re-verified.
  • Backend unit tests: createScratch, metadata derivation, workdir deletion safety, orphan sweep, git-status gating. Frontend tests for sidebar section, creation flow, router, capabilities.

Risks

  • projectPath means both "config bucket key" and "cwd-ish path"; for scratch these differ (bucket key = _scratch sentinel, metadata path = workdir). All findWorkspace consumers were audited and covered by rename/archive/remove tests, but this is where regressions would hide.
  • Downgrade: older builds see _scratch as a system project and filter it from the sidebar; chats become invisible but harmless, and re-upgrade restores them.
  • Recursive delete is only issued for paths matching ~/.mux/scratch/<workspaceId> exactly.

Generated with mux • Model: anthropic:claude-fable-5 • Thinking: xhigh • Cost: $279.19

Adds a hidden _scratch system project bucket, kind: "scratch" workspace
metadata, app-owned workdirs at ~/.mux/scratch/<workspaceId> on
LocalRuntime, capability-gated git UI, sidebar Chats section, command
palette + keyboard shortcut entry points, and docs.

---

_Generated with `mux` • Model: `anthropic:claude-fable-5` • Thinking: `xhigh` • Cost: `$177.01`_

<!-- mux-attribution: model=anthropic:claude-fable-5 thinking=xhigh costs=177.01 -->
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@mintlify

mintlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
Mux 🟢 Ready View Preview Jul 14, 2026, 5:04 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

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

Copy link
Copy Markdown

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: 6ff071a612

ℹ️ 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 thread src/browser/features/ChatInput/useCreationWorkspace.ts
Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

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

Copy link
Copy Markdown

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: adbb4ed750

ℹ️ 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 thread src/browser/components/WorkspaceMenuBar/WorkspaceMenuBar.tsx
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

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

Copy link
Copy Markdown

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: 43ca660ba5

ℹ️ 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 thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx
Comment thread src/browser/contexts/WorkspaceContext.tsx
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

1 similar comment
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

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

Copy link
Copy Markdown

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: 51170f1466

ℹ️ 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 thread src/node/services/workspaceService.ts
Comment thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

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

Copy link
Copy Markdown

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: 5b4f158bcd

ℹ️ 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 thread src/node/services/workspaceService.ts
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

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

Copy link
Copy Markdown

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: 79fa5fb3d1

ℹ️ 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 thread src/browser/utils/commands/sources.ts
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

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

Copy link
Copy Markdown

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: f0dc0333d0

ℹ️ 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 thread src/browser/App.tsx
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

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

Copy link
Copy Markdown

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: 901f89d907

ℹ️ 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 thread src/browser/components/ProjectSidebar/ProjectSidebar.tsx Outdated
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

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

Copy link
Copy Markdown

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: 144e14dead

ℹ️ 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 thread src/node/config.ts
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

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

Copy link
Copy Markdown

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: 1ac0fa1594

ℹ️ 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 thread src/node/services/aiService.ts
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

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

Copy link
Copy Markdown

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: 61ac823957

ℹ️ 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 thread src/node/services/workspaceService.ts
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 6ed14dfd95

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

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