Chapter 11 of 15

Files, Search and the Terminal

Freddy has stopped switching windows to read what the agent wrote, and noticed how much of his old routine was only that: find the file, open it, scroll to the line, go back. This chapter is the small tools that make the routine disappear.

The problem

Supervising an agent means looking at the code, and looking at the code from another application means leaving the conversation. You lose your place, the agent's question goes unnoticed, and the file you opened is a copy of the folder you are not working in, if the thread has its own worktree.

The hard way

A full editor open on the project, a terminal next to it, and the discipline to keep both pointed at the same folder as the thread. With worktrees (chapter 7) that last part is where it goes wrong: the terminal is in your project and the agent is in its own copy.

The command palette (⌘K)

The palette searches everything at once:

  • Threads by title. With no search text, your eight most recent threads are listed. From three characters, matching message text is searched too.
  • Commands: every action in the app, with its shortcut.
  • New thread in…: start a thread in a project.
  • Theme: …: switch color theme.

Use ↑/↓ (or ⌃N / ⌃P) to move, Enter to pick, Escape or a click outside to close. Matching is fuzzy: nwthr finds New thread. Searching message text is the one to remember. Freddy can no longer say which thread it was, but he remembers a word the agent used.

Find a file (⌘P) lists the files of the active thread's folder, or the current project's, respecting .gitignore. Search in files (⇧⌘F) searches file contents in the same folder. From two characters, results show the matching line with its file and line number, and picking one opens the file at that line. The search is case-insensitive unless your text contains a capital letter, and it skips binary files, files over 2 MB and anything ignored by .gitignore.

The Files tab

A file tree and an editor for the active thread's folder, in the tools panel (⇧⌘E).

  • Tree: folders first, then files. .gitignored files are hidden; other dotfiles are shown.
  • Editor: syntax highlighting for common languages, with line numbers. Autosave saves shortly after you stop typing, and ⌘S saves at once; the header shows Unsaved or Saved.
  • Changes on disk: if the agent (or anything else) changes the file, the editor reloads it, unless you have unsaved edits. Then a bar offers Reload (take the disk version) or Overwrite (keep yours).
  • Markdown: the eye button switches between editing and a rendered preview. Images (PNG, JPEG, GIF, WebP, SVG, BMP, ICO) are shown as a preview. Binary files and files over 2 MB are not opened.
  • @ in the header adds @path for the open file to the thread's message box.

The Changes on disk bar is the important one when an agent is working in the same file you are editing. Nothing is silently overwritten in either direction; you are asked.

The tools panel is narrow for editing. The expand button in the Files header (or ⌥⌘E) slides the tree and editor in over half the window; drag its edge to make it wider. The conversation stays visible beside it. Close it with the ×, ⌥⌘E or a click outside it; the file stays open in the Files tab.

And when you want your own editor, ⌘O opens the thread's folder in it, or the open file if there is one. The Open button in the title bar shows your editor; its menu lists every supported editor found on this Mac, from VS Code, Cursor, Zed and Sublime Text to the JetBrains IDEs, Xcode, BBEdit, and terminals like iTerm, Ghostty and Warp. Choose your default in Settings → General → External editor; Automatic picks the first one installed.

A terminal in every thread

Every thread has its own terminals, which start in the thread's folder (its worktree, if it has one). Open them with ⌘J, or the Terminal tab in the tools panel. ⇧⌘J gives the terminal the whole window; press it again to go back. That solves the problem from the start of the chapter: the terminal is where the thread is.

It runs your login shell (or the shell set in Settings) and is complete enough for full-screen programs such as vim, htop, lazygit and Claude Code itself.

ShortcutAction
⌘TNew terminal tab
⇧⌘WClose terminal
⇧⌘] / ⇧⌘[Next / previous terminal
⌘DSplit: the current terminal stays on the left, a new one opens on the right. Press again to unsplit.
⌘FSearch the scrollback (Enter or ⌘G for the next older match, Shift+Enter or ⇧⌘G for the next newer, Escape closes)
⌘KClear the screen and scrollback (in a terminal, this does that instead of opening the command palette)

The tab title follows the program running in it. A terminal whose shell has exited is shown struck through. If a command is still running when you close a terminal, Workspace asks first.

Select with the mouse; double-click selects a word, triple-click a line, and ⌥-drag a rectangular block. ⌘C copies and ⌘V pastes. And the button that earns its place: Add selection to chat in the terminal's toolbar puts the selected text in the thread's message box as a code block. Use it to show the agent an error.

For Nordic and other non-US keyboards. Option types characters by default, as macOS does, which you need for [ ] { } | @ ~ on Norwegian and other Nordic keyboards. Turn on Use Option as Meta key in Settings → Terminal only if you use Emacs-style Meta shortcuts instead. Font, size, line height, cursor, shell and scrollback length are set in Settings → Terminal.
Try it: press ⌘K and search for a word from an earlier conversation. Then press ⌘P, open a file the agent changed, edit one line while the agent is idle, and press ⌘J to run the tests in the thread's own terminal.

What you learned

  • What the command palette searches, including the text of earlier messages
  • How to find a file, and how to search in files
  • How the Files tab handles an agent changing a file you have open
  • That every thread has terminals that start in the thread's own folder
  • How to send a piece of terminal output to the agent
Next: in Chapter 12 you set the agents to work on a schedule, and run a task board from the sidebar.