From 7c871b14da1c3affcc2868e282a7467e0a58b58f Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Sun, 20 Sep 2026 16:52:08 +0100 Subject: [PATCH 01/14] docs: define capability-based orchestration --- skills/WORKFLOW.md | 79 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 73 insertions(+), 6 deletions(-) diff --git a/skills/WORKFLOW.md b/skills/WORKFLOW.md index b6a45163..888afb01 100644 --- a/skills/WORKFLOW.md +++ b/skills/WORKFLOW.md @@ -31,6 +31,70 @@ bin/pyauto-brain build --dry-run If Brain is unavailable, emulate the requested decision from its `AGENTS.md` and this file, and say that it was emulated. +## Orchestration capabilities and execution evidence + +The **orchestration environment** is the scientist-facing session currently +driving the task. The **execution environment** is wherever a particular phase +obtains the evidence it needs. They may be the same place, but they need not be. +Neither is an organ and neither owns task state: Mind remains the sole lifecycle +record. + +Reason about capabilities, not product names. Probe the current surface once and +use only capabilities it actually exposes: + +- `repository-read` / `repository-write` — inspect or change repository files; +- `github-control` — branches, commits, issues, PRs, reviews and Actions state; +- `local-filesystem` / `shell-runtime` — checkout-local files, commands and imports; +- `test-execution` — unit/integration/smoke commands in a real runtime; +- `worktrees` — isolated local task checkouts; +- `independent-review` — a reviewer genuinely independent of the authoring context; +- `remote-compute` — SSH/HPC/GPU or other environment-specific execution. + +A model/provider/app name does not imply any item in that list. In particular, a +connected Chat surface may expose read-only GitHub access, read/write GitHub +actions, or no GitHub action at all. Detect what is present; fail closed on what +is absent. + +For each phase, identify the **required evidence** first. Stay in the current +orchestration environment when its capabilities can honestly produce it. An +existing repository CI workflow on the exact branch head may provide applicable +test/smoke evidence when it runs the required scope; verify the head SHA and +individual legs rather than treating "CI green" as a generic proof. Do not add a +throwaway workflow merely to obtain a shell. + +When a capability is missing, delegate the **smallest coherent phase** that +needs it and return its diff/commit plus decision-relevant evidence to the same +Mind task. If substantial implementation itself is runtime-dependent +(scientific/numerical debugging, profiling, HPC, environment inspection, +generated artefacts), route that coherent phase to an execution environment +from the outset; Chat or another orchestration surface can still retain the +Brain decisions and user conversation. + +Independent review is evidence, not a second look by the author: the same +conversation that wrote a branch cannot self-certify the review faculty's +independence. Delegate only the review phase when that is the sole missing +capability. + +**Heart remains separate from CI.** Exact-head CI can satisfy applicable test or +smoke evidence; it never substitutes for the authoritative Heart verdict. If the +current surface cannot read fresh authoritative Heart evidence, obtaining that +evidence is itself a bounded missing-capability step. + +`Lane:` remains an intrinsic scheduling requirement (`any` or `local-dev`) +for a task that genuinely needs local data/output/SSH resources. It is not the +name of the orchestrating product and must not grow a `chatgpt`, `codex` or +`claude` value. + +### No OpenAI API fallback + +The ordinary-Chat route has **no API billing path**. Never use an OpenAI SDK, +Responses API, API Platform key, `OPENAI_API_KEY`, browser/session credential +reuse, or a local Brain process that programmatically starts a ChatGPT +conversation as a fallback. If the current Chat lacks a capability, use only an +explicitly selected supported execution surface (for example existing GitHub +Actions, Codex/Work, local shell or HPC) or stop at that phase. This invariant +does not depend on the user's API billing settings. + ## Model delegation Provider policies are intentionally asymmetric. Anthropic retains mandatory @@ -80,10 +144,11 @@ review, and Heart form the ship gate. Merge is always a current human action. - Plan Mode means present-and-wait unless explicit `--auto` changes that gate. - With no prompt, first create a concise Mind draft containing the original request verbatim. -- If a requested worker is unavailable, execute directly without weakening - permissions, review, or health gates. -- `gh` commands name GitHub operations; remote sessions translate them through - `GITHUB_ACCESS.md`. +- If a requested worker is unavailable, execute directly only when the current + surface has the required capability; otherwise use the bounded cross-environment + handoff in `MODEL_DELEGATION.md` or stop without weakening any gate. +- `gh` commands name GitHub operations; map those operations onto the authenticated + GitHub-control surface actually available via `GITHUB_ACCESS.md`. ## Task state and worktrees @@ -98,8 +163,10 @@ claim; tasks touching the same repo serialize unless a human explicitly authorizes coordination. Source the generated `activate.sh` before Python or tests. -In web/CI sessions, use available clones and explicit cache/PYTHONPATH settings. -The same Mind registry provides continuity across environments. +In web/CI sessions with clones, use those clones and explicit cache/PYTHONPATH +settings. A GitHub-control-only session may have no clone at all: it operates on +remote branches/files and records no fake `worktree:` path. The same Mind +registry and branch/commit provide continuity across environments. ## Repository routing From ed5e7744ece6b2f1dc1af10b93509603b31ec22f Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Sun, 20 Sep 2026 16:52:11 +0100 Subject: [PATCH 02/14] docs: make GitHub access operation-first --- skills/GITHUB_ACCESS.md | 70 ++++++++++++++++++++++++++++++----------- 1 file changed, 52 insertions(+), 18 deletions(-) diff --git a/skills/GITHUB_ACCESS.md b/skills/GITHUB_ACCESS.md index a240cbc5..a5154f33 100644 --- a/skills/GITHUB_ACCESS.md +++ b/skills/GITHUB_ACCESS.md @@ -1,9 +1,34 @@ -# GitHub access: `gh` is not always there +# GitHub access: operations first, clients second Shared by every skill that touches GitHub. Read this once, at the top of a run, and act on what it says for the rest of the run. -## The problem this page exists for +## Canonical contract + +The workflow asks for **GitHub operations**, not a particular client. Resolve +the authenticated GitHub-control surface once, then keep using it consistently: + +1. a local shell may have authenticated `gh`; +2. a remote/chat harness may expose native GitHub actions/tools instead, with a + repository scope and a read/write subset fixed by that connection; +3. a surface may be read-only or have no GitHub write capability at all. + +Do not infer permissions from "ChatGPT", "Codex", "Claude", mobile, web, or a +model name. Inspect the actions/permissions actually exposed. Do not perform a +dummy write just to probe access: use the first required operation, and if the +provider denies it, downgrade that capability and route the missing phase. + +The `gh` commands in skill bodies are executable commands only on the first +surface. Elsewhere they name the operation to perform. The MCP column below is +one measured adapter, not the architecture; another connected GitHub surface +may expose equivalent actions under different names. + +**No API fallback:** GitHub access in the ordinary-Chat route must never be +replaced with the OpenAI API, an OpenAI API key, ChatGPT browser automation, or +session-credential reuse. Those are not GitHub clients and are not execution +fallbacks. + +## The remote-session problem this page originally existed for Most of the workflow was written on a developer box, where `gh` is installed and authenticated, so the skills spell their GitHub steps as `gh` commands — 19 skill @@ -24,20 +49,27 @@ completion record logged it after the fact: So: decide once, up front, which surface you have, and read the procedure through that lens. -## Decide once, at the start of the run +## Resolve the GitHub-control surface once + +When a shell is available, the established probe remains: ```bash command -v gh >/dev/null 2>&1 && gh auth status >/dev/null 2>&1 \ - && echo "gh" || echo "mcp" + && echo "gh" || echo "native-tools" ``` - **`gh`** — follow the skill's commands as written. -- **`mcp`** — the `gh` lines are *the operation to perform*, not the command to - run. Translate with the table below. Do not try to install `gh` (the next - section says why it would not help), and do not report the task as blocked: the MCP surface can do everything the close-out - needs — deleting a branch is not one of the things it needs (below). - -A session cannot be half-and-half. Probe once; don't re-probe per step. +- **native GitHub actions/tools** — treat each `gh` line as the operation to + perform and translate it to the equivalent authenticated action. The mapping + below records the currently measured MCP names; use equivalent operations on + another connected surface. +- **no matching write action** — the current surface is not repository-write / + GitHub-control capable for that phase. Do not install credentials, improvise a + browser automation route, or call an OpenAI API; use the bounded execution + handoff or stop. + +Select one authenticated control surface for the run and do not mix credentials +or raw-token workarounds. Do not re-probe per step. ## Installing `gh` does not work — measured, 2026-08-27 @@ -85,7 +117,7 @@ straight into the 403s above — the failure mode the probe exists to prevent. The probe is only honest while `gh` is absent, which is the strongest reason to leave it that way. -## The mapping +## Measured `gh` ↔ MCP adapter mapping | Operation | `gh` | MCP tool | |---|---|---| @@ -117,8 +149,10 @@ leave it that way. | Create, answer or convert a Discussion | `gh api graphql` (`createDiscussion`) / the issue sidebar | **nobody in a session** — REST Discussions is read-only, GraphQL is refused; the human clicks (`PyAutoMind/policy/community_surface.md`) | | Be woken by CI / comments on a PR | *(no equivalent — a CLI polls)* | `subscribe_pr_activity`, `unsubscribe_pr_activity` exist but are **not to be armed** — sessions end at their deliverable; use `unsubscribe_pr_activity` only to clear a stale subscription | -Tool names are given unprefixed; the harness exposes them as -`mcp__github__`. If a name is not loaded, `ToolSearch` fetches its schema. +Tool names are given unprefixed for the measured MCP adapter; that harness +exposes them as `mcp__github__`. Other connected GitHub surfaces may use +different action names. Match operation semantics and permissions, not these +wire names. That last row is the one capability a run must **not** take. A subscription or a `send_later` reminder outlives the session's deliverable and wakes turns @@ -160,12 +194,12 @@ against `gh api repos/...` REST paths runs in a remote session by pointing repository set at start; `add_repo` extends it. A call outside that scope is denied — that is the scope working, not an auth problem to route around. -## Two rules that apply on both surfaces +## Two rules that apply on every surface -1. **Every comment, review or reply you author ends with the attribution - footer** — a blank line, a `---` rule, then - `_Generated by [Claude Code](https://claude.ai/code)_`. The server strips - duplicates, so include it even where the tool adds one. +1. **Do not fabricate harness attribution.** If repository policy requires an + attribution footer, identify the actual harness when it is known; otherwise + use the repository's provider-neutral wording. Never stamp a Chat/Codex run + as Claude (or vice versa) merely because an older adapter example did. 2. **Be frugal.** Post when a round resolves the task, hits a real blocker, or raises a question. The diff is the record; don't narrate each fix. From 67b3d4c2d4fb6bb522c648ca04badf4dd715e59a Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Sun, 20 Sep 2026 16:52:14 +0100 Subject: [PATCH 03/14] docs: bound cross-environment execution handoffs --- skills/MODEL_DELEGATION.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/skills/MODEL_DELEGATION.md b/skills/MODEL_DELEGATION.md index d2adfd03..62e75a9a 100644 --- a/skills/MODEL_DELEGATION.md +++ b/skills/MODEL_DELEGATION.md @@ -44,6 +44,38 @@ review faculty remains independent for both provider families. No default is defined for other model families. If a requested worker is not available, execute in-session without changing safety or approval gates. +## Cross-environment capability handoff + +A missing execution capability does not make the execution environment the new +orchestrator. The current scientist-facing session keeps planning, Mind state, +approval gates and final judgment; hand off only the smallest coherent phase +whose required evidence cannot be produced here. + +A cross-environment packet carries: + +- the existing Mind task / issue; +- repository, branch and exact starting commit; +- one coherent objective and permitted files/scope; +- required commands, runtime/scientific checks or review question; +- explicit "do not broaden/redesign unrelated work"; +- requested return: resulting commit/diff (if any), pass/fail counts and only + decision-relevant failure/environment evidence. + +The receiving environment resumes the existing branch; it does not create a +second task or lifecycle. The orchestrator consumes the returned evidence and +continues the same Brain → review/vitals → Heart → PR flow. + +**Independent review is a separate capability.** A conversation that authored +the branch cannot satisfy the independent-review leg by rereading its own diff. +If no independent worker/reviewer is available in the current surface, hand off +only the review phase or require human review. + +**No OpenAI API fallback.** An ordinary ChatGPT orchestration route must never +turn a missing worker/runtime into an OpenAI SDK, Responses API, +`OPENAI_API_KEY`, browser/session automation or other separately billed API +call. Use an explicitly chosen supported execution surface or stop at the +missing phase. + ## Bounded worker contract - Pass only the worktree, affected files, accepted plan, required commands, From ffd3cc70d1af33ecb8bb05ab4d31ad6a34798a82 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Sun, 20 Sep 2026 16:53:10 +0100 Subject: [PATCH 04/14] docs: support GitHub-only start-dev routing --- skills/start_dev/start_dev.md | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/skills/start_dev/start_dev.md b/skills/start_dev/start_dev.md index eb70e52f..33edf1c2 100644 --- a/skills/start_dev/start_dev.md +++ b/skills/start_dev/start_dev.md @@ -147,15 +147,29 @@ routing decision. ### 6. Register in Mind + route +First resolve the current surface's capabilities (WORKFLOW.md). + +**Local/worktree-capable surface:** + ```bash source "${PYAUTO_BRAIN:-$(test -d organs/PyAutoBrain && echo organs/PyAutoBrain || echo PyAutoBrain)}/bin/worktree.sh" worktree_check_conflict [repo2 ...] ``` -- **No conflict:** register the task in `PyAutoMind/active.md` with - `status: library-dev | workspace-dev` and the `worktree:` path. -- **Conflict (non-zero):** register in `PyAutoMind/planned.md` (blocked) and tell - the user what's blocking it. +**GitHub-control-only surface (no clone/worktree):** do not skip the conflict +guard. Read the current `PyAutoMind/active.md` through GitHub and inspect every +other task's `repos:` bullets. Any target repo claimed by another active task +is the same hard conflict the local helper would report. If current Mind state +cannot be read, fail closed; never infer "no conflict" from missing local files. + +- **No conflict, local:** register `status: library-dev | workspace-dev` and the + real `worktree:` path. +- **No conflict, GitHub-control-only:** register the same status, real + `session:` / `location:` metadata and repo branch claims, but **no + `worktree:` field**. A later execution environment resumes the same + branch/commit. +- **Conflict:** register in `PyAutoMind/planned.md` (blocked) and tell the user + what's holding the repo. Registry-entry formats are in [`reference.md`](reference.md) → "Registry entries". Then route: library → `/start_library`; workspace → `/start_workspace`; @@ -175,6 +189,9 @@ prompt_sync_push "prompt: route (#) → " ## Notes - Always present the issue body for review before creating it. -- If `gh auth status` fails, tell the user to run `! gh auth login`. +- Resolve GitHub operations through `GITHUB_ACCESS.md`. Only a shell-`gh` + surface can meaningfully use `gh auth login`; a connected GitHub action + surface has its own permissions and must never be repaired with an OpenAI API + key or browser/session credential. - Long-form detail (issue-body template, registry formats) is in [`reference.md`](reference.md). From 98945dca39e7297896686043679fcc96a45b04b9 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Sun, 20 Sep 2026 16:53:13 +0100 Subject: [PATCH 05/14] docs: make remote conflict checks use Mind claims --- skills/start_dev/reference.md | 46 ++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/skills/start_dev/reference.md b/skills/start_dev/reference.md index 1ef71ed5..686913e7 100644 --- a/skills/start_dev/reference.md +++ b/skills/start_dev/reference.md @@ -24,6 +24,8 @@ create_issue's base template): ### active.md (no conflict — task can start) +Local/worktree-capable surface: + ```markdown ## - issue: @@ -33,10 +35,22 @@ create_issue's base template): - repos: ``` +GitHub-control-only surface: + +```markdown +## +- issue: +- session: +- location: github-api-only (no local clone or task worktree) +- status: +- repos: + - : feature/ +``` + `status` follows the classification: library work or both → `library-dev`; -workspace work → `workspace-dev`. The `worktree:` directory does not exist yet -(`/start_library` creates it); `repos:` starts empty and is filled when branches -are created. +workspace work → `workspace-dev`. Record a `worktree:` only when that path +really exists. The `repos:` bullets are the cross-environment claims; they are +required even when no local worktree exists. ### planned.md (conflict — task is queued) @@ -53,8 +67,9 @@ are created. ``` A "conflict" means another `active.md` entry already claims one of the target -repos via its `worktree:` field. Tasks editing different repos run in parallel; -two tasks wanting the same repo must serialise. After a blocking task ships, +repos in its `repos:` block. `worktree:` is location metadata, not the claim. +Tasks editing different repos run in parallel; two tasks wanting the same repo +must serialise. After a blocking task ships, `/health status` shows the queued task as ready, then `/start_library` or `/start_workspace` begins it. @@ -183,15 +198,18 @@ PyAutoMind. Shared organ boundary and the execution-environment model are in The steps above assume a local-dev checkout with task worktrees. In other execution environments (see [`../WORKFLOW.md`](../WORKFLOW.md)): -- **web-github / analysis-only** (no local tree): skip the worktree checks - (`worktree_list_claimed`, `worktree_check_conflict`) and read branch state via - the GitHub API instead of local `git -C`: - ```bash - gh api repos///branches --jq '.[].name' | head -10 - gh api repos///branches/ --jq '.name' 2>/dev/null - ``` - Use the repo → owner mapping in WORKFLOW.md. Suggest the branch name and present - the summary as normal; on resume, verify branches via the API. +- **GitHub-control-only** (no local tree): read current branch state through the + authenticated GitHub operation surface instead of local `git -C`. **Do not + skip task-claim checks**: fetch current `PyAutoMind/active.md` and compare the + target repos against every other entry's `repos:` bullets. If Mind cannot be + read, the conflict check is unverifiable and the run fails closed. +- **Remote/CI with clones:** use the clones for branch/dirty state, but the same + current Mind `repos:` claims remain authoritative for cross-session + conflicts. + +Use the repo → owner mapping in WORKFLOW.md. Suggest the branch name and present +the same summary in every environment; on resume, verify the remote branch and +exact commit through GitHub when no clone exists. This is the same reasoning in every environment — only the source of branch state differs (local git vs GitHub API). It is not a separate "mobile mode". From 96782d512324dd25a8bd7ee196b2390523f9078f Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Sun, 20 Sep 2026 16:53:18 +0100 Subject: [PATCH 06/14] docs: add GitHub-control-only library development --- skills/start_library/start_library.md | 37 +++++++++++++++++---------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/skills/start_library/start_library.md b/skills/start_library/start_library.md index e7eb1128..2cac39d5 100644 --- a/skills/start_library/start_library.md +++ b/skills/start_library/start_library.md @@ -20,11 +20,12 @@ source "${PYAUTO_BRAIN:-$(test -d organs/PyAutoBrain && echo organs/PyAutoBrain worktree_check_conflict [repo2 ...] ``` -A conflict only fires when another `active.md` entry already claims one of the -target repos via its `worktree:` field (tasks on different repos run in -parallel). On non-zero exit, **block** and show the holding task, its worktree -and branch; the only options are finish that task first, or abort. If the repo -appears under the **same** task (resuming), proceed. +A conflict fires when another `active.md` entry claims one of the target repos +in its `repos:` block (tasks on different repos run in parallel). On a +worktree-capable surface the helper performs this check. On a +GitHub-control-only surface, read current `active.md` through GitHub and apply +the same rule; fail closed if it cannot be read. On conflict, **block** and show +the holding task plus any recorded worktree/branch. Same task = resuming. ### 2. Read the active issue (Mind) @@ -65,15 +66,24 @@ Before running Python, pytest, or smoke tests in this session, run: source ~/Code/PyAutoLabs-wt//activate.sh ``` -**Other execution environments** (web-github / ci-only — see WORKFLOW.md): there -is no local worktree. Operate on the clones present in the working directory, -`git checkout -b feature/`, and export `PYTHONPATH` (the library -repos), `NUMBA_CACHE_DIR=/tmp/numba_cache`, `MPLCONFIGDIR=/tmp/matplotlib` -manually. Register the repos in `active.md` without a `worktree:` field. +**Other capability surfaces** (see WORKFLOW.md): + +- **clone + shell, no task worktree:** operate on the provided clone, create or + resume `feature/`, export the documented cache/PYTHONPATH values, + and register no fake `worktree:`. +- **GitHub-control-only, no clone:** create or resume + `feature/` through the GitHub branch operation from current + `main`, then edit/commit files through repository-write operations. Register + `session:`, `location: github-api-only (no local clone or task worktree)` + and each `repos:` branch claim; omit `worktree:`. This surface may + implement repository changes but cannot claim local imports/tests. +- **no repository-write capability:** stop before branch creation and use the + bounded execution handoff. Do not fall back to an OpenAI API call. ### 5. Register repos in active.md (Mind) + push -Update the task entry to record the worktree path and claimed repos: +Update the task entry to record the real execution location and claimed repos. +The local form is: ```markdown ## @@ -87,8 +97,9 @@ Update the task entry to record the worktree path and claimed repos: ``` The ` - ` bullets under `repos:` are the claim — they are what -`worktree_check_conflict` compares to detect collisions from other sessions -(`worktree:` is reported alongside, but claims nothing on its own). Both +`worktree_check_conflict` (or its GitHub-only equivalent) compares to detect +collisions from other sessions. `worktree:` is location metadata only and is +omitted when no worktree exists. Both ` - : ` and ` - ()` parse; the branch is informational and may be omitted. Then: From 386cd6c2e3e1fb837ee0189892fa8a3664e084a8 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Sun, 20 Sep 2026 16:53:21 +0100 Subject: [PATCH 07/14] docs: add GitHub-control-only workspace development --- skills/start_workspace/start_workspace.md | 26 +++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/skills/start_workspace/start_workspace.md b/skills/start_workspace/start_workspace.md index 8225f8e9..a872fc47 100644 --- a/skills/start_workspace/start_workspace.md +++ b/skills/start_workspace/start_workspace.md @@ -22,9 +22,11 @@ source "${PYAUTO_BRAIN:-$(test -d organs/PyAutoBrain && echo organs/PyAutoBrain worktree_check_conflict [workspace_repo2 ...] ``` -Conflict only fires when another `active.md` entry claims a target workspace repo -via its `worktree:` field. On non-zero exit, block (finish the holding task or -abort). Same task = resuming → proceed. +Conflict fires when another `active.md` entry claims a target workspace repo +in its `repos:` block. Use the worktree helper when available; on a +GitHub-control-only surface read current `active.md` through GitHub and apply +the same rule. If the registry cannot be read, fail closed. Same task = +resuming → proceed. ### 2. Mode detection (Mind) @@ -70,12 +72,18 @@ summary" (worktree root, activation reminder, repos to edit, scripts, the scripts-only/never-notebooks rule). End: "When done, run `/ship_workspace` to validate and create PRs." -**Other execution environments** (web-github / ci-only — see WORKFLOW.md): no -local worktree; operate on the clones in the working directory, branch with -`git checkout -b feature/`, export `PYTHONPATH`/`NUMBA_CACHE_DIR`/ -`MPLCONFIGDIR` manually, and register repos in `active.md` without a `worktree:` -field. `active.md` is the shared task state across environments — no special -handoff step is needed. +**Other capability surfaces** (see WORKFLOW.md): a clone+shell surface may use +the clone directly and manual cache/PYTHONPATH settings. A +**GitHub-control-only** surface creates/resumes the feature branch through +GitHub operations, edits only the canonical `scripts/` sources through +repository-write operations, and records +`location: github-api-only (no local clone or task worktree)` plus the +`repos:` branch claims with no `worktree:` field. Notebook regeneration, +imports and smoke execution remain missing capabilities and are delegated as a +bounded later phase. A surface with no repository-write capability stops before +branch creation; it never falls back to an OpenAI API call. `active.md` and +the exact branch/commit are the cross-environment handoff — no second state +object is created. ## Notes From ab2dc1a8f8c15b0ad328bc8587cfc8ff63de08fe Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Sun, 20 Sep 2026 16:54:30 +0100 Subject: [PATCH 08/14] docs: make library ship evidence capability-based --- skills/ship_library/ship_library.md | 55 +++++++++++++++++++---------- 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/skills/ship_library/ship_library.md b/skills/ship_library/ship_library.md index d854ef72..551f10ac 100644 --- a/skills/ship_library/ship_library.md +++ b/skills/ship_library/ship_library.md @@ -29,10 +29,12 @@ WT_ROOT=~/Code/PyAutoLabs-wt/ source "$WT_ROOT/activate.sh" ``` -Legacy entries with no `worktree:` fall back to the main checkouts — warn that -the task pre-dates the worktree flow and is not parallel-safe. In other execution -environments (web-github / ci-only), use the working-directory clones with -`PYTHONPATH` exported (WORKFLOW.md). +A task with a real `worktree:` uses it. A clone+shell surface without a task +worktree may use its working-directory clone with the documented environment +settings. A **GitHub-control-only** task deliberately has no `worktree:`: +resolve each claimed `repos:` branch and exact head commit through GitHub, +inspect its diff against `main`, and never fall back to a canonical local +checkout that this surface does not possess. ### 2. Draft commit message + PR body (reasoning model) @@ -62,23 +64,40 @@ tests/smoke/review, a live human may authorize the canonical `AUTONOMY.md` "Corrective-PR exception for Heart RED" for a causal fix. Follow the selected canonical section's scope and four record sinks exactly. Neither path permits release or bypassing CI; merge requires its own current human command and green -required GitHub checks. If `pyauto-brain`/`pyauto-heart` are -unavailable, run the per-repo `pytest / -x` inside the worktree as the -gate and treat any failure as RED (WORKFLOW.md). Under `--auto`, this step is -the four-leg **autonomous-ship gate** — tests (+ downstream dependents on -public-API changes), smoke, review-faculty CLEAN, Heart — per -`AUTONOMY.md` "The autonomous-ship gate"; do not restate it here. +required GitHub checks. If the organism CLIs are unavailable, use WORKFLOW.md's capability/evidence +rules rather than weakening the gate: + +- a runtime-capable surface runs the required per-repo tests/smoke directly; +- a no-runtime GitHub-control surface may consume **existing exact-head GitHub + Actions evidence** only when the workflow/legs cover the required test scope; + verify the branch head SHA and each relevant conclusion; +- if the required execution evidence is absent, hand off only that validation + phase; +- CI is never a Heart verdict. Read fresh authoritative Heart readiness evidence + from an available Heart surface; if that cannot be obtained here, obtain only + that bounded evidence before shipping. + +Under `--auto`, this step is the four-leg **autonomous-ship gate** — tests +(+ downstream dependents on public-API changes), smoke, review-faculty CLEAN, +Heart — per `AUTONOMY.md` "The autonomous-ship gate"; do not restate it here. +A same-conversation reread is not an independent review. ### 4. Execute the ship (feature-dev) -On GREEN, run the dev workflow's own test → commit → push → feature-PR step per -[`reference.md`](reference.md) → "Execution contract": run tests inside the -worktree, confirm the branch is `feature/` (never auto-switch), -commit, push, `gh pr create --label pending-release`, and verify the label -landed. This is feature-development git work, not a Build/release step. In -local-dev Anthropic delegates the mechanical part to its execution tier; -OpenAI runs it inline unless a bounded exception applies. Elsewhere run it -directly. If any step fails, stop and report — do not proceed. +On a Heart outcome permitted by WORKFLOW.md / AUTONOMY.md, execute the dev +workflow's test/evidence → commit/push → feature-PR step per +[`reference.md`](reference.md) → "Execution contract". A local worktree runs +the commands there. A GitHub-control-only surface verifies the existing remote +feature branch and exact head, uses repository/GitHub write operations for the +remaining commit/PR mechanics, and verifies required exact-head Actions +evidence. It must not claim a local test it did not run. If generation, imports +or another runtime step is still required, perform the bounded execution +handoff before PR-ready status. + +This is feature-development git work, not a Build/release step. Provider model +delegation still follows MODEL_DELEGATION.md; capability absence is handled by +its cross-environment handoff rather than by provider-name conditionals. If any +step or evidence leg fails, stop and report — do not proceed. **Under `--auto`:** all four legs of the autonomous-ship gate must pass — **five under a batch launch**, which adds the independent-adversary leg (`AUTONOMY.md` leg 5) — (step 3 note); then ship **without interactive sign-off** — the PR body additionally From e6a19b4321434f61668f1382594ccebf915ff1bd Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Sun, 20 Sep 2026 16:54:34 +0100 Subject: [PATCH 09/14] docs: make workspace ship evidence capability-based --- skills/ship_workspace/ship_workspace.md | 43 +++++++++++++++---------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/skills/ship_workspace/ship_workspace.md b/skills/ship_workspace/ship_workspace.md index 05b28aa4..a1ba435e 100644 --- a/skills/ship_workspace/ship_workspace.md +++ b/skills/ship_workspace/ship_workspace.md @@ -29,10 +29,10 @@ WT_ROOT=~/Code/PyAutoLabs-wt/ source "$WT_ROOT/activate.sh" ``` -In-scope repos are the workspace/tutorial repos only. If any **library** repo has -uncommitted changes in the worktree, stop and tell the user to ship them with -`/ship_library`. Legacy/no-worktree and other execution environments behave as in -WORKFLOW.md (working-directory clones, manual `PYTHONPATH`). +In-scope repos are the workspace/tutorial repos only. If a local worktree has +uncommitted **library** changes, stop and ship them through `/ship_library`. +A GitHub-control-only task has no local dirty-state claim to make: resolve each +workspace branch and exact head through GitHub and inspect the remote diff. ### 2. Draft commit message + PR body (reasoning model) @@ -60,22 +60,31 @@ applicable tests/smoke/review, including the reason strings verbatim from "Corrective-PR exception for Heart RED" for a causal fix. Follow the selected canonical section's scope and four record sinks exactly. Neither path permits release or bypassing CI; merge requires its own current human command and green -required GitHub checks. If the -organism CLIs are unavailable, run `/smoke_test` (with `activate.sh` sourced) as -the gate and treat any failure as RED. Under `--auto`, this step is the -four-leg **autonomous-ship gate** (`AUTONOMY.md` "The autonomous-ship gate"); -do not restate it here. +required GitHub checks. If the organism CLIs are unavailable, use WORKFLOW.md's capability/evidence +rules: run smoke locally when a runtime exists; otherwise consume existing +**exact-head** Actions evidence only when its jobs exercise the required smoke +scope, or hand off only that validation phase. Notebook generation or other +required generated artefacts also require a real runtime and cannot be inferred +from source edits. CI never substitutes for Heart: obtain fresh authoritative +Heart readiness evidence separately, or stop at that missing evidence. + +Under `--auto`, this step is the four-leg **autonomous-ship gate** +(`AUTONOMY.md` "The autonomous-ship gate"); do not restate it here. A +same-conversation reread is not an independent review. ### 4. Execute the ship (feature-dev) -On GREEN, run the dev workflow's own commit → push → smoke → feature-PR → -cross-reference step per -[`reference.md`](reference.md) → "Execution contract": verify the branch (never -auto-switch), regenerate notebooks from scripts (never edit `notebooks/` -directly), `gh pr create --label pending-release`, verify the label, and -cross-reference the upstream library PR if linked. In local-dev Anthropic -delegates to its execution tier; OpenAI runs inline unless a bounded exception -applies. Elsewhere run directly. Any failure → stop and report. +On a Heart outcome permitted by WORKFLOW.md / AUTONOMY.md, perform the +feature-dev commit/push/validation/PR/cross-reference contract. A local runtime +regenerates notebooks from scripts and runs smoke normally. A +GitHub-control-only surface may perform branch/commit/PR operations but **must +delegate notebook generation and any missing smoke/runtime evidence** before the +branch is PR-ready; it then verifies the returned commit and exact-head checks. +Never edit generated notebooks by hand to avoid the execution requirement. + +Provider model delegation still follows MODEL_DELEGATION.md; missing capability +uses its bounded cross-environment handoff. Any failed step or evidence leg → +stop and report. **Under `--auto`:** all four legs of the autonomous-ship gate must pass — **five under a batch launch**, which adds the independent-adversary leg (`AUTONOMY.md` leg 5) — (step 3 note); ship without interactive sign-off, add the `## Validation checklist` From c08c81bb93089fa87cc794e8fa84ce0922be0aa1 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Sun, 20 Sep 2026 16:54:36 +0100 Subject: [PATCH 10/14] test: pin Chat orchestration capability contract --- tests/test_chat_orchestration_contract.py | 95 +++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 tests/test_chat_orchestration_contract.py diff --git a/tests/test_chat_orchestration_contract.py b/tests/test_chat_orchestration_contract.py new file mode 100644 index 00000000..13797b9f --- /dev/null +++ b/tests/test_chat_orchestration_contract.py @@ -0,0 +1,95 @@ +"""Contracts for ordinary-Chat orchestration without a parallel workflow.""" + +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] +SKILLS = ROOT / "skills" + + +def _read(relative): + return (ROOT / relative).read_text(encoding="utf-8") + + +def test_workflow_separates_orchestration_capabilities_from_execution_evidence(): + text = _read("skills/WORKFLOW.md") + for token in ( + "orchestration environment", + "execution environment", + "repository-read", + "repository-write", + "github-control", + "test-execution", + "independent-review", + "remote-compute", + "required evidence", + ): + assert token in text + assert "Lane:" in text + assert "must not grow a `chatgpt`" in text.lower() + + +def test_chat_route_has_no_openai_api_fallback(): + texts = "\n".join( + _read(path) + for path in ( + "skills/WORKFLOW.md", + "skills/GITHUB_ACCESS.md", + "skills/MODEL_DELEGATION.md", + ) + ) + assert "No OpenAI API fallback" in texts or "no API fallback" in texts + for executable_pattern in ( + "api.openai.com", + "from openai import", + "import openai", + "client.responses.create", + "responses.create(", + "OPENAI_API_KEY=", + ): + assert executable_pattern not in texts + + +def test_github_only_development_records_no_fake_worktree(): + for path in ( + "skills/start_dev/start_dev.md", + "skills/start_dev/reference.md", + "skills/start_library/start_library.md", + "skills/start_workspace/start_workspace.md", + ): + text = _read(path) + assert "GitHub-control-only" in text + assert "worktree" in text + assert "no fake `worktree:`" in _read("skills/start_dev/start_dev.md") + + +def test_remote_conflicts_still_use_mind_repo_claims(): + reference = _read("skills/start_dev/reference.md") + assert "Do not\n skip task-claim checks" in reference + assert "repos:" in reference + assert "fail closed" in reference + + +def test_ci_evidence_never_becomes_heart_or_independent_review(): + workflow = _read("skills/WORKFLOW.md") + library = _read("skills/ship_library/ship_library.md") + workspace = _read("skills/ship_workspace/ship_workspace.md") + for text in (workflow, library, workspace): + assert "Heart" in text + assert "exact-head" in text.lower() or "exact branch head" in text.lower() + assert "CI" in text or "Actions" in text + assert "never substitutes for the authoritative Heart verdict" in workflow + assert "cannot self-certify" in workflow + assert "same-conversation reread is not an independent review" in library + assert "same-conversation reread is not an independent review" in workspace + + +def test_no_runtime_provider_switch_was_added(): + """Harness names belong in adapters/docs, not execution routing code.""" + offenders = [] + for root in (ROOT / "agents", ROOT / "bin"): + for path in root.rglob("*"): + if path.suffix not in {".py", ".sh"} or not path.is_file(): + continue + if "chatgpt" in path.read_text(encoding="utf-8", errors="replace").lower(): + offenders.append(str(path.relative_to(ROOT))) + assert not offenders, offenders From cee236574c87fce5d28cd2bafc3fa03ab14bdd4a Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Sun, 20 Sep 2026 16:56:14 +0100 Subject: [PATCH 11/14] test: avoid escaped backticks in contract strings From b759a4aef538b44696b4644e2f938dc0214b3397 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Sun, 20 Sep 2026 16:59:19 +0100 Subject: [PATCH 12/14] docs: state no-fake-worktree guarantee From beac32385c7f8f133fa4615e9b45463ee721dcac Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Sun, 20 Sep 2026 16:59:23 +0100 Subject: [PATCH 13/14] docs: make remote conflict failure explicit --- skills/start_dev/reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/start_dev/reference.md b/skills/start_dev/reference.md index 686913e7..4e7a0794 100644 --- a/skills/start_dev/reference.md +++ b/skills/start_dev/reference.md @@ -202,7 +202,7 @@ execution environments (see [`../WORKFLOW.md`](../WORKFLOW.md)): authenticated GitHub operation surface instead of local `git -C`. **Do not skip task-claim checks**: fetch current `PyAutoMind/active.md` and compare the target repos against every other entry's `repos:` bullets. If Mind cannot be - read, the conflict check is unverifiable and the run fails closed. + read, the conflict check is unverifiable and the run **must fail closed**. - **Remote/CI with clones:** use the clones for branch/dirty state, but the same current Mind `repos:` claims remain authoritative for cross-session conflicts. From 571048531ca14ce80f48314547463cc87712d6d1 Mon Sep 17 00:00:00 2001 From: James Nightingale Date: Sun, 20 Sep 2026 16:59:52 +0100 Subject: [PATCH 14/14] docs: make no-fake-worktree wording testable --- skills/start_dev/start_dev.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/skills/start_dev/start_dev.md b/skills/start_dev/start_dev.md index 33edf1c2..aeb8f5ad 100644 --- a/skills/start_dev/start_dev.md +++ b/skills/start_dev/start_dev.md @@ -165,8 +165,7 @@ cannot be read, fail closed; never infer "no conflict" from missing local files. - **No conflict, local:** register `status: library-dev | workspace-dev` and the real `worktree:` path. - **No conflict, GitHub-control-only:** register the same status, real - `session:` / `location:` metadata and repo branch claims, but **no - `worktree:` field**. A later execution environment resumes the same + `session:` / `location:` metadata and repo branch claims, and record **no fake `worktree:` field**. A later execution environment resumes the same branch/commit. - **Conflict:** register in `PyAutoMind/planned.md` (blocked) and tell the user what's holding the repo.