Repository navigation
cortex conductor: census, dashboard, plan, gates, collect and the Mind badge — cortex-birth phase 2 (PyAutoMind#380) - #330
Merged
Conversation
…the Cortex, part A (PyAutoMind#380) The Cortex holds the science state; this is the conductor that reasons over it — the same split as Heart ↔ vitals and Gut ↔ hygiene. It renders the Cortex board, grades the gates and admits ready phases into a laptop slot. It never submits a run and never writes a ruling. - `agents/conductors/cortex/` — the conductor. `_cortex.py` is stdlib-only and Mind-free (the renderer runs bare inside the Cortex's own `dashboard_refresh.yml`, which installs nothing and checks out no Mind, so `_sizing`/`_intake` — which hard-fail without a body map — are copied from, never imported). `<cortex_root>/scripts/cortex.py` is imported at runtime as the schema API, so the conductor always reasons with the schema the checkout it is pointed at implements. No path is named in the code: every science path the board prints comes from a `projects.yaml` row. - Verbs: `census [--json]`, `dashboard --check|--apply`, `plan [--budget N] [--lane L]`, `gates [--grade] [--apply]` (a thin wrapper over the Cortex script's own `gates_report`, so the daily grading job needs no Brain), and `collect`, which slice B fills in. - The board's `--check` strips the generation comment **and** the visible `Last updated` banner, so a re-render on a new date is not drift — the Mind's normaliser strips only the comment, which is why its refresh self-heals with an empty commit most nights. - Board family: `policy.yaml boards:` gains the Cortex, `_theme` gains its palette (`#a5177d` / `#ff7ad9`, 6.96:1 and 8.14:1) and its mark, and `_board.collect_cortex()` composes the Cortex's own counts into the morning Resume strip (silently absent when no Cortex is checked out). - `resolve_cortex()` in `agents/_common.sh`; `bin/_pyauto_root.sh` learns PyAutoCortex (it had drifted from `agents/_pyauto_root.py`). - `tests.yml` checks out a third repo: the conductor's tests render against PyAutoCortex's own `tests/fixtures/skeleton`, the fixture that IS the schema's witness, and skip cleanly when it is absent. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SESCzU1FcwktEAdTZfmf3j
…Mind#380)
`cortex collect` scores what a pull brought back into packet member blocks,
and the Mind's in-flight rows say when a task gates a science phase.
`collect [--slot S] [--pull] [--refreshed ISO] [--apply] [--out F]
[--phase REL]` reads the batch record's live members (phase `submitted` or
`running`), finds their logs and run dirs under the project's `mirror` then
`local_path` — from `projects.yaml`, never a literal — and scores six legs,
each PASS / FAIL / UNOBSERVABLE with a one-line detail:
- `err` benign = every non-blank line is a `*Warning*` line or its indented
continuation (not size 0); Traceback/Error/Killed/OOM ⇒ FAIL
- `wall` the `.out`'s first/last stamps when it ends `Finished.`, else
`Time To Run` from `search.summary` read out of the `<hash>.zip` —
authoritative, because an extracted run dir can be a stale partial
- `version` a top-level `version` key in a JSON matching `witness_file`
- `checkpoint` `<root>/.cortex/pull.json` only; absent ⇒ UNOBSERVABLE `RAL only`
- `resume` `Fit Already Completed` / `Resuming … previous samples found` ⇒ FAIL
- `witness` a `witness_file` match newer than the phase's first submission
HEALTH is FAILED on any FAIL, SUSPECT on any UNOBSERVABLE, else HEALTHY;
`delivered:` counts the HEALTHY ones and the verb exits 1 when any member
needs the human. Two of the four `delivered:` legs are simply not visible on
the laptop today, so they are UNOBSERVABLE rather than invented PASSes or
unprovable FAILs. `--pull` runs the project's own `<sync_cli> pull` (printed
first — the only thing here that reaches the cluster) and stamps the refresh;
`--apply` moves each member `running → pulled → awaiting-ruling`, appends its
`- refreshed:` line and rewrites the member `<state>`, rehearsed on a
throwaway copy of the tree and refused outright if `cortex.py check` would
not pass afterwards. The `Ruling` line is left blank: the verdict is the
human's.
The Mind badge is render-only and import-free: `_intake.py` probes
`$PYAUTO_CORTEX` then `PyAutoCortex` beside the Mind, reads each phase's
`Gates:` with a local copy of the Cortex's `GATE_REF_RE` (short-form owner
from the Mind's own `repos.yaml`), and badges the in-flight rows whose issue
a phase is waiting on — md and html. No Cortex checkout, no badge, no error.
20 new tests (three-member tmp board with both laptop layouts, zip-over-stale
extraction, the unobservable legs, apply/refuse/pull, the badge's four
paths); `pytest tests -q` 741 passed; tenant firewall green.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SESCzU1FcwktEAdTZfmf3j
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Brain side of the Cortex — phase 2 of the
cortex-birthepic (PyAutoLabs/PyAutoMind#380). A new conductoragents/conductors/cortex/gives the science registry a view and a driver:cortex census/dashboard --check|--apply— a stdlib Markdown+HTML renderer (sections: Awaiting ruling → Running/submitted → Ready → Gated → Recent rulings → Epics → Projects, plus the counts table the Brain board reads). The normaliser strips the generated comment AND theLast updatedbanner so a no-op night commits nothing (the Mind renderer's daily self-heal drift is not inherited). Page home derived from the repo's own README/AGENTS links so CI and laptop renders are byte-identical.cortex plan— laptop-slot admission:State: ready+ witness + budget +local-dev; a cloud session reports the ready count and plans nothing; greedy by review-minutes against--budget; the launch payload carries no decision. No autonomy cap consulted.cortex gates --grade [--apply]— thin wrapper over the Cortex script'sgates_report(--apply→--write); the daily grading job lives in the Cortex repo and needs no Brain checkout.cortex collect— scores pulled runs from the laptop tree only: six legs (err,wall,version,checkpoint,resume,witness) each PASS / FAIL / UNOBSERVABLE (two legs are laptop-invisible until phase 3's pull manifest); HEALTH = FAILED / SUSPECT / HEALTHY; emits the packet member block;--pullopt-in runs the project's own sync CLI;--applymovesrunning → pulled → awaiting-rulingand appendsrefreshed:lines, rehearsed on a temp copy and re-checked after writing. The<hash>.zipoutranks a stale extracted run dir._intake.pyprobesPYAUTO_CORTEX/ a siblingPyAutoCortexand badges in-flight prompts whose issue a CortexGates:names ("gates a Cortex phase → "). Render-only, no new imports, silent when absent.policy.yamlcortex: PyAutoCortex, theme palette (6.96:1 / 8.14:1 contrast) + mark,collect_cortex()Resume strip. Skillsskills/cortex/, COMMANDS row, regenerated command surface,resolve_cortex,_pyauto_is_rootdrift fix,tests.ymlthird checkout (PyAutoCortex)._cortex.pyis stdlib-only and Mind-free (an AST test pins the import set); it imports<cortex>/scripts/cortex.pyat runtime. Merge before PyAutoCortex#2 and PyAutoMind's follow-up — both dashboard workflows render against Brain main.Scripts Changed
agents/conductors/cortex/{AGENTS.md,cortex.sh,_cortex.py}(new, ~1930 lines)agents/conductors/intake/_intake.py— the badgeboard/_theme.py,board/_board.py,config/policy.yaml— board familybin/pyauto-brain,AGENTS.md(generated block),agents/_common.sh,bin/_pyauto_root.shskills/cortex/{SKILL.md,cortex.md},skills/COMMANDS.md,docs/organs/cortex.md.github/workflows/tests.ymltests/test_cortex_conductor.py(new, 43 tests),tests/test_intake_dashboard.py(+6),tests/test_board.py(+1)Test Plan
pytest tests -q→ 741 passed (both Python legs in CI, with the Cortex checkout)bin/install.sh --check-agents-surfaceOK;check_skill_line_counts.sh(pre-existingprmoverrun only)cortex dashboard --applythen--checkclean on the phase-1 skeleton fixture (the witness)Generated by the PyAutoLabs agent workflow.