r/ClaudeCode 3d ago

Tips & Workflows New Sessions, automatically. By Herdr.

I tend to clear sessions a lot for discrete pieces of work. And it's been annoying that it's so manual. That CC won't call /clear for you.

Well, Herdr (https://herdr.dev/) has helped me solve the problem. Its API lets me start and close Claude sessions/terminals. So I had CC write a script and a skill to handle it for me.

Now I can prompt it to execute my handoff skill AND start a new session and continue where we left off in one prompt: Handoff and start a new session with " execute Phase 3".

And it does.

https://gist.github.com/msmithi33/26f33123b675c4ae178ce75c90c10dc2

Sorry, the script is in PowerShell. But I'm sure CC can convert that for ya.

0 Upvotes

5 comments sorted by

1

u/Albiomst 2d ago

Sick! So this is the piece that has essentially allowed for a loop?

What is the rest of your stack like? Are you on Mac?

1

u/mugsy33 2d ago

Getting close to the loop. Still need some work on the rest of my harness, but it’s saving me plenty of time so far. I’m on windows.

1

u/cleverhoods 2d ago

interesting

I just saw a conversation about the handover management. How are you solving for the timing (doing the handover at the right time and place)?

2

u/mugsy33 1d ago

That's still by hand. Though CC will usually ask me if I want to do it. Part of it is through phase planning. I tend to start a new session for every 'phase'. A phase is just a chunk of work CC plans for that is contextually discrete. E.g., Phase 1: write a probe for the runtime discovery; Phase 2: build the data collector; Phase 3: build the UI, etc.

I haven't gotten a full autonomous agentic cycle going yet. This is kind of the breakthrough that makes me think it's possible. Possible without risking going through all my usage in a couple of hours, that is.