{"slug": "i-stopped-treating-long-ai-coding-runs-like-chats-nightshift-now-treats-them", "title": "I Stopped Treating Long AI Coding Runs Like Chats — Nightshift Now Treats Them Like Shifts", "summary": "A developer built Nightshift, a tool that transforms long AI coding sessions into structured 'shifts' with work contracts and run state stored on disk rather than only in conversation. It supports both predefined feature plans and open-ended time-budgeted runs, preventing agents from stopping early and enabling better review and recovery of multi-hour work.", "body_md": "A while ago I wrote about a problem I kept hitting with Claude Code: I could give it a large task, walk away, and come back later to find that it had stopped somewhere in the middle.\n\nThat problem is what originally pushed me to build **Nightshift**.\n\nAt first, the goal was mostly:\n\nHow do I keep the agent working?\n\nOnce I got the agent to reliably work for hours, my focus shifted.\n\nThe problem was no longer just keeping it alive. I started focusing on improving the **shift itself**:\n\nIf I leave a coding agent working for several hours, how do I make that run something I can actually understand, trust, review, recover, and keep as history afterward?\n\nThat changed how I think about long-running agent work.\n\nI don't really want a six-hour conversation.\n\nI want a **shift**.\n\nThe core idea in Nightshift is:\n\n**The work contract and run state live on disk, not only in the conversation.**\n\nDuring a shift, I want to be able to open the files and see:\n\nThe conversation is still useful for instructions, reasoning, and following the work as it happens. But for a multi-hour shift, I don’t want it to be the only place that remembers what was agreed, what changed, what failed, and what is still left.\n\nThat becomes especially important when context gets compacted, a session fails, or I come back the next morning and need to understand what happened without scrolling through one giant chat.\n\nNightshift currently supports two main ways of working.\n\nYou define the work up front as a concrete feature plan.\n\nFor example:\n\nEach item can have its own quality or verification requirements, and/Or you can also define checks that apply to the whole shift.\n\nThe shift keeps working until every contracted item is ticked off. Owner-defined quality checks describe what “done” should mean, but the model decides when an item is ready to tick. Nightshift tracks that state and mechanically prevents the model from clocking out while anything is still open. Whether the work is actually good enough is still for the human reviewer to decide.\n\nThis mode became one of my favorite parts of Nightshift.\n\nInstead of giving it a fixed checklist, I give it:\n\n**a goal + a strict time budget**\n\nFor example:\n\nImprove this product for the next four hours.\n\nThe agent can inspect the product, codebase, history, tests, existing issues, comparable approaches, technical debt, UX problems, or other useful opportunities.\n\nIt finds useful work, ranks it, works on the strongest opportunities, and then keeps going.\n\nIf it finishes one thing early and tries to stop while meaningful time is still left, the shift pushes it to continue exploring and improving until the time budget is actually over.\n\nThe stopping condition becomes less:\n\n\"The model feels finished.\"\n\nand more:\n\n\"The shift is over.\"\n\nThis created a use case I didn't originally build Nightshift for.\n\nSometimes my Claude, Codex, or Cursor usage is going to reset the next day, and I still have a chunk of allowance left.\n\nMaybe I don't have a feature prepared.\n\nMaybe nothing is currently planned on the timeline.\n\nMaybe I just have a few hours of usage that are going to disappear anyway.\n\nInstead of wasting that capacity, I can start an open-ended shift and say:\n\nYou have three hours. Find useful work and improve the project.\n\nNightshift keeps the model working within that time budget instead of letting it finish one small task and stop after 20 minutes.\n\nSo the ready-made and open-ended shifts also give me a way to **spend otherwise-expiring usage usefully when I don't already have anything planned**.\n\nYou don't always need to design the shift yourself.\n\nNightshift also has a catalog of reusable shifts for things like:\n\nFor example, Product Evolution is an open-ended shift that studies the product, its history, user needs, and relevant standards, ranks opportunities by evidence, value, effort, reversibility, and risk, then works on the strongest ones within the available time.\n\nThe catalog is useful when I know I want to spend a few hours of agent time productively but don't have a detailed backlog ready.\n\nLonger term, I want this catalog to grow beyond my own workflows.\n\nIf someone has a long-running workflow that consistently works well, it should be possible to turn that into a reusable shift that other people can install, customize, and contribute back.\n\nAnd I don't think those shifts necessarily need to be coding-only.\n\nRecurring workflows like SEO, research, audits, or other reviewable agent work can fit the same model too.\n\nThis became an important design decision as Nightshift grew.\n\nI don't want Nightshift to replace Claude Code, Codex, or Cursor.\n\nThose tools already have their own ecosystems, commands, skills, hooks, capabilities, and ways of working.\n\nNightshift is designed to **augment those ecosystems**, not sit in front of them as another agent platform.\n\nThere is no Nightshift cloud service or account.\n\nYou don't need another npm CLI or Homebrew-installed orchestration runtime that proxies the agent.\n\nClaude Code should still feel like Claude Code.\n\nCodex should still feel like Codex.\n\nCursor should still feel like Cursor.\n\nNightshift adds the **shift contract, state, enforcement, recovery, review, and archive layer** around them.\n\nThere are already good ideas for keeping agents working for a long time.\n\nRalph-style loops, for example, already established patterns around persistent plans, specs, repeated iterations, and state that survives outside a single chat.\n\nSo Nightshift isn't trying to claim that file-backed plans or long-running loops are new.\n\nThe part I'm interested in is the accountability around the run:\n\nKeeping an agent running for six hours is useful.\n\nBeing able to understand **what actually happened during those six hours** is much more useful.\n\nAnother part I didn't want to trust only to prompting was recovery.\n\nIf the process doing the work is also the only thing responsible for noticing that it died, that isn't very helpful.\n\nNightshift therefore has an external watchman.\n\nFor example, if a Claude Code session hits a structured API failure such as:\n\n`API Error: 500`\n\nthe watchman can keep attempting to recover the recorded conversation when the API becomes available again.\n\nFor Codex, the watchman can recover a session once it is proven dead, preferring the recorded session when its identity is resumable. If that isn't possible, the on-disk contract still provides the handoff for a fresh recovery.\n\nFailures will happen.\n\nThe goal isn't to pretend they won't.\n\nThe goal is that a temporary API or session failure doesn't silently throw away the remaining hours of work.\n\nThis is one of the parts I appreciate more the longer I use Nightshift.\n\nWhen I want to file away finished work, Nightshift can archive the completed part of the shift.\n\nNightshift moves completed items, handled snags, and the rotated journal into a dated archive. Receipts are copied into the dated archive too, while the live copies stay in place.\n\nThe active contract and any still-open work stay intact instead of being filed away as if they were finished.\n\nOver time, those dated archives become a much cleaner history of previous shifts.\n\nThe original conversation might be thousands of lines long, but the archive gives me a short, structured record of what was completed, what decisions were made, what went wrong, and what evidence was left behind.\n\nSo instead of reopening an old marathon chat and trying to reconstruct what happened, I can open the archive for that date and understand the shift much faster.\n\nEven a shift I decide not to merge can leave useful history.\n\nMaybe the implementation wasn't good enough, but the investigation found something important.\n\nMaybe an approach failed, and I don't want the next agent rediscovering the same dead end.\n\nMaybe a decision needs to be revisited later.\n\nThat history is worth keeping.\n\nThe direction I'm pushing Nightshift toward is pretty simple.\n\nI don't want the final handoff to just be:\n\n\"Done! Everything looks good.\"\n\nI want to be able to inspect the actual state, diff, commits, verification, decisions, failures, and receipts myself.\n\nLong-running autonomy becomes easier to trust when you don't have to trust the agent's summary of its own work.\n\n**Read the receipts, not the promise.**\n\nNightshift is open source under MIT and currently supports:\n\nIt runs locally and is designed to augment those tools rather than replace them.\n\nThe project is still evolving, especially around reusable shifts, stronger review workflows, and making the same model useful beyond coding.\n\nBut the basic idea has become pretty clear to me:\n\nGive the agent a real shift instead of one enormous chat.\n\nDefine the work or the time budget.\n\nKeep the state outside the conversation.\n\nKeep it working while the shift is active.\n\nRecover when things fail.\n\nKeep the evidence.\n\nArchive the result.\n\nThen review what actually happened.\n\nIf you're already leaving coding agents working unattended for hours, I'd be especially interested in the workflows you've found that consistently work well.\n\nSome of them might make good reusable Nightshift shifts.", "url": "https://wpnews.pro/news/i-stopped-treating-long-ai-coding-runs-like-chats-nightshift-now-treats-them", "canonical_source": "https://dev.to/orwamahmoud/i-stopped-treating-long-ai-coding-runs-like-chats-nightshift-now-treats-them-like-shifts-40ec", "published_at": "2026-09-02 16:28:10+00:00", "updated_at": "2026-09-02 16:54:22.764703+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "ai-tools"], "entities": ["Nightshift", "Claude Code", "Codex", "Cursor"], "alternates": {"html": "https://wpnews.pro/news/i-stopped-treating-long-ai-coding-runs-like-chats-nightshift-now-treats-them", "markdown": "https://wpnews.pro/news/i-stopped-treating-long-ai-coding-runs-like-chats-nightshift-now-treats-them.md", "text": "https://wpnews.pro/news/i-stopped-treating-long-ai-coding-runs-like-chats-nightshift-now-treats-them.txt", "jsonld": "https://wpnews.pro/news/i-stopped-treating-long-ai-coding-runs-like-chats-nightshift-now-treats-them.jsonld"}}