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
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