From 68787ef13d6650ce939acfba9e8acb5912ef569d Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 7 Nov 2026 14:59:24 +0000 Subject: [PATCH] skills: trim batch and cortex under the 200-line budget; report token load in CI Two of the remaining offenders in bin/check_skill_line_counts.sh, from PyAutoMind draft/maintenance/organs/reduce_session_token_load.md: - batch: 274 -> 200 lines (SKILL.md + batch.md). The member-session contract, brief verbs, collect recipes, integration worktree and the batch-complete criteria move word for word to skills/batch/reference.md; batch.md keeps each rule's one-line summary and a pointer. - cortex: 232 -> 199 lines. New-project procedure, push mechanics and the verbs appendix move word for word to skills/cortex/reference.md. No rule, gate or refusal is removed. tests.yml now prints `token_load.py report` on every PR, and the line-count step's comment names what is left before it can be made blocking (start_dev and prm, both brought under budget by #597). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016nhQ8NoTm1hEGXkFTcNwbd --- .github/workflows/tests.yml | 15 +++- skills/batch/batch.md | 152 +++++++++--------------------------- skills/batch/reference.md | 113 +++++++++++++++++++++++++++ skills/cortex/SKILL.md | 4 +- skills/cortex/cortex.md | 54 +++---------- skills/cortex/reference.md | 55 +++++++++++++ 6 files changed, 232 insertions(+), 161 deletions(-) create mode 100644 skills/batch/reference.md create mode 100644 skills/cortex/reference.md diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9ff09255..073dcbbc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -107,13 +107,22 @@ jobs: run: bash PyAutoBrain/bin/install.sh --check-project-discovery # A skill's SKILL.md + body is MANDATORY context every time the skill # loads, so line count is a per-invocation token cost, not a style - # preference. Report-only: `batch` and `prm` are over the 200-line budget - # today and trimming them is its own task — this step makes the debt - # visible on every PR without reddening a gate nobody can currently pass. + # preference. Report-only while `start_dev` and `prm` are over the + # 200-line budget: batch, cortex and Mind's create_issue were trimmed + # under it on 2026-11-07 and PyAutoBrain#597 brings the last two under. + # Once both are on main, drop `continue-on-error` to make this blocking + # (PyAutoMind draft/maintenance/organs/reduce_session_token_load.md). - name: Skill line-count budget (report-only — known offenders) continue-on-error: true working-directory: PyAutoBrain run: bash bin/check_skill_line_counts.sh + # The token-load numbers the same Mind prompt targets (AGENTS.md tokens, + # start_dev / prm procedure lines, completion-record median), printed on + # every PR so the budget is measured rather than remembered. `report` + # always exits 0: this layout has no workspace AGENTS.md or PyAutoMemory + # checkout, so `check` would fail on what is absent, not on a regression. + - name: Token load report (report-only) + run: python3 PyAutoMind/scripts/token_load.py report --root "$GITHUB_WORKSPACE" - name: Tenant firewall (instance facts stay in declared config surfaces) run: > python3 PyAutoMind/scripts/repos_sync.py --check diff --git a/skills/batch/batch.md b/skills/batch/batch.md index e6094516..6783b8d9 100644 --- a/skills/batch/batch.md +++ b/skills/batch/batch.md @@ -35,13 +35,12 @@ never dipped, and every dipped pick carries a one-line reason in the digest. Report, per task they named: - **taken** — with its tier and review-minutes; -- **rejected, and why** — in the planner's own words. The reasons that come up - most: `autonomy human-required — would park at ship` (it cannot run unattended - at all — it would stop at the ship checkpoint and come back as a question, - which is the failure this workflow exists to remove; `supervised` no longer - parks there, see AUTONOMY.md "Decide-and-flag"), `Status: says the work is - already done`, `epic phase N is not next`, ` already claimed this - shift`, `would exceed the budget`. +- **rejected, and why** — in the planner's own words. Most common: + `autonomy human-required — would park at ship` (it cannot run unattended; it + would come back as a question — `supervised` no longer parks, AUTONOMY.md + "Decide-and-flag"), `Status: says the work is already done`, `epic + phase N is not next`, ` already claimed this shift`, `would exceed the + budget`. If everything they named is rejected, **say so plainly and offer the planner's own proposal instead** — never hand back a batch they did not ask for as though @@ -71,50 +70,25 @@ In order: library; they are the ONLY thing a later "generated by an earlier member" YELLOW classification may match against (`AUTONOMY.md`, leg 4). 2. Write `PyAutoMind/batches/-.md` from the schema in that - folder's `AGENTS.md` — members, planned review-minutes, the reason set, `expected-effects:` and - **`review-at:`** — **before** any session starts. That file is what makes the - launch auditable. `review-at:` is when the human expects to be back, and it - is where the grant expires; **if they did not say, ask before dispatching.** - It is the one thing only they know — never infer it from a schedule, a - previous batch, or the time of day, and do not dispatch without it. - **If the human says they will want to *run* the batch, write - `- integration: yes` into the record** — collect then builds the review's - integration worktree without anyone remembering a flag. -3. Start one session per member, each carrying `/start_dev --auto` - plus the member-session contract below — the batch record is what informs a - member of the shift's grant (it reads it at leg 4), not the dispatch line. Spawn them if this harness can; otherwise hand - the human the lines to paste. **One session per member, never shared**: a - shared session serialises them and carries one member's context into the - next. **`local-dev` members go first** (2026-08-31): they are pasted into - laptop CLI chats and their RAL submissions queue while the laptop is still - on — the priority use of the remaining laptop hours is getting cluster - queues running; cloud members follow, they do not need the laptop. - - **The member-session contract (2026-08-31, both measured that night):** - - - *Spawned from the orchestrator's session template, never bare* - (2026-11-03). Under a brief, every worker starts from the same template - the orchestrator uses — sources, bootstrap, the brief's path — so the two - points below are met by construction rather than remembered. - - - *Spawned cloud sessions need sources and a bootstrap preamble.* A session - created bare (environment inherited, no source repos) has no clones, no - skills and no GitHub scope — the whole first wave died on - `Unknown command: /start_dev`. Seed `PyAutoMind@main` as the session - source and prepend: run `scripts/session_bootstrap.sh`; attach - PyAutoLabs/PyAutoBrain via `add_repo` (push) + `register_repo_root`; read - `PyAutoBrain/skills/GITHUB_ACCESS.md`; read the batch record; then follow - `skills/start_dev/start_dev.md` for the prompt in `--auto` mode. - - *Members END at their deliverable — a green PR, a posted verdict, or a - park.* The dispatch line must say, and members must obey: **do not watch - the PR, do not `subscribe_pr_activity`, do not schedule check-ins or - routines after the last push.** The batch review owns everything that - follows. This is no longer a batch-only exemption: every session ends at - its deliverable (`PyAutoMind/policy/end_at_deliverable.md`), `/prm` - included. - Five members self-armed 2–4-hourly check-ins on green PRs overnight and - drained usage with no task active. At collect, the orchestrator deletes - any member-armed routine it finds and archives finished member sessions. + folder's `AGENTS.md` — members, planned review-minutes, the reason set, + `expected-effects:` and **`review-at:`** — **before** any session starts; + that file makes the launch auditable. `review-at:` is when the human expects + to be back and where the grant expires: **if they did not say, ask before + dispatching** — never infer it from a schedule, a previous batch, or the + time of day. **If they will want to *run* the batch, write + `- integration: yes` into the record** (collect then builds the worktree). +3. Start one session per member, each carrying `/start_dev --auto` plus + the member-session contract below (the batch record informs a member of the + shift's grant at leg 4, not the dispatch line). Spawn them if this harness + can; otherwise hand the human the lines to paste. **One session per member, + never shared** — sharing serialises them and leaks context. **`local-dev` + members go first** (2026-08-31): their RAL submissions queue while the + laptop is still on; cloud members follow. + + **The member-session contract** (2026-08-31) is in [`reference.md`](reference.md): + members spawn from the orchestrator's template with sources and the bootstrap + preamble, and **END at their deliverable** — no PR watching, no + `subscribe_pr_activity`, no check-ins (`PyAutoMind/policy/end_at_deliverable.md`). 4. **Open the packet at dispatch** (2026-08-31): write the review page to `PyAutoMind/batches/packets/-.html` with every member present — dev members as stubs, overnight runs as **PENDING** entries — and stamp it @@ -122,14 +96,8 @@ In order: collect fills it in. 5. Confirm what was dispatched, and stop. Do not follow the runs. -**Brief verbs.** `bin/pyauto-brain batch brief --check ` validates a -brief against the `batches/AGENTS.md` schema (every error names its key; -exit 1 refuses it), and `batch plan --brief ` composes inside it: named -tasks first, then only the backlog its policy covers, against its -`review-minutes:`. Run the check before writing a brief's `review-at:` into -`batches/`. Dispatch is the watcher's (below), not a verb. `batch digest ---record ` prints a shift's digest and writes nothing; the record append -and the one issue comment are the watcher's, at `review-at:`. +**Brief verbs** (`batch brief --check`, `batch plan --brief`, `batch digest`): +[`reference.md`](reference.md). Run the check before writing a brief's `review-at:`. ## The watcher (phases 3a–3d) @@ -150,47 +118,18 @@ What a tick does, its state, caps and the install commands: `agents/conductors/b bin/pyauto-brain batch collect --slot - --evidence ev.json --apply ``` -- **Gather the evidence, then hand it over.** Collect has no GitHub of its - own. In a web session, read each member's PRs with the GitHub MCP tools - (`pull_request_read` for state and diff counts, the check rollup or - `actions_list` for the checks — `PyAutoBrain/skills/GITHUB_ACCESS.md` maps - each operation) and write them into the evidence JSON that the conductor's - `AGENTS.md` documents under "The collect recipe". On the laptop lane - `--fetch` does the same by running one `gh pr view` per PR. Run it once - without `--apply` to read the report; run it again with `--apply` to write - the packet and stamp the record. -- **"I want to run the whole batch."** — - `bin/pyauto-brain batch collect --slot - --integration --apply` - (laptop only). One worktree root per slot under - `~/Code/PyAutoLabs-wt/integration-/`, each affected repo on - `integration/` cut from `origin/main` with every member's head merged - in dispatch order. Hand the human the `source /activate.sh` line: once - it is sourced a **library** member's change is live anywhere (it is on the - `PYTHONPATH`), while a **workspace** member's script must be run from inside - `/`. A member that conflicts is **left out and named with - the conflicting files** — report that as the answer to "how would this - resolve at the end?", not as a failure. Nothing is pushed, no PR is opened, - no remote ref is touched. If the reviewer needs it on another machine or in - CI, add `--push`: one real `integration/` per repo, pushed with the - laptop's own git auth, never forced, never a PR, and swept after the record's - `sweep-after:` date. The first push of a slot is the human's call. +- **Gather the evidence, then hand it over** — collect has no GitHub of its own; + the web-session (MCP) and laptop (`--fetch`) recipes are in [`reference.md`](reference.md). +- **"I want to run the whole batch."** — `batch collect --slot - + --integration --apply` (laptop only; nothing pushed without `--push`, the + human's call). What it builds and how conflicts read: [`reference.md`](reference.md). - **What comes back is scored, not summarised.** Six legs per member (pr · diff · checks · green · witness · adversary), one health word (FAILED · NOT-DELIVERED · SUSPECT · HEALTHY · PENDING · MERGED), failures at the top. A leg with no evidence is UNOBSERVABLE and never delivered — a member you did not look up reaches the human as SUSPECT, not as clean. -- **The PENDING entries fill themselves in.** `--apply` regenerates each - member's section in place — same path, same id — and stamps the page - `refreshed:`, normally while the human is already reading the finished - members. No other member's markup is touched, so their stored notes and - chips survive. -- **Science runs are not batch members.** Checking in on the science is its - own door — `/cortex`, over `bin/pyauto-brain cortex collect --pull --apply`, - which pulls every active project, scores every `submitted | running` phase - against its pre-registered witness and moves what came back to - `awaiting-ruling`. It needs no record, no slot and no packet. The science - board this conductor once opened (`--kind cortex`) was retired on - 2026-09-03; see `PyAutoBrain/skills/cortex/cortex.md`. +- **PENDING entries fill themselves in** on `--apply`, and **science runs are + not batch members** (`/cortex`): [`reference.md`](reference.md). **Before reading any PR from a batch, the independent adversary leg must have run** (`AUTONOMY.md` leg 5): `bin/pyauto-brain review --task --witness @@ -216,25 +155,12 @@ none of them; that part is yours, member by member: the **top of `queue.md`**. They never write a prompt file. - **reject** — route it to `condemned.md`. -**Review closes the batch; follow-ups never block the next one** (2026-08-31). -Every tweak and follow-up is *queued*, enacted in the next batch the human -launches — it is never executed inside the review, and an open follow-up is -never a reason to hold the next dispatch. The batch is complete when: accepted -PRs are merged, science rulings are in their ledgers, follow-ups sit at the top -of `queue.md`, the packet page is archived in `batches/packets/`, and the batch -record carries `reviewed-at:` (when they actually sat down — the calibration of -their own `review-at:` estimate), `delivered:` (see below), `review:` (the -review file's path) and **`review-minutes-actual:`**. That last number is the -only calibration the review estimate will ever get, so ask for it if the human -does not volunteer it. +**Review closes the batch; follow-ups never block the next one** (2026-08-31): +they are queued for the next batch, never executed inside the review. What +"complete" means, and asking for `review-minutes-actual:`: [`reference.md`](reference.md). -**Under a brief, the digest is the review surface** (2026-11-03). Collect -appends a `## Digest` to the record — brief work, then backlog picks with a -one-line reason each, one proof packet per task, then the shift counters — and -posts it once as a comment on the shift's `issue:`. The record plus that comment -is what the human reads; the HTML packet is written only when the brief says -`packet: yes`. Formats: `PyAutoMind/batches/AGENTS.md`, "Digest" and "Proof -packet". +**Under a brief, the digest is the review surface** (2026-11-03) — the record +plus one comment on the shift's `issue:`; see [`reference.md`](reference.md). **`delivered:` is not "green".** A cloud session's green status means it exited without an infrastructure error — not that the task succeeded. A member counts diff --git a/skills/batch/reference.md b/skills/batch/reference.md new file mode 100644 index 00000000..6f40c094 --- /dev/null +++ b/skills/batch/reference.md @@ -0,0 +1,113 @@ +# Batch — reference + +Moved word for word from [`batch.md`](batch.md) to keep the skill's mandatory +load under its 200-line budget. Read a section when the step that needs it is +reached; `batch.md` points here from each one. + +## The member-session contract (dispatch step 3) + +**The member-session contract (2026-08-31, both measured that night):** + +- *Spawned from the orchestrator's session template, never bare* + (2026-11-03). Under a brief, every worker starts from the same template + the orchestrator uses — sources, bootstrap, the brief's path — so the two + points below are met by construction rather than remembered. + +- *Spawned cloud sessions need sources and a bootstrap preamble.* A session + created bare (environment inherited, no source repos) has no clones, no + skills and no GitHub scope — the whole first wave died on + `Unknown command: /start_dev`. Seed `PyAutoMind@main` as the session + source and prepend: run `scripts/session_bootstrap.sh`; attach + PyAutoLabs/PyAutoBrain via `add_repo` (push) + `register_repo_root`; read + `PyAutoBrain/skills/GITHUB_ACCESS.md`; read the batch record; then follow + `skills/start_dev/start_dev.md` for the prompt in `--auto` mode. +- *Members END at their deliverable — a green PR, a posted verdict, or a + park.* The dispatch line must say, and members must obey: **do not watch + the PR, do not `subscribe_pr_activity`, do not schedule check-ins or + routines after the last push.** The batch review owns everything that + follows. This is no longer a batch-only exemption: every session ends at + its deliverable (`PyAutoMind/policy/end_at_deliverable.md`), `/prm` + included. + Five members self-armed 2–4-hourly check-ins on green PRs overnight and + drained usage with no task active. At collect, the orchestrator deletes + any member-armed routine it finds and archives finished member sessions. + +## Collect: the integration worktree + +- **"I want to run the whole batch."** — + `bin/pyauto-brain batch collect --slot - --integration --apply` + (laptop only). One worktree root per slot under + `~/Code/PyAutoLabs-wt/integration-/`, each affected repo on + `integration/` cut from `origin/main` with every member's head merged + in dispatch order. Hand the human the `source /activate.sh` line: once + it is sourced a **library** member's change is live anywhere (it is on the + `PYTHONPATH`), while a **workspace** member's script must be run from inside + `/`. A member that conflicts is **left out and named with + the conflicting files** — report that as the answer to "how would this + resolve at the end?", not as a failure. Nothing is pushed, no PR is opened, + no remote ref is touched. If the reviewer needs it on another machine or in + CI, add `--push`: one real `integration/` per repo, pushed with the + laptop's own git auth, never forced, never a PR, and swept after the record's + `sweep-after:` date. The first push of a slot is the human's call. + +## Collect: PENDING entries and science runs + +- **The PENDING entries fill themselves in.** `--apply` regenerates each + member's section in place — same path, same id — and stamps the page + `refreshed:`, normally while the human is already reading the finished + members. No other member's markup is touched, so their stored notes and + chips survive. +- **Science runs are not batch members.** Checking in on the science is its + own door — `/cortex`, over `bin/pyauto-brain cortex collect --pull --apply`, + which pulls every active project, scores every `submitted | running` phase + against its pre-registered witness and moves what came back to + `awaiting-ruling`. It needs no record, no slot and no packet. The science + board this conductor once opened (`--kind cortex`) was retired on + 2026-09-03; see `PyAutoBrain/skills/cortex/cortex.md`. + +## Under a brief, the digest is the review surface + +**Under a brief, the digest is the review surface** (2026-11-03). Collect +appends a `## Digest` to the record — brief work, then backlog picks with a +one-line reason each, one proof packet per task, then the shift counters — and +posts it once as a comment on the shift's `issue:`. The record plus that comment +is what the human reads; the HTML packet is written only when the brief says +`packet: yes`. Formats: `PyAutoMind/batches/AGENTS.md`, "Digest" and "Proof +packet". + +## Brief verbs + +**Brief verbs.** `bin/pyauto-brain batch brief --check ` validates a +brief against the `batches/AGENTS.md` schema (every error names its key; +exit 1 refuses it), and `batch plan --brief ` composes inside it: named +tasks first, then only the backlog its policy covers, against its +`review-minutes:`. Run the check before writing a brief's `review-at:` into +`batches/`. Dispatch is the watcher's (`batch.md`, "The watcher"), not a verb. `batch digest +--record ` prints a shift's digest and writes nothing; the record append +and the one issue comment are the watcher's, at `review-at:`. + +## Collect: gathering the evidence + +- **Gather the evidence, then hand it over.** Collect has no GitHub of its + own. In a web session, read each member's PRs with the GitHub MCP tools + (`pull_request_read` for state and diff counts, the check rollup or + `actions_list` for the checks — `PyAutoBrain/skills/GITHUB_ACCESS.md` maps + each operation) and write them into the evidence JSON that the conductor's + `AGENTS.md` documents under "The collect recipe". On the laptop lane + `--fetch` does the same by running one `gh pr view` per PR. Run it once + without `--apply` to read the report; run it again with `--apply` to write + the packet and stamp the record. + +## When the batch is complete + +**Review closes the batch; follow-ups never block the next one** (2026-08-31). +Every tweak and follow-up is *queued*, enacted in the next batch the human +launches — it is never executed inside the review, and an open follow-up is +never a reason to hold the next dispatch. The batch is complete when: accepted +PRs are merged, science rulings are in their ledgers, follow-ups sit at the top +of `queue.md`, the packet page is archived in `batches/packets/`, and the batch +record carries `reviewed-at:` (when they actually sat down — the calibration of +their own `review-at:` estimate), `delivered:` (`batch.md`: "`delivered:` is not green"), `review:` (the +review file's path) and **`review-minutes-actual:`**. That last number is the +only calibration the review estimate will ever get, so ask for it if the human +does not volunteer it. diff --git a/skills/cortex/SKILL.md b/skills/cortex/SKILL.md index 9a78a60a..88f8cac1 100644 --- a/skills/cortex/SKILL.md +++ b/skills/cortex/SKILL.md @@ -6,8 +6,8 @@ description: Check in on the science via the Cortex Agent — 'cortex pull' on t # Cortex 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 +on the laptop, `checkin` on any surface — and the individual verbs are +[`reference.md`](reference.md)'s 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 adb5d133..06c4e388 100644 --- a/skills/cortex/cortex.md +++ b/skills/cortex/cortex.md @@ -122,26 +122,10 @@ the entry protocol, not the work. ### 6. Start a new project -A new Science project is born in two halves, in this order: - -1. **Scaffold** — through the domain assistant the project will work with - (`autolens_assistant` or `autofit_assistant`): run its - `skills/start-new-project.md` (Create phase) with the target folder - `///` (`development/` for a project - whose purpose is developing or validating the software). Take data from the - Science tree: copy a sample from `dataset//`, or run a standard lens - from `simulators//.py --dataset-path dataset` inside the new - folder. The assistant owns the scaffold — never hand-copy an older project. -2. **Register** — `pyauto-brain cortex birth --category - --assistant --summary ""`. The dry run prints the row it - derived from the folder (remote, `ral_root` in the same category, the - `hpc/sync` verbs, the ledger file); show it to the human, then `--apply`: - it cuts `claude/birth-`, writes the row and ledger through - `scripts/cortex.py birth`, and pushes when the Cortex's classifier calls it - a birth (which lands by itself). It creates no GitHub remote and reaches no - cluster — it prints those lines for the human. - -`pyauto-brain cortex drift` should then be clean for the new project. +Two halves, in this order: **scaffold** through the domain assistant's +`skills/start-new-project.md` (never hand-copy an older project), then +**register** with `pyauto-brain cortex birth …` (dry run first, shown to +the human, then `--apply`). The full procedure: [`reference.md`](reference.md). ## The push rule @@ -153,12 +137,9 @@ reaches GitHub another way (the map is 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 -`scripts/ledger_merge.py classify` calls the diff *code*, it stops before the -branch is cut and says why. `ledger_merge.yml` merges a ledger-only -`claude/**` push into `main` and deletes the branch — there is no PR to open -and nothing for the human to merge. **Never `main` directly, never `--force`.** +What a push does (`claude/checkin-`, explicit paths, merged by +`ledger_merge.yml`): [`reference.md`](reference.md). **Never `main` directly, +never `--force`.** ## The rules that do not bend @@ -197,20 +178,7 @@ and nothing for the human to merge. **Never `main` directly, never `--force`.** changes a `projects.yaml` row's `status:` and `note:` and logs it; the row and the ledger stay. It refuses while the ledger still lists a run. -## Appendix — the verbs it composes - -`checkin` is a composition; each part is still runnable on its own, and -`--cortex ` (a flag of the *subcommand*) points any of them at another -checkout. - -| Verb | Answers | -|------|---------| -| `pull [--project KEY] [--dry-run]` | What does the cluster say? Each project's own pull, then its `jobs` output verbatim — or, for a campaign project, its `status` output and a dry-run `sync-runs` of the digest. 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 | -| `issue [--project KEY] [--apply]` | The ledger block at the top of each project's issue (Now, Runs, the last five). `--apply` writes it there through `gh`; never creates an issue; exit **1** without `gh` | -| `drift [--science-root PATH] [--json]` | Does the register match the laptop Science tree? Errors: unregistered `active/`/`development/` folders, vanished rows, category vs status. Reads, never writes; exit **1** on an error | -| `birth --category C --assistant A --summary S [--apply] [--no-push]` | Register a scaffolded project: its row and ledger on `claude/birth-`, written by `cortex.py birth`. Dry run by default; exit **2** = refused (no folder, key or path taken, no sync verbs) | -| `retire --why "…"` (`scripts/cortex.py`) | Is this project over? Flips the row to `status: retired`, stamps the note, logs it. Exit **1** = an unknown key, an already-retired row, or a run still listed | +## The verbs + +`pull`, `checkin`, `census`, `dashboard`, `issue`, `drift`, `birth`, `retire` +— flags and exit codes: [`reference.md`](reference.md), "Appendix". diff --git a/skills/cortex/reference.md b/skills/cortex/reference.md new file mode 100644 index 00000000..47aaa4ed --- /dev/null +++ b/skills/cortex/reference.md @@ -0,0 +1,55 @@ +# /cortex — reference + +Moved word for word from [`cortex.md`](cortex.md) to keep the skill's mandatory +load under its 200-line budget. Read a section when the step that needs it is +reached. + +## Start a new project (step 6) + +A new Science project is born in two halves, in this order: + +1. **Scaffold** — through the domain assistant the project will work with + (`autolens_assistant` or `autofit_assistant`): run its + `skills/start-new-project.md` (Create phase) with the target folder + `///` (`development/` for a project + whose purpose is developing or validating the software). Take data from the + Science tree: copy a sample from `dataset//`, or run a standard lens + from `simulators//.py --dataset-path dataset` inside the new + folder. The assistant owns the scaffold — never hand-copy an older project. +2. **Register** — `pyauto-brain cortex birth --category + --assistant --summary ""`. The dry run prints the row it + derived from the folder (remote, `ral_root` in the same category, the + `hpc/sync` verbs, the ledger file); show it to the human, then `--apply`: + it cuts `claude/birth-`, writes the row and ledger through + `scripts/cortex.py birth`, and pushes when the Cortex's classifier calls it + a birth (which lands by itself). It creates no GitHub remote and reaches no + cluster — it prints those lines for the human. + +`pyauto-brain cortex drift` should then be clean for the new project. + +## The push rule: what a push does + +When it pushes it cuts `claude/checkin-` from a fresh +`origin/main`, commits the changed paths **explicitly**, and pushes. If +`scripts/ledger_merge.py classify` calls the diff *code*, it stops before the +branch is cut and says why. `ledger_merge.yml` merges a ledger-only +`claude/**` push into `main` and deletes the branch — there is no PR to open +and nothing for the human to merge. **Never `main` directly, never `--force`.** + +## Appendix — the verbs it composes + +`checkin` is a composition; each part is still runnable on its own, and +`--cortex ` (a flag of the *subcommand*) points any of them at another +checkout. + +| Verb | Answers | +|------|---------| +| `pull [--project KEY] [--dry-run]` | What does the cluster say? Each project's own pull, then its `jobs` output verbatim — or, for a campaign project, its `status` output and a dry-run `sync-runs` of the digest. 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 | +| `issue [--project KEY] [--apply]` | The ledger block at the top of each project's issue (Now, Runs, the last five). `--apply` writes it there through `gh`; never creates an issue; exit **1** without `gh` | +| `drift [--science-root PATH] [--json]` | Does the register match the laptop Science tree? Errors: unregistered `active/`/`development/` folders, vanished rows, category vs status. Reads, never writes; exit **1** on an error | +| `birth --category C --assistant A --summary S [--apply] [--no-push]` | Register a scaffolded project: its row and ledger on `claude/birth-`, written by `cortex.py birth`. Dry run by default; exit **2** = refused (no folder, key or path taken, no sync verbs) | +| `retire --why "…"` (`scripts/cortex.py`) | Is this project over? Flips the row to `status: retired`, stamps the note, logs it. Exit **1** = an unknown key, an already-retired row, or a run still listed |