Skip to content

cortex conductor: census, dashboard, plan, gates, collect and the Mind badge — cortex-birth phase 2 (PyAutoMind#380) - #330

Merged
Jammy2211 merged 2 commits into
mainfrom
feature/cortex-conductor
Sep 2, 2026
Merged

Jammy2211 merged 2 commits into
mainfrom
feature/cortex-conductor

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

The Brain side of the Cortex — phase 2 of the cortex-birth epic (PyAutoLabs/PyAutoMind#380). A new conductor agents/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 the Last updated banner 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's gates_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; --pull opt-in runs the project's own sync CLI; --apply moves running → pulled → awaiting-ruling and appends refreshed: lines, rehearsed on a temp copy and re-checked after writing. The <hash>.zip outranks a stale extracted run dir.
  • Mind badge — _intake.py probes PYAUTO_CORTEX / a sibling PyAutoCortex and badges in-flight prompts whose issue a Cortex Gates: names ("gates a Cortex phase → "). Render-only, no new imports, silent when absent.
  • Board family: policy.yaml cortex: PyAutoCortex, theme palette (6.96:1 / 8.14:1 contrast) + mark, collect_cortex() Resume strip. Skills skills/cortex/, COMMANDS row, regenerated command surface, resolve_cortex, _pyauto_is_root drift fix, tests.yml third checkout (PyAutoCortex).

_cortex.py is stdlib-only and Mind-free (an AST test pins the import set); it imports <cortex>/scripts/cortex.py at 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 badge
  • board/_theme.py, board/_board.py, config/policy.yaml — board family
  • bin/pyauto-brain, AGENTS.md (generated block), agents/_common.sh, bin/_pyauto_root.sh
  • skills/cortex/{SKILL.md,cortex.md}, skills/COMMANDS.md, docs/organs/cortex.md
  • .github/workflows/tests.yml
  • tests/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-surface OK; check_skill_line_counts.sh (pre-existing prm overrun only)
  • tenant firewall leg OK
  • cortex dashboard --apply then --check clean on the phase-1 skeleton fixture (the witness)
  • CI green on this PR

Generated by the PyAutoLabs agent workflow.

Jammy2211 and others added 2 commits September 1, 2026 19:21
…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
@Jammy2211
Jammy2211 merged commit fcfb918 into main Sep 2, 2026
3 checks passed
@Jammy2211
Jammy2211 deleted the feature/cortex-conductor branch September 2, 2026 00:04
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.

1 participant