Skip to main content

Module gotcha_tracker

Module gotcha_tracker 

Source

Modules§

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

Structs§

DetectedError
ErrorEntry
FixEntry
Gotcha
GotchaStats
GotchaStore
PendingError
ReflectionInsight
A distilled, reusable insight derived from the gotcha trace.
SessionErrorLog

Enums§

GotchaCategory
GotchaSeverity
GotchaSource

Functions§

detect_error_pattern
fold_into_playbook
Fold reflection insights into a session playbook as deltas. Near-duplicates confirm the existing entry (the playbook’s grow-and-refine invariant), so repeated checkpoints reinforce rather than bloat. Returns (added, confirmed).
format_ledger
Human-readable Learning Ledger — what lean-ctx has actually learned from real shell outcomes: proven error→fix strategies, recurring pitfalls, and the counts behind them. Honest counts only — no fabricated token-savings figures, since “repeat errors avoided” has no measured per-incident token cost.
is_correlatable_command
True for the build/test/dependency/runtime command families this module can correlate (mirrors the per-tool gates in detect_error_pattern). The shell-layer hook uses it to skip all disk work for ordinary commands (ls, cat, echo, …) — a false positive only costs a cheap store load, never a wrong gotcha (detect_error_pattern still gates the real signal).
load_universal_gotchas
normalize_error_signature
record_shell_outcome
Shell-layer hook: learn from a finished command’s outcome.
reflect
Distill the gotcha trace into reusable insights. Pure and deterministic: an identical store always yields byte-identical, identically-ordered output (no timestamps, no map iteration order — BTree* keep it stable).
relevance_score
save_universal_gotchas