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.userPrompt is undefined, so preference/frustration/positive pattern matching against user input never fires
- Assistant content too narrow —
plainCompletion is a short extracted string, not the full response. Most SUMMARY: 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
userPrompt field to ParsedTranscript in TranscriptParser.ts and populate it from the last user message in the transcript
- Better: Expose full
userMessages and assistantMessages arrays from ParsedTranscript so 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
Summary
RelationshipMemory.hook.tswas refactored in v4.0.0 to use the new sharedTranscriptParser, but the migration introduced a breaking reference to a field (userPrompt) that doesn't exist on theParsedTranscriptinterface. 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, accessingentry.message.contenton each JSONL entry. This worked — both user and assistant messages were read.In v4.0.0, the hook was refactored to use
parseTranscript()fromPAI/Tools/TranscriptParser.ts:ParsedTranscriptinterface (TranscriptParser.ts) has these fields:No
userPromptfield. It's alwaysundefined.Impact
Three compounding failures:
parsed.userPromptis undefined, so preference/frustration/positive pattern matching against user input never firesplainCompletionis a short extracted string, not the full response. MostSUMMARY:and milestone regex patterns don't match against it[RelationshipMemory] No relationship notes to capture, no error thrownResult:
MEMORY/RELATIONSHIP/receives zero new entries. In my install, the last entry is from Feb 27 (pre-v4.0 upgrade). No2026-03directory was ever created despite daily use.Steps to Reproduce
MEMORY/RELATIONSHIP/— no new files createdSuggested Fix
Either:
userPromptfield toParsedTranscriptinTranscriptParser.tsand populate it from the last user message in the transcriptuserMessagesandassistantMessagesarrays fromParsedTranscriptso hooks can access the complete conversation, not just the last turn. The v3.0 approach of iterating all JSONL entries was more thoroughEnvironment