Working with AI
Thoughts, preferences, and learnings from collaborating with AI tools.
Use Worktrees to get Agents and Humans working together without conflict
(2026-01-07)
https://git-scm.com/docs/git-worktree
Mentally, this is moving from "git as version control" to "git as workspace isolation infrastructure"
π Each worktree is a parallel universe with its own checked-out state.
The .git directory is shared, but the working trees are independent.
## Why do this?
Agents can work on multiple features in the same repo using worktrees:
**No checkout conflicts** β Agent A literally cannot `git checkout` to Agent B's branch (git will refuse, since it's already checked out elsewhere)
**Filesystem isolation** β no accidental overwrites, no "oops I edited in the wrong directory"
**Parallel work is safe** β merge coordination happens through the shared object store, not file copying
## Diagram of the process
> diagram generated by Claude Code ^o^
```
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β .git (shared) β
β β
β commits, objects, refs, config β
β ONE source of truth β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
β refs/heads/*
β
βββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ
β finandox/ β βfinandox-auth/ β βfinandox-api/ β
β β β β β β
β branch: main β β branch: β β branch: β
β β β feature/auth β β feature/api β
β βββββββββββ β β βββββββββββ β β βββββββββββ β
β β working β β β β working β β β β working β β
β β tree β β β β tree β β β β tree β β
β βββββββββββ β β βββββββββββ β β βββββββββββ β
β β β β β β
β HUMAN β β AGENT A β β AGENT B β
βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
WORKFLOW
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
1. SETUP (human does this)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
finandox/$ git worktree add -b feature/auth ../finandox-auth main
finandox/$ git worktree add -b feature/api ../finandox-api main
main β
β
βββ feature/auth (finandox-auth/)
β
βββ feature/api (finandox-api/)
2. AGENTS WORK (isolated, parallel)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
finandox-auth/ finandox-api/
β β
βΌ βΌ
commit commit
β β
βΌ βΌ
commit commit
β β
βΌ βΌ
push push
main β
β
βββ feature/auth βββββββ β origin/feature/auth
β
βββ feature/api βββββββ β origin/feature/api
3. SYNC WITH MAIN (agent pulls updates)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
finandox-auth/$ git fetch origin
finandox-auth/$ git merge main
main βββββββ (human merged something)
β β
β ββββββββββ
β βΌ
βββ feature/auth βββββββββM (merge commit)
β
βββ feature/api βββββββ
4. HUMAN REVIEWS (three options)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Option A: cd into agent worktree
βββββββββββββββββββββββββββββββββββββββ
β finandox/$ cd ../finandox-auth β
β finandox-auth/$ ./scripts/uv run... β
β finandox-auth/$ cd - β
βββββββββββββββββββββββββββββββββββββββ
Option B: checkout branch in your worktree
βββββββββββββββββββββββββββββββββββββββ
β finandox/$ git checkout feature/authβ β switches YOUR branch
β finandox/$ ... test ... β
β finandox/$ git checkout main β
βββββββββββββββββββββββββββββββββββββββ
Option C: review PR on GitHub
βββββββββββββββββββββββββββββββββββββββ
β browser: github.com/.../pull/123 β
βββββββββββββββββββββββββββββββββββββββ
5. MERGE (human does this)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
GitHub: merge PR feature/auth β main
main βββββββββββββ β feature/auth merged
β
βββ feature/api βββββββ (still open)
6. OTHER AGENTS SYNC
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
finandox-api/$ git fetch origin
finandox-api/$ git merge main
main βββββββββββββ
β
ββββββββββ
βΌ
feature/api βββββββββM (has auth changes now)
7. CLEANUP (human does this)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
finandox/$ git worktree remove ../finandox-auth
finandox/$ git branch -d feature/auth
Remaining:
main βββββββββββββ
β
βββ feature/api βββββββββM
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
KEY INSIGHT
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β Worktrees are VIEWS into the same repo. β
β β
β β Same .git database β
β β Different checked-out branches β
β β Different working directories β
β β Git prevents checking out a branch that's active elsewhere β
β β
β Agents can't interfere with each other because they're β
β physically in different directories on different branches. β
β Coordination happens through merge, not file copying. β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
FORBIDDEN PATTERNS
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Agent does: cp ../finandox/file.py ./file.py
Why bad: Bypasses git, creates phantom changes, merge conflicts
β Agent does: git checkout main
Why bad: Branch is checked out in finandox/, git will refuse or corrupt
β Agent does: cd ../finandox-api/
Why bad: Working in wrong sandbox, commits go to wrong branch
β Agent does: git push origin main
Why bad: Human reviews and merges, agents push feature branches only
```
Specify the pattern you want an LLM to follow
(2026-01-09)
## Format your content to your audience.
Asking an LLM "What do you think?" is like asking a human "what is the purpose of life?" The answer will be a form of "i dunno" or a preposterously confident pontification (aka, hallucination).
Better results are achieved when the model knows what kind of output you want (which voice to use, what audience to speak to).
LLMs predict the next "most likely correct" token, based on 1. training data, 2. filtered through the model makers' "core goals" for the outputs (helpfulness, harmlessness, ethical behavior, etc.),
3. system prompts and 4. context from the current conversation.
Embrace defaults, avoid tinkering, talk to your users
(2026-01-14)
## Focus on your goals -- ship *YOUR* products
Give yourself over to defaults. **Let go and see what happens.** Apply discipline as an engineer, planner, managerβnot as a prompt tweaker.
Avoid tinkering and fiddling and "programming" the tools themselves--this is not actually getting work done.
Trust the models to do what they do best. Focus on *your* goals (make users happy), not on marginal gains with your tools.
It's worked so far for me; I haven't chased any red herrings. I've shipped useful products.
## Evidence: [Vercel rolled back 80% of their agentic architecture](https://vercel.com/blog/we-removed-80-percent-of-our-agents-tools)
The latest models just work, and they were wasting tokens.
I have so little timeβI have to focus on **my goals** and the product I'm building. The core is working so well, I can't afford to be tweaking for marginal gains (that seem so quickly swallowed by "context window is bigger nowβjust shove it all in there").
## Author more READMEs, AGENT_READMEs, IMPLEMENTATION_PLANs
Avoid compaction. Get Claude to write down its learnings and then *start over*. The model will reacquire appropriate context and do a new feature.
I guess this is the spirit of the "Ralph Wiggum" approachβthough Claude Code made a plugin with that name and annoyingly missed the entire point (they use a single context window and let it compact).
## Human On the Loop
I've been having a ridiculous amount of success telling the model to find one or two **"80% improvement" features**. You're not *in* the loop, you're observing it and stepping in where needed.
Here's [a good discussion of this methodology](https://youtu.be/O2bBWDoxO4s?si=e7Malq49GQAwDqj8) β "Compaction is the devil, Dex."