claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Skill tool PostToolUse response returns incorrect agentId

Open raw1z opened this issue 2 weeks ago • 1 comments

Bug Description

When a Skill tool completes and fires a PostToolUse hook event, the tool_response.agentId field contains an ID that doesn't match the actual subagent transcript file created on disk.

Steps to Reproduce

  1. Invoke a Skill tool (e.g., committing-changes)
  2. Capture the PostToolUse hook event
  3. Compare tool_response.agentId with the actual subagent transcript file in ~/.config/claude/projects/<project>/<session_id>/subagents/

Expected Behavior

The agentId in the PostToolUse response should match the subagent transcript filename (e.g., if response has agentId: "ae2fbc4", there should be a file agent-ae2fbc4.jsonl).

Actual Behavior

The agentId in the response doesn't match any transcript file:

  • PostToolUse response: agentId: "ae2fbc4"
  • Actual transcript file created: agent-a674f5e.jsonl

Evidence

Task tools work correctly - the agentId matches:

Tool Response agentId Transcript File Match
Task aa94c92 agent-aa94c92.jsonl
Task abbcbfa agent-abbcbfa.jsonl
Skill ae2fbc4 agent-a674f5e.jsonl

PostToolUse Event Data (Skill)

{
  "hook_event_name": "PostToolUse",
  "tool_name": "Skill",
  "tool_use_id": "toolu_01SKyuBnaNn9aN23NuuTXC8p",
  "tool_input": {
    "skill": "committing-changes"
  },
  "tool_response": {
    "status": "forked",
    "agentId": "ae2fbc4",
    "commandName": "committing-changes"
  }
}

Impact

This breaks any tooling that tries to correlate subagents with their triggering Skill invocations using the agentId from hook events.

Environment

  • Claude Code CLI
  • macOS

raw1z avatar Jan 16 '26 00:01 raw1z