Skip to content

Commit 114f711

Browse files
Jammy2211claude
andcommitted
chore: single-source the never-rewrite-history policy as a generated block
Replace the hand-maintained history-rewrite guidance with the generated repos_sync:history block (byte-identical canonical text from PyAutoMind/policy/never_rewrite_history.md), so the safety policy is single-sourced and drift-checked. The text stays inline; only the manual copy is retired. Part of the ecosystem standardization (spec 4). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KUGujq6jAgU3CExnLkkELe
1 parent 8ceec7c commit 114f711

1 file changed

Lines changed: 25 additions & 11 deletions

File tree

AGENTS.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,28 @@ nautilus; MLE: LBFGS/BFGS/drawer), `mapper/` (model + priors),
9292
(PyAutoGalaxy, PyAutoLens) and the workspaces may need updates.
9393
5. Ensure all tests pass before opening a PR.
9494

95-
## Clean state
96-
97-
Never rewrite history on a repo with a remote (no `git init` over a tracked
98-
tree, no force-push to `main`, no rebasing pushed shared branches). To reset a
99-
dirty tree the only correct sequence is:
100-
101-
```bash
102-
git fetch origin
103-
git reset --hard origin/main
104-
git clean -fd
105-
```
95+
<!-- repos_sync:history:begin -->
96+
## Never rewrite history
97+
98+
NEVER perform these operations on any repo with a remote:
99+
100+
- `git init` in a directory already tracked by git
101+
- `rm -rf .git && git init`
102+
- Commit with subject "Initial commit", "Fresh start", "Start fresh", "Reset
103+
for AI workflow", or any equivalent message on a branch with a remote
104+
- `git push --force` to `main` (or any branch tracked as `origin/HEAD`)
105+
- `git filter-repo` / `git filter-branch` on shared branches
106+
- `git rebase -i` rewriting commits already pushed to a shared branch
107+
108+
If the working tree needs a clean state, the **only** correct sequence is:
109+
110+
git fetch origin
111+
git reset --hard origin/main
112+
git clean -fd
113+
114+
This applies equally to humans, local Claude Code, cloud Claude agents, Codex,
115+
and any other agent. The "Initial commit — fresh start for AI workflow" pattern
116+
that appeared independently on origin and local for three workspace repos is
117+
exactly what this rule prevents — it costs ~40 commits of redundant local work
118+
every time it happens.
119+
<!-- repos_sync:history:end -->

0 commit comments

Comments
 (0)