Bug: Plan template hook fails on large HTML content

bug-plan-template-hook-large-content Todo

bug done

Bug: Plan template hook fails on large HTML content

Problem

The check-note-template.sh PreToolUse hook incorrectly reports missing sections when html_content is very long. A plan note containing all required sections (including "Depends On") was rejected claiming "Depends On" was missing. Trimming the content to a shorter version -- with an identical "Depends On" section -- passed.

Root Cause

The hook pipes content through echo "$DECODED_CONTENT" | grep (line 98). For very large strings (multi-KB HTML with 5+ phases and detailed tables), this likely hits shell argument limits or pipe buffering issues. The echo of a large shell variable through multiple sed transformations and grep calls may silently truncate content, causing sections near the end of the document to be missed.

Fix

Write content to a temp file instead of using shell variable echo:
File: ~/.claude/hooks/check-note-template.sh line 91-98

Impact

Low. Workaround: trim plan content on initial creation, then update with full detail after. But causes friction for detailed plans with many phases.

Acceptance Criteria

  • [ ] A plan note with 5+ phases and detailed tables passes the hook when all required sections are present
  • [ ] Hook still correctly rejects notes that genuinely miss required sections
  • ~/.claude/hooks/check-note-template.sh -- the hook file
  • template-plan -- the template it enforces