Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

[bug] SessionHarvester counts prompts from headless runs (LLM judges, reviewers) as…

Open IvanLeontev-stack opened this issue 1 week ago • 1 comments

What happened

SessionHarvester counts prompts from headless runs (LLM judges, reviewers) as the principal's own corrections and preferences

Summary

LIFEOS/TOOLS/SessionHarvester.ts reads every .jsonl in the projects directory, headless runs included. Claude Code marks each user line with who wrote it: promptSource is typed (or queued, suggestion_accepted) when a person typed it and sdk when a tool did, and entrypoint is sdk-cli for a headless run. The harvester does not read either field.

  1. Corrections (:347): isHumanTurn() rejects tool results, isMeta and injected blocks, but a prompt written by a tool for a headless run passes. A judge prompt that opens with "Actually," becomes a correction from the principal.
  2. --mine (:424): no human check at all. Every user line of 20 or more characters is mined, headless prompts included.

Repro on a clean v8.761.0 checkout, from LifeOS/install, with two one-line sessions in a temp dir:

D=$(mktemp -d); bun -e '
const u=(t,x)=>JSON.stringify({type:"user",timestamp:"2026-11-28T10:00:00Z",message:{role:"user",content:t},...x});
require("fs").writeFileSync(process.argv[1]+"/aaaaaaaa.jsonl", u("Actually, use bun for this script, not npm, we never use npm here.",{promptSource:"typed",entrypoint:"cli"})+"\n");
require("fs").writeFileSync(process.argv[1]+"/bbbbbbbb.jsonl", u("Actually, grade the draft below against the rubric and return a score from 1 to 5. Never use a lenient score, always use the strict rubric, and you must never skip a criterion.",{promptSource:"sdk",entrypoint:"sdk-cli"})+"\n");' "$D"
bun LIFEOS/TOOLS/SessionHarvester.ts --projects-dir "$D" --all --dry-run
bun LIFEOS/TOOLS/SessionHarvester.ts --projects-dir "$D" --all --dry-run --mine
  • Expected: one correction (session aaaaaaaa), and no mined candidate from the judge run.
  • Actual: two corrections, one of them the judge prompt (correction_bbbbbbbb); --mine returns the judge prompt as a [preference] at 40%.

On a real install this is most of the output: headless runs (memory review, Assay judges, sub-agent prompts) produce many transcripts, and their prompts are full of "always", "never" and "actually". On my install in September, keeping only lines a person typed cut false corrections from 173 to 17 over the same set of sessions.

Suggested fix: count a user line as the principal's words only when entrypoint is not sdk-cli and promptSource is typed, queued or suggestion_accepted, and use the same check in --mine. One case needs care: arguments typed after a slash command are recorded with no promptSource, inside <command-args>, so the check should read those arguments and not drop the line. If promptSource is absent from a whole transcript (an older Claude Code), falling back to today's isHumanTurn() keeps old archives working.

Details

  • Kind: bug
  • LifeOS version: 8.761.0

Filed with the LifeOS /feedback command. The reporter approved this exact text before it was sent; paths, secrets and personal details were stripped locally.

IvanLeontev-stack avatar Nov 28 '26 17:11 IvanLeontev-stack

[!NOTE] 🤖 Kai (AI assistant) responding on behalf of Daniel Miessler

Thanks @IvanLeontev-stack for the report.

This is fixed in our source and goes out in the next release. SessionHarvester excludes headless SDK activity, such as automated judges and reviewers, from harvested learnings and memories. It still includes human prompts and their replies from interactive SDK sessions.

Please reopen if it still happens after you upgrade.

danielmiessler avatar Dec 02 '26 08:12 danielmiessler