Add the skill faster_rust_worktrees: create the Git worktrees of a Rust repository fast and small on the disk

オープン
#19 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
git, python, rust, typescript

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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:

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

  1. Make all the Rust packages of the repository one Cargo workspace at the root, with one Cargo.lock and one target folder. 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 new Cargo.lock from the largest old one, and check that no locked version changed.
  2. Create each worktree with a command that clones the target folder of the main checkout into the worktree, with one copy-on-write clone: the function clonefile of macOS (through python3), with cp -c -R -p as the fallback. The clone takes about 2 seconds and shares the disk blocks until Cargo writes a file again.
  3. 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.
  4. 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 the target folder, and keep the date of each record.
  5. Install the packages of the worktree (for example pnpm install --frozen-lockfile).
  6. Give an option --without-optimization that only creates the worktree, to find out whether a problem comes from these optimizations.
  7. Give two cleaning commands: one that deletes the target folders of the worktrees that no build used for some days, and one that deletes the files of the target folder that the current builds do not use (from the hashes of the units in the Cargo log CARGO_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.toml of 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.toml of 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 target folder, the command creates the worktree without the clone and says so.
  • Measure with the real repository: count the lines Compiling of 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:

  1. Find the Rust packages of the repository, the commands that build and test them, and the folder of the worktrees.
  2. Make the Cargo workspace, and check that the locked versions did not change and that the tests pass.
  3. 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.
  4. Change the worktree creation command of the Issue Fix Workflow in the file AGENTS.md of the repository.
  5. Measure before and after, as in the table above, and write the measures in the issue.
主要言語
言語のデータがありません
スター
1
フォーク
0
平均マージ
7分
マージ済み PR(30日)
17

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

jeromeetienne/coding_agent_plugin のほかの issue

jeromeetienne/coding_agent_plugin の issue をすべて見る

似ている issue

DevTools の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。