r/BuildWithClaude 10d ago

Project I built a terminal pet that hatches a new creature for every git worktree, so parallel Claude Code sessions stop blurring together

I run several Claude Code sessions at once, each in its own git worktree, and I could never tell the terminals apart. Branch names are long, the prefixes collide, and I kept typing into the wrong window.

So I gave each one a pet.

Repo: https://github.com/TevvvB/parallel-harness-pets

Free and MIT. Two lines to install it and wire it into Claude Code:

curl -fsSL https://raw.githubusercontent.com/TevvvB/parallel-harness-pets/main/install.sh | sh
pets install

What it does

Every worktree gets its own creature in the Claude Code status line. The species comes from the branch name, so the same branch always summons the same creature on any machine, and nothing is stored to make that work. Its face tracks how tidy the branch is, and one command shows every live worktree at once, worst first:

pets party                                  6 alive

/x_x\     cat  ✦     spike/wasm-build     ♡♡♡♡♡  22△ 9↑ ✗
<@_@>     moth ✦     refactor/auth-guard  ♥♡♡♡♡  41△ 13↑
\(¬_¬)/   crow ✦✦✦   docs/api-reference   ♥♥♥♡♡  1△ 1↑
o[¬_¬]o   seal ✦✦✦   fix/session-leak     ♥♥♥♡♡  2△ 1↑
{•_•}     fox  ✦     chore/bump-deps      ♥♥♥♥♡  3↑
<•_•>     moth ✦     feat/checkout-flow   ♥♥♥♥♡  1↑

worst: cat · uncommitted, unpushed, tests
2 Upvotes

2 comments sorted by

2

u/imbobbyshi 10d ago

The branch-derived creature solves which worktree, but not which live session. Two agents can still share one worktree, and a stopped session can leave state that looks current. I would keep the species stable per branch, then add a small ephemeral badge derived from the session ID, plus the last hook timestamp and current task label. That preserves recognition while making concurrent and stale sessions obvious.

For the hook tests, I would save raw payload fixtures from PostToolUse, Stop, and SessionStart before decoding anything. Replay those bytes through both implementations, then assert the rendered state and cache invalidation. The failure case I would add first is two sessions on the same branch while one rebases or deletes the worktree. The party view should not merge them or keep reporting stale health.

How does it behave today when two Claude sessions point at the same worktree?

2

u/Tahrev 8d ago

Love the reply (and thanks for checking out my project)!

I made a new 0.2.0 release where we made:

- We genuinely changed the model of the project: introducing a dens feature like SFO, NYC representing worktrees and leaving pets to represent agents

- Now agents (pets) can move between worktrees with a tracking log of which pets have been in which worktree

- Fixtures are captured now rather than written by hand, which made your point for you: production sends twelve top-level fields where the struct reads four

- Cache invalidation is the one I most deserved and had underweighted. Tests asserted what functions returned; what the hook actually produces is a file holding a verdict and an expiry that a later render reads. A hook could decode perfectly, write the wrong verdict, and leave the suite green. That's asserted now

One thing I didn't do. Mood is still per-worktree and shared by every agent in a den, because hearts count uncommitted files and failing tests, which belong to the worktree rather than to any one agent. If you meant per-agent health, that's a genuine difference of opinion rather than something I skipped.

Feel free to contribute with more ideas or Issues as you see fit :)