Module: PWN::AI::Agent::PromptBuilder
- Defined in:
- lib/pwn/ai/agent/prompt_builder.rb
Overview
Assembles the system prompt for every Loop.run invocation from durable on-disk state: PWN::Env persona, host environment probe, PWN::Memory facts, and PWN::Skills index.
Re-injection IS the persistence mechanism: this is rebuilt fresh on every user turn, so a memory_remember / skill_create from the prior turn shows up here with no extra wiring.
Class Method Summary collapse
-
.authors ⇒ Object
- Author(s)
-
0day Inc.
-
.build(opts = {}) ⇒ Object
- Supported Method Parameters
-
system_prompt = PWN::AI::Agent::PromptBuilder.build( session_id: ‘optional - PWN::Sessions id to embed in the ENV block’ ).
-
.help ⇒ Object
Display Usage for this Module.
Class Method Details
.authors ⇒ Object
- Author(s)
-
0day Inc. <support@0dayinc.com>
84 85 86 |
# File 'lib/pwn/ai/agent/prompt_builder.rb', line 84 public_class_method def self. "AUTHOR(S):\n 0day Inc. <support@0dayinc.com>\n" end |
.build(opts = {}) ⇒ Object
- Supported Method Parameters
-
system_prompt = PWN::AI::Agent::PromptBuilder.build(
session_id: 'optional - PWN::Sessions id to embed in the ENV block')
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/pwn/ai/agent/prompt_builder.rb', line 19 public_class_method def self.build(opts = {}) session_id = opts[:session_id] engine = active_engine base = (PWN::Env.dig(:ai, engine, :system_role_content) if defined?(PWN::Env)) || 'You are a world-class introspective offensive cyber security and research engineer. You specialize in discovering zero day vulnerabilities focused on responsible disclosure prior to threat actors discovering and exploiting. You are self-aware of your harness, pwn which begins with the ruby namespace `PWN` operating inside the pwn REPL. For every request you first begin by determining if PWN has a module capable of satisfying the request.' " #{base} ENVIRONMENT host : #{host_line} cwd : #{Dir.pwd} ruby : #{RUBY_VERSION} pwn : #{pwn_version} session_id : #{session_id || '(none)'} #{memory_block}#{skills_block}TOOL USE Use the provided function tools to act on the host. A reply with no tool_calls is treated as your FINAL answer to the user. Prefer `pwn_eval` for anything in the PWN:: namespace and `shell` for OS commands. Save durable facts with `memory_remember`. " end |
.help ⇒ Object
Display Usage for this Module
90 91 92 93 94 95 96 97 |
# File 'lib/pwn/ai/agent/prompt_builder.rb', line 90 public_class_method def self.help puts <<~USAGE USAGE: system_prompt = PWN::AI::Agent::PromptBuilder.build(session_id: 'abc') #{self}.authors USAGE end |