Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

Setup Issue

Open sti0 opened this issue 11 months ago • 3 comments

I did run the Kai installer script and ran into various issues on a linux based system.

The install script defaults to my ~/.claude directory and created the .env file. ✔️

Running then the hook pack defaults to ~/.config/pai because the PAI_DIR env does not exists in the not existing settings.json.

Other values like DA and TIME_ZONE also not detected but defined in the .env file created from the installer script.

● Bash(echo "PAI_DIR: ${PAI_DIR:-'NOT SET - will use ~/.config/pai'}" && echo "DA: ${DA:-'NOT SET'}" && echo "TIME_ZONE: ${TIME_ZONE:-'NOT SET'}")
  ⎿  PAI_DIR: 'NOT SET - will use ~/.config/pai'
     DA: 'NOT SET'
     TIME_ZONE: 'NOT SET'

I suggest that the installer script should check for a settings.json file and either create it or add the PAI_DIR var if exists. (https://code.claude.com/docs/en/settings#environment-variables)

Additionally the installer script creates a Skills dir with CORE skill configuration which does not work in linux env because lower case skills is expected. The bundle installer then suggests to install the CORE pack which is a bit confusing because the installer already created it. But the "real" CORE skill has way more information so I think the intention of the bundle is to create a "slim" version of the CORE first and then merge to full skill later?

sti0 avatar Dec 30 '25 22:12 sti0

Related Finding: Broader Architecture Mismatch Pattern

I've been investigating PAI integration with Claude Code and discovered this issue is part of a larger architectural pattern. Here are complementary findings:

1. Environment Variable Propagation Issue (Confirmed)

Verified the issue described above - installer creates .env but doesn't propagate values to settings.json:

  • PAI_DIR not auto-populated → defaults to ~/.config/pai
  • DA (Assistant name) not propagated
  • TIME_ZONE not propagated

This is particularly problematic since hooks depend on these values from settings.json, not .env.

2. Case Sensitivity Root Cause

The TitleCase vs lowercase issue is mentioned in Issue #269. Key finding: Daniel recently announced (in #269 comments) that "I'm removing that requirement because too many things actually require lowercase in Claude Code." This suggests the fix involves:

  • Changing installer to create skills/ instead of Skills/
  • Updating all pack references to use lowercase directories

3. Related Non-Interactive Execution Issue

While investigating slash command implementation, discovered another mismatch: PAI documents features like /paiupdate that require interactive shell sessions (multi-step decision workflows), but Claude Code runs commands non-interactively. The installer should validate these constraints.

Suggested Priority:

  1. Update installer to populate settings.json environment variables from .env
  2. Coordinate with #269 fix (case sensitivity change to lowercase)
  3. Document which PAI features require interactive execution (can't run in Claude Code)

fayerman-source avatar Dec 30 '25 22:12 fayerman-source

Case sensitive issue was fixed with https://github.com/danielmiessler/Personal_AI_Infrastructure/commit/28c378c4d99113ff1824fae69e9a523ea026d060.

ENV issue still persist:

Help me installing @Packs/kai-hook-system.md 
  ⎿  Read Packs/kai-hook-system.md (1493 lines)

● I'll help you install the Kai Hook System pack. Let me start by analyzing your current system state and then proceed with the installation.

● Bash(echo "PAI_DIR: ${PAI_DIR:-'NOT SET - will use ~/.config/pai'}")
  ⎿  PAI_DIR: 'NOT SET - will use ~/.config/pai'

● Bash(PAI_CHECK="${PAI_DIR:-$HOME/.config/pai}"
      if [ -d "$PAI_CHECK" ]; then…)
  ⎿  ⚠️  PAI directory EXISTS at: /home/vscode/.config/pai
     Contents:
     total 4
     … +5 lines (ctrl+o to expand)

● Bash(PAI_CHECK="${PAI_DIR:-$HOME/.config/pai}"
      if [ -d "$PAI_CHECK/hooks" ]; then…)
  ⎿  ⚠️  Hooks directory EXISTS                                                                        
     Existing hooks:
     -rw-------. 1 vscode vscode 4373 Dec 30 23:38 /home/vscode/.config/pai/hooks/initialize-session.ts
     -rw-------. 1 vscode vscode 7587 Dec 30 23:35 /home/vscode/.config/pai/hooks/security-validator.ts

● Bash(CLAUDE_SETTINGS="$HOME/.claude/settings.json"
      if [ -f "$CLAUDE_SETTINGS" ]; then…)
  ⎿  Error: Exit code 2
     /bin/bash: eval: line 1: syntax error near unexpected token `then'
     /bin/bash: eval: line 1: `CLAUDE_SETTINGS=/.claude/settings.json if \[ -f '' \] ; then echo 'Claude settings.json EXISTS' if grep -q '"hooks"' '' 
     2>/dev/null ; then echo '⚠️  Existing hooks configuration found:' grep -A 50 '"hooks"' '' < /dev/null | head -60 else echo '✓ No hooks configured in 
     settings.json' fi else echo '✓ No Claude settings.json (will be created)' fi'

● Bash(echo "Environment variables:"
      echo "  DA: ${DA:-'NOT SET'}"…)
  ⎿  Environment variables:     
       DA: 'NOT SET'
       TIME_ZONE: 'NOT SET'
       PAI_SOURCE_APP: 'NOT SET'

● Bash(if [ -f "$HOME/.claude/settings.json" ]; then
        echo "Claude settings.json EXISTS"…)
  ⎿  ✓ No Claude settings.json (will be created)

● Bash(ls -la ~/.config/pai/hooks/)
  ⎿  total 16                                        
     drwxr-xr-x. 1 vscode vscode   90 Dec 30 23:38 .
     drwxr-xr-x. 1 vscode vscode   36 Dec 30 23:34 ..
     … +3 lines (ctrl+o to expand)

● System Analysis Summary:

  | Component             | Status                                       |
  |-----------------------|----------------------------------------------|
  | PAI_DIR               | Not set (using ~/.config/pai)                |
  | PAI Directory         | EXISTS with content                          |
  | Hooks Directory       | EXISTS with 2 hooks                          |
  | Existing Hooks        | security-validator.ts, initialize-session.ts |
  | Claude settings.json  | Does NOT exist (needs creation)              |
  | Environment Variables | Not configured                               |

  Let me check the lib directory and existing hook content:

sti0 avatar Dec 30 '25 23:12 sti0

Status Update

Thank you for the detailed report! Here's the status on each issue you raised:

1. Case Sensitivity (Skills vs skills) ✅ FIXED

This was fixed in commit 28c378c:

fix: Linux compatibility - use lowercase for Claude Code directories

The installer now creates lowercase skills/ directories as required by Linux.

2. Environment Variables (PAI_DIR, DA, TIME_ZONE) 🔧 FIXING

This is the same root cause as #275. The installer creates .env and updates shell profiles, but Claude Code doesn't re-source the shell during a session.

Fix in progress: Adding settings.json generation to the installer that uses Claude Code's native environment variable support:

{
  "env": {
    "DA": "YourAI",
    "TIME_ZONE": "Your/Timezone",
    "PAI_DIR": "~/.claude"
  }
}

This will be included in the #275 fix.

3. CORE Skill Confusion

This is expected behavior:

  • Installer creates: Slim CORE skill (basic identity, contacts, stack prefs)
  • kai-core-install pack adds: Full CORE skill with all workflows, tools, and documentation

The slim version is a starting point; the pack enhances it with the complete implementation.


Closing this as:

  • Case sensitivity: ✅ Fixed
  • Env vars: Tracked in #275
  • CORE confusion: Expected behavior (documented)

Thank you for helping improve PAI's Linux support!

danielmiessler avatar Dec 31 '25 06:12 danielmiessler