Skip to content

settings.json: "Task" matcher and permission should be "Agent" after Claude Code 2.1.x rename #969

@mellanon

Description

@mellanon

Summary

Claude Code 2.1.x renamed the Task tool to Agent. PAI v4.0.3's settings.json still references the old name in two places, causing hook failures and dead permissions.

Affected Locations

1. Hook matcher (line ~115 in settings.json)

// Current (broken)
{ "matcher": "Task", "hooks": [{ "type": "command", "command": "${PAI_DIR}/hooks/AgentExecutionGuard.hook.ts" }] }

// Fix
{ "matcher": "Agent", "hooks": [{ "type": "command", "command": "${PAI_DIR}/hooks/AgentExecutionGuard.hook.ts" }] }

2. Permissions allow list

// Current (dead entry)
"allow": [ ..., "Task", ... ]

// Fix
"allow": [ ..., "Agent", ... ]

3. Hook script comments

hooks/AgentExecutionGuard.hook.ts line 10:

// Current: TRIGGER: PreToolUse (matcher: Task)
// Fix:     TRIGGER: PreToolUse (matcher: Agent)

Symptoms

  • PreToolUse:Agent hook error on every Agent/background agent tool call
  • AgentExecutionGuard hook never fires (matcher "Task" doesn't match the renamed "Agent" tool)
  • "Task" in permissions.allow is a dead entry granting nothing

Reproduction

  1. Install PAI v4.0.3
  2. Use Claude Code 2.1.77 (or any 2.1.x where Task was renamed to Agent)
  3. Spawn any background agent
  4. Observe PreToolUse:Agent hook error in output

Environment

  • Claude Code: 2.1.77
  • PAI: v4.0.3
  • OS: macOS (Darwin 25.3.0)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions