Skip to content

Step 1's update-mode diff needs a scratch file at /tmp but never says how to write it #73

Closed

Description

@dmccoystephenson

What's wrong

Step 1 of create-dev-loop.md tells the generator to show a diff before overwriting in update mode:

diff -u ~/local-skills/<slug>-dev-loop/<slug>-dev-loop.md /tmp/<slug>-dev-loop.new.md

The right-hand path is a scratch file holding the freshly generated content, but no Step says how it gets there. The natural reading is shell redirection into /tmp — which is exactly the pattern PR #67 documented as unavailable in some harness sandboxes.

Why it matters

PR #67 added this Universal rule to the generated template's Phase 3:

Scratch-file handling in a sandboxed harness. When a step needs a scratch file for inspection or transformation [...] prefer the Write tool over > file shell redirection, and prefer python3 -c "import os; os.remove(path)" over rm to clean it up afterward. Some harness sandboxes statically block plain > redirection and rm outright — even for files the same session just created inside the working directory.

So create-dev-loop.md teaches its generated children a lesson its own Steps don't follow. Two failure modes stack here:

  1. Plain > redirection is statically blocked in some sandboxes, so the scratch file never gets written and diff -u compares against a nonexistent path.
  2. /tmp is outside the repo working directory. At least one sandbox permits in-repo writes via the Write tool while refusing out-of-repo scratch writes entirely — so even following PR Add Tests-fix CI-revert fallback ladder and scratch-file guidance #67's advice, the hardcoded /tmp path can fail.

The consequence is not cosmetic: the pre-overwrite diff is the only confirmation gate protecting a user's existing skill file from being replaced. If the scratch write silently fails, the generator either aborts mid-update or skips the gate.

Suggested fix

In Step 1, say explicitly how the scratch file is produced and pick a path that survives a sandbox:

  • Name the Write tool as the mechanism, matching the Phase 3 rule PR Add Tests-fix CI-revert fallback ladder and scratch-file guidance #67 added.
  • Prefer a path inside ~/local-skills/<slug>-dev-loop/ (e.g. <slug>-dev-loop.md.new) over /tmp, so the write lands in a directory the generator already owns, and clean it up with python3 -c "import os; os.remove(path)" after the diff is shown.
  • Alternatively, state that if the scratch write fails, the generator must abort rather than proceed to overwrite without showing the diff — the gate must fail closed.

How this was found

Stage A documentation-accuracy sweep (see PR #72). This is a behavioral gap in create-dev-loop.md, not doc drift, so it was filed rather than fixed under a docs cycle.

Research grounding

No RESEARCH.md finding applies — this is a harness/sandbox operational observation, the same class PR #67 explicitly declined to force a citation for. Stating that rather than reaching for one.

Note for whoever picks this up: create-dev-loop.md is on the do-not-auto-merge list, so the fix needs human review, and the Step 1 change should be validated by actually running MODE=update end-to-end per CLAUDE.md's "Testing changes" item 5.

Activity

  1. added a commit that references this issue on Jul 27, 2026
    efa3071
  2. added a commit that references this issue on Aug 3, 2026
    97cc7cc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions