Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

Issue: pai-hook-system pack - missing observability.ts + outdated history/MEMORY references

Open Gerkinfeltser opened this issue 10 months ago • 2 comments

The Problem

The pai-hook-system pack is missing src/lib/observability.ts that its own README, INSTALL.md, and VERIFY.md all reference. The install wizard expects this file in src/lib/ but it's not there.

Additionally, the README references the retired pai-history-system instead of the new MEMORY system in pai-core-install, and one hook (initialize-session.ts) still creates old-style history/ directories.

What's Missing

File Expected Location Status Used By
observability.ts src/lib/ ❌ MISSING initialize-session.ts, security-validator.ts

Design note: This is a shared library for sending events to observability dashboard. Hooks use it to optionally send data to PAI_OBSERVABILITY_URL. It's designed for graceful degradation - fails silently if dashboard isn't running. With pai-hook-system at install order #1 and pai-observability-server at #9, this library allows hooks to integrate with dashboard without hard dependency.

Evidence

From README.md:

  • Line 34: "Observability lib | src/lib/observability.ts | Event logging and dashboard integration"
  • Line 79: Architecture shows lib/observability.ts in the tree
  • Line 271: Changelog states "One lib file: observability"

From INSTALL.md line 250:

cp "$PACK_DIR/src/lib/observability.ts" "$PAI_DIR/hooks/lib/"

From VERIFY.md:

  • Line 15: Says ls should show "observability.ts"
  • Line 76: Checks $PAI_DIR/hooks/lib/observability.ts exists
  • Line 105: Expects ~1500 bytes for that file

From src/initialize-session.ts line 8:

import { sendEventToObservability, getCurrentTimestamp, getSourceApp } from './lib/observability';

This import will fail because the file doesn't exist.

Actual src/ Contents

src/
├── initialize-session.ts     ✓
├── load-core-context.ts      ✓
├── security-validator.ts      ✓
├── update-tab-titles.ts      ✓
└── lib/                    (directory doesn't exist)

Where It Went

File existed in Packs/kai-hook-system/src/lib/observability.ts before reorganization, got deleted during migration to v2.0.

Recovered from Git History

The file was found in git history at commit 1c34d06 (v2.0 migration, before kai→pai rebrand).

src/lib/observability.ts

View at commit: https://github.com/danielmiessler/Personal_AI_Infrastructure/blob/1c34d06/Packs/kai-hook-system/src/lib/observability.ts

Content summary: 63 lines, provides sendEventToObservability(), getCurrentTimestamp(), and getSourceApp() functions.

Additional Issues

1. Outdated Dependency Reference

README.md line 262:

- **pai-history-system** - Uses hooks for capturing session work and learnings

pai-history-system was retired in v2.1.1 (#372). MEMORY system now lives in pai-core-install. Should update to reference the new system.

2. Old history/ Directory Structure

src/initialize-session.ts lines 99-104:

const requiredDirs = [
  join(paiDir, 'hooks', 'lib'),
  join(paiDir, 'history', 'sessions'),      // old structure
  join(paiDir, 'history', 'learnings'),     // old structure
  join(paiDir, 'history', 'research'),      // old structure
];

Creates old-style history/ directories. With v2.1.1, MEMORY uses different structure in skills/CORE/USER/MEMORY.md and skills/CORE/SYSTEM/MEMORYSYSTEM.md. Need to verify if these directories are still needed.

Impact

Installation fails:

  • Step 4.3 in INSTALL.md can't copy src/lib/observability.ts
  • Hook initialize-session.ts will crash on import at runtime
  • Any hook using observability functions won't work

Outdated docs:

  • Users might try to install retired pai-history-system
  • Old directory structure may conflict with new MEMORY system

Suggested Fix

  1. Add src/lib/observability.ts back to the pack (copy from commit 1c34d06)
  2. Update README.md line 262 to reference MEMORY in pai-core-install instead of pai-history-system
  3. Verify history/ directories - remove or update if not compatible with PAI 2.1.1 MEMORY system

Version

  • Pack: pai-hook-system
  • Version: 1.0.0
  • Pack ID: danielmiessler-pai-hook-system-core-v1.0.0

Gerkinfeltser avatar Jan 11 '26 15:01 Gerkinfeltser

Fix Available in PR #411

I've restored the missing lib/observability.ts as part of a larger fix for the memory system.

The file was recovered from git history and includes all required functions:

  • sendEventToObservability()
  • getCurrentTimestamp()
  • getSourceApp()

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

Also restores the 4 deleted memory hooks and implements the complete three-tier MEMORY architecture.

Testing: All hooks now load without module resolution errors.

cc @danielmiessler

eccentricnode avatar Jan 16 '26 00:01 eccentricnode

Thanks for reporting! The pack system (pai-hook-system) was replaced by the integrated hook architecture in v3.0 (now released). observability.ts and the old HISTORY references are no longer part of the system. Please upgrade to v3.0.

kaimagnus avatar Feb 15 '26 17:02 kaimagnus