Treeflow treeflow
Use when the user asks for treeflow mode, wants a git-worktree-driven implementation flow, or asks to implement a change through PR creation, CI monitoring, and review-thread resolution in the assistant-ui monorepo. The opt-in `auto` mode also merges the PR.
- Our test
- —
- not tested yet
- GitHub stars
- 14k
- assistant-ui/assistant-ui
- Added by
- 0
- members
- Updated
- Dec 6
- commit 6a70f5b
- Content
- 2 files
- no scripts · 5 KB
- License
- MIT
- free to use
What our test found
Not tested yet. Our model tries every skill on a realistic request and scores the result, the most popular skills first. Until then, the safety checks on the right still apply.
name: treeflow description: Use when the user asks for treeflow mode, wants a git-worktree-driven implementation flow, or asks to implement a change through PR creation, CI monitoring, and review-thread resolution in the assistant-ui monorepo. The opt-in `auto` mode also merges the PR.
Treeflow
Implement the change in its own git worktree, open a PR, monitor CI and reviews, and address feedback until the PR is ready to merge. Multiple agents may run concurrently, so keep one worktree and one branch per change group, and leave the primary checkout and other worktrees untouched.
Modes
- Default: stop once the merge gate is clear, leave the PR open, and report that it is ready.
auto: merge the PR once the merge gate is clear. Use it only when the user opts in, by passingautoas an argument or asking for the PR to be landed or merged; never infer it.
Flow
- Run
git fetch origin main. - Create the worktree and branch with
git worktree add --no-track -b <branch-name> .worktrees/<branch-name> origin/main. - Work only inside
.worktrees/<branch-name>from here on, and runCI=true pnpm install --frozen-lockfilethere, because a new worktree has nonode_modules. - Implement the requested change.
- Validate with the repo-appropriate lint/build/test commands. For assistant-ui, default to
pnpm lintandpnpm buildunless the task clearly warrants narrower checks. - Stage only the intended files with
git add <file>, then commit withgit commit -m "<message>". - Push with
git push -u origin <branch-name>. - Open the PR with
gh pr create --title "<title>" --body "<body>"or another non-interactive form such as--fill. - Schedule a 2-minute recurring monitor using the environment's native automation mechanism. In Claude Code, use the available
scheduleorloopskill. - Monitor checks and review threads until the merge gate is satisfied, committing and pushing follow-up fixes from the same worktree.
- Stop the monitor, then finish per the mode: in default mode, report the PR as ready; in
automode, merge withgh pr merge <n> --squash --admin, then clean up.
Add a patch changeset only if a published package changed. Private packages such as @assistant-ui/docs-site and @assistant-ui/shadcn-registry are exempt.
Changes in the main worktree
When the user asks for it and the change already sits uncommitted in the main worktree (the primary checkout), open the PR from that change instead of writing it again; never infer this from a dirty main worktree. In step 4, carry the intended hunks into the new worktree with git -C <main-worktree> diff HEAD -- <file>... | git apply --3way, copy any untracked new files across, and leave out any hunk that belongs to other work. Leave the main worktree as it is.
Cleanup
Keep the worktree while the PR is open, because follow-up fixes land from it. After the PR merges, run these from the primary checkout:
git worktree remove .worktrees/<branch-name>
git branch -D <branch-name>git worktree remove refuses a worktree with uncommitted changes; inspect them instead of passing --force.
Monitor Cycle
Run:
gh pr checks <n>
gh pr view <n> --json reviews
gh api graphql -f query='query { repository(owner:"assistant-ui",name:"assistant-ui") { pullRequest(number:<n>) { reviewThreads(first:100) { nodes { id isResolved isOutdated comments(first:50) { nodes { databaseId body author { login } } } } } } } }'In review threads, id is the GraphQL node id for resolving the thread. databaseId on each comment is the REST integer for replies.
Addressing Threads
Every unresolved thread must get a reply and be resolved.
- Valid: fix in a follow-up commit, reply with the fix SHA, then resolve.
- Invalid: reply with a short rationale, then resolve.
- Outdated: if
isOutdated: true, reply that the diff moved, then resolve.
Use judgment on bot nits. Common-sense suggestions that duplicate what a competent agent already knows are usually reply-and-resolve. Scope creep from long bot-feedback loops is a signal to cut.
Do not add comments or changeset prose that only exist to acknowledge review feedback. Test: would you write it if no reviewer had flagged the code? If no, drop it.
gh api /repos/assistant-ui/assistant-ui/pulls/<n>/comments/<databaseId>/replies -f body='...'
gh api graphql -f query='mutation($id:ID!){resolveReviewThread(input:{threadId:$id}){thread{isResolved}}}' -f id=<threadId>Merge Gate
- All non-cubic CI checks pass.
- Every review thread is resolved.
- No non-cubic reviewer has a current
CHANGES_REQUESTEDstate. Address and wait for re-approval instead of dismissing.
Cubic is optional; do not wait for it if the other gates are clear.
A clear gate makes the PR ready. In default mode, the maintainer decides whether to merge; say in the PR what needs judging, such as a novel mechanism, a real tradeoff, or a public API change. In auto mode, merge once the gate is clear.