Repository navigation
Description
Folder family tree: parts of folder/mirror parents cut worktrees off the mirror
Parent: #228 · Depends on: #229 · Blocks: #TBD4
Problem
divide.md and prompts/task.md both promise a dividing worker that each part runs "in a copy of the repository taken from yours." For a parent whose ground is a git repository this is true — parts cut worktrees off the parent's worktree HEAD and merge back. For a parent whose ground is a plain folder (folder/in place/mirror), prepareTaskTreeAt falls through to dir: workspace — the part works in the parent's own directory, concurrently with its siblings, with no isolation and no merge semantics.
This is the largest class of general agentic work: research folders, document sweeps, data directories, multi-section reports. Today those families run their parts on top of each other.
Decision
The mirror is the family tree; parts cut real worktrees off it. When a folder/mirror parent divides, each part gets git worktree add off the mirror's HEAD, in its own directory under session trees/, merging back into the mirror on landing. The mirror is harness-owned space, so this is a real git worktree with real isolation — not a copy, not a shared directory.
- The mirror already holds the ground's content (it is the byte-for-byte copy made at family start).
- Parts merging into the mirror use the same
comeHomemachinery as repo parts — one road. - The family's final landing into the person's folder is unchanged:
landMirrorlays the (now complete, post-task families: ledger absorption — part writes compose into the parent #229) ledger by name.
This deletes the "parts share the parent's directory" hazard and makes the prompt's promise true for folders.
Acceptance
- A folder/mirror parent that divides gives each part its own directory; two parts writing different files never touch each other's tree.
- A part's work merges into the mirror and is present there before the family lands.
- The audit (
restoreFromFolder) judges the integrated mirror. in placefamilies are explicitly out of scope for worktree isolation (the person said "here") — parts of an in-place parent follow the add-only rule (#TBD4's landing shape) and this issue documents that boundary.- Prompt lies removed:
prompts/task.mdanddivide.mdno longer claim "copy of the repository" for folder families; they describe the family tree.
Notes for the implementer
- The seam is
prepareTaskTreeOn(task_run.go:5260): theTaskModeMirror/TaskModeFolderarms currently return a shareddir. For a node withspec.parent != 0whose parent's tree is a mirror, cut a worktree off the mirror instead. - The mirror must be a git repository for
worktree addto work. It is not one today. Initialize git in the mirror at family start (cheap: the content is already copied; onegit init+ add-all + baseline commit, bounded by the same entry capsmirrorGroundalready enforces). This is not the rejected "baseline for audit" idea — the audit restores from the folder; this repo exists solely to give parts a worktree source and a merge target. - If
git initfails (no git, read-only), degrade to today's shared-directory behavior loudly (log line + a sentence in the parent's brief), never silently. taskOwnFolderalready computes the per-node directory undertrees/; reuse it for the part's worktree path.
Verification recipe
- Scripted nest, mirror-mode parent on a temp ground; divide into two parts.
- Each part writes a different file and also appends to a shared-log file the parent owns — assert the shared-log case is refused by #TBD3, and the distinct-file case lands both files in the mirror.
- Assert each part ran in a directory distinct from the parent's mirror dir (
tree.dir != parent.tree.dir). - Assert
git -C <mirror> logshows the parts' merge commits before family landing.
Drafted with CodeAF · reviewed and owned by the author
Activity
folder families get a family tree of their own, and their parts get w…
task families: folder family tree — parts cut worktrees off the mirror (
build: repack the chat manual over the rebased pages
task families: uniform part-brief composition — harness composes fami…
task families: an end-to-end lane that proves parts work apart and la…
task families: an end-to-end lane that proves parts work apart and la…
task families: an end-to-end lane that proves parts work apart and la…
task families: a real-model end-to-end lane on both grounds (#280)