r/ClaudeCode • • 8h ago

Tips & Workflows Using hooks and skills I have three concurrent instances all working in the same branch, coordinating testing and deploys

I have one side hustle client. He's all in on AI just doesn't know or want to know how to use "computers" beyond some basic functionality.

He's a real estate agent who uses lots of different pieces of software. So I am building an orchestrator that facilitates some pretty cool automated workflows between the different tools, and alerts a human immediately if it encounters a problem, or it's time for one of the pre-defined human steps.

I also build and maintain his website, and I am building a membership program for him.

Those 3 projects all have deadlines and needs and so I will have a Claude Code instance open for all of them at the same time. What one does can and will impact the others.

So I created a hook that fires on any first message to an instance that gathers all the required context for the project at large and its specific part of it. Because my client often sends me his random thoughts for the project in text or email, the hook also checks my text and email. It files the relevant information in the various instances boards, and then it is ready to begin. The next instance fires the hook, sees the texts and emails that have been filed for its review, etc.

Then, when any instance is done, I have a skill to wrap up the session. It updates all relevant materials, commits any outstanding information, updates build plans or sources of truth, etc. Then it dispatches an agent to ensure that the next session can start cold from the exact same spot.

I also record all my convos with my client and feed Claude the transcripts and it files it accordingly as well. Even during a session, a new transcript will be filed to the appropriate boards, even if not relevant to the specific instance receiving the transcript.

And, of course, if one of them needs to do something that could impact another instance, like a commit, build, test or deploy, it communicates with the other instances and gets the go ahead. They all work in unison, obey when a test or deploy lock is taken, and make it work.

As always, I have no idea whether I'm doing something the most efficient or practical way, or if I'm reinventing the wheel, but it works for me and I'm proud of it.

5 Upvotes

12 comments sorted by

•

u/AutoModerator 8h ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/hieuphung97 7h ago

The tricky part is concurrent session-wraps. If two instances try committing state updates at the same moment, git index locks fail fast. Serializing commits through an orchestration lock file saved us hours of corrupted handover diffs.

2

u/ThePenguinVA 6h ago

I run the wrap skill, one instance after another, rather than all at the same time.

1

u/hieuphung97 2h ago

Serializing the wrap calls manually makes total sense. As soon as you automate that queue step, it saves having to watch who finishes first.

1

u/calunicornia 7h ago

have you used work trees?

1

u/ThePenguinVA 7h ago

Work trees are employed as part of this, yes.

1

u/Agile_Stomach9020 5h ago

how are you handling the lock mechanism between the instances? file locks in a shared temp directory work well for this, unless youre already routing it through a local database.

2

u/ThePenguinVA 4h ago

File-based. A small Python script wraps any heavy command (full test suites, builds). It takes the lock with an atomic mkdir of a lock directory in my home folder, not temp, so a cleanup can't wipe it while a run holds it. The holder's PID and what it's running go in a JSON file inside it. If the holder process dies, the lock clears itself. Waiting runs queue as one file each, ordered by priority and wait time, and a run also waits until the machine's load is low enough. A hook blocks those heavy commands if an agent tries to run them without the lock. No database needed.

1

u/shetritr 5h ago

the hook reading his texts and emails is the part i'd watch. a random thought from the client filed straight onto a board is an instruction nobody approved. file them as "suggested" and let an instance act only after you tick it

1

u/ThePenguinVA 4h ago

Yes, correct. It simply files and advises me of their content.

1

u/shetritr 3h ago

then you're already there. only thing i'd add is keeping which text each task came from, so when he says "i never asked for that" you can show him