Workspaces, Git, and Changes
Working directories and multi-root workspaces, the file tree and editable documents in the Files panel, how the Changes panel compares, and whole-repository commits.
Working directory
Every session has its own working directory, and Klaus's file operations and commands happen there by default. For a session attached to a project, it is the project directory; a plain conversation without a project uses the session's own folder (~/.klaus/sessions/<session id>/). A session can also have several root directories attached at once (a multi-root workspace), and combinations you use often can be saved as workspace sets to reuse next time; when editing a workspace, the folder dialog lets you add several directories at once (sets are managed by id internally, so renaming one never loses the old set).
Files panel
The "Files" panel on the right (⇧⌘/Ctrl+E) lists the files in this session's working directory, every root of a multi-root workspace included. SSH remote projects work too, reading the remote files.
- File tree: icons by file type, with folders loaded when you open them. "Filter files..." at the top matches names, paths, or characters in order. On the keyboard, arrow keys move and expand or collapse, Home / End jump to the ends, and F2 renames; renaming is also in the context menu. The divider between the tree and the preview can be dragged, or adjusted with arrow keys when focused. Each session remembers its own expanded folders, selected file, and scroll position.
- Single-click to preview, double-click to keep: a single click opens the file in a preview tab, which the next single click replaces; double-clicking a file, or starting to edit it, pins the tab so it stays.
- Exclusion list: the workspace exclusion rules at the bottom of "Settings → Preferences" (one glob per line) decide which paths the file tree and filter skip; empty by default. When a file you expect cannot be found, check this list first.
Editing files directly
Markdown files (.md, .markdown) open in a formatted document view by default, with "View source" to switch to source; other writable text files open in the source editor. Both views are editable and save automatically 3 seconds after you stop typing, showing "Saving…" and "Saved". Switching files or views keeps your cursor, scroll position, and undo history, and saves pending changes first.
- If saving fails, your draft stays in the editor with "Save failed" and "Retry save".
- If another program changes the file while you are editing, Klaus pauses autosave and asks you to choose which version to keep: "Use disk version" discards your edits, "Keep my changes" overwrites the file on disk.
- Binary files, files truncated for size, and read-only files cannot be edited; images, audio, video, and PDFs open in preview.
Changes panel
The "Changes" panel shows what changed in the code. Pick a "Scope" at the top:
- Branch (default): compares from the common ancestor of the remote default branch and your branch to the current state of your working tree — everything this branch changed relative to the main line. The comparison base is chosen automatically, or you can specify another branch or commit.
- Uncommitted, Unstaged, Staged: git's three uncommitted states.
- Commit: the changes of one commit.
- Last turn: only what Klaus changed in the previous turn, combined across repositories when the session spans several.
When the session spans several repositories, choose one of them or all repositories under "Repository". The Branch, Uncommitted, and Unstaged scopes include untracked new files. The Changes panel reads the real state of the repository, so things you edited by hand also show up in it — it is not a list of "changes made by Klaus only". When there are very many changed files, only overall statistics are shown.
After each turn, the conversation also gets a file-change card for that turn: the header shows how many files were edited and lines added and removed, followed by the files (three by default for multi-file turns, with a button to show the rest), each with its own counts. Clicking a row jumps to that file's changes for that turn; ⌘/Ctrl-click opens the file itself; "View changes" opens the whole turn's diff. The card is for viewing only and has no undo button.
Git
- The client itself handles listing branches, switching and creating branches, and checking for uncommitted changes before a switch. More complex Git operations are carried out by Klaus as commands, going through the normal permission confirmation; running
git initin a directory that is not yet a repository falls in this category too — the area above the input box will not initialize a repository for you automatically, but asking Klaus to do it is fine, since it runs as a command with permission confirmation. - Branches appear above the input box only when the selection is "a single-folder project + already a git repository + has a current branch". No branch control is offered when a multi-root workspace (or workspace files) is selected — a set of directories has no single "current branch"; for such targets the "Worktree" option is likewise unavailable, with the reason stated. An empty repository (initialized but with no commits yet) also has no branch to pick.
- Before switching branches, uncommitted changes that would be overwritten by the checkout are checked: the confirmation dialog appears only when git would actually refuse the switch, listing those files and offering you the "commit and switch branch" path; changes that carry over intact (non-conflicting edits) do not bother you, and the switch just happens.
- Committing is a whole-repository commit:
git add -Afirst, then commit. The one exception is the "commit and switch branch" step above — it commits only the files that would be overwritten by the checkout, and the rest of your changes stay in the working tree. Before committing, glance at the Changes panel to make sure nothing you did not mean to include got in. You can have Klaus read the diff and write a commit message; an empty message is rejected. - When the repository is in the middle of a merge / rebase / cherry-pick / revert, both Diff and commit refuse outright — nothing will be committed on top of an unfinished merge. Finish that state first.