cmux NEXT Session Info: Environment lists the chat's project by name, never scratch or touched folders; a project click opens Files on the right

Merged
TE
9d ago
+311-233

Leo's words:

"why are these files being shown to me in the first place / what's up with all the logic of all these folders being strewn about anywyas? you guys / and what are you even deriving "project/environment" from? what are these folders pointing to? pointing for? and also when i click that why am i sent to a whole new thing instead of a tab opening on the right?"

What was wrong

The list is Session Info's Environment section (inspector/EnvironmentSection.tsx). Its folder rows came from inspector/chatFolders.ts:

  • The first row was always the chat's cwd, with no scratch filter. A chat started in a harness scratchpad under /private/tmp/... listed it with its path, and Save offered to save it as an environment.
  • The other rows were guesses. They were every folder the chat's tool calls touched (cd DIR, git -C DIR, read and edit paths), grouped into "projects" by guesswork. A worktree a command had cd'd into showed as a project.
  • The click. It already asked for the Files tree as a tab right of the chat (pane.action Files, then AgentBesidePlacement). The Files tab did open on the right. But the Session Info card floating over the chat stayed open, so the narrowed chat sat under the card next to a tree of a scratch folder. That reads as being sent somewhere new. Before #25282, a click on the header's Environment line opened Session Info itself, which in a narrow pane also covered the chat.

What changed

  1. Only the chat's project is listed (chatProject). That's the folder the chat runs in, at its linked worktree's top when acpmux reports one (summary.worktree). It's named by its GitHub repository when the App has read it, else by the folder. The full path is only in the row's tooltip, with no path text in the row. Folders the tool calls touched are no longer listed: the snapshot can't say which of them is a project.
  2. Temporary and internal folders are never a project, the cwd included (internalFolder). That covers /tmp, /private/tmp, /private/var, /var/folders, cmux's agent-home, the home folder and /. Hidden and .noindex folders count too, unless acpmux reports them in git: a worktree under ~/.cmux/worktrees or .claude/worktrees is the project.
  3. Save only for a project. A scratch chat shows its machine and nothing else: no folder row and no Save. A saved environment is named by the project's repository.
  4. A project click opens Files as a tab right of the chat, and Session Info steps aside when it floats over the chat. It does that at the click, or once the split narrows the pane. It stays open for its toggle. Beside the chat (a wide pane), it stays.

Not touched:

  • the machine row, Remote Control, the repository and branch links;
  • the ability to move a chat;
  • the composer.

Gallery (agent-pane.chat-inspector)

  • environment-folders (chosen): the project by its repository's name, then the repository and the branch links.
  • environment-branch-chip: the branch as a chip in the project row, with no branch row. One row shorter, but the branch loses its GitHub link and long names crowd the project name.
  • environment-parent: the name with its parent folder. That's the path text Leo asked not to see.
  • environment-scratchpad: a scratchpad chat shows only its machine.

Gallery: agent-pane.chat-inspector/environment-folders, agent-pane.chat-inspector/environment-scratchpad, agent-pane.chat-inspector/environment-branch-chip, agent-pane.chat-inspector/environment-parent

Before / after

A repository chat (gallery environment-folders, dark and light). Before, it showed its folder with a parent path and six folders guessed from tool calls. After, it shows the project by its repository's name, then the repository and branch links.

BeforeAfter
beforeafter
beforeafter

A scratchpad chat (gallery environment-scratchpad). Before, the scratchpad was the first row with its /private/tmp/... path, and Save was offered. After, only the machine shows.

After, darkAfter, light
afterafter

A project click in the app (cmux-ci capture of a real build on the fake harness, chat in /opt/homebrew, cropped to the chat and its new tab). Both show the Files tab right of the chat. Before (base b86099c1), the Session Info card stays over the narrowed chat and shows the folder's parent path. After (d9bcfe3a), the card steps aside and the chat with its new Files tab is what shows.

BeforeAfter
beforeafter

Alternatives not shipped:

Branch chipParent path
branch chipparent

Tests

Each new test fails on the base code and passes here (run on Linux):

  • chat-inspector-environment.test.tsx:
    • scratch and internal cwds are never a project;
    • the project is named by its repository at its worktree's top;
    • Save is none for a scratch chat;
    • a repository chat lists one row with the path in its tooltip and no touched folders, and the click asks for that folder;
    • a scratchpad chat shows only its machine.
  • chat-inspector-surfaces.test.tsx: over the chat, a project click asks for the Files tab and the card steps aside, still open; beside the chat, it stays. The first fails without the step-aside change.
  • chat-inspector.test.tsx: the first-chat test now expects the name without path text.

Type check, lint and format on the touched files pass. tooltip-rules and gallery-coverage fail the same way on base, and none of their findings are in these files.

Takes back #23943: Leo asked why the folders the chat touched were listed at all ("why are these files being shown to me in the first place"). Environment now lists only the chat's project, so #23943's touched-folder rows are removed on purpose.

Risk: low. This is webview-only, with no Swift or protocol change. Folders that tool calls touched no longer appear in Environment. They still appear in the transcript and in Changes.

Agent session: agent session

šŸ¤– Generated with Claude Code