pwn 0.5.621 → 0.5.626

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +2 -2
  3. data/Gemfile +1 -1
  4. data/README.md +7 -1
  5. data/bin/pwn_gqrx_scanner +78 -9
  6. data/documentation/Agent-Tool-Registry.md +3 -3
  7. data/documentation/Configuration.md +301 -47
  8. data/documentation/Cron.md +5 -3
  9. data/documentation/Diagrams.md +1 -1
  10. data/documentation/Extrospection.md +472 -26
  11. data/documentation/FFI.md +72 -8
  12. data/documentation/Home.md +4 -4
  13. data/documentation/How-PWN-Works.md +7 -3
  14. data/documentation/Mistakes.md +9 -0
  15. data/documentation/SDR.md +83 -10
  16. data/documentation/Skills-Memory-Learning.md +101 -11
  17. data/documentation/diagrams/agent-tool-registry.svg +56 -55
  18. data/documentation/diagrams/ai-integration-tool-calling.svg +24 -24
  19. data/documentation/diagrams/aws-cloud-security.svg +25 -25
  20. data/documentation/diagrams/burp-vs-zap-preference.svg +12 -12
  21. data/documentation/diagrams/code-scanning-sast.svg +25 -25
  22. data/documentation/diagrams/cron-scheduling.svg +23 -23
  23. data/documentation/diagrams/dot/agent-tool-registry.dot +2 -2
  24. data/documentation/diagrams/dot/extrospection-world-awareness.dot +33 -6
  25. data/documentation/diagrams/dot/hardware-hacking.dot +3 -1
  26. data/documentation/diagrams/dot/memory-skills-detailed.dot +4 -2
  27. data/documentation/diagrams/dot/mistakes-negative-feedback.dot +4 -2
  28. data/documentation/diagrams/dot/overall-pwn-architecture.dot +3 -3
  29. data/documentation/diagrams/dot/persistence-filesystem.dot +3 -3
  30. data/documentation/diagrams/dot/pwn-ai-feedback-learning-loop.dot +10 -4
  31. data/documentation/diagrams/dot/sdr-radio-flow.dot +39 -16
  32. data/documentation/diagrams/driver-framework.svg +13 -13
  33. data/documentation/diagrams/extrospection-world-awareness.svg +383 -177
  34. data/documentation/diagrams/fuzzing-workflow.svg +24 -24
  35. data/documentation/diagrams/hardware-hacking.svg +84 -69
  36. data/documentation/diagrams/history-to-drivers.svg +18 -18
  37. data/documentation/diagrams/memory-skills-detailed.svg +137 -120
  38. data/documentation/diagrams/mistakes-negative-feedback.svg +152 -137
  39. data/documentation/diagrams/network-infra-testing.svg +27 -27
  40. data/documentation/diagrams/overall-pwn-architecture.svg +97 -97
  41. data/documentation/diagrams/penetration-testing-workflow.svg +30 -30
  42. data/documentation/diagrams/persistence-filesystem.svg +100 -94
  43. data/documentation/diagrams/plugin-ecosystem.svg +35 -35
  44. data/documentation/diagrams/pwn-ai-feedback-learning-loop.svg +254 -207
  45. data/documentation/diagrams/pwn-repl-prototyping.svg +20 -20
  46. data/documentation/diagrams/reporting-pipeline.svg +18 -18
  47. data/documentation/diagrams/reverse-engineering-flow.svg +21 -21
  48. data/documentation/diagrams/sdr-radio-flow.svg +223 -91
  49. data/documentation/diagrams/sessions-cron-automation.svg +18 -18
  50. data/documentation/diagrams/swarm-multi-agent.svg +39 -39
  51. data/documentation/diagrams/web-application-testing.svg +26 -26
  52. data/documentation/diagrams/zero-day-research-flow.svg +25 -25
  53. data/documentation/pwn-ai-Agent.md +16 -10
  54. data/documentation/pwn_silent_help_learn_demo.gif +0 -0
  55. data/lib/pwn/ai/agent/assembly.rb +1 -1
  56. data/lib/pwn/ai/agent/btc.rb +1 -1
  57. data/lib/pwn/ai/agent/burp_suite.rb +1 -1
  58. data/lib/pwn/ai/agent/extrospection.rb +2562 -57
  59. data/lib/pwn/ai/agent/gqrx.rb +2 -2
  60. data/lib/pwn/ai/agent/hacker_one.rb +1 -1
  61. data/lib/pwn/ai/agent/learning.rb +16 -16
  62. data/lib/pwn/ai/agent/loop.rb +1 -1
  63. data/lib/pwn/ai/agent/{introspection.rb → reflect.rb} +12 -12
  64. data/lib/pwn/ai/agent/sast.rb +1 -1
  65. data/lib/pwn/ai/agent/tools/extrospection.rb +311 -8
  66. data/lib/pwn/ai/agent/tools/learning.rb +7 -7
  67. data/lib/pwn/ai/agent/transparent_browser.rb +1 -1
  68. data/lib/pwn/ai/agent/vuln_gen.rb +2 -2
  69. data/lib/pwn/ai/agent.rb +1 -1
  70. data/lib/pwn/ai/open_ai.rb +10 -6
  71. data/lib/pwn/config.rb +5 -4
  72. data/lib/pwn/ffi/adalm_pluto.rb +498 -0
  73. data/lib/pwn/ffi/fftw.rb +192 -0
  74. data/lib/pwn/ffi/hack_rf.rb +193 -0
  75. data/lib/pwn/ffi/liquid.rb +244 -0
  76. data/lib/pwn/ffi/rtl_sdr.rb +210 -0
  77. data/lib/pwn/ffi/soapy_sdr.rb +177 -0
  78. data/lib/pwn/ffi/stdio.rb +9 -1
  79. data/lib/pwn/ffi/volk.rb +241 -0
  80. data/lib/pwn/ffi.rb +45 -2
  81. data/lib/pwn/plugins/burp_suite.rb +2 -2
  82. data/lib/pwn/sast/pom_version.rb +2 -2
  83. data/lib/pwn/sast/test_case_engine.rb +1 -1
  84. data/lib/pwn/sdr/decoder/adsb.rb +201 -12
  85. data/lib/pwn/sdr/decoder/apt.rb +19 -5
  86. data/lib/pwn/sdr/decoder/base.rb +314 -1
  87. data/lib/pwn/sdr/decoder/bluetooth.rb +91 -18
  88. data/lib/pwn/sdr/decoder/dect.rb +81 -23
  89. data/lib/pwn/sdr/decoder/dsp.rb +229 -15
  90. data/lib/pwn/sdr/decoder/flex.rb +23 -6
  91. data/lib/pwn/sdr/decoder/gps.rb +80 -18
  92. data/lib/pwn/sdr/decoder/gsm.rb +83 -28
  93. data/lib/pwn/sdr/decoder/iridium.rb +80 -18
  94. data/lib/pwn/sdr/decoder/lora.rb +84 -28
  95. data/lib/pwn/sdr/decoder/lte.rb +80 -18
  96. data/lib/pwn/sdr/decoder/morse.rb +23 -6
  97. data/lib/pwn/sdr/decoder/p25.rb +90 -31
  98. data/lib/pwn/sdr/decoder/pager.rb +23 -6
  99. data/lib/pwn/sdr/decoder/pocsag.rb +23 -6
  100. data/lib/pwn/sdr/decoder/rds.rb +219 -52
  101. data/lib/pwn/sdr/decoder/rfid.rb +81 -27
  102. data/lib/pwn/sdr/decoder/rtl433.rb +85 -27
  103. data/lib/pwn/sdr/decoder/rtty.rb +23 -6
  104. data/lib/pwn/sdr/decoder/wifi.rb +86 -32
  105. data/lib/pwn/sdr/decoder/zigbee.rb +88 -35
  106. data/lib/pwn/sdr/decoder.rb +6 -5
  107. data/lib/pwn/sdr/frequency_allocation.rb +124 -81
  108. data/lib/pwn/sdr/gqrx.rb +1513 -165
  109. data/lib/pwn/version.rb +1 -1
  110. data/spec/lib/pwn/ai/agent/extrospection_spec.rb +96 -0
  111. data/spec/lib/pwn/ai/agent/{introspection_spec.rb → reflect_spec.rb} +3 -3
  112. data/spec/lib/pwn/ai/agent/tools/extrospection_spec.rb +8 -24
  113. data/spec/lib/pwn/ffi/adalm_pluto_spec.rb +37 -0
  114. data/spec/lib/pwn/ffi/fftw_spec.rb +26 -0
  115. data/spec/lib/pwn/ffi/hack_rf_spec.rb +25 -0
  116. data/spec/lib/pwn/ffi/liquid_spec.rb +42 -0
  117. data/spec/lib/pwn/ffi/rtl_sdr_spec.rb +24 -0
  118. data/spec/lib/pwn/ffi/soapy_sdr_spec.rb +25 -0
  119. data/spec/lib/pwn/ffi/volk_spec.rb +36 -0
  120. data/spec/lib/pwn/sdr/decoder/base_iq_spec.rb +65 -0
  121. data/spec/lib/pwn/sdr/decoder/dsp_spec.rb +50 -4
  122. data/spec/lib/pwn/sdr/decoder/rds_spec.rb +45 -4
  123. data/third_party/pwn_rdoc.jsonl +279 -30
  124. metadata +21 -5
@@ -36,10 +36,10 @@
36
36
  | | |
37
37
  |---|---|
38
38
  | [AI / LLM Integration](AI-Integration.md) | OpenAI · Anthropic · Grok (OAuth) · Gemini · Ollama |
39
- | [Agent Tool Registry](Agent-Tool-Registry.md) | 10 toolsets · 54 LLM-callable tools |
39
+ | [Agent Tool Registry](Agent-Tool-Registry.md) | 10 toolsets · 61 LLM-callable tools |
40
40
  | [Memory · Skills · Learning](Skills-Memory-Learning.md) | Introspection — the self-improvement loop |
41
41
  | [Mistakes](Mistakes.md) | **Negative feedback** — fingerprint failures · do-NOT-repeat · `[REPEATING]`/`[REGRESSED]` · inline self-correction |
42
- | [Extrospection](Extrospection.md) | World-awareness — snapshot · drift · intel · **watch** · **verify** · correlate · **rf** · **web** |
42
+ | [Extrospection](Extrospection.md) | World-awareness — snapshot · drift · intel · **watch** · **verify** · **rf_tune** · correlate · **rf** · **web** |
43
43
  | [Swarm (Multi-Agent)](Swarm.md) | Personas · ask · debate · broadcast · shared bus |
44
44
  | [Sessions](Sessions.md) | Transcript persistence + reflection |
45
45
  | [Cron](Cron.md) | Scheduled autonomous jobs |
@@ -58,11 +58,11 @@
58
58
  | [SAST (48 rules)](SAST.md) | Static analysis + test-case engine |
59
59
  | [WWW (21 drivers)](WWW.md) | Browser automations for real sites |
60
60
  | [AWS (90 services)](AWS.md) | Cloud-security enumeration |
61
- | [SDR](SDR.md) | GQRX · FlipperZero · RFIDler · SonMicro · **Decoder::* (20 protocols)** |
61
+ | [SDR](SDR.md) | GQRX · FlipperZero · RFIDler · SonMicro · **Decoder::* (20)** · FFI-accelerated DSP |
62
62
  | [Blockchain](Blockchain.md) | BTC · ETH helpers |
63
63
  | [Bounty](Bounty.md) | Lifecycle / auth-replay tooling |
64
64
  | [Reports](Reporting.md) | HTML/JSON output + DefectDojo/Jira |
65
- | [FFI](FFI.md) | Native calls |
65
+ | [FFI](FFI.md) | Native DSP/RF backends (Volk · Liquid · FFTW · HackRF · RTL-SDR · SoapySDR) |
66
66
  | [Banner](Banner.md) | 15 startup banners |
67
67
 
68
68
  ## 🛠️ Meta
@@ -27,12 +27,12 @@ hardware).
27
27
  | Module | Role |
28
28
  |---|---|
29
29
  | `Loop` | plan → dispatch tool_calls → observe → repeat until final answer |
30
- | `Registry` | JSON-Schema function definitions grouped into 10 **toolsets** · 54 tools |
30
+ | `Registry` | JSON-Schema function definitions grouped into 10 **toolsets** · 61 tools |
31
31
  | `Dispatch` / `Result` | execute a tool, capture stdout/value/error/duration |
32
32
  | `PromptBuilder` | inject MEMORY / SKILLS / LEARNING / **KNOWN MISTAKES + FIXES** / METRICS / EXTROSPECTION blocks |
33
33
  | `Metrics` · `Learning` | **introspection** — how well am I doing? |
34
34
  | `Mistakes` | **negative feedback** — fingerprint failures, do NOT repeat, `[REPEATING]`/`[REGRESSED]`, inline `correction_hint` |
35
- | `Extrospection` | **extrospection** — what does the world look like? (host · net · toolchain · repo · env · **rf**) |
35
+ | `Extrospection` | **extrospection** — on-demand world sensing (`intel` · **`verify`** · **`watch`** · **`rf_tune`**) + ambient baseline (host · net · toolchain · repo · env · **rf** · **web**) joined to introspection via `correlate` |
36
36
  | `Swarm` | multi-agent personas over a shared JSONL bus |
37
37
 
38
38
  See [Agent Tool Registry](Agent-Tool-Registry.md) for every tool the LLM can call.
@@ -56,7 +56,11 @@ See [Persistence](Persistence.md) for the byte-level layout of each file.
56
56
 
57
57
  The reason L2 exists is to close this loop on every turn — successes
58
58
  become skills/lessons, **failures become fingerprinted mistakes with fixes**,
59
- and both are re-injected into the very next system prompt:
59
+ **world-state is sensed on demand** (`extro_verify` / `extro_watch` /
60
+ `extro_rf_tune` / `extro_osint` / `extro_serial` / `extro_telecomm` / `extro_packet` / `extro_vision` / `extro_voice` / `extro_intel`) and correlated against those failures, and
61
+ **all six prompt blocks** (MEMORY · SKILLS · LEARNING · KNOWN MISTAKES/FIXES ·
62
+ TOOL EFFECTIVENESS · EXTROSPECTION) are re-injected into the very next system
63
+ prompt:
60
64
 
61
65
  ![Self-improvement loop](diagrams/pwn-ai-feedback-learning-loop.svg)
62
66
 
@@ -90,6 +90,15 @@ and the entry re-enters the `KNOWN MISTAKES` block tagged `[REGRESSED]` with
90
90
  its (now-insufficient) previous fix shown inline — the strongest possible
91
91
  "your last fix didn't hold" signal.
92
92
 
93
+ ## Join with Extrospection
94
+
95
+ A tool failure is **not always the agent's fault**. Before treating a
96
+ `[REPEATING]` signature as a pure technique bug, call `extro_correlate` —
97
+ it cross-checks Mistakes / Metrics / Learning against host/toolchain/rf/web
98
+ drift so the agent can distinguish "I called the API wrong" from "nmap was
99
+ upgraded", "the HackRF was unplugged", or "the target DOM moved". See
100
+ [Extrospection](Extrospection.md#extro_correlate--the-point-of-the-whole-thing).
101
+
93
102
  **See also:** [Skills, Memory & Learning](Skills-Memory-Learning.md) ·
94
103
  [Extrospection](Extrospection.md) · [Persistence](Persistence.md) ·
95
104
  [pwn-ai Agent](pwn-ai-Agent.md)
data/documentation/SDR.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  | Module | Purpose |
8
8
  |---|---|
9
- | **`GQRX`** | Remote-control a running GQRX instance over TCP: tune, set demod, squelch, record, `get_spectrum_snapshot` (pure-Ruby FFT — median noise floor, DC/LO-leakage null, band-edge guard), `fast_scan_range` |
9
+ | **`GQRX`** | Remote-control a running GQRX instance over TCP: tune, set demod, squelch, record, `get_spectrum_snapshot` (pure-Ruby FFT — median NF, relative peak/prominence, **plan-parametric** min-distance & −6 dB BW), `fast_scan_range` (**always RAW @ sample_rate** panoramic capture; band-plan IF deferred to refine/decoder; `#fft_plan_geometry` derives sep/merge/refine/snap from `(plan_bw, step, res)`; local-FFT refine + S-meter confirm; schema-parity with `scan_range`) |
10
10
  | `FlipperZero` | Serial control of Flipper (sub-GHz, NFC, IR, iButton) |
11
11
  | `RFIDler` | 125 kHz RFID reader/emulator |
12
12
  | `SonMicroRFID` | SM130 13.56 MHz reader |
@@ -16,16 +16,39 @@
16
16
  ## CLI
17
17
 
18
18
  ```bash
19
- # FFT sweep — SNR-gated peak detection (no false-positive flood)
20
- pwn_gqrx_scanner --start 430e6 --stop 440e6 --fft-scan \
19
+ # FFT sweep — plan-parametric peak geometry + local-FFT refine for exact centres
20
+ # Works for ALL band plans (CW 150 Hz → FLEX 20 kHz → FM 200 kHz → GPS 30 MHz)
21
+ pwn_gqrx_scanner -a pager_flex --fft-scan # alias: flex_pager
22
+ pwn_gqrx_scanner -a fm_radio --fft-scan --min-snr-db 18
23
+ pwn_gqrx_scanner -a am_radio --fft-scan --no-refine
24
+ pwn_gqrx_scanner --scan-ranges 430.000.000-440.000.000 --fft-scan \
21
25
  --avg 8 --min-snr-db 10 --capture-secs 0.10
26
+ # Skip refine (pure panoramic): add --no-refine
27
+ # Explicit S-meter lock (skips auto-cal from live NF): -S -55
22
28
 
23
29
  # Classic iterative S-meter scan
24
- pwn_gqrx_scanner --start 118e6 --stop 137e6 --step 12.5e3 \
25
- --strength-lock -60 --audio-gain-db 6
30
+ pwn_gqrx_scanner -a aviation_vhf
31
+ pwn_gqrx_scanner -s 118.000.000-137.000.000 -D AM -b 25.000 -P 4 -S -60
26
32
  ```
27
33
 
28
- See skill `pwn_gqrx_scanner_fast_vs_iterative_scanning` for the trade-off.
34
+ ### `--fft-scan` geometry (all 84 band plans)
35
+
36
+ Every detector/refine/merge knob is a pure function of the two band-plan
37
+ invariants already on each plan (`bandwidth` → `plan_bw_hz`, `precision` →
38
+ `step_hz = 10**(precision-1)`) plus spectrum resolution `res_hz = sample_rate/nfft`:
39
+
40
+ | Stage | Rule |
41
+ |---|---|
42
+ | Capture IF | **Always** `M RAW sample_rate` (IQRECORD is demod IF — never plan FM/20 kHz) |
43
+ | Peak height / prom | Relative: `median_nf + 12 dB`, prom ≥ 8 dB |
44
+ | Peak min-distance | `#fft_plan_geometry` → `sep_hz = max(0.5·plan, step, floor)` |
45
+ | Occupied BW | −6 dB-from-peak contour, hard-capped to `± plan_bw` |
46
+ | Centre | Power-weighted centroid of −6 dB lobe → raster snap |
47
+ | Merge | `tol = max(½ plan, step, ½ measured_bw, 2·res)` |
48
+ | Refine window | ~0.6·plan (capped so next neighbour is outside); local high-res FFT |
49
+ | Strength lock | Auto from live S-meter NF + 8 dB unless `-S` given |
50
+
51
+ See skill `pwn_gqrx_scanner_fast_vs_iterative_scanning` for the full trade-off.
29
52
 
30
53
  ## REPL example
31
54
 
@@ -38,20 +61,70 @@ PWN::SDR::FrequencyAllocation.lookup(freq: 433_920_000)
38
61
  # => { band: 'ISM 433', typical: ['garage doors', 'weather stations', …] }
39
62
  ```
40
63
 
64
+
65
+ ## Native DSP acceleration (`PWN::FFI`)
66
+
67
+ `PWN::SDR::Decoder::DSP` transparently accelerates hot paths when the host
68
+ has the matching shared libraries:
69
+
70
+ | DSP method | Backend | Library |
71
+ |---|---|---|
72
+ | `unpack_s16le` | `PWN::FFI::Volk` | libvolk |
73
+ | `resample` | `PWN::FFI::Liquid` | libliquid |
74
+ | `dc_block(m:)` | `PWN::FFI::Liquid` | libliquid |
75
+ | `rms_dbfs` (≥64) | `PWN::FFI::Volk` | libvolk |
76
+
77
+ ```ruby
78
+ PWN::FFI.backends
79
+ # => {FFTW: true, HackRF: true, Liquid: true, RTLSdr: true, SoapySDR: true, Volk: true}
80
+
81
+ # Force pure-Ruby (e.g. for tests / A/B)
82
+ PWN::SDR::Decoder::DSP.native = false
83
+ ```
84
+
85
+ Front-end inventory & raw I/Q capture:
86
+
87
+ ```ruby
88
+ PWN::FFI::SoapySDR.list_devices
89
+ # => [{driver: "hackrf", label: "HackRF Pro #0 …", serial: "…"}, …]
90
+
91
+ PWN::FFI::RTLSdr.list_devices
92
+ dev = PWN::FFI::HackRF.open
93
+ PWN::FFI::HackRF.configure(device: dev, freq_hz: 433_920_000, rate_hz: 10e6)
94
+ PWN::FFI::HackRF.close(device: dev)
95
+ ```
96
+
97
+ See [FFI](FFI.md) for the full binding surface and design rules.
98
+
41
99
  ## RF ↔ Extrospection
42
100
 
43
- The AI agent is RF-aware. `extro_snapshot(sections: [:rf])` runs `probe_rf`
44
- (RTL-SDR / HackRF / SoapySDR / Flipper / GQRX-socket inventory) and RF signal
45
- intel is recorded with a first-class `:rf` observation category:
101
+ The AI agent is RF-aware. Two layers:
102
+
103
+ | Layer | Call | Role |
104
+ |---|---|---|
105
+ | **Passive inventory** | `extro_snapshot(sections: [:rf])` → `probe_rf` | RTL-SDR / HackRF / SoapySDR / Flipper / GQRX-socket presence |
106
+ | **Active sense organ** | **`extro_rf_tune(freq: "101.1")`** | Connect to a *running* GQRX remote-control socket, tune, demod, measure strength, sample RDS → `now_playing` / `station` |
46
107
 
47
108
  ```ruby
109
+ # record a recon finding
48
110
  extro_observe(source: 'gqrx', category: :rf, target: '433.920MHz',
49
111
  data: 'peak -34.2 dBFS bw=200k FSK — likely garage remote')
112
+
113
+ # ask the radio a question (RDS on FM broadcast)
114
+ extro_rf_tune(freq: '101.1')
115
+ # → { ok:true, freq:"101.1 MHz", strength_dbfs:-2.8, station:"X96",
116
+ # now_playing:"Mr. Brightside by The Killers", rds:{pi,ps_name,radiotext}, … }
117
+ # → observe(category: :rf, ttl: 300) # songs are ephemeral
50
118
  ```
51
119
 
120
+ RDS sampling is `PWN::SDR::Decoder::RDS.sample` (non-interactive Hash). The
121
+ TTY spinner (`Decoder::RDS.decode`) stays the human path used by
122
+ `GQRX.init_freq(decoder: :rds)`. Agents and cron use `extro_rf_tune` /
123
+ `.sample(interactive: false)`.
124
+
52
125
  `extro_correlate` then cross-references `:rf` observations against missing
53
126
  `RF_BINS` / unplugged hardware so the agent can tell "no signal" from "no
54
- dongle".
127
+ dongle" / "GQRX remote control is down".
55
128
 
56
129
  **See also:** [Hardware](Hardware.md) · [Extrospection](Extrospection.md)
57
130
 
@@ -19,18 +19,26 @@ its own performance, turns wins into permanent capability, and — critically
19
19
  ## The lifecycle of a lesson
20
20
 
21
21
  ```text
22
- 1. Dispatch runs a tool → Metrics.record(tool, ok?, ms)
23
- ↳ tool FAILED? → Mistakes.record(tool, error) (count++, cross-session)
24
- ↳ same sig ≥3×? → guard_repeated_failure + inline correction_hint
25
- 2. Final answer produced → Learning.auto_reflect(session_id)
26
- 3. Reflect finds a durable insight Memory.remember(lesson_xxxx, …)
27
- 4. A whole workflow succeeded Learning.distill_skill(name, session_id, references:)
28
- 5. Found a fix for a mistake mistakes_resolve(sig, fix) → Memory :lesson "AVOID X — FIX: Y"
29
- 6. Next launch: PromptBuilder injects all five blocks the model already knows.
22
+ 1. Dispatch runs a tool → Metrics.record(tool, ok?, ms)
23
+ ↳ tool FAILED? → Mistakes.record(tool, error) (count++, cross-session)
24
+ ↳ same sig ≥3×? → guard_repeated_failure + inline correction_hint
25
+ 2. Agent senses the world (opt) → extro_verify / watch / rf_tune / osint / serial / telecomm / packet / vision / voice / intel / observe
26
+ extro_verify :refuted Mistakes.record(tool:'assumption', …) # proactive
27
+ extro_verify :confirmed observe(:intel, ttl:30d)
28
+ 3. Final answer produced Learning.auto_introspect(session_id)
29
+ if auto_extrospect enabled Extrospection.auto_extrospect # AUTO_SECTIONS only
30
+ 4. Reflect finds a durable insight → Memory.remember(lesson_xxxx, …)
31
+ 5. A whole workflow succeeded → Learning.distill_skill(name, session_id, references:)
32
+ 6. Found a fix for a mistake → mistakes_resolve(sig, fix) → Memory :lesson "AVOID X — FIX: Y"
33
+ 7. Next launch: PromptBuilder injects all six blocks → the model already knows:
34
+ MEMORY · SKILLS · LEARNING · KNOWN MISTAKES/FIXES · TOOL EFFECTIVENESS · EXTROSPECTION
30
35
  ```
31
36
 
32
- See **[Mistakes](Mistakes.md)** for the full negative-feedback mechanics
33
- (fingerprinting, `[REPEATING]`, `[REGRESSED]`, user-correction detection).
37
+ `extro_correlate` is the **join** it tells the agent whether a failure was
38
+ *its* fault (belongs in Mistakes) or *the world* changed (kernel upgrade,
39
+ dongle unplugged, target DOM moved). See **[Mistakes](Mistakes.md)** for the
40
+ negative-feedback mechanics and **[Extrospection](Extrospection.md)** for the
41
+ outward half.
34
42
 
35
43
  ## Skill file format
36
44
 
@@ -66,7 +74,89 @@ the `## References` section, deduplicates, and exposes them via
66
74
  | `mistakes_reset(confirm: true)` | new host/engagement — prior failure patterns no longer apply |
67
75
  | `metrics_reset(confirm: true)` | fixed a broken tool; stale 0 % is misleading |
68
76
  | `skill_delete(name)` | auto-distilled skill turned out low-quality |
69
- | `learning_auto_reflect_toggle(enabled: false)` | during noisy fuzz loops |
77
+ | `learning_auto_introspect_toggle(enabled: false)` | during noisy fuzz loops |
78
+
79
+ ## Example questions that trigger Introspection
80
+
81
+ Natural-language prompts that should fire the **inward** half of the learning
82
+ feedback loop (Memory · Skills · Learning · Mistakes · Metrics). Pair these with
83
+ the outward catalog in [Extrospection](Extrospection.md#example-questions-that-trigger-extrospection)
84
+ when deciding which side of the loop to exercise.
85
+
86
+ ### Memory (`memory_remember`, `memory_recall`, `memory_forget`, `memory_clear`)
87
+
88
+ - “Remember that our preferred AI engine for long recon chains is grok-4.5.”
89
+ - “What do we already know about OpenSSH 8.2p1 from prior sessions?”
90
+ - “Forget the stale fact about the old HackRF serial — it was replaced.”
91
+ - “Store this as a durable lesson: always back up source files before patching.”
92
+ - “Recall any preference we set for Burp/ZAP proxy ports.”
93
+
94
+ ### Skills (`skill_list`, `skill_view`, `skill_create`, `skill_add_reference`, `skill_delete`, `learning_distill_skill`)
95
+
96
+ - “What skills do we have for SQLi / RDS / GQRX scanning?”
97
+ - “Show me the full body of `vulnerability_research_fundamentals`.”
98
+ - “Distill this successful session into a reusable skill for ADS-B capture.”
99
+ - “Add CWE-89 and T1190 as references on the `sqli_union_enum` skill.”
100
+ - “Delete the low-quality auto-distilled skill from yesterday’s fuzz loop.”
101
+ - “Create a skill that walks GQRX remote control → `extro_rf_tune` → observe.”
102
+
103
+ ### Learning outcomes & reflection (`learning_note_outcome`, `learning_reflect`, `learning_outcomes`, `learning_stats`, `learning_consolidate`)
104
+
105
+ - “Record that the video-generation pipeline succeeded (ffmpeg + flite).”
106
+ - “What was our success rate over the last 50 attempts?”
107
+ - “Reflect on session `20260709_172057_49594079` and extract durable lessons.”
108
+ - “Show only the recent *failures* tagged with `extrospection` or `rf`.”
109
+ - “Consolidate near-duplicate MEMORY lessons — cap at 200 entries.”
110
+ - “Reset learning outcomes; the dev experiment noise polluted the rate.” *(destructive)*
111
+
112
+ ### Mistakes / negative feedback (`mistakes_list`, `mistakes_record`, `mistakes_resolve`, `mistakes_reset`)
113
+
114
+ - “What mistakes keep recurring across sessions?”
115
+ - “I just assumed Registry had `.list` — record that as an assumption mistake.”
116
+ - “Resolve signature `1b6f88b46ce2` — the fix is use `.all` / `.lookup`, not `.list`.”
117
+ - “Show only unresolved fingerprints sorted by count.”
118
+ - “That last approach was wrong; fingerprint it so we don’t repeat it.”
119
+ - “Wipe mistakes.json for a clean slate on the new engagement host.” *(destructive)*
120
+
121
+ ### Metrics / tool effectiveness (`metrics_summary`, `metrics_reset`)
122
+
123
+ - “Which tools have the lowest success rate right now?”
124
+ - “How often has `shell` been called, and what’s its avg duration?”
125
+ - “Is `extro_rf_tune` healthier than the old GQRX helpers by metrics?”
126
+ - “Reset metrics after we fixed the broken tool so the 0 % doesn’t steer us away.” *(destructive)*
127
+
128
+ ### Sessions / transcripts (`sessions_list`, `sessions_view`, `sessions_current`, `sessions_stats`, `sessions_delete`)
129
+
130
+ - “What’s the active session id?”
131
+ - “List the last 10 sessions and their sizes.”
132
+ - “Open session X and show the last 50 turns (truncated).”
133
+ - “How much disk are session transcripts using overall?”
134
+ - “Delete the noisy fuzz-experiment transcript so reflect() stays high-signal.”
135
+
136
+ ### Loop toggles & housekeeping
137
+
138
+ - “Disable auto-introspect while we fuzz; re-enable for the summary turn.”
139
+ - “Is auto-introspect currently on?”
140
+ - “Revalidate MEMORY facts that contain CVEs / versions / URLs.” *(joins Extrospection.revalidate_memory)*
141
+ - “Why did that tool start failing — my fault or world drift?” → `extro_correlate` then Mistakes vs Learning
142
+
143
+ ### Short “trigger” patterns the agent should recognize
144
+
145
+ | Pattern | Likely tools |
146
+ |--------|----------------|
147
+ | “Remember / recall / forget that…” | `memory_remember` / `memory_recall` / `memory_forget` |
148
+ | “What skills do we have for… / distill this” | `skill_*` / `learning_distill_skill` |
149
+ | “Did that work? / note the outcome / success rate” | `learning_note_outcome` / `learning_stats` |
150
+ | “Reflect on this session / extract lessons” | `learning_reflect` / `sessions_current` |
151
+ | “Don’t do that again / that was wrong / resolve…” | `mistakes_record` / `mistakes_resolve` / `mistakes_list` |
152
+ | “Which tools are unhealthy / avg duration” | `metrics_summary` |
153
+ | “What did we run in session X / active session” | `sessions_view` / `sessions_current` |
154
+ | “Disable reflection while we fuzz” | `learning_auto_introspect_toggle` |
155
+
156
+ Contrast with **Extrospection** examples: weather in Chicago, “what’s on 101.1”,
157
+ CVE fact-checks, and host drift are *outside-world* senses. The table above is
158
+ purely *self* measurement — how well the agent did, what it must stop repeating,
159
+ and which procedures to promote permanently.
70
160
 
71
161
  **See also:** [Mistakes](Mistakes.md) — the negative-feedback half ·
72
162
  [Extrospection](Extrospection.md) — the outward-facing half ·