Skip to content

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

@Gerkinfeltser

Description

@Gerkinfeltser

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

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