Repository navigation
docs(agents): 默认复用已有检出,不新开工作树;Core rust/target 复制复用 - #2149
Merged
Merged
Conversation
- develop-lithe 第七节“工作树缓存复用”改为“检出与编译缓存复用”: 先在空闲主检出切分支,其次复用空闲的已有工作树,都被占用才新建; 给出“空闲”的两条判定条件和后台任务用 EnterWorktree path 的做法 - 禁止在系统/会话临时目录克隆仓库、建工作树或放 Cargo 编译目录, 禁止把 CARGO_TARGET_DIR 指向临时目录或另一个检出; 移除工作树只用 git worktree remove,不加 --force - 新建 Core 工作树复制 rust/target(cp -cR),首次编译前 cargo clean --workspace,只重编工作区成员 - AGENTS.md 入口提醒同步改写;docs/ci-builds.md 补默认不新建工作树的说明 - 新增 Agent Note 记录 2026-11-18 磁盘占满事件、决策、备选方案和复制实验数据; 旧 Note 和引用处更新节名
xiaoyumuxi
marked this pull request as ready for review
November 18, 2026 08:28
12 of 15 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
2026-11-18 开发机数据卷 926 GB 用掉 894 GB,只剩约 6 GB。原因是每个任务都新开一份检出、从零编出自己的编译目录,用完不复用,也没人删:
~/.claude/jobs/<任务>/tmp)共 255 GB,其中 55 个 Cargo 编译目录约 228 GB,全部属于已结束的任务(在临时目录建 Core 工作树直接跑 Cargo,或把CARGO_TARGET_DIR指向tmp/target*);.claude/worktrees/下另有 3 个,对应 PR 都已合入;.claude/worktrees/下有 5 个 PR 已合入的工作树,其中两个各 27 GB。现行规则(2026-11-16)只规定了“新工作树复制
.artifacts/desktop”,没有规定什么时候不该新建工作树,也没覆盖 Core 的rust/target。本 PR 把规则改成“能在分支上做就不开工作树”,并补上 Core 编译目录的复制做法。改动 / Changes
.agents/skills/develop-lithe/SKILL.md(规则真源)origin/main切分支;②否则复用空闲的已有工作树,在其中切分支;③都不空闲才在.claude/worktrees/下新建。git status --porcelain为空,且当前分支是main或其 PR 已合入/关闭(gh pr list --head <分支> --state all);分离 HEAD 时要求git branch -r --contains HEAD有输出。选中后立即切分支,避免并行任务选中同一个检出。.claude/worktrees/)跳过第 1 步,用EnterWorktree的path进入已有工作树,不用name新建。CARGO_TARGET_DIR指向临时目录、私有目录或另一个检出(验证其他工具链、交叉编译目标、文档也用同一编译目录);用git worktree remove --force或直接删目录移除工作树。cp -cR、源检出编译中不复制、异常就删掉重编、不复制运行时状态和报告);.artifacts/desktop的前提和命令沿用原规则;新增 Corerust/target:cp -cR复制,首次编译前cargo clean --manifest-path rust/Cargo.toml --workspace,只重编工作区成员。AGENTS.md(入口提醒)docs/ci-builds.md资源说明五条提醒,细节指向 Skill;链接新旧两份 Note。Agent Note
.agents/notes/implemented/process/2026-11-18-reuse-checkouts-before-new-worktrees.md:记录本次磁盘占满的数据、6 条决策、为什么复制rust/target后必须cargo clean --workspace、正确做法与反例、4 个被否方案(继续新建 + 清理脚本、全局CARGO_TARGET_DIR、sccache、只用主检出)、后果和复制实验数据。2026-11-16-worktree-cache-reuse-without-script.md:更新节名引用,注明 2026-11-18 改名并链接新 Note。bug-fix/2026-11-09-viva-core-cgo-cache-identity.md:更新节名引用。docs/ci-builds.md.artifacts/desktop/只有留在同一检出里才能增量复用,默认先在空闲检出切分支,都被占用才新建工作树。不在本 PR 范围内 / Out of scope
类型专属:docs
.agents/notes/(中文),docs/只保留操作说明;改了 Note 已运行./scripts/agent-notes/verify-agent-notes.sh范围检查 / Scope checks
功能矩阵 / Feature matrix
N/A:只改开发规则文档,没有用户可见能力或跨平台行为变化。
插件归属 / Plugin ownership
develop-lithe第三节“插件归属与宿主零依赖”的自查命令,结果为空shared/i18n/;插件的构建步骤、资源路径和补丁没有写进docs/ci-builds.md、Agent Note 或 SkillUI 验证 / UI evidence
N/A:没有 UI 改动。
统一日志系统 / Structured logging
N/A:没有代码改动。
界面文案 / i18n
N/A:没有用户可见文案(仍运行了两条 i18n 检查,见“验证”)。
逻辑归属 / Logic placement
N/A:没有业务逻辑改动。
性能与内存 / Performance and memory
N/A:没有运行时改动。
设置 / Settings
N/A:没有设置改动。
插件契约 / Plugin contract
N/A:不涉及插件契约、能力版本或宿主方法。
发行包与资源 / Bundle and resources
N/A:没有新增或修改运行时资源和构建资源;
docs/ci-builds.md只更新节名引用并补充“默认不新建工作树”的说明。无用代码与重构 / Dead code and refactoring
N/A:没有代码改动。
验证 / Verification
./scripts/agent-notes/verify-agent-notes.shok: 176 active Agent Note(s) verifiednode scripts/i18n/verify-app-language-localization.mjsnode scripts/i18n/generate-i18n.mjs --checkdevelop-lithe第三节)rg '工作树缓存复用'确认没有残留的旧节名引用docs/screenshots/git-blame-menu-review/README.md的一般性描述,与本节无关rust/target复制实验(Rust 1.100.0,darwin/arm64):从origin/main新建 Core 工作树,cp -cR克隆主检出约 46 GB 的rust/target,再cargo clean --workspace,再cargo build --workspacecargo metadata --no-deps列出的 52 个工作区成员,没有重编第三方 crate未能执行的检查和原因: Windows 没有验证。复制命令
cp -cR依赖 APFS 克隆,只适用于 macOS;Windows 上的复制方式本 PR 没有规定。提交前确认 / Final checks
main创建;目标分支main