Bug
A PostToolUse hook that returns additionalContext successfully executes and returns the context, but the context is not injected into the tool result for the model request on the same turn. It only becomes visible in subsequent turns when conversation history is replayed.
This means a hook designed to influence the model's immediate next action (e.g., "before presenting this plan, run a review skill") has no effect — the model never sees the instruction on the turn it matters.
Reproduction
- Configure a
PostToolUse hook that matches the memory tool and returns additionalContext:
{
"hooks": {
"PostToolUse": [
{
"matcher": "memory",
"hooks": [
{
"type": "command",
"command": "node ${PLUGIN_ROOT}/hooks/remind-plan-review.mts"
}
]
}
]
}
}
- The hook script outputs:
{
"hookSpecificOutput": {
"hookEventName": "PostToolUse",
"additionalContext": "Before presenting the plan to the user, you MUST use the 'review-plan' skill"
}
}
- Trigger the hook by having the agent call the
memory tool to create a plan.md file.
Evidence from debug logs
| Timestamp (ms) |
Event |
Detail |
| 604432 |
tool_call (memory) |
Completed successfully |
| 604457 |
hook (PostToolUse) |
Ran in 118ms, resultKind: "success", returned additionalContext |
| 604467 |
llm_request |
Sent to model — tool result contains only "File created successfully at: /memories/session/plan.md" |
- The
additionalContext text ("Before presenting the plan...") appears 0 times in the inputMessages of the same-turn llm_request (line 33 of main.jsonl).
- The same text appears in every subsequent
llm_request (line 44+), because the conversation history now includes the PostToolUse-context annotation from the transcript.
Expected behavior
The additionalContext from a PostToolUse hook should be appended to the tool result before the next model request on the same turn, so the model can act on it immediately.
Actual behavior
The additionalContext is recorded in the transcript but not injected into the tool result for the same-turn model call. It only becomes visible on the next user message turn, making it too late to influence the model's behavior.
Version
- VS Code Insiders (version from session log)
- Copilot Chat extension
Bug
A
PostToolUsehook that returnsadditionalContextsuccessfully executes and returns the context, but the context is not injected into the tool result for the model request on the same turn. It only becomes visible in subsequent turns when conversation history is replayed.This means a hook designed to influence the model's immediate next action (e.g., "before presenting this plan, run a review skill") has no effect — the model never sees the instruction on the turn it matters.
Reproduction
PostToolUsehook that matches thememorytool and returnsadditionalContext:{ "hooks": { "PostToolUse": [ { "matcher": "memory", "hooks": [ { "type": "command", "command": "node ${PLUGIN_ROOT}/hooks/remind-plan-review.mts" } ] } ] } }{ "hookSpecificOutput": { "hookEventName": "PostToolUse", "additionalContext": "Before presenting the plan to the user, you MUST use the 'review-plan' skill" } }memorytool to create aplan.mdfile.Evidence from debug logs
tool_call(memory)hook(PostToolUse)resultKind: "success", returnedadditionalContextllm_request"File created successfully at: /memories/session/plan.md"additionalContexttext ("Before presenting the plan...") appears 0 times in theinputMessagesof the same-turnllm_request(line 33 ofmain.jsonl).llm_request(line 44+), because the conversation history now includes thePostToolUse-contextannotation from the transcript.Expected behavior
The
additionalContextfrom aPostToolUsehook should be appended to the tool result before the next model request on the same turn, so the model can act on it immediately.Actual behavior
The
additionalContextis recorded in the transcript but not injected into the tool result for the same-turn model call. It only becomes visible on the next user message turn, making it too late to influence the model's behavior.Version