Skip to content

7.40.4: FailureCapture quotes another session under What Happened: SatisfactionCapture reads one global MEMORY/STATE/last-response.txt (SatisfactionCapture.hook.ts:83) #2289

Description

@jppattn-lgtm

Version

LifeOS 7.40.4 (hooks/SatisfactionCapture.hook.ts and LIFEOS/TOOLS/FailureCapture.ts as shipped, unmodified).

What is broken

A FAILURES capture's sentiment.json.detailed_context, rendered as ## What Happened in CONTEXT.md, is taken from MEMORY/STATE/last-response.txt, one file for the whole install. With two or more sessions open, that file holds whichever session's assistant response landed last, so the capture quotes a turn from a different session. Observed 2026-10-05: a capture triggered by "stop doing anything right now." quoted an assistant message about deleting scratch copies of a notification database; that phrase occurs zero times in the captured session's own transcript.jsonl (1,406 lines). The transcript and tool-calls in the same folder belong to the right session; only the quoted turn is foreign, and everything that mines captures (Cortex, Upgrade, LearningPatternSynthesis) reads the wrong "what happened".

Where (file:line)

Writer of the quote: hooks/SatisfactionCapture.hook.ts:83 (LAST_RESPONSE_CACHE = join(BASE_DIR, 'MEMORY', 'STATE', 'last-response.txt')), read at :116, passed as detailedContext at :442 and :511. Reader: LIFEOS/TOOLS/FailureCapture.ts:355 (detailed_context) and :390 (## What Happened). Cache writer: hooks/LastResponseCache.hook.ts:48 (the same single path, no session key; hooks/DriftReminder.hook.ts:74 reads it too). The hook already holds the right source: data.transcript_path (:439).

Repro on a clean tree

  1. Fresh 7.40.4 install. Open two Claude Code sessions, A and B.
  2. In A, have the assistant answer with a distinctive sentence. In B, immediately send a low rating ("2") about B's own work.
  3. Open the new MEMORY/LEARNING/FAILURES/<month>/<capture>/CONTEXT.md: ## What Happened shows A's sentence, and grep -c "<A's sentence>" transcript.jsonl in the same folder returns 0.

Negative control

With a single session open, the quoted turn matches the last assistant entry in the capture's own transcript.jsonl.

Suggested fix

Derive detailedContext from the last assistant entry of data.transcript_path (FailureCapture already parses that file, :156-163), or key the cache file by session id wherever it is written. Untested.

Before submitting

  • I searched open and closed issues for this defect.
  • The repro runs against a clean tree of the version above, not against my modified install.
  • I removed personal data from the pasted output — real names, absolute home paths, tokens, my own content.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions