PWN::AI::Agent::Mistakes
PWN::AI::Agent::Mistakes is the negative-feedback half of the pwn-ai learning loop. Where Learning records WHAT WORKED and Metrics records HOW OFTEN a tool worked, Mistakes records SPECIFIC FAILURE PATTERNS with a stable fingerprint so the agent can (a) recognise it is repeating itself, (b) be told exactly what not to do again in every future system prompt, and (c) capture the FIX once one is found so the avoidance lesson becomes an actionable correction. A "mistake" is keyed by sha12(tool + normalised_error). Normalisation strips volatile bits (paths, hex addresses, line numbers, timestamps, UUIDs, PIDs) so "NoMethodError ... at foo.rb:42" and "... at foo.rb:99" collapse to one signature and its :count climbs — that count IS the repeat detector. Closed loop (why it does NOT repeat mistakes): Loop.run --(tool failure)---------> Mistakes.record (persist + count++) Loop.run --(same sig fails ≥N)----> guard_repeated_failure (uses PERSISTENT count, so triggers on the 1st recurrence in a new session, not the 3rd) Loop.run --(failure w/ known fix)-> inline "KNOWN FIX: …" (self-corrects next iter) Loop.run --(user says "wrong")----> check_user_correction (flip last outcome + record) PromptBuilder <-------------------- Mistakes.to_context (DO-NOT-REPEAT + KNOWN-FIXES) model --(tool call)---------------> mistakes_record / mistakes_resolve
When to use
Call PWN::AI::Agent::Mistakes from pwn_eval when the task needs this module.
Do not reimplement it in shell.
Methodologies
Generated from pwn/ai/agent/mistakes.rb. Prefer the public class methods below.
Class methods take (opts = {}) and read opts.
How to call
PWN::AI::Agent::Mistakes.help
PWN::AI::Agent::Mistakes.load(opts)
Public methods
loadsavesignatureerror_classfamilyfindfor_toolrecordresolvetopextinguishextinguish_parkedparkoperator_inboxto_contextcorrection_hintnote_hint_outcomecorrectioncheck_user_correctionleanreseteffective_countauthorshelpcorrection?extinguish!extinguish_parked!lean!
Source
pwn/ai/agent/mistakes.rb
Verification
PWN::AI::Agent::Mistakes.respond_to?(:load) after the
module is loaded. Read the source for parameter names.