Skip to content

feat: block work tools without active delegation#50

Open
barkain wants to merge 3 commits into
mainfrom
block-work-tools
Open

feat: block work tools without active delegation#50
barkain wants to merge 3 commits into
mainfrom
block-work-tools

Conversation

@barkain

@barkain barkain commented May 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • require_delegation.py returns exit 2 (block) for the 7 WORK_TOOLS when no delegation is active
  • Agent, Skill, TaskCreate, EnterPlanMode, and all other tools always pass (exit 0)
  • Subagents bypass (CLAUDE_PARENT_SESSION_ID / CLAUDE_AGENT_ID)
  • delegation_active flag bypasses (main agent steering subagents)

Why

Plugin additionalContext doesn't carry CLAUDE.md authority — the model ignores soft nudges and calls work tools directly. Blocking is the only reliable enforcement mechanism available to plugins.

Test plan

  • 26 tests pass — work tools blocked, non-work tools allowed, subagent immunity, delegation_active bypass
  • Ruff clean
  • Manual: ccw --plugin-dir ~/dev/claude-code-workflow-orchestration → "add a hello world script" → should block Write and prompt delegation

🤖 Generated with Claude Code

Scoped to 7 WORK_TOOLS only — Agent, Skill, TaskCreate etc. always
pass. Subagents and active delegations bypass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

barkain and others added 2 commits May 13, 2026 00:07
Subagents saw the stub and tried to delegate instead of doing work.
The blocking hook already bypasses subagents, but the injected
instructions were still telling them to delegate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The flag was referenced by require_delegation.py to bypass blocking
for active delegations, but no code ever created it — the creation
logic was removed in v2.0.0. Now created in the PostToolUse hook
that already detects delegate invocations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant