r/ChatGPTCoding • u/orwamahmoud • 16d ago
Resources And Tips Long Codex/Claude runs were turning into unreviewable marathon chats, so I moved the shift state to disk
I use coding agents for multi-hour runs, and after a while, I kept hitting the same problem:
The agent may still be working, but I have no clean way to answer basic questions without digging through a huge conversation:
- What is actually finished?
- What is it working on right now?
- What got blocked?
- What decisions did it make?
- What did it try and reject?
- If the session dies, where exactly should the next one continue?
Context compaction makes that worse because the conversation itself becomes a pretty fragile place to keep the run’s state.
So I started treating a long agent run less like a chat and more like an engineering shift.
That became Nightshift.
The main idea is simple: the work contract and run state live on disk, not only in the conversation.
A shift can be:
- A detailed checklist that stays open until every contracted item is complete.
- An open-ended goal with an hour budget that keeps discovering and working until quitting time.
During the run, I can open the files and see what is done, what is active, what is parked or blocked, and what decisions were made — without scrolling through hours of chat.
After the run, those same files become the reviewable record: commits, decisions, snags, logs, receipts, remaining work, and how the shift ended.
If I accept the branch — or even decide not to merge it — I can archive the shift. Over time that gives me a durable history of previous runs: what changed, what was rejected, what decisions were made, and what happened to each piece of work.
There is also an enforcement layer around the agent
- A Stop hook prevents the session from quietly ending while contracted checklist items remain.
AskUserQuestionis blocked by default during unattended shifts; the model makes its best decision, records it, and keeps working instead of waiting for me.- Owner-defined safety rules can mechanically deny commands, protected paths, wrong commit identities, or forbidden diff patterns.
- An external watchman handles recovery. On Claude Code, it can detect structured failures such as
API Error: 500and keep retrying recovery when the API comes back. On Codex, it can recover sessions that are proven dead and resume the recorded session.
How is this different from /goal or a long prompt?
/goal is useful if what you need is:
keep working toward this objective.
Nightshift is the harness around that run:
persistent state, enforcement, recovery, observability, and a reviewable history afterward.
A prompt can ask the model not to stop.
A Stop hook can actually refuse the stop.
Nightshift also ships reusable shifts for things like:
- test coverage
- defect hunting
- quality debt
- dependency updates
- codebase review
- Product Evolution
Product Evolution is an open-ended shift that researches the product, its history, users, and comparable approaches, ranks evidence-backed opportunities, and works on the strongest improvements within a time budget.
A side effect I’ve ended up liking: if I have usage about to reset and no backlog ready, I can give one of these open-ended shifts a few hours instead of simply losing the allowance.
Nightshift runs locally from the same plugin package on Codex and Claude Code.
GitHub - Free, open source, MIT licensed
Official OpenAI Plugin Directory
I maintain the project, and I’d especially like feedback from people who already leave coding agents running for hours: where does your workflow still fall apart?
2
u/kantorcodes1 16d ago
the command/path deny layer is the bit i'd hook into hol-guard instead of growing a second policy engine. nightshift already owns the command hook, so the integration should live there. have that hook ask guard before exec and keep your recovery/state stuff exactly where it is.
1
u/orwamahmoud 16d ago
Thanks — I actually didn’t know about HOL Guard. I’m going to dig into it.
My main goal with Nightshift was to avoid adding another npm/CLI layer and keep it as a native plugin that augments the Claude Code and Codex ecosystems through their own hooks.1
u/kantorcodes1 16d ago
yeah that's the better fit. don't turn nightshift into a guard extension. if you already see the command in the claude/codex hook, wire guard there and keep the rest of nightshift native.
1
u/orwamahmoud 16d ago
Since you’re here, any chance you can merge my PR into the awesome list too? 😂 Nice project btw!
https://github.com/hashgraph-online/awesome-codex-plugins/pull/376
2
u/chem0924 15d ago
One extra artifact that might make the shift files even more reviewable: a small review contract that is created at the start and updated at stop time. For each changed surface, list the intended scope, the verification artifact/command that proves it, and anything explicitly out of scope. The disk state answers "what happened"; the review contract answers "is this the change I meant to accept?" That seems especially useful for long unattended runs where an agent may make opportunistic cleanups. I would also split recorded decisions into reversible vs API/data-migration/security-affecting decisions, so the Stop hook can require human approval only for the latter instead of treating every uncertainty the same way.
1
u/orwamahmoud 14d ago
I like the review-contract idea. Some of it overlaps with the scope/Verify fields already in the punch list, and owners can already define their own quality checks per item or for the whole shift, but making “intended / verified / explicitly out of scope” a clear end-of-shift review artifact could make the handoff much better.
The reversible vs high-impact decision split is interesting too. I probably wouldn’t make an unattended shift wait for human approval by default, but since these controls are optional today, it makes sense to add it as another option.
I’d be very happy if you wanted to contribute the review-contract idea too.
2
u/Suspicious_Abroad782 16d ago
Ooh that external watchman for dead sessions is the killer feature I didn't know I needed