Skip to content

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

Description

@berggrenmartinj-bit

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions