Skip to Content
loop.fun
Versioning agent work

Versioning a goal loop

How the new tools support goal-driven, self-improving systems, and a reference setup you can assemble today from open-source parts.

The earlier pages describe tools by layer. This one starts from the loop. A goal-driven system has a few moments where versioning matters, and each maps to a capability the new tools add on top of git.

Set goalFork attemptsWork and recordJudgeMerge winnerLearnversioned

What a goal loop needs, step by step

Loop stepWhat can go wrong with plain gitWhat the new tools addTools
Set goalThe goal lives in a prompt or chat and is lostGoal and constraints stored with the work and linked from every commitEntire Trails, Agent Trace metadata, a GOAL.md in the branch
Fork attemptsOne checkout, so attempts run one after another or collideCheap parallel workspaces, each with its own branch (and database branch)Worktrees, GitButler, AgentFS, VM forks, Neon or Dolt branches
Work and recordOnly final commits survive; the agent's own git mistakes destroy workEvery intermediate state kept; any operation undoable; session linked to each commitjj op log, GitButler oplog, Entire CLI, git-ai, re_gent
JudgeThe judge sees a diff with no contextThe judge (and later the human) reads the session, the evals and the diff togetherEntire Trails, entire checkpoint explain, session trailers
Merge winnerBig agent diffs are unreviewable; parallel merges conflictStacked PRs, structural merges, per-branch write throughputGitHub stacked PRs, Graphite, Mergiraf, GitHub's new storage
LearnSkill and memory edits overwrite the old version with no reviewSkills and memory as files in git, changed on a branch, gated by evalsAgent Skills, Letta, Hermes self-evolution, Copilot Dreaming

How the new services change the loop

Sessions become the review surface. With the session stored next to the commit, a judge can check not just whether tests pass but how the agent got there: did it delete the failing test, or fix the bug? That's one of the most common verification failures, and provenance makes it visible after the fact. Entire's Trails take this furthest, running evals on every push and presenting the run, not the diff, as the thing to approve.

Undo becomes cheap enough to let the loop take risks. An operation log means a loop can try a big rebase or a sweeping refactor knowing that the whole repository can be rolled back to any earlier point. That makes Ralph-style "try, check, revert" loops much safer to leave running overnight.

Exploration becomes a fork-and-judge pattern. Instead of one agent retrying in place, a goal loop forks N attempts, each on its own branch and workspace, and a judge merges the best one. The maker/checker pattern with N makers. Headless git services and VM forks make N large; worktrees and GitButler make it work on a laptop.

Self-improvement becomes reviewable. When skills and memory are files in git, the "learn" step of the loop produces a PR like any other. You can measure whether a skill change helped, revert it when it didn't, and see which run taught the agent what. GitHub's Dreaming and Hermes's self-evolution pipeline already work this way.

History becomes something agents query, not just humans. Entire's MCP server, git-ai's blame, Copilot Memory and Letta's context repositories all let the next run read what previous runs did and why, which is a form of long-term memory grounded in the repository rather than in a vector store.

A reference setup from open-source parts

A setup you can assemble today with no vendor lock-in, for one goal loop on your own machine or host:

Git stays the system of record. Any forge: GitHub, GitLab, or a self-hosted Forgejo.

Record every session next to its commits. Install the Entire CLI (sessions as git refs, pushed with your code) or git-ai (line-level authorship as git notes). At minimum, have the harness add a session ID trailer to each commit.

Give the agent an undo button. Colocate jj with git, or use GitButler, so every agent operation is in an op log you can roll back.

One workspace per attempt. Worktrees (built into Claude Code) for files; a Dolt or Neon branch per attempt if the goal touches a database.

Skills and memory in their own repo. Agent Skills format, auto-committed per agent write, changed on a branch, merged only when a replay of past tasks doesn't regress. Lock the judge's instructions.

Small, stacked merges. Ask the loop to land work as a stack of small PRs, not one giant diff. Add Mergiraf as a merge driver if many branches land at once.

If you'd rather buy than build, the hosted equivalents are the Entire forge (sessions, Trails and memory in one place), GitHub with stacked PRs, Agent HQ and Copilot Memory, or GitLab Duo if you need it self-managed.

Sessions are sensitive

A stored session contains everything the agent saw: file contents, tool output, sometimes secrets pasted into a prompt or printed by a command. Pushing sessions to a shared remote widens who can read them. Check redaction settings (Entire has some), keep sessions in a separate private repository when in doubt, and read Security before you turn this on for a team.

Open questions

  • Will a standard for attribution emerge? Agent Trace, git-ai's notes spec and a dozen trailers coexist. None has won.
  • How much session is enough? Full transcripts are huge and sensitive. Summaries lose exactly the detail you need when something goes wrong. Nobody has a good answer to retention yet.
  • Can review keep up? Trails and eval-gated merges assume the evals are good. If they aren't, versioning only makes it easier to see, after the fact, how the loop fooled itself. See Judges.
  • Is git the end state? The labs kept the protocol and replaced everything behind it. Pablo Santos Luaces calls it the most open moment in version control for twenty years (psantosl).

Running a loop with any of these tools? Share a field report: what you kept, what you could reconstruct afterwards, and what you wished you'd saved.

loop.fun

Patterns, hints and tools for designing the loops that keep agents working, and for widening the set of loops you can think of.

© 2026 loop.fun · CC BY 4.0

On this page