pwn 0.5.636 → 0.5.637

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 (46) hide show
  1. checksums.yaml +4 -4
  2. data/bin/pwn_setup +11 -0
  3. data/documentation/Agent-Tool-Registry.md +12 -5
  4. data/documentation/CLI-Drivers.md +37 -31
  5. data/documentation/Configuration.md +16 -3
  6. data/documentation/Contributing.md +9 -2
  7. data/documentation/Cron.md +21 -1
  8. data/documentation/Diagrams.md +6 -2
  9. data/documentation/Drivers.md +1 -1
  10. data/documentation/General-PWN-Usage.md +7 -1
  11. data/documentation/Home.md +1 -1
  12. data/documentation/How-PWN-Works.md +31 -17
  13. data/documentation/Installation.md +85 -53
  14. data/documentation/Persistence.md +34 -8
  15. data/documentation/Plugins.md +5 -5
  16. data/documentation/Reinforcement-Learning.md +7 -0
  17. data/documentation/Sessions.md +6 -2
  18. data/documentation/Skills-Memory-Learning.md +26 -10
  19. data/documentation/Troubleshooting.md +23 -0
  20. data/documentation/What-is-PWN.md +12 -6
  21. data/documentation/Why-PWN.md +3 -2
  22. data/documentation/diagrams/agent-tool-registry.svg +105 -102
  23. data/documentation/diagrams/cron-scheduling.svg +137 -78
  24. data/documentation/diagrams/dot/agent-tool-registry.dot +4 -4
  25. data/documentation/diagrams/dot/cron-scheduling.dot +25 -9
  26. data/documentation/diagrams/dot/history-to-drivers.dot +1 -1
  27. data/documentation/diagrams/dot/memory-skills-detailed.dot +10 -4
  28. data/documentation/diagrams/dot/overall-pwn-architecture.dot +2 -2
  29. data/documentation/diagrams/dot/persistence-filesystem.dot +18 -11
  30. data/documentation/diagrams/dot/pwn-ai-feedback-learning-loop.dot +19 -4
  31. data/documentation/diagrams/dot/reinforcement-learning.dot +102 -0
  32. data/documentation/diagrams/history-to-drivers.svg +6 -6
  33. data/documentation/diagrams/memory-skills-detailed.svg +233 -198
  34. data/documentation/diagrams/overall-pwn-architecture.svg +168 -168
  35. data/documentation/diagrams/persistence-filesystem.svg +212 -136
  36. data/documentation/diagrams/pwn-ai-feedback-learning-loop.svg +386 -283
  37. data/documentation/diagrams/reinforcement-learning.svg +392 -0
  38. data/documentation/pwn-REPL.md +33 -4
  39. data/documentation/pwn-ai-Agent.md +42 -30
  40. data/lib/pwn/plugins/repl.rb +78 -15
  41. data/lib/pwn/setup.rb +171 -4
  42. data/lib/pwn/version.rb +1 -1
  43. data/pwn.gemspec +2 -0
  44. data/third_party/pwn_rdoc.jsonl +2 -0
  45. data/third_party/terminator/pwn_shift_enter.py +137 -0
  46. metadata +6 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41a8a5c5d750508d4f3904d7a05151719e2c86fa4cf20001a3aab0985910963d
4
- data.tar.gz: 7af0757b53bdfa6c97d86a9415a2cbf41ca9447b3f9e438b95b2424f5d835cbf
3
+ metadata.gz: 0201dea34ecdcd8a8a04debd2beea9f8faf296806dda78067873a023e3dd311e
4
+ data.tar.gz: f82990f46e0b6bccc2bf1020c41d19e681fa48e1ff6b96904b762e8d7a206716
5
5
  SHA512:
6
- metadata.gz: 8053f31ef3138368e50c1b6920fa7804945f508daabc31191ba2a9578f3c31f7e6629e1ca901a409ec82e4cefdf3a824fa48bcfe4fdcd8ab4a1a9da0f168e1da
7
- data.tar.gz: 592bfb24c2c2a610813fcd5b8431478d4774ef312405f446393db9cbb305c2c223b129a0714b9b464adc9976e682b1754a4e5d760d0ca28b00ba99778df21d7a
6
+ metadata.gz: '036668a7388b08f9aed7fe00d92b3034c3b47c9e29a0dccf92f3a2eb5149f9948d7283420a679547737763f2934a2df959f367ae33d08c1c785be6ff3db8dbe1'
7
+ data.tar.gz: d89b96e1dc380a4f87d0d82249c64213caa4c7f06a7ba8d20efe4a284ca1017b12de1f4bafaec66946d14efb31d4d9281dfc69c11fb840e3d74bc32c58f12415
data/bin/pwn_setup CHANGED
@@ -44,6 +44,12 @@ pwn_driver = PWN::Driver::Parser.new do |options|
44
44
  opts[:yes] = o
45
45
  end
46
46
 
47
+ options.on('-t', '--terminal',
48
+ '<Optional - Opt-in SHIFT+ENTER multi-line support: prints ~/.tmux.conf lines and, ' \
49
+ 'under Terminator, installs the PWNShiftEnter GTK plugin (with confirmation)>') do |o|
50
+ opts[:terminal] = o
51
+ end
52
+
47
53
  options.on('-n', '--dry-run',
48
54
  '<Optional - Print the commands that would run, do not execute>') do |o|
49
55
  opts[:dry_run] = o
@@ -61,6 +67,11 @@ begin
61
67
  dry_run: opts[:dry_run]
62
68
  )
63
69
  exit 1 unless r && r[:after] && r[:after][:incompatible].empty?
70
+ elsif opts[:terminal]
71
+ PWN::Setup.terminal(
72
+ yes: opts[:yes],
73
+ dry_run: opts[:dry_run]
74
+ )
64
75
  elsif opts[:deps] || opts[:profile]
65
76
  PWN::Setup.deps(
66
77
  profile: opts[:profile],
@@ -6,21 +6,25 @@ toolsets; the JSON-Schema for each tool is what the model actually sees.
6
6
 
7
7
  ![Tool registry](diagrams/agent-tool-registry.svg)
8
8
 
9
- ## Toolsets → Tools (10 toolsets · 61 tools)
9
+ ## Toolsets → Tools (10 toolsets · 71 tools)
10
10
 
11
11
  | Toolset | Tools | Backed by |
12
12
  |---|---|---|
13
13
  | `terminal` | `shell` | `Open3.capture3` on the host |
14
14
  | `pwn` | `pwn_eval` | `TOPLEVEL_BINDING.eval` in the live REPL process |
15
15
  | `memory` | `memory_remember` · `memory_recall` · `memory_forget` · `memory_clear` | `PWN::Memory` → `~/.pwn/memory.json` |
16
- | `skills` | `skill_list` · `skill_view` · `skill_create` · `skill_add_reference` · `skill_delete` · `skill_migrate_legacy` | `~/.pwn/skills/<name>/SKILL.md` (agentskills.io; legacy flat `*.md` still read) |
16
+ | `skills` | `skill_list` · `skill_view` · `skill_create` · `skill_add_reference` · `skill_delete` · `skill_migrate_legacy` | `~/.pwn/skills/<name>/SKILL.md` (**[agentskills.io](https://agentskills.io) spec**; legacy flat `*.md` auto-migrated) |
17
17
  | `sessions` | `sessions_list` · `sessions_view` · `sessions_current` · `sessions_delete` · `sessions_stats` | `PWN::Sessions` → `~/.pwn/sessions/` |
18
- | `learning` | `learning_note_outcome` · `learning_reflect` · `learning_distill_skill` · `learning_stats` · `learning_outcomes` · `learning_consolidate` · `learning_reset` · `learning_auto_introspect_toggle` · `learning_purge_noise` · **`mistakes_list`** · **`mistakes_record`** · **`mistakes_resolve`** · **`mistakes_reset`** · **`reward_judge`** · **`reward_prm`** · **`reward_sentinel`** · **`reward_preferences`** · **`reward_export_dpo`** · **`curriculum_practice`** · **`curriculum_train`** · **`curriculum_hindsight`** | `PWN::AI::Agent::Learning` + `Mistakes` + `Reward` + `Curriculum` → `~/.pwn/learning.jsonl` + `~/.pwn/mistakes.json` + `~/.pwn/preferences.jsonl` + `~/.pwn/curriculum/` |
18
+ | `learning` | `learning_note_outcome` · `learning_reflect` · `learning_distill_skill` · `learning_stats` · `learning_outcomes` · `learning_consolidate` · `learning_reset` · `learning_auto_introspect_toggle` · **`mistakes_list`** · **`mistakes_record`** · **`mistakes_resolve`** · **`mistakes_reset`** · **`reward_judge`** · **`reward_prm`** · **`reward_sentinel`** · **`reward_preferences`** · **`reward_export_dpo`** · **`curriculum_practice`** · **`curriculum_train`** · **`curriculum_hindsight`** · **`learning_purge_noise`** | `PWN::AI::Agent::Learning` + `Mistakes` + `Reward` + `Curriculum` → `~/.pwn/learning.jsonl` + `~/.pwn/mistakes.json` + `~/.pwn/preferences.jsonl` + `~/.pwn/curriculum/` + `~/.pwn/finetune/` |
19
19
  | `metrics` | `metrics_summary` · `metrics_reset` | `PWN::AI::Agent::Metrics` → `~/.pwn/metrics.json` |
20
- | `extrospection` | `extro_snapshot` · `extro_drift` · `extro_observe` · `extro_observations` · `extro_intel` · **`extro_watch`** · **`extro_verify`** · **`extro_rf_tune`** · **`extro_osint`** · **`extro_serial`** · **`extro_telecomm`** · **`extro_packet`** · **`extro_vision`** · **`extro_voice`** · `extro_correlate` · `extro_stats` · `extro_reset` · `extro_auto_toggle` | `PWN::AI::Agent::Extrospection` (+ Serial/Packet/OCR/Voice/BareSIP/TransparentBrowser) → `~/.pwn/extrospection.json` |
20
+ | `extrospection` | `extro_snapshot` · `extro_drift` · `extro_observe` · `extro_observations` · `extro_intel` · **`extro_watch`** · **`extro_verify`** · **`extro_rf_tune`** · **`extro_osint`** · **`extro_serial`** · **`extro_telecomm`** · **`extro_packet`** · **`extro_vision`** · **`extro_voice`** · `extro_correlate` · `extro_stats` · `extro_reset` · `extro_auto_toggle` | `PWN::AI::Agent::Extrospection` (+ Serial/Packet/OCR/Voice/BareSIP/TransparentBrowser/GQRX) → `~/.pwn/extrospection.json` |
21
21
  | `cron` | `cron_list` · `cron_create` · `cron_run` · `cron_enable` · `cron_disable` · `cron_remove` | `PWN::Cron` → `~/.pwn/cron/jobs.yml` |
22
22
  | `swarm` | `agent_list` · `agent_spawn` · `agent_ask` · `agent_debate` · `agent_broadcast` · `swarm_bus` · `swarm_list` | `PWN::AI::Agent::Swarm` → `~/.pwn/agents.yml` + `~/.pwn/swarm/` |
23
23
 
24
+ The `learning` toolset is deliberately fat: **Mistakes** (negative feedback),
25
+ **Reward** (ORM/PRM/sentinel/DPO ledger) and **Curriculum** (self-play, HER,
26
+ regression-gated LoRA) are all facets of the same self-improvement loop -
27
+ see [Reinforcement Learning](Reinforcement-Learning.md).
24
28
 
25
29
  ## Dynamic tool-set slimming (`ai.agent.tool_router`)
26
30
 
@@ -41,6 +45,8 @@ CORE_TOOLS = shell · pwn_eval · memory_remember · memory_recall
41
45
  ```ruby
42
46
  PWN::AI::Agent::Registry.definitions(relevance: 'nmap sweep 10.0.0.0/8', top_k: 10)
43
47
  PWN::AI::Agent::Registry.rank(query: 'run a shell command') # inspect ranking
48
+ PWN::AI::Agent::Registry.toolsets # → the 10 names above
49
+ PWN::AI::Agent::Registry.all.count # → 71
44
50
  ```
45
51
 
46
52
  Frontier engines leave `tool_router` off and receive the full set.
@@ -75,6 +81,7 @@ recon:
75
81
  engine: ollama
76
82
  ```
77
83
 
78
- **See also:** [pwn-ai Agent](pwn-ai-Agent.md) · [Mistakes](Mistakes.md) · [Swarm](Swarm.md)
84
+ **See also:** [pwn-ai Agent](pwn-ai-Agent.md) · [Mistakes](Mistakes.md) ·
85
+ [Reinforcement Learning](Reinforcement-Learning.md) · [Swarm](Swarm.md)
79
86
 
80
87
  [← Home](Home.md)
@@ -1,47 +1,52 @@
1
1
  # CLI Drivers - `bin/pwn_*`
2
2
 
3
- 53 headless executables, each a thin `OptionParser` wrapper over one plugin
4
- (or one workflow). They exist so CI/CD can call PWN without a REPL or an LLM.
3
+ 53 headless executables (52 `pwn_*` + `pwn`), each a thin `OptionParser`
4
+ wrapper over one plugin (or one workflow). They exist so CI/CD can call PWN
5
+ without a REPL or an LLM.
5
6
 
6
7
  ![Driver anatomy](diagrams/driver-framework.svg)
7
8
 
8
9
  ## Full list
9
10
 
10
11
  ```text
11
- pwn pwn_jenkins_thinBackup_aws_s3
12
- pwn_android_war_dialer pwn_jenkins_update_plugins
13
- pwn_autoinc_version pwn_jenkins_useradd
14
- pwn_aws_describe_resources pwn_mail_agent
15
- pwn_bdba_groups pwn_msf_postgres_login
16
- pwn_bdba_scan pwn_nessus_cloud_scan_crud
17
- pwn_burp_suite_pro_active_rest_api_scan pwn_nessus_cloud_vulnscan
18
- pwn_burp_suite_pro_active_scan pwn_nexpose
19
- pwn_char_base64_encoding pwn_nmap_discover_tcp_udp
20
- pwn_char_dec_encoding pwn_openvas_vulnscan
21
- pwn_char_hex_escaped_encoding pwn_pastebin_sample_filter
22
- pwn_char_html_entity_encoding pwn_phone
23
- pwn_char_unicode_escaped_encoding pwn_rdoc_to_jsonl
24
- pwn_char_url_encoding pwn_sast
25
- pwn_crt_sh pwn_serial_check_voicemail
26
- pwn_defectdojo_engagement_create pwn_serial_msr206
27
- pwn_defectdojo_importscan pwn_serial_qualcomm_commands
28
- pwn_defectdojo_reimportscan pwn_serial_son_micro_sm132_rfid
29
- pwn_diff_csv_files_w_column_exclude pwn_setup
30
- pwn_domain_reversewhois pwn_shodan_graphql_introspection
31
- pwn_fuzz_net_app_proto pwn_shodan_search
32
- pwn_gqrx_scanner pwn_simple_http_server
33
- pwn_jenkins_create_job pwn_web_cache_deception
34
- pwn_jenkins_create_view pwn_www_checkip
35
- pwn_jenkins_install_plugin pwn_www_uri_buster
12
+ pwn pwn_mail_agent
13
+ pwn_android_war_dialer pwn_msf_postgres_login
14
+ pwn_autoinc_version pwn_nessus_cloud_scan_crud
15
+ pwn_aws_describe_resources pwn_nessus_cloud_vulnscan
16
+ pwn_bdba_groups pwn_nexpose
17
+ pwn_bdba_scan pwn_nmap_discover_tcp_udp
18
+ pwn_burp_suite_pro_active_rest_api_scan pwn_openvas_vulnscan
19
+ pwn_burp_suite_pro_active_scan pwn_pastebin_sample_filter
20
+ pwn_char_base64_encoding pwn_phone
21
+ pwn_char_dec_encoding pwn_rdoc_to_jsonl
22
+ pwn_char_hex_escaped_encoding pwn_sast
23
+ pwn_char_html_entity_encoding pwn_serial_check_voicemail
24
+ pwn_char_unicode_escaped_encoding pwn_serial_msr206
25
+ pwn_char_url_encoding pwn_serial_qualcomm_commands
26
+ pwn_crt_sh pwn_serial_son_micro_sm132_rfid
27
+ pwn_defectdojo_engagement_create pwn_setup
28
+ pwn_defectdojo_importscan pwn_shodan_graphql_introspection
29
+ pwn_defectdojo_reimportscan pwn_shodan_search
30
+ pwn_diff_csv_files_w_column_exclude pwn_simple_http_server
31
+ pwn_domain_reversewhois pwn_web_cache_deception
32
+ pwn_fuzz_net_app_proto pwn_www_checkip
33
+ pwn_gqrx_scanner pwn_www_uri_buster
34
+ pwn_jenkins_create_job pwn_xss_dom_vectors
35
+ pwn_jenkins_create_view pwn_zaproxy_active_rest_api_scan
36
+ pwn_jenkins_install_plugin pwn_zaproxy_active_scan
37
+ pwn_jenkins_thinBackup_aws_s3
38
+ pwn_jenkins_update_plugins
39
+ pwn_jenkins_useradd
36
40
  ```
37
41
 
38
42
  Run any with `--help` for its flags.
39
43
 
40
- ## `pwn_setup` - post-install doctor & capability provisioner
44
+ ## `pwn_setup` - post-install doctor / provisioner / state migrator
41
45
 
42
46
  The one driver that isn't a plugin wrapper. It grows a bare `gem install pwn`
43
47
  into a fully-armed host by installing OS headers / external tools for whatever
44
- capability profile you ask for. Also reachable as `pwn setup` and
48
+ capability profile you ask for, **and** verifies/repairs every persisted
49
+ `~/.pwn` state file after an upgrade. Also reachable as `pwn setup` and
45
50
  `pwn --setup[=PROFILE]`.
46
51
 
47
52
  ```bash
@@ -49,10 +54,11 @@ pwn_setup # read-only doctor; exit 1 if degraded
49
54
  pwn_setup --list-profiles
50
55
  pwn_setup --profile web --yes # CI-friendly, non-interactive
51
56
  pwn_setup --deps --dry-run # print the apt/dnf/pacman/brew/port commands only
57
+ pwn_setup --migrate --fix # ~/.pwn state doctor + autofix (PWN::Migrate)
52
58
  ```
53
59
 
54
- See [Installation](Installation.md) for the full profile table and
55
- `PWN::Setup` API.
60
+ See [Installation](Installation.md) for the full profile table, the
61
+ `PWN::Setup` API and the `PWN::Migrate` state-file registry.
56
62
 
57
63
  ## Typical CI usage
58
64
 
@@ -20,6 +20,9 @@ generates the decryptor.
20
20
  > [doctor](Installation.md#pwn-setup--the-post-install-doctor--provisioner)
21
21
  > reports whether `~/.pwn/`, `pwn.yaml`, its decryptor, and an AI-engine key
22
22
  > are present, and exits non-zero for CI if any are missing.
23
+ > After `gem update pwn`, run `pwn setup --migrate --fix` — `PWN::Migrate`
24
+ > deep-merges any keys the new `PWN::Config.env_template` added into your
25
+ > encrypted `pwn.yaml` **without overwriting your values**.
23
26
 
24
27
  ---
25
28
 
@@ -263,6 +266,11 @@ PWN::Config.refresh_env
263
266
  | `ai.agent.plan_first` | Boolean \| `nil` | `nil` (auto: `true` when `ai.active == ollama`) | `PWN::AI::Agent::Loop.plan_first` | Plan-then-act pre-pass: the model must emit a numbered tool plan (as an assistant message) *before* it may dispatch anything. Cheap chain-of-thought scaffolding for local models. |
264
267
  | `ai.agent.tool_router` | Boolean | `false` | `PWN::AI::Agent::Registry.definitions` | Dynamic tool-set slimming: expose only `Registry::CORE_TOOLS` + the top-K keyword-relevant schemas for *this* request. Ties break on historical `Metrics` success rate so the router itself is a learned component. |
265
268
  | `ai.agent.escalation_persona` | String \| `nil` | `nil` | `PWN::AI::Agent::Loop.escalate` → `Swarm.ask` | Circuit-breaker: once a local model accumulates ≥ `Loop::ESCALATE_AFTER_FAILS` in-turn failures, ask this Swarm persona for a 3-line corrective hint (injected as a synthetic tool result). The local model still authors the final answer so Learning/Metrics stay attributed. |
269
+ | `ai.agent.critic` | Boolean | `false` | `PWN::AI::Agent::Curriculum.critic` (S3) | Tool-armed constitutional self-critic reviews (and may `shell`/`extro_verify`) every final answer before it is returned. |
270
+ | `ai.agent.red_team_plan` | Boolean | `false` | `PWN::AI::Agent::Curriculum.red_team_plan` (S4) | Adversarial review of the `plan_first` numbered plan, grounded in Metrics/Mistakes/`extro_drift` telemetry, before the first dispatch. |
271
+ | `ai.agent.counterfactual` | Boolean | `false` | `PWN::AI::Agent::Curriculum.counterfactual` (S2) | On `[REPEATING]`, fork an alt-persona branch, judge both, and record the `(loser, winner)` DPO preference pair. |
272
+ | `ai.agent.hindsight` | Boolean | `true` | `PWN::AI::Agent::Curriculum.hindsight` (C3) | Hindsight Experience Replay — relabel a failed trajectory as `success:true` for whatever it *did* accomplish. Free positive samples from failures. |
273
+ | `ai.agent.verify_as_reward` | Boolean | `false` | `PWN::AI::Agent::Reward.verify_as_reward` (E3) | Ground the LLM judge score by browser-verifying any checkable claim in the final via `extro_verify`; verdict caps/floors `Reward.judge`. |
266
274
  | `ai.agent.extrospection.web.anchors` | Array\<String\> | `DEFAULT_WEB_ANCHORS` | `PWN::AI::Agent::Extrospection.probe_web` | URLs the headless browser fingerprints on `extro_snapshot(sections:[:web])`. Alias: `web_anchors`. |
267
275
  | `ai.agent.extrospection.web.proxy` | String | - | `Extrospection.probe_web` / `.verify` / `.watch` | Upstream proxy for `PWN::Plugins::TransparentBrowser` (e.g. `tor`, `http://127.0.0.1:8080`). |
268
276
  | `ai.agent.extrospection.web.max_anchors` | Integer | `8` | `Extrospection.probe_web` | Cap on anchors rendered per snapshot. |
@@ -371,9 +379,14 @@ agent system prompt.
371
379
 
372
380
  `pwn.yaml` is the only file you edit; everything else is machine-written
373
381
  state. See **[Persistence](Persistence.md)** for the full map
374
- (`memory.json`, `memory.idx`, `learning.jsonl`, `mistakes.json`,
375
- `metrics.json`, `extrospection.json`, `sessions/`, `skills/`,
376
- `finetune/`, `cron/`, `agents.yml`, `swarm/`).
382
+ (`.schema`, `memory.json`, `memory.idx`, `learning.jsonl`,
383
+ `preferences.jsonl`, `mistakes.json`, `metrics.json`,
384
+ `reward_sentinel.json`, `extrospection.json`, `sessions/`,
385
+ `skills/<name>/SKILL.md`, `curriculum/`, `finetune/`, `cron/`,
386
+ `agents.yml`, `swarm/`, `backup/`, `quarantine/`).
387
+
388
+ `pwn setup --migrate` verifies (and `--fix` autorepairs) every
389
+ one of them against the running gem version.
377
390
 
378
391
  Multi-agent personas are **not** configured here - they live in
379
392
  `~/.pwn/agents.yml` and are managed with `agent_spawn` / `agent_list`
@@ -5,10 +5,11 @@
5
5
  ```text
6
6
  lib/pwn/ # all namespaces
7
7
  lib/pwn/setup.rb # PWN::Setup - doctor/provisioner data tables
8
+ lib/pwn/migrate.rb # PWN::Migrate - ~/.pwn state doctor / auto-migrator
8
9
  lib/pwn/plugins/ # 66 plugin modules
9
10
  lib/pwn/ai/agent/ # agent core
10
11
  lib/pwn/ai/agent/tools/ # LLM tool registrations
11
- bin/ # 53 pwn_* drivers (incl. pwn_setup)
12
+ bin/ # 52 pwn_* drivers + pwn (incl. pwn_setup)
12
13
  spec/ # RSpec (incl. conventions_spec)
13
14
  documentation/ # this wiki + diagrams
14
15
  ```
@@ -44,7 +45,13 @@ rake # rubocop + rspec - must be zero offenses
44
45
  set, reference it from `PWN::Setup::PROFILES`. That single edit makes
45
46
  `pwn setup` install it on every OS and every install path (gem, git,
46
47
  Docker, Packer, Vagrant, CI). **Do not** add a new bash provisioner.
47
- 7. Update [Plugins.md](Plugins.md) and, if it changes a data flow, the
48
+ 7. **If it persists a new file under `~/.pwn/`**, add **one entry** to
49
+ `PWN::Migrate::STATE_FILES` in `lib/pwn/migrate.rb` (owner, kind,
50
+ `:fix` strategy, shallow verifier). If the change breaks *existing*
51
+ files, bump `PWN::Migrate::SCHEMA_VERSION` and append an idempotent
52
+ lambda to `PWN::Migrate::MIGRATIONS`. `pwn setup --migrate --fix`
53
+ then heals every user's `~/.pwn` on upgrade.
54
+ 8. Update [Plugins.md](Plugins.md) and, if it changes a data flow, the
48
55
  relevant `.dot` in `documentation/diagrams/dot/` → `./build.sh`.
49
56
 
50
57
  ## Commit / release
@@ -24,6 +24,26 @@ invokes `PWN::Cron.run(<id>)` on schedule.
24
24
  | `cron_enable` / `cron_disable` | Toggle without deleting |
25
25
  | `cron_remove` | Delete from `jobs.yml` (does **not** scrub crontab - `crontab -e` yourself) |
26
26
 
27
+ ## Seeded self-improvement jobs (`PWN::Cron.install_defaults`)
28
+
29
+ `pwn setup --migrate` (schema `v1`) seeds two jobs into every fresh
30
+ `~/.pwn/cron/jobs.yml`:
31
+
32
+ | Name | Schedule | Ruby |
33
+ |---|---|---|
34
+ | `curriculum_practice_nightly` | `0 3 * * *` | `PWN::AI::Agent::Curriculum.practice(limit: 3)` |
35
+ | `curriculum_train_weekly` | `0 4 * * 0` | `PWN::AI::Agent::Curriculum.train_and_gate(dry_run: true)` |
36
+
37
+ The first practises the top unresolved `Mistakes` under `Reward.judge` and
38
+ auto-`resolve`s any it now solves; the second exports SFT + DPO datasets to
39
+ `~/.pwn/finetune/`, LoRA-trains a `pwn-vN+1` local model, replays the
40
+ `Mistakes.top` set on both, and only promotes the new adapter when it wins.
41
+ Set `dry_run: false` (via `pwn-ai-cron` or `cron_create`) once a local
42
+ trainer is installed. See [Reinforcement Learning](Reinforcement-Learning.md).
43
+
44
+ `cron_disable(id:)` turns either off; `install_defaults` is idempotent and
45
+ never overwrites a job you already have with the same name.
46
+
27
47
  ## Example
28
48
 
29
49
  ```ruby
@@ -57,6 +77,6 @@ yyyy-mm-dd]` so the injected MEMORY block stops calcifying into
57
77
  confidently-wrong priors - see [Extrospection § revalidate_memory](Extrospection.md).
58
78
 
59
79
  **See also:** [Sessions](Sessions.md) · [Extrospection](Extrospection.md) ·
60
- [CLI Drivers](CLI-Drivers.md)
80
+ [Reinforcement Learning](Reinforcement-Learning.md) · [CLI Drivers](CLI-Drivers.md)
61
81
 
62
82
  [← Home](Home.md)
@@ -1,6 +1,6 @@
1
1
  # PWN Data-Flow Diagrams
2
2
 
3
- 27 SVG diagrams, all rendered from Graphviz sources in
3
+ 28 SVG diagrams, all rendered from Graphviz sources in
4
4
  [`diagrams/dot/`](diagrams/dot/) with a single shared visual theme
5
5
  (see [`_THEME.md`](diagrams/dot/_THEME.md)). Rebuild everything with:
6
6
 
@@ -55,11 +55,15 @@ groups) so lines never criss-cross.
55
55
  [source](diagrams/dot/mistakes-negative-feedback.dot) · doc: [Mistakes](Mistakes.md)
56
56
  ![mistakes-negative-feedback](diagrams/mistakes-negative-feedback.svg)
57
57
 
58
+ ### Reinforcement Learning - Reward + Curriculum
59
+ [source](diagrams/dot/reinforcement-learning.dot) · doc: [Reinforcement Learning](Reinforcement-Learning.md)
60
+ ![reinforcement-learning](diagrams/reinforcement-learning.svg)
61
+
58
62
  ### Multi-Provider LLM Integration
59
63
  [source](diagrams/dot/ai-integration-tool-calling.dot) · doc: [AI Integration](AI-Integration.md)
60
64
  ![ai-integration-tool-calling](diagrams/ai-integration-tool-calling.svg)
61
65
 
62
- ### Agent Tool Registry (10 toolsets · 61 tools)
66
+ ### Agent Tool Registry (10 toolsets · 71 tools)
63
67
  [source](diagrams/dot/agent-tool-registry.dot) · doc: [Agent Tool Registry](Agent-Tool-Registry.md)
64
68
  ![agent-tool-registry](diagrams/agent-tool-registry.svg)
65
69
 
@@ -43,7 +43,7 @@ puts result
43
43
  | Artifact | Made with | Consumed by |
44
44
  |---|---|---|
45
45
  | `bin/pwn_<name>` | template above | shell / CI |
46
- | `~/.pwn/skills/<name>.md` | `learning_distill_skill` | every future pwn-ai prompt |
46
+ | `~/.pwn/skills/<name>/SKILL.md` | `learning_distill_skill` | every future pwn-ai prompt |
47
47
  | `cron` job | `cron_create(ruby: '...')` | system crontab → unattended |
48
48
 
49
49
  **See also:** [CLI Drivers](CLI-Drivers.md) · [Cron](Cron.md) ·
@@ -14,9 +14,11 @@ $ pwn_nmap_discover_tcp_udp -t 10.0.0.0/24 -o out/ # headless driver
14
14
  $ pwn setup # doctor: which PWN:: capabilities are usable here?
15
15
  $ pwn setup --profile web # install what TransparentBrowser / Burp / ZAP need
16
16
  $ pwn setup --list-profiles # core · ai · web · net · db · sdr · vision · voice · exploit · hardware · full
17
+ $ pwn setup --migrate --fix # after `gem update pwn`: verify + autofix ~/.pwn state
17
18
  ```
18
19
 
19
- See [Installation](Installation.md) for every flag and the `PWN::Setup` API.
20
+ See [Installation](Installation.md) for every flag and the
21
+ `PWN::Setup` / `PWN::Migrate` API.
20
22
 
21
23
  ## Inside the REPL
22
24
 
@@ -25,6 +27,7 @@ PWN.help # top-level help
25
27
  PWN::Plugins.constants.sort # list all 66 plugins
26
28
  PWN::Plugins::NmapIt.help # per-plugin usage
27
29
  PWN::Setup.check # capability doctor from inside the REPL
30
+ PWN::Migrate.status # ~/.pwn state-file compatibility rows
28
31
  ls PWN::Plugins::BurpSuite # Pry: list methods
29
32
  show-source PWN::SAST::SQL.scan # Pry: read the code
30
33
  history # what you've typed → copy into a driver
@@ -36,11 +39,14 @@ history # what you've typed → copy into a driver
36
39
  |---|---|
37
40
  | `pwn-ai` | Enter the agent TUI (SHIFT+ENTER = newline, ENTER = submit) |
38
41
  | `pwn-asm` | Multi-line assembly ↔ opcode workbench |
42
+ | `pwn-mesh` | Meshtastic serial / MQTT client (Ruby ≥ 4.0) |
39
43
  | `pwn-vault` | Decrypt → edit `~/.pwn/pwn.yaml` in `$EDITOR` → re-encrypt |
40
44
  | `pwn-ai-memory` | Inspect / edit `~/.pwn/memory.json` |
41
45
  | `pwn-ai-sessions` | List / view / delete transcripts |
42
46
  | `pwn-ai-cron` | List / run scheduled jobs |
43
47
  | `pwn-ai-delegate` | Hand a task to a Swarm persona |
48
+ | `toggle-pwn-ai-debug` | Show/hide raw tool_calls JSON |
49
+ | `toggle-pwn-ai-speaks` | TTS every final answer on/off |
44
50
  | `welcome-banner` | Redraw a random `PWN::Banner` |
45
51
  | `toggle-pager` | Pry pager on/off |
46
52
 
@@ -20,7 +20,7 @@
20
20
  | [Installation](Installation.md) | `gem install pwn` → `pwn setup` doctor/provisioner · capability profiles · `--migrate` state doctor |
21
21
  | [General Usage](General-PWN-Usage.md) | Day-one cheat sheet |
22
22
  | [Configuration](Configuration.md) | `~/.pwn/pwn.yaml` (encrypted) - engines, keys, agent options · `pwn-vault` |
23
- | **[All Data-Flow Diagrams](Diagrams.md)** | **27 SVGs** in one scrollable page |
23
+ | **[All Data-Flow Diagrams](Diagrams.md)** | **28 SVGs** in one scrollable page |
24
24
 
25
25
  ## 🚪 Entry Points
26
26
 
@@ -19,52 +19,66 @@ hardware).
19
19
  | `pwn` REPL | `lib/pwn/plugins/repl.rb` | Pry with `PWN::` pre-loaded + custom commands |
20
20
  | `pwn-ai` | `lib/pwn/ai/agent/loop.rb` | Agent TUI inside the REPL |
21
21
  | `pwn --ai PROMPT` | `bin/pwn` | Headless one-shot agent (CI-friendly) |
22
- | `pwn setup` | `lib/pwn/setup.rb` · `bin/pwn_setup` | Post-install doctor + capability provisioner (also `pwn --setup[=PROFILE]`) |
23
- | `bin/pwn_*` | 53 files | Thin OptionParser wrappers over one plugin each |
24
- | `PWN::Cron` | `lib/pwn/cron.rb` | Scheduled jobs → any of the above |
22
+ | `pwn setup` | `lib/pwn/setup.rb` · `bin/pwn_setup` | Post-install doctor + capability provisioner + `--migrate` state doctor (also `pwn --setup[=PROFILE]`) |
23
+ | `bin/pwn_*` | 52 files | Thin OptionParser wrappers over one plugin each |
24
+ | `PWN::Cron` | `lib/pwn/cron.rb` | Scheduled jobs → any of the above (nightly self-play + weekly weight-loop seeded by default) |
25
25
 
26
26
  ## L2 - AI agent core (`lib/pwn/ai/agent/`)
27
27
 
28
28
  | Module | Role |
29
29
  |---|---|
30
30
  | `Loop` | plan → dispatch tool_calls → observe → repeat until final answer |
31
- | `Registry` | JSON-Schema function definitions grouped into 10 **toolsets** · 61 tools |
31
+ | `Registry` | JSON-Schema function definitions grouped into 10 **toolsets** · **71 tools** |
32
32
  | `Dispatch` / `Result` | execute a tool, capture stdout/value/error/duration |
33
33
  | `PromptBuilder` | inject MEMORY / SKILLS / LEARNING / **KNOWN MISTAKES + FIXES** / METRICS / EXTROSPECTION blocks |
34
- | `Metrics` · `Learning` | **introspection** - how well am I doing? |
34
+ | `Metrics` · `Learning` · `Reflect` | **introspection** - how well am I doing? |
35
35
  | `Mistakes` | **negative feedback** - fingerprint failures, do NOT repeat, `[REPEATING]`/`[REGRESSED]`, inline `correction_hint` |
36
- | `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
+ | **`Reward`** | **R1** ORM `judge` · **R2** PRM per-step credit · **R3** `sentinel` reward-hacking detector · **R4** `semantic_ok` · **W1** DPO `preferences.jsonl` |
37
+ | **`Curriculum`** | **S1** mistake-driven self-play `practice` · **S2** `counterfactual` A/B · **S3** tool-armed `critic` · **S4** `red_team_plan` · **C3** `hindsight` (HER) · **W2** `train_and_gate` regression-gated LoRA |
38
+ | `Extrospection` | **extrospection** - on-demand world sensing (`intel` · **`verify`** · **`watch`** · **`rf_tune`** · **`osint`** · `serial` · `telecomm` · `packet` · `vision` · `voice`) + ambient baseline (host · net · toolchain · repo · env · **rf** · **web**) joined to introspection via `correlate` |
37
39
  | `Swarm` | multi-agent personas over a shared JSONL bus |
38
40
 
39
- See [Agent Tool Registry](Agent-Tool-Registry.md) for every tool the LLM can call.
41
+ See [Agent Tool Registry](Agent-Tool-Registry.md) for every tool the LLM can
42
+ call, and [Reinforcement Learning](Reinforcement-Learning.md) for how
43
+ `Reward` + `Curriculum` close the weight-level loop.
40
44
 
41
45
  ## L3 - Capability namespaces (`lib/pwn/*`)
42
46
 
43
47
  `Plugins` (66) · `SAST` (48) · `WWW` (21) · `AWS` (90) · `SDR` · `Blockchain` ·
44
- `Bounty` · `Reports` · `FFI` · `Banner`. Each is a plain module of
45
- `public_class_method def self.x(opts = {})` methods - callable identically from
46
- the REPL, from `pwn_eval`, or from a driver.
48
+ `Bounty` · `Reports` · `FFI` · `Banner` · **`Setup`** · **`Migrate`**. Each is
49
+ a plain module of `public_class_method def self.x(opts = {})` methods -
50
+ callable identically from the REPL, from `pwn_eval`, or from a driver.
47
51
 
48
52
  ## L4 - Persistence (`~/.pwn/`)
49
53
 
50
- Everything the framework remembers between processes lives in one directory:
54
+ Everything the framework remembers between processes lives in one directory.
55
+ `PWN::Migrate` (schema-stamped, idempotent, dry-run capable) verifies and
56
+ autofixes every file in it after a `gem update pwn`:
51
57
 
52
58
  ![~/.pwn map](diagrams/persistence-filesystem.svg)
53
59
 
54
- See [Persistence](Persistence.md) for the byte-level layout of each file.
60
+ See [Persistence](Persistence.md) for the byte-level layout of each file and
61
+ [Installation § Upgrading](Installation.md#upgrading--pwn-state-migration-pwnmigrate)
62
+ for the migrator.
55
63
 
56
64
  ## The feedback loop
57
65
 
58
66
  The reason L2 exists is to close this loop on every turn - successes
59
67
  become skills/lessons, **failures become fingerprinted mistakes with fixes**,
60
68
  **world-state is sensed on demand** (`extro_verify` / `extro_watch` /
61
- `extro_rf_tune` / `extro_osint` / `extro_serial` / `extro_telecomm` / `extro_packet` / `extro_vision` / `extro_voice` / `extro_intel`) and correlated against those failures, and
62
- **all six prompt blocks** (MEMORY · SKILLS · LEARNING · KNOWN MISTAKES/FIXES ·
63
- TOOL EFFECTIVENESS · EXTROSPECTION) are re-injected into the very next system
64
- prompt:
69
+ `extro_rf_tune` / `extro_osint` / `extro_serial` / `extro_telecomm` /
70
+ `extro_packet` / `extro_vision` / `extro_voice` / `extro_intel`) and
71
+ correlated against those failures, an **LLM judge scores the final** and a
72
+ **process reward model tags each tool step**, and **all six prompt blocks**
73
+ (MEMORY · SKILLS · LEARNING · KNOWN MISTAKES/FIXES · TOOL EFFECTIVENESS ·
74
+ EXTROSPECTION) are re-injected into the very next system prompt.
75
+ Nightly cron practises the top unresolved Mistakes; weekly cron cuts a
76
+ LoRA and only promotes it if it beats the previous adapter on that same
77
+ mistake set:
65
78
 
66
79
  ![Self-improvement loop](diagrams/pwn-ai-feedback-learning-loop.svg)
67
80
 
68
- **Next:** [pwn REPL](pwn-REPL.md) · [pwn-ai Agent](pwn-ai-Agent.md)
81
+ **Next:** [pwn REPL](pwn-REPL.md) · [pwn-ai Agent](pwn-ai-Agent.md) ·
82
+ [Reinforcement Learning](Reinforcement-Learning.md)
69
83
 
70
84
  [← Home](Home.md)