agentleFS
forjdforjd/better-writing/CLAUDE.md

better-writing

CLAUDE.md37 starsChanged 2 months agoMITView on GitHub

These instructions apply to the entire better-writing repository. This section is for automated agent runs that share a provisioned checkout of this repo. If you are a human working in your own clone, none of it applies. The shared checkout is the repo itself. The orchestrator provisions one clone per project, not one per task, and this project is a single repo — so the clone you are standing in is the only one every concurrent run has. Running git…

The file

We split this CLAUDE.md into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Never run checkout, switch, reset, stash, merge, rebase, commit, clean, apply, or pull there, and never edit a tracked file there.

    line 24
  2. Distinctive:

    Before your first edit, get an isolated working tree.

    line 30
  3. Distinctive:

    Stop. Do not commit and do not stash — both make it worse for whoever else is in there.

    line 69

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

Agent instructions

These instructions apply to the entire better-writing repository.

Git workspace hygiene for automated agents

This section is for automated agent runs that share a provisioned checkout of this repo. If you are a human working in your own clone, none of it applies.

The shared checkout is the repo itself. The orchestrator provisions one clone per project, not one per task, and this project is a single repo — so the clone you are standing in is the only one every concurrent run has. Running git checkout or git reset there replaces another run's working tree mid-task.

This is measured, not theoretical. Concurrent runs on this repo have moved a shared checkout's HEAD repeatedly inside a single twenty-minute window, including hard resets that discarded uncommitted changes.

Rule 1 — never mutate the project checkout

In the project checkout, the only git commands allowed are read-only queries plus fetch, remote, and worktree add|remove|list|prune.

Never run checkout, switch, reset, stash, merge, rebase, commit, clean, apply, or pull there, and never edit a tracked file there. Every edit happens in your per-task worktree.

Rule 2 — work in a per-task worktree

Before your first edit, get an isolated working tree. A linked worktree shares the object store, so it costs a couple of MB and no extra fetch:

WT=$(scripts/issue-worktree.sh . FOR-123 docs/123-short-slug)
cd "$WT"

The first argument is . because this project's checkout is the repo itself; the script also accepts a subdirectory name for projects that nest several clones under one checkout. The full signature is <repo-dir> <issue-key> [branch] [base-ref]. It prints only the worktree path, is idempotent across runs on the same task, refuses to steal a branch another worktree already holds, and never resets an existing branch. Read it before you trust it — it is short.

Then edit, commit, and push entirely from $WT. If you are woken again on the same task, re-run the script; it returns the same path.

Rule 3 — tear down when the task is finished

Once your branch is pushed and the task is done or handed off:

git -C "$PAPERCLIP_WORKSPACE_CWD" worktree remove "$WT"
git -C "$PAPERCLIP_WORKSPACE_CWD" worktree prune

$PAPERCLIP_WORKSPACE_CWD is the project checkout. Use --force only when you mean to discard your own uncommitted changes. Never force-remove a worktree that is not yours — the path contains the owning agent's id.

Rule 4 — one branch per task

Git refuses to check out one branch in two worktrees. Name branches after the task (<type>/<task-number>-<slug>) so concurrent tasks cannot collide. If issue-worktree.sh reports the branch is already checked out, another run owns it: coordinate on the task rather than forcing it.

If you already edited the project checkout

Stop. Do not commit and do not stash — both make it worse for whoever else is in there. Create your worktree, re-apply your changes in it, and say what happened on the task.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.