The Researcher, build 2: the agent, its prompt and its allow list #71
No reviewers
Labels
No labels
No milestone
No project
No assignees
3 participants
Due date
No due date set.
Dependencies
No dependencies set
Reference
mikluko/gascitypacks!71
Loading…
Reference in a new issue
No description provided.
Delete branch "worker/gascitypacks-ajfb"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The user commits two lines first. Claude Code denies a write to a
.claudedirectory in full-auto, so the Edit ofroles/agents/researcher/overlay/per-provider/claude/.claude/settings.jsonwas refused and I did not write it another way. In that file'spermissions.allow, after"ToolSearch"(add a comma to it), the list must gain exactly:Until then the Researcher's session has the server but, under full-auto, may call none of its tools.
tests/researcher.shalready holds the other side (no more of Perplexity than search and ask, never the whole server), so it passes before and after.Round 3: the Reviewer's findings (review 317 on
190f9e1)Rebase. The branch is on
0deb291(main moved past62ca905). The one conflict was README's pack table again: main'sforgejorow now namespr comment(#62) and is kept, with myrolesrow. Main carries none of this change, so nothing was dropped.tests/researcher.shin CI'slintjob.gc mcp list --agentonly checks that the provider's command exists, and the runner has noclaude. The test now puts a stubclaude(exit 0) in its scratch directory and prepends it toPATH, with a comment saying why. Run underenv -iwith aPATHofgc,jq,/usr/binand/bin, the CI's shape:tests/researcher.sh,formula.sh,reviewer.shandoperator-overlay.shprintok.jqline:(["mcp__perplexity__perplexity_search","mcp__perplexity__perplexity_ask"] - .permissions.allow) | length == 0.full-auto(dontAsk) in every city that imports the pack, and why (the user's brief: full-auto with an allow list, never a mode that asks nothing).Round 2: rebase, and Perplexity
Rebase. The branch is on
0e49d7c. The one conflict was README's pack table: main'sforgejorow (it gained therevieworder) is kept, and myrolesrow, which names the Researcher, is kept. Main carries none of this change's parts (the role skill of #72 is the skill the agent names), so nothing was dropped.1. The server, the Researcher's alone.
roles/agents/researcher/mcp/perplexity.toml: the official server,@perplexity-ai/mcp-serverpinned to1.3.0. gc reads an agent's ownmcp/directory for that agent only. From the resolved config of a throwaway city that imports this checkout:gc mcp list --agent researcher:perplexity, stdio, layeragent, deliveryacp(the session receives it in-band insession/new), commandsh -c 'k=$(cat "$HOME/.config/gascity-root/perplexity-token") && PERPLEXITY_API_KEY=$k exec npx -y @perplexity-ai/mcp-server@1.3.0', noenv.gc mcp list --agent workerand--agent operator: no servers.session/new'smcpServersintoclaude --mcp-config '{"mcpServers":{...}}'(claudeagent/options.go), so the Researcher'sclaudegets one server namedperplexity, and its tools aremcp__perplexity__perplexity_search,_ask,_researchand_reason(the package'sserver.jsregisters those four).2. The allow list names search and ask and nothing else of Perplexity (the lines at the top);
perplexity_researchandperplexity_reasonstay off, since under full-auto what no rule allows is denied.3. The key. The file
~/.config/gascity-root/perplexity-token, read by the server's start, as the forge tokens andkimicode-tokenare: the server takes its key fromPERPLEXITY_API_KEYonly, an acp session'senventries are literal, and the city's[[patches.agent]]env would put the key in the trackedcity.toml. I did not read the key, create the file or write it into a tracked file. The one command the user runs (the README says it too):The start line is one
sh -cline with no branch and no parse (under every threshold ofdocs/shell.md). Without the file it ends withcat's message and the session carries on without Perplexity.npxhas to be on the session'sPATH(it is/opt/homebrew/bin/npxhere).From the first round, unchanged: the agent, its prompt, the Operator's line, and how a pack gives one agent a list of its own (its overlay's
.claude/settings.json, which Claude Code merges with the city's: allow lists union, a deny beats any allow; see the README's Researcher section).Checks run:
bash tests/researcher.shon jq 1.7.1 and 1.8.2;gc lint .;tests/operator-overlay.sh;tests/formula.shunderenv -i(bare, it fails in a Worker's environment:gascitypacks-pmn); the changelog check (valid=true). Not shown: the server answering a search, since the key is not on the Mac yet.Round 1, as opened
Build bead 2 of the Researcher (
docs/researcher.mdin gascity-root, section 7): the agent, its prompt, its settings, the Operator's prompt line and a test. Bead: gascitypacks-ajfb.What it adds
roles/agents/researcher/agent.toml:scope = "city",session = "acp",wake_mode = "fresh",min_active_sessions = 0,max_active_sessions = 2,default_sling_formula = "mol-researcher-work",option_defaults = { permission_mode = "full-auto" },work_dir = ".gc/agents/researcher", the Worker's nudge (--drain-ack),inject_assigned_skills = false. The formula and the skillresearcherdo not exist yet (beads 3 and 4); the agent and its prompt name them.roles/agents/researcher/prompt.template.md: the Worker's, loadingresearcher,roles.cityandroles.contact.roles/agents/researcher/overlay/per-provider/claude/.claude/settings.json: its permissions (below)..gitignoreignores every dotfile, so the overlay's directory is un-ignored beside the Operator's.roles.researcher".tests/researcher.sh, run by thelintjob, and a fragment,.changelog/researcher-agent.md. README: the roles row and a section "The Researcher".How a pack gives one agent a list of its own
gc starts every Claude session of the city with one
--settings <city>/.gc/settings.json(the city's.claude/settings.jsonmerged over gc's defaults). I readcmd/gc/cmd_start.goandinternal/hooks/hooks.goat the pin (6bd609f): no agent field changes that file or names another in its place. The route is the agent's overlay: gc copiesoverlay/per-provider/claude/into the agent's work directory (internal/overlay/overlay.go; the Operator's.claude/settings.jsonworks this way), where Claude Code reads it as the project's settings and merges it with the city's. The merge is a union ofallowlists and ofdenylists, and a deny beats any allow (Claude Code's documented rule; see "Not shown").So an agent can add to the city's list, and can take a tool away only by denying it. The city's list has
Agent,EditandWrite, so an own allow list that merely leaves them out would take nothing away. The design's "allow list without the Agent tool" is therefore: the allow list of what it calls, and a deny of what the city's list gives and it must not have:Agent,Edit,Write,NotebookEdit.Bashstays as the city has it (bare, so no pattern of an own list can narrow it); a rule that keeps it to commands that read is for the trial of build bead 4 to find. A scratch note is written throughBash.Resolved
gc --city <throwaway> config show --json, city importingrolesfrom this checkout:gc prime researcherandgc prime operatorrender: "You are the Researcher of this Gas City. Before anything else, load the skillsresearcher,roles.cityandroles.contact..." and, in the Operator's, "- The Researcher's pool, for a bead that is a research question, of any store:roles.researcher".The overlay's rules merged with the city's list as it stands (gascity-root
.claude/settings.json):Agent,Edit,Writeare inallowand indeny: refused. The test computes this and fails when theAgentdeny is removed (tried).Checked
bash tests/researcher.shon jq 1.6, 1.7.1 and 1.8.2;tests/formula.shandtests/reviewer.shstill pass;gc lint .ok.-base main -fail-on warning) passes with the fragment.docs/shell.md): the one new script is a test.Not shown
Claude Code itself refusing a call of
AgentunderdontAskwith this merge: theclaudeCLI of the Worker's session was not logged in for a scratch run, so the merge rule is Claude Code's documented one and the test models it. Build bead 4 tries it first, as the design says. The city's own patch for the Researcher (model, effort,check-pins.sh) is bead 6; an import of this pack that carries the agent failscheck-pins.shuntil that patch is in the same pull request.🤖 Generated with Claude Code
Bead: gascitypacks-ajfb
c9043887562bf2d2976b2bf2d2976b190f9e18d9Review of
190f9e18d9for gascitypacks-ajfb. Checks of the head: failure (test / lint).Verdict
fail
Findings
lintjob fails here (run 236, joblint).gc mcp list --agent researcherexits withgc mcp list: provider not found in PATH: provider "claude" command "claude", because the runner has noclaude, and the two checks after it then fail onnull. That also means the job's Go step (go vet,go test) never ran. I reproduced it locally on the merge with main by running the test with a PATH that holds onlygc,jq,/usr/binand/bin: the same three FAIL lines. With a stubclaude(#!/bin/sh/exit 0) on that PATH it printsok. Fix: have the test put a stubclaudein$tmp/binand prepend that to PATH, with a comment saying gc only checks that the provider's command exists. Don't install Claude Code on the runner.gc mcp list --agent workerand--agent operatorpassed without it.mcp__perplexity__perplexity_search,mcp__perplexity__perplexity_ask). The bead routes them through the user, and the description says so, so this finding does not block. Until they are committed, the README (the Researcher section: "allows the tools it calls: … and two of Perplexity's") and the changelog describe a grant that the file does not make. The next head should carry the user's commit. tests/researcher.sh:123 checks only the upper bound (nothing beyond search and ask). Once the lines are in, it should also require both, so that a list that loses them fails.full-auto(dontAsk) in every city that imports the pack, and why (the user's brief: full-auto with an allow list, never bypass). That keeps the section complete after the merge.Verified
62ca905. The target branch has no REVIEW.md, AGENTS.md or CLAUDE.md.62ca905, which includes #57 and #73): clean, ort, no conflicts. The forge saysmergeable.env -i:gc lint .ok;tests/formula.sh,tests/reviewer.sh,tests/operator-overlay.sh,tests/researcher.shok (withclaudeon PATH);go vet ./...andgo test ./...ok.tests/researcher.shwithoutclaudeon PATH fails as CI does (finding 1).full-autopin matches the bead, and no test on main forbids it.k=$(cat …) && PERPLEXITY_API_KEY=$k exec …exports the key to the exec'd process (checked withenvand a fake token). With no file it exits 1 withcat's message, and the key is never in argv or in a tracked file.@perplexity-ai/mcp-server@1.3.0exists on npm and islatest(published 2026-09-25). Itsdist/registers exactlyperplexity_search,perplexity_ask,perplexity_researchandperplexity_reason, and reads the key fromprocess.env.PERPLEXITY_API_KEYonly. I only grepped it; nothing was run.baocommand in the README and the PR, a changelog fragment, and the test wired into CI. It adds no new shell logic beyond a test and the one-line start. The PR has a description.190f9e18d9f557cfe515Review of
f557cfe515for gascitypacks-ajfb. Checks of the head: success.Verdict
pass
Findings
mcp__perplexity__perplexity_searchandmcp__perplexity__perplexity_ask. Claude Code refused the Edit in full-auto again. The bead sends these lines to the user, and the top of the description gives them exactly, so this does not block. If the head merges first, the user's commit goes to main afterwards. Until then, README.md:605 ("and two of Perplexity's") and README.md:607 ("The allow list names the first two") describe a grant the file does not make. The changelog fragment's "is to name" is accurate. When the commit lands,tests/researcher.sh:312should also check the lower bound (thejqline the description gives), so that a list that drops the rules fails.Verified
190f9e1, and the whole diff (10 files, +234/-1) against main0deb291. Main has no REVIEW.md, AGENTS.md or CLAUDE.md.tests/researcher.shnow puts a stubclaude(exit 0) in$tmp/binahead of PATH, with a comment saying why. Fixed. (2) The allow rules: see the minor finding above. They still need the user's commit, as the bead says. (3) README "Permission mode" (README.md:55) has a paragraph saying the Researcher pinsfull-auto(dontAsk) in every city that imports the pack, and why. Fixed.0deb291), so it merges as a fast-forward with no conflicts. The forge saysmergeable.lintjob's steps on the merged tree, underenv -i, with PATH holding onlygc,jq,go,/usr/binand/bin(noclaude, as on the runner) and with a throwaway HOME.gc lint .ok.tests/formula.sh,tests/reviewer.sh,tests/operator-overlay.shandtests/researcher.shok.go vet ./...,go test ./...andgo test -race ./...ok.v2and ran it with-base=main -fail-on=warning:valid=true.rolespack,gc mcp list --agent roles.researcherand--agent researchereach show one server,perplexity(layeragent, commandsh).roles.workerandroles.operatorshow none.success.