Repository navigation
feat(spawn): honor config/crew-exclude-tools on Claude workers via permissions.deny - #43
Conversation
| @@ -0,0 +1,109 @@ | |||
| # Claude.ai connector tools denied to Claude ship and scout workers. | |||
There was a problem hiding this comment.
This list is pretty specific to my needs and may not fit everyone who useses this project. My suggestion is this list be saved to some local only configuration. If we don't already have that concept I suspect we should create it so we can maintain configs in a manageable and access space.
There was a problem hiding this comment.
Agreed, and reworked. There is no tracked list anymore: the live list is your local, gitignored config/crew-exclude-tools, the same file Pi workers already honor. Claude ship and scout workers now turn it into permissions.deny in their launch settings instead of refusing a non-empty list, so one local list serves both runtimes. The only tracked file is the copyable example docs/examples/crew-exclude-tools (the 78 claude.ai connector write tools). With no file, or an empty one, nothing changes. Secondmate agents and the primary session are unaffected, and the list is still not inherited by secondmate homes (called out as an open question in the description). Head: e20743d.
Claude ship and scout launches now carry permissions.deny entries from the tracked bin/fm-worker-connector-deny.list in their inline --settings JSON, so send, post, create, edit, delete, share, and transition connector tools are removed from the worker's session under bypass and auto permission modes. Read tools stay allowed; secondmate and primary sessions are unchanged.
… upstream-owned files that no ADR exception covers (bin/fm-exclude-tools-lib.sh, the new bin/fm-worker-connector-deny.list, tests/lib.sh, tests/fm-backend-orca.test.sh, tests/fm-spawn-dispatch-profile.test.sh). Invariant: every path that differs from the upstream pin is in a PixelOven namespace or an ADR override set, and the workflow allowlist and the identity.md copy of it list the same paths. Fix, following ADR-0021's pattern: added docs/adr/0022-worker-connector-deny-list.md with Status Proposed, because the PR is a draft that should not ship yet. It lists the exact files and hunks covered. Added the five paths to the A4 allowlist in .github/workflows/pixeloven-gates.yml and made the same edit in docs/pixeloven/identity.md. Registered the ADR in docs/adr/README.md and docs/documentation-audiences.json, and named it in the ADR lists in fork-contract.md and identity.md. Local results: running the extracted fork-contract step, A1–A4 and A6–A11 pass, A4 included, but the run still ends FAILED on A5. A5 fails only because macOS BSD sed rejects '1{/^$/d}' ('extra characters at the end of d command'); README.md is unchanged and A5 passed in CI. tests/fm-documentation-audiences.test.sh and bin/fm-doc-audience-check.sh pass. bin/fm-lint-workflows.sh could not run because actionlint is not on PATH; the workflow edit only changes a regex string and the file still parses as YAML. ADR-0022 must be moved to Accepted before merge
Claude ship and scout launches now turn the home's local config/crew-exclude-tools into permissions.deny in their inline --settings JSON instead of refusing a non-empty list, so one local list serves Pi and Claude workers. The tracked connector list moves to the copyable example docs/examples/crew-exclude-tools; read-named entries warn on Claude launches. Secondmate agents and the primary session stay unaffected, and the list stays outside the inherited configuration set.
631fa4f to
e20743d
Compare
Renumber this branch's ADR from 0022 to 0024, because main now holds ADR-0022 (delivery-lane credential helper) and ADR-0023 (repeatable --allow-red waiver), and merge the A4 allowlist line with main's.
Intent
Build a deny list that stops worker sessions from calling send/post/delete/create/edit-class claude.ai connector tools, but do not ship it yet: "Let's build but not ship it yet. I want to see what shape it takes." The PR stays a DRAFT for review; it is not marked ready or merged.
Context (from an earlier tooling investigation, sections 4 and 6): Claude workers launch with
--dangerously-skip-permissionsby default (bin/fm-spawn.sh,CLAUDE_PERM_FLAGwhenconfig/claude-permission-modeis absent), and user settings hold nomcp__deny entries, so a worker can call Gmail send, Slack post, Calendar delete or Jira create with no prompt; today only prompt discipline guards that. Claude Code's permissions docs state deny rules are evaluated before the permission mode and override all permission modes, and a bare tool-name deny removes the tool from context (https://code.claude.com/docs/en/permissions) - not yet verified live. The investigation proposed addingpermissions.denyentries through the worker launch settings (__CLAUDESETTINGS__,bin/fm-spawn.sh).Wanted shape: a
permissions.denylist in the worker launch settings that blocks send/post/delete/create/edit-class claude.ai connector tools (Gmail send/draft-send/trash, Slack send/schedule/canvas writes, Calendar create/update/delete/respond, Atlassian create/edit/transition/comment, Drive share/trash/update, and similar), keeps every read tool allowed, and does not affect the primary's or navigators' own sessions.Added on review of PR #43 (inline on bin/fm-worker-connector-deny.list:1): "This list is pretty specific to my needs and may not fit everyone who useses this project. My suggestion is this list be saved to some local only configuration. If we don't already have that concept I suspect we should create it so we can maintain configs in a manageable and access space."
Answer on the deny list location: "On the deny list - agreed (a)" - option (a) was to reuse the existing local config/crew-exclude-tools, making Claude workers honour it via permissions.deny instead of a separate list.
Later decisions on the same PR: entries that match no tool in a Claude session are documented only (no warn or refuse rule), and that is listed as an open question in the PR's Shape section; the read-verb warning, its docs line, and its test were removed. Other runtimes and raw launch commands keep refusing a non-empty list; a secondmate's own agent and the primary session are unaffected; config/crew-exclude-tools stays outside the inherited configuration set; only the copyable example docs/examples/crew-exclude-tools is tracked.
This run revalidates the already-approved head e20743d with current origin/main merged into it (a merge, not a rebase, so no pushed history is discarded); main now carries ADR-0022 (delivery-lane GitHub credential helper) and ADR-0023 (repeatable --allow-red waiver). The only changes allowed versus e20743d are: renumber this PR's ADR from 0022 to 0024 (docs/adr/0024-worker-connector-deny-list.md, Status Proposed, must move to Accepted before merge) and every reference to it (docs/adr/README.md, docs/documentation-audiences.json, docs/pixeloven/fork-contract.md, docs/pixeloven/identity.md), and merge this PR's A4 allowlist tokens (fm-exclude-tools-lib, docs/examples/crew-exclude-tools, fm-spawn-dispatch-profile) with main's line in both .github/workflows/pixeloven-gates.yml and docs/pixeloven/identity.md. No other edits, no rewording, no new fixes. Main's pre-existing difference between the two allowlist copies (fm-pr-merge appears only in the workflow copy) is main's and is deliberately left alone. Known pre-existing CI failures on main: Behavior portable serial 2 (tests/fm-supervision-host.test.sh) and serial 5 (tests/fm-remote-secondmate-lifecycle-e2e.test.sh watcher assertion); those go to the operator's merge-time waiver and are not to be fixed here.
What Changed
bin/fm-spawn.shandbin/fm-exclude-tools-lib.shnow acceptclaudeas a runtime that can exclude tools. A non-emptyconfig/crew-exclude-toolsbecomes apermissions.denyfragment, built by the newfm_exclude_tools_claude_denyfunction. That fragment goes into the inline--settingsJSON of every Claude ship and scout spawn and relaunch. The new__CLAUDEDENY__placeholder is substituted after all other placeholders, so listed names are never rewritten. Secondmate agents, other runtimes and raw launch commands behave as before; for example, a raw launch still refuses when the list is non-empty.docs/examples/crew-exclude-tools, a copyable starting list of write-class tools for claude.ai connectors (Gmail, Slack, Calendar, Atlassian, Drive and similar).docs/configuration.mdgets a "Claude workers" section on how deny rules apply and their limits; for example, an entry that matches no tool does nothing and gives no warning. Adds ADR-0024 (status: Proposed), with links in the ADR index, the documentation-audiences map and the pixeloven fork-contract/identity docs.tests/fm-spawn-dispatch-profile.test.shgains tests for the Claude deny fragment. The A4 allowlist tokens in.github/workflows/pixeloven-gates.ymlanddocs/pixeloven/identity.mdnow include the new library, example file and test.🤖 Generated with Claude Code
Risk Assessment
✅ Low: Compared with the approved head e20743d, the merge changes only the ADR number (0022 to 0024) and its references, plus the merged A4 allowlist lines; the deny-list logic is unchanged and still substitutes the deny list after every other placeholder, as the earlier round required.
Testing
I stood up a disposable live lab with fm-live-lab.sh on the merged target tree and drove real Claude scout workers through fm-spawn.sh. The deny-listed worker launched with --dangerously-skip-permissions plus permissions.deny holding exactly the three listed names. It reported WebSearch, Slack send_message and Gmail send_message absent, while the Slack and Gmail read tools and WebFetch stayed available. A control worker with an empty list had every tool and ran WebSearch, so the absence came from the deny list. A codex spawn with the non-empty list was refused before launch, and the lab primary's command line carried no deny rules. The lab was torn down afterwards. The four Claude exclude-tools spawn tests pass: placeholder-shaped names, secondmate isolation, the example file, and the exact ship/scout deny. The first targeted run showed the Pi tests and the refusal test passing, but its Claude tests failed with 'command not found' because my trimmed runner had left out a helper. With every helper included, the Claude tests pass. That failure is recorded in the evidence log. The full test file was stopped at the background time limit, so it was not used as evidence. Secondmate isolation, placeholder-shaped names and the ADR/allowlist merge checks were not driven live and are marked untested.
git diff --name-only a165883e HEADand no…Evidence: Live deny-listed Claude worker launch command (permissions.deny under --dangerously-skip-permissions)
Source: Live deny-listed Claude worker launch command (permissions.deny under --dangerously-skip-permissions)
Evidence: Deny-listed worker's own tool-availability report (denied tools absent, read tools present)
Source: Deny-listed worker's own tool-availability report (denied tools absent, read tools present)
Evidence: Deny-listed worker pane capture
Source: Deny-listed worker pane capture
Evidence: Control worker launch command (no deny with comments-only list)
Source: Control worker launch command (no deny with comments-only list)
Evidence: Control worker report (all tools present, WebSearch ran)
Source: Control worker report (all tools present, WebSearch ran)
Evidence: Codex spawn refused with non-empty exclusion list
Source: Codex spawn refused with non-empty exclusion list
Evidence: Lab primary command line (no deny rules)
Source: Lab primary command line (no deny rules)
Evidence: Targeted exclude-tools spawn test output
Source: Targeted exclude-tools spawn test output
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
git diff --name-only a165883e HEADand no…bin/fm-live-lab.sh up --harness claude --supervision-host none --expect-host noon the target tree cc52583a (disposable lab /private/tmp/fmlab.mZFgKq; real Claude primary answered its probe)Lab: removed config/claude-permission-mode so workers get the default --dangerously-skip-permissions; wrote config/crew-exclude-tools = WebSearch, mcp__claude_ai_Slack__slack_send_message, mcp__claude_ai_Gmail__send_messagefm-brief.sh labdeny-scout notes --scout+fm-spawn.sh labdeny-scout projects/notes --scout --harness claude --model sonnet --effort low; captured the live claude process command line (ps) and the worker's own tool-availability reportControl: comments-only crew-exclude-tools,fm-spawn.sh labctl-scout ... --scout --harness claude; captured the launch command line and the reportfm-spawn.sh labdeny-codex projects/notes --scout --harness codexwith the non-empty list (refusal transcript, exit code, no state meta)Lab primary process command line viaps(no permissions.deny)bin/fm-live-lab.sh down(tmux server, trust entries, task temp dirs and lab root removed) plus removal of the leftover /tmp/fm-labdeny-scout and /tmp/fm-labctl-scout dirsTargeted subset oftests/fm-spawn-dispatch-profile.test.sh: test_pi_exclude_tools_reach_ship_and_scout_launches, test_pi_exclude_tools_worker_registry_reports, test_pi_exclude_tools_absent_and_empty_lists, test_exclude_tools_unsupported_runtime_refuses_non_empty_list, test_claude_exclude_tools_deny_on_ship_and_scout_launches, test_claude_exclude_tools_names_survive_launch_placeholders, test_claude_secondmate_launch_ignores_exclude_tools, test_exclude_tools_example_parses_for_claudeRan the merged A4 allowlist regex from .github/workflows/pixeloven-gates.yml againstgit diff --name-only a165883e HEAD;git grepfor stale ADR-0022 references to the deny-list ADR✅ **Document** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.