PAI 3.0 15-Feb Full Prompt LifeCycle Documentation #673
Closed
vpzed
started this conversation in
Show and tell
Replies: 2 comments
-
|
Wow. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Closing — this v3.0 lifecycle documentation is outdated. PAI v4.0 fundamentally changed the architecture:
The v3.0 prompt lifecycle documented here no longer reflects how PAI works. Current release: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
PAI 3.0 Complete Prompt Lifecycle Documentation (COMPREHENSIVE VERIFIED)
Document Version: 2.0 (COMPREHENSIVE VERIFICATION PASS)
PAI Version: 3.0
Algorithm Version: v1.5.0 (verified from Components/Algorithm/LATEST)
Generated: 2026-02-15
Verification Status: All paths checked, missing files documented with 🚫
VERIFICATION METHODOLOGY
This documentation was created with:
Table of Contents
File Inventory
Hook Files (20 total - all verified)
Library Files (11 total - all verified)
Library Files Detailed Reference
1. algorithm-state.ts - Single source of truth for algorithm state management
Key Exports:
readState(sessionId)- Read algorithm state from MEMORY/STATE/algorithms/{sessionId}.jsonwriteState(state)- Write algorithm state with effortLevel syncphaseTransition(sessionId, phase)- Phase transitions with rework detectioncriteriaAdd(sessionId, criterion)- Add ISC criterion, handles session reactivationcriteriaUpdate(sessionId, taskId, status)- Update criterion statuseffortLevelUpdate(sessionId, level)- Update effort levelagentAdd(sessionId, agent)- Track spawned agentsalgorithmEnd(sessionId, enrichment)- Mark algorithm complete with extracted datasweepStaleActive(currentSessionId)- Phase-aware stale session cleanup (15-60min thresholds)algorithmAbandon(sessionId)- Manual abandonment via APIWriters: AlgorithmTracker (PostToolUse), AlgorithmEnrichment (Stop handler)
State Location:
MEMORY/STATE/algorithms/{sessionId}.jsonPhase-Aware Staleness Thresholds:
2. change-detection.ts - Utilities for detecting PAI system changes
Key Exports:
parseToolUseBlocks(transcriptPath)- Extract Write/Edit/MultiEdit from transcriptcategorizeChange(path)- Categorize by: skill, hook, workflow, config, core-system, memory-system, documentationisSignificantChange(changes)- Check if philosophical/structural changes warrant integrity checkshouldDocumentChanges(changes)- Lowered threshold (2+ files) for frequent documentationisInCooldown()- Check 2-minute cooldown periodisDuplicateRun(changes)- Deduplication via change hashingdetermineSignificance(changes)- Label: trivial, minor, moderate, major, criticalinferChangeType(changes)- Type: skill_update, hook_update, structure_change, doc_update, multi_areagenerateDescriptiveTitle(changes)- 4-8 word title from changesExcluded Paths: MEMORY/WORK/, MEMORY/LEARNING/, MEMORY/STATE/, scratch/, Plans/, projects/
High-Priority Paths: skills/PAI/, PAISYSTEMARCHITECTURE.md, SKILLSYSTEM.md, settings.json
3. identity.ts - Central identity loader for DA and Principal
Key Exports:
getIdentity()- DA identity from settings.json (name, displayName, color, voiceId, voice prosody, personality)getPrincipal()- Principal identity (name, pronunciation, timezone)getDAName()- Just DA namegetPrincipalName()- Just Principal namegetVoiceId()- Just voice IDgetVoiceProsody()- Legacy ElevenLabs voice settingsgetVoicePersonality()- Qwen3-TTS voice settingsgetSettings()- Full settings objectclearCache()- Clear cached settingsReads:
/home/paiuser/.claude/settings.jsonDefaults: DA name="PAI", Principal name="User", timezone="UTC"
4. learning-utils.ts - Shared learning categorization logic
Key Exports:
getLearningCategory(content, comment)- Categorize as SYSTEM (tooling/infrastructure) or ALGORITHM (task execution)isLearningCapture(text, summary, analysis)- Detect learning moments (2+ learning indicators)Algorithm Indicators: over-engineer, wrong approach, should have asked, didn't follow, missed the point, too complex
System Indicators: hook, crash, broken, tool, config, deploy, path, import, module, TypeScript, npm, bun
Default: ALGORITHM (user feedback about task quality is most valuable)
5. metadata-extraction.ts - Agent instance ID extraction for UOCS enhancement
Key Exports:
extractAgentInstanceId(toolInput, description)- Extract agent-type-N from descriptions or promptsenrichEventWithAgentMetadata(event, toolInput, description)- Add agent metadata to eventsisAgentSpawningCall(toolName, toolInput)- Check if Task tool spawns agentExtraction Patterns:
[agent-type-N]in description[AGENT_INSTANCE: agent-type-N]in prompt[PARENT_SESSION: uuid]in prompt[PARENT_TASK: task_id]in promptsubagent_type6. notifications.ts - ntfy push + voice notification service
Key Exports:
getNotificationConfig()- Load from settings.json with env var expansionrecordSessionStart()- Record session start timegetSessionDurationMinutes()- Calculate session durationisLongRunningTask()- Check if > threshold (default 5 min)sendPush(message, options)- Send ntfy push notificationnotify(event, message, options)- Smart router by event typenotifyTaskComplete(message, options)- Task completion notificationnotifyBackgroundAgent(agentType, message, options)- Agent completion notificationnotifyError(message, options)- Error notificationEvent Types: taskComplete, longTask, backgroundAgent, error, security
Config: settings.json notifications section (ntfy server, topic, routing, thresholds)
7. output-validators.ts - Voice and tab title validation
Key Exports:
isValidVoiceCompletion(text)- Check voice line validity (>=10 chars, no garbage, no conversational filler)isValidWorkingTitle(text)- Working-phase title: MUST start with gerund (-ing)isValidCompletionTitle(text)- Completion-phase title: must NOT start with gerundisValidQuestionTitle(text)- Question-phase title: noun phrase, no period, 1-4 words, max 30 charsgerundToPastTense(gerund)- Convert "Fixing" → "Fixed", "Building" → "Built"Garbage Patterns: appreciate, thank, welcome, helping you, reaching out, happy to, let me know
Incomplete Endings: the, a, an, to, for, with, of, in, on, at, by, and, or, but
Tab Title State Machine: Working (⚙️ gerund) → Completion (✓ past tense) → Question (❓ noun phrase)
8. paths.ts - Centralized path resolution with env var expansion
Key Exports:
expandPath(path)- ExpandgetPaiDir()- Get PAI directory (expanded PAI_DIR env or ~/.claude)getSettingsPath()- Get settings.json pathpaiPath(...segments)- Get path relative to PAI_DIRgetHooksDir()- Get hooks directorygetSkillsDir()- Get skills directorygetMemoryDir()- Get MEMORY directoryPurpose: Claude Code doesn't expand $HOME in settings.json env values, so this library handles it
9. tab-constants.ts - Single source of truth for tab title colors and states
Key Exports:
TAB_COLORS- Color definitions for: thinking, working, question, completed, error, idleACTIVE_TAB_BG,ACTIVE_TAB_FG,INACTIVE_TAB_FG- Universal color constantsPHASE_TAB_CONFIG- Phase-specific symbols and colors:Design: Each Algorithm phase gets distinct background color + symbol for at-a-glance multi-tab status
10. tab-setter.ts - Unified tab state setter for Kitty terminal
Key Exports:
setTabState(opts)- Set Kitty tab title and color, persist statepersistKittySession(sessionId, listenOn, windowId)- Save Kitty env to session filecleanupKittySession(sessionId)- Remove session file on session endreadTabState(sessionId)- Read per-window state filestripPrefix(title)- Remove emoji prefix from tab titlegetSessionOneWord(sessionId)- Extract two representative words from session namesetPhaseTab(phase, sessionId, summary)- Set tab for Algorithm phase with format:{SYMBOL} {ONE_WORD} | {PHASE}State Files:
MEMORY/STATE/kitty-sessions/{sessionId}.jsonMEMORY/STATE/tab-titles/{windowId}.jsonResolution Order: Process env vars → Per-session file
Features: Opportunistic cleanup of stale state files for dead Kitty windows
11. time.ts - Shared time utilities with timezone awareness
Key Exports:
getPSTTimestamp()- Full timestamp: "YYYY-MM-DD HH:MM:SS TZ"getPSTDate()- Date only: "YYYY-MM-DD"getYearMonth()- Year-month: "YYYY-MM"getISOTimestamp()- ISO8601 with timezone offsetgetFilenameTimestamp()- Filename-safe: "YYYY-MM-DD-HHMMSS"getPSTComponents()- Timestamp components for custom formattinggetTimezoneDisplay()- Timezone string for displayTimezone Source:
settings.json→principal.timezone(defaults to UTC)Note: "PST" in function names is legacy - actually uses configured timezone, not hardcoded PST
SKILL.md Component Files (verified)
Main Components (6 files):
Algorithm Component:
ContextFiles (from settings.json - all verified)
Tools (verified)
Configuration Files
settings.json
Location:
/home/paiuser/.claude/settings.json✓ existsCritical for: Everything. Read by:
hooks/lib/identity.tsandhooks/lib/paths.tsKey sections affecting lifecycle:
{ "env": { "PAI_DIR": "/home/paiuser/.claude", "PROJECTS_DIR": "/home/paiuser/projects", // ...other environment variables }, "hooks": { "SessionStart": [ /* 3 hooks */ ], "UserPromptSubmit": [ /* 4 hooks */ ], "PreToolUse": [ /* 8 hook matchers */ ], "PostToolUse": [ /* 4 hook matchers */ ], "Stop": [ /* 1 hook */ ], "SessionEnd": [ /* 5 hooks */ ] }, "contextFiles": [ "skills/PAI/SKILL.md", "skills/PAI/AISTEERINGRULES.md", "skills/PAI/USER/AISTEERINGRULES.md", "skills/PAI/USER/DAIDENTITY.md", "skills/PAI/USER/ABOUTME.md" // Customization from default to always inject human context ], "daidentity": { "name": "PAI", "voices": { /* voice configuration */ } }, "principal": { "name": "PAI_Human", "timezone": "America/Los_Angeles" } }CLAUDE.md
Location:
/home/paiuser/.claude/CLAUDE.md✓ existsContent (complete file):
Role: Vestigial. Claude Code reads this after hooks complete, but actual context loading happens via
LoadContext.hook.tswhich injects SKILL.md (and other files) via<system-reminder>before CLAUDE.md is processed. The comment suggesting to read SKILL.md is redundant.Hook System Complete Reference
Hook Execution Flow by Event
Hook File Reading Guide
Format for each hook:
SessionStart Lifecycle
Overview
Three hooks execute in parallel when session starts:
Hook 1: StartupGreeting.hook.ts
File:
/home/paiuser/.claude/hooks/StartupGreeting.hook.ts✓ existsPurpose: Display PAI neofetch-style banner with system stats
Files Read:
/home/paiuser/.claude/settings.json✓ exists (for identity configuration)Files Written:
/home/paiuser/.claude/MEMORY/STATE/kitty-sessions/{session_id}.json(Kitty terminal state persistence)/home/paiuser/.claude/MEMORY/STATE/kitty-sessions/✓ existsCommands Executed:
bun run /home/paiuser/.claude/skills/PAI/Tools/Banner.tsspawnSyncSubagent Behavior:
CLAUDE_PROJECT_DIRcontains/.claude/Agents/CLAUDE_AGENT_TYPEis definedOutput: Banner to stdout (captured by Claude Code)
Hook 2: LoadContext.hook.ts (CRITICAL)
File:
/home/paiuser/.claude/hooks/LoadContext.hook.ts✓ existsPurpose: THE PRIMARY CONTEXT INJECTION MECHANISM. Loads and concatenates all PAI context files into a single
<system-reminder>message.Execution Flow:
Files Read (in order):
Component Freshness Check:
/home/paiuser/.claude/skills/PAI/Components/(recursive)/home/paiuser/.claude/skills/PAI/SKILL.md(for timestamp comparison)Rebuild SKILL.md (if needed):
bun /home/paiuser/.claude/skills/PAI/Tools/RebuildPAI.ts/home/paiuser/.claude/skills/PAI/Components/00-frontmatter.md✓ exists/home/paiuser/.claude/skills/PAI/Components/10-pai-intro.md✓ exists/home/paiuser/.claude/skills/PAI/Components/15-format-mode-selection.md✓ exists/home/paiuser/.claude/skills/PAI/Components/20-the-algorithm.md✓ exists/home/paiuser/.claude/skills/PAI/Components/30-workflow-routing.md✓ exists/home/paiuser/.claude/skills/PAI/Components/40-documentation-routing.md✓ exists/home/paiuser/.claude/skills/PAI/Components/Algorithm/LATEST✓ exists (contains "v1.5.0")/home/paiuser/.claude/skills/PAI/Components/Algorithm/v1.5.0.md✓ exists{{ALGORITHM_VERSION}}placeholder appears{DAIDENTITY.NAME}→ "PAI")/home/paiuser/.claude/skills/PAI/SKILL.mdSettings:
/home/paiuser/.claude/settings.json✓ existsContext Files (from settings.contextFiles array):
/home/paiuser/.claude/skills/PAI/SKILL.md✓ exists/home/paiuser/.claude/skills/PAI/AISTEERINGRULES.md✓ exists/home/paiuser/.claude/skills/PAI/USER/AISTEERINGRULES.md✓ exists/home/paiuser/.claude/skills/PAI/USER/DAIDENTITY.md✓ exists/home/paiuser/.claude/skills/PAI/USER/ABOUTME.md✓ existsRelationship Context (conditional - high-confidence opinions):
/home/paiuser/.claude/skills/PAI/USER/OPINIONS.md✓ existsRelationship Context (conditional - recent notes):
/home/paiuser/.claude/MEMORY/RELATIONSHIP/{YYYY-MM}/{YYYY-MM-DD}.md/home/paiuser/.claude/MEMORY/RELATIONSHIP/✓ existsActive Work Summary (conditional):
/home/paiuser/.claude/MEMORY/STATE/session-names.json✓ exists/home/paiuser/.claude/MEMORY/WORK/✓ exists (directory)META.yaml✓ format exists in active sessionsPRD-{YYYYMMDD}-{slug}.md(format verified from docs)/home/paiuser/.claude/MEMORY/STATE/progress/✓ exists (directory)*-progress.jsonfiles for persistent project trackingFiles Written:
Commands Executed:
bun /home/paiuser/.claude/skills/PAI/Tools/RebuildPAI.ts(conditional, if components changed)date '+%Y-%m-%d %H:%M:%S %Z'(via Bun.spawn for current date/time)Output Format:
Critical Effect: This single hook injects ALL primary PAI context into Claude's system prompt. Without this hook, Claude would have no Algorithm format, no ISC system, no AI Steering Rules, no user context.
Hook 3: CheckVersion.hook.ts
File:
/home/paiuser/.claude/hooks/CheckVersion.hook.ts✓ existsPurpose: Check npm registry for Claude Code updates
Files Read:
Files Written:
Network Calls:
claude-codepackage version checkOutput: Optional update notification to stdout if newer version available
Error Handling: Non-blocking - errors logged to stderr, session continues
UserPromptSubmit Lifecycle
Overview
Four hooks execute sequentially when user submits a prompt. Their outputs are captured and injected into Claude's context before Claude processes the user's message.
Hook 1: RatingCapture.hook.ts (CRITICAL)
File:
/home/paiuser/.claude/hooks/RatingCapture.hook.ts✓ existsPurpose:
Files Read:
Files Written:
/home/paiuser/.claude/MEMORY/LEARNING/ratings.jsonl✓ existsCommands Executed:
bun /home/paiuser/.claude/skills/PAI/Tools/Inference.ts fastOutput to stdout:
Critical Effect: This message is injected into every prompt Claude receives. The Algorithm format is not optional - it's enforced per-prompt via this hook.
Hook 2: AutoWorkCreation.hook.ts
File:
/home/paiuser/.claude/hooks/AutoWorkCreation.hook.ts✓ existsPurpose: Create or update work session directory for tracking
Files Read:
/home/paiuser/.claude/MEMORY/STATE/current-work.json✓ existsFiles Written:
/home/paiuser/.claude/MEMORY/WORK/{timestamp}_{slug}/(directory created)YYYYMMDD-HHMMSS_slug/home/paiuser/.claude/MEMORY/WORK/{timestamp}_{slug}/META.yaml/home/paiuser/.claude/MEMORY/STATE/current-work.json(updated)Commands Executed:
Output: None to stdout (silent operation)
Hook 3: UpdateTabTitle.hook.ts
File:
/home/paiuser/.claude/hooks/UpdateTabTitle.hook.ts✓ existsPurpose:
Files Read:
/home/paiuser/.claude/settings.json✓ exists (for voice configuration)/home/paiuser/.claude/MEMORY/STATE/kitty-sessions/{session_id}.json(for Kitty env vars)Files Written:
/home/paiuser/.claude/MEMORY/STATE/tab-state/{session_id}.jsonCommands Executed:
bun /home/paiuser/.claude/skills/PAI/Tools/Inference.ts(infer task from prompt)Network Calls:
POST http://localhost:8888/notify{"message": "Working on: {task}", "voice_id": "...", "stability": ..., "similarity_boost": ...}Output: None to stdout (side effects: tab title change + voice notification)
Hook 4: SessionAutoName.hook.ts
File:
/home/paiuser/.claude/hooks/SessionAutoName.hook.ts✓ existsPurpose: Generate clean English name for session (first prompt only)
Files Read:
/home/paiuser/.claude/MEMORY/STATE/session-names.json✓ existsFiles Written:
/home/paiuser/.claude/MEMORY/STATE/session-names.json(updated with new session name)Commands Executed:
bun /home/paiuser/.claude/skills/PAI/Tools/Inference.ts smart(session name generation)Logic:
Output: None to stdout
Tool Execution Hooks
PreToolUse Hooks (Guards)
Execute before a tool runs. Can block, allow, or ask for confirmation.
VoiceGate.hook.ts (Bash commands)
File:
/home/paiuser/.claude/hooks/VoiceGate.hook.ts✓ existsPurpose: Block voice notification curls from subagents
Matcher:
PreToolUse: BashDecision Logic:
Files Read:
/home/paiuser/.claude/MEMORY/STATE/kitty-sessions/{session_id}.json(existence check only)Why This Exists: Subagents inherit full PAI context (including Algorithm format with voice curl requirements). Without this gate, spawning 8 agents would trigger 8 simultaneous voice notifications.
Output: JSON decision to stdout
SecurityValidator.hook.ts (Bash/Edit/Write/Read)
File:
/home/paiuser/.claude/hooks/SecurityValidator.hook.ts✓ existsPurpose: Validate file paths and bash commands against security patterns
Matcher:
PreToolUse: Bash,PreToolUse: Edit,PreToolUse: Write,PreToolUse: ReadCascading Pattern Lookup (tries in order):
User patterns:
/home/paiuser/.claude/skills/PAI/USER/PAISECURITYSYSTEM/patterns.yamlSystem patterns:
/home/paiuser/.claude/skills/PAI/PAISECURITYSYSTEM/patterns.example.yamlValidates:
Files Written:
/home/paiuser/.claude/MEMORY/SECURITY/{YYYY}/{MM}/security-{summary}-{timestamp}.jsonlOutput: JSON decision to stdout (
{continue: true},{decision: "ask", "message": "..."}, or{decision: "block", "reason": "..."})AgentExecutionGuard.hook.ts (Task tool)
File:
/home/paiuser/.claude/hooks/AgentExecutionGuard.hook.ts✓ existsPurpose: Warn about foreground agent execution (should use run_in_background: true)
Matcher:
PreToolUse: TaskFiles Read: NONE (stdin JSON parsing only)
Decision Logic: Passes if ANY of these conditions are true:
run_in_background: true['Explore']['haiku']Exception Patterns:
Output: JSON decision (allow or warn)
SkillGuard.hook.ts (Skill tool)
File:
/home/paiuser/.claude/hooks/SkillGuard.hook.ts✓ existsPurpose: Block false-positive skill invocations (keybindings-help position bias bug)
Matcher:
PreToolUse: SkillValidates: Skill name against BLOCKED_SKILLS array
Files Read: NONE (pure string matching, no I/O)
Decision Logic:
Output: JSON decision (block or allow)
SetQuestionTab.hook.ts (AskUserQuestion tool)
File:
/home/paiuser/.claude/hooks/SetQuestionTab.hook.ts✓ existsPurpose: Change tab color to teal when asking questions
Matcher:
PreToolUse: AskUserQuestionFiles Written:
Effect: Visual indicator in Kitty terminal
Output: None to stdout (side effect only)
PostToolUse Hooks (Tracking)
Execute after a tool completes. Used for state tracking and feedback.
AlgorithmTracker.hook.ts (Multiple tools)
File:
/home/paiuser/.claude/hooks/AlgorithmTracker.hook.ts✓ existsPurpose: Consolidated tracker for phases, criteria, and agents
Matchers:
PostToolUse: Bash→ Phase detection from voice curlsPostToolUse: TaskCreate→ Criteria creation trackingPostToolUse: TaskUpdate→ Criteria status updatesPostToolUse: Task→ Agent spawn trackingPhase Detection (from Bash tool):
Files Read:
/home/paiuser/.claude/MEMORY/STATE/algorithm-state/{session_id}.json✓ format existsFiles Written:
/home/paiuser/.claude/MEMORY/STATE/algorithm-state/{session_id}.json(updated state)/home/paiuser/.claude/MEMORY/STATE/tab-state/{session_id}.json(phase-specific tab title)State Tracked:
Critical Effect: This hook powers the real-time dashboard. All algorithm progress tracking flows through here.
Output: None to stdout (writes stderr status messages)
QuestionAnswered.hook.ts (AskUserQuestion tool)
File:
/home/paiuser/.claude/hooks/QuestionAnswered.hook.ts✓ existsPurpose: Reset tab color after question answered
Matcher:
PostToolUse: AskUserQuestionEffect: Tab returns from teal to phase-specific color
Output: None to stdout
Stop and SessionEnd
Stop Hook
Trigger: Claude completes response (streaming finishes)
StopOrchestrator.hook.ts
File:
/home/paiuser/.claude/hooks/StopOrchestrator.hook.ts✓ existsPurpose: Post-response actions:
Files Read:
/home/paiuser/.claude/settings.json✓ exists (voice config)/home/paiuser/.claude/skills/PAI/Components/(timestamp check for rebuild)Files Written:
/home/paiuser/.claude/MEMORY/STATE/tab-state/{session_id}.json(reset to idle)/home/paiuser/.claude/skills/PAI/SKILL.md(if rebuild triggered)Commands Executed:
POST http://localhost:8888/notify(voice: "Task complete")bun /home/paiuser/.claude/skills/PAI/Tools/RebuildPAI.ts(if components changed)Output: None to stdout
SessionEnd Hooks
Trigger: Session terminates (user closes terminal, exits Claude Code)
Five hooks execute sequentially:
WorkCompletionLearning.hook.ts
File:
/home/paiuser/.claude/hooks/WorkCompletionLearning.hook.ts✓ existsPurpose: Extract insights from session
Files Read:
/home/paiuser/.claude/MEMORY/STATE/algorithm-state/{session_id}.jsonFiles Written:
/home/paiuser/.claude/MEMORY/LEARNING/REFLECTIONS/algorithm-reflections.jsonl✓ existsSessionSummary.hook.ts
File:
/home/paiuser/.claude/hooks/SessionSummary.hook.ts✓ existsPurpose: Mark work complete and clear session state
Files Read:
/home/paiuser/.claude/MEMORY/STATE/current-work.json/home/paiuser/.claude/MEMORY/WORK/{dir}/META.yamlFiles Written:
status: "ACTIVE"→status: "COMPLETED", addscompleted_attimestampFiles Deleted:
current-work.json(clears active work pointer)kitty-sessions/{session_id}.json(cleanup Kitty env state)Key Operations:
RelationshipMemory.hook.ts
File:
/home/paiuser/.claude/hooks/RelationshipMemory.hook.ts✓ existsPurpose: Extract relationship notes from session transcripts
Files Read:
Files Written:
/home/paiuser/.claude/MEMORY/RELATIONSHIP/{YYYY-MM}/{YYYY-MM-DD}.mdNote Types:
Analysis Patterns:
UpdateCounts.hook.ts
File:
/home/paiuser/.claude/hooks/UpdateCounts.hook.ts✓ existsPurpose: Update settings.json counts at session end
Implementation: Delegates to handler
handleUpdateCounts()Files Written:
/home/paiuser/.claude/settings.json(counts section: skills, workflows, hooks, files, sessions, etc.)IntegrityCheck.hook.ts
File:
/home/paiuser/.claude/hooks/IntegrityCheck.hook.ts✓ existsPurpose: Detect PAI system file changes and doc drift
Implementation: Delegates to two handlers:
handleSystemIntegrity(parsed, hookInput)- System file integrity checkshandleDocCrossRefIntegrity(parsed, hookInput)- Documentation cross-reference validationUses:
parseTranscript(hookInput.transcript_path)to analyze session changesOutput: Warnings to stderr if drift detected
Complete File Read Sequence
SessionStart → Ready
Result: Claude has full PAI context loaded
UserPrompt → Response
SessionEnd
Missing Files and Gaps
Verified Missing
🚫 Skill Index File:
/home/paiuser/.claude/skills/skill-index.json- confirmed DOES NOT EXIST (checked in prior documentation)Impact: No centralized skill registry. Skill discovery happens via directory scanning.
NOTE: I think I remember reading in an Issues reply that this is by design now. I believe Claude Code loads frontmatter from "skills/skill-name/SKILL.md" already.
Gap Investigation Complete
All previously identified gaps have been investigated and documented:
Investigation Date: 2026-02-15
Method: Complete file reads, path verification via ls, no assumptions
Conclusion
This documentation represents a COMPLETE comprehensive verification pass with gap investigation:
Key Insights:
This documentation is accurate to the actual file system and verified code as of 2026-02-15.
Gap investigation completed 2026-02-15 - all 5 documented gaps resolved with complete file reads.
End of Documentation
Generated by PAI System Documentation (Comprehensive Verification Pass)
All paths verified | No assumptions | Missing files documented
Beta Was this translation helpful? Give feedback.
All reactions