Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

v5.0.0: ISASync / CheckpointPerISC / ToolFailureTracker hooks ship but aren't registered in settings.json

Open wojteksbt opened this issue 7 months ago • 2 comments

Summary

Three hook files ship with v5.0.0 but are not registered in settings.json, so they never fire:

Hook Trigger (per file header) Doctrine role
hooks/ISASync.hook.ts PostToolUse (Write/Edit on ISA.md) Syncs ISA frontmatter phase → MEMORY/STATE/work.json and the kitty tab
hooks/CheckpointPerISC.hook.ts PostToolUse (Write/Edit on ISA.md) Auto-commits checkpoint repos on every [ ]→[x] ISC transition
hooks/ToolFailureTracker.hook.ts PostToolUseFailure Appends structured failure events to MEMORY/OBSERVABILITY/tool-failures.jsonl

All three are referenced as live subsystems in:

  • Algorithm doctrine Releases/v5.0.0/.claude/PAI/ALGORITHM/v6.3.0.md (phase tracking, checkpoints)
  • Releases/v5.0.0/.claude/PAI/DOCUMENTATION/ARCHITECTURE_SUMMARY.md Pipeline Topology table (Algorithm + Observability rows)

But they are silent — phase changes don't reach work.json, no per-ISC checkpoint commits, no tool-failure observability.

Reproduce

git clone https://github.com/danielmiessler/Personal_AI_Infrastructure
cd Personal_AI_Infrastructure/Releases/v5.0.0/.claude

ls hooks/{ISASync,CheckpointPerISC,ToolFailureTracker}.hook.ts
# → all three present

grep -cE "ISASync|CheckpointPerISC|ToolFailureTracker" settings.json
# → 0

Suggested fix

Add registrations to settings.json. Minimal version:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          { "type": "command", "command": "$HOME/.claude/hooks/ISASync.hook.ts" },
          { "type": "command", "command": "$HOME/.claude/hooks/CheckpointPerISC.hook.ts" }
        ]
      }
    ],
    "PostToolUseFailure": [
      {
        "hooks": [
          { "type": "command", "command": "$HOME/.claude/hooks/ToolFailureTracker.hook.ts" }
        ]
      }
    ]
  }
}

(Merge alongside existing entries — the file already has a PostToolUse array.)

Environment

PAI v5.0.0, main branch.

wojteksbt avatar May 02 '26 13:05 wojteksbt

Second-user confirmation on Linux. All three hooks still ship unregistered in v5.0.0, and tool-failures.jsonl has never been written on this install.

Evidence

$ ls ~/.claude/PAI/MEMORY/OBSERVABILITY/
prompt-processing.jsonl
tool-activity.jsonl
# no tool-failures.jsonl ever created

$ grep -cE "ISASync|CheckpointPerISC|ToolFailureTracker|PostToolUseFailure" ~/.claude/settings.json
0

$ ls ~/.claude/hooks/{ISASync,CheckpointPerISC,ToolFailureTracker}.hook.ts
~/.claude/hooks/CheckpointPerISC.hook.ts
~/.claude/hooks/ISASync.hook.ts
~/.claude/hooks/ToolFailureTracker.hook.ts
# all three present in code, none registered

$ bun --eval 'const s = require("/home/USER/.claude/settings.json"); console.log(Object.keys(s.hooks).join("\n"))'
PreToolUse
PostToolUse
PreCompact
SessionEnd
UserPromptSubmit
SubagentStop
SessionStart
Stop
# no PostToolUseFailure section

Today's wrinkle — recursive observability gap

I was triaging a wave of classifier failures and Skill/Agent hook errors today and couldn't reach tool-failures.jsonl at all — PAI has zero observability for the very errors it's supposed to log. Confirms the priority: ToolFailureTracker is the most user-visible of the three unregistered hooks.

PostToolUseFailure is a valid Claude Code hook event (verified against the current Claude Code docs), so the fix in the issue body lands cleanly.

Environment

  • PAI: v4.0.3 (settings.json sourced from v5.0.0 template)
  • Platform: Linux (Arch)
  • Claude Code: 2.x

eccentricnode avatar May 12 '26 08:05 eccentricnode

Verified — fixed in upcoming 5.1.0. All three hooks are registered in settings.json:

  • ISASync.hook.ts — 5 matchers (PostToolUse on Edit/Write, etc.)
  • CheckpointPerISC.hook.ts — 4 references
  • ToolFailureTracker.hook.ts — 1 reference

Each fires on the events its doctrine specifies.

Closing as fixed in next release. Thanks for the catch — the dormant-hooks problem was the kind of thing that's easy to miss without a deliberate registration audit.

danielmiessler avatar May 20 '26 21:05 danielmiessler