feat(delegate): add --write/--plan delegation permission modes - #23
Merged
Merged
Conversation
crossagent could run second-opinion (read-only) delegations but had no ergonomic way to grant an executor write access, so delegated write tasks silently ran read-only. Add advisor-agnostic --write/--plan intents that expand to each advisor's native permission flags. - Advisor gains write_args/plan_args tuples + mode_args()/supports_mode(); built-ins: cmd --yolo, opencode --auto, claude bypassPermissions, codex --sandbox workspace-write (stock codex exec is read-only). - --write/--plan/--permission-mode are one mutually-exclusive group, shared by the foreground and start parsers. - --write on a read-only advisor hard-fails (exit 2), never a silent read-only run; --plan on an advisor with no plan flags warns; --write without --allow-path warns about unbounded access. - Semantic mode persists to command.json and re-expands against the CHILD advisor on escalation; a --write escalation onto a read-only rung is refused and audited. Verifier stays read-only regardless of mode. - --list-advisors shows each advisor's write/plan flags. Verified live end-to-end with commandcode and codex (--write writes within --allow-path scope, check + scope gates green). 537 tests pass (+24).
Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
datj9
force-pushed
the
feat/delegation-modes
branch
from
September 8, 2026 08:06
a4cbef0 to
500dd11
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
crossagent could run second-opinion (read-only) delegations but had no ergonomic way to grant an executor write access. Delegated write tasks silently ran read-only — the exact failure crossagent's no-silent-failure ethos exists to prevent. There was also no path an orchestrating Claude agent could use, since the auto-mode classifier blocks the literal
--yolotoken in a command an agent emits.What
Advisor-agnostic
--write/--planintents that expand to each advisor's native permission flags.Advisorgainswrite_args/plan_argstuples +mode_args()/supports_mode(). Built-ins:commandcode --yolo,opencode --auto,claude bypassPermissions,codex --sandbox workspace-write(stockcodex execis read-only, confirmed by probe).--write/--plan/--permission-modeare one argparse mutually-exclusive group, shared by the foreground andstartparsers via_add_mode_args.--writeon a read-only advisor hard-fails (exit 2), never a silent read-only run.--planon an advisor with no plan flags warns and uses its default.--writewithout--allow-pathwarns about unbounded access.modepersists tocommand.jsonand re-expands against the child advisor on escalation — a--writejob escalates to a peer that can also write, or the rung is refused and audited. The independent verifier stays read-only regardless of mode.--list-advisorsshows each advisor's write/plan flags.Verification
crossagent start --agent cmd --write --allow-path add.py --check ...→succeeded | check 0 | scope ok, file written within scope.crossagent start --agent codex --write ...→ file written (confirms the codex read-only fix).Notes
--permission-mode auto-acceptdoes not enable writes in-pmode (needs--yolo);--allow-pathscope enforcement requires a git repo (fails closed otherwise).🤖 Generated with Claude Code