Skip to content

fix: Prevent Inference.ts from creating noise session files#635

Open
m4nt0de4 wants to merge 1 commit intodanielmiessler:mainfrom
m4nt0de4:fix/inference-session-persistence
Open

fix: Prevent Inference.ts from creating noise session files#635
m4nt0de4 wants to merge 1 commit intodanielmiessler:mainfrom
m4nt0de4:fix/inference-session-persistence

Conversation

@m4nt0de4
Copy link
Contributor

Summary

  • Every hook calling Inference.ts (FormatReminder, ImplicitSentiment, AutoWorkCreation, etc.) creates a .jsonl session file via claude --print
  • With 3-4 hooks per interaction turn, this generates hundreds of ghost sessions that pollute claude --resume
  • Adds --no-session-persistence to the claude args array to prevent ephemeral inference calls from persisting session files

Reproduction

  1. Launch PAI with hooks enabled (default config)
  2. Count .jsonl files in ~/.claude/projects/ before and after a few interactions
  3. Observe 3-4 new noise files per turn (one per hook using inference)
  4. Run claude --resume and see ghost sessions mixed with real ones

Fix

Single-line addition of '--no-session-persistence' to the args array in Inference.ts (line 78).

Verification

After applying the fix:

  • 0 new noise .jsonl files per interaction turn
  • claude --resume shows only real sessions
  • All hooks still function correctly (inference results unchanged)

Test plan

  • Verify FormatReminder hook still classifies depth correctly
  • Verify ImplicitSentiment hook still captures sentiment
  • Confirm no new .jsonl files appear in projects directory after interactions
  • Confirm claude --resume list is clean

🤖 Generated with Claude Code

Every hook that calls Inference.ts (FormatReminder, ImplicitSentiment,
AutoWorkCreation, etc.) creates a .jsonl session file via `claude --print`.
With 3-4 hooks per interaction turn, this generates hundreds of ghost
sessions that pollute `claude --resume`.

Adding `--no-session-persistence` to the args array prevents these
ephemeral inference calls from persisting session files.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant