Add the skill faster_rust_worktrees: create the Git worktrees of a Rust repository fast and small on the disk
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- git, python, rust, typescript
- Lĩnh vực
- developer-experience, tooling
Hướng nghiên cứu
Start by reading skills/issue_fix_workflow/SKILL.md and the referenced worktree_tools README to understand the existing worktree workflow and reference implementation. Find the Rust package build and test commands, then follow the issue’s steps for the Cargo workspace, worktree creation and cleaning commands, and the AGENTS.md workflow update. Done means locked versions remain unchanged, tests pass, and measurements show the reported worktree build and disk space improvements.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Goal
Add a skill faster_rust_worktrees in skills, with a file SKILL.md. With this skill, a coding agent makes the Git worktrees of any Rust repository fast to create and small on the disk. Each issue fix creates a new worktree, and without this technique the first build of each worktree compiles every Rust dependency again.
The technique was proven first in Heidrun Code, then applied to the repository localai_rust:
- https://github.com/heidrun-org/localai_rust/issues/14
- https://github.com/heidrun-org/heidrun_code/issues/864
Measures in localai_rust
Measured on 2026-10-29 on an Apple M1 Pro, in fresh clones (the comments of the issue of localai_rust give the details):
| Measure | Before | After |
|---|---|---|
Create a worktree, then its first pnpm test |
0.3 s + 207.2 s, 875 crates compiled | 2.0 s + 29.1 s, 0 crates compiled |
| Cold build of the repository | 200.5 s, 875 crates | 137.3 s, 609 crates |
Disk space of the target folders of one checkout |
3.5 GB | 2.8 GB |
| Real disk space of a new worktree before its first change | about 3.5 GB after its first build | 5 MB |
| Estimate with 10 worktrees | about 38.5 GB | about 2.85 GB |
The technique
- Make all the Rust packages of the repository one Cargo workspace at the root, with one
Cargo.lockand onetargetfolder. The packages then share their compiled dependencies, and Cargo uses relative paths for the packages of the repository, so the compiled files stay valid in a worktree. To keep the locked versions, start the newCargo.lockfrom the largest old one, and check that no locked version changed. - Create each worktree with a command that clones the
targetfolder of the main checkout into the worktree, with one copy-on-write clone: the functionclonefileof macOS (throughpython3), withcp -c -R -pas the fallback. The clone takes about 2 seconds and shares the disk blocks until Cargo writes a file again. - Give each tracked file with the same content as in the main checkout the modification date of the main checkout, and each folder with the same list of names. Git gives every file of a new worktree the date of the creation, and Cargo then compiles every crate of the repository again.
- In the build script records
target/<debug or release>/build/*/output, replace the absolute path of the main checkout with the path of the worktree, for the folder of the packages and for thetargetfolder, and keep the date of each record. - Install the packages of the worktree (for example
pnpm install --frozen-lockfile). - Give an option
--without-optimizationthat only creates the worktree, to find out whether a problem comes from these optimizations. - Give two cleaning commands: one that deletes the
targetfolders of the worktrees that no build used for some days, and one that deletes the files of thetargetfolder that the current builds do not use (from the hashes of the units in the Cargo logCARGO_LOG=cargo::core::compiler::fingerprint=debug).
Traps found in localai_rust
- Run Cargo in the folder of each package, as the scripts of the package do, and never at the root of the workspace. At the root, Cargo builds the packages together, which gives the shared dependencies other features and other hashes, and it does not read the
.cargo/config.tomlof a package. Both make Cargo compile everything again. - Run each Cargo command of the cleaning command in the folder of its package, for the same reason. A variable such as
GGML_METAL, set in the.cargo/config.tomlof a package, makes a build script run again when it changes. - The worktree must be inside the main checkout (for example
.agents/worktrees/<branch>), so that both folders are on the same disk, which the clone needs. - The main checkout must be built first. Without a
targetfolder, the command creates the worktree without the clone and says so. - Measure with the real repository: count the lines
Compilingof the first build in a new worktree. The result must be 0 crates when no source changed, and only the changed package after a change of one line.
What the skill does
The skill names no detail of one repository, like the skill issue_fix_workflow. It tells the coding agent to:
- Find the Rust packages of the repository, the commands that build and test them, and the folder of the worktrees.
- Make the Cargo workspace, and check that the locked versions did not change and that the tests pass.
- Add the command that creates a worktree, and the two cleaning commands. The package worktree_tools of localai_rust is the reference implementation, in TypeScript.
- Change the worktree creation command of the Issue Fix Workflow in the file
AGENTS.mdof the repository. - Measure before and after, as in the table above, and write the measures in the issue.
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 1
- Fork
- 0
- Merge trung bình
- 7 phút
- Pull request đã merge (30 ngày)
- 17
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của jeromeetienne/coding_agent_plugin
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
jeromeetienne/coding_agent_plugin#7 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
jeromeetienne/coding_agent_plugin#62 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
jeromeetienne/coding_agent_plugin#61 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Symbiospec to UX — Draft skillĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
jeromeetienne/coding_agent_plugin#25 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
jeromeetienne/coding_agent_plugin#9 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của jeromeetienne/coding_agent_plugin
Issue tương tự
-
status: ready
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
melodic-software/claude-code-plugins#15008 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Project-N-E-K-O/N.E.K.O#3670 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
🏷️ good first issue enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
S-Needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày