-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Summary
RelationshipMemory.hook.ts was refactored in v4.0.0 to use the new shared TranscriptParser, but the migration introduced a breaking reference to a field (userPrompt) that doesn't exist on the ParsedTranscript interface. The hook silently produces zero output and has been non-functional since v4.0.0.
Bug Details
In v3.0, the hook parsed transcripts directly via readFileSync + JSON line parsing, accessing entry.message.content on each JSONL entry. This worked — both user and assistant messages were read.
In v4.0.0, the hook was refactored to use parseTranscript() from PAI/Tools/TranscriptParser.ts:
// RelationshipMemory.hook.ts, lines 76-84
const parsed = parseTranscript(path);
const entries: TranscriptEntry[] = [];
if (parsed.userPrompt) { // <-- doesn't exist
entries.push({ type: 'user', text: parsed.userPrompt });
}
if (parsed.plainCompletion) {
entries.push({ type: 'assistant', text: parsed.plainCompletion });
}ParsedTranscript interface (TranscriptParser.ts) has these fields:
raw, lastMessage, currentResponseText, voiceCompletion,
plainCompletion, structured, responseState
No userPrompt field. It's always undefined.
Impact
Three compounding failures:
- User messages never captured —
parsed.userPromptis undefined, so preference/frustration/positive pattern matching against user input never fires - Assistant content too narrow —
plainCompletionis a short extracted string, not the full response. MostSUMMARY:and milestone regex patterns don't match against it - Silent failure — the hook exits cleanly with
[RelationshipMemory] No relationship notes to capture, no error thrown
Result: MEMORY/RELATIONSHIP/ receives zero new entries. In my install, the last entry is from Feb 27 (pre-v4.0 upgrade). No 2026-03 directory was ever created despite daily use.
Steps to Reproduce
- Install PAI v4.0.x
- Run any session and let it end cleanly (SessionEnd fires)
- Check
MEMORY/RELATIONSHIP/— no new files created - Check stderr — hook logs "No relationship notes to capture"
Suggested Fix
Either:
- Minimal: Add
userPromptfield toParsedTranscriptinTranscriptParser.tsand populate it from the last user message in the transcript - Better: Expose full
userMessagesandassistantMessagesarrays fromParsedTranscriptso hooks can access the complete conversation, not just the last turn. The v3.0 approach of iterating all JSONL entries was more thorough
Environment
- PAI v4.0.3 / Algorithm v3.7.0
- Claude Code 2.1.78
- macOS Darwin 25.3.0