Skip to content

Latest commit

 

History

History
188 lines (160 loc) · 10.7 KB

AGENTS.md

File metadata and controls

188 lines (160 loc) · 10.7 KB

PyAutoCortex — Agent Guidance

This file is for AI coding agents (Claude Code, Codex, Cursor, etc.) and humans discovering this repository. PyAutoCortex is the Cortex organ of the PyAuto organism — where the organism keeps track of what is true.

You are one peer organ of the PyAuto organism (human-led, natural-language software development), not a part of another. Boundaries: PyAutoBrain/ORGANISM.md; every repo: PyAutoMind/repos.yaml.

Organ Repo Role
Brain PyAutoBrain Reasoning and orchestration: decomposes and routes work through its conductors and faculties.
Broca PyAutoBroca Assistant evaluation history, upkeep evidence and its dashboard.
Mind PyAutoMind Intent, priorities and workflow state; every task starts as a prompt here.
Cortex PyAutoCortex What is true in the science: the project body map and one ledger per project.
Memory PyAutoMemory Long-term scientific, software and project knowledge.
Eyes PyAutoEyes Cross-project figure dashboard over the <lib>_visualization repos.
Ears PyAutoEars Read-only community listening: conversation snapshots and coverage.
Heart PyAutoHeart Health/readiness — the authoritative release verdict.
Hands PyAutoHands Packaging, tagging, notebooks and PyPI release execution.
Pulse PyAutoPulse Cross-project profiling dashboard over the <lib>_profiling repos.
Insight PyAutoInsight Inference campaign intent, instance registry and evidence dashboard.
DNA PyAutoDNA Software-stack specifications, environment inventories and upgrade campaigns.
Nerves PyAutoNerves Configuration/serialization layer (autonerves): layered config, version handshake, test_mode.
Gut PyAutoGut Condemned branches, stashes and dead code, held as recoverable refs until swept.

Call chain: Brain → Heart (gate) → Build (execute). Conductors decide and act; faculties judge read-only and stop. New capability grows as a faculty, not an organ, unless it owns state or effects no organ can.

Generated from PyAutoMind/repos.yaml + PyAutoBrain/ORGANISM.md; edit there, then run python3 PyAutoMind/scripts/repos_sync.py --write.

What this repo is

The Mind decides what to build, the Brain routes the work and executes nothing, the Cortex keeps track of what is true. The Cortex is a project ledger: project → runs → log. It holds the science body map (projects.yaml: every science project, its laptop and RAL paths, how it syncs) and one ledger per project (projects/<key>.md: a Now, the Runs on the cluster, and a Log that only ever gets longer).

It is not a second PyAutoMind and not a task tracker (schema decision 60): no state machine, no witness, no verdict. Nothing in a ledger is inferred from results — run submission, start and end are cluster facts the script records; a result or lesson is the human's own words, written on their ask.

Schema, line grammars, every scripts/cortex.py verb, the projects.yaml fields, the merge classification, check-in and the board are in REFERENCE.md. Every choice is dated in docs/schema_decisions.md; read decisions there, do not re-derive them.

Layout

  • projects.yaml — the body map. Code, not ledger: sync_cli and local_path are paths a conductor executes under, so editing or dropping a row is a human's turn. Exception: a birth (add-only rows, each with its ledger in the same push, via cortex.py birth) lands by itself.
  • projects/<key>.md — one ledger per project; projects/AGENTS.md is the folder's doctrine. Every status: active row must have one.
  • archive/ — frozen 2026-08/09 ledgers the science repos cite. Never written; any change under it is code.
  • checkin.yaml — refreshed:, the last real check-in (not the last render); the board reddens it after an hour.
  • scripts/cortex.py — the one lifecycle script; every ledger write goes through a verb (REFERENCE.md "the verb reference").
  • dashboard.md / dashboard.html — generated by the Brain's cortex conductor and self-healed on main; never hand-edited.
  • scripts/ledger_merge.py — the default-deny classifier behind ledger_merge.yml: a claude/** push whose whole diff is ledger lands on main by itself; anything else waits for a human. python3 scripts/ledger_merge.py classify --base origin/main predicts the verdict.

Driving the Cortex

The reasoning lives in the Brain's cortex conductor (pyauto-brain cortex <verb>, or python3 PyAutoBrain/agents/conductors/cortex/_cortex.py <verb> --cortex <checkout>). It splits where the machines split: pull shows what the cluster says and runs on the laptop only (every local_path is a laptop path; elsewhere it exits 2 and says so); checkin stamps, re-renders and pushes on any surface and reaches no cluster. census, drift, dashboard, issue and birth are the rest; pyauto-brain help cortex has each. The conductor's writing flag is --apply; cortex.py verbs write directly.

Nothing here submits a job by itself. A submission is made only on the human's ask, with the project's own sync_cli submit, followed at once by cortex.py run <project> <jobid> "<what>". running / done may be typed from what jobs printed (cluster facts). CPU-only arrays go on ral, never gpu (human rule, 2026-09-30); call a run GPU only after scontrol show job shows gres/gpu (REFERENCE.md → partition).

Only dashboard_refresh.yml (the two pages) and ledger_merge.yml (ledger branches) write to main; cortex_check.yml and pages_dashboard.yml write nothing. No scheduled job mutates the ledger. The board is https://pyautolabs.github.io/PyAutoCortex/.

The workspace-paths exception

The Cortex is the one organ with paths outside the workspace, confined to projects.yaml: local_path and mirror are absolute laptop paths (the Science folder under /mnt/c/…) where datasets and output/ live. A ledger points into a project only through its row, never with a bare absolute path. Every Cortex project runs from the laptop: RAL as canonical home, a login-node courier, Globus/self-hosted runners and SSH from a Claude container were all refused — see PyAutoMind/complete/archive/shelved/batch_science_lane.md before reopening any of them.

Hard rules

  1. Never rewrite history on any branch with a remote (block below).
  2. Pull before edit. git fetch && git status first, every time.
  3. Never write a result or a lesson the human did not say. Cluster facts (run, running, done) are the script's to record; meaning is the human's.
  4. Never edit a ledger by hand in a session. Every write is a scripts/cortex.py verb, and python3 scripts/cortex.py check runs before you push; ledger_merge.yml runs it on the trial-merge tree and a failing check leaves the branch for a human.
  5. Never touch archive/. It is frozen; the merge gate refuses it.
  6. No hand-written HTML. dashboard.html is rendered by the cortex conductor; a hand edit is drift that dashboard_refresh.yml will overwrite.

Remote sessions (Claude Code on web and mobile)

Three facts, measured in a web/mobile container. A session holding several organs is cwd'd at the repos' parent, where no project hook fires, so nothing has set it up — this block is what does.

  • Bootstrap in the first turn, unconditionally — before the first test command, not as a remedy: bash PyAutoMind/scripts/session_bootstrap.sh (--check reports only). It supplies pytest/PyYAML/xdist and unshallows the clones, without which git merge-base --is-ancestor calls a merged branch "not an ancestor" and the close-out acts on it.
  • Run the suite in parallel: python3 -m pytest -q -n auto (4 cores, ~3.5x).
  • There is no gh, and installing one does not help — it authenticates, then 403s every repo-scoped call through the egress proxy. GitHub is the mcp__github__* tools; PyAutoBrain/skills/GITHUB_ACCESS.md maps each gh operation onto its tool and is the one full page on the subject.

Never rewrite history

Never rewrite pushed history on any repo with a remote — no git init over a tracked repo, no force-push to main, no fresh-start "Initial commit", no filter-repo / filter-branch / rebase -i on pushed branches. To get a clean tree: git fetch origin && git reset --hard origin/main && git clean -fd.

Sessions end at their deliverable

A session ends when it reports its deliverable — never arm anything that outlives the turn to wait for CI, a review or a merge: no send_later, no subscribe_pr_activity, CronCreate, ScheduleWakeup, /loop, RemoteTrigger create/update/run, or Monitor or background loop on GitHub. Judge once, report, stop; the human re-runs /prm (or the batch review) when it is green. The one exception, the shift cockpit's stream: PyAutoMind policy/shift_cockpit_watch.md. Measured: five batch members armed hourly check-ins on 2026-08-31, and a mobile /prm re-armed a 60-minute send_later all night on 2026-09-03, draining usage.

Where to file

Questions, help with code or an analysis, ideas, bug reports and results from a user or collaborator — or an agent acting for one — go to https://github.com/orgs/PyAutoLabs/discussions in the matching category (Help & Questions, Ideas & Proposals, Bugs & Errors, Show and tell; Announcements is maintainers-only), never to this repo's Issues. An agent never runs gh issue create for such a report: it drafts the title, category and body and hands them to the human (sessions cannot create Discussions). Only the development flow — Mind prompt → /start_dev → /create_issue → one issue per task → PR — opens issues here. Why: PyAutoMind/policy/community_surface.md.

Shared standards

Before changing a shared interface, consult the applicable organism standard on demand, identify affected consumers, and validate their adoption. Change generated guidance at its canonical source and regenerate.

For board changes, follow the applicable sizing, navigation and orchestration standards and reuse Brain’s shared components. Keep domain data, prompt meaning and approval boundaries with the board’s owner.