This commit is contained in:
Rai (Michael Pokorny)
2025-06-25 03:22:36 -07:00
parent 6521b84369
commit 98dc2c8482
2 changed files with 20 additions and 5 deletions

View File

@@ -63,6 +63,9 @@ Tasks live under `agentydragon/tasks/` as individual Markdown files. Please upda
-
- Without `--agent`, this creates or reuses a worktree at
- `agentydragon/tasks/.worktrees/<task-id>-<task-slug>` off the `agentydragon` branch.
- Internally, the helper uses CoW hydration instead of a normal checkout: it registers the worktree with `git worktree add --no-checkout`, then performs a filesystem-level reflink
- of all files (macOS: `cp -cRp`; Linux: `cp --reflink=auto`), falling back to `rsync` if reflinks arent supported. This makes new worktrees appear nearly instantly on supported filesystems while
- preserving untracked files.
- With `--agent`, after setup it runs pre-commit checks (aborting on failure), then launches the Developer Codex agent in that workspace (using `prompts/developer.md` and the task file),
- and when the developer agent exits, it automatically runs the Commit agent helper to stage fixes and commit the work.
**Commit agent helper**: in `agentydragon/tasks/`, run:

View File

@@ -70,19 +70,31 @@ def main(agent, tmux_mode, interactive, shell_mode, task_inputs):
wt_root.mkdir(parents=True, exist_ok=True)
if not wt_path.exists():
# Create worktree without checkout, then hydrate via reflink/rsync for COW performance
# --- COW hydration logic ---
# Instead of checking out files normally, register the worktree empty and then
# perform a filesystem-level reflink of tracked + untracked files for near-instant setup.
# On macOS/APFS this uses `cp -cRp` (clonefile); on Linux we pass `--reflink=auto`.
run(['git', 'worktree', 'add', '--no-checkout', str(wt_path), branch])
src = str(repo_root())
dst = str(wt_path)
# Use filesystem-specific reflink options: macOS (clonefile via cp -c), Linux (--reflink=auto)
if sys.platform == 'darwin':
reflink_cmd = ['cp', '-cRp', f'{src}/.', f'{dst}/', '--exclude=.git', '--exclude=.gitlink']
reflink_cmd = [
'cp', '-cRp', f'{src}/.', f'{dst}/',
'--exclude=.git', '--exclude=.gitlink'
]
else:
reflink_cmd = ['cp', '--reflink=auto', '-Rp', f'{src}/.', f'{dst}/', '--exclude=.git', '--exclude=.gitlink']
reflink_cmd = [
'cp', '--reflink=auto', '-Rp', f'{src}/.', f'{dst}/',
'--exclude=.git', '--exclude=.gitlink'
]
try:
run(reflink_cmd)
except subprocess.CalledProcessError:
run(['rsync', '-a', '--delete', f'{src}/', f'{dst}/', '--exclude=.git*'])
# Fallback on filesystems without reflink support
run([
'rsync', '-a', '--delete', f'{src}/', f'{dst}/',
'--exclude=.git*'
])
if shutil.which('pre-commit'):
run(['pre-commit', 'install'], cwd=dst)
else: