Repository navigation
Description
Overview
Point a fresh agent chat at a science project folder and it should work out where the project got to, how to resume, and what its history is — by default, without being asked "what have we done?". Today it does not: the generated project AGENTS.md has no session-start section, nothing reads the journal on arrival, results_summary.md is consumed at Publish but never templated, results/manifests/ is aspirational (empty after a full real campaign), and profile.md conflates user-level facts with the per-project science goal.
This task makes that true for projects scaffolded by the assistants' start-new-project skill, and lands the change once — via a new sync mode on the PyAutoBrain clone conductor that re-applies the reference assistant's _SHARED_GENERIC diff to its siblings as a reviewable patch, rather than four hand edits.
euclid_assistant is a different design and is explicitly out of scope.
Plan
- Phase 1 — PyAutoBrain. Add a
syncmode to the clone conductor: given a reference assistant and a commit range, take the reference's diff to the_SHARED_GENERICfiles and apply it to each sibling as a three-way patch, reporting per-file/per-sibling applied cleanly / hunks rejected / file absent. Dry-run by default;--applywrites. Domain-adapted lines in siblings survive; conflicts surface for a human instead of being resolved silently. Wire intobin/pyauto-brain clone sync, document in the conductor'sAGENTS.md, unit-test with a temp-dir fixture. - Phase 2 — autolens_assistant (the reference copy). Deliverables A–D: a session-start block in the generated project
AGENTS.md(+ a projectCLAUDE.mdthat@-imports it); astate.mdhead pointer (templated, scaffolded, rewritten-not-appended each session, wired into the end-of-session journal ritual); a templatedresults_summary.mdwith acovers_through:stamp;results/manifests/deleted from the scaffold and from every sentence that promises it; andprofile.mdsplit at the user/project seam. - Phase 3 — propagate. Run the Phase-1 sync dry-run from
autolens_assistanttoautocti_assistant,autogalaxy_assistant,autofit_assistant. Apply and PR the two that take the patch cleanly;autofit_assistant(diverged by ~343 lines) is not applied — its dry-run report is posted here for a human.
Detailed implementation plan
Work Classification
Library (three independent repos; no workspace follow-up — the assistants are their own workspaces).
Affected Repositories
- PyAutoBrain (primary)
- autolens_assistant
- autocti_assistant
- autogalaxy_assistant
- autofit_assistant (dry-run only — no edits this task)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./PyAutoBrain | main | clean |
| ./autolens_assistant | main | clean |
| ./autocti_assistant | main | clean |
| ./autogalaxy_assistant | main | clean |
| ./autofit_assistant | main | clean |
Suggested branch: feature/science-project-memory
Worktree root: ~/Code/PyAutoLabs-wt/science-project-memory/
Implementation Steps
Phase 1 — PyAutoBrain/agents/conductors/clone/
_clone.py: add asyncsubcommand path. Semantics — not a blind overwrite:- Resolve the reference (default
autolens_assistant) and its_SHARED_GENERICfile set (reuseREFERENCE_PROFILES[...]["generic"]/match_any, not a second list). - Compute the reference's diff over a commit range (
--since <rev>, default: the sibling's last recorded sync, elseorigin/main), restricted to the generic paths. - For each sibling, apply per file with
git apply --3way --checkthen--3way, falling back to reporting rejected hunks. Report per file:applied/rejected (<hunk list>)/absent/unchanged. - Dry run by default (
--checkonly, nothing written);--applywrites.
- Resolve the reference (default
bin/pyauto-brain: wireclone sync ...throughclone.sh.agents/conductors/clone/AGENTS.md: document the mode, its semantics, and that a rejected hunk is a human decision, never auto-resolved.tests/test_clone_sync.py: temp-dir fixture with three fake assistants (one divergent) asserting clean-apply, rejected-hunk reporting, absent-file reporting, and that a dry run writes nothing.
Phase 2 — autolens_assistant
skills/start-new-project.md:- Generated project
AGENTS.mdtemplate gains "## Session start — do this first, every session": readwiki/project/profile.md,wiki/project/state.md, and the newest datedwiki/project/YYYY-MM-DD-*.md, then answer. - Scaffold emits a project
CLAUDE.mdthat@-importsAGENTS.md(the same two-line pattern asPyAutoLabs/CLAUDE.md). - Scaffold tree: add
state.md+results_summary.md; removeresults/manifests/and every sentence promising per-run manifests (Phase 2 step 1, the generatedAGENTS.md, the generatedREADME.md, the Publish gate) — the journal run table is the run record. - Seed the project's
profile.mdfrom the assistant clone's ownwiki/project/profile.mdwhen present, else from_profile_template.md.
- Generated project
wiki/project/_state_template.md(new, ~30 lines): Where we are now / In flight / Open, carried forward / Traps — don't repeat / Journal index.wiki/project/_results_summary_template.md(new):covers_through: <date>at the top.wiki/project/_profile_template.md: user-level sections only (background, interaction mode, HPC access + authorization, automation preference); science goal + data-on-hand move to the state template.wiki/project/README.md:state.mdrule — rewritten each session, never appended; the end-of-session ritual becomes "journal entry + rewritestate.md"; an entry is finished whenstate.mdis current.AGENTS.mdstep 2: readstate.mdand the newest journal entry too, when present.- The clone boundary already covers
wiki/project/*andskills/start-new-project*as_SHARED_GENERIC, socheck_boundary.pystays green.
Phase 3 — propagation
clone sync --reference autolens_assistantdry-run → all three siblings.- Apply + PR
autocti_assistantandautogalaxy_assistantif hunks land cleanly; inautocti_assistantreconcile the orphanwiki/project/state.md(real content: CTI stack/release-train/heritage facts) against the scaffolded template. autofit_assistant: no apply — post the dry-run report here.
Key Files
PyAutoBrain/agents/conductors/clone/_clone.py—_SHARED_GENERIC,match_any,REFERENCE_PROFILES; new sync modePyAutoBrain/agents/conductors/clone/AGENTS.md— operating summaryPyAutoBrain/bin/pyauto-brain— conductor dispatchPyAutoBrain/tests/test_clone_sync.py— newautolens_assistant/skills/start-new-project.md— the scaffold (A, C, D)autolens_assistant/wiki/project/{README,_profile_template,_state_template,_results_summary_template}.mdautolens_assistant/AGENTS.md— session-start step 2
Original Prompt
Click to expand starting prompt
Science-project memory: a fresh chat pointed at a project folder resumes…
Type: feature
Target: PyAutoBrain
Repos:
- autocti_assistant
- autofit_assistant
- autogalaxy_assistant
- autolens_assistant
- PyAutoBrain
Difficulty: large
Autonomy: supervised
Priority: high
Status: formalised
Science-project memory: a fresh chat pointed at a project folder resumes by default
Type: feature
Difficulty: large
Autonomy: supervised
Priority: high
Make "point a fresh agent chat at a science project folder and it works out where it got to, how to resume, and the project's history" true by default for projects scaffolded by the assistants' start-new-project skill.
Scope: autolens_assistant (reference copy), autofit_assistant, autogalaxy_assistant, autocti_assistant, and the pyautobrain clone conductor. The euclid assistant is a different design and is explicitly out of scope.
User's original request (verbatim): "I want to know how much memory of a project they truly have. Ideally, I can always load a new agent (e.g. claude) chat, and point it to a science project and it can quickly work out where it got to, how to resume and the general history of the science project. I feel like this would need more in the wiki than just the code run, so how much of this type of more persistant memory is avaialble? Is this something we should add, like an indexed tracker of tasks and work analogous to how organ repos and other tasks are easily resumeable?"
Findings verified 2026-08-28 (one real project scaffolded in July, two journal entries, one full run campaign):
- The generated project AGENTS.md (from
skills/start-new-project.md) has no session-start section; each assistant's own AGENTS.md step 2 readswiki/project/profile.mdonly. Nothing reads the journal on arrival, so a fresh chat does not resume unless asked "what have we done?". autocti_assistant/wiki/project/state.mdis an orphan — no AGENTS.md or skill reads or writes it (the only precedent for a head pointer, and it is dead).results_summary.mdis consumed by the Publish phase (gh release create --notes-file wiki/project/results_summary.md, autolens_assistantskills/start-new-project.md:381) but is never templated or created by the scaffold.results/manifests/is aspirational: empty after a full real campaign; the journal's run tables do the job.profile.mdconflates user-level facts (role, HPC/SSH access, automation consent) with the per-project science goal; a second project re-elicits everything.- The four copies of
skills/start-new-project.mdandwiki/project/{README,_profile_template,_template}.mdhave four distinct hashes (the autofit_assistant copy diverged by 343 lines). The clone conductor lists them as_SHARED_GENERIC(agents/conductors/clone/_clone.py:69-81) but only has a birth mode — nothing re-syncs after birth.
Deliverables, in priority order (A alone gets most of the value):
A. Session-start block in the generated project AGENTS.md, and in the assistants' AGENTS.md step 2: read profile.md, wiki/project/state.md, and the newest dated journal entry before answering. Verify the scaffold emits a CLAUDE.md that @-imports AGENTS.md so Claude Code actually loads it.
B. wiki/project/state.md (keep autocti_assistant's filename) — a small head pointer, rewritten not appended each session: Where we are now / In flight (runs, job IDs, what unblocks each) / Open, carried forward (struck when done) / Traps — don't repeat / one-line journal index. Wire it into the existing end-of-session "want a journal entry?" ritual: an entry is finished when state.md is rewritten. Markdown read by an LLM, not YAML — a science project is one repo with a handful of in-flight runs.
C. Template results_summary.md with a covers_through: <date> stamp so staleness is visible. Drop results/manifests/ from the scaffold and the AGENTS text (delete the trap rather than document it).
D. Split profile.md at the user/project seam: the user half (who you are, HPC access, automation preference) seeded from the assistant clone's profile.md and free to diverge; the project goal moves to state.md.
E. Land via a clone-conductor sync mode that re-applies _SHARED_GENERIC files from autolens_assistant (reference) to the other three, rather than four hand edits. A human reviews the autofit_assistant divergence before any overwrite — some of it may be deliberate domain adaptation.
Out of scope: the library-repo anonymisation of a named science target is filed as its own small maintenance prompt in the data-reduction library.
Activity
Jammy2211 commentedon Aug 28, 2026
Branches pushed — PRs held at the Heart gate
All three phases are implemented and pushed. No PRs were opened: the ship gate consulted
pyauto-heart readiness --jsonand got RED. The reason strings, verbatim:(verdict
red, score 45, ts2026-08-28T21:34:42Z, profiledefault, nothing stale.)None of the RED reasons is caused by this work — it is markdown, one new conductor mode and a
new hermetic test file. Opening the four PRs is a one-command follow-up once Heart is GREEN,
or under a human-authorized corrective exception naming the RED reason above.
feature/science-project-memory55e9fd4pytest tests/ -q627 passed, 0 failed (618 pre-existing + 9 new intests/test_clone_sync.py); tenant firewall OKfeature/science-project-memory6b7c5c4check_boundarycomplete (generic 60 · domain 324 · mixed 92)feature/science-project-memory523015bcheck_boundaryskips (not a reference)feature/science-project-memory7964ff7check_boundaryskips (not a reference)One supporting change is already on
PyAutoMindmain (2b764e48): the tenant-firewallallowlist entry for the new Brain test. The Brain PR gate runs the firewall against Mind
main, so it had to land first.Phase 1 —
pyauto-brain clone syncNot a blind overwrite. It takes the reference's own diff over a commit range, restricted to
that reference's
genericpattern set (reusingREFERENCE_PROFILES/match_any), rewrites thenames for each sibling, and applies it with GNU
patch. Per file it reportsapplied/created/already-applied/rejected (hunks #n)/absent/skipped/unsupported.Dry run by default,
--applywrites and leaves.rejfiles; exit 1 when anything wasrejected. "Since the sibling's last sync" is read from the sibling's own history via a
Clone-sync: <reference>@<sha>commit trailer — no state file.The substitution set adds the UPPERCASE rule birth omits, which is why
autocti_assistantstill names
$AUTOLENS_ASSISTANTin its generated project scaffold.Phase 3 — autofit_assistant: dry run only, NOT applied
As planned,
autofit_assistantwas not written to. Its_SHARED_GENERICcopies havediverged too far for a patch to be the right instrument, and some of that divergence is
deliberate domain adaptation (it is the domain-agnostic base, not a domain assistant). Its
dry-run report:
Divergence from the reference, after normalising the names (
diff-changed lines):AGENTS.md193 ·skills/start-new-project.md221 ·wiki/project/README.md56 ·wiki/project/_profile_template.md101.Left for a human. The two new template files would land cleanly; the four rejected files
need a decision per hunk about which side's prose wins. Re-run to reproduce:
Also noted, deliberately not fixed here
autocti_assistant/wiki/project/_profile_template.mdstill heads its first section"Lensing background", and its generated
.claude/settings.jsonstill names$AUTOLENS_ASSISTANT— birth-time substitution gaps that predate this work.autolens_assistant'sllms-chat.txtandchat_pack/01_api_surface.mdare already stale onmain(chat_bundle.py --checkfails there too). Regenerating them would sweep an unrelatedAPI-surface snapshot into this PR, so it stays a separate hygiene item.
clone sync: domain + env-var substitution rules (#315)
Jammy2211 commentedon Aug 29, 2026
Follow-up folded in: autofit_assistant synced, the two birth gaps closed at source
The follow-up prompt that was going to be its own issue is folded into this one — same
branches, no new issue. Human authorised both legs ("do this" on the autofit dry-run
report). Still no PRs: Heart is RED for the reasons already posted above, unchanged
and unrelated to this work.
feature/science-project-memoryd2b1af9pytest tests/ -q634 passed (627 before;tests/test_clone_sync.py9 → 16); tenant firewall OKfeature/science-project-memorydf8408dcheck_boundaryskips (not a reference); gap grep emptyfeature/science-project-memory1bc7675pytest autoassistant/tests -q56 passed;check_boundarycomplete (generic 105 · domain 20 · mixed 21)autolens_assistant(6b7c5c4) andautogalaxy_assistant(7964ff7) are unchanged —autogalaxy was checked for both gaps and carries neither (its profile template was
hand-adapted at birth).
euclid_assistantwas never opened.Leg B — the gaps closed in the rename table, not by hand
Birth and sync each built their own substitution list, and birth's was missing the two
rules.
name_substitutions()is now the one table both use —apply_seedserialisesit for PyAutoHands'
clone_seed,sync_substitutionscalls it directly — and it carries:$AUTOLENS_ASSISTANT→$AUTOCTI_ASSISTANT);DOMAIN_NOUNS— the science's own noun and its longer phrase per package(lensing / galaxy / CTI / model-fitting; "gravitational lensing" → "charge transfer
inefficiency"), word-anchored so
microlensingsurvives andlensing-fluentkeeps its tail;DOMAIN_ALIASES— the qualified compounds resolve to the target's bare noun first,because "strong-lensing" → "strong-CTI" is a phrase in no science.
A target package absent from the table gets no domain rule and a printed warning at
birth: a science's own noun is never guessed.
Seven new tests pin it, including the honest limit: sync does not retro-fix. It only
ever touches the lines in the patch, so a line an earlier birth got wrong stays wrong until
the reference changes that very line — which is why autocti needed the step below rather
than a re-run of
clone sync(it was already synced toautolens_assistant@6b7c5c4, so are-run had nothing to replay).
autocti_assistant (
df8408d) therefore took the conductor's own substitution output overthe reference's current copies of the two files — mechanical, not hand-written prose; the two
files were otherwise byte-identical to the substituted reference. Then three hand adaptations
in the profile template's examples, the way autogalaxy's were done at birth: a mechanical
rename cannot turn "PhD on weak lensing, new to strong" into a sentence a CTI user recognises.
Verified:
grep -n 'AUTOLENS\|lensing\|Lensing\|autolens\|HowToLens'over both files is empty.One extra find:
.claude/skills/start-new-project.mdin autocti was a stale copy of thepre-#315 file (no session-start block,
results/manifests/still there) where every siblingcell has a symlink — the same birth-artefact class. Restored as the symlink.
Leg A — autofit_assistant, the four rejected files
clone sync --since ee306ac --target autofit_assistant --applyreproduced the dry runexactly (1 applied · 2 created · 4 rejected). Every reject resolved by the same rule:
autofit's domain adaptation wins, #315's structure is layered on. No
.rejleft.AGENTS.md(hunks 1, 2) — session-start step 2 becomes "Project memory" (state.md,newest entry,
profile.md), keeping this cell's "and domain context"; the sub-wikiparagraph and the first-interaction protocol take the profile/state split; the
domain-adaptation section now routes "where the work got to" to
state.md.skills/start-new-project.md(hunks 2, 8, 9, 10) —results/manifests/and theper-run manifest JSON give way to the journal run table + the
state.mdrewrite ritual,written in this cell's transit/TOI-1234 vocabulary rather than the reference's SLACS
example; the HPC paragraph gains the user-vs-project split; Phase 3 starts an arriving
collaborator from
state.md. A stale "records the version in every run manifest" linefurther up was updated to the journal row.
wiki/project/README.md(hunks 1, 3, 4) — the three-file memory, in this cell's ownvocabulary (prior change, sampler swap, paper ingested).
wiki/project/_profile_template.md(hunks 1, 2) — "User profile" + the portabilitynote; "Science goal" and "Data inventory" dropped (they are
state.md's first twosections). "Scientific domain" kept — a fact about the user, and this cell's most
important section. "Likelihood & model code" moved to
state.md— it is where thisproject's code sits, not who the user is.
modes/assistant.mdapplied clean. The two created templates were adapted for thedomain-agnostic base:
_state_template.mdgains the "Likelihood & model code" section, andtwo lensing examples ("a mask radius that ate the arc", "pixelised source settings") became
domain-agnostic ones. Parity check against the reference:
state.mdmentioned 17 times ineach copy of the skill,
results_summary7 in each; no leftoverresults/manifests; the only"autolens"/"lensing" strings left in autofit are the two genuine cross-references that were
already on
main(it describes itself against a domain assistant).Not fixed here — reported
slacs_subhaloand a SLaM/slacs0946run-table row inskills/start-new-project.md,slacs0737/subhalofilename examples inwiki/project/README.md, and lensing wording inits
AGENTS.mdwiki paragraph. These need the same human domain adaptation autogalaxy got;they are not substitutions.
.claude/skills/entries that are real files where the siblingshave symlinks:
_bootstrap_skill.md,_style.md,contribute-upstream.md. Same birthartefact, left alone here.
autolens_assistant'sllms-chat.txt/chat_pack/01_api_surface.mdare still stale onmain— unchanged from the note above.Jammy2211 commentedon Aug 29, 2026
PRs open — under an acknowledged Heart RED
The human authorised opening and merging under the RED verbatim: "open prs under red and merge i acknowledge". The readiness reasons are unchanged from the comments above and none of them is caused by this work:
release validation FAILED (stage integrate)workspace validation not passing (2 failed, cloud#33179766004: autolens_test scripts/imaging/rectangular_mge.py, rectangular_mge_rtu.py)manifest drift: session-start hooks (generated) — 32 mismatch(es) vs PyAutoMind/repos.yamlThe acknowledgement is recorded on both task entries in
PyAutoMind/active.md(heart-ack:).d2b1af9pytest tests/ -q634 passed; tenant firewall OK6b7c5c4check_boundarycomplete (generic 60 · domain 324 · mixed 92)7964ff7check_boundaryskips (not the reference); both birth gaps absentdf8408dcheck_boundaryskips; gap grep empty1bc7675pytest autoassistant/tests -q56 passed;check_boundarycomplete (generic 105 · domain 20 · mixed 21)The PyAutoBrain PR carries
Closes #315; the four assistant PRs reference this issue as Part of. This issue closes once all five are merged.Opened alongside, unrelated task, same acknowledgement: PyAutoLabs/PyAutoReduce#74 (PyAutoReduce#73).
Jammy2211 commentedon Aug 29, 2026
Three of five merged — reopening: two PRs are red on pre-existing
wiki-currencydriftBrain Tests—pytest (3.12)success,pytest (3.13)success8f5f7697658d585b42fa52ea6d6c0fcdd1988bdaclone-boundarysuccess,wiki-currencysuccess0242d7be673673aa93c701d8b7ec37cbeba55566wiki-currencysuccessd5df11fba0bc2e9a54bf0318d705f0a4d0b3a1f1clone-boundarysuccess ·wiki-currencyFAILUREclone-boundarysuccess ·wiki-currencyFAILUREGitHub closed this issue automatically on #316's
Closes #315. Reopened — two of its five PRs are still open.The failing leg, verbatim
wiki-currency/ jobwiki-currency, step "Run set +e …":autolens_assistant#116 (
drift-report.mdartifact, run 33226180760) — one sub-check failed:(
--check-versionclean,--lint-idiomsclean,--check-provenancewarnings only,--check-citationsclean, chat bundle currency reported — the known stalellms-chat.txt/chat_pack/01_api_surface.mdnoted earlier in this thread.)autogalaxy_assistant#20 (run 33226182888) — two sub-checks failed:
Why this is not this branch's failure
Both failures are in
wiki/core/pages and the skill API audit. This branch touches onlyAGENTS.md,modes/assistant.md,skills/start-new-project.md,wiki/project/*and.claude/hooks/session-start.sh— nowiki/corepage, no cited source path, no audited skill symbol.wiki-currencywas already failing on both repos' previous PRs, which were merged anyway:feature/pynufft-removal-residue-phase-2→ failure (PR refactor: rename morning skill to wake_up (composition door) #115, merged)feature/pynufft-removal-residue-phase-2→ failure (PR Add /health full mode (release-run dashboard) #19, merged)No code was modified to make the leg pass, and neither PR was merged. They stay open for a human: either re-run after the wiki drift is fixed as its own hygiene task, or merge deliberately on the same "pre-existing red" judgement the previous pair took.
Jammy2211 commentedon Aug 29, 2026
Shipped
All five PRs are merged. Phases 1-3 landed, plus the folded-in follow-up (autofit_assistant sync + the autocti_assistant birth-substitution gaps).
8f5f769clone syncmode on the clone conductor (three-way patch of_SHARED_GENERICfrom a reference cell), plus the sharedname_substitutions()rename table used by both birth and sync (UPPERCASE package rule,DOMAIN_NOUNS/DOMAIN_ALIASES; unknown target science = no domain rule + a warning, never a guess). Suite 627 → 634; clone-sync tests 9 → 16.0242d7bwiki/project/state.mdreconciled into the template (not deleted); stale.claude/skills/start-new-project.mdreal-file copy restored as the symlink every sibling has.d5df11f--since ee306ac, all four rejected files hand-resolved keeping its fitting/inference domain adaptation and layering #315's structure on top. 56 tests pass, boundary complete.010378dAGENTS.md(+ projectCLAUDE.mdthat@-imports it),state.mdhead pointer (templated, scaffolded, rewritten-not-appended, wired into the end-of-session ritual), templatedresults_summary.mdwithcovers_through:,results/manifests/deleted from the scaffold and from every sentence promising it,profile.mdsplit at the user/project seam.5938bccstate.mdas the head pointer a session reads first.euclid_assistantwas out of scope throughout and was never opened.The last two merged over a pre-existing CI red
autolens_assistant#116andautogalaxy_assistant#20were merged on human acknowledgement with thewiki-currencyleg red. The failure is pre-existingwiki/core/ skill-audit drift that these branches do not touch:autolens_assistant#116— "Symbol audit (--scope all) exited 1" (missing/broken: 1)autogalaxy_assistant#20— the same, plus "Citation paths (--check-citations) exited 1" (wiki/core/operations/sandbox.mdcitesPyAutoGalaxy:autogalaxy/plot/plot_utils.py, absent from the source tree)The same leg failed on both repos' previous PRs (#115, #19 — pynufft residue phase 2, 2026-08-23), which were merged anyway. No code was modified to make the leg pass.
That drift is now filed as its own task:
PyAutoMind draft/maintenance/pyautobrain/fix_wiki_currency_ci_drift_in_the.md.Heart was RED at ship time for an unrelated reason, acknowledged verbatim by the human: "release validation FAILED (stage integrate)".
Closing — the follow-up prompt was recorded as folded into this issue, not re-filed as a separate task.