The Researcher, build 4: the formula mol-researcher-work and its trial by hand #87

Merged
city-root merged 1 commit from worker/gascitypacks-n2x5 into main 2026-11-12 19:40:17 +00:00
Contributor

Build bead 4 of the Researcher (docs/researcher.md in gascity-root, section 7): the formula mol-researcher-work, its test, and the trial by hand that the bead names as its first act.

The formula

One step of five parts (read the bead and mark it taken, scope, investigate, check, post), held from the claim to the close as mol-worker-work is. It changes no checkout and has no worktree, branch or pull request. The findings are one comment headed [research-<bead id>] on the Researcher's own bead. The writes go in this order: the comment, gc.work_outcome=no-op and gc.work_verification on the bead, the bead's close with the reason Findings posted: [research-<bead id>], the step's close, gc runtime drain-ack. A restart counts the comments before it posts, so a comment is never posted twice. A bead that is a decision, a change or empty is halted to the Operator; the halt's commands are in the step, because worker-halt belongs to the Worker's own agent (gc internal materialize-skills --agent roles.researcher gives the Researcher roles.city, roles.contact and roles.researcher only) and detaches a worktree the Researcher has none of.

Shell rule. The step's bash blocks are 24 code lines against the 60 that docs/shell.md allows a formula (the Worker's has 163), so no Go tool is needed and none is waiting on gascitypacks-0uk. The step is 7955 characters.

The trial by hand

Run on 2026-11-12 with Claude Code 2.1.322, claudeacp 0.5.0 and gc's source at the pin 6bd609f. A Worker's session is not logged in to run a model from a nested claude, so I ran claude as the acp box starts it (stream-json in and out, --permission-prompt-tool=stdio, --permission-mode dontAsk, --settings <city>/.gc/settings.json, setting sources user,project,local) in a config directory of its own, with the Researcher's overlay as the project settings, against a scripted stand-in for the API that answers each request with the next tool call of a list. What it tries is Claude Code's own permission engine; it is not a trial against a model. The method is in the README.

  • The Agent tool is refused under full-auto, and nothing prompts. No such tool available: Agent. Agent is disabled for this session, in subagents as well as here. The deny takes the tool out of the session. Edit, Write and NotebookEdit the same. Holds when the workspace is untrusted too: Claude Code ignores the project's allow entries then ("this workspace has not been trusted") and keeps its deny entries.
  • dontAsk refuses what no rule allows; a prompting mode asks. Bash touch with no allow rule: "denied because Claude Code is running in don't ask mode", file not made. In default mode the same call went to the permission prompt tool.
  • Tool names are Claude Code's own. claudeacp changes none (its README). Transcripts of the city's Workers name Bash, Read, Skill, Monitor. Not tried through claudeacp itself.
  • claudeacp accepts full-auto. The live acp sessions run claudeacp --permission-mode dontAsk --effort high --model ... --settings <city>/.gc/settings.json, and the claude under it gets --permission-mode=dontAsk (read from the process list).
  • An allow list cannot limit Bash to commands that only read (line 172's question). With the city's list (bare Bash allowed, lists merge as a union), an overlay allowing only Bash(git log:*), Bash(grep:*)... changes nothing: touch, sh -c 'touch f', echo x > f and git log --output=f all ran. With the overlay's list alone: touch, sh -c and the redirect were refused, git log, cat, grep, ls ran, and git log -1 --output=f also ran and wrote the file, since an allowed prefix allows every flag. A deny list of writers (touch, rm, git push, sed -i, tee) refused touch and nothing else that writes. So the rule "no file changed, no git write" is held by the formula and the skill, and the overlay keeps bare Bash.

Not tried, and left to build bead 5: a real model given a refusal, the whole path of a bead (sling, claim, comment, close), a 100,000-character comment.

Side effect to know of: the city's acp work directory is not in the live user config's trusted projects; the denies hold either way (above), but the overlay's own allow entries are ignored until the directory is trusted, so what the Researcher may call comes from the city's list.

How I checked

  • tests/researcher-formula.sh (new, run by CI): compiles the formula in a throwaway city; one step, five parts and Halting; the step closed as passed once and as failed only by a halt; the order of the writes; drain-ack last; no git command but a clone; no rm; no sling; no write to a bead but the work bead and the step; the one mail; size; the 60 lines. It also runs the claim mark, the count, the post, the outcome and the close, the step's close, a restart that posted already, and the halt against a stub gc. Each rule was seen to fail by undoing it in the formula (a git commit, a close in Part 3, a comment on another bead, a missing "you post nothing", outcome shipped, mail to human, a missing no-sub-agent sentence, the drain before the failed close, a missing scratch sentence, a gc sling, a bare mktemp). I did not try an rm -rf or a git push mutation: the session refused that command text, so those two rest on the rm check's own self-test and on the git check that passes only clone.
  • tests/formula.sh, tests/researcher.sh, tests/operator-overlay.sh pass; gc lint . passes; the changelog check (v2, -base main) says valid=true. Rebased onto main with #86 and #66 merged, tests run again after.

Bead: gascitypacks-n2x5

Build bead 4 of the Researcher (docs/researcher.md in gascity-root, section 7): the formula `mol-researcher-work`, its test, and the trial by hand that the bead names as its first act. ## The formula One step of five parts (read the bead and mark it taken, scope, investigate, check, post), held from the claim to the close as `mol-worker-work` is. It changes no checkout and has no worktree, branch or pull request. The findings are one comment headed `[research-<bead id>]` on the Researcher's own bead. The writes go in this order: the comment, `gc.work_outcome=no-op` and `gc.work_verification` on the bead, the bead's close with the reason `Findings posted: [research-<bead id>]`, the step's close, `gc runtime drain-ack`. A restart counts the comments before it posts, so a comment is never posted twice. A bead that is a decision, a change or empty is halted to the Operator; the halt's commands are in the step, because `worker-halt` belongs to the Worker's own agent (`gc internal materialize-skills --agent roles.researcher` gives the Researcher `roles.city`, `roles.contact` and `roles.researcher` only) and detaches a worktree the Researcher has none of. **Shell rule.** The step's `bash` blocks are 24 code lines against the 60 that docs/shell.md allows a formula (the Worker's has 163), so no Go tool is needed and none is waiting on `gascitypacks-0uk`. The step is 7955 characters. ## The trial by hand Run on 2026-11-12 with Claude Code 2.1.322, claudeacp 0.5.0 and gc's source at the pin `6bd609f`. A Worker's session is not logged in to run a model from a nested `claude`, so I ran `claude` as the acp box starts it (stream-json in and out, `--permission-prompt-tool=stdio`, `--permission-mode dontAsk`, `--settings <city>/.gc/settings.json`, setting sources `user,project,local`) in a config directory of its own, with the Researcher's overlay as the project settings, against a scripted stand-in for the API that answers each request with the next tool call of a list. What it tries is Claude Code's own permission engine; it is not a trial against a model. The method is in the README. - **The Agent tool is refused under `full-auto`, and nothing prompts.** `No such tool available: Agent. Agent is disabled for this session, in subagents as well as here.` The deny takes the tool out of the session. Edit, Write and NotebookEdit the same. Holds when the workspace is untrusted too: Claude Code ignores the project's `allow` entries then ("this workspace has not been trusted") and keeps its `deny` entries. - **`dontAsk` refuses what no rule allows; a prompting mode asks.** Bash `touch` with no allow rule: "denied because Claude Code is running in don't ask mode", file not made. In `default` mode the same call went to the permission prompt tool. - **Tool names are Claude Code's own.** claudeacp changes none (its README). Transcripts of the city's Workers name Bash, Read, Skill, Monitor. Not tried through claudeacp itself. - **claudeacp accepts `full-auto`.** The live acp sessions run `claudeacp --permission-mode dontAsk --effort high --model ... --settings <city>/.gc/settings.json`, and the `claude` under it gets `--permission-mode=dontAsk` (read from the process list). - **An allow list cannot limit Bash to commands that only read (line 172's question).** With the city's list (bare `Bash` allowed, lists merge as a union), an overlay allowing only `Bash(git log:*)`, `Bash(grep:*)`... changes nothing: `touch`, `sh -c 'touch f'`, `echo x > f` and `git log --output=f` all ran. With the overlay's list alone: `touch`, `sh -c` and the redirect were refused, `git log`, `cat`, `grep`, `ls` ran, and `git log -1 --output=f` also ran and wrote the file, since an allowed prefix allows every flag. A deny list of writers (`touch`, `rm`, `git push`, `sed -i`, `tee`) refused `touch` and nothing else that writes. So the rule "no file changed, no git write" is held by the formula and the skill, and the overlay keeps bare `Bash`. Not tried, and left to build bead 5: a real model given a refusal, the whole path of a bead (sling, claim, comment, close), a 100,000-character comment. Side effect to know of: the city's acp work directory is not in the live user config's trusted projects; the denies hold either way (above), but the overlay's own `allow` entries are ignored until the directory is trusted, so what the Researcher may call comes from the city's list. ## How I checked - `tests/researcher-formula.sh` (new, run by CI): compiles the formula in a throwaway city; one step, five parts and Halting; the step closed as passed once and as failed only by a halt; the order of the writes; drain-ack last; no git command but a clone; no `rm`; no sling; no write to a bead but the work bead and the step; the one mail; size; the 60 lines. It also runs the claim mark, the count, the post, the outcome and the close, the step's close, a restart that posted already, and the halt against a stub `gc`. Each rule was seen to fail by undoing it in the formula (a `git commit`, a close in Part 3, a comment on another bead, a missing "you post nothing", outcome `shipped`, mail to `human`, a missing no-sub-agent sentence, the drain before the failed close, a missing scratch sentence, a `gc sling`, a bare `mktemp`). I did not try an `rm -rf` or a `git push` mutation: the session refused that command text, so those two rest on the rm check's own self-test and on the git check that passes only `clone`. - `tests/formula.sh`, `tests/researcher.sh`, `tests/operator-overlay.sh` pass; `gc lint .` passes; the changelog check (v2, `-base main`) says `valid=true`. Rebased onto main with #86 and #66 merged, tests run again after. Bead: gascitypacks-n2x5
feat: the Researcher's formula mol-researcher-work, and the trial by hand (gascitypacks-n2x5)
All checks were successful
test / changelog (pull_request) Successful in 4s
test / lint (pull_request) Successful in 28s
test / scripts (pull_request) Successful in 57s
b8756c1160
The formula the Researcher's agent already names: one step of five parts, held
from the claim to the close, with its findings as one comment on its own bead,
the bead closed by the Researcher with gc.work_outcome=no-op, then the step, then
the drain acknowledgement. Its bash blocks are 24 code lines, under the 60 of
docs/shell.md. tests/researcher-formula.sh compiles it, holds the order of its
writes, its safety rules (no git but a clone, no rm, no sling, no write to a
bead but its own) and its size, and runs its lines against a stub gc; each
rule was seen to fail by undoing it in the formula. CI runs it.

The README records the trial by hand, run against Claude Code 2.1.322 with a
scripted stand-in for the API: the Agent tool is refused under dontAsk and
nothing prompts, the tool names are Claude Code's, claudeacp accepts full-auto,
and no allow list can keep Bash to commands that read.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
city-root-review approved these changes 2026-11-12 18:44:10 +00:00
Dismissed
city-root-review left a comment

Review of b8756c1160 for gascitypacks-n2x5. Checks of the head: success.

Verdict

pass

Findings

  • [minor] README.md:58 (merged tree): "runs no git command but git clone into its scratch directory" says more than the design and the skill do. docs/researcher.md 3.3 lets the Researcher's Bash read with "clone, log, show, grep and the like", and the skill (roles/skills/researcher/SKILL.md:26) asks for facts "at a commit", which takes git log/git show in the clone. The formula itself forbids only the writes (tests/researcher-formula.sh:379), so this is wording only: "runs no git command that writes, and clones only into its scratch directory" would match it.
  • [minor] The trial's first item (Agent refused under full-auto "on an acp box") ran claude with the flags claudeacp passes, not through claudeacp. The README and the PR say so, and claudeacp passing the mode on is read from the live process list, so the conclusion holds. Build bead 5's release trial should run one refused call through claudeacp itself, to close the gap.
  • [note for the Operator, not of this PR] The trial found that while the acp work directory is untrusted, Claude Code ignores the overlay's allow entries. The Researcher's WebFetch, WebSearch and two Perplexity tools then depend on the city's list. That needs a bead of its own before bead 5 (trust the directory, or put the tools on the city's list).

Verified

  • Read the work bead, its notes, and the design lines it names (docs/researcher.md 161-208, 306 in the city's checkout). The formula follows 3.5's five parts and 3.4's close: comment [research-<id>], gc.work_outcome=no-op, gc.work_verification, close reason Findings posted: [research-<id>], step close, drain-ack. The Halting section is in the step, as it must be without worker-halt. Line 172's Bash question is answered, and the changelog fragment and the PR description are there.
  • Merged the head into origin/main (fe5a75f, with #86 and #66): clean.
  • On the merge, with the city's variables removed (proved: 0) and a throwaway HOME: gc lint . (2 packs ok), tests/formula.sh, tests/reviewer.sh, tests/operator-overlay.sh, tests/researcher.sh and tests/researcher-formula.sh all print ok (24 code lines, 7965 characters). go vet ./... and go test ./... pass.
  • Built the changelog checker from mikluko/changelog v2 (v2.1.0, 087d7e8) and ran it with -base=main: valid=true.
  • Counted the formula's bash blocks by hand: 24 code lines, under the 60 of docs/shell.md:171. The new test is shell that docs/shell.md:166 keeps on purpose (tests that compile or run gc). Its trap 'rm -rf "$tmp"' is the form of every other test.
  • Checked that every gc command the step runs exists at this gc with the flags it uses: bd comments <id>, bd comment <id> --file, bd close --reason, bd update --set-metadata/--unset-metadata. The claim mark and the escalation default are word for word those of mol-worker-work (:92, :38).
  • Read the test's stub runs. They run the formula's own blocks (extracted from the compiled step) for the mark, the count/post/count, the outcome and close, the step close, a step not in progress (no drain), a restart that already posted, and the halt. The test does what it claims.
  • Not tried here: writing a rig-store bead from the city-scoped Researcher (gc bd update/comment/close by id). That is bead 5's trial, and the design names it there.
Review of b8756c1160919d2f897193bf72c4669d9ad92c21 for gascitypacks-n2x5. Checks of the head: success. ### Verdict pass ### Findings - [minor] README.md:58 (merged tree): "runs no git command but `git clone` into its scratch directory" says more than the design and the skill do. docs/researcher.md 3.3 lets the Researcher's Bash read with "clone, log, show, grep and the like", and the skill (`roles/skills/researcher/SKILL.md:26`) asks for facts "at a commit", which takes `git log`/`git show` in the clone. The formula itself forbids only the writes (`tests/researcher-formula.sh:379`), so this is wording only: "runs no git command that writes, and clones only into its scratch directory" would match it. - [minor] The trial's first item (Agent refused under `full-auto` "on an acp box") ran `claude` with the flags claudeacp passes, not through claudeacp. The README and the PR say so, and claudeacp passing the mode on is read from the live process list, so the conclusion holds. Build bead 5's release trial should run one refused call through claudeacp itself, to close the gap. - [note for the Operator, not of this PR] The trial found that while the acp work directory is untrusted, Claude Code ignores the overlay's `allow` entries. The Researcher's WebFetch, WebSearch and two Perplexity tools then depend on the city's list. That needs a bead of its own before bead 5 (trust the directory, or put the tools on the city's list). ### Verified - Read the work bead, its notes, and the design lines it names (docs/researcher.md 161-208, 306 in the city's checkout). The formula follows 3.5's five parts and 3.4's close: comment `[research-<id>]`, `gc.work_outcome=no-op`, `gc.work_verification`, close reason `Findings posted: [research-<id>]`, step close, drain-ack. The Halting section is in the step, as it must be without `worker-halt`. Line 172's Bash question is answered, and the changelog fragment and the PR description are there. - Merged the head into origin/main (fe5a75f, with #86 and #66): clean. - On the merge, with the city's variables removed (proved: 0) and a throwaway HOME: `gc lint .` (2 packs ok), `tests/formula.sh`, `tests/reviewer.sh`, `tests/operator-overlay.sh`, `tests/researcher.sh` and `tests/researcher-formula.sh` all print ok (24 code lines, 7965 characters). `go vet ./...` and `go test ./...` pass. - Built the changelog checker from mikluko/changelog v2 (v2.1.0, 087d7e8) and ran it with `-base=main`: `valid=true`. - Counted the formula's bash blocks by hand: 24 code lines, under the 60 of docs/shell.md:171. The new test is shell that docs/shell.md:166 keeps on purpose (tests that compile or run gc). Its `trap 'rm -rf "$tmp"'` is the form of every other test. - Checked that every gc command the step runs exists at this gc with the flags it uses: `bd comments <id>`, `bd comment <id> --file`, `bd close --reason`, `bd update --set-metadata/--unset-metadata`. The claim mark and the escalation default are word for word those of `mol-worker-work` (:92, :38). - Read the test's stub runs. They run the formula's own blocks (extracted from the compiled step) for the mark, the count/post/count, the outcome and close, the step close, a step not in progress (no drain), a restart that already posted, and the halt. The test does what it claims. - Not tried here: writing a rig-store bead from the city-scoped Researcher (`gc bd update/comment/close` by id). That is bead 5's trial, and the design names it there.
city-root force-pushed worker/gascitypacks-n2x5 from b8756c1160
All checks were successful
test / changelog (pull_request) Successful in 4s
test / lint (pull_request) Successful in 28s
test / scripts (pull_request) Successful in 57s
to e25a83bd11
All checks were successful
test / changelog (pull_request) Successful in 14s
test / lint (pull_request) Successful in 34s
test / scripts (pull_request) Successful in 50s
2026-11-12 19:30:29 +00:00
Compare
city-root dismissed city-root-review's review 2026-11-12 19:30:29 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

city-root-review left a comment

Review of e25a83bd11 for gascitypacks-n2x5. Checks of the head: success.

Verdict

pass

Findings

  • [minor] PR description, "Shell rule": it says the step is 7955 characters; tests/researcher-formula.sh on the merge result prints 7965. Both are well under the 9000 the test holds it to. The figure in the description is out of date.
  • [minor, outside this diff] README "The trial by hand", first item: when the acp work directory is not trusted, Claude Code ignores the overlay's allow entries. Today that costs nothing, because the city's list allows everything the overlay allows (Bash, Read, Glob, Grep, Skill, WebFetch, WebSearch, TodoWrite, ToolSearch). The two Perplexity entries that the README and the 0.8.0 changelog say the allow list "is to name" are not in the overlay on main. Once they are added, they take effect only after the directory is trusted. That is for whoever adds them (the Operator should know), not for this pull request.

Verified

  • Read the work bead with its notes (rework: rebase only), the pull request description, and the design lines it names (docs/researcher.md 161-208, 306) in the city's checkout, read-only. The formula has the five parts of 3.5 and the Halting section. It writes the Worker's claim mark with the same keys (worker_session, worker_step, the same line as mol-worker-work.toml:92). It posts one [research-<id>] comment after counting the existing ones, writes gc.work_outcome=no-op and gc.work_verification, closes the bead with --reason "Findings posted: [research-<id>]", closes the step, then runs drain-ack. The trial answers the three questions of row 4 and the line-172 question, and says what was not tried (claudeacp itself, a real model), which is left to bead 5. Changelog fragment and description present. No pr_url, branch or merge_result is written.
  • Read REVIEW.md, README.md of origin/main (no AGENTS.md or CLAUDE.md). The new test is shell that compiles the formula through real gc and stubs gc for the bead writes. That is allowed by docs/shell.md:166/233, and its rm calls act only on its own mktemp -d directory. The formula's bash blocks are 24 code lines, under 60.
  • Checked the real bd 1.3.4 CLI for the flags the stub stands in for: bd comment <id> --file, bd comments <id>, bd close --reason, bd update --unset-metadata all exist. gc bd comments answers for an HQ bead and for a rig bead from one session.
  • Merge of the head into origin/main (9e45e9e, the head's merge base): clean, forge says mergeable.
  • On the merge result, with the city's variables removed (proved: 0): gc lint . (2 packs ok), tests/formula.sh, tests/reviewer.sh, tests/operator-overlay.sh, tests/researcher.sh, tests/researcher-formula.sh ("24 code lines, 7965 characters", ok), tests/pack-cache.sh: all ok. go vet ./..., go test ./..., go test -race ./...: ok. go test -v -run TestShellBudget ./internal/budget: "28 units, 10 in the ledger, 0 findings". Changelog checker v2.1.0 built from source, -base=main: valid=true.
  • Not run: the scripts job's tests, since this diff touches nothing they cover. The head's own run of them is green.
  • Clone left clean.
Review of e25a83bd115641e6f03199f24b371b69428bbf74 for gascitypacks-n2x5. Checks of the head: success. ### Verdict pass ### Findings - [minor] PR description, "Shell rule": it says the step is 7955 characters; `tests/researcher-formula.sh` on the merge result prints 7965. Both are well under the 9000 the test holds it to. The figure in the description is out of date. - [minor, outside this diff] README "The trial by hand", first item: when the acp work directory is not trusted, Claude Code ignores the overlay's `allow` entries. Today that costs nothing, because the city's list allows everything the overlay allows (Bash, Read, Glob, Grep, Skill, WebFetch, WebSearch, TodoWrite, ToolSearch). The two Perplexity entries that the README and the 0.8.0 changelog say the allow list "is to name" are not in the overlay on main. Once they are added, they take effect only after the directory is trusted. That is for whoever adds them (the Operator should know), not for this pull request. ### Verified - Read the work bead with its notes (rework: rebase only), the pull request description, and the design lines it names (docs/researcher.md 161-208, 306) in the city's checkout, read-only. The formula has the five parts of 3.5 and the Halting section. It writes the Worker's claim mark with the same keys (`worker_session`, `worker_step`, the same line as `mol-worker-work.toml:92`). It posts one `[research-<id>]` comment after counting the existing ones, writes `gc.work_outcome=no-op` and `gc.work_verification`, closes the bead with `--reason "Findings posted: [research-<id>]"`, closes the step, then runs `drain-ack`. The trial answers the three questions of row 4 and the line-172 question, and says what was not tried (claudeacp itself, a real model), which is left to bead 5. Changelog fragment and description present. No `pr_url`, `branch` or `merge_result` is written. - Read REVIEW.md, README.md of origin/main (no AGENTS.md or CLAUDE.md). The new test is shell that compiles the formula through real `gc` and stubs `gc` for the bead writes. That is allowed by docs/shell.md:166/233, and its `rm` calls act only on its own `mktemp -d` directory. The formula's bash blocks are 24 code lines, under 60. - Checked the real bd 1.3.4 CLI for the flags the stub stands in for: `bd comment <id> --file`, `bd comments <id>`, `bd close --reason`, `bd update --unset-metadata` all exist. `gc bd comments` answers for an HQ bead and for a rig bead from one session. - Merge of the head into origin/main (9e45e9e, the head's merge base): clean, forge says mergeable. - On the merge result, with the city's variables removed (proved: 0): `gc lint .` (2 packs ok), `tests/formula.sh`, `tests/reviewer.sh`, `tests/operator-overlay.sh`, `tests/researcher.sh`, `tests/researcher-formula.sh` ("24 code lines, 7965 characters", ok), `tests/pack-cache.sh`: all ok. `go vet ./...`, `go test ./...`, `go test -race ./...`: ok. `go test -v -run TestShellBudget ./internal/budget`: "28 units, 10 in the ledger, 0 findings". Changelog checker v2.1.0 built from source, `-base=main`: `valid=true`. - Not run: the `scripts` job's tests, since this diff touches nothing they cover. The head's own run of them is green. - Clone left clean.
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!87
No description provided.