Concepts

Tasks and worktrees

How Horus isolates the agents' work on its own git branch until you decide to merge.

What it is#

A worktree is a second working copy of the same git repository, in a separate folder and on its own branch. The agent edits that copy and the project's main folder does not change until you decide to merge.

Horus uses worktrees in two places:

AspectConversation with an isolated branchHorusAI task
Who turns it onYou, in a new conversationHorusAI, by default, for every new task
When it is createdOn the first sendWhen the task starts
Where you review itIn the branch chip, in the conversation headerIn the task and the evidence panel
MergingOnly when you click mergeOnly with Integrar… (Merge), never automatic

How it works#

Conversation with an isolated branch#

  1. Open a new conversation in a project that is a git repository.
  2. In the message box, click Trabalhar em branch isolada (Work on an isolated branch). The button turns active (Branch isolada ativa, Isolated branch on). It only shows in an empty conversation and in a folder with git.
  3. Send the first message. Horus creates the branch and the worktree at that moment. If it cannot, the message box says why: fix it and resend, or turn the option off.
  4. The header now shows the Conversa · branch-name chip. Clicking it opens Rever e integrar alterações (Review and merge changes), with the full diff.
  5. When everything looks right, click Integrar no projeto principal em (Merge into the main project on). The button label ends with the base branch, for example main. If there is a warning, the button becomes Integrar mesmo assim (Merge anyway) and the decision is yours.

Other rules:

  • Criar fork (Create fork) and Duplicar (Duplicate) do not carry the worktree: there is always one worktree per conversation.
  • Turns in a worktree, in a conversation or in a HorusAI task, have no restore point and no Editou N ficheiros (Edited N files) card with Anular (Undo). To throw the work away, you do not integrate the branch. See Undoing the changes of a turn.
  • When you delete a conversation with unmerged changes, the Branch isolada por integrar (Unmerged isolated branch) dialog asks what to do. Remover worktree (Remove worktree) deletes the worktree folder, and anything committed stays on the local git branch. Manter em disco (Keep on disk) leaves the folder so you can recover it by hand.

Review with Codex#

Before merging, you can ask Codex for a second opinion on the changes.

  1. Turn it on in Definições do projeto › Permissões › Revisão pelo Codex (Project settings › Permissions › Codex review). It is off by default.
  2. On the diff screen, click Rever com Codex (Review with Codex). The dialog shows the account, the size and the new files included, and warns about files with secret-looking names.
  3. Issues show up in a card, by severity. You can send them to Claude, dismiss them with a reason or review again.

Codex only receives the changes and has no access to the disk.

HorusAI tasks in worktrees#

  • By default, new tasks each run in their own worktree and in parallel: up to two per project and four in total.
  • In the goal, ⋯ › Execução… (Execution) has the options Isolar alterações (Isolate changes, one git folder per task) and Executar em paralelo (Run in parallel, up to two independent tasks per project). Existing tasks keep their previous mode.
  • Each task starts from the repository base. Unmerged changes from one task do not carry over to the next.
  • In a project without git, tasks use the project folder and run one at a time.
  • To bring a task's work into your branch, use Integrar… (Merge), with a preview and confirmation (see Merging a delivery). A task's worktree chip opens that merge; the direct merge of conversations with an isolated branch does not work for tasks.
  • Archiving a task only removes the worktree once the current delivery is in the target. If it is not, the worktree and the branch stay, so you can merge with Integrar… or remove them by hand. The branch is never deleted. If removal fails, for example because of unsaved changes, the task shows Tentar limpar novamente (Try cleaning up again).
  • If the project has verification set up, the commands run in the delivery folder, which is the task's worktree. See HorusAI.

When to use it#

  • Isolated branch: risky or experimental changes, or when you want to keep the main folder clean while the agent works.
  • No worktree: questions, reading code and small edits you will review straight away.
  • Isolated HorusAI tasks: several independent tasks at once, without one stepping on the other's changes.
  • Review with Codex: before merging a large or sensitive change.

Next steps#