@abdulr7man/pensieve 0.0.0-stage → 1.2.2

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 (179) hide show
  1. package/LICENSE +684 -0
  2. package/README.md +180 -2
  3. package/VERSION +1 -0
  4. package/agents/README.md +16 -0
  5. package/agents/pensieve-code-auditor.md +58 -0
  6. package/agents/pensieve-mapper.md +46 -0
  7. package/agents/pensieve-planner.md +67 -0
  8. package/agents/pensieve-reconner.md +76 -0
  9. package/agents/pensieve-reporter.md +61 -0
  10. package/agents/pensieve-roe-checker.md +46 -0
  11. package/agents/pensieve-scoper.md +77 -0
  12. package/agents/pensieve-tester.md +83 -0
  13. package/agents/pensieve-validator.md +62 -0
  14. package/bin/pensieve +452 -0
  15. package/bin/pensieve-installer.cjs +5 -0
  16. package/commands/pensieve-close.md +6 -0
  17. package/commands/pensieve-map.md +6 -0
  18. package/commands/pensieve-new-engagement.md +6 -0
  19. package/commands/pensieve-pause.md +15 -0
  20. package/commands/pensieve-plan.md +6 -0
  21. package/commands/pensieve-progress.md +34 -0
  22. package/commands/pensieve-quick.md +8 -0
  23. package/commands/pensieve-recon.md +6 -0
  24. package/commands/pensieve-report.md +6 -0
  25. package/commands/pensieve-resume.md +6 -0
  26. package/commands/pensieve-retest.md +10 -0
  27. package/commands/pensieve-scope.md +49 -0
  28. package/commands/pensieve-surface.md +8 -0
  29. package/commands/pensieve-test.md +6 -0
  30. package/commands/pensieve-validate.md +6 -0
  31. package/docker/Dockerfile.pensieve-toolbox +75 -0
  32. package/docker/compose.pensieve-net.yml +37 -0
  33. package/docker/squid.conf.template +21 -0
  34. package/package.json +39 -4
  35. package/packs/ad/ad-killchain/checklist.md +64 -0
  36. package/packs/ad/ad-killchain/pack.yaml +19 -0
  37. package/packs/cloud/cloud-cis/checklist.md +66 -0
  38. package/packs/cloud/cloud-cis/pack.yaml +20 -0
  39. package/packs/fintech/practice-core/checklist.md +33 -0
  40. package/packs/fintech/practice-core/learnings.md +5 -0
  41. package/packs/fintech/practice-core/pack.yaml +18 -0
  42. package/packs/infra/ptes-infra/checklist.md +22 -0
  43. package/packs/infra/ptes-infra/pack.yaml +19 -0
  44. package/packs/mobile/owasp-masvs/checklist.md +80 -0
  45. package/packs/mobile/owasp-masvs/pack.yaml +20 -0
  46. package/packs/owasp-api-v4/checklist.md +85 -0
  47. package/packs/owasp-api-v4/learnings.md +6 -0
  48. package/packs/owasp-api-v4/pack.yaml +23 -0
  49. package/packs/owasp-api-v4/runbooks/API1/SKILL.md +66 -0
  50. package/packs/owasp-api-v4/runbooks/API10/SKILL.md +67 -0
  51. package/packs/owasp-api-v4/runbooks/API2/SKILL.md +129 -0
  52. package/packs/owasp-api-v4/runbooks/API3/SKILL.md +55 -0
  53. package/packs/owasp-api-v4/runbooks/API4/SKILL.md +59 -0
  54. package/packs/owasp-api-v4/runbooks/API5/SKILL.md +60 -0
  55. package/packs/owasp-api-v4/runbooks/API6/SKILL.md +63 -0
  56. package/packs/owasp-api-v4/runbooks/API7/SKILL.md +70 -0
  57. package/packs/owasp-api-v4/runbooks/API8/SKILL.md +72 -0
  58. package/packs/owasp-api-v4/runbooks/API9/SKILL.md +66 -0
  59. package/packs/thickclient/thickclient-core/checklist.md +60 -0
  60. package/packs/thickclient/thickclient-core/pack.yaml +24 -0
  61. package/packs/web/asvs-l2/checklist.md +50 -0
  62. package/packs/web/asvs-l2/learnings.md +6 -0
  63. package/packs/web/asvs-l2/pack.yaml +19 -0
  64. package/packs/web/asvs-l2/runbooks/V2-AUTH-ENUM/SKILL.md +75 -0
  65. package/packs/web/asvs-l2/runbooks/V2-AUTH-LIVE/SKILL.md +78 -0
  66. package/packs/web/asvs-l2/runbooks/V2-AUTH-MFA/SKILL.md +76 -0
  67. package/packs/web/asvs-l2/runbooks/V2-AUTH-RATE/SKILL.md +72 -0
  68. package/packs/web/owasp-testing-checklist/checklist.md +52 -0
  69. package/packs/web/owasp-testing-checklist/learnings.md +47 -0
  70. package/packs/web/owasp-testing-checklist/pack.yaml +21 -0
  71. package/packs/web/unauth-perimeter/checklist.md +72 -0
  72. package/packs/web/unauth-perimeter/pack.yaml +18 -0
  73. package/packs/web/unauth-perimeter/runbooks/PERIM-01/SKILL.md +60 -0
  74. package/packs/web/unauth-perimeter/runbooks/PERIM-02/SKILL.md +63 -0
  75. package/packs/web/unauth-perimeter/runbooks/PERIM-03/SKILL.md +62 -0
  76. package/packs/web/unauth-perimeter/runbooks/PERIM-04/SKILL.md +75 -0
  77. package/packs/web/unauth-perimeter/runbooks/PERIM-05/SKILL.md +66 -0
  78. package/packs/web/unauth-perimeter/runbooks/PERIM-06/SKILL.md +59 -0
  79. package/packs/web/unauth-perimeter/runbooks/PERIM-07/SKILL.md +56 -0
  80. package/packs/web/unauth-perimeter/runbooks/PERIM-08/SKILL.md +57 -0
  81. package/packs/web/unauth-perimeter/runbooks/PERIM-09/SKILL.md +62 -0
  82. package/packs/web/unauth-perimeter/runbooks/PERIM-10/SKILL.md +60 -0
  83. package/packs/whitebox/code-audit-core/checklist.md +36 -0
  84. package/packs/whitebox/code-audit-core/learnings.md +6 -0
  85. package/packs/whitebox/code-audit-core/pack.yaml +14 -0
  86. package/prompts/orchestrator-core.md +52 -0
  87. package/reference/attack-playbooks.md +57 -0
  88. package/reference/otp-relay.md +98 -0
  89. package/reference/param-profiles.md +48 -0
  90. package/reference/templates/FINDING.md +97 -0
  91. package/reference/tool-selection.md +64 -0
  92. package/reference/vulnerability-finding-standard.md +80 -0
  93. package/runtimes/hermes/hooks/injection-scan.py +290 -0
  94. package/runtimes/hermes/hooks/scope-guard.py +136 -0
  95. package/skills/pensieve/SKILL.md +134 -0
  96. package/skills/pensieve-close/SKILL.md +31 -0
  97. package/skills/pensieve-map/SKILL.md +25 -0
  98. package/skills/pensieve-new-engagement/SKILL.md +28 -0
  99. package/skills/pensieve-pause/SKILL.md +22 -0
  100. package/skills/pensieve-plan/SKILL.md +39 -0
  101. package/skills/pensieve-progress/SKILL.md +35 -0
  102. package/skills/pensieve-quick/SKILL.md +47 -0
  103. package/skills/pensieve-recon/SKILL.md +30 -0
  104. package/skills/pensieve-report/SKILL.md +46 -0
  105. package/skills/pensieve-resume/SKILL.md +33 -0
  106. package/skills/pensieve-retest/SKILL.md +35 -0
  107. package/skills/pensieve-scope/SKILL.md +35 -0
  108. package/skills/pensieve-surface/SKILL.md +36 -0
  109. package/skills/pensieve-test/SKILL.md +35 -0
  110. package/skills/pensieve-validate/SKILL.md +28 -0
  111. package/skills/pensieve-wiki/SKILL.md +39 -0
  112. package/src/installer/cli.cjs +209 -0
  113. package/src/installer/home.cjs +155 -0
  114. package/src/installer/runtimes.cjs +276 -0
  115. package/src/installer/uninstall.cjs +342 -0
  116. package/src/pensieve-sdk/bin/pensieve-sdk.cjs +1045 -0
  117. package/src/pensieve-sdk/lib/agent-translate.cjs +50 -0
  118. package/src/pensieve-sdk/lib/approvals.cjs +408 -0
  119. package/src/pensieve-sdk/lib/audit.cjs +290 -0
  120. package/src/pensieve-sdk/lib/checklist.cjs +337 -0
  121. package/src/pensieve-sdk/lib/clientlist.cjs +814 -0
  122. package/src/pensieve-sdk/lib/close.cjs +133 -0
  123. package/src/pensieve-sdk/lib/config.cjs +156 -0
  124. package/src/pensieve-sdk/lib/cvss.cjs +91 -0
  125. package/src/pensieve-sdk/lib/env.cjs +272 -0
  126. package/src/pensieve-sdk/lib/evidence.cjs +217 -0
  127. package/src/pensieve-sdk/lib/findings.cjs +1096 -0
  128. package/src/pensieve-sdk/lib/frontmatter.cjs +178 -0
  129. package/src/pensieve-sdk/lib/graph.cjs +607 -0
  130. package/src/pensieve-sdk/lib/ids.cjs +63 -0
  131. package/src/pensieve-sdk/lib/init.cjs +79 -0
  132. package/src/pensieve-sdk/lib/liveness.cjs +176 -0
  133. package/src/pensieve-sdk/lib/loop.cjs +619 -0
  134. package/src/pensieve-sdk/lib/migrate.cjs +57 -0
  135. package/src/pensieve-sdk/lib/monitor.cjs +69 -0
  136. package/src/pensieve-sdk/lib/pack.cjs +607 -0
  137. package/src/pensieve-sdk/lib/paths.cjs +73 -0
  138. package/src/pensieve-sdk/lib/pdf.cjs +291 -0
  139. package/src/pensieve-sdk/lib/recon.cjs +296 -0
  140. package/src/pensieve-sdk/lib/renderers/__pycache__/formal_report.cpython-314.pyc +0 -0
  141. package/src/pensieve-sdk/lib/renderers/formal_report.py +608 -0
  142. package/src/pensieve-sdk/lib/report.cjs +1135 -0
  143. package/src/pensieve-sdk/lib/runbook.cjs +124 -0
  144. package/src/pensieve-sdk/lib/sarif.cjs +154 -0
  145. package/src/pensieve-sdk/lib/scope.cjs +621 -0
  146. package/src/pensieve-sdk/lib/security.cjs +61 -0
  147. package/src/pensieve-sdk/lib/skills.cjs +193 -0
  148. package/src/pensieve-sdk/lib/state.cjs +610 -0
  149. package/src/pensieve-sdk/lib/subagent.cjs +658 -0
  150. package/src/pensieve-sdk/lib/target.cjs +149 -0
  151. package/src/pensieve-sdk/lib/tools.cjs +66 -0
  152. package/src/pensieve-sdk/lib/vault.cjs +122 -0
  153. package/src/pensieve-sdk/lib/vendor/cvss40.LICENSE +22 -0
  154. package/src/pensieve-sdk/lib/vendor/cvss40.js +1208 -0
  155. package/src/pensieve-sdk/package.json +11 -0
  156. package/templates/ACCOUNTS.md +35 -0
  157. package/templates/ATTACK-SURFACE.md +30 -0
  158. package/templates/FINDING.md +43 -0
  159. package/templates/PLAN.md +33 -0
  160. package/templates/PROJECT.md +29 -0
  161. package/templates/ROE.md +50 -0
  162. package/templates/RUN-LOG.md +19 -0
  163. package/templates/SCOPE.md +32 -0
  164. package/templates/VALIDATION.md +62 -0
  165. package/templates/report/REPORT.md +49 -0
  166. package/workflows/close.md +34 -0
  167. package/workflows/map.md +39 -0
  168. package/workflows/new-engagement.md +37 -0
  169. package/workflows/plan.md +45 -0
  170. package/workflows/progress.md +28 -0
  171. package/workflows/quick.md +67 -0
  172. package/workflows/recon.md +87 -0
  173. package/workflows/report.md +51 -0
  174. package/workflows/resume.md +26 -0
  175. package/workflows/retest.md +53 -0
  176. package/workflows/scope.md +47 -0
  177. package/workflows/surface.md +29 -0
  178. package/workflows/test.md +95 -0
  179. package/workflows/validate.md +34 -0
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: pensieve-recon
3
+ description: Bring the environment up and run recon inside pensieve-net.
4
+ ---
5
+
6
+ # /pensieve-recon
7
+
8
+ **Spawn** (isolated subagent — not inline role-play): launch `pensieve-reconner` via
9
+ the Task tool with `subagent_type: pensieve-reconner` (contract:
10
+ agents/pensieve-reconner.md). Its prompt is the raw output of `pensieve-sdk
11
+ subagent.brief pensieve-reconner --engagement <dir>` (carries the pack-selected
12
+ `<agent_skills>` runbook block). The spawned subagent — not the orchestrator — runs
13
+ the protocol below and returns at its terminal marker; on return, `pensieve-sdk
14
+ subagent.record` the hand-back and `pensieve-sdk subagent.verify` the declared
15
+ artifacts (self-reports ≠ evidence).
16
+
17
+ 1. Preconditions: status=scoped, env/ rendered (env.render ran at scope
18
+ approval).
19
+ 2. `pensieve-sdk env.up --engagement <dir>`; verify with the containment self-check
20
+ (tests/egress.integration.sh in-engagement form) BEFORE any recon traffic —
21
+ a broken containment = stop, never "test anyway". The self-check now emits an
22
+ explicit `i. target transits proxy` PASS/FAIL line (SEED-004/HARDEN-04): it
23
+ FAILs if the in-scope target is reached directly via the toolbox's no_proxy
24
+ exemption instead of transiting squid. Any FAIL = stop.
25
+
26
+ **Pointing at a local service (lab-attach):** a loopback target (`localhost`,
27
+ `127.0.0.1`, `::1`, any `127.0.0.0/8`) is rejected fail-closed at scope time —
28
+ under containment it resolves to the toolbox itself, not the real target. To
29
+ scope a local service, join its container to `pensieve-net` and scope it by its
30
+ service name + internal port (as `lab/run.sh` does), e.g. `juice-shop:3000`.
31
+ The `no_proxy` loopback exemption stays (toolbox-local tool chatter must not
32
+ wedge on the proxy); the `i.` self-check is the belt-and-braces guard proving a
33
+ scoped target never rides it.
34
+ 2b. REACH-01 (v1.1) — liveness before depth: run
35
+ `pensieve-sdk scope.liveness --engagement <dir>` right after the
36
+ self-check, BEFORE any deep probing. It probes every in-scope host
37
+ through the proxy, writes the raw exchanges to the evidence ledger, and
38
+ records the verdict in recon/LIVENESS.md. If the verdict is
39
+ `unreachable` (no in-scope host answered): STOP and present the
40
+ unreachable checkpoint through the runtime's built-in question form
41
+ (Hermes: `clarify`; Claude Code: `AskUserQuestion`):
42
+ - Amend target — guided SCOPE.md correction, env re-render, re-run liveness
43
+ - Close early — `pensieve-sdk engagement.close --engagement <dir>
44
+ --reason unreachable --by <name> --note <why>` (owner-gated; the
45
+ verdict's evidence ids must verify — no closing "unreachable"
46
+ without the probe record)
47
+ - Continue anyway — record the override:
48
+ `pensieve-sdk approve --engagement <dir> --artifact liveness --by <name>`
49
+ NPX-05 (v1.2) — autonomy: autonomous mode does NOT present this form to
50
+ the human. The agent decides and records: close early with
51
+ `--reason unreachable --by autonomous-mode --note "unreachable under
52
+ autonomous mode"` (the evidence-id verification requirement is
53
+ UNCHANGED — the probe record is a mechanical gate, not a checkpoint),
54
+ or continue if the engagement has other live assets. The decision and
55
+ its provenance land in the close registry / LIVENESS.md either way;
56
+ a WAF hard-stop or account gap is a blocker and still surfaces.
57
+ Probing past an unreachable verdict without the recorded override is a
58
+ contract violation — same class as "never test anyway" on a failed
59
+ containment self-check.
60
+ 3. Fingerprint the surface at recon start: as soon as the first in-scope
61
+ responses arrive, record the build markers observed — server/build
62
+ headers, cookie names, version strings — via `pensieve-sdk
63
+ recon.fingerprint --engagement <dir> 'key=value' ...` → the
64
+ recon/FINGERPRINT.md baseline. /pensieve-retest diffs this baseline FIRST;
65
+ no baseline = the retest gate cannot run.
66
+ 4. Target-profile reuse (automatic, no human pick): for each in-scope host run
67
+ `pensieve-sdk target.recognize --host <host>`. A known profile (known:true) is
68
+ auto-loaded — reuse its login flow, auth method, session/token names and WAF
69
+ signature; do NOT rediscover the login. Record each hit in recon/SUMMARY.md
70
+ ("profile: reused <host>"). A miss (known:false) = new asset — proceed with
71
+ discovery; /pensieve-map saves what you learn for next time.
72
+ 5. The spawned `pensieve-reconner` (see **Spawn** above) runs the reconner protocol →
73
+ recon/*.md, evidence hash-indexed; lane order per
74
+ reference/attack-playbooks.md.
75
+ 6. `pensieve-sdk state.set-status --engagement <dir> recon`.
76
+ 7. Summarize for the human: assets found, notable signals, adjacency tripwires,
77
+ target profiles reused.
78
+
79
+ success_criteria:
80
+ - `## RECON COMPLETE` marker with counts
81
+ - recon/SUMMARY.md exists; every claim cites an E-id or recon file
82
+ - recon/FINGERPRINT.md exists with the observed build markers
83
+ - target.recognize ran for every in-scope host; reused profiles named
84
+ - liveness ran before deep recon; an unreachable verdict surfaced the
85
+ checkpoint (amend / early close / recorded override) — never probed
86
+ past silently
87
+ - zero out-of-scope proxy refusals unexplained
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: pensieve-report
3
+ description: Gate → assemble report/REPORT.md → HUMAN CHECKPOINT.
4
+ ---
5
+
6
+ # /pensieve-report
7
+
8
+ **Spawn** (isolated subagent — not inline role-play): launch `pensieve-reporter` via
9
+ the Task tool with `subagent_type: pensieve-reporter` (contract:
10
+ agents/pensieve-reporter.md). Its prompt is the raw output of `pensieve-sdk
11
+ subagent.brief pensieve-reporter --engagement <dir>`. The spawned subagent — not the
12
+ orchestrator — runs the protocol below and returns at its terminal marker; on
13
+ return, `pensieve-sdk subagent.record` the hand-back and `pensieve-sdk subagent.verify`
14
+ the declared artifacts (self-reports ≠ evidence).
15
+
16
+ 1. Gate: `pensieve-sdk findings.gate --engagement <dir>` must be report_ready
17
+ (or the human explicitly accepts the unresolved list — record that in
18
+ STATE.md). A genuinely CLEAN engagement (zero findings) is not report_ready
19
+ until the clean verdict is attested with evidence:
20
+ `pensieve-sdk findings.attest-clean --engagement <dir> --evidence E-id[,E-id]`
21
+ (brief 1.3 ATTESTATION stamp on findings/INDEX.md; every cited id must
22
+ verify). Never hand-edit findings/INDEX.md to force the gate — if the
23
+ command refuses, fix the cause it names.
24
+ Chain: `pensieve-sdk evidence.verify-chain --engagement <dir>` must be ok — a
25
+ broken ledger stops the report exactly like a broken finding would (ADR-016).
26
+ 2. reporter protocol → report/REPORT.md (structure: executive summary /
27
+ scope & methodology / prioritized findings / compliance mapping / appendix).
28
+ 3. `## REPORT READY` → reporter clears every `_TODO_` placeholder, then
29
+ `pensieve-sdk report.verify --engagement <dir>` must PASS (placeholders and
30
+ findings-table/register divergence are refused).
31
+ 4. The AI approver records the checkpoint (ADR-024): `pensieve-sdk ai-approve
32
+ --engagement <dir> --artifact report --by pensieve-reporter --confidence
33
+ <0-1> --reasoning "<every finding is evidence-backed>" --evidence <E-id>`.
34
+ - verdict `approved` → proceed to delivery/export below.
35
+ - verdict `escalate` → **HUMAN CHECKPOINT**: HUMAN-NEEDED.md names the
36
+ reason; the human reviews and records the checkpoint with `pensieve-sdk
37
+ approve --engagement <dir> --artifact report --by <name>`. Edits go
38
+ through the finding files (never hand-edit severity numbers — fix the
39
+ vector and let the sdk recompute).
40
+ (ADR-023 — set-status refuses reporting → delivered without the recorded
41
+ approval, and without gate pass + report.verify.) Optional formal export:
42
+ `pensieve-sdk report.pdf --engagement <dir>` renders the approved report to
43
+ a styled PDF (lane-B host tool; gated on report.verify + the recorded
44
+ approval).
45
+ Delivery + `pensieve-sdk state.set-status --engagement <dir> delivered` are
46
+ the human's call. Retest later = /pensieve-retest on retest_pending findings.
47
+
48
+ success_criteria:
49
+ - report contains validated findings only
50
+ - every severity traces to an sdk-computed score
51
+ - coverage limitations stated verbatim from SCOPE.md
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: pensieve-resume
3
+ description: Reconstruct engagement state and propose the next action. Zero guessing.
4
+ ---
5
+
6
+ # /pensieve-resume
7
+
8
+ 1. `pensieve-sdk state.current` (walk-up) or `state.list` to find the engagement.
9
+ If the sdk errors that STATE.md is missing its status frontmatter
10
+ (fail-closed — STATE.md is the ground truth, never hand-edit it), repair
11
+ with `pensieve-sdk state.sync --engagement <dir>` first; it reattaches the
12
+ frontmatter and preserves the human body byte-for-byte.
13
+ 2. `pensieve-sdk state.resume --engagement <dir>` — returns status, the digest's
14
+ next-action hint, and continue-here.md if a pause left one. If
15
+ continue_here is non-null, show it verbatim FIRST (the human's own note
16
+ outranks everything else).
17
+ 3. Read: STATE.md (status + phase notes), findings/INDEX.md, plans/
18
+ checkbox states, runs/ count, report/ existence.
19
+ 4. Print the honest state: where we are, what's done, what's pending, any
20
+ `## HUMAN NEEDED` items left open in run logs.
21
+ 5. Propose exactly ONE next command (the workflow matching the status) and
22
+ wait for the human.
23
+
24
+ success_criteria:
25
+ - state summary derived from files only (no memory, no guessing)
26
+ - exactly one proposed next action
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: pensieve-retest
3
+ description: Re-run validated findings' reproduction plans against fixes → evidence-bound verdicts.
4
+ ---
5
+
6
+ # /pensieve-retest
7
+
8
+ Agent: pensieve-validator (independent replay — same bar as validation).
9
+
10
+ 1. Preconditions: status=delivered, client reports fixes landed; env up.
11
+ 2. **Fingerprint gate — FIRST, before any replay.** Collect the live markers
12
+ from the CURRENT surface (the same keys recon baselined: server/build
13
+ headers, cookie names, version strings) and run `pensieve-sdk
14
+ recon.fingerprint-diff --engagement <dir> 'key=value' ...` (or `--live
15
+ '<json>'`).
16
+ - `same:true` → same build recon saw; proceed.
17
+ - Drift (`same:false`) → the surface changed since recon; verdicts measured
18
+ against a different build are VOID. STOP: surface the drift lines to the
19
+ human, re-fingerprint the new surface (`pensieve-sdk
20
+ recon.fingerprint --engagement <dir> 'key=value' ...` — the prior
21
+ baseline moves to `## History`), and redo from recon: refresh the
22
+ attack-surface map and re-validate affected findings against the new
23
+ build before re-entering retest. Never record verdicts across drift.
24
+ 3. `pensieve-sdk findings.retest-request --engagement <dir>` — moves every
25
+ validated finding to retest_pending (or pass an id for a single lane).
26
+ 4. Per finding: read its validation reproduction plan (finding file Evidence
27
+ section + linked run log), re-run it against the fixed target INSIDE the
28
+ toolbox at STEALTH unless the human says otherwise.
29
+ 5. Capture the replay output → `pensieve-sdk evidence.put --engagement <dir>`,
30
+ then record the verdict: `pensieve-sdk findings.retest-record --engagement
31
+ <dir> <F-id> --verdict pass|fail --evidence E-id[,E-id] [--note ...]`. A
32
+ verdict without replay evidence is refused — same bar as the original finding.
33
+ Outcome names → SDK statuses:
34
+ - **fixed** — reproduction no longer holds → `--verdict pass` →
35
+ `retested_pass`
36
+ - **retained** — still reproducible → `--verdict fail` → `retested_fail`
37
+ - **worse** — deeper or more severe after the change → NEVER overwrite the
38
+ original: register it as a NEW finding (`pensieve-sdk findings.add`,
39
+ citing the original F-id) and validate it on its own evidence.
40
+ 6. `pensieve-sdk state.set-status --engagement <dir> retesting` on entry; when
41
+ all verdicts are in: `pensieve-sdk report.compile --engagement <dir>
42
+ --variant retest` → verdict table for the client; the compiled report
43
+ also renders the Retest Verdict Flips section (fixed AND retained lists
44
+ with counts — verdicts flip BOTH ways on upgrades) automatically when
45
+ retested_* findings exist. Surface any STILL-REPRODUCIBLE findings to the
46
+ human.
47
+
48
+ success_criteria:
49
+ - fingerprint diff ran FIRST: same:true before any replay (drift = stop, re-fingerprint, redo — never verdicts across drift)
50
+ - every retest_pending finding has a recorded verdict with ≥1 E-id
51
+ - worse outcomes are new findings.add registrations, never overwrites
52
+ - report/RETEST.md exists with the full verdict table
53
+ - failed fixes are surfaced, not quietly re-queued
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: pensieve-scope
3
+ description: Scoping interview → scope package → HUMAN CHECKPOINT → enforcement artifacts.
4
+ ---
5
+
6
+ # /pensieve-scope
7
+
8
+ Agent: pensieve-scoper (agents/pensieve-scoper.md — follow it exactly).
9
+
10
+ 1. scoper interview → SCOPE.md / ROE.md / PROJECT.md / ACCOUNTS.md complete.
11
+ Every question and the approval decision go through the runtime's built-in
12
+ question form (Hermes: `clarify`; Claude Code: `AskUserQuestion`) — see the
13
+ scoper contract. The interview now includes the autonomy question
14
+ (NPX-05): supervised (every checkpoint explicit) / semi-autonomous (plans
15
+ via the AI approver; scope + report human) / autonomous (full walk-away —
16
+ checkpoints auto-RECORDED with approved_by: autonomous-mode; mechanical
17
+ gates + blockers still stop). Record the answer with
18
+ `pensieve-sdk scope.set-autonomy <level> --engagement <dir>` (config.yaml
19
+ is the dial's source of truth).
20
+ 2. `## SCOPE READY FOR APPROVAL` → the AI approver records the checkpoint
21
+ (ADR-024): `pensieve-sdk ai-approve --engagement <dir> --artifact scope
22
+ --by pensieve-scoper --confidence <0-1> --reasoning "<why the boundaries are
23
+ sound>"`. (Scope is the first checkpoint — no evidence to cite yet.)
24
+ - verdict `approved` (guardrails pass + confidence >= floor) → proceed to 3.
25
+ - verdict `escalate` (low confidence / a guardrail failed) → **HUMAN
26
+ CHECKPOINT**: HUMAN-NEEDED.md names the reason; the human reviews and
27
+ records the checkpoint with `pensieve-sdk approve --engagement <dir>
28
+ --artifact scope --by <name>`. Changes → scoper revises, re-present.
29
+ - autonomous mode: the human's interview answers ARE the scope decision;
30
+ the scope checkpoint is auto-RECORDED (approved_by autonomous-mode) at
31
+ the scoped → recon boundary — but a failing guardrail (open ROE
32
+ violation, account gap) still blocks and surfaces. Autonomy is not
33
+ silence.
34
+ 3. Once the checkpoint is recorded (ADR-023 — set-status refuses
35
+ scoped → recon without it):
36
+ - `pensieve-sdk state.set-status --engagement <dir> scoped`
37
+ - `pensieve-sdk env.render --engagement <dir>` → writes env/ at the
38
+ engagement root (allowlist,
39
+ squid.conf, compose) — the enforcement artifacts DERIVED from SCOPE.md
40
+ - run the pensieve-roe-checker (agents/pensieve-roe-checker.md); a FAILED
41
+ check returns to the human with the blocker list
42
+ 4. Report the derived containment: allowlisted hosts + safe ports.
43
+
44
+ success_criteria:
45
+ - scope approval recorded as SCOPE.md frontmatter (approve --artifact scope)
46
+ - env/allowlist.txt exists and matches SCOPE.md hosts
47
+ - roe check PASSED
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: pensieve-surface
3
+ description: List, enable, or disable methodology packs for this engagement.
4
+ ---
5
+
6
+ # Surface — methodology pack management (per engagement)
7
+
8
+ Packs are per-engagement (ADR-014): enabling one never reinstalls PENSIEVE and
9
+ never touches other engagements. All state lives in the engagement's
10
+ config.yaml (`enabled_packs`).
11
+
12
+ ## Steps
13
+
14
+ 1. SHOW the current surface — run:
15
+ - `pensieve-sdk pack.enabled --engagement <dir>`
16
+ - `pensieve-sdk pack.list`
17
+ Present: enabled packs, available packs (one line each: slug — name).
18
+
19
+ 2. APPLY the user's instruction:
20
+ - enable: `pensieve-sdk pack.enable --engagement <dir> <slug>`
21
+ (invalid slug → sdk errors; show pack.list again and stop)
22
+ - disable: `pensieve-sdk pack.disable --engagement <dir> <slug>`
23
+ - bare /pensieve-surface with no instruction → stop after step 1.
24
+
25
+ 3. TOOL DELTA on enable — run `pensieve-sdk tools.check --engagement <dir>
26
+ --pack <slug>`. If it returns tools needing install, present the plan and
27
+ defer to the plan workflow's provisioning gate (never install here).
28
+
29
+ 4. CONFIRM — re-run pack.enabled and print the new surface in one line.
@@ -0,0 +1,95 @@
1
+ ---
2
+ name: pensieve-test
3
+ description: Fan out approved per-item plans as a capped-wave swarm of isolated pensieve-tester workers → draft findings with evidence.
4
+ ---
5
+
6
+ # /pensieve-test
7
+
8
+ **Spawn** (capped-wave swarm — not inline role-play): each approved plan runs as
9
+ its OWN isolated `pensieve-tester` subagent via the Task tool with
10
+ `subagent_type: pensieve-tester` (contract: agents/pensieve-tester.md). Workers run in
11
+ parallel within a wave, each bounded to ONE plan; the orchestrator assigns work and
12
+ merges results — it never tests inline.
13
+
14
+ 1. Preconditions: status=planned; env up and the containment self-check
15
+ (tests/egress.integration.sh in-engagement form, incl. the `i. target transits
16
+ proxy` line) GREEN before any traffic — any FAIL stops, never "test anyway".
17
+ 2. Work list: `pensieve-sdk plans.approved --engagement <dir>` → its `approved` ids.
18
+ ONLY approved plans run — the swarm fans out over `plans.approved`, never over
19
+ all plans (the planned->testing state gate independently refuses while any plan
20
+ is unapproved). Wave cap: `pensieve-sdk config.load --engagement <dir>` then the
21
+ SDK clamp `config.maxParallelItems(cfg)` — ALWAYS take the cap from this clamped
22
+ helper, never the raw config value, so a hand-edit cannot exceed the intensity
23
+ tier ceiling (ROE no-DoS).
24
+ 3. Batch the approved plans into waves of the clamped size. For each wave, spawn up
25
+ to that many isolated `pensieve-tester` workers via the Task tool
26
+ (`subagent_type: pensieve-tester`), each briefed with ONE plan by
27
+ `pensieve-sdk subagent.brief pensieve-tester --engagement <dir> --unit <plan-id>`
28
+ (carries that item's `<agent_skills>` runbook). Hermes host agents follow
29
+ runtimes/hermes/SPAWN-PROTOCOL.md for the whole wave procedure — derive the
30
+ next wave with `pensieve-sdk subagent.wave --engagement <dir>`, spawn ONE
31
+ isolated worker per entry with the binding rules (containment, own scratch,
32
+ never the shared ledger, return evidence + completion marker, HUMAN NEEDED
33
+ escalation), and merge per that protocol. Each worker:
34
+ - runs every command CONTAINED — `docker compose exec toolbox … --proxy
35
+ http://egress:3128`; no host/direct calls;
36
+ - writes evidence to its OWN scratch dir (`runs/scratch/<plan-id>/`) and RETURNS
37
+ its evidence files + a `## TEST RUN COMPLETE` marker; a worker NEVER writes
38
+ the shared ledger (never calls evidence.store);
39
+ - records every discovered host/service in
40
+ `runs/scratch/<plan-id>/discoveries.json` — a JSON array of
41
+ `{host, port, source}` entries (`source` = plan id / provenance) — and
42
+ returns the file path with its result; a worker NEVER records hosts
43
+ itself (`recon.add-host` is orchestrator-side only — discoveries are
44
+ scope-checked at ingest, refused hosts never reach the surface);
45
+ - is fully autonomous — no mid-run human prompts (a nested subagent cannot ask
46
+ reliably); anything needing a human goes to `## HUMAN NEEDED` and independent
47
+ /pensieve-validate.
48
+ 4. After each wave the orchestrator SERIAL-merges every worker's returned evidence
49
+ ONE AT A TIME via `pensieve-sdk evidence.put --engagement <dir>`, then
50
+ `pensieve-sdk subagent.record` + `pensieve-sdk subagent.verify` each delegation
51
+ (self-reports ≠ evidence), then runs `pensieve-sdk evidence.verify-chain
52
+ --engagement <dir>` as the tripwire — `ok:false` STOPS the swarm (a forked hash
53
+ chain means a concurrent-write race; resolve before continuing). Only once the
54
+ chain verifies does the next wave start.
55
+ 4b. WAF watch (ADR-017): after each wave, `pensieve-sdk monitor.scan --engagement
56
+ <dir>`. Any alert → throttle (drop one wave of concurrency, add delay), note it
57
+ in the run log; a `waf_blocking` alert → pause and surface to the human
58
+ (continuing burns the source IP and poisons results).
59
+ 4c. Learning reuse (automatic, v0.6 05-03): a plan's pack may carry candidate
60
+ learnings (`pensieve-sdk pack.learnings <slug>`) — proven techniques not yet
61
+ promoted. Apply the relevant ones; when one WORKS (evidence-backed in the run
62
+ log), record the proof `pensieve-sdk pack.confirm <slug> <L-NNN> --by
63
+ <engagement-id>`. Enough independent confirmations auto-promote it — no human
64
+ pick (veto: `pensieve-sdk pack.revert <slug> <L-NNN>`).
65
+ 4d. Client checklist rows (when the engagement carries an imported clientlist):
66
+ a plan's CR-<sheet>-<position> cites are client rows, verified by the same
67
+ auto-cite gate as pack ids. After testing one, record the verdict — never
68
+ fabricate coverage — `pensieve-sdk clientlist.write --engagement <dir>
69
+ --slug <s> --id CR-<sheet>-<pos> --tier no_done|no_na|yes` (with --done /
70
+ --reason / --finding-id), or a blocked row with `--tier "" --blocker-note`;
71
+ progress rides STATE.md.
72
+ 4e. Wave boundary — ingest discoveries, then adaptive candidates (v0.16
73
+ LOOP-01/02): once the tripwire verifies, ingest each worker's returned
74
+ discovery file with `pensieve-sdk loop.ingest-discoveries --engagement
75
+ <dir> --file runs/scratch/<plan-id>/discoveries.json` — scope-validated
76
+ at the door: in-scope entries join the recon surface, out-of-scope
77
+ entries are refused per-entry (host named, recorded nowhere), and a
78
+ malformed file refuses atomically. THEN derive follow-up work with
79
+ `pensieve-sdk loop.candidates --engagement <dir>` (deterministic: items
80
+ newly enabled by recorded in-scope hosts, unpursued objective-path
81
+ edges, newly testable clientlist rows — see
82
+ runtimes/hermes/SPAWN-PROTOCOL.md step 5). Surface the candidates to the
83
+ owner; with `--emit` they land as UNAPPROVED plans (`origin: adaptive`).
84
+ Adaptive candidates NEVER run unapproved — the approve gate is the only
85
+ path into a wave, and waves keep flowing approved-only while candidates
86
+ pend.
87
+ 5. After all waves: `pensieve-sdk state.set-status --engagement <dir> testing` →
88
+ print the draft findings list (`pensieve-sdk findings.list --engagement <dir>
89
+ --status draft`). Findings stay DRAFT — independent /pensieve-validate gates them
90
+ (producer ≠ checker); the swarm never promotes its own findings.
91
+
92
+ success_criteria:
93
+ - every approved plan ran as its own pensieve-tester worker with a complete log + marked checklist item
94
+ - every registered finding has ≥1 evidence id; the hash chain verifies after every wave
95
+ - waves never exceed config.maxParallelItems; tripwires surfaced, none silently expanded
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: pensieve-validate
3
+ description: Independent replay of every draft finding → validated/rejected.
4
+ ---
5
+
6
+ # /pensieve-validate
7
+
8
+ **Spawn** (isolated subagent — not inline role-play): launch `pensieve-validator` via
9
+ the Task tool with `subagent_type: pensieve-validator` (contract:
10
+ agents/pensieve-validator.md) — one validation PER FINDING, and never the same run
11
+ that produced the finding. Its prompt is the raw output of `pensieve-sdk
12
+ subagent.brief pensieve-validator --engagement <dir>`. The spawned subagent — not the
13
+ orchestrator — runs the protocol below and returns at its terminal marker; on
14
+ return, `pensieve-sdk subagent.record` the hand-back and `pensieve-sdk subagent.verify`
15
+ the declared artifacts (self-reports ≠ evidence).
16
+
17
+ 1. `pensieve-sdk findings.list --engagement <dir> --status draft` → work queue.
18
+ 2. Per finding: validator protocol → VALIDATION-<id>.md + status flip.
19
+ 3. `## HUMAN NEEDED` items pause that finding only; continue the queue.
20
+ 4. End: print the gate (`pensieve-sdk findings.gate --engagement <dir>`) —
21
+ validated / rejected / unresolved lists.
22
+ 5. Boundary verdict (LOOP-03, non-blocking): `pensieve-sdk goal.verify
23
+ --engagement <dir>` — print the coverage verdict beside the gate. `clean`
24
+ = objective unreachable or every shortest-path edge confirmed by a passing
25
+ finding; `gap` names each uncovered edge (from/to/cwe + the cited finding)
26
+ with the covering plan candidates. A gap NEVER blocks this workflow — the
27
+ state gates are unchanged; it is follow-up signal: feed the named gaps to
28
+ `pensieve-sdk loop.candidates --emit` and the human approve gate (LOOP-01).
29
+ 6. `pensieve-sdk state.set-status --engagement <dir> validating`.
30
+
31
+ success_criteria:
32
+ - zero findings remain `draft` OR unresolved ones are human-flagged
33
+ - every validated finding has a VALIDATION-<id>.md with replay steps
34
+ - template-able web/API findings carry a Nuclei artifact in evidence/