Expand description
Session-mined candidate rules.
The local worker turns session transcripts into candidate rules:
- A SessionEnd / Stop / N-turn watermark fires the local worker
(see
difflore-cli/src/session_mine/). - The worker pulls the last few user-prompt / assistant-text pairs from the platform transcript, strips tool calls + thinking blocks, and hands them to a small LLM gate (Haiku-class).
- The gate verdict is either KEEP (a brand-new reusable rule) or
MERGE:
(an extension of an existing rule). In either case the worker enqueues a SessionMinedCandidateoncloud_outboxwithkind = "session_mined_candidate". - The cloud clusters those rows into draft
candidate_ruleswithorigin = 'session_mined'andrequires_human_approval = true.
Structs§
- Session
Mined Candidate - Wire format for one session-mined candidate. Serialised verbatim
into
cloud_outbox.payload_jsonunderkind = "session_mined_candidate". - Session
Mined Candidate Args - Builder bundle accepted by
SessionMinedCandidate::try_new. Kept as a struct (rather than a long argument list) so future fields can be added without breaking call sites.
Enums§
- Candidate
Error - Errors a
SessionMinedCandidatecan fail validation with. Returned by the constructor /validateso the worker can swallow invalid candidates without retrying through the outbox.
Constants§
- BODY_
MAX_ CHARS - Cap on
body(chars, not bytes). 2 KB is enough for a 3-5 sentence rule body with a snippet; anything longer is almost certainly the raw transcript text the gate failed to compress. - MAX_
FILE_ PATTERNS - Maximum number of file glob patterns we will accept from the gate. 1-3 is the sweet spot: a single broad glob is too noisy, more than three usually means the gate failed to localise the rule.
- ORIGIN
- Stable origin tag for the candidate-rule pipeline.
- TITLE_
MAX_ CHARS - Cap on
title(chars, not bytes). Matches the existingObservation::titleconvention so cloud-side renderers can share truncation logic.
Functions§
- compute_
content_ hash sha256(source_repo|title|body)[:16]as lowercase hex. Mirrors the 16-char convention used byObservation::content_hashandremember_ruleso cloud-side dedup logic doesn’t need a separate hash family.