Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

Bug Report: History capture hooks deleted but not migrated in v2.1.1

Open berggrenmartinj-bit opened this issue 10 months ago • 2 comments

Summary

The v2.1.1 release retired pai-history-system and claims that "Core installation now provides complete memory/history functionality out of the box." However, the history capture hooks were deleted from pai-history-system but never added to pai-core-install, leaving the MEMORY system without automatic event capture.

Version

  • PAI Version: v2.1.1
  • Affected commit: 45bb441 (2026-01-09)

Expected Behavior

According to the v2.1.1 changelog:

History System Retired

  • Removed standalone pai-history-system pack
  • History/context-tracking functionality is now part of pai-core-install as the MEMORY System
  • Core installation now provides complete memory/history functionality out of the box

Users installing pai-core-install should have working history capture without needing pai-history-system.

Actual Behavior

  1. The pai-core-install README still lists pai-history-system as an optional dependency (line 12-13):

    dependencies:
      - pai-hook-system (required)
      - pai-history-system (optional) - History capture for skill usage and learnings
    
  2. The pai-core-install README states "Hooks registered: 0" (line 224)

  3. The settings.json.template in pai-core-install references hooks that no longer exist:

    "command": "bun run $PAI_DIR/hooks/capture-all-events.ts --event-type SessionStart"
    "command": "bun run $PAI_DIR/hooks/capture-session-summary.ts"
    "command": "bun run $PAI_DIR/hooks/stop-hook.ts"
    "command": "bun run $PAI_DIR/hooks/subagent-stop-hook.ts"
    
  4. These hooks were deleted in commit 45bb441:

    Packs/pai-history-system/src/capture-all-events.ts      | 130 ------
    Packs/pai-history-system/src/capture-session-summary.ts | 159 --------
    Packs/pai-history-system/src/stop-hook.ts               | 190 ---------
    Packs/pai-history-system/src/subagent-stop-hook.ts      | 233 -----------
    
  5. No corresponding files were added to pai-core-install or pai-hook-system

Impact

  • Users following the documentation will have a non-functional MEMORY system
  • The settings.json.template will reference non-existent hooks, causing errors
  • The MEMORY directories exist but never get populated with data

Suggested Fix

Either:

Option A: Add hooks to pai-core-install

  1. Move the 4 deleted hooks to Packs/pai-core-install/src/hooks/
  2. Move lib/metadata-extraction.ts to Packs/pai-core-install/src/hooks/lib/
  3. Update INSTALL.md to copy hooks during installation
  4. Update paths from history/ to MEMORY/ in the hooks

Option B: Add hooks to pai-hook-system

  1. Move the 4 deleted hooks to Packs/pai-hook-system/src/
  2. Move lib/metadata-extraction.ts to Packs/pai-hook-system/src/lib/
  3. The settings.json.template in pai-core-install already expects them in $PAI_DIR/hooks/

Files That Need the Hooks

The hooks can be recovered from git history:

git show 45bb441^:Packs/pai-history-system/src/capture-all-events.ts
git show 45bb441^:Packs/pai-history-system/src/capture-session-summary.ts
git show 45bb441^:Packs/pai-history-system/src/stop-hook.ts
git show 45bb441^:Packs/pai-history-system/src/subagent-stop-hook.ts

The metadata-extraction.ts library still exists in pai-observability-server:

Packs/pai-observability-server/src/hooks/lib/metadata-extraction.ts

Additional Notes

  • The hooks need path updates: history/ → MEMORY/ to match the v2.1.1 structure
  • The default PAI_DIR should be ~/.claude not ~/.config/pai to match Claude Code's default

Workaround

Users can manually recover the hooks from git history and install them:

cd ~/PAI
git show 45bb441^:Packs/pai-history-system/src/capture-all-events.ts > ~/.claude/hooks/capture-all-events.ts
# ... etc, then update paths from 'history' to 'MEMORY'

Found while installing PAI v2.1.1 on a fresh system.

berggrenmartinj-bit avatar Jan 10 '26 23:01 berggrenmartinj-bit

Fix Available in PR #411

I've submitted a PR that restores all 4 deleted memory hooks:

  • capture-all-events.ts
  • capture-session-summary.ts
  • stop-hook.ts
  • subagent-stop-hook.ts

The hooks were recovered from git history (commit 45bb441^) and updated for the MEMORY/ structure.

PR: https://github.com/danielmiessler/Personal_AI_Infrastructure/pull/411

Testing: Verified working locally with 59 events captured and 4 sessions summarized.

Would appreciate review when you have a chance. This should restore full memory capture functionality.

cc @danielmiessler

eccentricnode avatar Jan 16 '26 00:01 eccentricnode

Thanks for the detailed report! History hooks were replaced by the new MEMORY and LEARNING systems in v3.0 (now released). Session capture works differently in the new architecture. Please upgrade to v3.0.

kaimagnus avatar Feb 15 '26 17:02 kaimagnus