Skip to content

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

Closed

Description

@Jammy2211

Overview

Phase 2 of making the Cortex the main tool for managing Science projects (phase 1, cortex drift, shipped in #544). Today a new project is started by hand-copying an old one, so it never gets a register row and drift reports it as unregistered. The domain assistants' start-new-project already does the scaffolding. This adds the Cortex half, so that birth plus registration is one flow.

Plan

  • New cortex.py birth in PyAutoCortex: the second command allowed to write projects.yaml. It appends one validated row, opens the ledger, and rolls back if the result doesn't read back cleanly.
  • New pyauto-brain cortex birth <key> --category active|development --assistant <name> --summary "…". It checks the scaffolded folder exists and has no row, then derives:
    • local_path and ral_root (same category on RAL);
    • the remote (git origin, or none);
    • sync_verbs from the project's hpc/sync;
    • the ledger file.
  • Dry run by default. --apply cuts claude/birth-<key> from fresh origin/main, calls cortex.py birth, commits, and pushes only if Cortex's own classifier calls the commit a birth (ledger). It then returns to main and runs drift.
  • It never creates a GitHub repo or touches RAL; it prints those commands for the human.
  • The Brain's cortex skill gains a "new project" section: the assistant's start-new-project with the target Science/<category>/<key>, data from Science/dataset/ or Science/simulators/, then cortex birth.
  • Docs: Cortex REFERENCE.md (birth), AGENTS.md (two commands write projects.yaml), decision 63.

Tier: judge — merge mode: human /prm

Detailed implementation plan

Affected Repositories

  • PyAutoBrain (primary — conductor verb, skill, tests)
  • PyAutoCortex (scripts/cortex.py birth, tests, docs)

Branch Survey

Repository Current Branch Dirty?
./organs/PyAutoBrain main clean
./organs/PyAutoCortex main clean

Suggested branch: feature/cortex-birth

Implementation Steps

  1. PyAutoCortex/scripts/cortex.py: birth_project(root, key, row: dict, summary, today, issue, now) validates the key regex, that the key is unused, that local_path is unused, and that the fields are complete and quotable. It appends the row block at the end of projects.yaml in PROJECT_FIELDS order, re-reads it with load_projects (restoring the file on any problem), then new_ledger. CLI birth <key> --local-path … --ral-root … --remote … --sync-verbs a,b --ledger … --assistant … --partition … --witness-file … --summary … [--issue] [--note]. Tests in tests/.
  2. PyAutoBrain/agents/conductors/cortex/_cortex.py: birth_row(projects, key, category, assistant, …) derives the fields. The Science root comes from science_root_from. The RAL base is the most common <base> of the category-shaped ral_roots. Remote from git remote get-url origin → owner/repo. sync_verbs from the hpc/sync case labels. Ledger wiki/project/state.md → README.md fallback. cmd_birth dry-run prints the row. --apply: push_preflight, cut claude/birth-<key>, subprocess cortex.py birth, commit, ledger_merge.py classify --base origin/main (push only on 0), back to main, then drift_report filtered to the key.
  3. skills/cortex (Brain): a "Starting a new project" section.
  4. Docs: Cortex REFERENCE.md, AGENTS.md, docs/schema_decisions.md 63; conductor AGENTS.md.
  5. Tests: Brain conductor (derivation, dry-run writes nothing, refusals: no folder, existing key or path, wrong category) and Cortex (birth appends, rolls back, refuses duplicates).
  6. Verify end-to-end on a throwaway Cortex clone, never the real main: scaffold a dummy project dir, birth --apply --no-push, then drift is clean for it.

Key Files

  • PyAutoCortex/scripts/cortex.py, PyAutoCortex/tests/
  • PyAutoBrain/agents/conductors/cortex/_cortex.py, PyAutoBrain/tests/test_cortex_conductor.py, PyAutoBrain/skills/cortex/

Original Prompt

Click to expand starting prompt

Cortex birth: scaffold, seed and register a Science project in one step

Type: feature
Target: cortex
Repos:

  • PyAutoBrain
  • PyAutoCortex
    Themes:
  • science
  • cortex
    Difficulty: medium
    Autonomy: human-required
    Priority: high
    Status: formalised
    Consequence: judge
    Filed: 2026-10-29
    Parent: complete/2026/10/cortex-science-drift.md

Original request (verbatim)

"5) Bring this all together with PyAutoCortex which needs to become the main tool to manage Science
projects, its meant to be but hasnt been used as such for a while."

Follow-up (2026-10-29), approving the proposed next steps including "a new-project command that
scaffolds a project in active/ or development/, seeds it from dataset/ or simulators/ and
registers it in one step": "yeah do it", then "Merge, then Phase 2".

Context

Phase 1 (cortex drift, PyAutoBrain#544) shipped 2026-10-29: the register and the Science tree are
now compared on every census/check-in. Today a new project is started by hand-copying an older one,
so it gets no row and the drift check reports it as unregistered. Science layout:
/mnt/c/Users/Jammy/Workspace/Science/{active,development,complete,archive,dataset,simulators};
simulators share --dataset-path / --dataset-types (Science/simulators/AGENTS.md).

Scope (revised 2026-10-29, human-approved: "yes, file it and go")

Scaffolding stays with the domain assistant: autolens_assistant / autofit_assistant
skills/start-new-project.md is the single science-project skill, and the public assistants must
not learn the private Science tree or the Cortex. The Cortex adds only the registration half:

  • pyauto-brain cortex birth <key> --category active|development --assistant <name> --summary "<one line>" [--issue Repo#N] [--apply]: checks Science/<category>/<key>/
    exists and has no row; derives local_path, ral_root (<ral base>/<category>/<key>, base
    from the other rows), sync_cli / sync_verbs from the scaffolded hpc/sync, partition,
    witness_file and remote (git origin or none); writes the row and runs cortex.py new
    on a claude/birth-<key> branch (an add-only birth diff, which lands by itself); then runs
    drift for the new project. Dry run by default. Never creates a GitHub remote or touches RAL;
    it prints those lines for the human.
  • The Brain's cortex skill gains a "new project" section: run the assistant's
    start-new-project with the target Science/<category>/<key>, seed dataset/ from
    Science/dataset/<sample> or Science/simulators/<type>/<lens>.py --dataset-path dataset,
    then cortex birth.
  • Docs: Cortex REFERENCE.md (birth) and schema decision 63.

Out of scope

Moving trees on RAL; output summaries on the board (draft/feature/cortex/output_summary.md).

Activity

  1. Jammy2211 commented on Oct 29, 2026

    @Jammy2211
    ContributorAuthor

    Library PRs created

    Workspace impact: none (organ tooling). Tier judge: the human merges with /prm.

    Open question: should a development/ birth's RAL path be .../development/<key> (mirroring the laptop, as drift expects) or stay under RAL active/ like the four existing development projects?

    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

  2. Jammy2211 commented on Oct 29, 2026

    @Jammy2211
    ContributorAuthor

    Shipped

    Merged on 2026-10-29: PyAutoLabs/PyAutoCortex#79 (cortex.py birth), then #546 (cortex birth verb plus the /cortex "Start a new project" section). The CI failure on #546 was the tenant firewall catching real owner and assistant names in new tests. Fixed with neutral names; CI green.

    The open question is resolved by the human: mirror on RAL. PyAutoLabs/PyAutoCortex#80 moved the four development trees and euclid on RAL, registered the storage folders as retired, and repointed concr. cortex drift on main: none — projects.yaml and the Science tree agree.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions