pwn 0.5.669 → 0.5.673

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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/Gemfile +1 -1
  4. data/README.md +13 -9
  5. data/documentation/AI-Integration.md +1 -1
  6. data/documentation/Agent-Tool-Registry.md +17 -5
  7. data/documentation/Configuration.md +19 -8
  8. data/documentation/Diagrams.md +2 -2
  9. data/documentation/Home.md +2 -2
  10. data/documentation/How-PWN-Works.md +12 -10
  11. data/documentation/Installation.md +3 -1
  12. data/documentation/Mistakes.md +3 -0
  13. data/documentation/Persistence.md +4 -1
  14. data/documentation/Reinforcement-Learning.md +90 -73
  15. data/documentation/Skills-Memory-Learning.md +28 -4
  16. data/documentation/What-is-PWN.md +8 -7
  17. data/documentation/Why-PWN.md +3 -2
  18. data/documentation/diagrams/agent-tool-registry.svg +188 -160
  19. data/documentation/diagrams/dot/agent-tool-registry.dot +7 -4
  20. data/documentation/diagrams/dot/memory-skills-detailed.dot +12 -5
  21. data/documentation/diagrams/dot/overall-pwn-architecture.dot +4 -3
  22. data/documentation/diagrams/dot/persistence-filesystem.dot +2 -1
  23. data/documentation/diagrams/dot/pwn-ai-feedback-learning-loop.dot +11 -4
  24. data/documentation/diagrams/dot/reinforcement-learning.dot +8 -3
  25. data/documentation/diagrams/dot/task-summarizer.dot +24 -12
  26. data/documentation/diagrams/memory-skills-detailed.svg +252 -210
  27. data/documentation/diagrams/overall-pwn-architecture.svg +21 -12
  28. data/documentation/diagrams/persistence-filesystem.svg +127 -113
  29. data/documentation/diagrams/pwn-ai-feedback-learning-loop.svg +449 -397
  30. data/documentation/diagrams/reinforcement-learning.svg +276 -239
  31. data/documentation/diagrams/task-summarizer.svg +178 -126
  32. data/documentation/pwn-ai-Agent.md +66 -32
  33. data/lib/pwn/ai/agent/curriculum.rb +13 -4
  34. data/lib/pwn/ai/agent/dispatch.rb +3 -0
  35. data/lib/pwn/ai/agent/learning.rb +100 -14
  36. data/lib/pwn/ai/agent/loop.rb +692 -25
  37. data/lib/pwn/ai/agent/metrics.rb +52 -4
  38. data/lib/pwn/ai/agent/mistakes.rb +158 -1
  39. data/lib/pwn/ai/agent/policy.rb +935 -0
  40. data/lib/pwn/ai/agent/prompt_builder.rb +82 -6
  41. data/lib/pwn/ai/agent/reflect.rb +11 -3
  42. data/lib/pwn/ai/agent/registry.rb +18 -3
  43. data/lib/pwn/ai/agent/reward.rb +360 -48
  44. data/lib/pwn/ai/agent/task_summarizer.rb +415 -33
  45. data/lib/pwn/ai/agent/tool_guard.rb +157 -0
  46. data/lib/pwn/ai/agent/tools/policy.rb +76 -0
  47. data/lib/pwn/ai/agent/tools/ruby_eval.rb +27 -1
  48. data/lib/pwn/ai/agent/tools/shell.rb +28 -32
  49. data/lib/pwn/ai/agent.rb +2 -0
  50. data/lib/pwn/config.rb +14 -2
  51. data/lib/pwn/memory.rb +188 -0
  52. data/lib/pwn/sessions.rb +9 -4
  53. data/lib/pwn/version.rb +1 -1
  54. data/spec/integration/reinforced_feedback_loop_spec.rb +35 -9
  55. data/spec/lib/pwn/ai/agent/learning_spec.rb +119 -3
  56. data/spec/lib/pwn/ai/agent/loop_spec.rb +215 -3
  57. data/spec/lib/pwn/ai/agent/metrics_spec.rb +10 -0
  58. data/spec/lib/pwn/ai/agent/mistakes_spec.rb +33 -0
  59. data/spec/lib/pwn/ai/agent/policy_spec.rb +165 -0
  60. data/spec/lib/pwn/ai/agent/prompt_builder_spec.rb +51 -0
  61. data/spec/lib/pwn/ai/agent/reward_spec.rb +75 -0
  62. data/spec/lib/pwn/ai/agent/signal_hygiene_spec.rb +118 -0
  63. data/spec/lib/pwn/ai/agent/task_summarizer_spec.rb +111 -6
  64. data/spec/lib/pwn/ai/agent/tool_guard_spec.rb +61 -0
  65. data/spec/lib/pwn/ai/agent/tools/policy_spec.rb +18 -0
  66. data/spec/lib/pwn/memory_spec.rb +62 -0
  67. data/spec/support/sandbox.rb +2 -0
  68. data/third_party/pwn_rdoc.jsonl +108 -4
  69. metadata +10 -3
@@ -4,13 +4,13 @@
4
4
  <!-- Generated by graphviz version 14.1.2 (0)
5
5
  -->
6
6
  <!-- Title: PWN_Overall_Architecture Pages: 1 -->
7
- <svg width="1642pt" height="848pt"
8
- viewBox="0.00 0.00 1642.00 848.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
7
+ <svg width="1770pt" height="848pt"
8
+ viewBox="0.00 0.00 1770.00 848.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
9
9
  <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(43.2 804.83)">
10
10
  <title>PWN_Overall_Architecture</title>
11
- <polygon fill="#0f172a" stroke="none" points="-43.2,43.2 -43.2,-804.83 1599.2,-804.83 1599.2,43.2 -43.2,43.2"/>
12
- <text xml:space="preserve" text-anchor="start" x="521.12" y="-737.73" font-family="sans-Serif" font-weight="bold" font-size="22.00" fill="#e2e8f0">PWN &#45; Offensive Security Automation Framework</text>
13
- <text xml:space="preserve" text-anchor="start" x="706" y="-726.18" font-family="sans-Serif" font-size="11.00" fill="#94a3b8">Overall Architecture · lib/pwn/*</text>
11
+ <polygon fill="#0f172a" stroke="none" points="-43.2,43.2 -43.2,-804.83 1727.2,-804.83 1727.2,43.2 -43.2,43.2"/>
12
+ <text xml:space="preserve" text-anchor="start" x="585.12" y="-737.73" font-family="sans-Serif" font-weight="bold" font-size="22.00" fill="#e2e8f0">PWN &#45; Offensive Security Automation Framework</text>
13
+ <text xml:space="preserve" text-anchor="start" x="770" y="-726.18" font-family="sans-Serif" font-size="11.00" fill="#94a3b8">Overall Architecture · lib/pwn/*</text>
14
14
  <g id="clust1" class="cluster">
15
15
  <title>cluster_actors</title>
16
16
  <path fill="#1e293b" stroke="#334155" stroke-dasharray="5,2" d="M491,-614.62C491,-614.62 1116,-614.62 1116,-614.62 1122,-614.62 1128,-620.62 1128,-626.62 1128,-626.62 1128,-700.62 1128,-700.62 1128,-706.62 1122,-712.62 1116,-712.62 1116,-712.62 491,-712.62 491,-712.62 485,-712.62 479,-706.62 479,-700.62 479,-700.62 479,-626.62 479,-626.62 479,-620.62 485,-614.62 491,-614.62"/>
@@ -33,8 +33,8 @@
33
33
  </g>
34
34
  <g id="clust9" class="cluster">
35
35
  <title>cluster_persist</title>
36
- <path fill="#422006" stroke="#a16207" stroke-width="2" d="M20,-8C20,-8 1536,-8 1536,-8 1542,-8 1548,-14 1548,-20 1548,-20 1548,-93.62 1548,-93.62 1548,-99.62 1542,-105.62 1536,-105.62 1536,-105.62 20,-105.62 20,-105.62 14,-105.62 8,-99.62 8,-93.62 8,-93.62 8,-20 8,-20 8,-14 14,-8 20,-8"/>
37
- <text xml:space="preserve" text-anchor="middle" x="778" y="-80.72" font-family="sans-Serif" font-size="22.00" fill="#fde68a">Persistence &#160;~/.pwn/</text>
36
+ <path fill="#422006" stroke="#a16207" stroke-width="2" d="M20,-8C20,-8 1664,-8 1664,-8 1670,-8 1676,-14 1676,-20 1676,-20 1676,-93.62 1676,-93.62 1676,-99.62 1670,-105.62 1664,-105.62 1664,-105.62 20,-105.62 20,-105.62 14,-105.62 8,-99.62 8,-93.62 8,-93.62 8,-20 8,-20 8,-14 14,-8 20,-8"/>
37
+ <text xml:space="preserve" text-anchor="middle" x="842" y="-80.72" font-family="sans-Serif" font-size="22.00" fill="#fde68a">Persistence &#160;~/.pwn/</text>
38
38
  </g>
39
39
  <!-- User -->
40
40
  <g id="node1" class="node">
@@ -147,7 +147,7 @@
147
147
  <title>Registry</title>
148
148
  <path fill="#c4b5fd" stroke="#334155" stroke-width="1.4" d="M623.88,-369.12C623.88,-369.12 508.12,-369.12 508.12,-369.12 502.12,-369.12 496.12,-363.12 496.12,-357.12 496.12,-357.12 496.12,-332.62 496.12,-332.62 496.12,-326.62 502.12,-320.62 508.12,-320.62 508.12,-320.62 623.88,-320.62 623.88,-320.62 629.88,-320.62 635.88,-326.62 635.88,-332.62 635.88,-332.62 635.88,-357.12 635.88,-357.12 635.88,-363.12 629.88,-369.12 623.88,-369.12"/>
149
149
  <text xml:space="preserve" text-anchor="middle" x="566" y="-354.68" font-family="sans-Serif" font-size="11.00" fill="#0f172a">Registry</text>
150
- <text xml:space="preserve" text-anchor="middle" x="566" y="-341.18" font-family="sans-Serif" font-size="11.00" fill="#0f172a">12 toolsets · 82 tools</text>
150
+ <text xml:space="preserve" text-anchor="middle" x="566" y="-341.18" font-family="sans-Serif" font-size="11.00" fill="#0f172a">13 toolsets · 85 tools</text>
151
151
  <text xml:space="preserve" text-anchor="middle" x="566" y="-327.68" font-family="sans-Serif" font-size="11.00" fill="#0f172a">tool_router (CORE+topK)</text>
152
152
  </g>
153
153
  <!-- PwnAI&#45;&gt;Registry -->
@@ -180,10 +180,11 @@
180
180
  <!-- Prompt -->
181
181
  <g id="node12" class="node">
182
182
  <title>Prompt</title>
183
- <path fill="#c4b5fd" stroke="#334155" stroke-width="1.4" d="M1013.88,-369.12C1013.88,-369.12 856.12,-369.12 856.12,-369.12 850.12,-369.12 844.12,-363.12 844.12,-357.12 844.12,-357.12 844.12,-332.62 844.12,-332.62 844.12,-326.62 850.12,-320.62 856.12,-320.62 856.12,-320.62 1013.88,-320.62 1013.88,-320.62 1019.88,-320.62 1025.88,-326.62 1025.88,-332.62 1025.88,-332.62 1025.88,-357.12 1025.88,-357.12 1025.88,-363.12 1019.88,-369.12 1013.88,-369.12"/>
184
- <text xml:space="preserve" text-anchor="middle" x="935" y="-354.68" font-family="sans-Serif" font-size="11.00" fill="#0f172a">PromptBuilder</text>
185
- <text xml:space="preserve" text-anchor="middle" x="935" y="-341.18" font-family="sans-Serif" font-size="11.00" fill="#0f172a">engine&#45;budgeted blocks</text>
186
- <text xml:space="preserve" text-anchor="middle" x="935" y="-327.68" font-family="sans-Serif" font-size="11.00" fill="#0f172a">MemoryIndex → relevance&#45;ranked</text>
183
+ <path fill="#c4b5fd" stroke="#334155" stroke-width="1.4" d="M1013.88,-375.88C1013.88,-375.88 856.12,-375.88 856.12,-375.88 850.12,-375.88 844.12,-369.88 844.12,-363.88 844.12,-363.88 844.12,-325.88 844.12,-325.88 844.12,-319.88 850.12,-313.88 856.12,-313.88 856.12,-313.88 1013.88,-313.88 1013.88,-313.88 1019.88,-313.88 1025.88,-319.88 1025.88,-325.88 1025.88,-325.88 1025.88,-363.88 1025.88,-363.88 1025.88,-369.88 1019.88,-375.88 1013.88,-375.88"/>
184
+ <text xml:space="preserve" text-anchor="middle" x="935" y="-361.43" font-family="sans-Serif" font-size="11.00" fill="#0f172a">PromptBuilder</text>
185
+ <text xml:space="preserve" text-anchor="middle" x="935" y="-347.93" font-family="sans-Serif" font-size="11.00" fill="#0f172a">engine&#45;budgeted blocks</text>
186
+ <text xml:space="preserve" text-anchor="middle" x="935" y="-334.43" font-family="sans-Serif" font-size="11.00" fill="#0f172a">MEMORY · SKILLS · POLICY</text>
187
+ <text xml:space="preserve" text-anchor="middle" x="935" y="-320.93" font-family="sans-Serif" font-size="11.00" fill="#0f172a">MemoryIndex → relevance&#45;ranked</text>
187
188
  </g>
188
189
  <!-- Cronb&#45;&gt;Prompt -->
189
190
  <!-- Loop&#45;&gt;LLM -->
@@ -439,5 +440,13 @@
439
440
  <path fill="none" stroke="#334155" stroke-width="1.4" d="M1402.25,-54.79C1402.25,-52.98 1382.86,-51.52 1359,-51.52 1335.14,-51.52 1315.75,-52.98 1315.75,-54.79"/>
440
441
  <text xml:space="preserve" text-anchor="middle" x="1359" y="-36.36" font-family="sans-Serif" font-size="11.00" fill="#0f172a">finetune/*.jsonl</text>
441
442
  </g>
443
+ <!-- PolicyF -->
444
+ <g id="node33" class="node">
445
+ <title>PolicyF</title>
446
+ <path fill="#fcd34d" stroke="#334155" stroke-width="1.4" d="M1668.38,-59.75C1668.38,-62.16 1648.49,-64.12 1624,-64.12 1599.51,-64.12 1579.62,-62.16 1579.62,-59.75 1579.62,-59.75 1579.62,-20.38 1579.62,-20.38 1579.62,-17.96 1599.51,-16 1624,-16 1648.49,-16 1668.38,-17.96 1668.38,-20.38 1668.38,-20.38 1668.38,-59.75 1668.38,-59.75"/>
447
+ <path fill="none" stroke="#334155" stroke-width="1.4" d="M1668.38,-59.75C1668.38,-57.34 1648.49,-55.38 1624,-55.38 1599.51,-55.38 1579.62,-57.34 1579.62,-59.75"/>
448
+ <text xml:space="preserve" text-anchor="middle" x="1624" y="-43.11" font-family="sans-Serif" font-size="11.00" fill="#0f172a">policy.json</text>
449
+ <text xml:space="preserve" text-anchor="middle" x="1624" y="-29.61" font-family="sans-Serif" font-size="11.00" fill="#0f172a">policy_traj.jsonl</text>
450
+ </g>
442
451
  </g>
443
452
  </svg>