Skip to content

feat(cortex): birth — register a scaffolded Science project in one step - #546

Merged
Jammy2211 merged 2 commits into
mainfrom
feature/cortex-birth
Oct 29, 2026
Merged

Jammy2211 merged 2 commits into
mainfrom
feature/cortex-birth

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Closes #545 (phase 2 of making the Cortex the Science project manager; phase 1 was #544).

Summary

  • pyauto-brain cortex birth <key> --category active|development --assistant A --summary S registers a project folder that the domain assistant's start-new-project already scaffolded. Scaffolding stays with the assistants.
  • It derives the projects.yaml row from the folder and the other rows:
    • the remote, from the git origin;
    • ral_root, the rows' RAL base plus the category and key;
    • sync_verbs, from the hpc/sync dispatch case (help excluded);
    • the ledger file.
  • It's a dry run by default, which also enforces the 15-word summary limit.
  • --apply (needs the Cortex clean on main) does five things:
    1. cuts claude/birth-<key> from origin/main;
    2. writes through PyAutoCortex's cortex.py birth; the conductor writes no ledger itself;
    3. commits;
    4. pushes only if ledger_merge.py classify --base origin/main calls the commit a birth, so it lands by itself;
    5. returns to main.
  • A failed write or commit abandons the branch and leaves main clean. Exit codes: 2 refused, 1 for any git, write or push failure, 0 landed or --no-push.
  • The /cortex skill gains a "Start a new project" section: scaffold with the assistant, take data from dataset/ or simulators/, then cortex birth.

API Changes

None to the library API. The conductor gains a verb: cortex birth. It needs PyAutoLabs/PyAutoCortex's companion PR (cortex.py birth); until that merges, the three --apply tests skip.

Validation

  • A dry run on euclid_detailed derives a row identical to its registered one, then refuses because the key and path are taken.
  • End-to-end --apply against a throwaway clone with a local bare origin: written, classified as a birth, pushed, back on clean main, drift clean.
  • Derived sync_verbs match four of the seven registered active Science rows exactly. For analytic_gaussian, ep_toy_gaussian and slope_hierarchy_scale, the registered rows list fewer verbs than their hpc/sync now dispatches. That's stale rows, not this code.

Review findings addressed

  • A failed git commit, for example from a hook, used to leave the birth staged on main and exit 0 with a false "committed locally" message. It now abandons the branch, leaves main clean and exits 1. There's a test that uses a rejecting pre-commit hook.
  • A failed push and a classifier refusal now exit 1, as documented. There's a test.
  • A backslash in a value was silently treated as a YAML escape. It's now refused, and the read-back compares every field (Cortex PR).
  • help is no longer counted as a sync verb.
  • The dry run enforces the summary limit.

Open question for the human: a development/ birth's ral_root is <base>/development/<key>, mirroring the laptop as decision 61 and drift expect. But the four existing development projects still sit under RAL active/, and no development/ folder exists on RAL yet.

Heart RED override (development only)

Authorized by the live human on 2026-10-29: "I authorize development only heart override" (for PyAutoBrain#545, after the exact RED reasons were shown). Development ship only: commit, push, PR-open. Merge needs a separate human /prm with every required check green. No release.

Exact RED reasons (pyauto-heart readiness, 2026-10-29):

  • PyAutoArray: 4 uncommitted source change(s)
  • PyAutoGalaxy: 9 commit(s) behind origin
  • PyAutoLens: 7 commit(s) behind origin
  • release validation incomplete: no rehearsal for current source
  • release push credential check stale (pyautolabs-bot, 49h old)

None of these involves PyAutoBrain or PyAutoCortex. This branch does not fix them.

Passed branch gates: Brain tests/test_cortex_conductor.py 80 passed (3 end-to-end tests skip cleanly against a Cortex without birth); Cortex 70 tests + cortex check: OK; no new lint beyond the file's existing idiom; smoke n/a (organ tooling); independent review FINDINGS, all addressed (below).

🤖 Generated with Claude Code

`cortex birth <key> --category active|development --assistant A --summary S`
derives the projects.yaml row from <Science root>/<category>/<key>/ (remote
from git origin, ral_root from the rows' RAL base, sync_verbs from the
hpc/sync dispatch case, the ledger file) and prints it. --apply cuts
claude/birth-<key> from origin/main, writes through the Cortex's own
`cortex.py birth`, commits, pushes only when `ledger_merge.py classify
--base origin/main` calls it a birth, and returns to main; any failed
write or commit abandons the branch and leaves main clean (exit 1).
Scaffolding stays with the assistant's start-new-project; the /cortex
skill gains "Start a new project".

Refs #545

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit da6743f into main Oct 29, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the feature/cortex-birth branch October 29, 2026 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cortex): birth — register a scaffolded Science project in one step

1 participant