News for hackers. Stuff that matters.
Re:We Put Claude Code in Rollercoaster Tycoon by hk__2 on Saturday January 17, 2026 @11:59AM (#46659605)
> The only other notable setback was an accidental use of the word "revert" which Codex took literally, and ran git revert on a file where 1-2 hours of progress had been accumulating.
Re:We Put Claude Code in Rollercoaster Tycoon by Filligree on Saturday January 17, 2026 @12:19PM (#46659800)
Yet another reason to use Jujutsu. And put a `jj status` wrapper in your PS1. ;-)
Re:We Put Claude Code in Rollercoaster Tycoon by glemion43 on Saturday January 17, 2026 @02:49PM (#46661392)
It's not going to happen...

Stop spamming

Re:We Put Claude Code in Rollercoaster Tycoon by dwattttt on Saturday January 17, 2026 @03:51PM (#46661961)
The feature of "there is no such thing as an uncommitted working directory" is very relevant to the situation.
Re:We Put Claude Code in Rollercoaster Tycoon by glemion43 on Saturday January 17, 2026 @05:23PM (#46662704)
It's not. There are so many ways to just solve this non issue that no one will just switch to just another random tool.

Especially not away from git.

Re:We Put Claude Code in Rollercoaster Tycoon by dwattttt on Saturday January 17, 2026 @06:19PM (#46663135)
> It's not

Given that other posts solved the problem by scripting this feature on top of git, I guess you're telling them their solution isn't relevant too.

Re:We Put Claude Code in Rollercoaster Tycoon by glemion43 on Sunday January 18, 2026 @04:25AM (#46666228)
It's about switching your whole ecosystem to a complete different thing...
Re:We Put Claude Code in Rollercoaster Tycoon by NewsaHackO on Saturday January 17, 2026 @03:00PM (#46661480)
This is funny. I tried it once and didn't see what the benefit was. Then, when I tried to reset it back to normal git, I realized that the devs had not (at the time) made any clean way to revert it back, just a one-way conversion to jj. I haven't tried it since.
Re:We Put Claude Code in Rollercoaster Tycoon by steveklabnik on Saturday January 17, 2026 @03:10PM (#46661568)
What were you trying to “revert back”? You should have been able to just stop using jj, there’s nothing to revert back to.
Re:We Put Claude Code in Rollercoaster Tycoon by JimDabell on Sunday January 18, 2026 @03:56AM (#46666075)
Jujutsu doesn’t change your Git repository in incompatible ways. It just tracks extra information in the .jj/ directory. There is zero migration needed to revert back to Git – you just start using Git again.
Re:We Put Claude Code in Rollercoaster Tycoon by diath on Saturday January 17, 2026 @12:36PM (#46660019)
> Yet another reason to use Jujutsu

And what would that reason be? You can git revert a git revert.

Re:We Put Claude Code in Rollercoaster Tycoon by jsnell on Saturday January 17, 2026 @01:08PM (#46660341)
You're correct for an actual git revert, but it seems pretty clear that the original authors have mangled the story and it was actually either a "git checkout" or "git reset". The "file where 1-2 hours of progress had been accumulating" phrasing only makes sense if those were uncommitted changes.

And the reason jj helps in that case is that for jj there is no such thing as an uncommitted change.

Re:We Put Claude Code in Rollercoaster Tycoon by block_dagger on Saturday January 17, 2026 @02:04PM (#46660931)
Having no such thing as an uncommitted change seems like it would be a nightmare, but perhaps I'm just too git-oriented.
Re:We Put Claude Code in Rollercoaster Tycoon by steveklabnik on Saturday January 17, 2026 @03:11PM (#46661577)
Things like the index become a workflow pattern, rather than a feature, if that makes any sense.
Re:We Put Claude Code in Rollercoaster Tycoon by eru on Saturday January 17, 2026 @10:04PM (#46664465)
> Having no such thing as an uncommitted change seems like it would be a nightmare, but perhaps I'm just too git-oriented.

Why? What's the problem you see? The only problem I see is when you let these extra commits pollute the history reachable from any branch you care about.

Let's look at the following:

Internally, 'git stash' consists of two operations: one that makes an 'anonymous' commit of your files, and another that resets those files to whatever they were in HEAD. (That commit is anonymous in the sense that no branch points at it.)

The git libraries expose the two operations separately. And you can build something yourself that works similarly.

You can use these capabilities to build an undo/redo log in git, but without polluting any of the history you care about.

To be honest, I have no clue how Jujutsu does it. They might be using a totally different design.

Re:We Put Claude Code in Rollercoaster Tycoon by fragmede on Sunday January 18, 2026 @12:15AM (#46664979)
> perhaps I'm just too git-oriented.

The problem is git's index let's you write a bunch of unconnected code, then commit it separately. To different branches, even! This works great for stacking diffs but is terribly confusing if you don't know what you're doing.

Re:We Put Claude Code in Rollercoaster Tycoon by eru on Sunday January 18, 2026 @02:02AM (#46665458)
Well, git doesn't really commit 'to' a branch.

You just build commits, and then later on you muck around with the mutable pointers that are branches.

Re:We Put Claude Code in Rollercoaster Tycoon by fragmede on Wednesday January 21, 2026 @12:27PM (#46708676)
How "to" do you want to make it? That description's totally disingenuous.

"later on" makes it sound to a human like it takes any real amount of time or that it isn't basically instant and wrapped by up porcelean, and "muck around with" implies that there's anything more random or complicated to it then writing the sha to a file in the right place in the .git directory.

Re:We Put Claude Code in Rollercoaster Tycoon by MarkMarine on Saturday January 17, 2026 @02:35PM (#46661275)
Also JJ undo is there and easy to tell the model to use, I have it in my Claude.md
Re:We Put Claude Code in Rollercoaster Tycoon by hu3 on Saturday January 17, 2026 @04:58PM (#46662520)
surely Claude is much better at using git because of the massive training data difference.

If it didn't undo git, it would do it with JJ either.

Re:We Put Claude Code in Rollercoaster Tycoon by Filligree on Saturday January 17, 2026 @11:09PM (#46664710)
It does fine with jj. Sometimes better, because jj is much easier to use non-interactively.
Re:We Put Claude Code in Rollercoaster Tycoon by hu3 on Monday January 19, 2026 @10:30AM (#46680071)
what do you mean non-interactively? Claude is great with git in command-line.
Re:We Put Claude Code in Rollercoaster Tycoon by MarkMarine on Monday January 19, 2026 @11:27PM (#46687911)
Actually I find it better with JJ. I have context7 mcp to help with commands and I’ve got an explicit Claude.md to direct it, but it’s more ambitious running stacked PRs and better at resolving conflicts.
Re:We Put Claude Code in Rollercoaster Tycoon by mbb70 on Saturday January 17, 2026 @01:02PM (#46660280)
Probably it actually ran git checkout or reset. As you say git revert only operates on committed snapshots so it will all be in the reflog
Re:We Put Claude Code in Rollercoaster Tycoon by ewoodrich on Saturday January 17, 2026 @02:26PM (#46661188)
Yes, this exact scenario has happened to me a couple times with both Claude and Codex, and it's usually git checkout, more rarely git reset. They immediately realize they fucked up and spend a few minutes trying to undo by throwing random git commands at it until eventually giving up.
Re:We Put Claude Code in Rollercoaster Tycoon by foobar10000 on Saturday January 17, 2026 @03:28PM (#46661713)
Yeap - this is why when running it in a dev container, I just use ZFS and set up a 1 minute auto-snapshot - which is set up as root - so it generally cannot blow it away. And cc/codex/gemini know how to deal with zfs snapshots to revert from them.

Of course if you give an agentic loop root access in yolo mode - then I am not sure how to help...

Re:We Put Claude Code in Rollercoaster Tycoon by westurner on Saturday January 17, 2026 @12:49PM (#46660151)
Start with env args like AGENT_ID for indicating which Merkle hash of which model(s) generated which code with which agent(s) and add those attributes to signed (-S) commit messages. For traceability; to find other faulty code generated by the same model and determine whether an agent or a human introduced the fault.

Then, `git notes` is better for signature metadata because it doesn't change the commit hash to add signatures for the commit.

And then, you'd need to run a local Rekor log to use Sigstore attestations on every commit.

Sigstore.dev is SLSA.dev compliant.

Sigstore grants short-lived release attestation signing keys for CI builds on a build farm to sign artifacts with.

So, when jujutsu autocommits agent-generated code, what causes there to be an {{AGENT_ID}} in the commit message or git notes? And what stops a user from forging such attestations?

Re:We Put Claude Code in Rollercoaster Tycoon by westurner on Saturday January 17, 2026 @01:15PM (#46660411)
- "Diffwatch – Watch AI agents touch the FS and see diffs live" (2025) https://news.ycombinator.com/item?id=45786382 :

> you can manually stage against @-: [with jujutsu]

Re:We Put Claude Code in Rollercoaster Tycoon by _flux on Saturday January 17, 2026 @12:26PM (#46659880)
Amazing that these tools don't maintain a replayable log of everything they've done.

Although git revert is not a destructive operation, so it's surprising that it caused any loss of data. Maybe they meant git reset --hard or something like that. Wild if Codec would run that.

Re:We Put Claude Code in Rollercoaster Tycoon by arcanemachiner on Saturday January 17, 2026 @02:44PM (#46661349)
I was looking at the insanity known as Gas Town [0] the other day, and it does use Git to store historical work state in something it calls "beads":

https://github.com/steveyegge/gastown?tab=readme-ov-file

Re:We Put Claude Code in Rollercoaster Tycoon by calebkaiser on Saturday January 17, 2026 @03:05PM (#46661528)
If anyone is curious, Beads is an agent memory project from the same developer: https://github.com/steveyegge/beads
Re:We Put Claude Code in Rollercoaster Tycoon by PKop on Saturday January 17, 2026 @04:22PM (#46662232)
Bees?
Re:We Put Claude Code in Rollercoaster Tycoon by brap on Saturday January 17, 2026 @04:45PM (#46662434)
BEADS
Re:We Put Claude Code in Rollercoaster Tycoon by rabf on Saturday January 17, 2026 @02:02PM (#46660898)
I have had codex recover things for me from its history after claude had done a git reset hard, codex is one of the more reliable models/harneses when it comes to performing undo and redo operations in my experience.
Re:We Put Claude Code in Rollercoaster Tycoon by theptip on Saturday January 17, 2026 @03:11PM (#46661574)
Claude Code has had this feature for a few months now.
Re:We Put Claude Code in Rollercoaster Tycoon by CPLX on Saturday January 17, 2026 @03:28PM (#46661709)
I found this tool to be the solution I was looking for to address this specific problem:

https://contextify.sh

Re:We Put Claude Code in Rollercoaster Tycoon by MattGaiser on Saturday January 17, 2026 @12:29PM (#46659908)
Claude Code has /rewind. Not sure if it is foolproof, but this has been tried.
Re:We Put Claude Code in Rollercoaster Tycoon by JimDabell on Sunday January 18, 2026 @03:51AM (#46666045)
It doesn‘t handle anything Claude uses the shell for, so if it runs `rm -rf .` then rewind won’t help you.
Re:We Put Claude Code in Rollercoaster Tycoon by xandrius on Sunday January 18, 2026 @08:17AM (#46667589)
You can give it approved commands, so you can prevent that.
Re:We Put Claude Code in Rollercoaster Tycoon by saagarjha on Sunday January 18, 2026 @04:29AM (#46666249)
Huh, I didn't realize this existed. I feel like it's a miss that Claude doesn't use it when you tell it to undo its work.
Re:We Put Claude Code in Rollercoaster Tycoon by stinkbeetle on Saturday January 17, 2026 @07:58PM (#46663773)
`git reset --hard` doesn't remove unreferenced commits or rewrite the reflog so I don't think that would do it. Something like `git reset && git gc` would have to be done.
Re:We Put Claude Code in Rollercoaster Tycoon by eru on Saturday January 17, 2026 @09:57PM (#46664436)
And git gc doesn't collect any garbage less than two weeks old by default, either.
Re:We Put Claude Code in Rollercoaster Tycoon by _flux on Sunday January 18, 2026 @02:20AM (#46665539)
But it does remove current uncommitted changes.
Re:We Put Claude Code in Rollercoaster Tycoon by olvy0 on Monday January 19, 2026 @11:49AM (#46681186)
Except for new files, you'd have to also run git clean -f
Re:We Put Claude Code in Rollercoaster Tycoon by esafak on Saturday January 17, 2026 @01:18PM (#46660437)
Does Codex not let you set command permissions?
Re:We Put Claude Code in Rollercoaster Tycoon by legojoey17 on Saturday January 17, 2026 @07:41PM (#46663683)
Yea, it does so this would likely have been to be a `--yolo` (I don't care, let me `rm -rf /`). I've found even with the "workspace write" mode and no additional writable directories I can't do git operations without approval so it seems to exclude `.git` by default.
Re:We Put Claude Code in Rollercoaster Tycoon by alt227 on Saturday January 17, 2026 @01:35PM (#46660601)
I wonder how they accidentaly used a word like that.
Re:We Put Claude Code in Rollercoaster Tycoon by gbear605 on Saturday January 17, 2026 @01:47PM (#46660714)
“Please revert that last change you did”, referring to like a smaller change that had just been done
Re:We Put Claude Code in Rollercoaster Tycoon by GardenLetter27 on Saturday January 17, 2026 @03:29PM (#46661736)
Codex reverted kindly.
Re:We Put Claude Code in Rollercoaster Tycoon by qaboutthat on Sunday January 18, 2026 @01:07AM (#46665232)
If I tell Claude to "revert that last change, it isn't right, try this instead" and Claude hasn't committed recently it will happily `git checkout ...` and blow away all recent changes instead of reverting the "last change".

(Which, it's not wrong or anything -- I did say "revert that change" -- it's just annoying. And telling `CLAUDE.md` to commit more often doesn't work consistently, because Claude is a dummy sometimes).

Re:We Put Claude Code in Rollercoaster Tycoon by mh- on Sunday January 18, 2026 @03:03AM (#46665770)
I haven't tried it, but theoretically one could use Claude Code's hooks facility to enforce committing at some determined thresholds.
Re:We Put Claude Code in Rollercoaster Tycoon by MrGreenTea on Sunday January 18, 2026 @06:56AM (#46667077)
I use it (with jj but should be the same with git). It tells Claude to commit after every Write tool use. It's a bit to small steps but I then usually just squash them afterwards. I haven't yet found a good automatic heuristic for when to tell Claude to commit (or directly auto-commit, but I like that Claude writes the commit message)