Skip to content

Commit eda6a5e

Browse files
committed
docs: add 'delete' to CLI/ctl listings; rewrite examples/README for v0.2.0 protocol
README: missed adding 'agentenv delete' when the feature shipped — add it to the CLI command list and to ctl's op enumeration. examples/README: the socket-protocol cheat-sheet was missing delete/tag/ tournament (added in v0.2.0); also didn't mention the MCP server, now the headline driver for Claude Code. Rewritten to enumerate the three drivers (CLI / socket / MCP), list every supported op including streaming + error frame shapes, and point at examples/claude-code/ for the MCP path.
1 parent 040a07e commit eda6a5e

2 files changed

Lines changed: 47 additions & 11 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,14 @@ agentenv shell interactive shell inside the env (human/debug)
8888
agentenv exec -- <cmd...> run one command in the env (scripting/CI)
8989
9090
# out-of-band client (talks to a running daemon/supervise, no repo lock needed)
91-
agentenv ctl <op> [args] log | head | branches | exec | checkout | diff | ...
91+
agentenv ctl <op> [args] log | head | branches | exec | checkout | delete | diff | ...
9292
9393
# setup / history / inspection
9494
agentenv init --from <dir|/> | --tarball <path|URL>
9595
seed root from an existing dir, or extract a tar(.gz)
9696
agentenv commit -m "msg" manual snapshot (auto-capture usually does this)
9797
agentenv checkout <ref> roll the whole env back to any node (accepts tag/prefix)
98+
agentenv delete <ref> remove a node (children re-parent; HEAD/only-node refused)
9899
agentenv tag [name] [ref] list/get/set named refs (e.g. tag winner <id>)
99100
agentenv tournament --base <ref> --test "<cmd>" -- "cand1" "cand2" ...
100101
fork base, run each candidate, keep first that passes test

examples/README.md

Lines changed: 45 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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
3965
node=$(agentenv head)
4066
agentenv 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

Comments
 (0)