Skip to main content

Module mining

Module mining 

Source
Expand description

Offline trace mining: distill recurring error signatures from a directory of .jsonl transcript/log files (e.g. agent transcripts, CI logs).

The live loop (record_shell_outcome) learns from commands run through lean-ctx. This module bootstraps that loop from history: it scans past transcripts for the same unambiguous error markers the shell detector recognizes (error[E####], error TS####, Traceback, npm ERR!, panicked at, …) and ranks the signatures that recur across the most sessions — the project’s persistent pain points.

Deterministic and high-precision by design: only structured error markers match (never free prose), each file counts as one “session”, and the output is read-only — it surfaces signatures for review, it never mutates state.

Structs§

MinedSignature
A recurring error signature distilled from mined transcripts.

Functions§

extract_error_signatures
Extract normalized error signatures from a single blob of text. Pure and deterministic; returns one entry per match (callers aggregate counts).
format_mining_report
Render a mining report. min_sessions hides one-off signatures so only genuinely recurring pain points show.
mine_jsonl_dir
Mine all .jsonl files in dir for recurring error signatures. Each file is treated as one session; signatures are ranked by session reach, then total occurrences, then lexically — fully deterministic.