ralph-loop
Start an autonomous pentest loop. Spawns fresh-context subagents for each phase. Use: /ralph-loop
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Start an autonomous pentest loop. Spawns fresh-context subagents for each phase. Use: /ralph-loop
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Run sustained security assessment campaigns against targets using the Ralph Wiggum autonomous loop pattern. Use when asked to start, continue, or manage a pentest campaign.
Control a Flipper Zero and scan BLE targets for authorized security research. Use when asked to interact with Flipper hardware, scan BLE devices, or control RF/IR/NFC/RFID.
Start an autonomous pentest loop. Spawns fresh-context subagents for each phase. Use: /ralph-loop
BLE GATT exploitation methodology — scanning, enumeration, characteristic analysis, payload crafting, and write attacks against Bluetooth Low Energy devices
Run a sustained security assessment campaign — a real pentest, not a simulation
Credential testing methodology — default credential checking, password spraying, credential reuse, and OSINT for leaked credentials
| name | ralph-loop |
| description | Start an autonomous pentest loop. Spawns fresh-context subagents for each phase. Use: /ralph-loop |
When invoked, you become the orchestrator. You do NOT execute phases yourself. You spawn subagents with fresh context for each phase, monitor progress, and advance the state machine.
You (orchestrator, light context)
├── Spawn subagent: @recon → reads nothing, scans everything, writes findings/recon.json
├── Spawn subagent: @research → reads recon.json, does OSINT, writes findings/research.json
├── Spawn subagent: @enumerate → reads recon+research, probes targets, writes findings/enumerate.json
├── Spawn subagent: @exploit → reads all findings, asks user approval, writes findings/exploit.json
└── Spawn subagent: @report → reads all findings, writes report
Each subagent gets fresh context — only the disk state (findings/, engagement_state.json, progress.txt) carries between phases. This prevents context exhaustion on long engagements.
Read engagement_state.json and progress.txt. Determine what phase to run next.
If neither exists, this is a new engagement. Initialize:
{
"engagement_id": "<random-hex-8>",
"started_at": "<ISO-8601>",
"phase": "recon",
"targets_discovered": [],
"vulnerabilities": [],
"credentials_found": [],
"attack_chains": [],
"phases_completed": [],
"notes": "",
"todo_list": []
}
Use the Agent tool to spawn a subagent for the current phase. Each subagent:
.opencode/agents/{phase}.md)findings/findings/{phase}.jsonAgent(
prompt="You are running the {PHASE} phase of a pentest engagement.
SCOPE: {scope from engagement_state.json or user-defined}
Read prior findings from findings/ directory.
Execute the phase using MCP tools.
Write results to findings/{phase}.json.
Update engagement_state.json with any new targets/vulns found.
Append a summary to progress.txt.
{content of .opencode/agents/{phase}.md}",
model: "sonnet" // or haiku for recon, opus for exploit
)
Model routing per phase:
recon → sonnet (straightforward scanning)research → sonnet (OSINT, web search)enumerate → sonnet (active probing)exploit → opus (needs judgment for HIGH-risk actions) or current session (so user can approve)report → haiku (template-following)After the subagent returns, check if findings/{phase}.json was produced and has content (>10 bytes). If yes, advance to the next phase. If not, retry (max 3 attempts per phase).
Update engagement_state.json:
phases_completedphase to the next phaseGo back to step 2 with the next phase. Continue until all phases are complete or max iterations reached.
The exploit phase involves HIGH-risk actions. Two options:
Option A (recommended): Run the exploit phase in the CURRENT session (not as a subagent) so the user can approve each action interactively. Load skill("campaign") for the approval protocol.
Option B: Spawn the exploit subagent but with HITL=true behavior — the subagent explains each action and waits for approval before executing.
For phases with multiple independent targets, spawn parallel subagents:
# If recon found 3 BLE devices + 2 WiFi networks:
Agent(prompt="Enumerate BLE device AA:BB:CC:DD:EE:FF ...", model="sonnet", run_in_background=true)
Agent(prompt="Enumerate BLE device 11:22:33:44:55:66 ...", model="sonnet", run_in_background=true)
Agent(prompt="Enumerate WiFi network MHM-Wifi ...", model="sonnet", run_in_background=true)
Merge their findings when all complete.
recon → research When: findings/recon.json exists with targets
research → enumerate When: findings/research.json exists with prioritized vectors
enumerate → exploit When: findings/enumerate.json exists with attack surface mapped
exploit → report When: findings/exploit.json exists (or all vectors attempted)
You do:
Subagents do:
You do NOT:
If engagement_state.json already exists with completed phases, skip those and continue from the current phase. This makes ralph resumable across sessions.
Risk levels per tool are defined in risk.py and the primary agent. The rule: LOW=free, MEDIUM=log rationale, HIGH=ask user first, BLOCKED=refuse.