Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Releases/v4.0.3/.claude/PAI/Tools/ActivityParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import * as path from "path";
// Configuration
// ============================================================================

const CLAUDE_DIR = path.join(process.env.HOME!, ".claude");
const CLAUDE_DIR = process.env.PAI_DIR || path.join(process.env.HOME!, ".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
Expand Down
3 changes: 2 additions & 1 deletion Releases/v4.0.3/.claude/PAI/Tools/AlgorithmPhaseReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import { join } from "path";
import { homedir } from "os";
import { parseArgs } from "util";

const STATE_DIR = join(homedir(), ".claude", "MEMORY", "STATE");
const PAI_DIR = process.env.PAI_DIR || join(homedir(), ".claude");
const STATE_DIR = join(PAI_DIR, "MEMORY", "STATE");
const STATE_FILE = join(STATE_DIR, "algorithm-phase.json");

interface AlgorithmState {
Expand Down
2 changes: 1 addition & 1 deletion Releases/v4.0.3/.claude/PAI/Tools/Banner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { join } from "path";
import { spawnSync } from "child_process";

const HOME = process.env.HOME!;
const CLAUDE_DIR = join(HOME, ".claude");
const CLAUDE_DIR = process.env.PAI_DIR || join(HOME, ".claude");

// ═══════════════════════════════════════════════════════════════════════════
// Terminal Width Detection
Expand Down
2 changes: 1 addition & 1 deletion Releases/v4.0.3/.claude/PAI/Tools/BannerMatrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { join } from "path";
import { spawnSync } from "child_process";

const HOME = process.env.HOME!;
const CLAUDE_DIR = join(HOME, ".claude");
const CLAUDE_DIR = process.env.PAI_DIR || join(HOME, ".claude");

// =============================================================================
// Terminal Width Detection
Expand Down
2 changes: 1 addition & 1 deletion Releases/v4.0.3/.claude/PAI/Tools/BannerNeofetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { join } from "path";
import { spawnSync } from "child_process";

const HOME = process.env.HOME!;
const CLAUDE_DIR = join(HOME, ".claude");
const CLAUDE_DIR = process.env.PAI_DIR || join(HOME, ".claude");

// ═══════════════════════════════════════════════════════════════════════
// Terminal Width Detection
Expand Down
2 changes: 1 addition & 1 deletion Releases/v4.0.3/.claude/PAI/Tools/BannerRetro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { join } from "path";
import { spawnSync } from "child_process";

const HOME = process.env.HOME!;
const CLAUDE_DIR = join(HOME, ".claude");
const CLAUDE_DIR = process.env.PAI_DIR || join(HOME, ".claude");

// ═══════════════════════════════════════════════════════════════════════════
// Terminal Width Detection
Expand Down
4 changes: 2 additions & 2 deletions Releases/v4.0.3/.claude/PAI/Tools/BuildCLAUDE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import { readFileSync, writeFileSync, existsSync } from "fs";
import { join } from "path";

const PAI_DIR = join(process.env.HOME!, ".claude");
const PAI_DIR = process.env.PAI_DIR || join(process.env.HOME!, ".claude");
const TEMPLATE_PATH = join(PAI_DIR, "CLAUDE.md.template");
const OUTPUT_PATH = join(PAI_DIR, "CLAUDE.md");
const OUTPUT_PATH = join(process.env.HOME!, ".claude", "CLAUDE.md"); // Always ~/.claude/ — Claude Code reads from fixed location
const SETTINGS_PATH = join(PAI_DIR, "settings.json");
const ALGORITHM_DIR = join(PAI_DIR, "PAI/Algorithm");
const LATEST_PATH = join(ALGORITHM_DIR, "LATEST");
Expand Down
3 changes: 2 additions & 1 deletion Releases/v4.0.3/.claude/PAI/Tools/FeatureRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ interface FeatureRegistry {
};
}

const REGISTRY_DIR = join(process.env.HOME || '', '.claude', 'MEMORY', 'progress');
const PAI_DIR = process.env.PAI_DIR || join(process.env.HOME || '', '.claude');
const REGISTRY_DIR = join(PAI_DIR, 'MEMORY', 'progress');

function getRegistryPath(project: string): string {
return join(REGISTRY_DIR, `${project}-features.json`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import * as path from "path";
// Configuration
// ============================================================================

const CLAUDE_DIR = path.join(process.env.HOME!, ".claude");
const CLAUDE_DIR = process.env.PAI_DIR || path.join(process.env.HOME!, ".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");
Expand Down
3 changes: 2 additions & 1 deletion Releases/v4.0.3/.claude/PAI/Tools/LoadSkillConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ interface ExtendManifest {

// Constants
const HOME = homedir();
const CUSTOMIZATION_DIR = join(HOME, '.claude', 'PAI', 'USER', 'SKILLCUSTOMIZATIONS');
const PAI_DIR = process.env.PAI_DIR || join(HOME, '.claude');
const CUSTOMIZATION_DIR = join(PAI_DIR, 'PAI', 'USER', 'SKILLCUSTOMIZATIONS');

/**
* Deep merge two objects recursively
Expand Down
2 changes: 1 addition & 1 deletion Releases/v4.0.3/.claude/PAI/Tools/NeofetchBanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { join } from "path";
import { spawnSync } from "child_process";

const HOME = process.env.HOME!;
const CLAUDE_DIR = join(HOME, ".claude");
const CLAUDE_DIR = process.env.PAI_DIR || join(HOME, ".claude");

// ═══════════════════════════════════════════════════════════════════════
// Terminal Width Detection
Expand Down
5 changes: 3 additions & 2 deletions Releases/v4.0.3/.claude/PAI/Tools/RebuildPAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import { readdirSync, readFileSync, writeFileSync } from "fs";
import { join } from "path";

const HOME = process.env.HOME!;
const PAI_DIR = join(HOME, ".claude/PAI");
const CLAUDE_DIR = process.env.PAI_DIR || join(HOME, ".claude");
const PAI_DIR = join(CLAUDE_DIR, "PAI");
const COMPONENTS_DIR = join(PAI_DIR, "Components");
const ALGORITHM_DIR = join(COMPONENTS_DIR, "Algorithm");
const OUTPUT_FILE = join(PAI_DIR, "SKILL.md");
const SETTINGS_PATH = join(HOME, ".claude/settings.json");
const SETTINGS_PATH = join(CLAUDE_DIR, "settings.json");

/**
* Load identity variables from settings.json for template resolution
Expand Down
2 changes: 1 addition & 1 deletion Releases/v4.0.3/.claude/PAI/Tools/SessionHarvester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { getLearningCategory, isLearningCapture } from "../../hooks/lib/learning
// Configuration
// ============================================================================

const CLAUDE_DIR = path.join(process.env.HOME!, ".claude");
const CLAUDE_DIR = process.env.PAI_DIR || path.join(process.env.HOME!, ".claude");
// Derive the project slug dynamically from CLAUDE_DIR (works on macOS and Linux)
// macOS: ${HOME}/.claude → -Users-username--claude
// Linux: /home/username/.claude → -home-username--claude
Expand Down
3 changes: 2 additions & 1 deletion Releases/v4.0.3/.claude/PAI/Tools/SessionProgress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ 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 PAI_DIR = process.env.PAI_DIR || join(process.env.HOME || '', '.claude');
const PROGRESS_DIR = join(PAI_DIR, 'MEMORY', 'STATE', 'progress');

function getProgressPath(project: string): string {
return join(PROGRESS_DIR, `${project}-progress.json`);
Expand Down
2 changes: 1 addition & 1 deletion Releases/v4.0.3/.claude/PAI/Tools/pai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { join, basename } from "path";
// Configuration
// ============================================================================

const CLAUDE_DIR = join(homedir(), ".claude");
const CLAUDE_DIR = process.env.PAI_DIR || join(homedir(), ".claude");
const MCP_DIR = join(CLAUDE_DIR, "MCPs");
const ACTIVE_MCP = join(CLAUDE_DIR, ".mcp.json");
const BANNER_SCRIPT = join(CLAUDE_DIR, "PAI", "Tools", "Banner.ts");
Expand Down
5 changes: 2 additions & 3 deletions Releases/v4.0.3/.claude/hooks/LastResponseCache.hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
*/

import { readHookInput, parseTranscriptFromInput } from './lib/hook-io';
import { getPaiDir } from './lib/paths';
import { writeFileSync } from 'fs';
import { join } from 'path';
import { homedir } from 'os';

async function main() {
const input = await readHookInput();
Expand All @@ -29,8 +29,7 @@ async function main() {

if (lastResponse) {
try {
const paiDir = process.env.PAI_DIR || join(homedir(), '.claude');
const cachePath = join(paiDir, 'MEMORY', 'STATE', 'last-response.txt');
const cachePath = join(getPaiDir(), 'MEMORY', 'STATE', 'last-response.txt');
writeFileSync(cachePath, lastResponse.slice(0, 2000), 'utf-8');
} catch (err) {
console.error('[LastResponseCache] Failed to write:', err);
Expand Down
3 changes: 2 additions & 1 deletion Releases/v4.0.3/.claude/hooks/RatingCapture.hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import { appendFileSync, mkdirSync, existsSync, readFileSync, writeFileSync } from 'fs';
import { join } from 'path';
import { getPaiDir } from './lib/paths';
import { inference } from '../PAI/Tools/Inference';
import { getIdentity, getPrincipal, getPrincipalName } from './lib/identity';
import { getLearningCategory } from './lib/learning-utils';
Expand Down Expand Up @@ -60,7 +61,7 @@ interface RatingEntry {

// ── Shared Constants ──

const BASE_DIR = process.env.PAI_DIR || join(process.env.HOME!, '.claude');
const BASE_DIR = getPaiDir();
const SIGNALS_DIR = join(BASE_DIR, 'MEMORY', 'LEARNING', 'SIGNALS');
const RATINGS_FILE = join(SIGNALS_DIR, 'ratings.jsonl');
const LAST_RESPONSE_CACHE = join(BASE_DIR, 'MEMORY', 'STATE', 'last-response.txt');
Expand Down
3 changes: 2 additions & 1 deletion Releases/v4.0.3/.claude/hooks/SessionCleanup.hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@

import { writeFileSync, existsSync, readFileSync, unlinkSync } from 'fs';
import { join } from 'path';
import { getPaiDir } from './lib/paths';
import { getISOTimestamp } from './lib/time';
import { setTabState, cleanupKittySession } from './lib/tab-setter';

const BASE_DIR = process.env.PAI_DIR || join(process.env.HOME!, '.claude');
const BASE_DIR = getPaiDir();
const MEMORY_DIR = join(BASE_DIR, 'MEMORY');
const STATE_DIR = join(MEMORY_DIR, 'STATE');
const WORK_DIR = join(MEMORY_DIR, 'WORK');
Expand Down
3 changes: 2 additions & 1 deletion Releases/v4.0.3/.claude/hooks/WorkCompletionLearning.hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@

import { writeFileSync, existsSync, readFileSync, mkdirSync } from 'fs';
import { join, dirname } from 'path';
import { getPaiDir } from './lib/paths';
import { getISOTimestamp, getPSTDate } from './lib/time';
import { getLearningCategory } from './lib/learning-utils';

const BASE_DIR = process.env.PAI_DIR || join(process.env.HOME!, '.claude');
const BASE_DIR = getPaiDir();
const MEMORY_DIR = join(BASE_DIR, 'MEMORY');
const STATE_DIR = join(MEMORY_DIR, 'STATE');
const WORK_DIR = join(MEMORY_DIR, 'WORK');
Expand Down
Loading