From 8bb6257f752614c202e537ece15b40d66a6fbca1 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 17 Sep 2026 19:54:24 +0000 Subject: [PATCH 1/4] =?UTF-8?q?docs:=20fix=20organism=20drift=20=E2=80=94?= =?UTF-8?q?=20Cortex=20row,=20organ=20counts,=20one=20gh=20pointer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ORGANISM.md ("the one canonical page") still described the Cortex's pre-decision-60 rulings/verdict model; it now says one ledger per project, cluster facts and the human's words, never a verdict. docs/concepts/organism.md gains the missing Nerves row, README/docs stop hard-coding a conductor count and spell the call chain's last step "Build" as ORGANISM.md does; COMMANDS.md lists batch/clone/release and the four unlisted composition doors. The 4-line "no gh on a remote session" banner in 16 skill files collapses to one line pointing at skills/GITHUB_ACCESS.md (the single full page); the retirement notices restated in five places are cut to one. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_018AWgNfNwvJMi6s7MWBeVJ2 --- ORGANISM.md | 14 ++++----- README.md | 6 ++-- board/AGENTS.md | 16 +++++----- docs/concepts/agents.md | 15 +++------- docs/concepts/organism.md | 16 +++++----- docs/organs/cortex.md | 13 ++++---- docs/satellites.md | 2 +- skills/COMMANDS.md | 30 ++++++++++++++----- skills/OPERATIONS.md | 4 +++ skills/health/health.md | 6 ++-- skills/intake/intake.md | 4 +-- skills/issue_cleanup/issue_cleanup.md | 6 +--- skills/issue_cleanup/reference.md | 6 +--- skills/repo_cleanup/SKILL.md | 6 +--- skills/repo_cleanup/reference.md | 6 +--- skills/ship_library/reference.md | 8 ++--- skills/ship_library/ship_library.md | 6 +--- skills/ship_workspace/reference.md | 6 +--- skills/ship_workspace/ship_workspace.md | 6 +--- skills/start_dev/reference.md | 6 +--- skills/start_dev/start_dev.md | 6 +--- skills/start_dev_for_user/reference.md | 6 +--- .../start_dev_for_user/start_dev_for_user.md | 6 +--- skills/start_library/start_library.md | 6 +--- skills/start_workspace/reference.md | 6 +--- skills/start_workspace/start_workspace.md | 6 +--- skills/update_issue/SKILL.md | 6 +--- 27 files changed, 89 insertions(+), 135 deletions(-) diff --git a/ORGANISM.md b/ORGANISM.md index 0f909bb4..3253f6a9 100644 --- a/ORGANISM.md +++ b/ORGANISM.md @@ -14,7 +14,7 @@ organs plan, build, test and release it, and you make every judgment call. |-------|------|-------------------| | **Brain** | PyAutoBrain | Figures out *how* — reasoning, planning, decomposition, routing; hosts the specialist agents. Owns **no state, no health checks, no execution mechanics**. | | **Mind** | PyAutoMind | Decides *what* — intent, goals, priorities, workflow state, the prompt registry and taxonomy. Also holds the body map (`repos.yaml`, the single source of repo identity). | -| **Cortex** | PyAutoCortex | Learns *what is true* — the science body map (`projects.yaml`) and the rulings of record for every science run; the science mirror of the Mind (runs and rulings ↔ prompts and PRs). The Mind decides what to build, the Brain routes the work and executes nothing, the Cortex learns what is true. A verdict recorded only outside the Cortex does not exist: project ledgers are commentary that cite the ruling. | +| **Cortex** | PyAutoCortex | Keeps track of *what is true* — the science body map (`projects.yaml`) and **one ledger per science project** (`## Now`, the `## Runs` on the cluster, a `## Log` that only gets longer); the science mirror of the Mind (runs and a dated log ↔ prompts and PRs). Not a task tracker: it records cluster facts and the human's words, never a verdict of its own. | | **Memory** | PyAutoMemory | Long-term knowledge — *what the science says* (literature wikis, concepts, bibliographies). Operational history — *what the organism did* — lives in Mind (the `complete/` records, issues), not here. | | **Heart** | PyAutoHeart | Determines whether the organism is healthy. `pyauto-heart readiness` is the **authoritative** GREEN/YELLOW/RED "is it safe to release?" gate. An observer: never writes into other repos, never triggers Build. | | **Hands** | PyAutoHands | Builds and releases — packaging, tagging, notebook generation, PyPI via `release.yml`. A pure executor: runs no readiness checks and never re-derives a gate decision. | @@ -69,9 +69,9 @@ install wiring, a body-map row and boundary prose — it must earn that by owning state or effects no existing organ can. Two capabilities have earned organ status that way. Configuration/signalling is the **Nerves** (PyAutoNerves), the base config/serialization layer every library imports — new -config surfaces belong there, not in a new organ. Learning what is true is the -**Cortex** (PyAutoCortex), the second organ to earn it: it owns state no organ -owned before — the science body map and the rulings of record — so science -runs and their verdicts belong there, not in the Mind. The human interaction -layer is the command surface (`/route` + the verb commands), which is part of -Brain. +config surfaces belong there, not in a new organ. Keeping track of what is +true is the **Cortex** (PyAutoCortex), the second organ to earn it: it owns +state no organ owned before — the science body map and the per-project +ledgers — so science runs and the human's notes on them belong there, not in +the Mind. The human interaction layer is the command surface (`/route` + the +verb commands), which is part of Brain. diff --git a/README.md b/README.md index c503753b..9d5922dd 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ fresh when you wake. You drive it in plain English, through short slash commands in a Claude Code chat: `/intake` to file an idea, `/start_dev` to begin a task, `/health` for a check-up — or just `/route ` and the Brain picks the right -door. The full command surface (13 conductors + 5 faculties) is the generated -table in [AGENTS.md](AGENTS.md). +door. The generated table in [AGENTS.md](AGENTS.md) is the roster — every +conductor and faculty, regenerated from the router. 1. **A task arrives.** Usually from the Mind's backlog — pick a task on the [PyAutoMind dashboard](https://pyautolabs.github.io/PyAutoMind/) and paste @@ -43,7 +43,7 @@ table in [AGENTS.md](AGENTS.md). knows, `review` judges a branch. A conductor never consults another conductor — an opinion worth sharing becomes a faculty. 4. **The organs execute.** Always in the same order — **Brain → Heart (gate) - → Hands (execute)**: work happens on task worktrees, ships as pull + → Build (execute)**: work happens on task worktrees, ships as pull requests behind the Heart's health verdict, and is packaged and released by the Hands. 5. **Autonomy is a contract.** How much a run may do without a human is diff --git a/board/AGENTS.md b/board/AGENTS.md index bce2d773..5532b22e 100644 --- a/board/AGENTS.md +++ b/board/AGENTS.md @@ -133,10 +133,12 @@ Env: `PYAUTO_ROOT` (workspace root holding `PyAutoMind/`), `BOARD_GH` A Claude Code remote session (web/mobile) cannot reach either of the board's data sources by default: -- **`gh` is not installed.** The overnight sweep, the version stamps, the - community scan and the pending-release search all run through it. Without it - they cannot ask — which is not the same as asking and getting nothing, and - the render now says so (`could not read`, never `no runs`). +- **`gh` is not installed**, and installing one does not help + ([`../skills/GITHUB_ACCESS.md`](../skills/GITHUB_ACCESS.md) has the measured + reason). The overnight sweep, the version stamps, the community scan and the + pending-release search all run through it. Without it they cannot ask — which + is not the same as asking and getting nothing, and the render now says so + (`could not read`, never `no runs`). - **The sibling Pages boards are refused by the egress policy.** The proxy answers `403` to `CONNECT` for `.github.io`, so `board.json` and `badge.json` — the Heart's readiness surface among them — are unreadable. @@ -201,9 +203,9 @@ Three rules the seam does not get to bend: The alternative to the seam is an org admin connecting the Claude GitHub App, after which `$GH_TOKEN` would work from a subprocess and `gh_json()` could -become a plain REST helper on every surface. Probed 2026-08-27: 200 on `/user` -and `/rate_limit`, **403 on every repo-scoped path**. Re-probe before assuming -this seam is still needed — it is meant to be deletable. +become a plain REST helper on every surface. It did not when it was measured +(`../skills/GITHUB_ACCESS.md`). Re-probe before assuming this seam is still +needed — it is meant to be deletable. To get a complete board in a remote session, the environment needs outbound access to the Pages host. That is cloud-environment configuration on claude.ai, diff --git a/docs/concepts/agents.md b/docs/concepts/agents.md index 6b68adea..72641116 100644 --- a/docs/concepts/agents.md +++ b/docs/concepts/agents.md @@ -12,17 +12,10 @@ question: **does it act, or only opine?** conductors consult. They return a judgment and stop — never dispatch, never mutate. -The live conductor set: **intake** (raw idea → formal Mind prompt), -**feature** (plan the next growth task), **bug** (classify and route a -repair), **refactor** (behaviour-preserving restructuring), **workspace** -(the Voice — plan workspace + HowTo example authorship), **profiling** -(the organism's sense of its own effort), **hygiene** (the organism's sense -of its own upkeep), **clone** (reproduce a mature assistant into a new -cell), **build**, **release**, and **health** (the clinician loop toward -GREEN). The faculties behind them: -**vitals** (the only component that talks to Heart), **review** (the -automatic-review leg of the ship gate), **memory** (cited digests over the -Memory organ), and **samplers** (domain expertise for the live instance). +The live roster is never listed twice: the verb table in the Brain's +[AGENTS.md](https://github.com/PyAutoLabs/PyAutoBrain/blob/main/AGENTS.md) is +generated from the router (`bin/pyauto-brain`), so it cannot drift from the +agents that exist. Each agent's own `AGENTS.md` carries its full role. ## The consult graph is a DAG diff --git a/docs/concepts/organism.md b/docs/concepts/organism.md index 9f766241..b5846160 100644 --- a/docs/concepts/organism.md +++ b/docs/concepts/organism.md @@ -11,10 +11,11 @@ it and adds the framework/instance distinction an adopter needs. |-------|------|-----| | **Brain** | PyAutoBrain | Figures out *how* — reasoning, planning, routing; hosts the specialist agents. Owns no state, no health checks, no execution mechanics. | | **Mind** | PyAutoMind | Decides *what* — intent, goals, priorities, workflow state, the prompt registry, and the body map (`repos.yaml`). | -| **Cortex** | PyAutoCortex | *Learns what is true* — the science body map (`projects.yaml`) and the rulings of record for every science run; the science mirror of the Mind (runs and rulings ↔ prompts and PRs). The Mind decides, the Brain routes, the Cortex learns; a verdict recorded only outside the Cortex does not exist. | +| **Cortex** | PyAutoCortex | *Keeps track of what is true* — the science body map (`projects.yaml`) and one ledger per science project (`## Now`, the `## Runs` on the cluster, a `## Log` that only gets longer); the science mirror of the Mind (runs and a dated log ↔ prompts and PRs). Not a task tracker: it records cluster facts and the human's words, never a verdict of its own. | | **Memory** | PyAutoMemory | *Knows* — long-term domain knowledge: literature wikis, concepts, bibliographies. Pull-only; consulted, never load-bearing at runtime. | | **Heart** | PyAutoHeart | Decides whether the organism is *healthy*. `pyauto-heart readiness` is the authoritative GREEN/YELLOW/RED release gate. An observer: never writes into other repos, never triggers a build. | | **Hands** | PyAutoHands | *Does* — packaging, tagging, notebook generation, PyPI releases. A pure executor: never re-derives a gate decision. | +| **Nerves** | PyAutoNerves | *Connects* — the configuration/serialization layer (`autonerves`): layered config, the workspace↔library version handshake, `test_mode`, FITS/JSON I/O. The base layer every library imports. | | **Gut** | PyAutoGut | *Sheds* — the lifecycle of condemned self-material (stale branches, stashes, dead code/tests): holds each as a durable, recoverable git ref through a transit window, then **voids** it on a sweep. The storage mirror of Memory (retention ↔ release); the hygiene conductor drives it, as vitals reads Heart. | Everything else — the libraries being developed, their example workspaces, @@ -25,13 +26,14 @@ organism expects of each are the {doc}`category contract <../satellites>`. ## The call chain ``` -Brain → Heart (gate) → Hands (execute) +Brain → Heart (gate) → Build (execute) ``` -Always in that order. The Brain asks Heart for the readiness verdict, -reasons over it, and only on GREEN triggers the Hands. Heart never triggers -a build; the Hands never re-check readiness. Each boundary exists so that no -organ has to be trusted to police itself. +Always in that order — *Build* is the call-chain step, the Hands are the +organ that performs it (ORGANISM.md). The Brain asks Heart for the readiness +verdict, reasons over it, and only on GREEN triggers Build. Heart never +triggers a build; the Hands never re-check readiness. Each boundary exists so +that no organ has to be trusted to police itself. ## Framework vs instance @@ -41,7 +43,7 @@ The organs split on one line that matters for adoption: pipelines. Domain facts appear only in declared config surfaces (tables and policy files, not logic), and a drift check — the {ref}`tenant firewall ` — keeps it that way. -- **Instance organs — Mind, Cortex, Memory, Gut.** Committed state, rulings, +- **Instance organs — Mind, Cortex, Memory, Gut.** Committed state, ledgers, knowledge, and shed material. These are *inherently yours*: an adopter never forks the upstream Mind, Cortex, Memory or Gut content, they create their own repos with the same documented shape. diff --git a/docs/organs/cortex.md b/docs/organs/cortex.md index 997eb8d3..5924f8f0 100644 --- a/docs/organs/cortex.md +++ b/docs/organs/cortex.md @@ -65,15 +65,18 @@ same split as **Heart ↔ vitals** and **Gut ↔ hygiene**. | Verb | What it does | |------|--------------| -| `checkin [--dry-run \| --apply] [--push \| --no-push] [--project KEY] [--skip-pull]` | **The door.** Pull every active project through its own sync CLI (streamed; one project's failure does not stop the sweep), print each project's `jobs` output verbatim where its ledger lists runs, stamp `checkin.yaml`, re-render the board, push the ledger where the rule allows, and print a summary **by project** — Now, the runs, the last entries, the `cortex.py` lines likely typed next. `--dry-run` (the default) says what it would do and reaches nothing | +| `pull [--project KEY] [--dry-run]` | **The laptop leg.** Pull every active project through its own sync CLI (streamed; one project's failure does not stop the sweep) and print each project's `jobs` output verbatim. Writes nothing; where no `local_path` exists (web, mobile) it exits 2 and says so | +| `checkin [--dry-run \| --apply] [--push \| --no-push] [--project KEY]` | **The door, on any surface.** Stamp `checkin.yaml`, re-render the board, push the ledger where the rule allows, and print a summary **by project** — Now, the runs as the ledger holds them, the last entries, the `cortex.py` lines likely typed next. Shells out to no sync CLI. `--dry-run` (the default) writes nothing | | `census [--json]` | What the Cortex is holding — per project: status, runs by state, log length, last update; the totals; the last check-in stamp | | `dashboard --check` \| `--apply` | The generated board, `dashboard.md` + `dashboard.html`. `--check` exits **1** on drift — the contract the Cortex's `dashboard_refresh.yml` runs on. The two pages are generated: never hand-edit them | | `issue [--project KEY] [--apply]` | The concise ledger block (Now, Runs, the last five) that sits at the top of each project's GitHub issue, between two markers; `--apply` writes it there through `gh` — never creates an issue | -**Checking in is one command.** `pyauto-brain cortex checkin --apply` pulls, -shows, renders and pushes on `claude/checkin-` when `gh` is logged in -and the checkout is clean on `main`, then ends with the by-project summary the -human reads back — and then records what they say with `scripts/cortex.py`. +**Checking in is two commands, one per machine.** On the laptop, +`pyauto-brain cortex pull` pulls and shows what the cluster says. Anywhere, +`pyauto-brain cortex checkin --apply --push` stamps, renders and pushes on +`claude/checkin-` when the checkout is clean on `main` with a resolvable +`origin` (no `gh` needed), then ends with the by-project summary the human +reads back — and then records what they say with `scripts/cortex.py`. ## The board diff --git a/docs/satellites.md b/docs/satellites.md index c4f1c597..927ad8b7 100644 --- a/docs/satellites.md +++ b/docs/satellites.md @@ -8,7 +8,7 @@ repos that honour the contracts your body map declares. | Category | What it is for | What the organism expects of it | |----------|----------------|--------------------------------| -| `organ` | The five organism repos themselves. | Framework identity — names survive a fork; excluded from the tenant firewall's instance-fact tokens. | +| `organ` | The eight organism repos themselves. | Framework identity — names survive a fork; excluded from the tenant firewall's instance-fact tokens. | | `library` | A source package you release. | A test suite and CI workflow Heart gates on; a row in the Brain release conductor's library set; a PyPI package the Hands release; a version floor workspaces pin against. | | `workspace` | Runnable, user-facing examples for one library. | A `run_workspace` row in `pre_build.sh` (repo, package, flags, parent library); a version pin Heart's `version_skew` compares to the installed library; required CI (smoke tests) on `main`; notebook generation from its scripts. | | `workspace_test` | Regression / smoke / parity scripts — code-heavy, doc-light. | Same `run_workspace` mechanics; scripts runnable headless in the validation pipeline; the home for cross-package and integration checks that don't belong in a library's unit tests. | diff --git a/skills/COMMANDS.md b/skills/COMMANDS.md index f57860c8..6e788e5a 100644 --- a/skills/COMMANDS.md +++ b/skills/COMMANDS.md @@ -1,6 +1,6 @@ # PyAutoBrain command surface — shared reference -The short verb commands (`/intake`, `/community`, `/feature`, `/build`, `/health`, `/bug`, +The short verb commands (`/intake`, `/batch`, `/community`, `/feature`, `/build`, `/health`, `/bug`, `/refactor`, `/workspace`, `/eyes`, `/profiling`, `/cortex`, `/hygiene`, `/docs`, `/research`, `/route`, `/brain`) are a thin, human-friendly **veneer** over the PyAutoBrain router (`bin/pyauto-brain`). This file is the shared context every command file points at, so each command body stays a few lines long. @@ -22,7 +22,7 @@ through the Brain Feature Agent. A command is a *shortcut into* the Brain, never *replacement for* it. No command file re-implements classification, planning, the readiness gate, or execution — those belong to the organs. -## The three command tiers +## The command tiers **1. Real conductors** — route straight to an existing agent in `agents/conductors/` (`AGENTS.md` is authoritative): @@ -30,6 +30,7 @@ readiness gate, or execution — those belong to the organs. | Command | Agent | Chain | |---------|-------|-------| | `/intake` | Intake Agent | `bin/pyauto-brain intake` → files a PyAutoMind prompt (**before** `start_dev`); `census`/`dashboard` = backlog inventory / `PyAutoMind/dashboard.md` | +| `/batch` | Batch Agent | `bin/pyauto-brain batch` → the BatchDecision for one unattended shift, budgeted in review minutes; proposes only — the human's approval in the slot dispatches it; `batch collect` scores what came back | | `/community` | Community Agent | `bin/pyauto-brain community` → scan/triage user-filed issues (read-only surfaces) → session drafts replies for human approval → `/start_dev_for_user` | | `/feature` | Feature Agent | `bin/pyauto-brain feature` → `start_dev` → `ship_*` | | `/bug` | Bug Agent | `bin/pyauto-brain bug` → `start_dev` → `ship_*` (health mode → vitals + Heart issues) | @@ -37,10 +38,12 @@ readiness gate, or execution — those belong to the organs. | `/workspace` | Workspace Agent | `bin/pyauto-brain workspace` → WorkspaceDecision (plan/survey example authorship) → `start_dev` → `start_workspace` → `ship_workspace` | | `/eyes` | Eyes Agent | `bin/pyauto-brain eyes` → survey/review a visualization workspace's figures; render via its `gallery_run.sh`; accepted critiques → `/intake` → `start_dev` | | `/profiling` | Profiling Agent | `bin/pyauto-brain profiling` → campaign/ingest/triage plans over the autolens_profiling workspace | -| `/cortex` | Cortex Agent | `bin/pyauto-brain cortex checkin` → the science check-in over PyAutoCortex's per-project ledgers: pull every active project through its own sync CLI, show where each run stands (its `jobs` output verbatim), re-render the board and read it back by project — Now, runs, the last entries (`census`/`dashboard`/`issue` are the verbs beside it); it records cluster facts and the human's words with `scripts/cortex.py`, never a verdict of its own; a run is submitted only on the human's ask | +| `/cortex` | Cortex Agent | `bin/pyauto-brain cortex pull` (laptop) → every active project pulled through its own sync CLI, its `jobs` output verbatim; `bin/pyauto-brain cortex checkin` (anywhere) → stamp, re-render the board, push the ledger and read it back by project — Now, runs, the last entries (`census`/`dashboard`/`issue` are the verbs beside them); it records cluster facts and the human's words with `scripts/cortex.py`, never a verdict of its own; a run is submitted only on the human's ask | | `/hygiene` | Hygiene Agent | `bin/pyauto-brain hygiene` → perf/tidy/noise/deps/docs/docstrings upkeep plans; delegates fixes to refactor/bug/feature | | `/build` | Build Agent | `bin/pyauto-brain build` → vitals faculty → Heart → PyAutoHands | | `/health` | Health Agent | `bin/pyauto-brain health` loop → vitals faculty → Heart → GREEN | +| `clone` | Clone Agent | `bin/pyauto-brain clone` → CloneDecision; a birth only under `--apply --mode lightweight-seed`, behind the human's clone-mode and repo-creation answers (skill only, no slash command) | +| `release` | Release Agent | `bin/pyauto-brain release` → the Build Agent's release mode (single gate); `rehearse`/`validate`/`nightly` beside it; a manual release stays human-authorized (skill only, no slash command) | **2. Work-type entries** — no dedicated conductor exists **yet**, so these route through the Brain dev-flow with their PyAutoMind work-type fixed. Still through @@ -105,6 +108,20 @@ call, so the Brain is not bypassed): Code chat and Codex alike; the worktree half is local-only and is reported as outstanding elsewhere. +- **`/start_bundle`** — one session, several **independent** PyAutoMind prompts + in the same repo (the dashboard's Bundles card). Every member still goes + through `/start_dev` and ships its own issue and PR, so `/prm` closes each one + out unchanged; the door only orchestrates. + +- **`sampler_pipeline`** — the ingest → prototype → profile → promote trial of a + new non-linear sampler: reason with the samplers faculty, then do each stage + as ordinary dev work through `/start_dev` → `ship_*`. Promotion to a PyAutoFit + `NonLinearSearch` is the last stage, not the first. + +- **`update_issue`** — post a progress update (commits, summary, what is left) + to the active task's GitHub issue, read from the PyAutoMind registry. The + dev-lifecycle's progress leg; `start_dev_for_user` calls it at milestones. + **5. Maintenance doors** — periodic sweeps that reason about accumulated debris and then execute their own cleanup after per-bucket human confirmation. They own no agent, but unlike the composition doors they *mutate*, so each is @@ -137,10 +154,9 @@ These are complements, not overlaps: `/repo_cleanup` never touches issues, `/issue_cleanup` never touches git, `/ci_speedup` touches neither. Neither handles **external** users' issues — that is `/community`, whose drafts stay human-approved. -Codex skills also expose the remaining public CLI agents directly: the `clone` -conductor, the `release` conductor, and the read-only `vitals`, `review`, -`memory`, and `samplers` faculties. They do not gain new -slash commands; `brain` remains Claude's low-level passthrough. +Codex skills also expose the read-only faculties directly — `vitals`, `review`, +`memory`, `sizing`, `samplers`. Faculties and the two skill-only conductors gain +no slash command; `brain` remains Claude's low-level passthrough. ## How these are installed diff --git a/skills/OPERATIONS.md b/skills/OPERATIONS.md index f9626900..558de768 100644 --- a/skills/OPERATIONS.md +++ b/skills/OPERATIONS.md @@ -11,6 +11,10 @@ gets rediscovered twice, it belongs here. ## GitHub CLI fallbacks +These are `gh` bugs on a box that *has* `gh`. Whether this session has one at +all is the other question, answered once in +[`./GITHUB_ACCESS.md`](./GITHUB_ACCESS.md). + - **`gh pr create` fails on SSH remotes.** When `origin` is an SSH URL it can refuse to resolve the repo. Fallback: `gh api repos///pulls -f title=… -f head= -f base=main -f body=…` diff --git a/skills/health/health.md b/skills/health/health.md index c4fc9467..5e9979bf 100644 --- a/skills/health/health.md +++ b/skills/health/health.md @@ -30,10 +30,8 @@ Shared routing context: `PyAutoBrain/skills/COMMANDS.md`. - **`/health worktrees`** → follow the worktree dashboard procedure in `PyAutoHeart/skills/worktree_status/reference.md`. -`/health` is the **only** health command. The former `/health_check`, -`/pyauto-status`, `/pyauto-status-full`, and `/worktree_status` are retired as -top-level commands and live on as the `check`, `status`, `full`, and -`worktrees` legs above — the door is the Brain, the procedures are Heart's. +`/health` is the **only** health command — the door is the Brain, the +procedures are Heart's. On the shell side, the same vocabulary applies: `health` (git-sync dashboard), `health release`, and `health audit` (see `PyAutoHeart/scripts/health.sh`) — a diff --git a/skills/intake/intake.md b/skills/intake/intake.md index c6b1e6c1..001ede16 100644 --- a/skills/intake/intake.md +++ b/skills/intake/intake.md @@ -84,8 +84,8 @@ dev workflow (issue, branch, plan). Do not bypass the Brain. (then regenerate the dashboard and commit it with the change, per step 4). - `bin/pyauto-brain intake reconcile [prefix]` — ranks backlog (`draft/`) prompts that look already-shipped (cross-referenced against the `complete/` - records — the sole completion ledger since `complete.md` retired, #81 — and `active/`; a stale - hand-set `Status:` is a signal, never proof). Always read-only: verify each + records — the sole completion ledger — and `active/`; a stale hand-set + `Status:` is a signal, never proof). Always read-only: verify each suspect against the target repo's git log / merged PRs, then retire it to the `complete/` archive by hand (it is already done). - `bin/pyauto-brain intake reconcile --repo [prefix]` — **also** reads diff --git a/skills/issue_cleanup/issue_cleanup.md b/skills/issue_cleanup/issue_cleanup.md index 969ec711..10228484 100644 --- a/skills/issue_cleanup/issue_cleanup.md +++ b/skills/issue_cleanup/issue_cleanup.md @@ -24,11 +24,7 @@ reply* — this skill never touches those, it routes them there); `$create-issue and `$update-issue` (single-issue primitives); `$hygiene` (code-quality debt, not the tracker). -> **GitHub surface.** The `gh` commands below name the *operation*, not -> necessarily the command: a Claude Code remote session has no `gh` and -> reaches GitHub through the `mcp__github__*` tools instead. Probe once -> (`command -v gh`) and translate via -> [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). +> No `gh` on a remote session — map each `gh` step via [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). ## Why this needs care diff --git a/skills/issue_cleanup/reference.md b/skills/issue_cleanup/reference.md index c0f3d0ea..ae2bdc2a 100644 --- a/skills/issue_cleanup/reference.md +++ b/skills/issue_cleanup/reference.md @@ -5,11 +5,7 @@ holds the collection commands, the record header taxonomy, the evidence rules, the dashboard layout, the per-bucket execution recipes, the recap, and the execution-environment fallback. -> **GitHub surface.** The `gh` commands below name the *operation*, not -> necessarily the command: a Claude Code remote session has no `gh` and -> reaches GitHub through the `mcp__github__*` tools instead. Probe once -> (`command -v gh`) and translate via -> [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). +> No `gh` on a remote session — map each `gh` step via [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). ## Collect open issues diff --git a/skills/repo_cleanup/SKILL.md b/skills/repo_cleanup/SKILL.md index 065ac3aa..9b5d6961 100644 --- a/skills/repo_cleanup/SKILL.md +++ b/skills/repo_cleanup/SKILL.md @@ -36,11 +36,7 @@ but this also mutates); post-merge cleanup in `CLAUDE.md` (once per shipped task this covers residue when that flow is skipped); the start_dev branch survey (task start — this is between-tasks hygiene). -> **GitHub surface.** The `gh` commands below name the *operation*, not -> necessarily the command: a Claude Code remote session has no `gh` and -> reaches GitHub through the `mcp__github__*` tools instead. Probe once -> (`command -v gh`) and translate via -> [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). +> No `gh` on a remote session — map each `gh` step via [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). ## Safety principles (non-negotiable) diff --git a/skills/repo_cleanup/reference.md b/skills/repo_cleanup/reference.md index 9e30d2f3..66980ece 100644 --- a/skills/repo_cleanup/reference.md +++ b/skills/repo_cleanup/reference.md @@ -4,11 +4,7 @@ Factored out of `SKILL.md`. The body is authoritative for the flow; this holds the audit commands, the dashboard layout, the per-bucket execution recipes, the recap, and the execution-environment fallback. -> **GitHub surface.** The `gh` commands below name the *operation*, not -> necessarily the command: a Claude Code remote session has no `gh` and -> reaches GitHub through the `mcp__github__*` tools instead. Probe once -> (`command -v gh`) and translate via -> [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). +> No `gh` on a remote session — map each `gh` step via [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). ## Audit canonical checkouts diff --git a/skills/ship_library/reference.md b/skills/ship_library/reference.md index c2abaa42..d559b2f0 100644 --- a/skills/ship_library/reference.md +++ b/skills/ship_library/reference.md @@ -4,11 +4,7 @@ Factored out of `ship_library.md`. The body skill is authoritative for the flow; this file holds the verbatim PR format, the API-Changes rules, and the workspace-impact analysis. -> **GitHub surface.** The `gh` commands below name the *operation*, not -> necessarily the command: a Claude Code remote session has no `gh` and -> reaches GitHub through the `mcp__github__*` tools instead. Probe once -> (`command -v gh`) and translate via -> [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). +> No `gh` on a remote session — map each `gh` step via [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). ## Writing the `## API Changes` section (judgement — stays in the reasoning model) @@ -174,7 +170,7 @@ and `/review_release` clears it once a release has actually published. **Shipped (option iii passed):** offer to merge the library PR (`gh pr merge --merge --auto`), post a "Shipped" comment (PRs, summary, optional session notes), then record completion — the dated record **is** the -ledger (issues #71/#81; the monolithic `complete.md` was retired 2026-07-16): +ledger (issues #71/#81): - **Draft the rich completion body** to a temp file — `## `, `issue`, `completed: `, `library-pr:`, any uncleared `pending-release:` carried over from the `active.md` row, then the summary/traps/notes bullets. diff --git a/skills/ship_library/ship_library.md b/skills/ship_library/ship_library.md index f6d2c4d5..689ead80 100644 --- a/skills/ship_library/ship_library.md +++ b/skills/ship_library/ship_library.md @@ -15,11 +15,7 @@ the organ boundary, the readiness gate, and the execution-environment model. PR format, the execution contract, and the impact analysis are in [`reference.md`](reference.md). -> **GitHub surface.** The `gh` commands below name the *operation*, not -> necessarily the command: a Claude Code remote session has no `gh` and -> reaches GitHub through the `mcp__github__*` tools instead. Probe once -> (`command -v gh`) and translate via -> [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). +> No `gh` on a remote session — map each `gh` step via [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). ## Steps diff --git a/skills/ship_workspace/reference.md b/skills/ship_workspace/reference.md index e06063b3..c28b0965 100644 --- a/skills/ship_workspace/reference.md +++ b/skills/ship_workspace/reference.md @@ -3,11 +3,7 @@ Factored out of `ship_workspace.md`. The body skill is authoritative for the flow; this file holds the PR format, the merge gate, and the issue/Mind formats. -> **GitHub surface.** The `gh` commands below name the *operation*, not -> necessarily the command: a Claude Code remote session has no `gh` and -> reaches GitHub through the `mcp__github__*` tools instead. Probe once -> (`command -v gh`) and translate via -> [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). +> No `gh` on a remote session — map each `gh` step via [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). ## PR body format diff --git a/skills/ship_workspace/ship_workspace.md b/skills/ship_workspace/ship_workspace.md index 56617e9f..2b237dfe 100644 --- a/skills/ship_workspace/ship_workspace.md +++ b/skills/ship_workspace/ship_workspace.md @@ -15,11 +15,7 @@ entry point, not an agent. Read [`../WORKFLOW.md`](../WORKFLOW.md) for the organ boundary, readiness gate and execution-environment model; PR format, merge gate and issue/Mind formats are in [`reference.md`](reference.md). -> **GitHub surface.** The `gh` commands below name the *operation*, not -> necessarily the command: a Claude Code remote session has no `gh` and -> reaches GitHub through the `mcp__github__*` tools instead. Probe once -> (`command -v gh`) and translate via -> [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). +> No `gh` on a remote session — map each `gh` step via [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). ## Steps diff --git a/skills/start_dev/reference.md b/skills/start_dev/reference.md index b760488b..b7994301 100644 --- a/skills/start_dev/reference.md +++ b/skills/start_dev/reference.md @@ -4,11 +4,7 @@ Long-form templates and procedures factored out of `start_dev.md` to keep the primary skill concise. The body skill is authoritative for the flow; this file holds the verbatim formats it points at. -> **GitHub surface.** The `gh` commands below name the *operation*, not -> necessarily the command: a Claude Code remote session has no `gh` and -> reaches GitHub through the `mcp__github__*` tools instead. Probe once -> (`command -v gh`) and translate via -> [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). +> No `gh` on a remote session — map each `gh` step via [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). ## Issue body diff --git a/skills/start_dev/start_dev.md b/skills/start_dev/start_dev.md index eb444c4f..91d8b7c8 100644 --- a/skills/start_dev/start_dev.md +++ b/skills/start_dev/start_dev.md @@ -16,11 +16,7 @@ Opus too, dropping to Sonnet only for the really simple mechanical `ship_*` / `pre_build` recipes), and the Mind registry paths used below. -> **GitHub surface.** The `gh` commands below name the *operation*, not -> necessarily the command: a Claude Code remote session has no `gh` and -> reaches GitHub through the `mcp__github__*` tools instead. Probe once -> (`command -v gh`) and translate via -> [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). +> No `gh` on a remote session — map each `gh` step via [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). ## Usage diff --git a/skills/start_dev_for_user/reference.md b/skills/start_dev_for_user/reference.md index 9dd71260..7018da5c 100644 --- a/skills/start_dev_for_user/reference.md +++ b/skills/start_dev_for_user/reference.md @@ -4,11 +4,7 @@ Factored out of `start_dev_for_user.md` (read by repo path `PyAutoBrain/skills/start_dev_for_user/reference.md`). Holds the tone rules, comment templates, registry formats, and the forward-compatibility note. -> **GitHub surface.** The `gh` commands below name the *operation*, not -> necessarily the command: a Claude Code remote session has no `gh` and -> reaches GitHub through the `mcp__github__*` tools instead. Probe once -> (`command -v gh`) and translate via -> [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). +> No `gh` on a remote session — map each `gh` step via [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). ## Tone rules (every comment on a `user-facing: true` task) diff --git a/skills/start_dev_for_user/start_dev_for_user.md b/skills/start_dev_for_user/start_dev_for_user.md index dbf01cca..5a4443e5 100644 --- a/skills/start_dev_for_user/start_dev_for_user.md +++ b/skills/start_dev_for_user/start_dev_for_user.md @@ -15,11 +15,7 @@ the organ boundary, the Feature Agent, Memory consultation and the execution-environment model. Tone rules, comment templates and registry formats are in [`reference.md`](reference.md) (`PyAutoBrain/skills/start_dev_for_user/reference.md`). -> **GitHub surface.** The `gh` commands below name the *operation*, not -> necessarily the command: a Claude Code remote session has no `gh` and -> reaches GitHub through the `mcp__github__*` tools instead. Probe once -> (`command -v gh`) and translate via -> [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). +> No `gh` on a remote session — map each `gh` step via [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). ## Usage diff --git a/skills/start_library/start_library.md b/skills/start_library/start_library.md index 4a5b8efc..c12201af 100644 --- a/skills/start_library/start_library.md +++ b/skills/start_library/start_library.md @@ -9,11 +9,7 @@ Workflow entry point — the worktree/branch setup is the dev workflow's own state is **Mind**. Read [`../WORKFLOW.md`](../WORKFLOW.md) for the organ boundary, the worktree helpers, the execution-environment model, and the registry paths. -> **GitHub surface.** The `gh` commands below name the *operation*, not -> necessarily the command: a Claude Code remote session has no `gh` and -> reaches GitHub through the `mcp__github__*` tools instead. Probe once -> (`command -v gh`) and translate via -> [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). +> No `gh` on a remote session — map each `gh` step via [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). ## Steps diff --git a/skills/start_workspace/reference.md b/skills/start_workspace/reference.md index 0ba36c3d..d0afbb0f 100644 --- a/skills/start_workspace/reference.md +++ b/skills/start_workspace/reference.md @@ -3,11 +3,7 @@ Factored out of `start_workspace.md`. The body skill is authoritative for the flow; this file holds the verbatim impact-report and registry formats. -> **GitHub surface.** The `gh` commands below name the *operation*, not -> necessarily the command: a Claude Code remote session has no `gh` and -> reaches GitHub through the `mcp__github__*` tools instead. Probe once -> (`command -v gh`) and translate via -> [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). +> No `gh` on a remote session — map each `gh` step via [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). ## Linked-mode API-change impact diff --git a/skills/start_workspace/start_workspace.md b/skills/start_workspace/start_workspace.md index e8ad050f..2eea4b43 100644 --- a/skills/start_workspace/start_workspace.md +++ b/skills/start_workspace/start_workspace.md @@ -11,11 +11,7 @@ Workflow entry point — worktree/branch setup is the dev workflow's own helpers, execution-environment model, and registry paths. Verbose formats live in [`reference.md`](reference.md). -> **GitHub surface.** The `gh` commands below name the *operation*, not -> necessarily the command: a Claude Code remote session has no `gh` and -> reaches GitHub through the `mcp__github__*` tools instead. Probe once -> (`command -v gh`) and translate via -> [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). +> No `gh` on a remote session — map each `gh` step via [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). ## Steps diff --git a/skills/update_issue/SKILL.md b/skills/update_issue/SKILL.md index cb97d05c..985c546e 100644 --- a/skills/update_issue/SKILL.md +++ b/skills/update_issue/SKILL.md @@ -10,11 +10,7 @@ is part of the development cycle (the `start_*` → `ship_*` lifecycle; `start_dev_for_user` calls it at milestones). It reads the PyAutoMind registry to find the active issue. Organ boundary: [`../WORKFLOW.md`](../WORKFLOW.md). -> **GitHub surface.** The `gh` commands below name the *operation*, not -> necessarily the command: a Claude Code remote session has no `gh` and -> reaches GitHub through the `mcp__github__*` tools instead. Probe once -> (`command -v gh`) and translate via -> [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). +> No `gh` on a remote session — map each `gh` step via [`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md). ## Usage From 6bfa55b12c9250b6af899cd6efaddece87b39007 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 17 Sep 2026 19:54:24 +0000 Subject: [PATCH 2/4] cortex conductor: `pull` on the laptop, `checkin` anywhere MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `checkin --apply` shelled out to every active project's sync CLI under a laptop path and refused to push without `gh`, so on the web/mobile surface most Cortex traffic comes from it was a dry run (7 of 7 pulls fail, ~27 % of the conductor inert) and the ledger_merge bot did the landing. The pull leg is now its own verb — `pull` runs the sync CLIs and `jobs`, exits 2 naming each missing root when this is not the laptop — and `checkin` stamps, re-renders, summarises by project and pushes from any surface, with a git-only preflight (clean tree on main, a resolvable origin; the push itself proves the credential). `--skip-pull` is accepted and ignored with a notice. Board chip carries both lines. 41 conductor tests; full suite green. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_018AWgNfNwvJMi6s7MWBeVJ2 --- AGENTS.md | 2 +- agents/conductors/cortex/AGENTS.md | 102 ++++++---- agents/conductors/cortex/_cortex.py | 297 ++++++++++++++++++++-------- agents/conductors/cortex/cortex.sh | 18 +- bin/pyauto-brain | 4 +- skills/cortex/SKILL.md | 7 +- skills/cortex/cortex.md | 94 +++++---- tests/test_cortex_conductor.py | 221 +++++++++++++++++---- 8 files changed, 532 insertions(+), 213 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index e7eb9afd..39204ebc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -141,7 +141,7 @@ the `/` slash commands. | `workspace` | The voice — the organism's expressive function: plan/survey workspace + HowTo example authorship (workspace\|howto registers) — WorkspaceDecision (never writes) | `bin/pyauto-brain workspace` | | `eyes` | The perceptive function — the organism's sense of its own appearance: survey/review a visualization workspace's figure surface, critiques route to intake/start_dev — EyesSurvey/EyesReviewSurface (never renders, never edits) | `bin/pyauto-brain eyes` | | `profiling` | The proprioceptive function — the organism's sense of its own effort: campaign/ingest/triage plans over the autolens_profiling workspace — ProfilingDecision | `bin/pyauto-brain profiling` | -| `cortex` | The learning function — where the organism keeps track of what is true: the per-project science ledger over PyAutoCortex ('cortex checkin') — pull every active project through its own sync CLI, show where each run stands, re-render the board; it records cluster facts and the human's words, never a verdict of its own | `bin/pyauto-brain cortex` | +| `cortex` | The learning function — where the organism keeps track of what is true: the per-project science ledger over PyAutoCortex — 'cortex pull' on the laptop pulls every active project through its own sync CLI and shows where each run stands; 'cortex checkin' anywhere stamps, re-renders the board and pushes the ledger; it records cluster facts and the human's words, never a verdict of its own | `bin/pyauto-brain cortex` | | `hygiene` | The maintenance function — the organism's sense of its own upkeep: code-quality debt (dev-loop cost + tidiness), delegating fixes — HygieneDecision | `bin/pyauto-brain hygiene` | | `clone` | The Mitosis Agent: partition the reference assistant, analyze the domain, emit the CloneDecision; --apply --mode lightweight-seed delegates the seed birth to Build; 'clone sync' patches the reference's generic-file diff onto the born siblings (dry run by default; rejected hunks are a human decision) | `bin/pyauto-brain clone` | | `build` | Coordinate execution: consult the vitals faculty, then delegate to PyAutoHands | `bin/pyauto-brain build` | diff --git a/agents/conductors/cortex/AGENTS.md b/agents/conductors/cortex/AGENTS.md index f46780d8..88c2e333 100644 --- a/agents/conductors/cortex/AGENTS.md +++ b/agents/conductors/cortex/AGENTS.md @@ -3,14 +3,15 @@ > **Tier: conductor** — a front-door agent you *drive*. The *learning > function* — where the organism keeps track of what is true: it reasons over > PyAutoCortex (the science body map and **one ledger per project**) and -> answers one question — *where is my science?* — with one command, -> `checkin`: pull every active project through its own sync CLI, show where -> each run stands, re-render the board, push the ledger, read it back by -> project. It **records cluster facts and the human's words, never a verdict -> of its own**: it never scores a result, never drafts a ruling, never writes -> a `result` or `lesson` entry the human did not say. A run is submitted only -> on the human's ask (by the agent in the session, through the project's own -> sync CLI), and every ledger write is a `scripts/cortex.py` verb. +> answers one question — *where is my science?* — in two verbs, split where +> the machines split: `pull` asks the cluster (the laptop only, because every +> science root is a laptop path), `checkin` stamps, re-renders and pushes the +> board and reads the ledger back by project (anywhere). It **records cluster +> facts and the human's words, never a verdict of its own**: it never scores +> a result, never drafts a ruling, never writes a `result` or `lesson` entry +> the human did not say. A run is submitted only on the human's ask (by the +> agent in the session, through the project's own sync CLI), and every ledger +> write is a `scripts/cortex.py` verb. The same split the organism already uses twice — **Heart ↔ vitals**, **Gut ↔ hygiene**: the organ keeps the state, the conductor reasons over it. A ledger @@ -24,15 +25,18 @@ note`). | Verb | Question | Emits | |------|----------|-------| -| `checkin [--dry-run \| --apply] [--push \| --no-push] [--project KEY] [--skip-pull]` | **Where is my science?** | the door — the sequence below, ending in a summary keyed by project; exit **1** when a pull failed or the tree does not check | +| `pull [--project KEY] [--dry-run]` | **What does the cluster say?** | the laptop leg: each project's own ` pull`, streamed, then its `jobs` output verbatim, then one line per project (and the roots that are not on this machine, as skipped). Writes nothing. Exit **1** a pull failed · **2** no project's `local_path` is here | +| `checkin [--dry-run \| --apply] [--push \| --no-push] [--project KEY]` | **Where is my science?** | the door — the sequence below, ending in a summary keyed by project; reaches no cluster; exit **1** when the tree does not check | | `census [--json]` | What is the Cortex holding? | per project: status, summary, runs by state, log length, last update; totals (active projects, runs open, runs running); the check-in stamp; the problems `cortex.py check` would report | | `dashboard --check` | Are the committed pages current? | exit 0 current · **1 stale** · 2 no checkout · 3 unreadable tree | | `dashboard --apply` | — | writes `dashboard.md` + `dashboard.html` | | `issue [--project KEY] [--apply]` | What sits at the top of each project's issue? | the fenced ledger block (`cortex.py`'s `issue_block`) per project with an `Issue:`; `--apply` writes it into the issue body through `gh` (replacing the block between the markers, or prepending it); never creates an issue; exit **1** without `gh` | ``` -pyauto-brain cortex checkin --dry-run # what it would pull; reaches nothing -pyauto-brain cortex checkin --apply # the check-in +pyauto-brain cortex pull # the laptop: pull, then jobs verbatim +pyauto-brain cortex pull --dry-run # what it would pull; reaches nothing +pyauto-brain cortex checkin --dry-run # what it would write; writes nothing +pyauto-brain cortex checkin --apply # the check-in, on any surface pyauto-brain cortex # census pyauto-brain cortex dashboard --apply pyauto-brain cortex issue --apply @@ -70,7 +74,9 @@ Mind's: a session holding one organ and not the other still works. The page opens on the door: a counts table (`Running`, `Open`, `Projects` — what `board/_board.py` reads for the Brain board's Cortex strip), the -**check-in chip** — the paste for the laptop's science chat — and the **last +**check-in chip** — two lines, because the check-in has two halves that do +not run on the same machine: `pyauto-brain cortex pull` on the laptop, then +`pyauto-brain cortex checkin --apply --push` anywhere — and the **last check-in** stamp under it. Then **Summary**: one row per active project, four narrow columns (`Project | Running | Open | Last update`) so it fits a phone. Then **Projects**: a `### — ` card per project with a ledger — @@ -96,38 +102,58 @@ its age on the **viewer's** clock and reddens it once stale. `--check` compares the pages with the generation comment **and** the visible `Last updated` banner stripped, so a re-render on a new date is not drift. -## The door (`checkin`) - -The verb a human types. It composes what is already here and reasons nothing -of its own: - -1. **Sync.** Every project with `status: active` in `projects.yaml`, plus any - project whose ledger lists a run (a dormant project with a job still out - there is still out there). Each is pulled with **its own** - `/ pull`, output **streamed**, not captured. A - non-zero exit is recorded against that project and the sweep continues. -2. **Jobs.** Where the row has a `jobs` verb and the ledger lists runs, the +## The split: `pull` on the laptop, `checkin` anywhere + +Both verbs sweep the same set — every `status: active` row of +`projects.yaml`, plus any project whose ledger lists a run (a dormant project +with a job still out there is still out there) — and `--project KEY` narrows +either. What separates them is a fact about paths: a project's `local_path` +is a laptop path out of `projects.yaml`, so only the laptop can run its sync +CLI, while stamping, rendering, pushing and reading a ledger back work on any +surface. `checkin` used to do both, which made the headline verb a dry run +everywhere but one machine. + +### `pull` — the laptop leg + +1. **Roots first.** Every swept project's `local_path` is checked before + anything runs. None here → exit **2**, one line per project naming the + missing root and *"this is not the laptop — run `checkin` here and `pull` + on the laptop"*. Some here → those are pulled and the rest are listed as + skipped. +2. **Pull.** Each project's own `/ pull`, **streamed**, + not captured. A non-zero exit is recorded against that project, the sweep + continues, and the verb exits **1**. +3. **Jobs.** Where the row has a `jobs` verb and the ledger lists runs, the project's own ` jobs` is run and its output printed **verbatim** — no parsing, no state flip. The human, or the agent in the session, records what it says with `cortex.py running | done`. -3. **Stamp + render.** `checkin.yaml`, then `dashboard.md` + `dashboard.html`. -4. **Push** (the rule below). -5. **Summarise, by project** — printed **last**, so a chat sees it above the - fold: `key — summary`, what the pull did, the jobs output (or "no jobs - verb"), Now, the runs, the last five entries, and a fenced block of the - three `cortex.py` lines most likely typed next (`done`, `log --kind - result|lesson`, `now`). - -`--dry-run` (the default) prints the exact `cd && -pull` per project and reaches nothing at all. `--project KEY` narrows the -sweep; `--skip-pull` skips the pull and still asks `jobs`, stamps and renders. + +It writes nothing: no stamp, no pages, no ledger. `--dry-run` prints the exact +`cd && pull` per project and reaches nothing at all. + +### `checkin` — the door + +1. **Stamp + render.** `checkin.yaml`, then `dashboard.md` + `dashboard.html`. +2. **Push** (the rule below). +3. **Summarise, by project** — printed **last**, so a chat sees it above the + fold: `key — summary`, Now, the runs **as the ledger holds them**, the last + five entries, and a fenced block of the three `cortex.py` lines most likely + typed next (`done`, `log --kind result|lesson`, `now`). It closes by saying + those runs are the ledger's word, not the cluster's. + +It shells out to no sync CLI at all. `--dry-run` (the default) names what it +would write and writes nothing; `--skip-pull` is accepted and ignored with a +notice, so an old paste still runs. ### The push rule -`--push` is allowed only when **`gh auth status` succeeds** *and* **the Cortex -checkout is clean on `main`** — read *before* anything is written. That is the -whole cloud/laptop split, and it is also the default: a laptop pushes without -asking, a cloud session cannot and says so. The push cuts +`--push` is allowed when **the Cortex checkout is clean on `main` with a +resolvable `origin`** — read *before* anything is written — and it is the +default. It is git's own answer, asked of git alone: the leg that used to open +with `gh auth status` refused every surface that reaches GitHub another way, +which is how a quarter of the Cortex's commits came to be the merge bot +compensating. The push itself is the real gate — it succeeds, or the summary +says exactly how it failed. The push cuts `claude/checkin-` from a fresh `origin/main`, commits the changed paths **explicitly**, pushes, and names `ledger_merge.yml` as what lands it. `scripts/ledger_merge.py classify` is asked first and a code-classified diff is diff --git a/agents/conductors/cortex/_cortex.py b/agents/conductors/cortex/_cortex.py index cf1084a6..9178b301 100644 --- a/agents/conductors/cortex/_cortex.py +++ b/agents/conductors/cortex/_cortex.py @@ -6,9 +6,10 @@ The Cortex is **one ledger per science project** (`projects/.md`): a `## Now` the human rewrites, the `## Runs` on the cluster right now, and a dated `## Log`, newest first. This conductor renders that ledger as the -board, pulls every active project through its own sync CLI, shows where each -run stands, and reads the ledger back by project. It **records cluster facts -and the human's words, never a verdict of its own**: it never scores a +board, reads the ledger back by project, and — on the laptop, where the +science actually lives — pulls every active project through its own sync CLI +and shows where each run stands. It **records cluster facts and the human's +words, never a verdict of its own**: it never scores a result, never drafts a ruling, never writes a `result` or `lesson` entry — those are the human's words, written on their ask through the Cortex's own `scripts/cortex.py`. The same split as Heart ↔ vitals and Gut ↔ hygiene. @@ -26,13 +27,19 @@ the one place that carries such a path is the Cortex's own `projects.yaml`, and every path this module prints is read from a row of it at runtime. -Verbs: `checkin [--dry-run|--apply] [--push|--no-push] [--project KEY] -[--skip-pull]` (the door) · `census [--json]` · `dashboard --check|--apply` · -`issue [--project KEY] [--apply]`. +The verbs split along the one line the surfaces actually draw: a science +project's `local_path` is a laptop path, so only the laptop can pull it, +while stamping and rendering the board work anywhere. + +Verbs: `pull [--project KEY] [--dry-run]` (the laptop leg) · `checkin +[--dry-run|--apply] [--push|--no-push] [--project KEY]` (the door, reaches no +cluster) · `census [--json]` · `dashboard --check|--apply` · `issue +[--project KEY] [--apply]`. Exit codes: 0 ok · 1 dashboard drift (the `dashboard_refresh.yml` contract), a failed pull, or a tree that does not check · 2 bad args / no Cortex -checkout · 3 the Cortex tree could not be read. +checkout / no project's `local_path` is on this machine · 3 the Cortex tree +could not be read. """ from __future__ import annotations @@ -386,11 +393,18 @@ def _board_links(home: str, current: str) -> list: def checkin_payload(c: dict) -> str: - return (f"/cortex — check in on every active science project since the " - f"last check-in ({c.get('checkin') or CHECKIN_NEVER}): pull each " - "through its sync CLI, show me where each run stands, re-render " - "and push the board, then read me the by-project summary. Record " - "nothing about results — I will tell you what to log.") + """Two lines, because the check-in has two halves and they do not run on + the same machine: the pull needs the laptop the science lives on, the + check-in itself runs on whatever surface you are holding.""" + return "\n".join([ + "/cortex — on the laptop: `pyauto-brain cortex pull` — pull every " + "active science project through its own sync CLI and show me where " + "each run stands.", + f"/cortex — anywhere: `pyauto-brain cortex checkin --apply --push` — " + f"stamp, re-render and push the board since the last check-in " + f"({c.get('checkin') or CHECKIN_NEVER}), then read me the by-project " + "summary. Record nothing about results — I will tell you what to log.", + ]) def resume_payload(key: str, row: dict) -> str: @@ -756,6 +770,32 @@ def run_pull_streamed(projects: dict, keys: list) -> dict: return results +#: What a surface without the science on it is told, once, instead of seven +#: failed pulls: the split this module is built around. +NOT_THE_LAPTOP = ("this is not the laptop — run `checkin` here and `pull` on " + "the laptop") + + +def local_root(row: dict) -> str: + return (row.get("local_path") or "").strip() + + +def _root_of(projects: dict, key: str) -> str: + """A project's `local_path` as a line names it, or why there is none.""" + return local_root(projects.get(key, {})) or "(no local_path in projects.yaml)" + + +def split_by_root(projects: dict, keys: list) -> tuple: + """`(present, missing)` — which of `keys` have their `local_path` on this + machine. The one question that decides whether a pull can happen at all: + a project's root is a laptop path, and nothing else can stand in for it.""" + present, missing = [], [] + for key in keys: + root = local_root(projects.get(key, {})) + (present if root and Path(root).is_dir() else missing).append(key) + return present, missing + + def run_jobs(row: dict) -> str | None: """The project's own ` jobs`, verbatim — stdout and stderr as they came, no parsing. None when the row has no `jobs` verb.""" @@ -777,8 +817,8 @@ def run_jobs(row: dict) -> str | None: CHECKIN_BRANCH_PREFIX = "claude/checkin-" #: The rule the `--push` default resolves by, stated wherever it is applied. -PUSH_RULE = ("`--push` needs `gh auth status` to succeed and the Cortex " - "checkout to be clean on `main`") +PUSH_RULE = ("`--push` needs the Cortex checkout clean on `main` with a " + "resolvable `origin`") def _git(root: Path, *args: str) -> subprocess.CompletedProcess: @@ -788,23 +828,30 @@ def _git(root: Path, *args: str) -> subprocess.CompletedProcess: def push_preflight(root: Path) -> tuple: """`(ok, reason)` — may this check-in push its own ledger diff? Read - **before** anything is written. Two legs, both facts about this machine: - a logged-in `gh` (the cloud/laptop split) and a clean checkout on `main`.""" - if shutil.which("gh") is None: - return False, "no `gh` on PATH — this is not a laptop session" - if subprocess.run(["gh", "auth", "status"], capture_output=True, - text=True).returncode != 0: - return False, "`gh auth status` fails — not authenticated" + **before** anything is written, and asked of **git alone**. + + It used to open with a `gh` probe standing in for "this is a laptop". + That reading is wrong twice over: a session can push a branch without + `gh` (git credentials are not the GitHub CLI), and making the headline + verb refuse everywhere `gh` is absent is what left the ledger to the + merge bot. So the preflight asks only what git can answer — a checkout, + on `main`, clean, with an `origin` to push to — and the push itself is + the real gate: it either succeeds or `push_ledger` says exactly how it + failed. + """ head = _git(root, "rev-parse", "--abbrev-ref", "HEAD") if head.returncode != 0: return False, "the Cortex checkout is not a git repo" branch = head.stdout.strip() if branch != "main": return False, f"the Cortex checkout is on `{branch}`, not `main`" + origin = _git(root, "remote", "get-url", "origin") + if origin.returncode != 0 or not origin.stdout.strip(): + return False, "the Cortex checkout has no `origin` to push to" dirty = _git(root, "status", "--porcelain") if dirty.returncode != 0 or dirty.stdout.strip(): return False, "the Cortex checkout has uncommitted changes" - return True, "`gh` is authenticated and the Cortex is clean on `main`" + return True, "the Cortex is clean on `main` with an `origin`" def dirty_paths(root: Path) -> list[str]: @@ -921,24 +968,17 @@ def next_commands(key: str, d: dict | None) -> str: f'python3 scripts/cortex.py now {key} ""']) -def project_digest(key: str, c: dict, pull: tuple | None, jobs: str | None, - skipped: bool) -> list[str]: +def project_digest(key: str, c: dict) -> list[str]: + """One project as the check-in reads it back: what the human said they + were doing, what the ledger says is on the cluster, what they last wrote + down, and the three lines they are most likely to type next. + + No pull column and no `jobs` block: this digest is the ledger, and the + ledger is readable on any surface. What the cluster says is `pull`'s to + print, on the laptop that can ask it. + """ d = ledger_of(c, key) - row = c["projects"].get(key, {}) L = [f"## {key} — {d['summary'] if d else '(no ledger)'}", ""] - if skipped: - L.append("pull: skipped (--skip-pull)") - elif pull is None: - L.append("pull: not run") - else: - rc, note = pull - L.append("pull: ok" if rc == 0 else f"pull: {note or f'exited {rc}'}") - if jobs is None: - has = "jobs" in (row.get("sync_verbs") or []) - L.append("jobs: " + ("no runs listed — not asked" if has else "no jobs verb")) - else: - L += ["jobs:", jobs] - L.append("") if d is None: L += ["(no projects/.md — `python3 scripts/cortex.py new " f"{key} --summary ...` opens one)", ""] @@ -952,50 +992,137 @@ def project_digest(key: str, c: dict, pull: tuple | None, jobs: str | None, return L -def cmd_checkin(root: Path, mod, a) -> int: +# -------------------------------------------------------------- the pull --- +def cmd_pull(root: Path, mod, a) -> int: + """The laptop leg: each project's own ` pull`, then its `jobs` + output verbatim. Nothing else — no stamp, no render, no push. + + It is a separate verb because it has a separate precondition: every path + it runs under is a `local_path` out of `projects.yaml`, which exists on + exactly one machine. Asked anywhere else it says so once, by project, + rather than failing a pull per project. + """ projects, _ = mod.load_projects(root) ledgers, _ = mod.load_ledgers(root) keys, notes = checkin_keys(projects, ledgers, a.project) runs_by_key = {led.key: len(led.runs) for led in ledgers} + present, missing = split_by_root(projects, keys) - if not a.apply: - print("== Cortex check-in — dry run (nothing is reached) ==") + def jobs_line(key: str) -> str: + row = projects[key] + return f"cd {row.get('local_path')} && {row.get('sync_cli')} jobs" + + def asks_jobs(key: str) -> bool: + return bool(runs_by_key.get(key)) and \ + "jobs" in (projects[key].get("sync_verbs") or []) + + if a.dry_run: + print("== Cortex pull — dry run (nothing is reached) ==") for key in keys: row = projects[key] - print(f"\n{key} — {row.get('status')}") + here = "" if key in present else " (not on this machine)" + print(f"\n{key} — {row.get('status')}{here}") print(f" $ {pull_shell(row)}") - if runs_by_key.get(key) and "jobs" in (row.get("sync_verbs") or []): - print(f" $ cd {row.get('local_path')} && {row.get('sync_cli')} jobs") + if asks_jobs(key): + print(f" $ {jobs_line(key)}") for n in notes: print(f"\nnote: {n}") - print(f"\n{len(keys)} project(s) would be pulled. Run with --apply to " - "check in.") + print(f"\n{len(present)} of {len(keys)} project(s) would be pulled. " + "Run without --dry-run to pull.") return RC_OK - # The push decision is read before anything is written. - push_ok, push_why = push_preflight(root) - push = push_ok if a.push is None else a.push - push_note = "" - if push and not push_ok: - push, push_note = False, f"push: REFUSED — {push_why} ({PUSH_RULE})" - elif not push: - push_note = f"push: off — {push_why if a.push is None else '--no-push'}" + for n in notes: + print(f"note: {n}") + if not keys: + print("no project to pull — no `status: active` row and no ledger " + "lists a run.") + return RC_OK + if not present: + print("cortex pull: no project's `local_path` is on this machine:", + file=sys.stderr) + for key in missing: + print(f" - {key}: {_root_of(projects, key)} is not here", + file=sys.stderr) + print(f" {NOT_THE_LAPTOP}", file=sys.stderr) + return RC_USAGE - pulls: dict[str, tuple] = {} - if not a.skip_pull: - pulls = run_pull_streamed(projects, keys) + pulls = run_pull_streamed(projects, present) jobs_out: dict[str, str] = {} - for key in keys: + for key in present: if not runs_by_key.get(key): continue out = run_jobs(projects[key]) if out is None: continue jobs_out[key] = out - print(f"\n$ cd {projects[key].get('local_path')} && " - f"{projects[key].get('sync_cli')} jobs", flush=True) + print(f"\n$ {jobs_line(key)}", flush=True) print(out, flush=True) + failed = [k for k, (rc, _n) in pulls.items() if rc not in (0, None)] + print("\n# The cluster by project — pull\n") + for key in present: + rc, note = pulls.get(key, (None, "not run")) + print(f"{key}: " + ("pull ok" if rc == 0 else + (note or f"pull exited {rc}"))) + if key in jobs_out: + print(jobs_out[key]) + elif asks_jobs(key): + print(" (jobs printed nothing)") + else: + has = "jobs" in (projects[key].get("sync_verbs") or []) + print(" jobs: " + ("no runs listed — not asked" if has + else "no jobs verb")) + for key in missing: + print(f"{key}: skipped — {_root_of(projects, key)} is not on this " + "machine") + if missing: + print(f" {NOT_THE_LAPTOP}") + print("\nRecord what the jobs output says with `python3 scripts/cortex.py " + "running|done ` in the Cortex checkout; a result or a " + "lesson is written only in the human's words. Then " + "`pyauto-brain cortex checkin --apply` stamps and re-renders the " + "board.") + return RC_DRIFT if failed else RC_OK + + +# -------------------------------------------------------------- the door --- +def cmd_checkin(root: Path, mod, a) -> int: + """The door, on any surface: stamp, render, push, read the ledger back. + + It reaches no cluster and shells out to no sync CLI — every path such a + CLI runs under exists on the laptop alone, so a check-in that pulled was + a check-in that only worked in one place. `pull` is that leg now. + """ + projects, _ = mod.load_projects(root) + ledgers, _ = mod.load_ledgers(root) + keys, notes = checkin_keys(projects, ledgers, a.project) + if a.skip_pull: + notes.append("--skip-pull: accepted and ignored — `checkin` no longer " + "pulls; the pull is `pyauto-brain cortex pull`, on the " + "laptop") + + if not a.apply: + print("== Cortex check-in — dry run (nothing is written) ==") + for key in keys: + print(f"\n{key} — {projects[key].get('status')}") + for n in notes: + print(f"\nnote: {n}") + print(f"\nwould stamp {CHECKIN_FILE}, re-render dashboard.md + " + "dashboard.html, and read back " + f"{len(keys)} project(s). Run with --apply to check in.") + print("The pull is its own verb, on the laptop: " + "`pyauto-brain cortex pull`.") + return RC_OK + + # The push decision is read before anything is written. + push_ok, push_why = push_preflight(root) + push = push_ok if a.push is None else a.push + push_note = "" + if push and not push_ok: + push, push_note = False, f"push: REFUSED — {push_why} ({PUSH_RULE})" + elif not push: + push_note = f"push: off — {push_why if a.push is None else '--no-push'}" + stamp = _utc_now() write_checkin(root, stamp) c = census(root) @@ -1006,7 +1133,6 @@ def cmd_checkin(root: Path, mod, a) -> int: if push: _ok, push_lines = push_ledger(root, stamp[:10], dirty_paths(root)) - failed = [k for k, (rc, _n) in pulls.items() if rc not in (0, None)] print(f"\n# The Cortex by project — check-in {stamp}\n") print(f"{len(keys)} project(s) · {c['counts']['running']} running · " f"{c['counts']['open']} open · pages re-rendered") @@ -1017,12 +1143,13 @@ def cmd_checkin(root: Path, mod, a) -> int: "run `python3 scripts/cortex.py check`") print() for key in keys: - print("\n".join(project_digest(key, c, pulls.get(key), jobs_out.get(key), - a.skip_pull))) - print("Record what the jobs output says with `python3 scripts/cortex.py " - "running|done ` in the Cortex checkout; a result or a " - "lesson is written only in the human's words.") - return RC_DRIFT if failed or c["problems"] else RC_OK + print("\n".join(project_digest(key, c))) + print("The runs above are what the ledger says, not what the cluster " + "says: `pyauto-brain cortex pull` on the laptop asks the cluster, " + "and `python3 scripts/cortex.py running|done ` records " + "what it answered. A result or a lesson is written only in the " + "human's words.") + return RC_DRIFT if c["problems"] else RC_OK # ------------------------------------------------------------ the issue --- @@ -1114,30 +1241,36 @@ def common(p): help="exit 1 if the committed pages are stale") d.add_argument("--apply", action="store_true", help="write both pages") + u = common(sub.add_parser( + "pull", help="the laptop leg: pull every active project through its " + "own sync CLI and print its `jobs` output verbatim")) + u.add_argument("--project", action="append", default=[], metavar="KEY", + help="pull only these projects (repeatable)") + u.add_argument("--dry-run", dest="dry_run", action="store_true", + help="name every pull and reach nothing") + n = common(sub.add_parser( - "checkin", help="the check-in door: pull every active project through " - "its own sync CLI, show where each run stands, " - "re-render the board and read it back by project")) + "checkin", help="the check-in door, on any surface: stamp, re-render " + "the board, push the ledger and read it back by " + "project (it reaches no cluster — that is `pull`)")) n.add_argument("--dry-run", dest="dry_run", action="store_true", - help="the default — say what would be pulled and touch " + help="the default — say what would be written and write " "nothing") n.add_argument("--apply", action="store_true", - help="do it: pull, jobs, stamp, render (and push, per the " - "push rule)") + help="do it: stamp, render (and push, per the push rule)") n.add_argument("--push", dest="push", action="store_const", const=True, default=None, help="push the ledger diff on `claude/checkin-` " - "(allowed only when `gh auth status` succeeds and the " - "Cortex is clean on main; also the default when " - "neither flag is given)") + "(allowed when the Cortex checkout is clean on `main` " + "with an `origin`; also the default when neither flag " + "is given)") n.add_argument("--no-push", dest="push", action="store_const", const=False, - help="never push — the default in any session without a " - "logged-in `gh`") + help="never push — leave the check-in in the checkout") n.add_argument("--project", action="append", default=[], metavar="KEY", - help="sweep only these projects (repeatable)") + help="read back only these projects (repeatable)") n.add_argument("--skip-pull", dest="skip_pull", action="store_true", - help="do not pull — stamp, render and read back what is " - "already on the laptop") + help="accepted and ignored — `checkin` no longer pulls " + "(kept so an old paste still runs)") i = common(sub.add_parser( "issue", help="the ledger block that sits at the top of each " @@ -1163,6 +1296,8 @@ def main(argv=None) -> int: return RC_USAGE try: + if verb == "pull": + return cmd_pull(root, mod, a) if verb == "checkin": return cmd_checkin(root, mod, a) if verb == "issue": diff --git a/agents/conductors/cortex/cortex.sh b/agents/conductors/cortex/cortex.sh index 8d5b2a9a..f96dcc13 100755 --- a/agents/conductors/cortex/cortex.sh +++ b/agents/conductors/cortex/cortex.sh @@ -5,19 +5,23 @@ # # Reasons over PyAutoCortex, the organ that holds the science body map and one # ledger per project (Now, Runs, Log): renders the Cortex board (dashboard.md -# + dashboard.html, published to Pages), runs the check-in (each project's own -# sync CLI, its `jobs` output verbatim) and syncs the ledger block onto each -# project's issue. It records cluster facts and the human's words, never a -# verdict of its own — a run is submitted only on the human's ask, and a -# result or lesson is logged only in their words. +# + dashboard.html, published to Pages), runs the check-in (stamp, render, +# push, read the ledger back by project — on any surface), pulls the cluster +# through each project's own sync CLI (the laptop only, where the science +# roots are) and syncs the ledger block onto each project's issue. It records +# cluster facts and the human's words, never a verdict of its own — a run is +# submitted only on the human's ask, and a result or lesson is logged only in +# their words. # # Usage: # cortex.sh # census (default) # cortex.sh census --json # machine-readable # cortex.sh dashboard --check # exit 1 if the pages are stale # cortex.sh dashboard --apply # write dashboard.md + dashboard.html -# cortex.sh checkin --dry-run # what it would pull; reaches nothing -# cortex.sh checkin --apply # the check-in: pull, jobs, stamp, render, push +# cortex.sh pull # the laptop: each project's pull, then jobs verbatim +# cortex.sh pull --dry-run # what it would pull; reaches nothing +# cortex.sh checkin --dry-run # what it would write; writes nothing +# cortex.sh checkin --apply # the check-in: stamp, render, push, read back # cortex.sh issue [--apply] # the ledger block for each project's issue # cortex.sh --cortex # point at another PyAutoCortex checkout diff --git a/bin/pyauto-brain b/bin/pyauto-brain index a2122bf2..528f635d 100755 --- a/bin/pyauto-brain +++ b/bin/pyauto-brain @@ -18,7 +18,7 @@ # pyauto-brain workspace [args] (conductor) the Voice: plan/survey workspace + HowTo example authorship — WorkspaceDecision (writes nothing) # pyauto-brain eyes [args] (conductor) the Eyes: survey/review a visualization workspace's figure surface — EyesSurvey/EyesReviewSurface (writes nothing) # pyauto-brain profiling [args] (conductor) campaign/ingest/triage plans over the profiling workspace -# pyauto-brain cortex [args] (conductor) the science check-in: checkin/census/dashboard/issue +# pyauto-brain cortex [args] (conductor) the science check-in: pull/checkin/census/dashboard/issue # pyauto-brain hygiene [args] (conductor) code-quality upkeep: perf/tidy/noise/deps/docs — HygieneDecision (modes staged) # pyauto-brain clone [args] (conductor) analyze a library+workspace against the reference assistant — CloneDecision (writes nothing) # (clone sync: re-apply the reference's generic-file diff to its born @@ -87,7 +87,7 @@ declare -A AGENT_DESC=( [refactor]="The renewal function: plan behaviour-preserving restructuring — RefactorDecision; default-safe under --auto" [workspace]="The voice — the organism's expressive function: plan/survey workspace + HowTo example authorship (workspace|howto registers) — WorkspaceDecision (never writes)" [eyes]="The perceptive function — the organism's sense of its own appearance: survey/review a visualization workspace's figure surface, critiques route to intake/start_dev — EyesSurvey/EyesReviewSurface (never renders, never edits)" - [cortex]="The learning function — where the organism keeps track of what is true: the per-project science ledger over PyAutoCortex ('cortex checkin') — pull every active project through its own sync CLI, show where each run stands, re-render the board; it records cluster facts and the human's words, never a verdict of its own" + [cortex]="The learning function — where the organism keeps track of what is true: the per-project science ledger over PyAutoCortex — 'cortex pull' on the laptop pulls every active project through its own sync CLI and shows where each run stands; 'cortex checkin' anywhere stamps, re-renders the board and pushes the ledger; it records cluster facts and the human's words, never a verdict of its own" [profiling]="The proprioceptive function — the organism's sense of its own effort: campaign/ingest/triage plans over the autolens_profiling workspace — ProfilingDecision" [hygiene]="The maintenance function — the organism's sense of its own upkeep: code-quality debt (dev-loop cost + tidiness), delegating fixes — HygieneDecision" [clone]="The Mitosis Agent: partition the reference assistant, analyze the domain, emit the CloneDecision; --apply --mode lightweight-seed delegates the seed birth to Build; 'clone sync' patches the reference's generic-file diff onto the born siblings (dry run by default; rejected hunks are a human decision)" diff --git a/skills/cortex/SKILL.md b/skills/cortex/SKILL.md index 225c310f..ba6ef06a 100644 --- a/skills/cortex/SKILL.md +++ b/skills/cortex/SKILL.md @@ -1,12 +1,13 @@ --- name: cortex -description: Check in on the science — run the PyAutoBrain Cortex Agent's one door (pull every active project through its own sync CLI, show where each run stands, re-render the board, push the ledger) and read each project's ledger back to the human — Now, the runs on the cluster, the last entries — then record what they say with the Cortex's own cortex.py verbs. Use for science runs and project ledgers; never for development tasks, which are the Mind's. +description: Check in on the science — run the PyAutoBrain Cortex Agent's two doors ('cortex pull' on the laptop, which pulls every active project through its own sync CLI and shows where each run stands; 'cortex checkin' anywhere, which stamps, re-renders and pushes the board) and read each project's ledger back to the human — Now, the runs, the last entries — then record what they say with the Cortex's own cortex.py verbs. Use for science runs and project ledgers; never for development tasks, which are the Mind's. --- # Cortex -Follow [`cortex.md`](cortex.md) exactly: it is the check-in sequence, and the -individual verbs are its appendix. The conductor records cluster facts and the +Follow [`cortex.md`](cortex.md) exactly: it is the check-in sequence — `pull` +on the laptop, `checkin` on any surface — and the individual verbs are its +appendix. The conductor records cluster facts and the human's words, never a verdict of its own: it never scores a result, never drafts a ruling, never writes a `result` or `lesson` entry the human did not say. A run is submitted only when the human asks for it in the session — then diff --git a/skills/cortex/cortex.md b/skills/cortex/cortex.md index 41cf28f9..64e0bffd 100644 --- a/skills/cortex/cortex.md +++ b/skills/cortex/cortex.md @@ -1,12 +1,18 @@ # /cortex — check in on the science (via the Brain Cortex Agent) **This is the check-in.** You have runs on a cluster; this door finds out where -they got to. It pulls every active project through that project's *own* sync -CLI, shows that CLI's `jobs` output verbatim, re-renders the board, pushes the -ledger when it is allowed to, and hands you each project's ledger back — **Now**, -the runs on the cluster, the last entries — with the `cortex.py` lines you are -most likely to type next. It records cluster facts and your words. It never -decides what a result meant. +they got to — in **two verbs, split by the machine they need**: + +- `pull` asks the cluster, through each project's *own* sync CLI, and shows + that CLI's `jobs` output verbatim. It runs **on the laptop only**: every + science root is a `local_path` out of `projects.yaml`, and it exists on one + machine. Asked anywhere else it says so, once, and stops. +- `checkin` stamps, re-renders the board, pushes the ledger when it is allowed + to, and hands you each project's ledger back — **Now**, the runs, the last + entries — with the `cortex.py` lines you are most likely to type next. It + reaches no cluster, so it works **anywhere**: web, mobile, laptop. + +It records cluster facts and your words. It never decides what a result meant. Development work is the Mind's and goes through `/intake` and `/start_dev`; this door is for what the organism is *finding out*, not what it is building. @@ -19,50 +25,54 @@ note`). Every write to one is a verb of `PyAutoCortex/scripts/cortex.py`. ## Do -### 1. Look before you pull +### 1. On the laptop, pull first ```bash -bin/pyauto-brain cortex checkin --dry-run +bin/pyauto-brain cortex pull --dry-run # names every pull; reaches nothing +bin/pyauto-brain cortex pull # pull, then jobs verbatim +bin/pyauto-brain cortex pull --project subhalo_validation ``` -Prints every project it would sweep and the exact `cd && - pull` it would run for each (and the `jobs` line where the ledger -lists runs). It reaches no cluster and writes nothing. Read it to the human — -especially if a project they expect is missing (it is missing because its -`projects.yaml` row is not `status: active` and its ledger lists no run). +Each project's own ` pull`, streamed as it comes (a pull takes +minutes; do not wrap it in anything that buffers), then — where the row has a +`jobs` verb and the ledger lists runs — its ` jobs`, printed +**verbatim**. Nothing is parsed, no state flips, nothing is written. A pull +that exits non-zero is recorded against *that* project, the sweep carries on, +and the verb exits 1. -### 2. Check in +**Not on the laptop?** `pull` exits **2** and names each missing root: *"this +is not the laptop — run `checkin` here and `pull` on the laptop."* That is the +expected answer on web and mobile, not a failure to work around. Go to step 2; +the runs you read back are the ledger's word, and say so. + +### 2. Check in — on any surface ```bash +bin/pyauto-brain cortex checkin --dry-run # what it would write bin/pyauto-brain cortex checkin --apply # push per the rule below bin/pyauto-brain cortex checkin --apply --no-push # never push bin/pyauto-brain cortex checkin --apply --project subhalo_validation -bin/pyauto-brain cortex checkin --apply --skip-pull # no pull; jobs, stamp, render ``` It runs, in order: -1. **Sync** — each project's own ` pull`, output streamed as it - comes (a pull takes minutes; do not wrap this in anything that buffers). - A pull that exits non-zero is recorded against *that* project and the sweep - carries on. -2. **Jobs** — where the row has a `jobs` verb and the ledger lists runs, the - project's own ` jobs`, printed **verbatim**. Nothing is parsed - and no state flips. -3. **Render** — the refresh stamp into `checkin.yaml` (the board's "Last +1. **Render** — the refresh stamp into `checkin.yaml` (the board's "Last check-in", red on the Pages twin once stale), then `dashboard.md` + `dashboard.html`. -4. **Push** — see the rule below. -5. **Summarise by project** — printed last, so it is what the chat sees. +2. **Push** — see the rule below. +3. **Summarise by project** — printed last, so it is what the chat sees. + +It shells out to no sync CLI. `--skip-pull` is accepted and ignored with a +notice, so an old paste still runs. ### 3. Read the summary back, project by project The last block of the output is the deliverable: one section per project — -`key — summary`, what its pull did, the jobs output, then **Now**, the -**runs** and the **last entries** as the ledger holds them. Read it to the -human as *where each project is*, in that shape: what they said they were -doing, what is on the cluster, what they last wrote down. Then stop and let -them talk. +`key — summary`, then **Now**, the **runs** and the **last entries** as the +ledger holds them. Read it to the human as *where each project is*, in that +shape: what they said they were doing, what the ledger says is on the cluster, +what they last wrote down. If you could not pull, say that the runs are the +ledger's word and the cluster was not asked. Then stop and let them talk. ### 4. Record what the human says @@ -77,7 +87,7 @@ python3 scripts/cortex.py now "" ``` - `running` and `done` are **cluster facts**: the agent may run them straight - from the `jobs` output the check-in printed, and say it did. + from the `jobs` output `pull` printed, and say it did. - A `result` or a `lesson` is written **only in the human's words, when they say it**. If you read a results file, tell the human what you see; they say what to log. Never paraphrase a result into the ledger unasked. @@ -100,13 +110,13 @@ the entry protocol, not the work. ## The push rule -`--push` is allowed only when **`gh auth status` succeeds** *and* **the Cortex -checkout is clean on `main`**. That `gh` call is a *probe*, not a GitHub -operation — a session without `gh` (a remote one, which reaches GitHub through -the `mcp__github__*` tools instead; the map is -[`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md)) simply gets `--no-push` and is -told so. Do not install `gh` to change that answer: the push wants a laptop -with a clean checkout, and a remote session has neither. +`--push` is allowed when **the Cortex checkout is clean on `main` with a +resolvable `origin`**, and it is the default. It asks git only — no `gh`, on +any surface: the probe that used to open this rule refused every session that +reaches GitHub another way (the map is +[`../GITHUB_ACCESS.md`](../GITHUB_ACCESS.md)), which left the ledger to the +merge bot. The push itself is the gate; if it fails, the summary says exactly +how and the commit is still on the branch. When it pushes it cuts `claude/checkin-` from a fresh `origin/main`, commits the changed paths **explicitly**, and pushes. If @@ -126,8 +136,9 @@ and nothing for the human to merge. **Never `main` directly, never `--force`.** entry is the human's words, verbatim, on their ask. - **Never edit a ledger by hand.** Every write is a `cortex.py` verb; the script refuses an edit that would not read back. -- **Only the project's own CLI reaches a cluster.** The door adds no SSH of - its own, and `--dry-run` reaches nothing at all. +- **Only the project's own CLI reaches a cluster.** `pull` adds no SSH of its + own, `checkin` reaches no cluster at all, and either `--dry-run` reaches + nothing. - **The door runs once and ends.** No timer, no subscription, no cron, no loop — you check in, you report, you stop. - **The door names the assistant, never reads it.** No assistant page is @@ -144,7 +155,8 @@ checkout. | Verb | Answers | |------|---------| -| `checkin [--dry-run\|--apply] [--push\|--no-push] [--project KEY] [--skip-pull]` | Where is my science? The whole sequence above. Exit **1** = a pull failed or the tree does not check | +| `pull [--project KEY] [--dry-run]` | What does the cluster say? Each project's own pull, then its `jobs` output verbatim. The laptop only. Exit **1** = a pull failed · **2** = no project's `local_path` is on this machine | +| `checkin [--dry-run\|--apply] [--push\|--no-push] [--project KEY]` | Where is my science? Stamp, render, push, read each ledger back. Any surface. Exit **1** = the tree does not check | | `census [--json]` | What is the Cortex holding? Per project: status, runs by state, log length, last update; the totals; the last check-in stamp | | `dashboard --check` | Are the committed pages current? Exit **1** = stale (the refresh workflow's contract) | | `dashboard --apply` | Regenerate `dashboard.md` + `dashboard.html` — never hand-edit those two | diff --git a/tests/test_cortex_conductor.py b/tests/test_cortex_conductor.py index 32f84a1c..21f97e98 100644 --- a/tests/test_cortex_conductor.py +++ b/tests/test_cortex_conductor.py @@ -87,6 +87,16 @@ def _run(args, cwd=None, env=None): """ +def wire_missing(root: Path, tmp_path: Path): + """Point every `local_path` at a directory that is not there — the web and + mobile surface, where a science root is a laptop path and nothing else.""" + text = (root / "projects.yaml").read_text(encoding="utf-8") + for key in re.findall(r"^([a-z][a-z0-9_]*):$", text, re.M): + text = text.replace(f"local_path: /tmp/{key}\n", + f"local_path: {tmp_path / 'not-here' / key}\n") + (root / "projects.yaml").write_text(text, encoding="utf-8") + + def wire_cli(root: Path, tmp_path: Path, fail=(), jobs="3002_[0-3] ral RUNNING"): """Point every `local_path` of the copied fixture at a directory holding a fake `hpc/sync` that echoes — so `--apply` pulls something that exists @@ -187,7 +197,13 @@ def test_one_resume_chip_per_active_project_and_no_other_chips(skeleton): "nothing until I say.") in page # `assistant: none` names no assistant assert ("and then /tmp/single/NOTES.md; tell me where I left off" in page) - assert "since the last check-in (2026-09-02T09:00Z)" in page + # two lines, because the two halves do not run on the same machine + assert ("/cortex — on the laptop: `pyauto-brain cortex pull` — pull every " + "active science project through its own sync CLI and show me " + "where each run stands." in page) + assert ("/cortex — anywhere: `pyauto-brain cortex checkin --apply --push` " + "— stamp, re-render and push the board since the last check-in " + "(2026-09-02T09:00Z), then read me the by-project summary." in page) assert "Record nothing about results — I will tell you what to log." in page assert "### Last check-in: 2026-09-02T09:00Z" in page assert "retire" not in page.lower().replace("retired", "") @@ -263,7 +279,8 @@ def test_the_html_twin_wears_the_theme_with_real_copy_buttons(skeleton): assert _cortex._theme_css("cortex") in html assert html.count('