Repository navigation
Description
Overview
The organism has no single answer to "where is the workspace root", and the six private answers it does have already disagree today — independent of any directory regroup. This is the prerequisite for phase 3 (grouping the science repos into lens/ galaxy/ fit/ cti/ reduce/ with the organs staying flat), but it is worth landing on its own merits.
Phase 1a of the workspace regroup. Changes no directory layout. Scoped to 4 organ repos; the mechanical fan-out that consumes this resolver is phase 2 (draft/maintenance/pyautobrain/workspace_resolver_fanout.md).
Plan
- Add a
.pyauto-rootmarker at the workspace root and make both resolvers walk up to it — inserted above the existing sibling-organ probe, never replacing it, so no currently-correct resolution can become wrong. - Validate
$PYAUTO_ROOTinstead of taking it verbatim; today it bypasses every check. - Make Heart, Hands and Mind consume that one resolver in place of their ~13 private answers.
- Make
repos_sync.pydrift-check in both directions — it is currently blind each way. - Commit the location inventory the later phases need as data, not a one-off sweep.
Detailed implementation plan
Affected Repositories
- PyAutoBrain (primary) — the resolver pair
- PyAutoHeart, PyAutoHands, PyAutoMind — adopt it
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./PyAutoBrain | main | clean |
| ./PyAutoHeart | main | clean |
| ./PyAutoHands | main | clean |
| ./PyAutoMind | main | clean |
worktree_check_conflict workspace-location-contracts PyAutoBrain PyAutoHeart PyAutoHands PyAutoMind → exit 0.
Suggested branch: feature/workspace-location-contracts
1. The resolver
PyAutoBrain/agents/_pyauto_root.py resolves in three steps and step 2 is the defect: _is_root() (:59) returns True for any directory containing one of SIBLING_ORGANS, without checking it is a checkout. Move the organs into an organs/ directory and PyAutoLabs/organs itself tests True — the root resolves one level too deep, silently, and every root / <repo> join below it misses.
The change is additive:
| Today | After | |
|---|---|---|
| 1 | $PYAUTO_ROOT verbatim |
$PYAUTO_ROOT, validated — the reason string says whether the marker confirmed it |
| 2 | parent, if it holds a sibling organ | walk up for .pyauto-root ← new, authoritative |
| 3 | parent regardless, "unverified" | parent, if it holds a sibling organ (unchanged, demoted) |
| 4 | — | parent regardless, "unverified" |
Keeping the sibling probe as a fallback is deliberate: a remote/web session often checks out a single repo with no root above it and therefore no marker. Demoting rather than deleting means the change can only add correctness.
PyAutoBrain/bin/_pyauto_root.sh takes the identical order — the module docstring requires the two to agree. Model the walk-up on autolens_profiling's profiling_root(), which already walks to a ruff.toml marker and is the one layout-independent path helper in the workspace.
Preserve the module's existing workspace_root_reason() contract: callers that degrade report why, so "resolved to a directory that does not exist" stays distinguishable from "resolved fine, found nothing".
2. Organs adopt it
Replace with the shared resolver:
PyAutoHeart/heart/_common.sh:31— hardcodes$HOME/Code/PyAutoLabsPyAutoHeart/heart/dashboard.py:171-179,188— falls back to~/Code, not~/Code/PyAutoLabsPyAutoHeart/heart/checks/worktree_drift.py:46-51— literal_p3.name == "PyAutoLabs"testPyAutoHeart/scripts/health_audit.sh:25,health_sync.sh:57,health_release.sh:31,heart/tick.sh:31PyAutoHands/autohands/board.py:56-78— also~/CodePyAutoHands/autohands/run_all.py:37— fixedparents[2]PyAutoHands/pre_build.sh:20— fixed depthPyAutoMind/scripts/spawn.py:507— fixedparents[2]PyAutoMind/scripts/repos_sync.py:1663
3. Bidirectional drift
Folds in the separately-filed draft/maintenance/pyautomind/autolens_jax_joss_manifest_gap.md; retire it on merge.
- Declared-but-missing is silently skipped —
repos_sync.py:882(CLAUDE pointer checks),:1318(origin checks),:1607(codex hook checks). After any move these pass while checking nothing. A successful check that means reduced coverage is the failure to remove. - On-disk-but-undeclared is silence — repos_sync walks the manifest and asks whether each entry is present, so it structurally cannot see a checkout absent from
repos.yaml.
These are independent of presence on disk: admin_jammy is a genuine manifest entry that is deliberately never cloned, so "missing" must be expressible as intentional rather than as drift.
4. Inventory as data
Commit the worktree / dependency-symlink / runtime-import-location inventory the later phases need, rather than re-deriving it by sweep.
Testing / Witness
- A pytest fixture builds a nested workspace (
lens/PyAutoLensbeside a flatPyAutoBrain) and asserts both entry points return the true root, not the family directory. Must be red before the fix and green after. repos_sync.py --checkexits non-zero on a declared-but-missing repo and on an undeclared on-disk checkout; today both pass.- Existing coverage must stay green:
PyAutoMind/tests/test_session_bootstrap.py,tests/test_session_hook_sync.py.
Key Files
PyAutoBrain/agents/_pyauto_root.py,PyAutoBrain/bin/_pyauto_root.shPyAutoHeart/heart/_common.sh,dashboard.py,checks/worktree_drift.pyPyAutoHands/autohands/board.py,run_all.py,pre_build.shPyAutoMind/scripts/repos_sync.py,spawn.py
Explicitly not in this phase
The physical move, the repos.yaml path: field, the ~12 root enumerators, worktree.sh, and the smoke_install.sh flat pip chain. Do not introduce a universal root / manifest.path rule here — the ordering hazard named by the independent Codex review is that such a rule breaks CI immediately (whose trees are legitimately flat) and misroutes task worktrees later.
Context
Phase 1b (workspace-dead-weight-cleanup) shipped 2026-09-18 — PyAutoBrain#390, PyAutoMind#413 — and removed ~80 worktree paths this phase no longer has to reason about.
Heart at start: RELEASE VALIDATION not release-ready and INSTALL VERIFY warnings, both pre-existing and unrelated; this is not an --auto run.
Original Prompt
Click to expand starting prompt
# Workspace location contracts: one resolver for root, repo, main and task checkouts
Type: maintenance
Target: PyAutoBrain
Repos:
- PyAutoBrain
- PyAutoHeart
- PyAutoHands
- PyAutoMind
Difficulty: large
Autonomy: supervised
Priority: high
Status: formalised
Consequence: judge
Witness: a pytest fixture builds a nested workspace (lens/PyAutoLens beside a flat PyAutoBrain) and asserts the resolver returns the TRUE root, not the family directory, for both the Python and the shell entry point; and repos_sync.py --check exits non-zero when a manifest-declared repo's directory is absent (today it passes silently, checking nothing).
Review-minutes: 25
Unattended: needs-slicing
Phase 1a of the PyAutoLabs workspace regroup. Changes NO directory layout.
## Why
The workspace root has 45 entries and is hard to navigate. The human approved (2026-09-18, in chat)
regrouping the science repos into per-family subfolders `lens/ galaxy/ fit/ cti/ reduce/`, leaving the
8 organs plus PyAutoArray, PyAutoScientist and pyautolabs.github.io flat at root. Lowercase family
names were chosen because none collides with an importable package name; the human explicitly rejected
naming a group after its library (PyAutoLens/PyAutoLens) because $ROOT/PyAutoLens would still resolve
to an existing directory after the move, converting loud failures into silent wrong-path ones.
Three read-only sweeps plus an independent Codex (gpt-6-astra) review, all 2026-09-18, established
that the blocking problem is not the move — it is that the organism has no single answer to where
anything is. Six organs disagree TODAY: PyAutoHeart/heart/_common.sh:31 hardcodes $HOME/Code/PyAutoLabs;
PyAutoHeart/heart/dashboard.py:171 and PyAutoHands/autohands/board.py:56 fall back to ~/Code (not
~/Code/PyAutoLabs); PyAutoHeart/heart/checks/worktree_drift.py:46 tests `_p3.name == "PyAutoLabs"`;
PyAutoHands/autohands/run_all.py:37 and PyAutoMind/scripts/spawn.py:507 use fixed parents[N]. Only
PyAutoBrain uses the canonical _pyauto_root pair, and that pair decides the root by probing for a
sibling organ directory (agents/_pyauto_root.py:59) without checking it is a checkout.
## Scope
1. Define four SEPARATE concepts and one API, rather than one conflated "root":
workspace-root discovery / repo identity / main-checkout location / task-checkout location.
This separation is the review's central recommendation: the dangerous end state is "organs resolve
by sibling arithmetic, science resolves through a manifest". Placement must be a location property,
not a second classification system. Note PyAutoArray stays flat but is a library, not an organ.
2. Add a `.pyauto-root` marker file at the workspace root and make root discovery walk up to it instead
of probing SIBLING_ORGANS. Model it on autolens_profiling's profiling_root(), which already walks up
to a ruff.toml marker and is the one layout-independent path helper in the workspace. Keep
$PYAUTO_ROOT as an override but validate it (today _pyauto_root.py:76 bypasses every check, so a
wrong value exported by a hook is accepted silently).
3. Make PyAutoHeart, PyAutoHands and PyAutoMind consume that single resolver instead of their six
private answers.
4. Make the drift check work in BOTH directions, folding in the separately-filed
`draft/maintenance/pyautomind/autolens_jax_joss_manifest_gap.md` (retire it on merge):
- declared-but-missing is silently SKIPPED at repos_sync.py:882 (CLAUDE pointer checks),
:1318 (origin checks) and :1607 (codex hook checks) — after any move these would pass while
checking nothing. A successful check that means reduced coverage is the failure to remove.
- on-disk-but-undeclared is SILENCE: repos_sync walks the manifest and asks whether each entry is
present, so it structurally cannot see a checkout absent from repos.yaml. That is the
manifest_gap defect, and it survived the removal of its example (autolens_jax_joss).
Note the two are independent of presence on disk: admin_jammy is a genuine manifest entry that is
deliberately never cloned, so "missing" must be expressible as intentional rather than as drift.
5. Record the inventory the later phases need, as committed data rather than a one-off sweep:
existing worktrees, dependency symlinks, and runtime import locations.
## Not in this phase
The physical move, the repos.yaml `path:` field, the ~12 root enumerators, worktree.sh, the
smoke_install.sh flat pip chain, and the IDE/PYTHONPATH/symlink migration are phases 2 and 3. Do not
introduce a universal `root / manifest.path` rule here: the review's named ordering hazard is that such
a rule breaks CI immediately (whose trees are legitimately flat) and misroutes task worktrees later.
The fan-out that CONSUMES this resolver is phase 2:
`draft/maintenance/pyautobrain/workspace_resolver_fanout.md` — the 37-copy session-start hook,
the 14 run_smoke/retime PyAutoHands joins, and the 7 hardcoded absolute paths. It cannot land
first and is mechanical once this phase exists.
The dead-weight cleanup was the sibling task workspace-dead-weight-cleanup, SHIPPED
2026-09-18 (PyAutoBrain#390, PyAutoMind#413) — record
`complete/2026/09/workspace-dead-weight-cleanup.md`. Two findings from it land here:
the `.worktrees/` trees it removed are ~80 paths this phase no longer has to migrate, and
its `autolens_jax_joss_manifest_gap` sibling is the MIRROR of scope item 4 — `repos_sync.py`
is blind in both directions (declared-but-missing is skipped; on-disk-but-undeclared is
silence). Fix both together.
Activity
Jammy2211 commentedon Sep 18, 2026
Decision:
admin_jammyleaves the body map (user ruling, 2026-09-18)admin_jammyis not part of the PyAutoLabs ecosystem and is leaving the workspace. This supersedes the reasoning in the plan above, and simplifies the hardest part of scope item 3.The codebase already anticipated it —
PyAutoBrain/bin/README.md:12: "admin_jammy hosts no skills and is slated to leavePyAutoLabs/".What this changes
The plan justified an "intentional absence" mechanism — a way for
repos.yamlto say declared, but not expected on disk — on the grounds thatadmin_jammywas a legitimate never-cloned entry. That justification is withdrawn.Verified:
admin_jammyis the only declared-but-absent entry (39 declared, 38 on disk). With it removed, declared in the manifest but not on disk can simply be an error, full stop — no new key, no parallel idiom, nothing invented. The simplest rule that is actually true.The reverse direction still needs a minimal allowance: on-disk-but-undeclared must not go red on legitimate non-repo directories at the root. The case that proves it is
.github/— a real checkout with a real remote (the org.githubrepo) that is deliberately not a body-map repo.Work added
admin_jammyentry fromPyAutoMind/repos.yamland regenerate the rootAGENTS.mdrouting table; drop the now-possibly-emptyadmin:category if nothing else uses it.PyAutoHeart/config/repos.yaml:188(- admin_jammy # personal tooling) — removed alongside, after checking what that list governs (if it is an exclusion list, dropping an entry could newly include something).PyAutoHands/bin/autohands:16(ADMIN_JAMMY="$PYAUTOBASE/admin_jammy") — vestigial, and a flat-layout assumption regardless.PyAutoHeart/scripts/health_sync.sh:340— comment referencing an already-deadadmin_jammy/skills/path.Left alone deliberately:
PyAutoBrain/bin/{install.sh,check_skill_line_counts.sh,README.md}, which scanadmin_jammy/skills/and already document it as vestigial, auto-skipped once admin_jammy leaves — they degrade correctly today. Retiring that scan is its own cleanup, not this contract's.Note
euclid_assistantis likewise in the personalJammy2211/namespace but stays — it is on disk and part of the science work. The namespace is not the criterion.This also supersedes one line in the phase-1b completion record (
complete/2026/09/workspace-dead-weight-cleanup.md), which describedadmin_jammyas a genuine body-map repo that is simply not cloned. That was true when written and is not now.Jammy2211 commentedon Sep 18, 2026
Shipped
All legs green before merge — 10 successful jobs across four repos (Brain 3.12/3.13, Heart 3.12/3.13, Hands 3.12/3.13/3.14, Mind refresh/privacy/firewall). Mind's
driftleg is skipped by construction on pull requests. Heart freeze: not frozen, and all four arecategory: organso the library gate does not apply. Every branch proven merged bygit merge-base --is-ancestor(0 unmerged commits each).Verified live on canonical after merge
Integration step done:
repos_sync.py --writerun once from the assembled tree — rootAGENTS.mdregenerated (0admin_jammyreferences),.pyauto-rootnow generated rather than hand-placed, andPyAutoBrain/skills/WORKFLOW.md's owner map synced (PyAutoBrain9091d9e).What the phase actually established
The scope item I expected to be most theoretical — "define four separate concepts rather than one conflated root" — earned its place three times in one session:
0 orphan / 5 dirtywhere canonical reports6 orphan / 7 dirty. The more flattering answer, reached by running Heart where you happen to be working. Now split:workspace_root()locates,canonical_root()grades, derived fromgit --git-common-dir.--writewould have regenerated another tree. The resolver is Brain-anchored, and a bundle'sPyAutoBrainis normally a symlink to canonical — so--writefrom a bundle resolved to canonical. Guarded: both adopters refuse a root that does not contain their own checkout.pyauto-brainbinary from inside the bundle regenerated canonical, and--checkreported "are current" because it checked canonical too — while the bundle's page kept offering a prompt that had just been retired. Caught only by grepping for the slug.All three are the same shape: locating is not writing, and not grading.
Corrections made along the way
spawn.py:507was not a workspace-root site — thatparents[2]is inside a template string for a generated satellite repo's smoke runner.admin_jammyis not part of the PyAutoLabs ecosystem (user ruling). Removing it meant the declared-but-missing check needed no exception mechanism at all — 38 declared ↔ 38 on disk. Only the reverse direction needed one entry,.github, proven load-bearing by unlisting it.Found on the way, filed separately
PyAutoHeart/heart/manifest_drift.py:45anchors its check-line parse to end-of-line, so any leg printing a suffix after its status is invisible to Heart — not green, unparsed. Measured: 16 legs parse, 1 does not (generated hooks), meaning that leg has never reached Heart's verdict. Filed asdraft/bug/pyautoheart/manifest_drift_parser_drops_suffixed_check_legs.md.Carried into phase 3
Step 3 of the resolver is still wrong for a nested workspace with no marker, deliberately, to protect the remote single-repo case — a test pins it. So the marker is the only thing protecting a regrouped workspace: whoever performs the move must create the marker in the same commit, or resolution silently goes one level deep again.
Phase 2 is
draft/maintenance/pyautobrain/workspace_resolver_fanout.md(the 37-copy hook, the 14 smoke shims, the 7 hardcoded paths), which wasBlocked-by:this and is now unblocked.