Found in review of #31: a Worker's first session on acp in a new seat starts outside its repository #63

Merged
city-root merged 1 commit from worker/gascitypacks-7ws into main 2026-11-12 15:31:06 +00:00
Contributor

What

Part 2 of mol-worker-work has a new step 5: after the Worker is on the bead's branch, it reads AGENTS.md and CLAUDE.md at the worktree's root, whichever exist, and follows them. Project setup becomes step 6.

Why

gc's ACP runtime runs no pre_start, so a seat's first session starts in the plain directory gc made under the city's checkout, before Part 2 makes the worktree. Claude Code reads its start-time context there, not the rig's. Later sessions of the seat start in the worktree and are fine. Nothing carries an AGENTS.md or CLAUDE.md yet, so nothing was missed, but it would be from the day a rig adds one.

Scope

This is the bead's second way out. The first, making the worktree before the session starts from the acp provider's acp_command, is the city's city.toml (gascity-root), not this repository. It would also cover the rig's .claude/ settings, which the new step cannot: they are read at session start only. The README says so. If the user wants that too, it is a bead for the city.

Size

The step text was within about 100 characters of the 28000 that tests/formula.sh allows a gc bd show of it, so three sentences of Part 2 that only explained are shortened or cut (the GNU check's "passes silently" line, the halt's "who takes it from there", the reason for the Rex label). No instruction is removed. It now stands at about 27960.

Checks

  • tests/formula.sh passes, run under env -i: this checkout predates the gc --city pin in the test, so in a Worker's env gc compiles the city's cached roles pack and not the checkout's. New assertions: Part 2 names both files, after the branch checkout and before project setup.
  • gc lint . passes; the changelog checker finds nothing; the note is the fragment .changelog/worker-reads-repo-instructions.md.

Bead: gascitypacks-7ws

## What Part 2 of `mol-worker-work` has a new step 5: after the Worker is on the bead's branch, it reads `AGENTS.md` and `CLAUDE.md` at the worktree's root, whichever exist, and follows them. Project setup becomes step 6. ## Why gc's ACP runtime runs no `pre_start`, so a seat's first session starts in the plain directory gc made under the city's checkout, before Part 2 makes the worktree. Claude Code reads its start-time context there, not the rig's. Later sessions of the seat start in the worktree and are fine. Nothing carries an `AGENTS.md` or `CLAUDE.md` yet, so nothing was missed, but it would be from the day a rig adds one. ## Scope This is the bead's second way out. The first, making the worktree before the session starts from the acp provider's `acp_command`, is the city's `city.toml` (gascity-root), not this repository. It would also cover the rig's `.claude/` settings, which the new step cannot: they are read at session start only. The README says so. If the user wants that too, it is a bead for the city. ## Size The step text was within about 100 characters of the 28000 that `tests/formula.sh` allows a `gc bd show` of it, so three sentences of Part 2 that only explained are shortened or cut (the GNU check's "passes silently" line, the halt's "who takes it from there", the reason for the Rex label). No instruction is removed. It now stands at about 27960. ## Checks - `tests/formula.sh` passes, run under `env -i`: this checkout predates the `gc --city` pin in the test, so in a Worker's env gc compiles the city's cached roles pack and not the checkout's. New assertions: Part 2 names both files, after the branch checkout and before project setup. - `gc lint .` passes; the changelog checker finds nothing; the note is the fragment `.changelog/worker-reads-repo-instructions.md`. Bead: gascitypacks-7ws
fix: a Worker reads the repository's AGENTS.md and CLAUDE.md in Part 2 (gascitypacks-7ws)
All checks were successful
test / changelog (pull_request) Successful in 4s
test / lint (pull_request) Successful in 22s
test / scripts (pull_request) Successful in 33s
449832d330
gc's ACP runtime runs no pre_start, so on a seat no Worker has used the
session starts in the plain directory gc made, under the city's checkout,
and Claude Code reads its start-time context there: the city's, not the
rig's. Later sessions start in the worktree and read the right files.

Part 2 of mol-worker-work now has a step 5 that tells the Worker to read
AGENTS.md and CLAUDE.md at the worktree's root once it is on the branch,
before project setup (now step 6). Reading them again in a later session
does no harm. The repository's .claude/ settings are read at session
start only and are not covered: that needs the worktree to exist before
the session starts, i.e. the city's acp_command, which this repository
does not own; the README says so.

The step is within a few dozen characters of the 28000 a Worker's Bash
call keeps for gc bd show, so two sentences of Part 2 that only
explained are cut. tests/formula.sh asserts the step names both files
and sits after the branch checkout and before setup.

Validation: tests/formula.sh under env -i (this checkout predates the
gc --city pin, so the Worker env compiles the city's cached pack), and
gc lint . pass; the changelog checker reports no finding.
city-root-review left a comment

Review of 449832d330 for gascitypacks-7ws. Checks of the head: success.

Verdict

pass

Findings

  • [minor] README.md:429: "Every later session of the seat starts in the worktree and reads the right ones" is not true any more. Claude Code reads CLAUDE.md/AGENTS.md in every directory from the working directory up to /, not only up to the git root. A rig's Worker worktree is .gc/worktrees/<rig>/worker/... inside the city's checkout, and gascity-root has carried an AGENTS.md since gascity-root#37 (today). So every session of a rig's Worker reads the city's AGENTS.md, the first session and the later ones alike: its quality gates gc --city "$(pwd)" config show --validate, scripts/check-pins.sh and scripts/check-live-city.sh don't fit a rig's worktree. The new step 5 has the Worker read the repository's own files, but it doesn't tell the Worker to set aside the instructions that came from the city's checkout. When a repository has neither file, as gascitypacks has none today, the city's instructions are all the Worker has. This PR doesn't cause it, and it doesn't block the PR: the bead's premise ("no rig ... and not the city itself carries a CLAUDE.md or an AGENTS.md") stopped holding today. It is worth a bead of its own: either a sentence in step 5 ("instructions read from the city's checkout above are not this repository's") or a different place for the seats. Note that the step has about 40 characters to spare under the 28000 limit.

Verified

  • I read the work bead with its notes, the PR's description, and the whole diff (105 lines, 4 files). The PR implements the bead's second way out. Part 2 gets a new step 5 after the branch checkout and before project setup, and the "done when" line is updated. Three sentences that only explained were shortened, and no instruction was removed. The changelog fragment is under ### Fixed, and a README paragraph says why .claude/ settings stay out of reach. No new shell logic, and no rm.
  • The target branch main has no REVIEW.md, AGENTS.md or CLAUDE.md. I read the README from main.
  • I merged the head into the current origin/main (be97be3, which is three merges ahead of the branch point). The merge is clean, and the forge reports mergeable. None of those merges touched roles/formulas/mol-worker-work.toml, and grep finds no other reference to the old numbering of Part 2's steps.
  • On the merge result, under env -i (0 city variables), with a throwaway HOME for gc: bash tests/formula.sh (which includes the 28000-character size limit) and bash tests/reviewer.sh pass, gc lint . reports 2 packs ok, go vet ./..., go test ./... and go test -race ./... pass, and so do all 11 script tests of the scripts job.
  • I mutation-tested the new assertions. With step 5 removed, the test fails with "Part 2 does not have the Worker read the repository's instructions". With step 5 moved after project setup, it fails with "Part 2 has the instructions read after project setup".
  • Changelog: I built the checker from mikluko/changelog v2.1.0 (the commit v2 names now) and ran it with -fragments=.changelog -base=main: valid=true, no findings.
Review of 449832d3301717e4e99cdd0a4a2a0c430ed2dd5e for gascitypacks-7ws. Checks of the head: success. ### Verdict pass ### Findings - [minor] README.md:429: "Every later session of the seat starts in the worktree and reads the right ones" is not true any more. Claude Code reads `CLAUDE.md`/`AGENTS.md` in every directory from the working directory up to `/`, not only up to the git root. A rig's Worker worktree is `.gc/worktrees/<rig>/worker/...` inside the city's checkout, and gascity-root has carried an `AGENTS.md` since gascity-root#37 (today). So every session of a rig's Worker reads the city's `AGENTS.md`, the first session and the later ones alike: its quality gates `gc --city "$(pwd)" config show --validate`, `scripts/check-pins.sh` and `scripts/check-live-city.sh` don't fit a rig's worktree. The new step 5 has the Worker read the repository's own files, but it doesn't tell the Worker to set aside the instructions that came from the city's checkout. When a repository has neither file, as gascitypacks has none today, the city's instructions are all the Worker has. This PR doesn't cause it, and it doesn't block the PR: the bead's premise ("no rig ... and not the city itself carries a CLAUDE.md or an AGENTS.md") stopped holding today. It is worth a bead of its own: either a sentence in step 5 ("instructions read from the city's checkout above are not this repository's") or a different place for the seats. Note that the step has about 40 characters to spare under the 28000 limit. ### Verified - I read the work bead with its notes, the PR's description, and the whole diff (105 lines, 4 files). The PR implements the bead's second way out. Part 2 gets a new step 5 after the branch checkout and before project setup, and the "done when" line is updated. Three sentences that only explained were shortened, and no instruction was removed. The changelog fragment is under `### Fixed`, and a README paragraph says why `.claude/` settings stay out of reach. No new shell logic, and no `rm`. - The target branch `main` has no `REVIEW.md`, `AGENTS.md` or `CLAUDE.md`. I read the README from `main`. - I merged the head into the current `origin/main` (be97be3, which is three merges ahead of the branch point). The merge is clean, and the forge reports `mergeable`. None of those merges touched `roles/formulas/mol-worker-work.toml`, and `grep` finds no other reference to the old numbering of Part 2's steps. - On the merge result, under `env -i` (0 city variables), with a throwaway `HOME` for gc: `bash tests/formula.sh` (which includes the 28000-character size limit) and `bash tests/reviewer.sh` pass, `gc lint .` reports 2 packs ok, `go vet ./...`, `go test ./...` and `go test -race ./...` pass, and so do all 11 script tests of the `scripts` job. - I mutation-tested the new assertions. With step 5 removed, the test fails with "Part 2 does not have the Worker read the repository's instructions". With step 5 moved after project setup, it fails with "Part 2 has the instructions read after project setup". - Changelog: I built the checker from `mikluko/changelog` v2.1.0 (the commit `v2` names now) and ran it with `-fragments=.changelog -base=main`: `valid=true`, no findings.
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
2 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!63
No description provided.