docs: add agent loop example — durable sessions on Cloudflare Artifacts via exgit#46
Open
ivarvong wants to merge 1 commit into
Open
docs: add agent loop example — durable sessions on Cloudflare Artifacts via exgit#46ivarvong wants to merge 1 commit into
ivarvong wants to merge 1 commit into
Conversation
ivarvong
force-pushed
the
examples/artifacts-agent-session
branch
from
July 2, 2026 20:03
54d7aba to
fa0b265
Compare
…ts via exgit Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FpxHS5iGm9ktgpnL9QZu9x
ivarvong
force-pushed
the
examples/artifacts-agent-session
branch
from
July 2, 2026 21:17
f89905b to
b4a4a1a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
examples/agent_artifacts_session.exs: durable, forkable agent memory — pure Elixir top to bottom. The sandbox is JustBash, the git client is exgit (clone, commit, push implemented in Elixir), and each session is one Cloudflare Artifacts repo. No git binary, no subprocess, no host filesystem, no credential in argv.The session repo is cloned in memory and mounted into the sandbox at
/work, so the agent's bash writes land directly in a git workspace. A checkpoint isWorkspace.commit+Exgit.push— one commit per turn, labeled with the commands that ran. Kill the process, switch machines, come back later:Memory is a plain git repo — commits pushed by exgit are cloned and audited with stock git, one commit per command:
State flows both ways (push files with a write-scoped token; the agent sees them on resume), and sessions fork like repos do:
Robustness: sandbox output is scrubbed to valid UTF-8 (arbitrary bytes and truncation cannot corrupt the transcript), the durable transcript is complete while the model sees a recent window cut at prompt boundaries, and a rejected push (concurrent run of one session) fails with a clear error instead of merging.
Depends on two fixes now in flight: ivarvong/exgit#9 (
Workspace.writeover an unborn ref, for the first checkpoint of a fresh repo) and #48 (mkdir/rmreport backend errors instead of crashing — git trees cannot hold empty directories, and agents lovemkdir -p). The example installs both libraries from GitHubmain, so it runs once those merge.🤖 Generated with Claude Code
https://claude.ai/code/session_01FpxHS5iGm9ktgpnL9QZu9x