⛰️ LifeOS — The AI-powered Life Operating System that helps you hill climb to wherever you're going.
fix: expand literal $HOME in env path vars (LIFEOS_DIR / LIFEOS_CONFIG_DIR / PROJECTS_DIR) — closes the #1404 shadow-directory bug (#1451)
jbmml76ba604646b8
diff --git a/LifeOS/Tools/LinkUser.ts b/LifeOS/Tools/LinkUser.tsindex 86d80b7d..7d059341 100755--- a/LifeOS/Tools/LinkUser.ts+++ b/LifeOS/Tools/LinkUser.ts@@ -13,6 +13,13 @@import { join } from "node:path";import { checkSymlinkContract, detectDevTree, setupUserSeparation } from "./InstallEngine";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++function main(): void {const a = process.argv.slice(2);const get = (f: string): string | undefined => {diff --git a/LifeOS/Tools/ScaffoldUser.ts b/LifeOS/Tools/ScaffoldUser.tsindex c2cebe17..0c0635e7 100755--- a/LifeOS/Tools/ScaffoldUser.ts+++ b/LifeOS/Tools/ScaffoldUser.ts@@ -13,6 +13,13 @@ import { existsSync } from "node:fs";import { join } from "node:path";import { copyMissing, detectDevTree } from "./InstallEngine";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++function main(): void {const a = process.argv.slice(2);const get = (f: string): string | undefined => {diff --git a/LifeOS/Tools/SeedPulse.ts b/LifeOS/Tools/SeedPulse.tsindex 89395b8a..8411fc82 100755--- a/LifeOS/Tools/SeedPulse.ts+++ b/LifeOS/Tools/SeedPulse.ts@@ -15,6 +15,13 @@ import { existsSync } from "node:fs";import { join } from "node:path";import { detectDevTree } from "./InstallEngine";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const GENERATORS = ["GenerateTelosSummary.ts", "UpdateLifeosState.ts"];function main(): void {diff --git a/LifeOS/install/LIFEOS/LIFEOS_INSTALL/engine/detect.ts b/LifeOS/install/LIFEOS/LIFEOS_INSTALL/engine/detect.tsindex e32f78eb..29c88333 100644--- a/LifeOS/install/LIFEOS/LIFEOS_INSTALL/engine/detect.ts+++ b/LifeOS/install/LIFEOS/LIFEOS_INSTALL/engine/detect.ts@@ -10,6 +10,13 @@ import { homedir } from "os";import { join, resolve } from "path";import type { DetectionResult, ExistingUserContentDetection } from "./types";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++function tryExec(cmd: string): string | null {try {return execSync(cmd, { timeout: 5000, stdio: ["pipe", "pipe", "pipe"] })diff --git a/LifeOS/install/LIFEOS/LIFEOS_INSTALL/engine/state.ts b/LifeOS/install/LIFEOS/LIFEOS_INSTALL/engine/state.tsindex 6540729e..8cd41212 100644--- a/LifeOS/install/LIFEOS/LIFEOS_INSTALL/engine/state.ts+++ b/LifeOS/install/LIFEOS/LIFEOS_INSTALL/engine/state.ts@@ -9,6 +9,13 @@ import { join, dirname } from "path";import type { InstallState, StepId } from "./types";import { INSTALLER_VERSION } from "./types";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const STATE_FILE = join(process.env.LIFEOS_CONFIG_DIR || join(homedir(), ".config", "LifeOS"),"LIFEOS_INSTALL",diff --git a/LifeOS/install/LIFEOS/LIFEOS_StatusLine.sh b/LifeOS/install/LIFEOS/LIFEOS_StatusLine.shindex c256405d..55200c5f 100755--- a/LifeOS/install/LIFEOS/LIFEOS_StatusLine.sh+++ b/LifeOS/install/LIFEOS/LIFEOS_StatusLine.sh@@ -12,6 +12,11 @@ set -o pipefail# ─────────────────────────────────────────────────────────────────────────────LIFEOS_DIR="${LIFEOS_DIR:-$HOME/.claude/LIFEOS}"+# Claude Code injects settings.json env values without shell expansion (LifeOS#1404):+# a shipped value of "$HOME/.claude/LIFEOS" arrives literal. Expand it here.+LIFEOS_DIR="${LIFEOS_DIR/#\$HOME/$HOME}"+LIFEOS_DIR="${LIFEOS_DIR/#\$\{HOME\}/$HOME}"+LIFEOS_DIR="${LIFEOS_DIR/#\~\//$HOME/}"CLAUDE_HOME="$HOME/.claude"SETTINGS_FILE="$CLAUDE_HOME/settings.json"RATINGS_FILE="$LIFEOS_DIR/MEMORY/LEARNING/SIGNALS/ratings.jsonl"diff --git a/LifeOS/install/LIFEOS/PULSE/Observability/observability.ts b/LifeOS/install/LIFEOS/PULSE/Observability/observability.tsindex e5ea2fee..c2e306d4 100644--- a/LifeOS/install/LIFEOS/PULSE/Observability/observability.ts+++ b/LifeOS/install/LIFEOS/PULSE/Observability/observability.ts@@ -26,6 +26,13 @@ import { join, extname } from "path"import { readFileSync, readdirSync, existsSync, realpathSync, statSync, watch, type FSWatcher } from "fs"import YAML from "yaml"import { effortToCanonicalTierName } from "../../../hooks/lib/effort"++// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}+// Growth is an OPTIONAL USER customization (USER/CUSTOMIZATIONS/TOOLS/Growth.ts): present on the// principal's machine, absent on fresh installs (private code, not shipped). It is loaded via a// guarded dynamic import in handleLifeGrowth so the Pulse server boots without it. A static importdiff --git a/LifeOS/install/LIFEOS/PULSE/checks/notification-governor.ts b/LifeOS/install/LIFEOS/PULSE/checks/notification-governor.tsindex a3b04fc8..5335ebf8 100755--- a/LifeOS/install/LIFEOS/PULSE/checks/notification-governor.ts+++ b/LifeOS/install/LIFEOS/PULSE/checks/notification-governor.ts@@ -32,6 +32,13 @@ import { readFileSync, writeFileSync, existsSync, mkdirSync, appendFileSync } frimport { join, dirname } from "path";import { createHash } from "crypto";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const STATE_FILE = join(LIFEOS_DIR, "PULSE", "state", "notification-governor.json");diff --git a/LifeOS/install/LIFEOS/PULSE/checks/poller-meta-monitor.ts b/LifeOS/install/LIFEOS/PULSE/checks/poller-meta-monitor.tsindex 22f68d3a..ee3cf253 100755--- a/LifeOS/install/LIFEOS/PULSE/checks/poller-meta-monitor.ts+++ b/LifeOS/install/LIFEOS/PULSE/checks/poller-meta-monitor.ts@@ -18,6 +18,13 @@import { readFileSync, existsSync } from "fs";import { join } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const PULSE_STATE = join(LIFEOS_DIR, "PULSE", "state", "state.json");diff --git a/LifeOS/install/LIFEOS/PULSE/modules/hypotheses.ts b/LifeOS/install/LIFEOS/PULSE/modules/hypotheses.tsindex 2743310b..02303d8f 100644--- a/LifeOS/install/LIFEOS/PULSE/modules/hypotheses.ts+++ b/LifeOS/install/LIFEOS/PULSE/modules/hypotheses.ts@@ -27,6 +27,13 @@import { existsSync, readFileSync, readdirSync, writeFileSync, unlinkSync, mkdirSync } from "fs";import { join } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const FRAMES_DIR = join(LIFEOS_DIR, "MEMORY", "WISDOM", "FRAMES");diff --git a/LifeOS/install/LIFEOS/PULSE/modules/user-index.ts b/LifeOS/install/LIFEOS/PULSE/modules/user-index.tsindex 6446e6fb..02278b6c 100644--- a/LifeOS/install/LIFEOS/PULSE/modules/user-index.ts+++ b/LifeOS/install/LIFEOS/PULSE/modules/user-index.ts@@ -22,6 +22,13 @@import { readFileSync, writeFileSync, statSync, readdirSync, mkdirSync, existsSync, watch } from "fs"import { join, relative, basename, dirname } from "path"+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME ?? ""const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS")const USER_DIR = join(LIFEOS_DIR, "USER")diff --git a/LifeOS/install/LIFEOS/PULSE/modules/work.ts b/LifeOS/install/LIFEOS/PULSE/modules/work.tsindex 6191c2f4..c8fb9b8d 100644--- a/LifeOS/install/LIFEOS/PULSE/modules/work.ts+++ b/LifeOS/install/LIFEOS/PULSE/modules/work.ts@@ -25,6 +25,13 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync, statSync } from "fsimport { join } from "path";import { loadWorkConfig, type WorkConfig } from "../../../hooks/lib/work-config";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const PULSE_STATE_DIR = join(LIFEOS_DIR, "PULSE", "state");diff --git a/LifeOS/install/LIFEOS/TOOLS/AgentWatchdog.ts b/LifeOS/install/LIFEOS/TOOLS/AgentWatchdog.tsindex 8987e29d..22c3bdb3 100755--- a/LifeOS/install/LIFEOS/TOOLS/AgentWatchdog.ts+++ b/LifeOS/install/LIFEOS/TOOLS/AgentWatchdog.ts@@ -20,6 +20,13 @@import { existsSync, readFileSync, statSync } from "fs";import { join } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const LIFEOS_DIR = process.env.LIFEOS_DIR || join(process.env.HOME!, ".claude", "LIFEOS");const OBS_DIR = join(LIFEOS_DIR, "MEMORY", "OBSERVABILITY");const ACTIVITY_FILE = join(OBS_DIR, "tool-activity.jsonl");diff --git a/LifeOS/install/LIFEOS/TOOLS/ApproveCurrentStateEntries.ts b/LifeOS/install/LIFEOS/TOOLS/ApproveCurrentStateEntries.tsindex 79870037..216e122e 100755--- a/LifeOS/install/LIFEOS/TOOLS/ApproveCurrentStateEntries.ts+++ b/LifeOS/install/LIFEOS/TOOLS/ApproveCurrentStateEntries.ts@@ -19,6 +19,13 @@import { readFileSync, writeFileSync, existsSync } from "fs";import { join } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const QUEUE_FILE = join(LIFEOS_DIR, "USER", "TELOS", "CURRENT_STATE", "proposals.jsonl");diff --git a/LifeOS/install/LIFEOS/TOOLS/ArchDecisionHarvest.ts b/LifeOS/install/LIFEOS/TOOLS/ArchDecisionHarvest.tsindex 47d9467a..8cee9fc8 100755--- a/LifeOS/install/LIFEOS/TOOLS/ArchDecisionHarvest.ts+++ b/LifeOS/install/LIFEOS/TOOLS/ArchDecisionHarvest.ts@@ -19,6 +19,13 @@ import * as fs from "fs";import * as path from "path";import * as os from "os";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++// ============================================================================// Configuration// ============================================================================diff --git a/LifeOS/install/LIFEOS/TOOLS/ArchitectureSummaryGenerator.ts b/LifeOS/install/LIFEOS/TOOLS/ArchitectureSummaryGenerator.tsindex e8e65f8d..1bc416c8 100755--- a/LifeOS/install/LIFEOS/TOOLS/ArchitectureSummaryGenerator.ts+++ b/LifeOS/install/LIFEOS/TOOLS/ArchitectureSummaryGenerator.ts@@ -15,6 +15,13 @@ import { parseArgs } from "util";import * as fs from "fs";import * as path from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++// ============================================================================// Configuration// ============================================================================diff --git a/LifeOS/install/LIFEOS/TOOLS/BookmarkSweep.ts b/LifeOS/install/LIFEOS/TOOLS/BookmarkSweep.tsindex 2fda61d1..9fadeeab 100755--- a/LifeOS/install/LIFEOS/TOOLS/BookmarkSweep.ts+++ b/LifeOS/install/LIFEOS/TOOLS/BookmarkSweep.ts@@ -22,6 +22,13 @@import { existsSync, readFileSync, writeFileSync, mkdirSync, appendFileSync, renameSync } from "fs";import { join } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++declare const Bun: { spawn: (cmd: string[], opts?: any) => any };const HOME = process.env.HOME || "";diff --git a/LifeOS/install/LIFEOS/TOOLS/CommitmentSweep.ts b/LifeOS/install/LIFEOS/TOOLS/CommitmentSweep.tsindex 7b5c3a92..d0b63659 100755--- a/LifeOS/install/LIFEOS/TOOLS/CommitmentSweep.ts+++ b/LifeOS/install/LIFEOS/TOOLS/CommitmentSweep.ts@@ -24,6 +24,13 @@ import { join } from "path";import { spawnSync } from "child_process";import { loadWorkConfig } from "../../hooks/lib/work-config";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const OBS_DIR = join(LIFEOS_DIR, "MEMORY", "OBSERVABILITY");diff --git a/LifeOS/install/LIFEOS/TOOLS/ComputeGap.ts b/LifeOS/install/LIFEOS/TOOLS/ComputeGap.tsindex 76606bba..35ca5856 100755--- a/LifeOS/install/LIFEOS/TOOLS/ComputeGap.ts+++ b/LifeOS/install/LIFEOS/TOOLS/ComputeGap.ts@@ -23,6 +23,13 @@import { readFileSync, existsSync, appendFileSync, mkdirSync } from "fs";import { join, dirname } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const IDEAL_DIR = join(LIFEOS_DIR, "USER", "TELOS", "IDEAL_STATE");diff --git a/LifeOS/install/LIFEOS/TOOLS/ContextAudit.ts b/LifeOS/install/LIFEOS/TOOLS/ContextAudit.tsindex 3357f622..1b6c8d07 100755--- a/LifeOS/install/LIFEOS/TOOLS/ContextAudit.ts+++ b/LifeOS/install/LIFEOS/TOOLS/ContextAudit.ts@@ -12,6 +12,13 @@ import { basename, dirname, join } from "path";import { CONTEXT_FRESHNESS_REGISTRY, parseFrontmatter, type ContextFile } from "./TelosFreshness";import { currentModel } from "./models";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const CLAUDE_DIR = dirname(LIFEOS_DIR);diff --git a/LifeOS/install/LIFEOS/TOOLS/FailureCapture.ts b/LifeOS/install/LIFEOS/TOOLS/FailureCapture.tsindex 70f5bacd..4b9bbc18 100644--- a/LifeOS/install/LIFEOS/TOOLS/FailureCapture.ts+++ b/LifeOS/install/LIFEOS/TOOLS/FailureCapture.ts@@ -29,6 +29,13 @@ import { existsSync, mkdirSync, readFileSync, writeFileSync, copyFileSync } fromimport { join, basename } from 'path';import { inference } from './Inference';+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const LIFEOS_DIR = process.env.LIFEOS_DIR || join(process.env.HOME!, '.claude');interface FailureCaptureInput {diff --git a/LifeOS/install/LIFEOS/TOOLS/FreshnessCache.ts b/LifeOS/install/LIFEOS/TOOLS/FreshnessCache.tsindex 1e2c1233..9d1ff9c9 100755--- a/LifeOS/install/LIFEOS/TOOLS/FreshnessCache.ts+++ b/LifeOS/install/LIFEOS/TOOLS/FreshnessCache.ts@@ -16,6 +16,13 @@ import { writeFileSync, renameSync, mkdirSync, existsSync } from "fs";import { join } from "path";import { readContextFreshness } from "./TelosFreshness";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const CACHE_DIR = join(LIFEOS_DIR, "USER", "CACHE");diff --git a/LifeOS/install/LIFEOS/TOOLS/GetCounts.ts b/LifeOS/install/LIFEOS/TOOLS/GetCounts.tsindex 61c0e7d3..a6206493 100755--- a/LifeOS/install/LIFEOS/TOOLS/GetCounts.ts+++ b/LifeOS/install/LIFEOS/TOOLS/GetCounts.ts@@ -36,6 +36,13 @@import { readdirSync, existsSync, statSync } from "fs";import { join } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME!;const CLAUDE_DIR = join(HOME, ".claude");// skills/, hooks/, settings.json live under CLAUDE_DIR.diff --git a/LifeOS/install/LIFEOS/TOOLS/Grok.ts b/LifeOS/install/LIFEOS/TOOLS/Grok.tsindex 2607d572..ea9d4338 100755--- a/LifeOS/install/LIFEOS/TOOLS/Grok.ts+++ b/LifeOS/install/LIFEOS/TOOLS/Grok.ts@@ -41,6 +41,13 @@ import { readFileSync } from 'fs'import { homedir } from 'os'import { join } from 'path'+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const colors = {reset: '\x1b[0m', bold: '\x1b[1m', dim: '\x1b[2m',red: '\x1b[31m', green: '\x1b[32m', yellow: '\x1b[33m', cyan: '\x1b[36m',diff --git a/LifeOS/install/LIFEOS/TOOLS/InterviewIdealState.ts b/LifeOS/install/LIFEOS/TOOLS/InterviewIdealState.tsindex bd731855..fefa897c 100755--- a/LifeOS/install/LIFEOS/TOOLS/InterviewIdealState.ts+++ b/LifeOS/install/LIFEOS/TOOLS/InterviewIdealState.ts@@ -18,6 +18,13 @@import { readFileSync, writeFileSync, existsSync, readdirSync } from "fs";import { join } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const TELOS_DIR = join(LIFEOS_DIR, "USER", "TELOS");diff --git a/LifeOS/install/LIFEOS/TOOLS/InterviewScan.ts b/LifeOS/install/LIFEOS/TOOLS/InterviewScan.tsindex 956aecc4..e464440e 100755--- a/LifeOS/install/LIFEOS/TOOLS/InterviewScan.ts+++ b/LifeOS/install/LIFEOS/TOOLS/InterviewScan.ts@@ -20,6 +20,13 @@ import { readFileSync, existsSync } from "fs";import { join } from "path";import { readTelosFreshness, sectionSlug, type SectionFreshness } from "./TelosFreshness";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const USER_DIR = join(LIFEOS_DIR, "USER");diff --git a/LifeOS/install/LIFEOS/TOOLS/KnowledgeGraph.ts b/LifeOS/install/LIFEOS/TOOLS/KnowledgeGraph.tsindex e4f31778..5dca1583 100755--- a/LifeOS/install/LIFEOS/TOOLS/KnowledgeGraph.ts+++ b/LifeOS/install/LIFEOS/TOOLS/KnowledgeGraph.ts@@ -27,6 +27,13 @@ import { parseArgs } from "util";import * as fs from "fs";import * as path from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++// ============================================================================// Configuration// ============================================================================diff --git a/LifeOS/install/LIFEOS/TOOLS/KnowledgeHarvester.ts b/LifeOS/install/LIFEOS/TOOLS/KnowledgeHarvester.tsindex 9bed8d34..b5d544b9 100755--- a/LifeOS/install/LIFEOS/TOOLS/KnowledgeHarvester.ts+++ b/LifeOS/install/LIFEOS/TOOLS/KnowledgeHarvester.ts@@ -22,6 +22,13 @@ import { parseArgs } from "util";import * as fs from "fs";import * as path from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++// ============================================================================// Configuration// ============================================================================diff --git a/LifeOS/install/LIFEOS/TOOLS/MemoryGraph.ts b/LifeOS/install/LIFEOS/TOOLS/MemoryGraph.tsindex 06c7385f..a7272cec 100755--- a/LifeOS/install/LIFEOS/TOOLS/MemoryGraph.ts+++ b/LifeOS/install/LIFEOS/TOOLS/MemoryGraph.ts@@ -28,6 +28,13 @@ import pagerank from "graphology-metrics/centrality/pagerank";import * as fs from "fs";import * as path from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME!;const LIFEOS_DIR = process.env.LIFEOS_DIR || path.join(HOME, ".claude", "LIFEOS");const MEMORY = path.join(LIFEOS_DIR, "MEMORY");diff --git a/LifeOS/install/LIFEOS/TOOLS/MemoryRetriever.ts b/LifeOS/install/LIFEOS/TOOLS/MemoryRetriever.tsindex 182daf74..b738ccba 100755--- a/LifeOS/install/LIFEOS/TOOLS/MemoryRetriever.ts+++ b/LifeOS/install/LIFEOS/TOOLS/MemoryRetriever.ts@@ -36,6 +36,13 @@ import * as fs from "fs";import * as path from "path";import { spawnSync } from "child_process";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++// ============================================================================// Configuration// ============================================================================diff --git a/LifeOS/install/LIFEOS/TOOLS/MigrateApprove.ts b/LifeOS/install/LIFEOS/TOOLS/MigrateApprove.tsindex f49c8478..f6ba0383 100755--- a/LifeOS/install/LIFEOS/TOOLS/MigrateApprove.ts+++ b/LifeOS/install/LIFEOS/TOOLS/MigrateApprove.ts@@ -25,6 +25,13 @@import { readFileSync, writeFileSync, existsSync, appendFileSync, mkdirSync } from "fs";import { join, dirname } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const QUEUE_FILE = join(LIFEOS_DIR, "MEMORY", "MIGRATION", "migration-proposals.jsonl");diff --git a/LifeOS/install/LIFEOS/TOOLS/MigrateContextFreshness.ts b/LifeOS/install/LIFEOS/TOOLS/MigrateContextFreshness.tsindex 705bf5ec..c6d065e3 100755--- a/LifeOS/install/LIFEOS/TOOLS/MigrateContextFreshness.ts+++ b/LifeOS/install/LIFEOS/TOOLS/MigrateContextFreshness.ts@@ -18,6 +18,13 @@ import {type ContextFile,} from "./TelosFreshness";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const CLAUDE_DIR = dirname(LIFEOS_DIR);diff --git a/LifeOS/install/LIFEOS/TOOLS/MigrateScan.ts b/LifeOS/install/LIFEOS/TOOLS/MigrateScan.tsindex 8a34eb94..cca1c6e2 100755--- a/LifeOS/install/LIFEOS/TOOLS/MigrateScan.ts+++ b/LifeOS/install/LIFEOS/TOOLS/MigrateScan.ts@@ -23,6 +23,13 @@ import { readFileSync, writeFileSync, existsSync, readdirSync, statSync, mkdirSyimport { join, basename, dirname, extname } from "path";import { randomUUID } from "crypto";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const QUEUE_FILE = join(LIFEOS_DIR, "MEMORY", "MIGRATION", "migration-proposals.jsonl");diff --git a/LifeOS/install/LIFEOS/TOOLS/MigrateTelosFreshness.ts b/LifeOS/install/LIFEOS/TOOLS/MigrateTelosFreshness.tsindex 2e0dca3c..a6fb7ba0 100755--- a/LifeOS/install/LIFEOS/TOOLS/MigrateTelosFreshness.ts+++ b/LifeOS/install/LIFEOS/TOOLS/MigrateTelosFreshness.ts@@ -23,6 +23,13 @@ import { readFileSync, writeFileSync, existsSync, mkdirSync, copyFileSync } fromimport { createHash } from "crypto";import { join } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const TELOS_PATH = join(LIFEOS_DIR, "USER", "TELOS", "TELOS.md");diff --git a/LifeOS/install/LIFEOS/TOOLS/PangramScore.ts b/LifeOS/install/LIFEOS/TOOLS/PangramScore.tsindex c29c6d20..90113436 100755--- a/LifeOS/install/LIFEOS/TOOLS/PangramScore.ts+++ b/LifeOS/install/LIFEOS/TOOLS/PangramScore.ts@@ -21,6 +21,13 @@ import { readFileSync, appendFileSync, mkdirSync } from "node:fs";import { createHash } from "node:crypto";import { dirname, join } from "node:path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const ENV_PATH = `${process.env.HOME}/.claude/.env`;// Run-record: proof the detector actually executed on a specific text. Thediff --git a/LifeOS/install/LIFEOS/TOOLS/ProposeCurrentStateEntry.ts b/LifeOS/install/LIFEOS/TOOLS/ProposeCurrentStateEntry.tsindex 9fe226ac..2ac621ba 100755--- a/LifeOS/install/LIFEOS/TOOLS/ProposeCurrentStateEntry.ts+++ b/LifeOS/install/LIFEOS/TOOLS/ProposeCurrentStateEntry.ts@@ -21,6 +21,13 @@ import { appendFileSync, mkdirSync, existsSync } from "fs";import { join, dirname } from "path";import { randomUUID } from "crypto";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const QUEUE_FILE = join(LIFEOS_DIR, "USER", "TELOS", "CURRENT_STATE", "proposals.jsonl");diff --git a/LifeOS/install/LIFEOS/TOOLS/Recommend.ts b/LifeOS/install/LIFEOS/TOOLS/Recommend.tsindex e3dbc2b4..402c3cba 100755--- a/LifeOS/install/LIFEOS/TOOLS/Recommend.ts+++ b/LifeOS/install/LIFEOS/TOOLS/Recommend.ts@@ -17,6 +17,13 @@import { readFileSync, existsSync } from "fs";import { join } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const TELOS_DIR = join(LIFEOS_DIR, "USER", "TELOS");diff --git a/LifeOS/install/LIFEOS/TOOLS/TelosFreshness.ts b/LifeOS/install/LIFEOS/TOOLS/TelosFreshness.tsindex 7dc3dca4..81a71ce5 100755--- a/LifeOS/install/LIFEOS/TOOLS/TelosFreshness.ts+++ b/LifeOS/install/LIFEOS/TOOLS/TelosFreshness.ts@@ -25,6 +25,13 @@import { readFileSync, writeFileSync, existsSync } from "fs";import { basename, join } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const TELOS_PATH = join(LIFEOS_DIR, "USER", "TELOS", "TELOS.md");diff --git a/LifeOS/install/LIFEOS/TOOLS/UpdateLifeosState.ts b/LifeOS/install/LIFEOS/TOOLS/UpdateLifeosState.tsindex 0ccef197..04cac7e8 100755--- a/LifeOS/install/LIFEOS/TOOLS/UpdateLifeosState.ts+++ b/LifeOS/install/LIFEOS/TOOLS/UpdateLifeosState.ts@@ -29,6 +29,13 @@import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";import { join, dirname } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const HOME = process.env.HOME || "";const LIFEOS_DIR = process.env.LIFEOS_DIR || join(HOME, ".claude", "LIFEOS");const IDEAL_DIR = join(LIFEOS_DIR, "USER", "TELOS", "IDEAL_STATE");diff --git a/LifeOS/install/LIFEOS/TOOLS/WisdomCrossFrameSynthesizer.ts b/LifeOS/install/LIFEOS/TOOLS/WisdomCrossFrameSynthesizer.tsindex e542035e..f32859de 100644--- a/LifeOS/install/LIFEOS/TOOLS/WisdomCrossFrameSynthesizer.ts+++ b/LifeOS/install/LIFEOS/TOOLS/WisdomCrossFrameSynthesizer.ts@@ -18,6 +18,13 @@ import { existsSync, readdirSync, readFileSync, writeFileSync, mkdirSync } fromimport { join, basename } from 'path';import { parseArgs } from 'util';+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const BASE_DIR = process.env.LIFEOS_DIR || join(process.env.HOME!, '.claude');const WISDOM_DIR = join(BASE_DIR, 'MEMORY', 'WISDOM');const FRAMES_DIR = join(WISDOM_DIR, 'FRAMES');diff --git a/LifeOS/install/LIFEOS/TOOLS/WisdomDomainClassifier.ts b/LifeOS/install/LIFEOS/TOOLS/WisdomDomainClassifier.tsindex 84dcf3fe..09688d83 100644--- a/LifeOS/install/LIFEOS/TOOLS/WisdomDomainClassifier.ts+++ b/LifeOS/install/LIFEOS/TOOLS/WisdomDomainClassifier.ts@@ -17,6 +17,13 @@ import { existsSync, readdirSync, readFileSync } from 'fs';import { join, basename } from 'path';import { parseArgs } from 'util';+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const BASE_DIR = process.env.LIFEOS_DIR || join(process.env.HOME!, '.claude');const FRAMES_DIR = join(BASE_DIR, 'MEMORY', 'WISDOM', 'FRAMES');diff --git a/LifeOS/install/LIFEOS/TOOLS/WisdomFrameUpdater.ts b/LifeOS/install/LIFEOS/TOOLS/WisdomFrameUpdater.tsindex 41d0386a..f1e19c15 100644--- a/LifeOS/install/LIFEOS/TOOLS/WisdomFrameUpdater.ts+++ b/LifeOS/install/LIFEOS/TOOLS/WisdomFrameUpdater.ts@@ -19,6 +19,13 @@ import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';import { join } from 'path';import { parseArgs } from 'util';+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const BASE_DIR = process.env.LIFEOS_DIR || join(process.env.HOME!, '.claude');const FRAMES_DIR = join(BASE_DIR, 'MEMORY', 'WISDOM', 'FRAMES');diff --git a/LifeOS/install/LIFEOS/TOOLS/WorkSweep.ts b/LifeOS/install/LIFEOS/TOOLS/WorkSweep.tsindex 9819379c..806c79f4 100755--- a/LifeOS/install/LIFEOS/TOOLS/WorkSweep.ts+++ b/LifeOS/install/LIFEOS/TOOLS/WorkSweep.ts@@ -28,6 +28,13 @@ import { existsSync, readFileSync, writeFileSync, readdirSync, statSync, mkdirSyimport { join } from "path";import { loadWorkConfig } from "../../hooks/lib/work-config";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++declare const Bun: { spawn: (cmd: string[], opts?: any) => any };const HOME = process.env.HOME || "";diff --git a/LifeOS/install/LIFEOS/TOOLS/YouTubeApi.ts b/LifeOS/install/LIFEOS/TOOLS/YouTubeApi.tsindex c3813a78..f75dfc2e 100755--- a/LifeOS/install/LIFEOS/TOOLS/YouTubeApi.ts+++ b/LifeOS/install/LIFEOS/TOOLS/YouTubeApi.ts@@ -23,6 +23,13 @@ import { readFileSync } from 'fs'import { homedir } from 'os'import { join } from 'path'+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++// ANSI colorsconst colors = {reset: '\x1b[0m',diff --git a/LifeOS/install/LIFEOS/TOOLS/algorithm.ts b/LifeOS/install/LIFEOS/TOOLS/algorithm.tsindex 609a8a28..296bb39e 100644--- a/LifeOS/install/LIFEOS/TOOLS/algorithm.ts+++ b/LifeOS/install/LIFEOS/TOOLS/algorithm.ts@@ -52,6 +52,13 @@ import { spawnSync, spawn } from "child_process";import { randomUUID } from "crypto";import { generateISATemplate } from "../../../.claude/hooks/lib/isa-template";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++// ─── Paths ───────────────────────────────────────────────────────────────────const HOME = process.env.HOME || "~";diff --git a/LifeOS/install/LIFEOS/TOOLS/llcli/llcli.ts b/LifeOS/install/LIFEOS/TOOLS/llcli/llcli.tsindex 40b3a481..ef5d347e 100755--- a/LifeOS/install/LIFEOS/TOOLS/llcli/llcli.ts+++ b/LifeOS/install/LIFEOS/TOOLS/llcli/llcli.ts@@ -13,6 +13,13 @@ import { readFileSync } from 'fs';import { join } from 'path';import { homedir } from 'os';+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++// ============================================================================// Types// ============================================================================diff --git a/LifeOS/install/hooks/DriftReminder.hook.ts b/LifeOS/install/hooks/DriftReminder.hook.tsindex 50c6fe67..dc2f649b 100755--- a/LifeOS/install/hooks/DriftReminder.hook.ts+++ b/LifeOS/install/hooks/DriftReminder.hook.ts@@ -13,6 +13,13 @@ import { existsSync, mkdirSync, readFileSync, renameSync, statSync, writeFileSynimport { dirname, join } from "node:path";import { firstBannedHit } from "./lib/banned-vocab";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++interface HookInput {prompt?: string;user_prompt?: string;diff --git a/LifeOS/install/hooks/InstructionsLoadedHandler.hook.ts b/LifeOS/install/hooks/InstructionsLoadedHandler.hook.tsindex db027696..8d5d22ff 100755--- a/LifeOS/install/hooks/InstructionsLoadedHandler.hook.ts+++ b/LifeOS/install/hooks/InstructionsLoadedHandler.hook.ts@@ -26,6 +26,13 @@ import { existsSync, mkdirSync } from 'fs';import { join } from 'path';import { homedir } from 'os';+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++// ========================================// Configuration// ========================================diff --git a/LifeOS/install/hooks/LastResponseCache.hook.ts b/LifeOS/install/hooks/LastResponseCache.hook.tsindex 61f773cc..bef0fda2 100755--- a/LifeOS/install/hooks/LastResponseCache.hook.ts+++ b/LifeOS/install/hooks/LastResponseCache.hook.ts@@ -15,6 +15,13 @@ import { readHookInput, parseTranscriptFromInput } from './lib/hook-io';import { writeFileSync } from 'fs';import { join } from 'path';+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++async function main() {const input = await readHookInput();if (!input) { process.exit(0); }diff --git a/LifeOS/install/hooks/OutputFormatGate.hook.ts b/LifeOS/install/hooks/OutputFormatGate.hook.tsindex 605cc112..18974c13 100755--- a/LifeOS/install/hooks/OutputFormatGate.hook.ts+++ b/LifeOS/install/hooks/OutputFormatGate.hook.ts@@ -30,6 +30,13 @@ import { scanAiSpeak } from "./lib/ai-speak-patterns";import { readFileSync, appendFileSync, mkdirSync } from "fs";import { dirname, join } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const OBS_PATH = join(process.env.LIFEOS_DIR || join(process.env.HOME!, ".claude", "LIFEOS"),"MEMORY",diff --git a/LifeOS/install/hooks/PromptProcessing.hook.ts b/LifeOS/install/hooks/PromptProcessing.hook.tsindex f30a04c0..a37392b8 100755--- a/LifeOS/install/hooks/PromptProcessing.hook.ts+++ b/LifeOS/install/hooks/PromptProcessing.hook.ts@@ -40,6 +40,13 @@ import { paiPath } from './lib/paths';import { updateSessionNameInWorkJson, upsertSession } from './lib/isa-utils';import { isDesktopChannel, logSkippedVoice, getNotificationChannel } from './lib/notification-channel';+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++// ── Types ──interface HookInput {diff --git a/LifeOS/install/hooks/SatisfactionCapture.hook.ts b/LifeOS/install/hooks/SatisfactionCapture.hook.tsindex 9385ec50..a26045e1 100755--- a/LifeOS/install/hooks/SatisfactionCapture.hook.ts+++ b/LifeOS/install/hooks/SatisfactionCapture.hook.ts@@ -32,6 +32,13 @@ import { getISOTimestamp, getPSTComponents } from './lib/time';import { captureFailure } from '../LIFEOS/TOOLS/FailureCapture';import { addRatingPulse } from './lib/isa-utils';+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++// ── Types ──interface HookInput {diff --git a/LifeOS/install/hooks/SessionCleanup.hook.ts b/LifeOS/install/hooks/SessionCleanup.hook.tsindex 340e58af..3f23b66a 100755--- a/LifeOS/install/hooks/SessionCleanup.hook.ts+++ b/LifeOS/install/hooks/SessionCleanup.hook.ts@@ -39,6 +39,13 @@ import { getISOTimestamp } from './lib/time';import { setTabState, cleanupKittySession } from './lib/tab-setter';import { readRegistry, writeRegistry, findArtifactPath, findActiveSessionByUUID } from './lib/isa-utils';+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const BASE_DIR = process.env.LIFEOS_DIR || join(process.env.HOME!, '.claude', 'LIFEOS');const MEMORY_DIR = join(BASE_DIR, 'MEMORY');const STATE_DIR = join(MEMORY_DIR, 'STATE');diff --git a/LifeOS/install/hooks/SkillSurface.hook.ts b/LifeOS/install/hooks/SkillSurface.hook.tsindex f1daa1ef..c075d1db 100755--- a/LifeOS/install/hooks/SkillSurface.hook.ts+++ b/LifeOS/install/hooks/SkillSurface.hook.ts@@ -12,6 +12,13 @@import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from "node:fs";import { basename, dirname, join } from "node:path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++interface HookInput {prompt?: string;user_prompt?: string;diff --git a/LifeOS/install/hooks/SuccessClaimGate.hook.ts b/LifeOS/install/hooks/SuccessClaimGate.hook.tsindex b189d001..9343028c 100755--- a/LifeOS/install/hooks/SuccessClaimGate.hook.ts+++ b/LifeOS/install/hooks/SuccessClaimGate.hook.ts@@ -39,6 +39,13 @@ import { readHookInput, parseTranscriptFromInput } from "./lib/hook-io";import { appendFileSync, mkdirSync } from "fs";import { dirname, join } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const OBS_PATH = join(process.env.LIFEOS_DIR || join(process.env.HOME!, ".claude", "LIFEOS"),"MEMORY",diff --git a/LifeOS/install/hooks/WorkCompletionLearning.hook.ts b/LifeOS/install/hooks/WorkCompletionLearning.hook.tsindex 376e15ec..14691efb 100755--- a/LifeOS/install/hooks/WorkCompletionLearning.hook.ts+++ b/LifeOS/install/hooks/WorkCompletionLearning.hook.ts@@ -55,6 +55,13 @@ import { getISOTimestamp, getPSTDate } from './lib/time';import { getLearningCategory } from './lib/learning-utils';import { findArtifactPath, findActiveSessionByUUID } from './lib/isa-utils';+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const BASE_DIR = process.env.LIFEOS_DIR || join(process.env.HOME!, '.claude', 'LIFEOS');const MEMORY_DIR = join(BASE_DIR, 'MEMORY');const WORK_DIR = join(MEMORY_DIR, 'WORK');diff --git a/LifeOS/install/hooks/WritingGate.hook.ts b/LifeOS/install/hooks/WritingGate.hook.tsindex a8710b37..00ee1e1b 100755--- a/LifeOS/install/hooks/WritingGate.hook.ts+++ b/LifeOS/install/hooks/WritingGate.hook.ts@@ -30,6 +30,13 @@ import { appendFileSync, mkdirSync, existsSync, readFileSync } from "fs";import { createHash } from "crypto";import { dirname, join } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const LIFEOS_DIR = process.env.LIFEOS_DIR || join(process.env.HOME!, ".claude", "LIFEOS");const OBS_PATH = join(LIFEOS_DIR, "MEMORY", "OBSERVABILITY", "writing-gate.jsonl");const RUNS_PATH = join(LIFEOS_DIR, "MEMORY", "OBSERVABILITY", "pangram-runs.jsonl");diff --git a/LifeOS/install/hooks/lib/work-config.ts b/LifeOS/install/hooks/lib/work-config.tsindex 7e4643ac..7129dd82 100755--- a/LifeOS/install/hooks/lib/work-config.ts+++ b/LifeOS/install/hooks/lib/work-config.ts@@ -27,6 +27,13 @@import { existsSync, readFileSync, writeFileSync, chmodSync } from "fs";import { join } from "path";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++declare const Bun: { spawnSync: (cmd: string[], opts?: any) => any };const HOME = process.env.HOME || "";diff --git a/LifeOS/install/skills/Art/Tools/Generate.ts b/LifeOS/install/skills/Art/Tools/Generate.tsindex bedebf4e..2d52c465 100755--- a/LifeOS/install/skills/Art/Tools/Generate.ts+++ b/LifeOS/install/skills/Art/Tools/Generate.ts@@ -675,6 +675,13 @@ function enhancePromptForTransparency(prompt: string): string {import { exec } from "node:child_process";import { promisify } from "node:util";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const execAsync = promisify(exec);// ============================================================================diff --git a/LifeOS/install/skills/Art/Tools/GenerateMidjourneyImage.ts b/LifeOS/install/skills/Art/Tools/GenerateMidjourneyImage.tsindex 41bb9c86..7a53730f 100755--- a/LifeOS/install/skills/Art/Tools/GenerateMidjourneyImage.ts+++ b/LifeOS/install/skills/Art/Tools/GenerateMidjourneyImage.ts@@ -17,6 +17,13 @@ import { MidjourneyClient, MidjourneyError } from '../lib/midjourney-client.js';import { readFile } from 'node:fs/promises';import { resolve } from 'node:path';+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++// ============================================================================// Environment Loading// ============================================================================diff --git a/LifeOS/install/skills/AudioEditor/Tools/Polish.ts b/LifeOS/install/skills/AudioEditor/Tools/Polish.tsindex d2ac589f..b87c3b41 100644--- a/LifeOS/install/skills/AudioEditor/Tools/Polish.ts+++ b/LifeOS/install/skills/AudioEditor/Tools/Polish.ts@@ -18,6 +18,13 @@ import { existsSync, readFileSync } from "fs";import { basename, dirname, extname, join, resolve } from "path";import { homedir } from "os";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++// ============================================================================// Environment Loading — keys from ~/.claude/.env// ============================================================================diff --git a/LifeOS/install/skills/Daemon/Tools/DaemonAggregator.ts b/LifeOS/install/skills/Daemon/Tools/DaemonAggregator.tsindex f7256942..d8a9b9b2 100755--- a/LifeOS/install/skills/Daemon/Tools/DaemonAggregator.ts+++ b/LifeOS/install/skills/Daemon/Tools/DaemonAggregator.ts@@ -19,6 +19,13 @@ import { readFileSync, existsSync, writeFileSync, readdirSync, statSync } from "import { join, resolve } from "path";import { filterContent, filterDaemonData, loadSecurityOverrides } from "./SecurityFilter.ts";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++// ─── Path Resolution ───const HOME = process.env.HOME || process.env.USERPROFILE || "";diff --git a/LifeOS/install/skills/LifeOS/Tools/LinkUser.ts b/LifeOS/install/skills/LifeOS/Tools/LinkUser.tsindex 86d80b7d..7d059341 100755--- a/LifeOS/install/skills/LifeOS/Tools/LinkUser.ts+++ b/LifeOS/install/skills/LifeOS/Tools/LinkUser.ts@@ -13,6 +13,13 @@import { join } from "node:path";import { checkSymlinkContract, detectDevTree, setupUserSeparation } from "./InstallEngine";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++function main(): void {const a = process.argv.slice(2);const get = (f: string): string | undefined => {diff --git a/LifeOS/install/skills/LifeOS/Tools/ScaffoldUser.ts b/LifeOS/install/skills/LifeOS/Tools/ScaffoldUser.tsindex c2cebe17..0c0635e7 100755--- a/LifeOS/install/skills/LifeOS/Tools/ScaffoldUser.ts+++ b/LifeOS/install/skills/LifeOS/Tools/ScaffoldUser.ts@@ -13,6 +13,13 @@ import { existsSync } from "node:fs";import { join } from "node:path";import { copyMissing, detectDevTree } from "./InstallEngine";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++function main(): void {const a = process.argv.slice(2);const get = (f: string): string | undefined => {diff --git a/LifeOS/install/skills/LifeOS/Tools/SeedPulse.ts b/LifeOS/install/skills/LifeOS/Tools/SeedPulse.tsindex 89395b8a..8411fc82 100755--- a/LifeOS/install/skills/LifeOS/Tools/SeedPulse.ts+++ b/LifeOS/install/skills/LifeOS/Tools/SeedPulse.ts@@ -15,6 +15,13 @@ import { existsSync } from "node:fs";import { join } from "node:path";import { detectDevTree } from "./InstallEngine";+// Normalize env path vars that Claude Code injects without shell expansion (LifeOS#1404)+for (const k of ["LIFEOS_DIR", "LIFEOS_CONFIG_DIR", "PROJECTS_DIR"]) {+ const v = process.env[k];+ if (v && /^\$\{?HOME\}?(\/|$)/.test(v)) process.env[k] = v.replace(/^\$\{?HOME\}?/, process.env.HOME ?? "~");+}++const GENERATORS = ["GenerateTelosSummary.ts", "UpdateLifeosState.ts"];function main(): void {