Skip to content

⛰️ LifeOS — The AI-powered Life Operating System that helps you hill climb to wherever you're going.

Windows Compatibility - Remove Temp Website Image files in directories named with characters that prevent git clone on Windows (#608)

Chris16e4eacbba1e
diff --git a/INSTALL.md b/INSTALL.md
index 36ff05c8..5056d04e 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -85,7 +85,7 @@ PAI offers three installation paths. Explain each and help them choose:
>
> Best for: First-time users, fresh setups, or when you want PAI working immediately.
>
-> [See Releases/v2.4/README.md](Releases/v2.4/README.md)
+> [See Releases/v2.5/README.md](Releases/v2.5/README.md)
**Option B: Bundle + Manual Packs**
> The Bundle wizard creates a skeleton directory structure. You then install each pack manually in order. This gives you understanding of how the system is built.
@@ -188,7 +188,7 @@ If you prefer to install PAI yourself without AI assistance:
```bash
# Clone the repository
git clone https://github.com/danielmiessler/PAI.git
-cd PAI/Releases/v2.4
+cd PAI/Releases/v2.5
# Back up your existing Claude Code configuration (if any)
[ -d ~/.claude ] && mv ~/.claude ~/.claude-backup-$(date +%Y%m%d)
diff --git a/Releases/v2.3/.claude/skills/Browser/Tools/https:/danielmiessler.com/blog/introducing-amazon-curate-i-wish b/Releases/v2.3/.claude/skills/Browser/Tools/https:/danielmiessler.com/blog/introducing-amazon-curate-i-wish
deleted file mode 100755
index 62a608c9..00000000
Binary files a/Releases/v2.3/.claude/skills/Browser/Tools/https:/danielmiessler.com/blog/introducing-amazon-curate-i-wish and /dev/null differ
diff --git a/Releases/v2.3/.claude/skills/Browser/http:/localhost:5173/ideas b/Releases/v2.3/.claude/skills/Browser/http:/localhost:5173/ideas
deleted file mode 100755
index 3bbdc77e..00000000
Binary files a/Releases/v2.3/.claude/skills/Browser/http:/localhost:5173/ideas and /dev/null differ
diff --git a/Releases/v2.3/.claude/skills/Browser/http:/localhost:5173/ideas#the-full-archive b/Releases/v2.3/.claude/skills/Browser/http:/localhost:5173/ideas#the-full-archive
deleted file mode 100755
index 3bbdc77e..00000000
Binary files a/Releases/v2.3/.claude/skills/Browser/http:/localhost:5173/ideas#the-full-archive and /dev/null differ
diff --git a/Releases/v2.4/.claude/skills/Browser/Tools/https:/danielmiessler.com/blog/introducing-amazon-curate-i-wish b/Releases/v2.4/.claude/skills/Browser/Tools/https:/danielmiessler.com/blog/introducing-amazon-curate-i-wish
deleted file mode 100755
index 62a608c9..00000000
Binary files a/Releases/v2.4/.claude/skills/Browser/Tools/https:/danielmiessler.com/blog/introducing-amazon-curate-i-wish and /dev/null differ
diff --git a/Releases/v2.4/.claude/skills/Browser/http:/localhost:5173/ideas b/Releases/v2.4/.claude/skills/Browser/http:/localhost:5173/ideas
deleted file mode 100755
index 3bbdc77e..00000000
Binary files a/Releases/v2.4/.claude/skills/Browser/http:/localhost:5173/ideas and /dev/null differ
diff --git a/Releases/v2.4/.claude/skills/Browser/http:/localhost:5173/ideas#the-full-archive b/Releases/v2.4/.claude/skills/Browser/http:/localhost:5173/ideas#the-full-archive
deleted file mode 100755
index 3bbdc77e..00000000
Binary files a/Releases/v2.4/.claude/skills/Browser/http:/localhost:5173/ideas#the-full-archive and /dev/null differ
diff --git a/Releases/v2.5/.claude/Observability/apps/server/src/index.ts b/Releases/v2.5/.claude/Observability/apps/server/src/index.ts
index b8038bc9..2da2cfb1 100755
--- a/Releases/v2.5/.claude/Observability/apps/server/src/index.ts
+++ b/Releases/v2.5/.claude/Observability/apps/server/src/index.ts
@@ -1,3 +1,5 @@
+import { homedir } from 'os';
+import { join } from 'path';
import type { HookEvent } from './types';
import {
createTheme,
@@ -360,7 +362,7 @@ const server = Bun.serve({
}
// Use Inference tool (via CLI subprocess) instead of direct API
- const proc = Bun.spawn(['bun', 'run', `${process.env.HOME}/.claude/skills/PAI/Tools/Inference.ts`, '--level', 'fast', 'You are a helpful assistant. Be concise.', prompt], {
+ const proc = Bun.spawn(['bun', 'run', join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude', 'skills', 'PAI', 'Tools', 'Inference.ts'), '--level', 'fast', 'You are a helpful assistant. Be concise.', prompt], {
stdout: 'pipe',
stderr: 'pipe',
});
diff --git a/Releases/v2.5/.claude/hooks/AutoWorkCreation.hook.ts b/Releases/v2.5/.claude/hooks/AutoWorkCreation.hook.ts
index 29efaf2e..9d287196 100755
--- a/Releases/v2.5/.claude/hooks/AutoWorkCreation.hook.ts
+++ b/Releases/v2.5/.claude/hooks/AutoWorkCreation.hook.ts
@@ -24,6 +24,7 @@
import { mkdirSync, existsSync, readFileSync, writeFileSync, symlinkSync, unlinkSync, lstatSync } from 'fs';
import { join } from 'path';
+import { homedir } from 'os';
import { getPSTComponents, getISOTimestamp } from './lib/time';
import { inference } from '../skills/PAI/Tools/Inference';
@@ -48,7 +49,7 @@ interface PromptClassification {
is_new_topic: boolean;
}
-const BASE_DIR = process.env.PAI_DIR || join(process.env.HOME!, '.claude');
+const BASE_DIR = process.env.PAI_DIR || join((process.env.HOME || process.env.USERPROFILE || homedir()), '.claude');
const WORK_DIR = join(BASE_DIR, 'MEMORY', 'WORK');
const STATE_DIR = join(BASE_DIR, 'MEMORY', 'STATE');
const CURRENT_WORK_FILE = join(STATE_DIR, 'current-work.json');
diff --git a/Releases/v2.5/.claude/hooks/ExplicitRatingCapture.hook.ts b/Releases/v2.5/.claude/hooks/ExplicitRatingCapture.hook.ts
index aefa4c87..7faef934 100755
--- a/Releases/v2.5/.claude/hooks/ExplicitRatingCapture.hook.ts
+++ b/Releases/v2.5/.claude/hooks/ExplicitRatingCapture.hook.ts
@@ -57,6 +57,7 @@
import { appendFileSync, mkdirSync, existsSync, readFileSync, writeFileSync } from 'fs';
import { join } from 'path';
+import { homedir } from 'os';
import { getLearningCategory } from './lib/learning-utils';
import { getPrincipalName } from './lib/identity';
import { getISOTimestamp, getPSTComponents } from './lib/time';
@@ -133,7 +134,7 @@ function parseRating(prompt: string): { rating: number; comment?: string } | nul
* NOTE: Ratings are now stored in LEARNING/SIGNALS/ (consolidated from separate SIGNALS/)
*/
function writeRating(entry: RatingEntry): void {
- const baseDir = process.env.PAI_DIR || join(process.env.HOME!, '.claude');
+ const baseDir = process.env.PAI_DIR || join((process.env.HOME || process.env.USERPROFILE || homedir()), '.claude');
const signalsDir = join(baseDir, 'MEMORY', 'LEARNING', 'SIGNALS');
const ratingsFile = join(signalsDir, 'ratings.jsonl');
@@ -185,7 +186,7 @@ function getLastResponseSummary(transcriptPath: string): string {
function captureLowRatingLearning(rating: number, comment: string | undefined, responseContext: string): void {
if (rating >= 6) return;
- const baseDir = process.env.PAI_DIR || join(process.env.HOME!, '.claude');
+ const baseDir = process.env.PAI_DIR || join((process.env.HOME || process.env.USERPROFILE || homedir()), '.claude');
const { year, month, day, hours, minutes, seconds } = getPSTComponents();
const yearMonth = `${year}-${month}`;
@@ -262,7 +263,7 @@ async function main() {
writeRating(entry);
// Update trending analysis cache (fire-and-forget, don't block)
- const baseDir = process.env.PAI_DIR || join(process.env.HOME!, '.claude');
+ const baseDir = process.env.PAI_DIR || join((process.env.HOME || process.env.USERPROFILE || homedir()), '.claude');
const trendingScript = join(baseDir, 'tools', 'TrendingAnalysis.ts');
if (existsSync(trendingScript)) {
Bun.spawn(['bun', trendingScript, '--force'], {
diff --git a/Releases/v2.5/.claude/hooks/ImplicitSentimentCapture.hook.ts b/Releases/v2.5/.claude/hooks/ImplicitSentimentCapture.hook.ts
index cddddeb9..36801702 100755
--- a/Releases/v2.5/.claude/hooks/ImplicitSentimentCapture.hook.ts
+++ b/Releases/v2.5/.claude/hooks/ImplicitSentimentCapture.hook.ts
@@ -63,6 +63,7 @@
import { appendFileSync, mkdirSync, existsSync, readFileSync, writeFileSync } from 'fs';
import { join } from 'path';
+import { homedir } from 'os';
import { inference } from '../skills/PAI/Tools/Inference';
import { getIdentity, getPrincipal } from './lib/identity';
import { getLearningCategory } from './lib/learning-utils';
@@ -281,7 +282,7 @@ async function analyzeSentiment(prompt: string, context: string): Promise<Sentim
* NOTE: Ratings are now stored in LEARNING/SIGNALS/ (consolidated from separate SIGNALS/)
*/
function writeImplicitRating(entry: ImplicitRatingEntry): void {
- const baseDir = process.env.PAI_DIR || join(process.env.HOME!, '.claude');
+ const baseDir = process.env.PAI_DIR || join((process.env.HOME || process.env.USERPROFILE || homedir()), '.claude');
const signalsDir = join(baseDir, 'MEMORY', 'LEARNING', 'SIGNALS');
const ratingsFile = join(signalsDir, 'ratings.jsonl');
@@ -304,7 +305,7 @@ function captureLowRatingLearning(
): void {
if (rating >= 6) return;
- const baseDir = process.env.PAI_DIR || join(process.env.HOME!, '.claude');
+ const baseDir = process.env.PAI_DIR || join((process.env.HOME || process.env.USERPROFILE || homedir()), '.claude');
const { year, month, day, hours, minutes, seconds } = getPSTComponents();
const yearMonth = `${year}-${month}`;
@@ -449,7 +450,7 @@ async function main() {
writeImplicitRating(entry);
// Update trending analysis cache (fire-and-forget, don't block)
- const baseDir = process.env.PAI_DIR || join(process.env.HOME!, '.claude');
+ const baseDir = process.env.PAI_DIR || join((process.env.HOME || process.env.USERPROFILE || homedir()), '.claude');
const trendingScript = join(baseDir, 'tools', 'TrendingAnalysis.ts');
if (existsSync(trendingScript)) {
Bun.spawn(['bun', trendingScript, '--force'], {
diff --git a/Releases/v2.5/.claude/hooks/SessionSummary.hook.ts b/Releases/v2.5/.claude/hooks/SessionSummary.hook.ts
index 08bb9641..5c5ae481 100755
--- a/Releases/v2.5/.claude/hooks/SessionSummary.hook.ts
+++ b/Releases/v2.5/.claude/hooks/SessionSummary.hook.ts
@@ -49,9 +49,10 @@
import { writeFileSync, existsSync, readFileSync, unlinkSync } from 'fs';
import { join } from 'path';
+import { homedir } from 'os';
import { getISOTimestamp } from './lib/time';
-const MEMORY_DIR = join(process.env.HOME!, '.claude', 'MEMORY');
+const MEMORY_DIR = join((process.env.HOME || process.env.USERPROFILE || homedir()), '.claude', 'MEMORY');
const STATE_DIR = join(MEMORY_DIR, 'STATE');
const CURRENT_WORK_FILE = join(STATE_DIR, 'current-work.json');
const WORK_DIR = join(MEMORY_DIR, 'WORK');
diff --git a/Releases/v2.5/.claude/hooks/WorkCompletionLearning.hook.ts b/Releases/v2.5/.claude/hooks/WorkCompletionLearning.hook.ts
index 56664deb..270c6069 100755
--- a/Releases/v2.5/.claude/hooks/WorkCompletionLearning.hook.ts
+++ b/Releases/v2.5/.claude/hooks/WorkCompletionLearning.hook.ts
@@ -52,10 +52,11 @@
import { writeFileSync, existsSync, readFileSync, mkdirSync } from 'fs';
import { join, dirname } from 'path';
+import { homedir } from 'os';
import { getISOTimestamp, getPSTDate } from './lib/time';
import { getLearningCategory } from './lib/learning-utils';
-const MEMORY_DIR = join(process.env.HOME!, '.claude', 'MEMORY');
+const MEMORY_DIR = join((process.env.HOME || process.env.USERPROFILE || homedir()), '.claude', 'MEMORY');
const STATE_DIR = join(MEMORY_DIR, 'STATE');
const CURRENT_WORK_FILE = join(STATE_DIR, 'current-work.json');
const WORK_DIR = join(MEMORY_DIR, 'WORK');
diff --git a/Releases/v2.5/.claude/hooks/handlers/ISCValidator.ts b/Releases/v2.5/.claude/hooks/handlers/ISCValidator.ts
index 346a4a9a..7225ecb0 100755
--- a/Releases/v2.5/.claude/hooks/handlers/ISCValidator.ts
+++ b/Releases/v2.5/.claude/hooks/handlers/ISCValidator.ts
@@ -20,6 +20,7 @@
import { existsSync, readFileSync, statSync } from 'fs';
import { join } from 'path';
+import { homedir } from 'os';
import type { ParsedTranscript } from '../../skills/PAI/Tools/TranscriptParser';
interface CurrentWork {
@@ -47,7 +48,7 @@ interface ValidationResult {
errors: string[];
}
-const BASE_DIR = process.env.PAI_DIR || join(process.env.HOME!, '.claude');
+const BASE_DIR = process.env.PAI_DIR || join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude');
const WORK_DIR = join(BASE_DIR, 'MEMORY', 'WORK');
const STATE_DIR = join(BASE_DIR, 'MEMORY', 'STATE');
const CURRENT_WORK_FILE = join(STATE_DIR, 'current-work.json');
diff --git a/Releases/v2.5/.claude/hooks/handlers/RebuildSkill.ts b/Releases/v2.5/.claude/hooks/handlers/RebuildSkill.ts
index b8948caf..9665eff6 100755
--- a/Releases/v2.5/.claude/hooks/handlers/RebuildSkill.ts
+++ b/Releases/v2.5/.claude/hooks/handlers/RebuildSkill.ts
@@ -21,10 +21,11 @@
import { statSync, readdirSync } from 'fs';
import { join } from 'path';
+import { homedir } from 'os';
import { spawnSync } from 'child_process';
export async function handleRebuildSkill(): Promise<void> {
- const CORE_DIR = join(process.env.HOME!, '.claude/skills/PAI');
+ const CORE_DIR = join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude', 'skills', 'PAI');
const COMPONENTS_DIR = join(CORE_DIR, 'Components');
const SKILL_MD = join(CORE_DIR, 'SKILL.md');
const BUILD_SCRIPT = join(CORE_DIR, 'Tools/CreateDynamicCore.ts');
@@ -62,7 +63,7 @@ export async function handleRebuildSkill(): Promise<void> {
function rebuild(buildScript: string): void {
const result = spawnSync('bun', [buildScript], {
- cwd: join(process.env.HOME!, '.claude/skills/PAI'),
+ cwd: join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude', 'skills', 'PAI'),
encoding: 'utf-8',
});
diff --git a/Releases/v2.5/.claude/hooks/lib/identity.ts b/Releases/v2.5/.claude/hooks/lib/identity.ts
index 2aa020bd..b8117013 100755
--- a/Releases/v2.5/.claude/hooks/lib/identity.ts
+++ b/Releases/v2.5/.claude/hooks/lib/identity.ts
@@ -8,9 +8,10 @@
import { readFileSync, existsSync } from 'fs';
import { join } from 'path';
+import { homedir } from 'os';
-const HOME = process.env.HOME!;
-const SETTINGS_PATH = join(HOME, '.claude/settings.json');
+const HOME = process.env.HOME || process.env.USERPROFILE || homedir();
+const SETTINGS_PATH = join(HOME, '.claude', 'settings.json');
// Default identity (fallback if settings.json doesn't have identity section)
const DEFAULT_IDENTITY = {
diff --git a/Releases/v2.5/.claude/hooks/lib/notifications.ts b/Releases/v2.5/.claude/hooks/lib/notifications.ts
index ac005de6..c72a186f 100755
--- a/Releases/v2.5/.claude/hooks/lib/notifications.ts
+++ b/Releases/v2.5/.claude/hooks/lib/notifications.ts
@@ -16,7 +16,7 @@
import { readFileSync, existsSync, writeFileSync, mkdirSync } from 'fs';
import { join } from 'path';
-import { homedir } from 'os';
+import { homedir, tmpdir } from 'os';
import { getIdentity } from './identity';
// ============================================================================
@@ -139,7 +139,7 @@ export function getNotificationConfig(): NotificationConfig {
// Session Timing
// ============================================================================
-const SESSION_START_FILE = '/tmp/pai-session-start.txt';
+const SESSION_START_FILE = join(tmpdir(), 'pai-session-start.txt');
/**
* Record session start time (call from SessionStart hook)
diff --git a/Releases/v2.5/.claude/hooks/lib/paths.ts b/Releases/v2.5/.claude/hooks/lib/paths.ts
index a7a11d26..df3559a1 100755
--- a/Releases/v2.5/.claude/hooks/lib/paths.ts
+++ b/Releases/v2.5/.claude/hooks/lib/paths.ts
@@ -9,7 +9,7 @@
* const paiDir = getPaiDir(); // Always returns expanded absolute path
*/
-import { homedir } from 'os';
+import { homedir, tmpdir } from 'os';
import { join } from 'path';
/**
@@ -73,3 +73,26 @@ export function getSkillsDir(): string {
export function getMemoryDir(): string {
return paiPath('MEMORY');
}
+
+/**
+ * Get the user's home directory (cross-platform)
+ * Priority: HOME (Unix/Git Bash) → USERPROFILE (Windows) → os.homedir()
+ */
+export function getHome(): string {
+ return process.env.HOME || process.env.USERPROFILE || homedir();
+}
+
+/**
+ * Get a cross-platform temp path
+ * Uses os.tmpdir() instead of hardcoded /tmp/
+ */
+export function getTempPath(...segments: string[]): string {
+ return join(tmpdir(), ...segments);
+}
+
+/**
+ * Check if running on Windows
+ */
+export function isWindows(): boolean {
+ return process.platform === 'win32';
+}
diff --git a/Releases/v2.5/.claude/hooks/lib/recovery-types.ts b/Releases/v2.5/.claude/hooks/lib/recovery-types.ts
index 002b713b..79b1b17e 100755
--- a/Releases/v2.5/.claude/hooks/lib/recovery-types.ts
+++ b/Releases/v2.5/.claude/hooks/lib/recovery-types.ts
@@ -2,6 +2,9 @@
* recovery-types.ts - Type definitions for the recovery journal system
*/
+import { tmpdir, homedir } from 'os';
+import { join } from 'path';
+
export interface RecoveryPoint {
id: string; // UUID for this recovery point
timestamp: string; // ISO timestamp
@@ -48,7 +51,7 @@ export interface RecoveryPointSummary {
}
// Safe paths that don't need journaling (within .claude ecosystem)
-const PAI_DIR = process.env.PAI_DIR || `${process.env.HOME}/.claude`;
+const PAI_DIR = process.env.PAI_DIR || join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude');
export const SAFE_PATH_PREFIXES = [
`${PAI_DIR}/MEMORY/`, // All MEMORY output is safe (sessions, learnings, raw-outputs, etc.)
`${PAI_DIR}/Scratchpad/`,
@@ -56,8 +59,7 @@ export const SAFE_PATH_PREFIXES = [
`${PAI_DIR}/Debug/`,
`${PAI_DIR}/SessionEnv/`,
`${PAI_DIR}/Todos/`,
- '/tmp/',
- '/var/tmp/',
+ join(tmpdir(), '/'), // OS temp directory (cross-platform)
];
// Skip journaling for these output-only operations
diff --git a/Releases/v2.5/.claude/hooks/lib/response-format.ts b/Releases/v2.5/.claude/hooks/lib/response-format.ts
index 562ea2b5..cfa0292d 100755
--- a/Releases/v2.5/.claude/hooks/lib/response-format.ts
+++ b/Releases/v2.5/.claude/hooks/lib/response-format.ts
@@ -9,8 +9,9 @@
import { readFileSync } from 'fs';
import { join } from 'path';
+import { homedir } from 'os';
-const PAI_SKILL_PATH = join(process.env.HOME!, '.claude/skills/PAI/SKILL.md');
+const PAI_SKILL_PATH = join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude', 'skills', 'PAI', 'SKILL.md');
// Cache the format spec
let formatSpec: string | null = null;
diff --git a/Releases/v2.5/.claude/hooks/lib/work-utils.ts b/Releases/v2.5/.claude/hooks/lib/work-utils.ts
index 1fcc80e8..47632c38 100644
--- a/Releases/v2.5/.claude/hooks/lib/work-utils.ts
+++ b/Releases/v2.5/.claude/hooks/lib/work-utils.ts
@@ -4,11 +4,12 @@
*/
import { existsSync, readFileSync, readdirSync } from 'fs';
+import { homedir } from 'os';
import { join } from 'path';
export type AlgorithmPhase = 'OBSERVE' | 'THINK' | 'PLAN' | 'BUILD' | 'EXECUTE' | 'VERIFY' | 'LEARN';
-const CLAUDE_DIR = process.env.PAI_DIR || process.env.HOME + '/.claude';
+const CLAUDE_DIR = process.env.PAI_DIR || join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude');
const WORK_DIR = join(CLAUDE_DIR, 'MEMORY', 'WORK');
/**
diff --git a/Releases/v2.5/.claude/skills/Art/Tools/ComposeThumbnail.ts b/Releases/v2.5/.claude/skills/Art/Tools/ComposeThumbnail.ts
index c1587843..3754e665 100755
--- a/Releases/v2.5/.claude/skills/Art/Tools/ComposeThumbnail.ts
+++ b/Releases/v2.5/.claude/skills/Art/Tools/ComposeThumbnail.ts
@@ -15,7 +15,8 @@
import { spawn } from "node:child_process";
import { existsSync, unlinkSync } from "node:fs";
-import { resolve, dirname } from "node:path";
+import { homedir } from "node:os";
+import { resolve, dirname, join } from "node:path";
// ============================================================================
// Types
@@ -44,7 +45,7 @@ const DEFAULTS = {
borderColor: "#bb9af7", // Tokyo Night Vivid Purple
font: "Helvetica-Bold", // System font that actually exists
headshotPosition: "left" as const,
- output: `${process.env.HOME}/Downloads/yt-thumbnail-${Date.now()}.png`,
+ output: join(process.env.HOME || process.env.USERPROFILE || homedir(), 'Downloads', `yt-thumbnail-${Date.now()}.png`),
};
const LAYOUT = {
diff --git a/Releases/v2.5/.claude/skills/Art/Tools/Generate.ts b/Releases/v2.5/.claude/skills/Art/Tools/Generate.ts
index 09bc6682..d07c72a2 100755
--- a/Releases/v2.5/.claude/skills/Art/Tools/Generate.ts
+++ b/Releases/v2.5/.claude/skills/Art/Tools/Generate.ts
@@ -17,6 +17,7 @@ import OpenAI from "openai";
import { GoogleGenAI } from "@google/genai";
import { writeFile, readFile } from "node:fs/promises";
import { extname, resolve } from "node:path";
+import { homedir } from "node:os";
// ============================================================================
// Environment Loading
@@ -27,7 +28,7 @@ import { extname, resolve } from "node:path";
* This ensures API keys are available regardless of how the CLI is invoked
*/
async function loadEnv(): Promise<void> {
- const paiDir = process.env.PAI_DIR || resolve(process.env.HOME!, '.claude');
+ const paiDir = process.env.PAI_DIR || resolve(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude');
const envPath = resolve(paiDir, '.env');
try {
const envContent = await readFile(envPath, 'utf-8');
@@ -84,7 +85,7 @@ interface CLIArgs {
const DEFAULTS = {
model: "flux" as Model,
size: "16:9" as Size,
- output: `${process.env.HOME}/Downloads/ul-image.png`,
+ output: resolve(process.env.HOME || process.env.USERPROFILE || homedir(), 'Downloads', 'ul-image.png'),
};
const REPLICATE_SIZES: ReplicateSize[] = ["1:1", "16:9", "3:2", "2:3", "3:4", "4:3", "4:5", "5:4", "9:16", "21:9"];
@@ -126,7 +127,7 @@ function handleError(error: unknown): never {
// ============================================================================
// PAI directory for documentation paths
-const PAI_DIR = process.env.PAI_DIR || `${process.env.HOME}/.claude`;
+const PAI_DIR = process.env.PAI_DIR || resolve(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude');
function showHelp(): void {
console.log(`
diff --git a/Releases/v2.5/.claude/skills/Art/Tools/GenerateMidjourneyImage.ts b/Releases/v2.5/.claude/skills/Art/Tools/GenerateMidjourneyImage.ts
index 0aab70eb..4b41be3d 100755
--- a/Releases/v2.5/.claude/skills/Art/Tools/GenerateMidjourneyImage.ts
+++ b/Releases/v2.5/.claude/skills/Art/Tools/GenerateMidjourneyImage.ts
@@ -15,7 +15,8 @@
import { DiscordBotClient } from '../lib/discord-bot.js';
import { MidjourneyClient, MidjourneyError } from '../lib/midjourney-client.js';
import { readFile } from 'node:fs/promises';
-import { resolve } from 'node:path';
+import { resolve, join } from 'node:path';
+import { homedir, tmpdir } from 'node:os';
// ============================================================================
// Environment Loading
@@ -26,7 +27,7 @@ import { resolve } from 'node:path';
* This ensures API keys are available regardless of how the CLI is invoked
*/
async function loadEnv(): Promise<void> {
- const paiDir = process.env.PAI_DIR || resolve(process.env.HOME!, '.claude');
+ const paiDir = process.env.PAI_DIR || resolve(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude');
const envPath = resolve(paiDir, '.env');
try {
const envContent = await readFile(envPath, 'utf-8');
@@ -79,7 +80,7 @@ const DEFAULTS = {
stylize: parseInt(process.env.MIDJOURNEY_DEFAULT_STYLIZE || '100'),
quality: parseInt(process.env.MIDJOURNEY_DEFAULT_QUALITY || '1'),
tile: false,
- output: '/tmp/midjourney-image.png',
+ output: join(tmpdir(), 'midjourney-image.png'),
timeout: 120,
};
diff --git a/Releases/v2.5/.claude/skills/Art/Tools/GeneratePrompt.ts b/Releases/v2.5/.claude/skills/Art/Tools/GeneratePrompt.ts
index 0ce10142..54f6dd0a 100755
--- a/Releases/v2.5/.claude/skills/Art/Tools/GeneratePrompt.ts
+++ b/Releases/v2.5/.claude/skills/Art/Tools/GeneratePrompt.ts
@@ -19,6 +19,7 @@
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
+import { homedir } from "node:os";
// ============================================================================
// Types
@@ -68,8 +69,8 @@ interface PromptOutput {
// ============================================================================
const ART_AESTHETIC_PATH = resolve(
- process.env.HOME!,
- ".claude/skills/PAI/Aesthetic.md"
+ process.env.HOME || process.env.USERPROFILE || homedir(),
+ ".claude", "skills", "PAI", "Aesthetic.md"
);
const COLOR_HEX_MAP: Record<TokyoNightColor, string> = {
diff --git a/Releases/v2.5/.claude/skills/Browser/Tools/Browse.ts b/Releases/v2.5/.claude/skills/Browser/Tools/Browse.ts
index 19e2992f..2a8ff3ad 100755
--- a/Releases/v2.5/.claude/skills/Browser/Tools/Browse.ts
+++ b/Releases/v2.5/.claude/skills/Browser/Tools/Browse.ts
@@ -18,12 +18,14 @@
*/
import { PlaywrightBrowser } from '../index.ts'
+import { tmpdir, homedir } from 'os'
+import { join } from 'path'
const VOICE_SERVER = 'http://localhost:8888/notify'
-const STATE_FILE = '/tmp/browser-session.json'
+const STATE_FILE = join(tmpdir(), 'browser-session.json')
const DEFAULT_PORT = 9222
const SESSION_TIMEOUT = 5000 // 5s to wait for session start
-const SETTINGS_PATH = `${process.env.HOME}/.claude/settings.json`
+const SETTINGS_PATH = join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude', 'settings.json')
// ============================================
// SETTINGS
@@ -318,7 +320,7 @@ async function debugUrl(url: string): Promise<void> {
// Take screenshot
const timestamp = Date.now()
- const screenshotPath = `/tmp/browse-${timestamp}.png`
+ const screenshotPath = join(tmpdir(), `browse-${timestamp}.png`)
await sessionCommand('screenshot', { path: screenshotPath })
// Get diagnostics
@@ -424,7 +426,7 @@ async function showFailed(): Promise<void> {
}
async function takeScreenshot(path?: string): Promise<void> {
- const screenshotPath = path || `/tmp/screenshot-${Date.now()}.png`
+ const screenshotPath = path || join(tmpdir(), `screenshot-${Date.now()}.png`)
await sessionCommand('screenshot', { path: screenshotPath })
console.log(`📸 Screenshot: ${screenshotPath}`)
}
diff --git a/Releases/v2.5/.claude/skills/Browser/Tools/BrowserSession.ts b/Releases/v2.5/.claude/skills/Browser/Tools/BrowserSession.ts
index 4218a5d2..935638d0 100755
--- a/Releases/v2.5/.claude/skills/Browser/Tools/BrowserSession.ts
+++ b/Releases/v2.5/.claude/skills/Browser/Tools/BrowserSession.ts
@@ -27,6 +27,8 @@
*/
import { PlaywrightBrowser } from '../index.ts'
+import { tmpdir } from 'os'
+import { join } from 'path'
const CONFIG = {
port: parseInt(process.env.BROWSER_PORT || '9222'),
@@ -35,7 +37,7 @@ const CONFIG = {
width: parseInt(process.env.BROWSER_WIDTH || '1920'),
height: parseInt(process.env.BROWSER_HEIGHT || '1080')
},
- stateFile: '/tmp/browser-session.json',
+ stateFile: join(tmpdir(), 'browser-session.json'),
idleTimeout: 30 * 60 * 1000 // 30 minutes
}
@@ -280,7 +282,7 @@ const server = Bun.serve({
// Screenshot
if (url.pathname === '/screenshot' && method === 'POST') {
const body = await req.json()
- const path = body.path || '/tmp/screenshot.png'
+ const path = body.path || join(tmpdir(), 'screenshot.png')
await browser.screenshot({
path,
fullPage: body.fullPage || false,
diff --git a/Releases/v2.5/.claude/skills/Browser/Tools/https:/danielmiessler.com/blog/introducing-amazon-curate-i-wish b/Releases/v2.5/.claude/skills/Browser/Tools/https:/danielmiessler.com/blog/introducing-amazon-curate-i-wish
deleted file mode 100755
index 62a608c9..00000000
Binary files a/Releases/v2.5/.claude/skills/Browser/Tools/https:/danielmiessler.com/blog/introducing-amazon-curate-i-wish and /dev/null differ
diff --git a/Releases/v2.5/.claude/skills/Browser/http:/localhost:5173/ideas b/Releases/v2.5/.claude/skills/Browser/http:/localhost:5173/ideas
deleted file mode 100755
index 3bbdc77e..00000000
Binary files a/Releases/v2.5/.claude/skills/Browser/http:/localhost:5173/ideas and /dev/null differ
diff --git a/Releases/v2.5/.claude/skills/Browser/http:/localhost:5173/ideas#the-full-archive b/Releases/v2.5/.claude/skills/Browser/http:/localhost:5173/ideas#the-full-archive
deleted file mode 100755
index 3bbdc77e..00000000
Binary files a/Releases/v2.5/.claude/skills/Browser/http:/localhost:5173/ideas#the-full-archive and /dev/null differ
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/ActivityParser.ts b/Releases/v2.5/.claude/skills/PAI/Tools/ActivityParser.ts
index eaf399ab..5739f681 100755
--- a/Releases/v2.5/.claude/skills/PAI/Tools/ActivityParser.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/ActivityParser.ts
@@ -16,12 +16,13 @@
import { parseArgs } from "util";
import * as fs from "fs";
import * as path from "path";
+import { homedir } from "os";
// ============================================================================
// Configuration
// ============================================================================
-const CLAUDE_DIR = path.join(process.env.HOME!, ".claude");
+const CLAUDE_DIR = path.join(process.env.HOME || process.env.USERPROFILE || homedir(), ".claude");
const MEMORY_DIR = path.join(CLAUDE_DIR, "MEMORY");
const USERNAME = process.env.USER || require("os").userInfo().username;
const PROJECTS_DIR = path.join(CLAUDE_DIR, "projects", `-Users-${USERNAME}--claude`); // Claude Code native storage
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/Banner.ts b/Releases/v2.5/.claude/skills/PAI/Tools/Banner.ts
index 0e5148f5..a0ac2f49 100755
--- a/Releases/v2.5/.claude/skills/PAI/Tools/Banner.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/Banner.ts
@@ -11,8 +11,9 @@
import { readdirSync, existsSync, readFileSync } from "fs";
import { join } from "path";
import { spawnSync } from "child_process";
+import { homedir } from "os";
-const HOME = process.env.HOME!;
+const HOME = process.env.HOME || process.env.USERPROFILE || homedir();
const CLAUDE_DIR = join(HOME, ".claude");
// ═══════════════════════════════════════════════════════════════════════════
@@ -22,6 +23,11 @@ const CLAUDE_DIR = join(HOME, ".claude");
function getTerminalWidth(): number {
let width: number | null = null;
+ // Tier 0: process.stdout.columns (cross-platform, works on Windows)
+ if (process.stdout.columns) {
+ return process.stdout.columns;
+ }
+
const kittyWindowId = process.env.KITTY_WINDOW_ID;
if (kittyWindowId) {
try {
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/BannerMatrix.ts b/Releases/v2.5/.claude/skills/PAI/Tools/BannerMatrix.ts
index c5e4e90a..c378f467 100755
--- a/Releases/v2.5/.claude/skills/PAI/Tools/BannerMatrix.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/BannerMatrix.ts
@@ -20,8 +20,9 @@
import { readdirSync, existsSync, readFileSync } from "fs";
import { join } from "path";
import { spawnSync } from "child_process";
+import { homedir } from "os";
-const HOME = process.env.HOME!;
+const HOME = process.env.HOME || process.env.USERPROFILE || homedir();
const CLAUDE_DIR = join(HOME, ".claude");
// =============================================================================
@@ -33,6 +34,11 @@ type DisplayMode = "nano" | "micro" | "mini" | "normal";
function getTerminalWidth(): number {
let width: number | null = null;
+ // Tier 0: process.stdout.columns (cross-platform, works on Windows)
+ if (process.stdout.columns) {
+ return process.stdout.columns;
+ }
+
// Tier 1: Kitty IPC
const kittyWindowId = process.env.KITTY_WINDOW_ID;
if (kittyWindowId) {
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/BannerNeofetch.ts b/Releases/v2.5/.claude/skills/PAI/Tools/BannerNeofetch.ts
index 08ba7ac7..030c2593 100755
--- a/Releases/v2.5/.claude/skills/PAI/Tools/BannerNeofetch.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/BannerNeofetch.ts
@@ -13,8 +13,9 @@
import { readdirSync, existsSync, readFileSync } from "fs";
import { join } from "path";
import { spawnSync } from "child_process";
+import { homedir } from "os";
-const HOME = process.env.HOME!;
+const HOME = process.env.HOME || process.env.USERPROFILE || homedir();
const CLAUDE_DIR = join(HOME, ".claude");
// ═══════════════════════════════════════════════════════════════════════
@@ -24,6 +25,11 @@ const CLAUDE_DIR = join(HOME, ".claude");
function getTerminalWidth(): number {
let width: number | null = null;
+ // Tier 0: process.stdout.columns (cross-platform, works on Windows)
+ if (process.stdout.columns) {
+ return process.stdout.columns;
+ }
+
const kittyWindowId = process.env.KITTY_WINDOW_ID;
if (kittyWindowId) {
try {
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/BannerRetro.ts b/Releases/v2.5/.claude/skills/PAI/Tools/BannerRetro.ts
index fd6f4da0..f0e5f924 100755
--- a/Releases/v2.5/.claude/skills/PAI/Tools/BannerRetro.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/BannerRetro.ts
@@ -18,8 +18,9 @@
import { readdirSync, existsSync, readFileSync } from "fs";
import { join } from "path";
import { spawnSync } from "child_process";
+import { homedir } from "os";
-const HOME = process.env.HOME!;
+const HOME = process.env.HOME || process.env.USERPROFILE || homedir();
const CLAUDE_DIR = join(HOME, ".claude");
// ═══════════════════════════════════════════════════════════════════════════
@@ -29,6 +30,11 @@ const CLAUDE_DIR = join(HOME, ".claude");
function getTerminalWidth(): number {
let width: number | null = null;
+ // Tier 0: process.stdout.columns (cross-platform, works on Windows)
+ if (process.stdout.columns) {
+ return process.stdout.columns;
+ }
+
// Tier 1: Kitty IPC
const kittyWindowId = process.env.KITTY_WINDOW_ID;
if (kittyWindowId) {
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/CreateDynamicCore.ts b/Releases/v2.5/.claude/skills/PAI/Tools/CreateDynamicCore.ts
index 0ad0faba..eb746eeb 100755
--- a/Releases/v2.5/.claude/skills/PAI/Tools/CreateDynamicCore.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/CreateDynamicCore.ts
@@ -11,8 +11,9 @@
import { readdirSync, readFileSync, writeFileSync } from "fs";
import { join } from "path";
+import { homedir } from "os";
-const HOME = process.env.HOME!;
+const HOME = process.env.HOME || process.env.USERPROFILE || homedir();
const CORE_DIR = join(HOME, ".claude/skills/PAI");
const COMPONENTS_DIR = join(CORE_DIR, "Components");
const ALGORITHM_DIR = join(COMPONENTS_DIR, "Algorithm");
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/FailureCapture.ts b/Releases/v2.5/.claude/skills/PAI/Tools/FailureCapture.ts
index 9b8d9c54..45a62bb6 100644
--- a/Releases/v2.5/.claude/skills/PAI/Tools/FailureCapture.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/FailureCapture.ts
@@ -27,9 +27,10 @@
import { existsSync, mkdirSync, readFileSync, writeFileSync, copyFileSync } from 'fs';
import { join, basename } from 'path';
+import { homedir } from 'os';
import { inference } from './Inference';
-const PAI_DIR = process.env.PAI_DIR || join(process.env.HOME!, '.claude');
+const PAI_DIR = process.env.PAI_DIR || join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude');
interface FailureCaptureInput {
transcriptPath: string;
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/FeatureRegistry.ts b/Releases/v2.5/.claude/skills/PAI/Tools/FeatureRegistry.ts
index 83c43563..914b9ed4 100755
--- a/Releases/v2.5/.claude/skills/PAI/Tools/FeatureRegistry.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/FeatureRegistry.ts
@@ -20,6 +20,7 @@
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
import { join } from 'path';
+import { homedir } from 'os';
interface TestStep {
step: string;
@@ -55,7 +56,7 @@ interface FeatureRegistry {
};
}
-const REGISTRY_DIR = join(process.env.HOME || '', '.claude', 'MEMORY', 'progress');
+const REGISTRY_DIR = join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude', 'MEMORY', 'progress');
function getRegistryPath(project: string): string {
return join(REGISTRY_DIR, `${project}-features.json`);
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/GetCounts.ts b/Releases/v2.5/.claude/skills/PAI/Tools/GetCounts.ts
index 218562ad..58648325 100644
--- a/Releases/v2.5/.claude/skills/PAI/Tools/GetCounts.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/GetCounts.ts
@@ -35,8 +35,9 @@
import { readdirSync, existsSync, statSync } from "fs";
import { join } from "path";
+import { homedir } from "os";
-const HOME = process.env.HOME!;
+const HOME = process.env.HOME || process.env.USERPROFILE || homedir();
const PAI_DIR = process.env.PAI_DIR || join(HOME, ".claude");
interface Counts {
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/IntegrityMaintenance.ts b/Releases/v2.5/.claude/skills/PAI/Tools/IntegrityMaintenance.ts
index 5efccc62..a31231b4 100755
--- a/Releases/v2.5/.claude/skills/PAI/Tools/IntegrityMaintenance.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/IntegrityMaintenance.ts
@@ -21,6 +21,7 @@
import { spawn } from 'child_process';
import { readFileSync, existsSync } from 'fs';
import { join, basename, dirname } from 'path';
+import { homedir } from 'os';
import { inference } from './Inference';
import { getIdentity } from '../../../hooks/lib/identity';
@@ -108,7 +109,7 @@ interface UpdateData {
// Constants
// ============================================================================
-const PAI_DIR = process.env.HOME + '/.claude';
+const PAI_DIR = join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude');
const CREATE_UPDATE_SCRIPT = join(PAI_DIR, 'skills/_SYSTEM/Tools/CreateUpdate.ts');
// Words that indicate generic/bad titles - reject these
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/LearningPatternSynthesis.ts b/Releases/v2.5/.claude/skills/PAI/Tools/LearningPatternSynthesis.ts
index a135aaab..a8ae3294 100755
--- a/Releases/v2.5/.claude/skills/PAI/Tools/LearningPatternSynthesis.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/LearningPatternSynthesis.ts
@@ -19,12 +19,13 @@
import { parseArgs } from "util";
import * as fs from "fs";
import * as path from "path";
+import { homedir } from "os";
// ============================================================================
// Configuration
// ============================================================================
-const CLAUDE_DIR = path.join(process.env.HOME!, ".claude");
+const CLAUDE_DIR = path.join(process.env.HOME || process.env.USERPROFILE || homedir(), ".claude");
const LEARNING_DIR = path.join(CLAUDE_DIR, "MEMORY", "LEARNING");
const RATINGS_FILE = path.join(LEARNING_DIR, "SIGNALS", "ratings.jsonl");
const SYNTHESIS_DIR = path.join(LEARNING_DIR, "SYNTHESIS");
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/NeofetchBanner.ts b/Releases/v2.5/.claude/skills/PAI/Tools/NeofetchBanner.ts
index 24813ca6..da2574af 100755
--- a/Releases/v2.5/.claude/skills/PAI/Tools/NeofetchBanner.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/NeofetchBanner.ts
@@ -18,8 +18,9 @@
import { readdirSync, existsSync, readFileSync } from "fs";
import { join } from "path";
import { spawnSync } from "child_process";
+import { homedir } from "os";
-const HOME = process.env.HOME!;
+const HOME = process.env.HOME || process.env.USERPROFILE || homedir();
const CLAUDE_DIR = join(HOME, ".claude");
// ═══════════════════════════════════════════════════════════════════════
@@ -31,6 +32,11 @@ type DisplayMode = "compact" | "normal" | "wide";
function getTerminalWidth(): number {
let width: number | null = null;
+ // Tier 0: process.stdout.columns (cross-platform, works on Windows)
+ if (process.stdout.columns) {
+ return process.stdout.columns;
+ }
+
// Tier 1: Kitty IPC
const kittyWindowId = process.env.KITTY_WINDOW_ID;
if (kittyWindowId) {
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/OpinionTracker.ts b/Releases/v2.5/.claude/skills/PAI/Tools/OpinionTracker.ts
index 1311c752..2c184446 100644
--- a/Releases/v2.5/.claude/skills/PAI/Tools/OpinionTracker.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/OpinionTracker.ts
@@ -23,8 +23,9 @@
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
import { join } from 'path';
+import { homedir } from 'os';
-const PAI_DIR = process.env.PAI_DIR || join(process.env.HOME!, '.claude');
+const PAI_DIR = process.env.PAI_DIR || join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude');
const OPINIONS_FILE = join(PAI_DIR, 'skills/PAI/USER/OPINIONS.md');
const RELATIONSHIP_LOG = join(PAI_DIR, 'MEMORY/RELATIONSHIP');
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/RelationshipReflect.ts b/Releases/v2.5/.claude/skills/PAI/Tools/RelationshipReflect.ts
index f6b6172c..58a1c726 100644
--- a/Releases/v2.5/.claude/skills/PAI/Tools/RelationshipReflect.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/RelationshipReflect.ts
@@ -28,8 +28,9 @@
import { readFileSync, writeFileSync, existsSync, readdirSync, mkdirSync } from 'fs';
import { join } from 'path';
import { execSync } from 'child_process';
+import { homedir } from 'os';
-const PAI_DIR = process.env.PAI_DIR || join(process.env.HOME!, '.claude');
+const PAI_DIR = process.env.PAI_DIR || join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude');
interface RelationshipNote {
type: 'W' | 'B' | 'O';
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/RemoveBg.ts b/Releases/v2.5/.claude/skills/PAI/Tools/RemoveBg.ts
index 4549ef66..a7ae71ba 100755
--- a/Releases/v2.5/.claude/skills/PAI/Tools/RemoveBg.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/RemoveBg.ts
@@ -17,13 +17,14 @@
import { readFile, writeFile } from "node:fs/promises";
import { resolve } from "node:path";
import { existsSync } from "node:fs";
+import { homedir } from "node:os";
// ============================================================================
// Environment Loading
// ============================================================================
async function loadEnv(): Promise<void> {
- const envPath = resolve(process.env.HOME!, ".claude/.env");
+ const envPath = resolve(process.env.HOME || process.env.USERPROFILE || homedir(), ".claude/.env");
try {
const envContent = await readFile(envPath, "utf-8");
for (const line of envContent.split("\n")) {
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/SessionHarvester.ts b/Releases/v2.5/.claude/skills/PAI/Tools/SessionHarvester.ts
index 11de80ab..1fe96adb 100755
--- a/Releases/v2.5/.claude/skills/PAI/Tools/SessionHarvester.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/SessionHarvester.ts
@@ -19,13 +19,14 @@
import { parseArgs } from "util";
import * as fs from "fs";
import * as path from "path";
+import { homedir } from "os";
import { getLearningCategory, isLearningCapture } from "../../../hooks/lib/learning-utils";
// ============================================================================
// Configuration
// ============================================================================
-const CLAUDE_DIR = path.join(process.env.HOME!, ".claude");
+const CLAUDE_DIR = path.join(process.env.HOME || process.env.USERPROFILE || homedir(), ".claude");
const USERNAME = process.env.USER || require("os").userInfo().username;
const PROJECTS_DIR = path.join(CLAUDE_DIR, "projects", `-Users-${USERNAME}--claude`);
const LEARNING_DIR = path.join(CLAUDE_DIR, "MEMORY", "LEARNING");
diff --git a/Releases/v2.5/.claude/skills/PAI/Tools/SessionProgress.ts b/Releases/v2.5/.claude/skills/PAI/Tools/SessionProgress.ts
index 6c0d256b..ead9444d 100755
--- a/Releases/v2.5/.claude/skills/PAI/Tools/SessionProgress.ts
+++ b/Releases/v2.5/.claude/skills/PAI/Tools/SessionProgress.ts
@@ -11,6 +11,7 @@
import { existsSync, readFileSync, writeFileSync, readdirSync } from 'fs';
import { join } from 'path';
+import { homedir } from 'os';
interface Decision {
timestamp: string;
@@ -44,7 +45,7 @@ interface SessionProgress {
}
// Progress files are now in STATE/progress/ (consolidated from MEMORY/PROGRESS/)
-const PROGRESS_DIR = join(process.env.HOME || '', '.claude', 'MEMORY', 'STATE', 'progress');
+const PROGRESS_DIR = join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude', 'MEMORY', 'STATE', 'progress');
function getProgressPath(project: string): string {
return join(PROGRESS_DIR, `${project}-progress.json`);
diff --git a/Releases/v2.5/.claude/skills/Recon/Tools/BountyPrograms.ts b/Releases/v2.5/.claude/skills/Recon/Tools/BountyPrograms.ts
index 23ef2c4d..e88546ce 100755
--- a/Releases/v2.5/.claude/skills/Recon/Tools/BountyPrograms.ts
+++ b/Releases/v2.5/.claude/skills/Recon/Tools/BountyPrograms.ts
@@ -21,6 +21,8 @@
*/
import { $ } from "bun";
+import { homedir } from "os";
+import { join } from "path";
interface BountyProgram {
name: string;
@@ -46,7 +48,7 @@ interface BountyProgramsResult {
const CHAOS_BOUNTY_URL = "https://raw.githubusercontent.com/projectdiscovery/public-bugbounty-programs/main/chaos-bugbounty-list.json";
// Local cache path
-const CACHE_DIR = `${process.env.HOME}/.claude/skills/Recon/Data`;
+const CACHE_DIR = join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude', 'skills', 'Recon', 'Data');
const CACHE_FILE = `${CACHE_DIR}/BountyPrograms.json`;
const CACHE_MAX_AGE_HOURS = 24;
diff --git a/Releases/v2.5/.claude/skills/Recon/Tools/PathDiscovery.ts b/Releases/v2.5/.claude/skills/Recon/Tools/PathDiscovery.ts
index 8f1311d9..b77487e5 100755
--- a/Releases/v2.5/.claude/skills/Recon/Tools/PathDiscovery.ts
+++ b/Releases/v2.5/.claude/skills/Recon/Tools/PathDiscovery.ts
@@ -14,6 +14,8 @@
*/
import { $ } from "bun";
+import { homedir } from "os";
+import { join } from "path";
interface PathDiscoveryOptions {
wordlist?: string;
@@ -60,7 +62,7 @@ const DEFAULT_WORDLISTS = [
"/opt/homebrew/share/seclists/Discovery/Web-Content/raft-medium-directories.txt",
"/usr/share/seclists/Discovery/Web-Content/raft-medium-directories.txt",
"/opt/seclists/Discovery/Web-Content/raft-medium-directories.txt",
- `${process.env.HOME}/wordlists/raft-medium-directories.txt`,
+ join(process.env.HOME || process.env.USERPROFILE || homedir(), 'wordlists', 'raft-medium-directories.txt'),
];
async function findWordlist(customPath?: string): Promise<string | null> {
diff --git a/Releases/v2.5/.claude/skills/Telos/Tools/UpdateTelos.ts b/Releases/v2.5/.claude/skills/Telos/Tools/UpdateTelos.ts
index 349aea62..d149c40b 100755
--- a/Releases/v2.5/.claude/skills/Telos/Tools/UpdateTelos.ts
+++ b/Releases/v2.5/.claude/skills/Telos/Tools/UpdateTelos.ts
@@ -36,9 +36,10 @@
import { readFileSync, writeFileSync, copyFileSync, existsSync } from 'fs';
import { join } from 'path';
+import { homedir } from 'os';
import { getPrincipal } from '../../../hooks/lib/identity';
-const TELOS_DIR = join(process.env.HOME!, '.claude', 'context', 'life', 'telos');
+const TELOS_DIR = join(process.env.HOME || process.env.USERPROFILE || homedir(), '.claude', 'context', 'life', 'telos');
const BACKUPS_DIR = join(TELOS_DIR, 'backups');
const UPDATES_FILE = join(TELOS_DIR, 'updates.md');