Live data from Hacker News

If AI writes code, should the session be part of the commit?

github.com

41–50 of 410 posts

Re: If AI writes code, should the session be part of the commit?

#41
post #19

If the model in use is managed by a 3rd party, can be updated at will, and also gives different output each time it is interacted with, what is the main benefit? If I chat with an agent and give an initial prompt, and it gets "aspect A" (some arbitrary aspect of the expected code) wrong, I'll iterate to get "aspect A" corrected. Other aspects of the output may have exactly matched my (potentially unstated) expectatio…

Because intent matters and 6 months or 3 years down the line and it's time to refactor, and the original human author is long gone, there's a difference if the prompt was "I need a login screen" vs "I need a login screen, it should support magic link login and nothing else".

Isn’t that point of design docs and not the commit log?

Re: If AI writes code, should the session be part of the commit?

#44
post #2

I’ve been thinking about a simple problem: We’re increasingly merging AI-assisted code into production, but we rarely preserve the thing that actually produced it — the session. Six months later, when debugging or reviewing history, the only artifact left is the diff. So I built git-memento. It attaches AI session transcripts to commits using Git notes.

I already invented this in my head, thanks for not making me code it. Excellent idea, I just wish GitHub would show notes. You also risk losing those notes if you rebase the commit they are attached to, so make sure you only attach the notes to a commit on main.

I added an action that will add a comment with the notes in GitHub so that you can see them directly.

I did work around squash to collect all sessions and concatenate them as a single one

Re: If AI writes code, should the session be part of the commit?

#45
post #19

If the model in use is managed by a 3rd party, can be updated at will, and also gives different output each time it is interacted with, what is the main benefit? If I chat with an agent and give an initial prompt, and it gets "aspect A" (some arbitrary aspect of the expected code) wrong, I'll iterate to get "aspect A" corrected. Other aspects of the output may have exactly matched my (potentially unstated) expectatio…

reproducibility isn't really the goal imo. more like a decision audit trail -- same reason code comments have value even though you can't regenerate the code from them. six months later when you're debugging you want to know 'why did we choose this approach' not 'replay the exact conversation.'

Re: If AI writes code, should the session be part of the commit?

#47

Should my google search history be part of the commit? To that question my answer is no.

I was looking for an analogy and this is a good one.

The noise to signal ratio seems so bad. You’d have to sift through every little “thought”. If I could record my thought stream would I add it to the commit? Hell no.

Now, a summary of the reasoning, assumptions made and what alternatives were considered? Sure, that makes for a great message.

Re: If AI writes code, should the session be part of the commit?

#48
I don't think it should be. I think a distilled summary of what the agent did should be committed. This requires some dev discipline. But for example:

Make a button that does X when clicked.

Agent makes the button.

I tell it to make the button red.

Agent makes it red.

I test it, it is missing an edge case. I tell it to fix it.

It fixes it.

I don't like where the button is. I tell it to put it in the sidebar.

It does that.

I can go on and on. But we don't need to know all those intermediaries. We just need to know Red button that does X by Y mechanism is in the sidebar. Tests that include edge cases here. All tests passing. 2026-03-01

And that document is persisted.

If later, the button gets deleted or moved again or something, we can instruct the agent to say why. Button deleted because not used and was noisy. 2026-03-02

This can be made trivial via skills, but I find it a good way to understand a bit more deeply than commit messages would allow me to do.

Of course, we can also just write (or instruct agents to write) better PRs but AFAICT there's no easy way to know that the button came about or was deleted by which PR unless you spelunk in git blame.

Re: If AI writes code, should the session be part of the commit?

#49
post #36

I haven't adopted this yet, but have a feeling that something like this is the right level of recording the llm contribution / session https://blog.bryanl.dev/posts/change-intent-records

I like it, but it seemed test could capture some of these "behaviors". But having it in a single document is helpful for context

Re: If AI writes code, should the session be part of the commit?

#50

Earlier quoted context omitted.

How’s it any different than a diff log?

Better question: how is it in any way similar?

If you read the history of both and assuming that there’s good comments and documentation, it shows you the reasoning that went into the decision-making
Post reply on HN