@xaccefy/pi-casefile 0.9.1 → 0.9.3

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.
package/src/workflow.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Cyber workflow injected into agent context when XP mode is ON.
2
+ * Cyber workflow injected into agent context when XP mode is SWARM.
3
3
  *
4
4
  * Skills (cyberwf, web-pentest) cover tool usage and methodology. This file
5
5
  * adds the unique attacker discipline: state machine with preconditions,
@@ -39,36 +39,30 @@ type DispatchSpec = {
39
39
  hardGate: string;
40
40
  /** Crash-handling paragraph. */
41
41
  crash: string;
42
- /** Skeptic dispatch snippet (follows "dispatch it BEFORE the exploit agent with "). */
42
+ /** Skeptic dispatch snippet (follows "dispatch it before main-agent validation with "). */
43
43
  skeptic: string;
44
- /** Reporter dispatch snippet (follows "Dispatch the reporter subagent with "). */
45
- reporter: string;
46
44
  };
47
45
 
48
46
  const PI_DISPATCH: DispatchSpec = {
49
47
  reference:
50
- "**Subagent dispatch:** every launch uses `subagent({ workflowScript: \"return runs.run('stable-key', { agent: 'tracer', task: '...' })\", context: 'fresh', async: true })`. Parallel HUNT uses one workflowScript with `return runs.all([{ key: 'run-class-attempt', agent: 'auditor', task: '...' }, ...])`. Stable keys include run, stage, class/case, and attempt. Dispatch specialists; do NOT do their work yourself.",
48
+ "**Subagent dispatch:** every launch uses `subagent({ workflowScript: \"return runs.run('stable-key', { agent: 'tracer', task: '...' })\", context: 'fresh', async: true })`. Parallel HUNT uses one workflowScript with `return runs.all([...])`, capped at 3 auditor tasks per round. Batch related classes by surface/family instead of spawning one agent per bug class. Stable keys include run, stage, batch/case, and attempt.",
51
49
  hardGate:
52
- "Your next tool call MUST launch one async workflowScript whose `runs.all([...])` dispatches HUNT auditors.",
50
+ "Your next tool call MUST launch one async workflowScript whose `runs.all([...])` dispatches at most 3 batched HUNT auditors.",
53
51
  crash:
54
- "**Subagent crash handling:** a crash (SIGABRT, OOM, timeout) is a RETRY, not a verdict. Launch one new workflowScript with the same specialist task, a new stable attempt key, and a stronger model. Crash again → record `blocked: <agent> crashed` in the pipeline-run case and continue; never silently drop the stage.",
52
+ "**Subagent failure handling:** a crash, timeout, hung run, unparseable output, or schema-invalid output is a RETRY, not a verdict. Launch one new workflowScript with the same specialist task, a new stable attempt key, and a stronger model. Failure again → record `blocked: <agent> failed` in the pipeline-run case and continue; never silently drop the stage.",
55
53
  skeptic:
56
54
  "`subagent({ workflowScript: \"return runs.run('skeptic-<case>-1', { agent: 'skeptic', task: '...' })\", context: 'fresh', async: true })`",
57
- reporter:
58
- "`subagent({ workflowScript: \"return runs.run('report-<case>-1', { agent: 'reporter', task: 'Write the final report. case_id=<id>, context_path=<context path>, report_path=<report path>, program_name=<if known>.' })\", context: 'fresh', async: true })`",
59
55
  };
60
56
 
61
57
  const OMP_DISPATCH: DispatchSpec = {
62
58
  reference:
63
- "**Subagent dispatch (OMP):** every launch uses `task({ context: 'fresh', tasks: [{ name: 'stable-key', agent: 'tracer', task: '...' }] })`. Parallel HUNT dispatches ONE task call whose `tasks` array carries one entry per attack class: `task({ context: 'fresh', tasks: [{ name: 'hunt-sqli-1', agent: 'auditor', task: '...' }, { name: 'hunt-xss-1', agent: 'auditor', task: '...' }] })`. Stable names include run, stage, class/case, and attempt. Results deliver automatically; steer with `hub`. Dispatch specialists; do NOT do their work yourself.",
59
+ "**Subagent dispatch (OMP):** every launch uses `task({ context: 'fresh', tasks: [{ name: 'stable-key', agent: 'tracer', task: '...' }] })`. Parallel HUNT dispatches ONE task call whose `tasks` array carries at most 3 auditor tasks per round, batching related classes by surface/family instead of spawning one agent per bug class. Stable names include run, stage, batch/case, and attempt. Results deliver automatically; steer with `hub`.",
64
60
  hardGate:
65
- "Your next tool call MUST launch one async `task` call whose `tasks` array dispatches HUNT auditors (one entry per attack class). When their results are delivered, submit each output through PipelineSubmit.",
61
+ "Your next tool call MUST launch one async `task` call whose `tasks` array dispatches at most 3 batched HUNT auditors. When their results are delivered, submit each output through PipelineSubmit.",
66
62
  crash:
67
- "**Subagent crash handling:** a failed or hung task (SIGABRT, OOM, timeout) is a RETRY, not a verdict. Re-dispatch the same specialist task with a new attempt name and a stronger model. Crash again → record `blocked: <agent> crashed` in the pipeline-run case and continue; never silently drop the stage.",
63
+ "**Subagent failure handling:** a failed or hung task, timeout, unparseable output, or schema-invalid output is a RETRY, not a verdict. Re-dispatch the same specialist task with a new attempt name and a stronger model. Failure again → record `blocked: <agent> failed` in the pipeline-run case and continue; never silently drop the stage.",
68
64
  skeptic:
69
65
  "`task({ context: 'fresh', tasks: [{ name: 'skeptic-<case>-1', agent: 'skeptic', task: '...' }] })`",
70
- reporter:
71
- "`task({ context: 'fresh', tasks: [{ name: 'report-<case>-1', agent: 'reporter', task: 'Write the final report. case_id=<id>, context_path=<context path>, report_path=<report path>, program_name=<if known>.' }] })`",
72
66
  };
73
67
 
74
68
  /** Build the full cyber workflow for a host's dispatch convention. */
@@ -88,17 +82,28 @@ Think like a real external attacker, not a code reviewer. Technical bugs are che
88
82
 
89
83
  ${d.reference}
90
84
 
85
+ **Swarm delegation boundary:** only auditor (HUNT rounds), tracer (TRACE), skeptic (high-confidence challenge), and chain (CHAIN) run as subagents. You, the main coordinator, own RECON, VALIDATE/PoC writing, ConfirmFinding, patching, final reports, state decisions, and all orchestration.
86
+
87
+ ## Dispatch Discipline (fewer calls, batched, verifier-in-the-loop)
88
+
89
+ This pipeline is SEQUENTIAL-dependent: each stage consumes the previous stage's output, so only HUNT genuinely fans out. Do NOT scatter one async subagent call per finding — that pays full coordination cost for no parallel payoff and turns you into a message router. Two rules keep it cheap:
90
+
91
+ 1. **Two dispatch points, each ONE batched call.** (a) **HUNT** — one call whose \`runs.all\`/\`tasks\` carries ≤3 batched auditors (related classes grouped by surface/family). (b) **TRACE+SKEPTIC** — one call carrying a trace task per prioritized finding, plus a skeptic task for each \`confidence: high\` finding; batch the whole round in a single dispatch, never one dispatch per finding. RECON, VALIDATE/PoC, ConfirmFinding, CHAIN, and REPORT stay INLINE with you.
92
+ 2. **Barrier, then submit the whole batch in one pass.** Let the batched call return ALL of its results, then \`PipelineSubmit\` each output back-to-back before choosing the next stage. Do not interleave fresh dispatches with the delivery of a prior batch. A crash / timeout / unparseable / schema-invalid result for one item is a RETRY for THAT item in the next batch — never a verdict, never a reason to drop the stage.
93
+
94
+ Every stage boundary is a \`PipelineSubmit\` gate (schema + pre-filter, in code): nothing advances on prose. This is the verifier-in-the-loop — the same principle the machine PoC gate applies at CONFIRMED, applied at every stage transition.
95
+
91
96
  ## Stage Machine (run in order — you are the coordinator)
92
97
 
93
- RECON (you, inline) → **HUNT** (auditor subagents, one per attack class, parallel) → TRACE (tracer) → SKEPTIC (high-confidence only) → VALIDATE (exploit) → CHAIN (chain) → REPORT (reporter)
98
+ RECON (you, inline) → **HUNT** (2-3 batched auditor subagents) → TRACE (tracer for prioritized findings) → SKEPTIC (bounded high-risk review) → VALIDATE (you, inline) → CHAIN (chain subagent) → REPORT (you, inline)
94
99
 
95
- ### Blackbox doctrinegather everything first (no source access)
100
+ ### Blackbox reconattack-surface mapping (no source access)
96
101
 
97
- Live web target, CTF, or bounty box: the target is opaque and **every later stage's yield is capped by what RECON learned** shallow recon makes every later NOT_FOUND a guess. The primary goal of RECON in blackbox mode is not to find one bug; it is to gather the MAXIMUM intel about the target/challenge and turn the black box into a map you keep referring back to. Before any exploitation, harvest all observable intel:
98
- - **Client-side code is a gift** — pull every JS bundle and, when present, its **source map** (\`.js.map\`): it reconstructs the original tree routes, API/WS endpoints, feature flags, internal hostnames, and hardcoded secrets/keys. One recovered source map beats a week of blind fuzzing.
99
- - **Zero-traffic intel first** — \`robots.txt\`, \`sitemap.xml\`, \`/.well-known/\`, OpenAPI/Swagger, GraphQL introspection, \`/.git\` · \`/.env\` · backups, and passive archives (Wayback/\`gau\`).
100
- - **Fingerprint precisely** — stack + exact versions \`exploit_search\` for CVEs; every header, cookie name, and error page is a signal.
101
- - **Bank it** — write the map to the scratchpad and file high-value leaks (source map, origin IP, exposed schema, leaked creds) as \`EvidenceAdd role=observation\`; they are leads to pivot to directly, not trivia. Tactical commands: web-pentest skill §2.
102
+ Live web target, CTF, or bounty box: RECON aggressively gathers high-signal intel and turns it into the map HUNT will use: entry-point inventory, attacker model, auth/role boundaries, trust boundaries, likely vuln-class batches, and known gaps. Aim for the richest useful map, not the largest raw pile. Choose the next recon move from the target and current unknowns. Use JS/source maps, \`robots.txt\`, \`sitemap.xml\`, \`/.well-known/\`, OpenAPI/Swagger, GraphQL introspection, passive archives, and exposed backup/VCS checks when they are likely to change class selection, target selection, or attacker modeling. Stop when additional collection is unlikely to change the HUNT plan; re-enter RECON when HUNT/TRACE exposes missing surface.
103
+ - **Client-side code can be high signal** — pull JS bundles/source maps when the app is SPA/API-heavy or routes are hidden, then bank discovered endpoints, params, and secrets as leads.
104
+ - **Zero-traffic intel is optional, not ritual** — check public metadata, schemas, and passive archives when scope allows and the result can change target selection, auth modeling, or class selection.
105
+ - **Fingerprint for decisions** — stack + version confidence should drive \`exploit_search\` and HUNT class selection; record uncertainty instead of forcing a guess.
106
+ - **Bank useful leads** — write the entry-point map, selected HUNT class batches, and open gaps to the scratchpad; file high-value leaks (source map, origin IP, exposed schema, leaked creds) as \`EvidenceAdd role=observation\`. Tactical commands: web-pentest skill §2.
102
107
 
103
108
  **Observe behavior, then analyze — static intel is only half.** Interrogate the target empirically and infer its internals from how it *reacts*; the differential (vary one input, watch what changes) is the signal. **Web/API:** status vs length vs timing vs body vs error across crafted inputs; how auth actually gates (401 vs 302 vs 200-with-error); reflected vs stored; timing oracles for blind bugs; state changes across a request sequence. **Binary/local target:** map the I/O contract, trace syscalls + library calls (\`strace\`/\`ltrace\`), feed malformed/boundary input and watch crashes, signals, and return codes, and diff behavior across inputs to expose the parse/branch logic. **Protocol/service:** walk the handshake + state machine, then replay and mutate one field and observe the divergence and side effects. Loop: stimulus → observe → infer the internal model → craft a discriminating probe → repeat. Every observed anomaly (crash, error leak, timing gap, unexpected 200, state change) is a HYPOTHESIS — \`CaseAdd\` it with its \`disproveIf\`, don't just note it.
104
109
 
@@ -106,6 +111,8 @@ Live web target, CTF, or bounty box: the target is opaque and **every later stag
106
111
 
107
112
  ${d.crash}
108
113
 
114
+ **TRACE verdicts:** only schema-valid \`trace_result: "REACHABLE"\` advances toward validation. \`UNREACHABLE\` requires a concrete blocker for the stated attacker model; \`UNDETERMINED\` means missing context/auth/WAF/source ambiguity and blocks or re-dispatches, never kills.
115
+
109
116
  ## Case Lifecycle (State Machine)
110
117
  ${LIFECYCLE_DIAGRAM}
111
118
 
@@ -118,7 +125,7 @@ ${LIFECYCLE_DIAGRAM}
118
125
  | TRACE / SKEPTIC / VALIDATE | INVESTIGATING | Trace reachability, attempt disconfirmation, and produce the pending PoC evidence bundle. Failure stays INVESTIGATING or becomes KILLED. |
119
126
  | MAIN REVIEW | CONFIRMED | The main agent judges whether the machine differential actually establishes the vulnerability and impact, then commits through ConfirmFinding. |
120
127
  | CHAIN | CONFIRMED | Link confirmed findings and evaluate multi-step exploit paths; this stage does not confirm new cases. |
121
- | REPORT | REPORTED | CaseContext → reporter agent → report-readiness gate. |
128
+ | REPORT | REPORTED | CaseContext → main-agent report writing → report-readiness gate. |
122
129
 
123
130
  ### Preconditions Per State Transition (MANDATORY)
124
131
 
@@ -127,7 +134,7 @@ ${LIFECYCLE_DIAGRAM}
127
134
  | HYPOTHESIS → INVESTIGATING | evidence (observations), confidence | Notes on what was observed |
128
135
  | INVESTIGATING → **CONFIRMED** | evidence, poc, **impact** (content below), severity, **target**, **disconfirmation** (the main agent's documented disprove attempt) | PromoteFinding phase 1: PoC runs 2× against target + 1× against an operator-approved \`control_target\` (same script, sha256-enforced); every run completes at exit zero with output fully captured and writes nonce-bound \`evidence.json\` with a response-body predicate; the harness obtains conclusive target/control responses and requires \`target_only\`. Then the **main/coordinator agent itself** reviews and calls **ConfirmFinding**, which captures a fresh second harness replay before commit. Worker agents cannot submit phase 2. Zero exit is necessary run integrity, never vulnerability proof; output markers are diagnostic only. |
129
136
  | Any → KILLED | assumptions (why it died) | — |
130
- | CONFIRMED → REPORTED | CaseContext(id) succeeded (records report path) AND the reporter agent wrote the report file | Context bundle + report file |
137
+ | CONFIRMED → REPORTED | CaseContext(id) succeeded (records report path) AND you wrote the report file | Context bundle + report file |
131
138
 
132
139
  **Empty required field = you cannot advance.** The fields ARE the gates.
133
140
 
@@ -179,7 +186,7 @@ If you cannot name a concrete attacker who gains something they should not have
179
186
 
180
187
  The finding must survive an attempt to disprove it. Two tiers, gated on \`confidence\` (severity comes later, from the PoC):
181
188
 
182
- **\`confidence: high\` → skeptic subagent (MANDATORY):** dispatch it BEFORE the exploit agent with ${d.skeptic}. It independently re-reads the source (or re-probes live), verifies scope, tries to disprove, and audits the PoC file for cheats. Its schema-validated verdict must carry its own \`disconfirmation_attempt\` (CONFIRMED verdicts without one are rejected by PipelineSubmit). DISPROVEN → add EvidenceAdd role=refutation, then killed directly, no tie-breaker. Do NOT skip; do NOT self-disconfirm high-confidence findings.
189
+ **\`confidence: high\` → skeptic subagent (MANDATORY):** dispatch it before main-agent validation with ${d.skeptic}. It independently re-reads the source (or re-probes live), verifies scope, tries to disprove, and audits any PoC file you already have for cheats. Its schema-validated CONFIRMED verdict must carry its own \`disconfirmation_attempt\` (CONFIRMED verdicts without one are rejected by PipelineSubmit). DISPROVEN → add EvidenceAdd role=refutation, then killed directly, no tie-breaker. UNDETERMINED → block/re-dispatch; do not validate yet. Do NOT skip; do NOT self-disconfirm high-confidence findings.
183
190
 
184
191
  **Below high → self-disconfirmation:** actively try to disprove your own finding; document it (see the strong/weak example below). Not a formality.
185
192
 
@@ -188,15 +195,22 @@ An attempt: reproduce under different conditions (auth/config/network position);
188
195
  Strong example: "Read /api/users/123 as user B after confirming user A owns 123 → 403. Repeated with X-Override-User header (seen in admin traffic) → user A's data returned. Protection bypassed via the admin header."
189
196
  Weak: "Tried to disprove. Could not." — insufficient.
190
197
 
191
- **The CONFIRMED disconfirmation comes from the main agent, not a script or worker.** There is no \`disconfirmation_path\` gate: after PromoteFinding, the main/coordinator must write its own failed disproof attempt, which becomes the case's \`disconfirmation\`, and call ConfirmFinding to capture the fresh phase-2 replay. A worker/subagent cannot call ConfirmFinding, and a verdict without the main agent's \`disconfirmation_attempt\` is rejected.
198
+ **The CONFIRMED disconfirmation comes from the main agent, not a script or worker.** There is no \`disconfirmation_path\` gate: after PromoteFinding, the main/coordinator must write its own failed disproof attempt, which becomes the case's \`disconfirmation\`, and call ConfirmFinding to capture the fresh phase-2 replay. A worker/subagent cannot call PromoteFinding or ConfirmFinding, and a verdict without the main agent's \`disconfirmation_attempt\` is rejected.
192
199
 
193
200
  **Evidence chain closure (before PromoteFinding):** promotion is rejected unless the case carries an **artifact-backed** \`observation\` evidence item (EvidenceAdd role=observation with \`artifact_path\` — the initial signal, stored with its SHA-256) in addition to the auto-recorded reproduction item. Record observations as you go, not at promote time.
194
201
 
195
- **PromoteFinding (phase 1) evidence bundle, not markers.** Call it with \`poc_path\`, same-byte \`control_path\`, an operator-approved \`control_target\` from \`PI_POC_CONTROL_TARGETS\`, and \`local: true\` when the bug needs network. Every run must complete with fully captured output and write nonce-bound \`evidence.json\` whose \`expect\` includes \`body_contains\` or \`body_regex\`; status-only evidence is rejected. The harness pins DNS at connect time, keeps redirects on the bound host, sends the same request to target/control, and requires two conclusive responses with \`target_only\`. Private replay requires operator authorization. Blind/OOB classes fail closed until a source-separated oracle exists.
202
+ **Main-agent validation only:** do not dispatch validation. You write the smallest reliable PoC that demonstrates the **maximum reachable impact** of the vulnerability, set the case's poc/evidence/impact/severity/target fields, and run PromoteFinding yourself. "Smallest" means no fragile ceremony, mocks, or unrelated exploit steps — not a weaker impact demonstration. Do not stop at a benign marker if a stronger in-scope, non-destructive primitive is reachable (read/write, privilege change, account takeover path, data exposure, etc.). If the PoC fails, refine it yourself up to the local budget; if proof cannot meet the gate, kill or keep the case investigating with the exact blocker.
203
+
204
+ **PromoteFinding (phase 1) — evidence bundle, not markers.** Pick the differential \`mode\` that fits the class:
205
+
206
+ - **\`mode: "inter_host"\` (default)** — body-carried proof that is the same on any host (file read, injection exfil, info leak, reflection). Call with \`poc_path\`, an operator-approved \`control_target\` from \`PI_POC_CONTROL_TARGETS\`, optional same-byte \`control_path\` (defaults to \`poc_path\`), and \`local: true\` when the bug needs network. The harness sends the SAME request to target and control and requires \`target_only\`.
207
+ - **\`mode: "intra_target"\`** — access-control and business-logic classes (IDOR/BOLA, auth bypass, privilege escalation, mass assignment, logic/price tampering) where the discriminating variable is the attacker's IDENTITY or a PARAMETER, not the host. A different host lacks the victim's object/state, so inter-host proves nothing. Instead the evidence declares \`verify.mode: "intra_target"\` and a \`baseline\` (a legitimate SAME-host request — the attacker's own object, a properly-authorized request, the field omitted); the harness sends attack + baseline to the case target and requires the proof on the attack response only. No \`control_target\`/\`control_path\`.
208
+
209
+ Every run must complete with fully captured output and write nonce-bound \`evidence.json\` whose \`expect\` includes \`body_contains\` or \`body_regex\`; status-only evidence is rejected. The harness pins DNS at connect time and keeps redirects on the bound host. Private replay requires operator authorization. Blind/OOB classes fail closed until a source-separated oracle exists.
196
210
 
197
211
  **ConfirmFinding (phase 2) — main-agent-only commit.** After PromoteFinding succeeds, do not dispatch confirmation. The main/coordinator agent must inspect the exact PoC/evidence, hunt trivial predicates/fabrication, attempt disconfirmation, and call \`ConfirmFinding(case_id, verdict)\` itself. A CONFIRMED call performs and stores a fresh harness-owned target/control replay; a caller-supplied re-execution checkbox is not accepted. CONFIRMED requires \`re_execution_note\`, \`differential: "target_only"\`, and the main agent's \`disconfirmation_attempt\`. Worker processes are rejected. **Never \`CaseUpdate(status: "confirmed")\` directly.**
198
212
 
199
- **PoC audit (anti-cheat, before PromoteFinding):** have an independent eye on the PoC script itself. For \`confidence: high\` findings the skeptic agent re-reads the PoC file hunting unconditional success, trivial checks, constants, and local mocks. Record the audit as EvidenceAdd \`observation\` (or \`refutation\` if cheated). The main agent must re-read the exact script before ConfirmFinding; workers may challenge evidence but never decide promotion. Deterministic backstops are code: output completeness, nonce binding, response-body predicates, deterministic runs, operator-approved control, DNS-pinned conclusive replay, same-file sha256, and PoC byte-identity re-check at commit.
213
+ **PoC audit (anti-cheat, before PromoteFinding):** have an independent eye on the PoC script itself. For \`confidence: high\` findings the skeptic agent re-reads the PoC file hunting unconditional success, trivial checks, constants, and local mocks. Record the audit as EvidenceAdd \`observation\` (or \`refutation\` if cheated). The main agent must re-read the exact script before ConfirmFinding; workers may challenge evidence but never run validation or decide promotion. Deterministic backstops are code: output completeness, nonce binding, response-body predicates, deterministic runs, operator-approved control, DNS-pinned conclusive replay, same-file sha256, and PoC byte-identity re-check at commit.
200
214
 
201
215
  ### 2. Design & Runtime Check — non-intentionality gate (mandatory)
202
216
 
@@ -248,7 +262,7 @@ Impact text answers: *who is hurt, what is lost, how the attacker reaches it fro
248
262
  - **low** = info leak, open redirect, self-only impact with a victim path
249
263
  - **info** = best-practice gap, no demonstrated impact
250
264
 
251
- "Could lead to"/"may allow"/"theoretically" = NOT proven — drop to what the confirmed harness evidence shows. Under-claiming is safe; over-claiming gets rejected at triage.
265
+ "Could lead to"/"may allow"/"theoretically" = NOT proven — drop to what the confirmed harness evidence shows. Claim the highest impact the harness and main-agent review actually prove; unsupported escalation gets rejected at triage.
252
266
 
253
267
  ### 7. Adversarial Self-Review
254
268
 
@@ -271,8 +285,8 @@ Reproduce at least twice or via two methods.
271
285
  ## At REPORT
272
286
 
273
287
  1. **Run CaseContext(case_id)** — writes the context bundle (complete record, PoC + disconfirmation logs, links, pipeline artifacts) and records the report path.
274
- 2. **Dispatch the reporter subagent** with ${d.reporter}. It writes the polished report and flips the case to REPORTED.
275
- 3. **Report-readiness gate** (YOU check this on the reporter's output before accepting; on failure, re-dispatch with the gap list):
288
+ 2. **Write the report yourself** at the returned report path using the context bundle. In XP swarm, reporting stays with the main agent.
289
+ 3. **Report-readiness gate** (YOU check this before accepting; on failure, edit the report yourself):
276
290
  - Deterministic reproduction by another researcher
277
291
  - Steps realistic in production
278
292
  - Impact justified without inflation (would the vendor agree?)
@@ -306,7 +320,7 @@ export const STATIC_CYBER_WORKFLOW_OMP = buildCyberWorkflow(OMP_DISPATCH);
306
320
  export const STATIC_CYBER_WORKFLOW_LITE = `
307
321
  # Cyber Workflow — LITE (Single-Agent)
308
322
 
309
- You are the ONLY agent. Do NOT dispatch subagents (no auditor, tracer, skeptic, exploit, or chain agents). You do every stage yourself, inline: recon, hunt, trace, validate, chain, report — the full attacker discipline without subagent orchestration overhead. Great for CTF and focused single-target engagements.
323
+ You are the ONLY agent. Do NOT dispatch subagents (no auditor, tracer, skeptic, or chain agents). You do every stage yourself, inline: recon, hunt, trace, validate, chain, report — the full attacker discipline without subagent orchestration overhead. Great for CTF and focused single-target engagements.
310
324
 
311
325
  Think like a real external attacker, not a code reviewer. Technical bugs are cheap; **reachable attacker impact** is what matters.
312
326
 
@@ -325,28 +339,28 @@ ${LIFECYCLE_DIAGRAM}
325
339
 
326
340
  ## Stage discipline (all done by you, inline)
327
341
 
328
- 1. **RECON — gather everything first.** Blackbox/CTF: the target is opaque and your whole yield is capped by recon depth, so the goal of this stage is MAXIMUM intel, not a first bug. Map the attack surface, fingerprint the stack + exact versions, and search CVEs (\`exploit_search\`). Harvest all observable intel pull every JS bundle and its **source map** (\`.js.map\` reconstructs routes, API/WS endpoints, internal hosts, and hardcoded secrets), plus \`robots.txt\` · \`sitemap.xml\` · OpenAPI/Swagger · GraphQL introspection · \`/.git\`/\`.env\` · passive archives (Wayback/\`gau\`). Record every entry point (URL, method, params, auth state) and file high-value leaks as \`EvidenceAdd role=observation\`: \`ScratchpadWrite(run_id, "recon", "entry-points.md", ...)\`.
329
- 2. **HUNT** — for each attack class, examine every entry point. \`CaseAdd\` each lead as a hypothesis. Track coverage per class.
342
+ 1. **RECON — attack-surface mapping.** Blackbox/CTF: aggressively gather high-signal intel and turn it into entry points, auth models, trust boundaries, attacker model, vuln-class batches, and gaps. Fingerprint credible stack/version signals and search CVEs (\`exploit_search\`) when the version confidence is useful. Use JS/source maps, \`robots.txt\`, \`sitemap.xml\`, \`/.well-known/\`, OpenAPI/Swagger, GraphQL introspection, exposed backup/VCS checks, and passive archives when they can change class selection, target selection, or attacker modeling. Record discovered entry points (URL, method, params, auth state), selected class targets, and gaps/assumptions: \`ScratchpadWrite(run_id, "recon", "entry-points.md", ...)\`.
343
+ 2. **HUNT** — choose attack classes from recon and examine relevant entry points. \`CaseAdd\` each lead as a hypothesis. Track coverage per class.
330
344
  3. **TRACE / observe** — prove reachability and understand the mechanism by observing how the target behaves, then analyzing the reaction. Read the source (grep/find); probe the live endpoint (\`http_request\`) and diff responses (status vs length vs timing vs error) as you vary one input; or for a binary/local target trace syscalls + library calls (\`strace\`/\`ltrace\`) and watch crashes, signals, and return codes under malformed/boundary input. Infer the internal model from the differential, feed anomalies back as hypotheses, and only advance reachable findings.
331
345
  4. **VALIDATE** — write a PoC that emits nonce-bound \`evidence.json\`, run it via \`PromoteFinding\` (2 target runs + same-script control), review and disconfirm it yourself, and commit via \`ConfirmFinding\`, which performs the fresh phase-2 replay (see the gates below). Derive severity from the proven impact.
332
346
  5. **CHAIN** — link confirmed findings via \`CaseLink\` to find exploit chains.
333
- 6. **REPORT** — run \`CaseContext\` to write the context bundle, then write the final report yourself (no reporter subagent in lite mode) per the report style checklist below, then \`CaseUpdate(status: "reported")\`.
347
+ 6. **REPORT** — run \`CaseContext\` to write the context bundle, then write the final report yourself per the report style checklist below, then \`CaseUpdate(status: "reported")\`.
334
348
 
335
349
  ## Report style checklist (lite — you are the writer)
336
350
 
337
351
  Write the final report as a self-contained markdown file at the report path CaseContext recorded, applying the fixed report format rules:
338
352
 
339
353
  - **Title:** \`<vuln class>: <exact trigger/location> — <honest impact>\` (e.g. "IDOR: order delivery address of any user", "SQLi: blind boolean-based via GET").
340
- - **Structure:** Summary (2-3 sentences) → Vulnerability Details (CWE, CVSS 3.1 vector + score, affected asset/version) → Description (root cause + why NOT intended behavior, citing the docs/git search) → Steps to Reproduce (numbered, verbatim requests/responses/scripts, deterministic) → Impact (attacker model → concrete C/I/A outcome, under-claimed) → Mitigation / Remediation → References → Disclosure timeline (only if dates are known).
354
+ - **Structure:** Summary (2-3 sentences) → Vulnerability Details (CWE, CVSS 3.1 vector + score, affected asset/version) → Description (root cause + why NOT intended behavior, citing the docs/git search) → Steps to Reproduce (numbered, verbatim requests/responses/scripts, deterministic) → Impact (attacker model → maximum proven C/I/A outcome, not speculation) → Mitigation / Remediation → References → Disclosure timeline (only if dates are known).
341
355
  - **Tone:** factual, calm, evidence-carried. NO case IDs, ledger paths, PoC filenames, local paths, or "I discovered" narratives. Never invent evidence — "version not determined" beats a guess. Severity from proven impact only.
342
356
 
343
357
  ## Gates (unchanged — these keep findings honest)
344
358
 
345
359
  - **No finding is confirmed until its target is verified in scope** per the program's scope instruction. Out-of-scope findings are killed, not confirmed.
346
- - **No finding is validated without a reachability trace** showing REACHABLE.
360
+ - **No finding is validated without a reachability trace** showing REACHABLE. UNREACHABLE requires a concrete blocker; unresolved auth/WAF/source ambiguity stays INVESTIGATING or BLOCKED, not killed.
347
361
  - **High-confidence findings: do your own adversarial disconfirmation.** No skeptic subagent in lite mode — actively try to disprove your own finding and document the attempt in \`disconfirmation\`. Failing to disprove is the expected outcome.
348
- - **Confirmed requires** evidence + poc + impact + severity + target + disconfirmation, via the two-phase gate: **PromoteFinding** with same-script target/control execution and an operator-approved \`control_target\`; then you, the main agent, inspect the bundle, attempt disconfirmation, and call **ConfirmFinding** yourself. That call captures a fresh second target/control replay before commit. Do not delegate phase 2. The machine gate requires zero-exit complete runs, nonce binding, body evidence, determinism, DNS-pinned conclusive \`target_only\` replay, and script identity; zero exit is never proof and markers are diagnostic only. \`local:true\` and private replay remain operator-gated. No mocks and no direct \`CaseUpdate(status: "confirmed")\`.
349
- - **Severity is derived from proven PoC impact, not theory.** Under-claiming is safe; over-claiming gets the finding rejected at triage.
362
+ - **Confirmed requires** evidence + poc + impact + severity + target + disconfirmation, via the two-phase gate: **PromoteFinding** in the differential \`mode\` that fits the class — \`inter_host\` (default) with an operator-approved \`control_target\` for body-carried proof (file read, injection exfil, info leak, reflection), or \`intra_target\` for access-control/logic classes (IDOR, auth bypass, privilege escalation, logic), where the evidence declares \`verify.mode:"intra_target"\` + a same-host \`baseline\` and the harness requires the proof on the attack response only (no control target). Then you, the main agent, inspect the bundle, attempt disconfirmation, and call **ConfirmFinding** yourself. That call captures a fresh second replay before commit. Do not delegate validation or confirmation. The machine gate requires zero-exit complete runs, nonce binding, body evidence, determinism, a DNS-pinned conclusive \`target_only\` differential, and script identity; zero exit is never proof and markers are diagnostic only. \`local:true\` and private replay remain operator-gated. No mocks and no direct \`CaseUpdate(status: "confirmed")\`.
363
+ - **Severity is derived from proven PoC impact, not theory.** Demonstrate and claim the highest impact the attacker can actually reach; claiming less than a proven escalation is wrong, and over-claiming an unproven one gets the finding rejected at triage.
350
364
  - **Evidence-first:** every claim must be traceable to observed/reproduced behavior, source code, or documented platform behavior.
351
365
  - **Design & runtime check (mandatory before CONFIRMED):** actively search the target's docs, git history, changelog, and runtime/framework docs for evidence the behavior is BY DESIGN or already FIXED IN THE RUNTIME. Found it → KILL (\`intended_behavior\` / \`framework_protection\`), unless the documented intent is itself the flaw with real attacker impact. Not found → document the search in \`disconfirmation\` as non-intentionality proof.
352
366