@@ -5,20 +5,45 @@ agentenv is **language-agnostic** on both sides:
55- ** Workloads** : capture/rollback happens at the * filesystem* level, so the agent
66 can build/run anything — ` go build ` , ` mvn package ` , ` pip install ` , ` cargo build ` ,
77 ` npm i ` — and it's all snapshotted regardless of language.
8- - ** Drivers** : you control agentenv from any language via either the ** CLI**
9- (` agentenv checkout <id> ` , ` agentenv log ` , ...) or the ** newline-JSON unix-socket
10- protocol** (` agentenv daemon ` ). Both are language-neutral contracts; no per-language
11- SDK is required.
8+ - ** Drivers** : three ways to drive agentenv, each language-neutral:
9+ 1 . ** CLI** — ` agentenv checkout <id> ` , ` agentenv log ` , ` agentenv delete <id> ` ,
10+ ` agentenv tournament … ` . When a ` daemon ` /` supervise ` holds the lock,
11+ mutating commands auto-route through its socket — same command works
12+ whether or not a daemon is up.
13+ 2 . ** Socket protocol** (newline-JSON, one request → one response or stream)
14+ — what ` daemon ` + ` supervise ` serve; the ` goclient ` / ` branch_explore.py ` /
15+ ` Client.java ` examples here use it directly.
16+ 3 . ** MCP** — ` agentenv mcp ` is a Model Context Protocol server over stdio.
17+ Use it from ** Claude Code** (the headline path); the
18+ [ ` claude-code/ ` ] ( ./claude-code/ ) sub-example ships a ready-to-run image.
1219
13- ## The protocol (one JSON request/response per line)
20+ ## The socket protocol (one JSON request/response per line)
1421
1522```
16- {"op":"exec","cmd":"go build ./..."} -> {"ok":true,"exit":0,"stdout":"...","node":"<id>","head":"<id>"}
17- {"op":"checkout","node":"<id>"} -> {"ok":true,"head":"<id>"}
18- {"op":"log"} {"op":"branches"} {"op":"head"} {"op":"diff","a":"x","b":"y"} {"op":"show","node":"x"}
19- {"op":"spawn","cmd":"..."} {"op":"commit","message":"..."} {"op":"ps"} {"op":"kill","pid":N} {"op":"gc"}
23+ # environment changes (multi-frame streams)
24+ {"op":"exec","cmd":"go build ./..."} -> {"stdout":"..."} {"stdout":"..."} {"ok":true,"exit":0,"node":"<id>","head":"<id>"}
25+ {"op":"spawn","cmd":"server &"} -> {"ok":true,"pid":N}
26+
27+ # history
28+ {"op":"head"} -> {"ok":true,"head":"<id>"}
29+ {"op":"log"} {"op":"branches"} -> {"ok":true,"nodes":[…]}
30+ {"op":"show","node":"<id>"} -> {"ok":true,"changes":[…]}
31+ {"op":"diff","a":"<id>","b":"<id>"} -> {"ok":true,"changes":[…]}
32+
33+ # mutation
34+ {"op":"commit","message":"…"} -> {"ok":true,"node":"<id>","head":"<id>"}
35+ {"op":"checkout","node":"<id>"} -> {"ok":true,"head":"<id>"}
36+ {"op":"delete","node":"<id>"} -> {"ok":true,"head":"<id>"} # v0.2.0
37+ {"op":"tag","name":"winner","ref":"<id>"} -> {"ok":true}
38+ {"op":"tournament","base":"<ref>","test":"<cmd>","candidates":[…]} -> {"ok":true,"branches":[…],"winner":"…"}
39+
40+ # processes / disk
41+ {"op":"ps"} {"op":"kill","pid":N} {"op":"gc"}
2042```
2143
44+ Error frames have ` {"error":"…"} ` instead of ` {"ok":true,…} ` . Streaming ops
45+ (currently ` exec ` ) end with a terminal frame carrying ` ok ` or ` error ` .
46+
2247## Clients (all stdlib, no dependencies)
2348
2449| File | Language | Run |
@@ -33,9 +58,19 @@ that passes the test — purely over the socket.
3358
3459## Simplest driver: the CLI
3560
36- Any orchestrator can just shell out:
61+ Any orchestrator can just shell out. When a daemon/supervise is running, the
62+ CLI transparently routes through its socket (no ` --socket ` needed):
3763
3864``` sh
3965node=$( agentenv head)
4066agentenv exec -- bash -lc ' make test' || agentenv checkout " $node " # undo on failure
67+ agentenv delete " $node " # prune a dead end
4168```
69+
70+ ## Claude Code via MCP
71+
72+ The fastest way to see agentenv shine. See [ ` claude-code/ ` ] ( ./claude-code/ ) :
73+ one ` docker run -it ghcr.io/css521/rewindable-claude ` lands you in a sandbox
74+ where Claude Code can edit, install, and ** roll back its OWN environment** via
75+ the ` agentenv__checkout ` / ` agentenv__delete ` MCP tools — without exiting the
76+ session.
0 commit comments