closes #239, reported by Raymond Manaloto (@sortakool) The progress reminder is addressed to Claude: [planning-with-files] Update progress.md with what you just did. ... hooks/claude-hook.sh emitted it as systemMessage, which Claude Code documents as a warning shown to the USER. So the person saw the instruction after every Write, Edit and Bash call for a whole session, and the model it is written for never saw it once. emit_session_start eleven lines above already emitted hookSpecificOutput.additionalContext for its own event, so the correct shape was in the same file the whole time. .codex/hooks/post_tool_use.py had the identical defect, next to a pre_tool_use.py and a run_sh.py that already used the right shape. Three defects, one line apart, fixed together: 1. The field. Both routes now emit additionalContext under hookSpecificOutput with "hookEventName": "PostToolUse". 2. The throttle. Once per turn rather than once per tool call. The string is a constant, so every repeat after the first carries no information: it names no tool, no file and no phase. UserPromptSubmit and SessionStart fire once per turn and clear a marker; the first post-tool fire of the turn sets it. The marker lives in the user's private cache under pwf-turn/, never in the plan directory, and is keyed on the plan path plus PWF_SESSION_ID so two sessions sharing a plan do not silence each other. A cache root that cannot be created skips the throttle rather than the reminder, so a broken cache cannot quietly remove the signal instead of the noise. 3. The matcher. Bash comes off PostToolUse on all three manifests: ls, git status and grep were tripping a "you changed something, record it" nudge. hooks/hooks.json goes to Write|Edit and both Codex manifests to apply_patch|Edit|Write. PreToolUse keeps Bash, because a plan reminder before a shell command is a different and wanted behaviour. The standalone skill route already used Write|Edit, which is further evidence the wider matchers were drift rather than intent. Fixing this surfaced a fourth thing. active_plan_dir() in hooks/claude-hook.sh resolves through the shared resolver and then fell back to the legacy root task_plan.md: the #237 fallback removed from the script and Codex routes in v3.15.0 and missed on the plugin dispatcher. A rejected PLAN_ID or PWF_PLAN_ROOT now stops there too. Deliberately not in this change: FileChanged, which would catch a Bash command that rewrites a file, is a new event surface with its own behaviour and belongs in a release where it can be tested on its own. The standalone skill route still emits the sentence as plain stdout from a YAML frontmatter scalar with no throttle; it already carries the narrow matcher so the volume reported here never applied to it, and giving it the throttle means either putting cache-key logic inside a hook scalar or routing it through a new script context across eleven SKILL.md files. Tests: 10 in tests/test_post_tool_nudge.py, driving both routes as processes rather than asserting on source. One proves the two Codex scripts agree on the marker key by asserting the re-arm deletes the exact file the throttle wrote: they derive it independently and one resolves a PWF_PLAN_ROOT pin while the other does not, so a divergence would leave the nudge firing once per session with nothing in any log.
102 lines
2.2 KiB
JSON
102 lines
2.2 KiB
JSON
{
|
|
"description": "Planning with Files lifecycle integration for Claude Code",
|
|
"hooks": {
|
|
"SessionStart": [
|
|
{
|
|
"matcher": "startup|resume|clear|compact",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "sh",
|
|
"args": [
|
|
"${CLAUDE_PLUGIN_ROOT}/hooks/claude-hook.sh",
|
|
"session-start"
|
|
],
|
|
"timeout": 10,
|
|
"statusMessage": "Restoring planning context"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"UserPromptSubmit": [
|
|
{
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "sh",
|
|
"args": [
|
|
"${CLAUDE_PLUGIN_ROOT}/hooks/claude-hook.sh",
|
|
"user-prompt-submit"
|
|
],
|
|
"timeout": 10
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"PreToolUse": [
|
|
{
|
|
"matcher": "Write|Edit|Bash|Read|Glob|Grep",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "sh",
|
|
"args": [
|
|
"${CLAUDE_PLUGIN_ROOT}/hooks/claude-hook.sh",
|
|
"pre-tool-use"
|
|
],
|
|
"timeout": 10
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"PostToolUse": [
|
|
{
|
|
"matcher": "Write|Edit",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "sh",
|
|
"args": [
|
|
"${CLAUDE_PLUGIN_ROOT}/hooks/claude-hook.sh",
|
|
"post-tool-use"
|
|
],
|
|
"timeout": 10
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"PreCompact": [
|
|
{
|
|
"matcher": "*",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "sh",
|
|
"args": [
|
|
"${CLAUDE_PLUGIN_ROOT}/hooks/claude-hook.sh",
|
|
"pre-compact"
|
|
],
|
|
"timeout": 10
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"Stop": [
|
|
{
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "sh",
|
|
"args": [
|
|
"${CLAUDE_PLUGIN_ROOT}/hooks/claude-hook.sh",
|
|
"stop"
|
|
],
|
|
"timeout": 10,
|
|
"statusMessage": "Checking planning completion"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|