Skip to content

Commit 2cfc77d

Browse files
Jammy2211claude
andauthored
chore: single-source the never-rewrite-history policy as a generated block (#30)
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). Claude-Session: https://claude.ai/code/session_01KUGujq6jAgU3CExnLkkELe Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent ab01aac commit 2cfc77d

1 file changed

Lines changed: 25 additions & 10 deletions

File tree

AGENTS.md

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,28 @@ entries until the summary passes; regenerate notebooks + catalogue after. **Gene
9595
only files in `scripts/` (never `notebooks/`), preserve docstrings and explanations, test, then
9696
regenerate. Flag any change that affects `autolens_workspace` or the source libraries in your PR.
9797

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

0 commit comments

Comments
 (0)