Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

docs: 工作树一律建在 peach-worktrees,Claude 不用内置那套

longmeidao88018fa48b7c
diff --git a/.claude/skills/peach-worktree/SKILL.md b/.claude/skills/peach-worktree/SKILL.md
index 4abb037e5..7a84a9be8 100644
--- a/.claude/skills/peach-worktree/SKILL.md
+++ b/.claude/skills/peach-worktree/SKILL.md
@@ -5,7 +5,7 @@ description: 在用户说并行、开工作树、worktree、暂存、提交、re
# 并行 worktree 与提交边界
-最后复核:2026-08-25
+最后复核:2026-08-26
证据来源:`docs/HANDOFF.md`「并行智能体与 Git 工作树」、`README.md`、ADR-0015、ADR-0017。
## 何时使用
@@ -21,6 +21,9 @@ description: 在用户说并行、开工作树、worktree、暂存、提交、re
& .\.venv\Scripts\python.exe scripts\agent_worktree.py create --agent claude --task <task>
```
+ 它建在 `peach-worktrees/`,Codex 和 Claude 共用这一个目录。**不要用 Claude Code 内置的
+ 工作树机制(`.claude/worktrees/`)**:它在分支被集成后会被回收,目录却留在原地。
+
2. 工作者只在自己的工作树内编辑。工作树不复制 `.venv`。
3. 测试在当前工作树根目录运行,每个平台只有一个入口:
@@ -53,6 +56,12 @@ description: 在用户说并行、开工作树、worktree、暂存、提交、re
## 已知陷阱
+- **工作树会惄无声息地失效,目录却还在**。2026-08-26 实例:分支被集成后,
+ `.claude/worktrees/<task>` 的注册消失,目录变成主检出里一份旧副本。提示符和文件列表看不出
+ 任何差别,但在里面跑的每一条 git 都作用于主检出的 master。后果不是报错而是假结论:
+ 那一轮里我一直告诉用户「我还没推」,实际上提交已经被另一个代理的 push 顺带到了 origin。
+ 判据不看目录名,只看 `git rev-parse --show-toplevel`;等于 `peach-app` 就是在主检出里。
+ 实测入口:`git worktree list` 里没有你那一行,就是已经没了。
- 健康检查端点是 `/healthz`,不是 `/health`。
- PowerShell 变量必须用任务专属名称,禁止声明 `$HOME`、`$home`、`$CODEX_HOME` 的任何大小写
变体;`foreach {}` 结果先存入任务专属数组再单独接管道,禁止在闭合花括号后直接写管道。
diff --git a/AGENTS.md b/AGENTS.md
index 7c13407c5..1285444a6 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -67,7 +67,7 @@
- Before adding or restoring an implementation, check `docs/REUSE.md`, the current tree and Git history. A missing legacy filename does not prove the capability is missing. Update the reuse register when the decision changes.
- When the user says to imitate, reference or align with another product, obtain current reproducible evidence first and register it per `peach-reference-evidence`. If evidence is unavailable, write `未取得`; do not ship a guessed approximation as a faithful reproduction.
- Never require the user to relay implementation details between agents. Put current facts in `docs/STATUS.md`, durable rules in `docs/HANDOFF.md`/`docs/REUSE.md`, procedures in a skill, and architecture decisions in an ADR.
-- During concurrent code work, the main `peach-app` checkout is integration-only. Each agent works in an isolated Git worktree; a worker commits its branch and reports it ready, but never merges itself. Details in `peach-worktree`.
+- During concurrent code work, the main `peach-app` checkout is integration-only. Each agent works in an isolated Git worktree created by `scripts/agent_worktree.py create` under `peach-worktrees/`, never anywhere else and never in the main checkout; a worker commits its branch and reports it ready, but never merges itself. Before every commit confirm you are still in that worktree — `git rev-parse --show-toplevel` must not be the main checkout. Details in `peach-worktree`.
- Never use `git add .`, `git add -A`, a directory path, or a glob in an agent checkout. Stage only the exact files owned by the task, then inspect `git diff --cached --name-status`. Implementation and its tests must be committed atomically.
- Run the verification commands in `README.md` before committing relevant changes: `scripts/test.ps1` on Windows, `scripts/test.sh` on macOS. Both entry points must stay green; a change that only passes on one platform is not done.
- Reuse existing usage surfaces and protocols. T3 Code/CodexBar cover historical token and API-equivalent cost views; official provider quota endpoints cover live remaining windows. Do not build another session-log cost scanner or depend on T3 Code's private localhost API.
diff --git a/CLAUDE.md b/CLAUDE.md
index 43c994c2d..9fc0443dc 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -1 +1,20 @@
@AGENTS.md
+
+## Claude 专有:不要用内置的工作树机制
+
+Claude Code 自带的工作树会建在 `.claude/worktrees/`,**本项目不用它**。工作树一律用
+`scripts/agent_worktree.py create` 建在 `peach-worktrees/`,和 Codex 共用同一个目录。
+
+理由是 2026-08-26 真实踩过的坑:内置工作树在分支被集成后会被回收,**目录却留在原地**,
+变成主检出里一份长得一模一样的旧副本。在里面跑 git 全部作用于主检出的 master,而提示符、
+文件列表看上去都没变。那一次的后果是我以为自己“还没推”,实际上提交已经被别的代理
+在同一个 master 上推走了。
+
+判据只有一条,别看目录名:
+
+```bash
+git rev-parse --show-toplevel
+```
+
+它如果等于 `peach-app`,你就在主检出里,不管当前目录叫什么。发现时立刻重建工作树再继续,
+不要“先把手头这一点改完”。