Skip to content

Delegate: prepare the worktree before an agent starts, and let writers push and stop #991

Open

Description

@scuttletoby

What: two habits become the default for every delegated agent, not only while usage is paced (#893):

  1. Prepare before the agent starts. For a writer or lens on an existing branch, a script (no Claude usage) makes the worktree, merges main, installs dependencies and runs the baseline tests of the files it will touch. The brief gets the result: worktree path, merge conflicts (if any) and baseline red tests. The agent starts with thinking, not setup.
  2. Push and stop. A writer pushes and ends. It does not sit waiting for CI. The orchestrator's PR watch (upstream watch_pull_request) wakes it when checks finish, and it starts the next step.

Why: agent time is the scarce part (usage limits, agent slots, VM memory). Setup is fixed steps a script does cheaper and the same way every time. A writer waiting 15–30 minutes on CI holds a slot and spends usage on polling. A red baseline found before the agent starts also stops agents "fixing" a test that was already red (known-failing rule).

Exceptions:

  • A writer may wait on CI when the run is short (about 5 minutes or less) and a fix loop is likely, because a fresh agent would have to re-read everything.
  • Prepare only what is queued to start soon. Each prepared worktree costs disk and goes stale as main moves; the agent merges main again at start (cheap).

Where: built on upstream T3 delegation (worktree isolation, PR watch), as a thin fork add-on. General: the commands for install and baseline tests come from the project's own config file, not hard-coded.

General vs project: general (any project); the project gives its install and test commands in its config.

🤖 Generated with Claude Code

Activity

  1. scuttletoby commented on Nov 22, 2026

    @scuttletoby
    OwnerAuthor

    Owner addition (in chat, 2026-11-22): a third exception. When an account is behind on using its usage and little time is left before its reset (usage that would otherwise go unused), running as many agents as possible comes first. Then agents may wait on CI and do their own setup, because the spare usage is otherwise lost.

    Rule:

    • On pace or ahead of it: prepare by script, and writers push and stop.
    • Behind, near the reset: fill every free slot (within the machine capacity checks). A paced-out script step is not worth holding an agent back for.

    The usage pacing numbers (#893) decide which case applies. This fits the existing burnFirst setting for accounts whose usage would expire.

    Posted by the orchestrator from the owner's chat message.

    🤖 Generated with Claude Code

  2. added
    area:agents
    size:medium
    type:feature
    on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:agentssize:mediumtype:feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions