-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
coreenhancementNew feature or requestNew feature or requestfeatureNew functionalityNew functionalitysecuritySecurity hardeningSecurity hardening
Milestone
Description
Part of #974
Background
Claude Code's agent frontmatter supports a disallowedTools list (denylist) as a complement to the existing tools allowlist. Additionally, the Task tool (which spawns sub-agents) can be restricted to specific agent types — e.g. Task(explore) means the agent can only spawn the explore sub-agent. These features give fine-grained control over what agents can do and what they can delegate.
Current state in Zeph
FilteredToolExecutor in zeph-core/src/subagent/ implements a ToolPolicy with an allowlist. There is no denylist complement. SubAgentManager::spawn() can be called with any agent name — there is no per-agent restriction on which sub-agents it may spawn.
Implementation
disallowedTools denylist
- Add
deny: Vec<String>to the existingToolPolicy(alongsideallow). - Evaluation order in
FilteredToolExecutor: if tool is indeny→ block, else ifallowis non-empty and tool not inallow→ block, else allow. - Wildcard support:
deny: ["*"]blocks all tools (useful for plan-only agents). - Update
AgentFileSpec:tools: allow: [shell, web_scrape] deny: [delete_file, write_file]
Task(agent_type) spawn restrictions
- Add
allowed_spawns: Option<Vec<String>>toSubAgentDef/AgentFileSpec. - In
SubAgentManager::spawn(parent_id, target_name): if the parent agent hasallowed_spawns: Some(list)andtarget_nameis not inlist, returnErr(SpawnDenied). allowed_spawns: null(default) means unrestricted spawning.allowed_spawns: []means the agent cannot spawn any sub-agents at all.- Frontmatter syntax:
allowed_spawns: - explore - summarizer
Acceptance criteria
-
deny: [shell]in tool policy prevents shell tool execution even ifallow: [shell]is also set (deny wins). -
deny: ["*"]blocks all tool calls. -
allowed_spawns: [explore]prevents the agent from spawning any agent other thanexplore. -
SpawnDeniederror is returned (not a panic) and includes the denied agent name. - Unit tests: deny overrides allow, wildcard deny, spawn restriction allow, spawn restriction deny.
-
cargo nextest run -p zeph-corepasses with zero warnings.
Technical notes
- Deny evaluation must happen before allow to prevent allow-then-deny confusion.
SpawnDeniedshould be a variant in the existingSubAgentErrorenum.- Document the deny/allow interaction in code comments on
ToolPolicy. allowed_spawnsis stored inSubAgentDef, not inSubAgentPermissions, since it is a capability constraint not a resource limit.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
coreenhancementNew feature or requestNew feature or requestfeatureNew functionalityNew functionalitysecuritySecurity hardeningSecurity hardening