@@ -61,6 +61,57 @@ When `pyauto-brain` is not on `PATH` and no PyAutoBrain checkout is present
6161(e.g. a GitHub-only session), perform the same reasoning inline following this
6262file and ` PyAutoBrain/AGENTS.md ` , and note that the agent was emulated.
6363
64+ ## Model delegation (Opus plans, Sonnet executes)
65+
66+ The workflow skills follow a ** "plan in Opus, execute in Sonnet"** split: the main
67+ session stays on Opus for planning, judgment and orchestration; mechanical
68+ shell/git phases are delegated to Sonnet subagents (` Agent ` tool,
69+ ` model: "sonnet" ` ). This keeps judgement in the stronger model while moving bulk
70+ execution to the faster, cheaper one — no manual model toggling.
71+
72+ ** Delegated (mechanical phase only):**
73+
74+ - ` ship_library ` — step 3 (test, commit, push, open PR).
75+ - ` ship_workspace ` — step 3 (commit, push, smoke test, open PR, cross-reference).
76+ - ` pre_build ` — step 2 (format, generate, version bump, stage, commit, push,
77+ dispatch workflow).
78+
79+ ** Stays in Opus:** planning (` start_dev ` ), environment setup
80+ (` start_library ` /` start_workspace ` ), release triage (` review_release ` );
81+ identifying affected repos, drafting the commit message and full PR body
82+ (` ## API Changes ` / ` ## Scripts Changed ` ), workspace-impact analysis, the
83+ library-first merge gate, the merge decision, ` active.md ` / ` complete.md `
84+ updates, and final issue comments. In ` pre_build ` : validating clean ` main ` ,
85+ asking for the minor version, printing the summary.
86+
87+ ** Subagent prompt contract (all delegated calls):**
88+
89+ - ** Inputs Opus passes:** worktree path / ` $WT_ROOT ` , repo list, pre-drafted
90+ commit message, pre-drafted PR body (paste verbatim via HEREDOC — never
91+ rewrite), relevant URLs (library PR, issue), target branch, labels.
92+ - ** Subagent's job:** run the named shell steps exactly. ` source activate.sh `
93+ before ` pytest ` / ` smoke_test ` . Verify the branch is ` feature/<task-name> `
94+ before committing — never auto-switch branches. ** Never modify code to make
95+ tests or smoke tests pass.** On failure, stop and return the failure verbatim
96+ (failing test names + traceback tail, or the shell error).
97+ - ** Subagent returns:** one line per repo — test/smoke pass-fail counts, commit
98+ SHA, PR URL, cross-reference/dispatch confirmations.
99+ - ** Opus after return:** interpret failures, decide routing, update registries,
100+ talk to the user.
101+
102+ ** Tutorial-prose split** (separate from skill delegation — depends on what the
103+ reader is there to learn):
104+
105+ - ** Opus** for narrative science-teaching scripts where the docstrings/comments
106+ are the product: tutorials in ` autofit_workspace ` , ` autogalaxy_workspace ` ,
107+ ` autolens_workspace ` (` overview_* ` , ` start_here.py ` , ` howto* ` ). Sonnet drifts
108+ to generic textbook phrasing and misses domain framing here.
109+ - ** Sonnet** for code-heavy, doc-light scripts where comments are short
110+ API-usage notes: ` *_workspace_test ` , ` euclid_strong_lens_modeling_pipeline `
111+ glue, and developer/regression/smoke/parity scripts.
112+ - Heuristic: * "is the reader here to learn science, or to exercise code?"*
113+ Science → Opus. Code → Sonnet.
114+
64115## Consult Memory before substantial planning
65116
66117Before committing to a plan, consult ** PyAutoMemory** whenever historical,
0 commit comments