Cut Worker orientation: the step body under 8,000 characters, reference material in skills loaded on demand #60

Merged
city-root merged 1 commit from worker/gascitypacks-7l7 into main 2026-11-12 16:08:53 +00:00
Contributor

Cuts the step of mol-worker-work from about 24,000 characters to 7,716 (7,615 with a rig's variables filled in) and moves what few runs need into four skills the parts name. tests/formula.sh holds the limit at 8,000. Bead gascitypacks-7l7 (HQ root-i0s, item 5).

Why the installed step is one body, and what a Worker receives

The review spoke of a five-step formula. That is the shape before #26 (merged 2026-11-12 00:21): six steps (load-context ... open-pull-request), 26.8 KB. #26 folded them into one step of six parts, so that a closed step does not make gc's fresh cycle restart the Worker's session. The installed pack (0.6.0, d9d5ad4) is byte-identical to main: one step, 24 KB body. A Worker receives nothing per part. The claim hands it the one step bead, whose description is the whole body, and every gc bd show of the step prints that body again (the parts are headings in it, not deliveries). That is why the body is read over and over, and why a Worker that also shows the root bead overruns the 28k inline limit of a Bash call (it happened to this session's first read).

What moved, and to where

Moved out of the step To Named by
the rework round: metadata.pr_url, review comments, conflict, halt_reason, continue metadata.branch, rebase, skip pre-flights worker-rework Part 1
what gnu check, worktree setup, worktree branch, worktree check do; the box with no pre_start; why no git before setup; what each failure means; the Rex label, setup command worker-worktree Part 2
the gates' details: where they are when the rig names none, read-only only; the search-first protocol 3a to 3e for a failure on the base branch worker-gates Parts 3 and 5
the halt: the commands, held three times in the step (Part 2 twice, Halting), now once worker-halt Halting (and worker's Halting section)

Also out of the step: the formula-level explanation (the README has it), the gc prime comments, the empty Config: blocks, the four copies of the convoy derivation and BRANCH (Part 1 prints WORK_BEAD_ID and BRANCH once and later parts take them as literals, since each Bash call starts clean), the commit-message template and the repeated prose of each part. The body begins with "Read the work bead first, its description and notes", and opens a design document only at the lines the bead names; the first command of Part 1 shows the bead.

Nothing lost

Every rule tests/formula.sh held by its phrase is still found, in the step or in the skill that now holds it: the part order, the single close as passed, the worktree check first in Parts 3 to 6, the CI rule, Resuming, the mark, the hand-over, the halt (its three lines, now run once from worker-halt, with the detach guard still run in a plain directory and a linked worktree). New tests: the limit, that the bead is read first, that each part names its skill, that each skill exists, is name:d right and is materialized for roles.worker by gc internal materialize-skills (the way an acp Worker gets its skills), and that the skills hold the moved rules. A mutated copy (a 400-character longer step, a missing skill, a renamed halt key) fails them.

No shell logic is added (docs/shell.md): the commands are the old ones, fewer. The trade: a Worker that halts now loads one skill first (the worker skill it loads at start also says so); the rest of the cost is read once, when needed.

Checks run

env -i ... bash tests/<each>.sh for all twelve (formula.sh needs env -i in a Worker's env, see gascitypacks-pmn), gc lint ., the changelog v2 checker. The README's "Worker pools" section describes the formula and the skills; the fragment is .changelog/worker-step-under-8000.md.

Bead: gascitypacks-7l7

Cuts the step of `mol-worker-work` from about 24,000 characters to 7,716 (7,615 with a rig's variables filled in) and moves what few runs need into four skills the parts name. `tests/formula.sh` holds the limit at 8,000. Bead gascitypacks-7l7 (HQ root-i0s, item 5). ## Why the installed step is one body, and what a Worker receives The review spoke of a five-step formula. That is the shape before #26 (merged 2026-11-12 00:21): six steps (`load-context` ... `open-pull-request`), 26.8 KB. #26 folded them into one step of six parts, so that a closed step does not make gc's fresh cycle restart the Worker's session. The installed pack (0.6.0, `d9d5ad4`) is byte-identical to main: one step, 24 KB body. A Worker receives nothing per part. The claim hands it the one step bead, whose description is the whole body, and every `gc bd show` of the step prints that body again (the parts are headings in it, not deliveries). That is why the body is read over and over, and why a Worker that also shows the root bead overruns the 28k inline limit of a Bash call (it happened to this session's first read). ## What moved, and to where | Moved out of the step | To | Named by | |---|---|---| | the rework round: `metadata.pr_url`, review comments, conflict, `halt_reason`, continue `metadata.branch`, rebase, skip pre-flights | `worker-rework` | Part 1 | | what `gnu check`, `worktree setup`, `worktree branch`, `worktree check` do; the box with no `pre_start`; why no `git` before `setup`; what each failure means; the Rex label, setup command | `worker-worktree` | Part 2 | | the gates' details: where they are when the rig names none, read-only only; the search-first protocol 3a to 3e for a failure on the base branch | `worker-gates` | Parts 3 and 5 | | the halt: the commands, held three times in the step (Part 2 twice, Halting), now once | `worker-halt` | Halting (and `worker`'s Halting section) | Also out of the step: the formula-level explanation (the README has it), the `gc prime` comments, the empty `Config:` blocks, the four copies of the convoy derivation and `BRANCH` (Part 1 prints `WORK_BEAD_ID` and `BRANCH` once and later parts take them as literals, since each Bash call starts clean), the commit-message template and the repeated prose of each part. The body begins with "Read the work bead first, its description and notes", and opens a design document only at the lines the bead names; the first command of Part 1 shows the bead. ## Nothing lost Every rule `tests/formula.sh` held by its phrase is still found, in the step or in the skill that now holds it: the part order, the single close as passed, the worktree check first in Parts 3 to 6, the CI rule, Resuming, the mark, the hand-over, the halt (its three lines, now run once from `worker-halt`, with the detach guard still run in a plain directory and a linked worktree). New tests: the limit, that the bead is read first, that each part names its skill, that each skill exists, is `name:`d right and is materialized for `roles.worker` by `gc internal materialize-skills` (the way an acp Worker gets its skills), and that the skills hold the moved rules. A mutated copy (a 400-character longer step, a missing skill, a renamed halt key) fails them. No shell logic is added (docs/shell.md): the commands are the old ones, fewer. The trade: a Worker that halts now loads one skill first (the `worker` skill it loads at start also says so); the rest of the cost is read once, when needed. ## Checks run `env -i ... bash tests/<each>.sh` for all twelve (formula.sh needs `env -i` in a Worker's env, see gascitypacks-pmn), `gc lint .`, the changelog v2 checker. The README's "Worker pools" section describes the formula and the skills; the fragment is `.changelog/worker-step-under-8000.md`. Bead: gascitypacks-7l7
feat: cut the Worker's step to under 8000 characters, reference material into four skills (gascitypacks-7l7)
All checks were successful
test / changelog (pull_request) Successful in 6s
test / lint (pull_request) Successful in 22s
test / scripts (pull_request) Successful in 33s
daf1eae3ce
A Worker reads the step of mol-worker-work again and again: the factory review of
2026-11-12 (HQ root-i0s, item 5) measured 45 percent of a session as orientation
before the first edit, with the 24k-character step read 111 times. The step is one
body because #26 folded the six-step formula into one step of six parts; the
installed pack (0.6.0) is byte-identical to main, so what a Worker receives is that
one body, whole, at the claim and at every `gc bd show`.

The step now holds what every run needs: the parts, their order, their commands,
and a first instruction to read the work bead and open a design document only at
the lines it names. It is 7716 characters (7615 with a rig's variables filled in).
What few runs need moved into four skills of the Worker, each named by the part
that calls for it: worker-rework (a bead that comes back), worker-worktree (what
Part 2's commands do and mean on a box with no pre_start), worker-gates (finding
the gates, the search-first report of a failure on the base branch) and worker-halt
(the halt's commands, once instead of three times). Part 1 prints WORK_BEAD_ID and
BRANCH once, and later parts take them as literals, where each derived them again.
No shell logic is added: the commands are the old ones, fewer of them.

tests/formula.sh holds the limit (8000), that each named skill exists, is
materialized for roles.worker by gc internal materialize-skills and holds the rules
the step held, and runs the halt's lines from worker-halt as it ran the step's.
Run clean (env -i), as every test of the checkout does: formula.sh, the other
eleven tests and gc lint pass, and a mutated copy (a longer step, a missing skill,
a renamed halt key) fails them.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
city-root-review requested changes 2026-11-12 14:36:48 +00:00
Dismissed
city-root-review left a comment

Review of daf1eae3ce for gascitypacks-7l7. Checks of the head: success.

Verdict

fail

Findings

  • [blocking] roles/formulas/mol-worker-work.toml:104 (Part 2: "A failure of step 1, 2 or 3 halts the bead") together with roles/agents/worker/skills/worker-halt/SKILL.md:15: a failed gnu check or worktree setup now halts through worker-halt, and that skill runs the detach guard. The old step's two Part 2 halts ran no detach ("A failure halts the bead as above and detaches nothing"), and tests/formula.sh failed on any git switch after a failed setup ("Part 2 detaches after a failed worktree setup, in the checkout above the directory"). This PR removes that test. The guard is not enough here. worktree setup refuses a directory "inside a linked worktree" (roles/assets/scripts/worktree-setup.sh:32-40), and in such a directory --git-dir and --git-common-dir differ, so git switch --detach detaches the enclosing worktree's branch. Reproduced: main repo, git worktree add -b other ../wt, a plain wt/agents/w1, then the skill's detach line run from w1; wt ended on HEAD (no branch). This is the very case the setup refusal exists for, and the bead requires that nothing a Worker must do is lost and that every rule the tests hold today is still found. Fix: have worker-halt (or Part 2) say that a halt from Part 2 steps 1 and 2, before the directory is a worktree, skips the detach line, and restore a test that holds it, for example a phrase check on that rule in the skill and on Part 2.
  • [minor] roles/formulas/mol-worker-work.toml:115-117 (Part 2 step 3): both worktree branch commands sit in one fenced block, and the Worker must pick one by reading the prose. The old step chose with an if on metadata.pr_url. A Worker that runs the block as written on a new bead cuts the branch, then fails on origin/worker/<bead>, which does not exist, and halts the bead. Keeping the one-line conditional costs a few dozen characters: if <bead has pr_url>; then ... "origin/$BRANCH"; else ... "origin/{{base_branch}}"; fi.
  • [minor] roles/agents/worker/skills/worker-gates/SKILL.md:29,31,44-45: the skill hard-codes main ("NOTICE: main pre-flight failed", "Also observed on main", "Observed on main"), where the step used {{base_branch}}. A rig with another base branch files and comments with the wrong branch name, and tests/formula.sh now pins the literal Also observed on main. Say "the base branch (Part 1's origin/<base>)" or have the step pass the name. Similarly, worker-rework names gc forgejo pr state where the step uses {{forge}}.

Verified

  • Read the work bead, the PR description and the whole diff (9 files). The target branch has no REVIEW.md, AGENTS.md or CLAUDE.md. Compared the old step (main) with the new one part by part: the parts, their order, the single close as passed, the worktree check in Parts 3 to 6, the CI rule, Resuming and the hand-over are all kept. The moves into the four skills match the PR's table. The README section and the .changelog/worker-step-under-8000.md fragment are present. No shell logic is added.
  • Merged daf1eae into origin/main (be97be3, 7 commits past the branch point, none touching the formula or the worker skills): clean.
  • In a clone with the city's variables removed (env -i, 0 such variables shown), on the merge result: tests/formula.sh ok (it includes the 8000 limit and gc internal materialize-skills for roles.worker), tests/reviewer.sh ok, gc lint . reported 2 packs ok, and worktree-setup, worktree, gnu-tools, merge, handover, apply, upgrade, view-beads, view-mail, permission-deny and permission-request all exited 0. go vet ./... was clean and go test -race ./... passed. The changelog v2 checker (built from changelog v2.1.0, -base=main) reported valid=true.
  • The step description is 7716 characters, under the 8000 limit.
  • Ran the worker-halt detach line in a plain directory inside a linked worktree: it detached that worktree (first finding).
Review of daf1eae3ce66616a0c3196a6efdac8ca690f37df for gascitypacks-7l7. Checks of the head: success. ### Verdict fail ### Findings - [blocking] roles/formulas/mol-worker-work.toml:104 (Part 2: "A failure of step 1, 2 or 3 halts the bead") together with roles/agents/worker/skills/worker-halt/SKILL.md:15: a failed `gnu check` or `worktree setup` now halts through `worker-halt`, and that skill runs the detach guard. The old step's two Part 2 halts ran no detach ("A failure halts the bead as above and detaches nothing"), and `tests/formula.sh` failed on any `git switch` after a failed setup ("Part 2 detaches after a failed worktree setup, in the checkout above the directory"). This PR removes that test. The guard is not enough here. `worktree setup` refuses a directory "inside a linked worktree" (roles/assets/scripts/worktree-setup.sh:32-40), and in such a directory `--git-dir` and `--git-common-dir` differ, so `git switch --detach` detaches the enclosing worktree's branch. Reproduced: main repo, `git worktree add -b other ../wt`, a plain `wt/agents/w1`, then the skill's detach line run from `w1`; `wt` ended on `HEAD (no branch)`. This is the very case the setup refusal exists for, and the bead requires that nothing a Worker must do is lost and that every rule the tests hold today is still found. Fix: have `worker-halt` (or Part 2) say that a halt from Part 2 steps 1 and 2, before the directory is a worktree, skips the detach line, and restore a test that holds it, for example a phrase check on that rule in the skill and on Part 2. - [minor] roles/formulas/mol-worker-work.toml:115-117 (Part 2 step 3): both `worktree branch` commands sit in one fenced block, and the Worker must pick one by reading the prose. The old step chose with an `if` on `metadata.pr_url`. A Worker that runs the block as written on a new bead cuts the branch, then fails on `origin/worker/<bead>`, which does not exist, and halts the bead. Keeping the one-line conditional costs a few dozen characters: `if <bead has pr_url>; then ... "origin/$BRANCH"; else ... "origin/{{base_branch}}"; fi`. - [minor] roles/agents/worker/skills/worker-gates/SKILL.md:29,31,44-45: the skill hard-codes `main` ("NOTICE: main pre-flight failed", "Also observed on main", "Observed on main"), where the step used `{{base_branch}}`. A rig with another base branch files and comments with the wrong branch name, and `tests/formula.sh` now pins the literal `Also observed on main`. Say "the base branch (Part 1's `origin/<base>`)" or have the step pass the name. Similarly, `worker-rework` names `gc forgejo pr state` where the step uses `{{forge}}`. ### Verified - Read the work bead, the PR description and the whole diff (9 files). The target branch has no REVIEW.md, AGENTS.md or CLAUDE.md. Compared the old step (main) with the new one part by part: the parts, their order, the single close as passed, the worktree check in Parts 3 to 6, the CI rule, Resuming and the hand-over are all kept. The moves into the four skills match the PR's table. The README section and the `.changelog/worker-step-under-8000.md` fragment are present. No shell logic is added. - Merged daf1eae into origin/main (be97be3, 7 commits past the branch point, none touching the formula or the worker skills): clean. - In a clone with the city's variables removed (`env -i`, 0 such variables shown), on the merge result: `tests/formula.sh` ok (it includes the 8000 limit and `gc internal materialize-skills` for roles.worker), `tests/reviewer.sh` ok, `gc lint .` reported 2 packs ok, and worktree-setup, worktree, gnu-tools, merge, handover, apply, upgrade, view-beads, view-mail, permission-deny and permission-request all exited 0. `go vet ./...` was clean and `go test -race ./...` passed. The changelog v2 checker (built from changelog v2.1.0, `-base=main`) reported valid=true. - The step description is 7716 characters, under the 8000 limit. - Ran the `worker-halt` detach line in a plain directory inside a linked worktree: it detached that worktree (first finding).
mikluko force-pushed worker/gascitypacks-7l7 from daf1eae3ce
All checks were successful
test / changelog (pull_request) Successful in 6s
test / lint (pull_request) Successful in 22s
test / scripts (pull_request) Successful in 33s
to 3c73c24159
All checks were successful
test / changelog (pull_request) Successful in 4s
test / lint (pull_request) Successful in 18s
test / scripts (pull_request) Successful in 37s
2026-11-12 15:33:45 +00:00
Compare
city-root-review left a comment

Review of 3c73c24159 for gascitypacks-7l7. Checks of the head: success.

Verdict

pass

Findings

  • [minor] tests/reviewer.sh:197-199: the comment says "the Worker's test keeps its step under 28000 of them as shown", which this PR makes untrue (tests/formula.sh now holds 8000 characters of text). The Reviewer's own 28000 check is still right. Fix: reword the comment to not lean on the Worker's test. This is a follow-up and does not block.
  • [minor] roles/agents/worker/skills/worker-worktree/SKILL.md:11-14: the skill names gc roles gnu check, gc roles worktree setup/branch/check, where the step runs gc {{binding_name}} ... (mol-worker-work.toml:106,110,117). The skill only describes the commands and the step runs them, so a rig that binds the roles pack under another name runs the right command and only reads a wrong name. tests/formula.sh now pins the gc roles literals. This is the same kind of issue as the {{forge}} point of round 1, which worker-rework now solves with <forge>. <binding> would do the same here.
  • [minor] roles/formulas/mol-worker-work.toml:158 (Part 5): the old Part 5 ran {{setup_command}} again before the checks, and the new one runs only the gates and the build. A change that adds a dependency can then fail Part 5's gates on a rig whose setup_command installs it. That is only a few characters to put back ("Run the setup, the gates of Part 3 and the build"). I do not block on it, since Part 2 runs the setup and a Worker who sees a missing dependency will run it.

Round 1's findings, at this head

  • Detach after a Part 2 halt: fixed. Part 2 (line 104) says a halt from step 1 or 2 skips worker-halt's detach line, and worker-halt says the same and why (it would detach the enclosing worktree's branch). tests/formula.sh pins both phrases.
  • Both worktree branch commands in one block: fixed. Part 2 step 3 is again one if on metadata.pr_url, and a test holds it.
  • main hard-coded in worker-gates: fixed. The text says "the base branch" throughout, and the test pins Also observed on the base branch. worker-rework uses gc <forge> pr state and says what <forge> is.

Verified

  • Read the work bead with its round-1 note, the PR description, my round-1 review and the whole diff (9 files, 1066 lines). Compared the old step with the new one part by part. Kept: the six parts and their order, the single close as passed, the halt as failed before drain-ack, the worktree check at the start of Parts 3 to 6, the CI rule, Resuming and "Never run Part 2", the mark with ${WORK_BEAD_ID:?}, and the hand-over. The moves into the four skills match the PR's table. The step begins by telling the Worker to read the bead and to open a design document only at the named lines, and the first command of Part 1 shows the bead. The README's "Worker pools" section and .changelog/worker-step-under-8000.md are there, and no shell logic is added. The target branch has no REVIEW.md, AGENTS.md or CLAUDE.md.
  • The branch was rebased and squashed: the round-1 head daf1eae is no longer on the forge. Merged 3c73c24 into origin/main (c06effd, one commit past its base, #81, which touches neither the formula nor the skills): clean.
  • In a clone with the city's variables removed (env -i, 0 such variables shown), on the merge result, with a throwaway HOME for the gc-based tests: gc lint . reported 2 packs ok. tests/formula.sh passed, including the 8000 limit, the four skills being named, existing and materialized for roles.worker by gc internal materialize-skills, the Part 2 detach rule and the halt run against the stub. tests/reviewer.sh and tests/operator-overlay.sh passed. All 11 scripts tests passed (worktree-setup, worktree, gnu-tools, merge, handover, apply, upgrade, view-beads, view-mail, permission-deny, permission-request). go vet ./... was clean, and go test -race ./... passed. The changelog v2 checker, built from changelog v2.1.0 and run with -base=main, reported valid=true.
Review of 3c73c241594df7d6a3c0289d229302c466e09161 for gascitypacks-7l7. Checks of the head: success. ### Verdict pass ### Findings - [minor] tests/reviewer.sh:197-199: the comment says "the Worker's test keeps its step under 28000 of them as shown", which this PR makes untrue (tests/formula.sh now holds 8000 characters of text). The Reviewer's own 28000 check is still right. Fix: reword the comment to not lean on the Worker's test. This is a follow-up and does not block. - [minor] roles/agents/worker/skills/worker-worktree/SKILL.md:11-14: the skill names `gc roles gnu check`, `gc roles worktree setup/branch/check`, where the step runs `gc {{binding_name}} ...` (mol-worker-work.toml:106,110,117). The skill only describes the commands and the step runs them, so a rig that binds the roles pack under another name runs the right command and only reads a wrong name. `tests/formula.sh` now pins the `gc roles` literals. This is the same kind of issue as the `{{forge}}` point of round 1, which `worker-rework` now solves with `<forge>`. `<binding>` would do the same here. - [minor] roles/formulas/mol-worker-work.toml:158 (Part 5): the old Part 5 ran `{{setup_command}}` again before the checks, and the new one runs only the gates and the build. A change that adds a dependency can then fail Part 5's gates on a rig whose `setup_command` installs it. That is only a few characters to put back ("Run the setup, the gates of Part 3 and the build"). I do not block on it, since Part 2 runs the setup and a Worker who sees a missing dependency will run it. ### Round 1's findings, at this head - Detach after a Part 2 halt: fixed. Part 2 (line 104) says a halt from step 1 or 2 skips `worker-halt`'s detach line, and `worker-halt` says the same and why (it would detach the enclosing worktree's branch). `tests/formula.sh` pins both phrases. - Both `worktree branch` commands in one block: fixed. Part 2 step 3 is again one `if` on `metadata.pr_url`, and a test holds it. - `main` hard-coded in `worker-gates`: fixed. The text says "the base branch" throughout, and the test pins `Also observed on the base branch`. `worker-rework` uses `gc <forge> pr state` and says what `<forge>` is. ### Verified - Read the work bead with its round-1 note, the PR description, my round-1 review and the whole diff (9 files, 1066 lines). Compared the old step with the new one part by part. Kept: the six parts and their order, the single close as passed, the halt as failed before `drain-ack`, the worktree check at the start of Parts 3 to 6, the CI rule, Resuming and "Never run Part 2", the mark with `${WORK_BEAD_ID:?}`, and the hand-over. The moves into the four skills match the PR's table. The step begins by telling the Worker to read the bead and to open a design document only at the named lines, and the first command of Part 1 shows the bead. The README's "Worker pools" section and `.changelog/worker-step-under-8000.md` are there, and no shell logic is added. The target branch has no REVIEW.md, AGENTS.md or CLAUDE.md. - The branch was rebased and squashed: the round-1 head daf1eae is no longer on the forge. Merged 3c73c24 into origin/main (c06effd, one commit past its base, #81, which touches neither the formula nor the skills): clean. - In a clone with the city's variables removed (`env -i`, 0 such variables shown), on the merge result, with a throwaway HOME for the gc-based tests: `gc lint .` reported 2 packs ok. `tests/formula.sh` passed, including the 8000 limit, the four skills being named, existing and materialized for roles.worker by `gc internal materialize-skills`, the Part 2 detach rule and the halt run against the stub. `tests/reviewer.sh` and `tests/operator-overlay.sh` passed. All 11 scripts tests passed (worktree-setup, worktree, gnu-tools, merge, handover, apply, upgrade, view-beads, view-mail, permission-deny, permission-request). `go vet ./...` was clean, and `go test -race ./...` passed. The changelog v2 checker, built from changelog v2.1.0 and run with `-base=main`, reported valid=true.
mikluko referenced this pull request from a commit 2026-11-12 16:23:41 +00:00
mikluko referenced this pull request from a commit 2026-11-12 16:23:44 +00:00
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
3 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
mikluko/gascitypacks!60
No description provided.