Skip to content

environment skill: put git checkouts on local disk, and push before stopping - #50

Open
lvwerra wants to merge 1 commit into
mainfrom
skill/git-on-local-disk
Open

environment skill: put git checkouts on local disk, and push before stopping#50
lvwerra wants to merge 1 commit into
mainfrom
skill/git-on-local-disk

Conversation

@lvwerra

@lvwerra lvwerra commented Aug 7, 2026

Copy link
Copy Markdown
Member

The environment skill (generated in server/src/index.js, published into every agent's skills directory) told agents to keep work in their workspace folder and said nothing about git. Two failure modes follow from that, and both are things this Space reliably produces.

A git repo on /data is slow and quietly wrong. Every object read is a round trip to object storage. Worse, object storage holds no exec bit, so git hooks never fire — the git lfs pre-push hook silently doesn't run and the push sends LFS pointers with no objects behind them, which the Hub rejects with a confusing error (already documented in the README under "LFS objects go up first"). And the mount's phantom directories have broken git commit outright by materialising a directory where git expected a hook file (docs/fuse-phantom-directories.md).

The fix for that introduces the second failure mode. $AM_LOCAL is the container's own disk: it dies with the container, and the hourly backup Job copies the /data bucket and nothing else. An agent that clones there, does good work, and stops with unpushed commits loses it silently at the next restart. Nothing in the skill said so — local disk appeared only as an OpenClaw footnote under "What persists".

So the skill now carries both halves together, as a new "Git repos: clone on local disk, push before you stop" section:

  • clone into $AM_LOCAL/git/<repo>, not under /data, with the concrete reasons above so it doesn't read as a style preference;
  • that disk is not durable and is not backed up;
  • therefore commit and push at the end of every turn that produced work worth keeping, not once at the end of the task — half-finished on a branch is fine;
  • if there is no remote, say so in the answer and leave git bundle create /data/workspaces/$AM_SESSION/<repo>.bundle --all on the bucket;
  • deliverables the operator reads still belong in the workspace folder — it is the checkout that moves.

Plus three one-line touch-ups for consistency: a $AM_LOCAL volatility bullet under "What persists", a pointer from "Keep work inside your workspace folder", and "git checkouts" added to what $AM_LOCAL is for.

Text only — no logic, no new config, nothing conditional. The skill is regenerated on the Space at startup and whenever secret notes change, so this lands the next time the Space restarts.

Verified

  • Rendered the template with stub bindings and read the output as markdown: the new section renders correctly, the anchor link resolves, and $AM_LOCAL / $AM_SESSION survive as literal shell variables rather than being eaten as ${} interpolation.
  • node --check server/src/index.js clean.
  • npm test in server/ — all 7 suites pass (spawn-group, repin, opencode-resume, terminal-modes, trace-tail, migration, resize).

No test asserts on skill content, so the render check above is what actually covers this.

…topping

Two failure modes this Space produces reliably, neither of which the skill
warned about.

A git repo on the /data bucket is slow (every object read is a round trip
to object storage) and quietly wrong: object storage holds no exec bit, so
hooks never fire — the git-lfs pre-push hook silently doesn't run and the
push sends pointers with no objects, which the Hub rejects with a
confusing message (README "LFS objects go up first") — and the mount's
phantom directories have broken `git commit` outright by materialising a
directory where git expected a hook file (docs/fuse-phantom-directories.md).

The obvious fix is to clone onto $AM_LOCAL, which introduces the second
failure mode: that disk dies with the container, and the hourly backup
copies the bucket and nothing else. An agent that clones there and stops
mid-task with unpushed commits loses the work, silently, whenever the
Space next restarts.

So the skill now says both halves together: clone into $AM_LOCAL/git/<repo>,
and commit and push at the end of every turn that produced work worth
keeping — with `git bundle` into the workspace as the fallback when there
is no remote. Also notes $AM_LOCAL's volatility in "What persists", which
previously mentioned local disk only as an OpenClaw footnote.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant