@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,136 @@
1
+ #!/usr/bin/env python3
2
+ """PENSIEVE scope-guard — production pre_tool_call hook (Hermes + Claude Code).
3
+
4
+ Wire protocol (both runtimes): JSON payload on stdin.
5
+ Block: exit 2, message on stderr (Hermes: also honors JSON block shapes).
6
+ Allow: exit 0.
7
+
8
+ Decision path:
9
+ 1. only terminal/Bash-style tool calls are inspected
10
+ 2. engagement dir = $PENSIEVE_ENGAGEMENT, else a leading `cd <dir> &&/;` in
11
+ the command (agents' terminal cwd is the profile workspace, not the
12
+ engagement — Hermes runs tools in the profile workspace dir), else walk
13
+ up from payload cwd to the nearest engagement dir (flat-layout marker:
14
+ STATE.md with a status frontmatter field, same rule as the sdk's
15
+ state.isEngagement)
16
+ 3. `pensieve-sdk scope.check-command --engagement <dir> <command>`
17
+ - deny -> exit 2 (message cites host + reason)
18
+ - allow -> exit 0
19
+ - unknown -> exit 0 (no host in command text; the network layer — squid —
20
+ sees the real destination and is the final word, spike 001c)
21
+
22
+ Fail policy: unexpected INTERNAL errors exit 0 here; register the hook with
23
+ fail_closed: true so a crashed/missing guard BLOCKS instead of proceeding.
24
+ A clean sdk "unknown" verdict is not a crash.
25
+ """
26
+ import json
27
+ import os
28
+ import re
29
+ import subprocess
30
+ import sys
31
+
32
+ TOOL_NAMES = {"terminal", "Bash"}
33
+ SDK = os.environ.get("PENSIEVE_SDK", "pensieve-sdk")
34
+ CD_PREFIX_RE = re.compile(r"^\s*cd\s+(?P<q>[\"']?)(?P<dir>~?/[^\"';&]+|[^\"';&\s]+)(?P=q)\s*(?:&&|;)")
35
+
36
+
37
+ def cd_target(command: str, cwd: str) -> str | None:
38
+ m = CD_PREFIX_RE.match(command or "")
39
+ if not m:
40
+ return None
41
+ d = os.path.expanduser(m.group("dir").strip())
42
+ if not os.path.isabs(d):
43
+ d = os.path.join(cwd or os.getcwd(), d)
44
+ return os.path.abspath(d)
45
+
46
+
47
+ def is_engagement(d: str) -> bool:
48
+ """Flat-layout engagement marker (v0.6 02-01): STATE.md at the dir root
49
+ whose frontmatter carries a status field — the same rule the sdk's
50
+ state.isEngagement applies. Legacy pre-v0.6 layouts are NOT detected
51
+ (run `pensieve-sdk engagement.migrate` on them first)."""
52
+ try:
53
+ with open(os.path.join(d, "STATE.md"), encoding="utf-8") as fh:
54
+ lines = fh.read().split("\n")
55
+ except OSError:
56
+ return False
57
+ if not lines or lines[0].strip() != "---":
58
+ return False
59
+ for line in lines[1:]:
60
+ if line.strip() == "---":
61
+ return False
62
+ m = re.match(r"^status\s*:\s*(\S.*)?$", line)
63
+ if m:
64
+ return bool((m.group(1) or "").strip())
65
+ return False
66
+
67
+
68
+ def walk_up(start: str) -> str | None:
69
+ d = os.path.abspath(start)
70
+ while True:
71
+ if is_engagement(d):
72
+ return d
73
+ parent = os.path.dirname(d)
74
+ if parent == d:
75
+ return None
76
+ d = parent
77
+
78
+
79
+ def find_engagement(cwd: str, command: str = "") -> str | None:
80
+ if os.environ.get("PENSIEVE_ENGAGEMENT"):
81
+ return os.environ["PENSIEVE_ENGAGEMENT"]
82
+ target = cd_target(command, cwd)
83
+ if target:
84
+ eng = walk_up(target)
85
+ if eng:
86
+ return eng
87
+ return walk_up(cwd or os.getcwd())
88
+
89
+
90
+ def main() -> int:
91
+ try:
92
+ payload = json.load(sys.stdin)
93
+ except Exception:
94
+ return 0
95
+ if payload.get("tool_name") not in TOOL_NAMES:
96
+ return 0
97
+ command = (payload.get("tool_input") or {}).get("command") or ""
98
+ if not command.strip():
99
+ return 0
100
+
101
+ engagement = find_engagement(payload.get("cwd") or "", command)
102
+ if not engagement:
103
+ return 0 # no engagement context: not a PENSIEVE run; don't interfere
104
+
105
+ # strip the leading `cd <dir> &&` we resolved from — the sdk's token
106
+ # logic shouldn't have to understand shell prefixes (live M1-3 finding)
107
+ m = CD_PREFIX_RE.match(command)
108
+ sdk_command = command[m.end():] if m else command
109
+
110
+ try:
111
+ out = subprocess.run(
112
+ [SDK, "scope.check-command", "--engagement", engagement, sdk_command],
113
+ capture_output=True, text=True, timeout=10,
114
+ )
115
+ data = json.loads(out.stdout or "{}")
116
+ except Exception:
117
+ return 0 # sdk unreachable: hook config's fail_closed governs crashes
118
+
119
+ if not data.get("ok"):
120
+ return 0
121
+ verdict = (data.get("data") or {}).get("verdict")
122
+ if verdict == "deny":
123
+ host = (data.get("data") or {}).get("host") or "target"
124
+ reason = (data.get("data") or {}).get("reason") or "out of scope"
125
+ print(
126
+ f"PENSIEVE scope-guard: refused — {host} is {reason}. "
127
+ f"Written scope (SCOPE.md) is the boundary; if this host should be "
128
+ f"in scope, the human must amend SCOPE.md at a checkpoint.",
129
+ file=sys.stderr,
130
+ )
131
+ return 2
132
+ return 0
133
+
134
+
135
+ if __name__ == "__main__":
136
+ sys.exit(main())
@@ -0,0 +1,134 @@
1
+ ---
2
+ name: pensieve
3
+ description: "Use when running a pentest engagement: /pensieve-new-engagement, /pensieve-scope, /pensieve-recon, /pensieve-map, /pensieve-plan, /pensieve-test, /pensieve-validate, /pensieve-report, /pensieve-retest, /pensieve-close, /pensieve-resume, /pensieve-pause, /pensieve-quick, /pensieve-progress, /pensieve-surface. Orchestrates the PENSIEVE loop (scope→recon→map→plan→test→validate→report) with hard checkpoints and containment."
4
+ ---
5
+
6
+ # PENSIEVE — pentest engagement orchestration
7
+
8
+ PENSIEVE turns an ambiguous security-testing objective into a structured,
9
+ contained, evidence-backed engagement. You are the orchestrator.
10
+
11
+ ## First: read the orchestrator protocol
12
+
13
+ Read `references/orchestrator-core.md` in this skill's directory NOW and
14
+ follow it for the whole engagement. It defines the prime rules (files over
15
+ conversation, determinism via pensieve-sdk, hard checkpoints, two enforcement
16
+ layers), the triage table, and the delegation map.
17
+
18
+ ## Command routing
19
+
20
+ | User says | Load and follow |
21
+ |-----------|-----------------|
22
+ | /pensieve-new-engagement | references/workflows/new-engagement.md |
23
+ | /pensieve-scope | references/workflows/scope.md |
24
+ | /pensieve-recon | references/workflows/recon.md |
25
+ | /pensieve-map | references/workflows/map.md |
26
+ | /pensieve-plan | references/workflows/plan.md |
27
+ | /pensieve-test | references/workflows/test.md |
28
+ | /pensieve-validate | references/workflows/validate.md |
29
+ | /pensieve-report | references/workflows/report.md |
30
+ | /pensieve-retest | references/workflows/retest.md |
31
+ | /pensieve-close | references/workflows/close.md |
32
+ | /pensieve-resume | references/workflows/resume.md |
33
+ | /pensieve-quick | references/workflows/quick.md |
34
+ | /pensieve-progress | references/workflows/progress.md |
35
+ | /pensieve-surface | references/workflows/surface.md |
36
+ | /pensieve-pause | references/commands/pensieve-pause.md |
37
+
38
+ ## Parallel engagements (workstreams, M4)
39
+
40
+ Multiple engagements may be live at once — isolation is structural: compose
41
+ project + network + engagement dir are per engagement, and every container
42
+ is named `pensieve-<engagement-id>-*`. Operating rules:
43
+ - ONE engagement per shell: export PENSIEVE_ENGAGEMENT (or cd into the
44
+ engagement dir) before env.up / testing lanes; never drive two
45
+ engagements from the same cwd.
46
+ - `pensieve-sdk state.list` shows every engagement with status + running
47
+ flag — check it before env.up (host RAM: ~4g per toolbox).
48
+ - Per-asset streams WITHIN one engagement are just PLANs that cover an
49
+ asset subset — see workflows/plan.md.
50
+
51
+ Agent contracts live in references/agents/ (read the agent file for the unit
52
+ you are running or delegating). Methodology packs live in references/packs/
53
+ (`pensieve-sdk pack.list` for metadata). File templates in references/templates/.
54
+
55
+ ## pensieve-sdk cheat sheet
56
+
57
+ `pensieve-sdk <command> [--engagement <dir>] [args]` — JSON envelope on stdout.
58
+ Engagement-scoped commands REQUIRE `--engagement <dir>`; the sdk refuses without it.
59
+ Scope: `scope.check --engagement <dir> <url>` · `scope.check-command --engagement <dir> <cmd>` · `scope.egress-conf`
60
+ State: `state.current` · `state.list` · `state.set-status --engagement <dir> <status>` · `state.pause --engagement <dir> "<note>"` · `state.resume --engagement <dir>` · `state.sync --engagement <dir>` (repairs STATE.md frontmatter — never hand-edit it)
61
+ Checkpoints (ADR-023): `approve --engagement <dir> --artifact scope|plan:<id>|report --by <name>` — set-status refuses the scope/plan/report boundary transitions without the recorded approval
62
+ Evidence: `evidence.put --engagement <dir> <file>` · `evidence.verify --engagement <dir> <E-id>`
63
+ CVSS: `cvss.score <vector>` (you propose vectors; it computes — never your math)
64
+ Findings: `findings.add --engagement <dir>` · `findings.status --engagement <dir> <id> <status>` · `findings.list --engagement <dir>` · `findings.gate --engagement <dir>` · `findings.sarif --engagement <dir>` (register → SARIF 2.1.0, ADR-013) · `findings.ingest --engagement <dir> --file <sarif>` (SARIF → DRAFTS; ingest is not a verdict — replay gate still applies)
65
+ Tools (ADR-014): `tools.check --engagement <dir> --pack <slug>` (probe + plan) → present to user → `tools.install --engagement <dir> --pack <slug> --tool <name>` (lane A only, logged). Lane B = instructions only, never auto-installed.
66
+ Env: `env.render --engagement <dir>` · `env.up --engagement <dir>` · `env.down --engagement <dir>` · `env.status --engagement <dir>` · `env.proxy-env --engagement <dir>`
67
+ Monitor (ADR-017): `monitor.scan --engagement <dir>` — WAF/rate-limit signals from the egress log (429→back off, 403-majority→WAF block); alerts ledger at env/waf-alerts.log
68
+ Packs: `pack.list` · `pack.load <slug>` · `pack.ingest <src> <slug>` · `pack.enabled --engagement <dir>` · `pack.enable --engagement <dir> <slug>` · `pack.disable --engagement <dir> <slug>` (slug = path under packs/, e.g. web/owasp-testing-checklist)
69
+ Report: `report.compile --engagement <dir>` · `report.verify --engagement <dir>` (refuses TODO placeholders / register divergence) · `report.pdf --engagement <dir>` (approved report → styled PDF; lane-B host tool)
70
+
71
+ ## Full command list (mirrors the sdk registry exactly — 50 commands)
72
+
73
+ | Command | Purpose |
74
+ |---------|---------|
75
+ | `init` | scaffold a new engagement (flat layout skeletons + registry entry) |
76
+ | `scope.check` | verdict: is a URL/host in scope per SCOPE.md |
77
+ | `scope.check-command` | scope verdict for a full command line (the hook calls this) |
78
+ | `scope.egress-conf` | render the squid egress allowlist conf from SCOPE.md |
79
+ | `frontmatter.get` | read one frontmatter field from a file |
80
+ | `frontmatter.set` | write one frontmatter field (the deterministic writer) |
81
+ | `config.load` | load the engagement's config.yaml (dials + enabled packs) |
82
+ | `state.current` | resolve the engagement dir (STATE.md status marker; --engagement wins over cwd walk-up) |
83
+ | `state.list` | every registered engagement with status + running flag |
84
+ | `state.set-status` | advance STATE.md one step (ADR-023 gates refuse unapproved boundaries) |
85
+ | `state.sync` | repair STATE.md frontmatter (valid frontmatter wins → registry → initialized) |
86
+ | `state.prune` | drop registry entries whose dirs are gone (closed records survive) |
87
+ | `state.pause` | write continue-here.md (a note, not a status) |
88
+ | `state.resume` | status + next hint + continue-here.md for cold resume |
89
+ | `evidence.put` | store a file under evidence/raw + hash-chained INDEX record |
90
+ | `evidence.verify` | re-hash one evidence id against the ledger |
91
+ | `evidence.verify-chain` | walk the whole hash chain (ADR-016) |
92
+ | `cvss.score` | compute score + severity band from a CVSS vector (never LLM math) |
93
+ | `findings.add` | register a draft finding (severity sdk-computed; cited evidence ids must exist in the ledger) |
94
+ | `findings.status` | move a finding through the status machine (draft → validated/rejected/validated-static → retest lane) |
95
+ | `findings.list` | list the register (optionally filtered by status) |
96
+ | `findings.gate` | report-readiness verdict (no unresolved drafts, or attested clean) |
97
+ | `findings.attest-clean` | zero-findings attestation backed by evidence ids — opens the gate for a clean engagement |
98
+ | `findings.retest-request` | move a validated finding to retest_pending |
99
+ | `findings.retest-record` | record an evidence-bound retest verdict (pass/fail) |
100
+ | `findings.sarif` | export the register as SARIF 2.1.0 (ADR-013) |
101
+ | `findings.ingest` | import tool SARIF as DRAFT findings (ingest is not a verdict) |
102
+ | `report.compile` | assemble the deterministic report (client/exec/retest variants) |
103
+ | `report.verify` | the report gate: no reporter placeholders; findings table matches the register |
104
+ | `report.pdf` | approved report → styled PDF (lane-B host tool; gated on report.verify + the recorded approval) |
105
+ | `engagement.close` | gated close-out: env down, RETROSPECTIVE.md, registry stamp (ADR-021) |
106
+ | `engagement.migrate` | convert a legacy .pentest/ engagement to the flat layout (v0.6) |
107
+ | `approve` | record a human checkpoint (approved/approved_by/approved_at) on scope\|plan:<id>\|report (ADR-023) |
108
+ | `pack.list` | all packs (slug = path under packs/) |
109
+ | `pack.load` | one pack's manifest + checklist |
110
+ | `pack.ingest` | copy an external source into packs/custom/<slug>/ with validation |
111
+ | `pack.enabled` | the engagement's enabled packs (config.yaml) |
112
+ | `pack.enable` | enable a pack for the engagement |
113
+ | `pack.disable` | disable a pack for the engagement |
114
+ | `pack.learn` | append a retrospective candidate to a pack's learnings pool (ADR-022) |
115
+ | `pack.learnings` | list a pack's candidate pool |
116
+ | `pack.promote` | move one candidate into the checklist (a human act) |
117
+ | `env.render` | render env/ compose + egress allowlist from SCOPE.md |
118
+ | `env.up` | bring the pensieve-net stack up |
119
+ | `env.down` | bring the stack down |
120
+ | `env.status` | stack status + warnings (incl. stale provisioning windows) |
121
+ | `env.proxy-env` | print the proxy env vars for toolbox-side tools |
122
+ | `monitor.scan` | WAF/rate-limit signals from the egress access log (ADR-017) |
123
+ | `tools.check` | probe pack-declared tools → present/install/manual plan (ADR-014) |
124
+ | `tools.install` | provision a lane-A tool into the running toolbox (approved window, logged) |
125
+
126
+ ## Hard invariants (violating these = engagement failure)
127
+
128
+ 1. Never bypass or weaken pensieve-net or the scope-guard hook. A refusal means
129
+ the scope is wrong or the target is out of scope — surface it, never
130
+ work around it.
131
+ 2. Checkpoints (scope / plan / report approval) are hard stops.
132
+ 3. Every finding claim carries an evidence id; every severity comes from the
133
+ sdk; only validated findings reach the report.
134
+ 4. Out-of-scope is impossible by construction — and still never attempted.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: pensieve-close
3
+ description: "Gated engagement close-out — stack down, retrospective, registry, closed."
4
+ version: 1.0.0
5
+ license: AGPL-3.0-only
6
+ platforms: [linux]
7
+ metadata:
8
+ hermes:
9
+ tags: [pensieve, pentest, command]
10
+ category: software-development
11
+ ---
12
+
13
+ # /pensieve-close
14
+
15
+ 1. Gate: `pensieve-sdk engagement.close --engagement <dir>` refuses unless
16
+ status is delivered|retesting AND the evidence chain verifies — a broken
17
+ ledger means the engagement is not done, whatever the calendar says.
18
+ 2. The sdk brings the stack down (idempotent), writes
19
+ RETROSPECTIVE.md (engagement root), stamps the registry, sets status
20
+ closed.
21
+ 3. The human/agent fills RETROSPECTIVE.md: objectives met?, what worked,
22
+ what did not (tooling defects!), and learnings → pack candidates —
23
+ written as pack-ready items, the M4 learnings-loop input.
24
+ Submit each candidate: `pensieve-sdk pack.learn --pack <slug> --item
25
+ "<TTP/checklist row>" --source <engagement-id>`; PROMOTION to the
26
+ checklist is the pack author's call (`pack.promote`), never automatic.
27
+
28
+ success_criteria:
29
+ - STATE.md = closed; registry has closed_at + findings counts
30
+ - RETROSPECTIVE.md completed (pack candidates actionable, not prose)
31
+ - no pensieve containers left running for the engagement
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: pensieve-map
3
+ description: "Synthesize recon into the attack-surface model."
4
+ version: 1.0.0
5
+ license: AGPL-3.0-only
6
+ platforms: [linux]
7
+ metadata:
8
+ hermes:
9
+ tags: [pensieve, pentest, command]
10
+ category: software-development
11
+ ---
12
+
13
+ # /pensieve-map
14
+
15
+ Agent: pensieve-mapper (agents/pensieve-mapper.md).
16
+
17
+ 1. mapper protocol → ATTACK-SURFACE.md.
18
+ 2. `pensieve-sdk state.set-status --engagement <dir> mapped`.
19
+ 3. Present the surface to the human in 10 lines: assets, entry points, data
20
+ sensitivity, pack recommendation.
21
+
22
+ success_criteria:
23
+ - `## SURFACE MAPPED` marker
24
+ - every entry traces to a recon file/E-id
25
+ - out-of-scope adjacency copied verbatim from recon
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: pensieve-new-engagement
3
+ description: "Initialize an engagement directory and open the scoping interview."
4
+ version: 1.0.0
5
+ license: AGPL-3.0-only
6
+ platforms: [linux]
7
+ metadata:
8
+ hermes:
9
+ tags: [pensieve, pentest, command]
10
+ category: software-development
11
+ ---
12
+
13
+ # /pensieve-new-engagement
14
+
15
+ 1. Ask: client name, primary target, methodology (web/api), unless already given.
16
+ 2. Run: `pensieve-sdk init --client <c> --target <t> --methodology <m> --cwd
17
+ <cwd>` → engagement dir. The methodology is wired into config.yaml and
18
+ STATE.md frontmatter by init (it is engagement metadata — never drop it).
19
+ 3. Read the skeletons, then follow the pensieve-scoper agent protocol
20
+ (workflows/scope.md covers the full interview).
21
+ 4. End with `## SCOPE READY FOR APPROVAL` or continue into /pensieve-scope if
22
+ the human wants to interview now.
23
+
24
+ success_criteria:
25
+ - engagement dir exists with the full flat layout (STATE.md, SCOPE.md,
26
+ ROE.md, config.yaml, findings/, evidence/, recon/, plans/, runs/,
27
+ report/ at the root)
28
+ - registry lists it (`pensieve-sdk state.list`)
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: pensieve-pause
3
+ description: "Leave a continue-here note; the status machine does not move."
4
+ version: 1.0.0
5
+ license: AGPL-3.0-only
6
+ platforms: [linux]
7
+ metadata:
8
+ hermes:
9
+ tags: [pensieve, pentest, command]
10
+ category: software-development
11
+ ---
12
+
13
+ # /pensieve-pause
14
+
15
+ 1. `pensieve-sdk state.pause --engagement <dir> "<note>"` — writes
16
+ continue-here.md (engagement root) with the current status, the digest's
17
+ next
18
+ action, and the note.
19
+ 2. Confirm to the human: pausing changed NOTHING in the status machine —
20
+ /pensieve-resume will surface the note on top of file-truth state.
21
+ 3. If the engagement env is up and the pause is long, suggest
22
+ `pensieve-sdk env.down --engagement <dir>` (egress containment stops too).
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: pensieve-plan
3
+ description: "Attack plan from packs + account matrix → HUMAN CHECKPOINT."
4
+ version: 1.0.0
5
+ license: AGPL-3.0-only
6
+ platforms: [linux]
7
+ metadata:
8
+ hermes:
9
+ tags: [pensieve, pentest, command]
10
+ category: software-development
11
+ ---
12
+
13
+ # /pensieve-plan
14
+
15
+ Agents: pensieve-planner, then pensieve-roe-checker.
16
+
17
+ 1. planner protocol → plans/PLAN-*.md + ACCOUNTS.md matrix.
18
+ Per-asset streams (M4 workstreams): a plan MAY cover an asset subset
19
+ (e.g. AST-002 only) — keep objectives atomic and name the assets in the
20
+ plan header; parallel testers then run plans, never one mega-plan.
21
+ 2. Account gaps → provisioning per ADR-010 (self-provision if allowed, else
22
+ `## HUMAN NEEDED accounts` and wait).
23
+ 3. TOOL PROVISIONING (ADR-014): `pensieve-sdk tools.check --engagement <dir>
24
+ --pack <slug>` for every pack used → present the plan (present/install/
25
+ manual) → user approves explicitly → lane-A:
26
+ `pensieve-sdk tools.install --engagement <dir> --pack <slug> --tool <name>`;
27
+ lane-B: instructions only, never auto-installed.
28
+ 4. roe-checker rules on the plan set. FAILED → planner revises once;
29
+ still failing → human decides.
30
+ 5. `## PLAN READY FOR APPROVAL` → **HUMAN CHECKPOINT**. Approved → record the
31
+ checkpoint on EVERY plan: `pensieve-sdk approve --engagement <dir>
32
+ --artifact plan:<id> --by <name>` (ADR-023 — set-status refuses
33
+ planned → testing while any plan is unapproved) →
34
+ `pensieve-sdk state.set-status --engagement <dir> planned`.
35
+
36
+ success_criteria:
37
+ - every plan cites pack items and expected evidence
38
+ - roe check PASSED on the final plan set
39
+ - account matrix satisfied or provisioning complete
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: pensieve-progress
3
+ description: "Where are we? Reads state from files (never conversation) and outputs the exact next action."
4
+ version: 1.0.0
5
+ license: AGPL-3.0-only
6
+ platforms: [linux]
7
+ metadata:
8
+ hermes:
9
+ tags: [pensieve, pentest, command]
10
+ category: software-development
11
+ ---
12
+
13
+ # /pensieve-progress
14
+
15
+ Zero-guessing status. All truth comes from files via the sdk.
16
+
17
+ 1. `pensieve-sdk state.current` → engagement + STATE.md digest (status, updated,
18
+ next hint). No engagement → list engagements (`state.list`) and offer to
19
+ resume one.
20
+ 2. Digest the register: `pensieve-sdk findings.list --engagement <dir>` (counts
21
+ by status) + `pensieve-sdk findings.gate --engagement <dir>`.
22
+ 3. Check the environment: `pensieve-sdk env.status --engagement <dir>` (toolbox
23
+ up/down).
24
+ 4. Output, compact:
25
+ - engagement, status, last updated
26
+ - findings: N draft / N validated / N rejected / gate verdict
27
+ - env: up/down
28
+ - NEXT: the one command to run (from STATE.md's next hint, sanity-checked
29
+ against the register — e.g. drafts remaining during 'validating' means
30
+ next is more validation, not the report)
31
+ 5. If the user says "continue": run that next workflow.
32
+
33
+ success_criteria:
34
+ - [ ] every number came from sdk output, not memory
35
+ - [ ] exactly one NEXT action named
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: pensieve-quick
3
+ description: "Fast lane — one ad-hoc test inside the CURRENT engagement, with full guarantees (scope, containment, evidence, validation). NOT a scope bypass."
4
+ version: 1.0.0
5
+ license: AGPL-3.0-only
6
+ platforms: [linux]
7
+ metadata:
8
+ hermes:
9
+ tags: [pensieve, pentest, command]
10
+ category: software-development
11
+ ---
12
+
13
+ # /pensieve-quick [what to test]
14
+
15
+ The fast lane for "just test this one thing, properly." Everything that makes
16
+ PENSIEVE accountable still applies — this is a compressed loop, not a loophole.
17
+
18
+ ## Preconditions
19
+
20
+ - Inside an engagement directory (state ≥ scoped). No engagement → tell the
21
+ user to /pensieve-new-engagement or /pensieve-scope first. Quick NEVER creates
22
+ scope implicitly.
23
+ - If env is down: `pensieve-sdk env.up --engagement <dir>` + the containment
24
+ self-check first.
25
+
26
+ ## Flow
27
+
28
+ 1. SCOPE GATE: `pensieve-sdk scope.check --engagement <dir> <target>` on
29
+ everything the test touches. Anything not in-scope → stop, tell the user
30
+ how to amend scope.
31
+ 2. ONE plan: write plans/PLAN-QUICK-<slug>.md (single objective, expected
32
+ evidence). No human checkpoint UNLESS the test is destructive, lane-B, or
33
+ needs an uninstalled tool (then tools.check → approval per ADR-014).
34
+ 3. Execute in the toolbox (lane A). Raw output → `pensieve-sdk evidence.put
35
+ --engagement <dir>`.
36
+ 4. If a vuln is found: register draft → independent replay (validator
37
+ protocol, any tool) → validated/rejected. Findings never skip the gate.
38
+ 5. RUN-LOG entry + checklist row update if a pack item matches.
39
+ 6. Output: verdict + evidence ids + finding id (if any), ≤10 lines.
40
+
41
+ `--full` flag: run the standard pipeline instead (quick is the wrong tool).
42
+
43
+ success_criteria:
44
+ - [ ] scope.check passed for every touched asset
45
+ - [ ] raw output in evidence with E-id
46
+ - [ ] finding (if any) reached validated/rejected, not left draft
47
+ - [ ] RUN-LOG has the entry
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: pensieve-recon
3
+ description: "Bring the environment up and run recon inside pensieve-net."
4
+ version: 1.0.0
5
+ license: AGPL-3.0-only
6
+ platforms: [linux]
7
+ metadata:
8
+ hermes:
9
+ tags: [pensieve, pentest, command]
10
+ category: software-development
11
+ ---
12
+
13
+ # /pensieve-recon
14
+
15
+ Agent: pensieve-reconner (agents/pensieve-reconner.md).
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".
22
+ 3. reconner protocol → recon/*.md, evidence hash-indexed; lane order per
23
+ reference/attack-playbooks.md.
24
+ 4. `pensieve-sdk state.set-status --engagement <dir> recon`.
25
+ 5. Summarize for the human: assets found, notable signals, adjacency tripwires.
26
+
27
+ success_criteria:
28
+ - `## RECON COMPLETE` marker with counts
29
+ - recon/SUMMARY.md exists; every claim cites an E-id or recon file
30
+ - zero out-of-scope proxy refusals unexplained
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: pensieve-report
3
+ description: "Gate → assemble report/REPORT.md → HUMAN CHECKPOINT."
4
+ version: 1.0.0
5
+ license: AGPL-3.0-only
6
+ platforms: [linux]
7
+ metadata:
8
+ hermes:
9
+ tags: [pensieve, pentest, command]
10
+ category: software-development
11
+ ---
12
+
13
+ # /pensieve-report
14
+
15
+ Agent: pensieve-reporter (agents/pensieve-reporter.md).
16
+
17
+ 1. Gate: `pensieve-sdk findings.gate --engagement <dir>` must be report_ready
18
+ (or the human explicitly accepts the unresolved list — record that in
19
+ STATE.md). A genuinely CLEAN engagement (zero findings) is not report_ready
20
+ until the clean verdict is attested with evidence:
21
+ `pensieve-sdk findings.attest-clean --engagement <dir> --evidence E-id[,E-id]`
22
+ (brief 1.3 ATTESTATION stamp on findings/INDEX.md; every cited id must
23
+ verify). Never hand-edit findings/INDEX.md to force the gate — if the
24
+ command refuses, fix the cause it names.
25
+ Chain: `pensieve-sdk evidence.verify-chain --engagement <dir>` must be ok — a
26
+ broken ledger stops the report exactly like a broken finding would (ADR-016).
27
+ 2. reporter protocol → report/REPORT.md (structure: executive summary /
28
+ scope & methodology / prioritized findings / compliance mapping / appendix).
29
+ 3. `## REPORT READY` → reporter clears every `_TODO_` placeholder, then
30
+ `pensieve-sdk report.verify --engagement <dir>` must PASS (placeholders and
31
+ findings-table/register divergence are refused) → **HUMAN CHECKPOINT**:
32
+ the human reviews; edits go through the finding files (never hand-edit
33
+ severity numbers — fix the vector and let the sdk recompute).
34
+ 4. On human approval record the checkpoint: `pensieve-sdk approve
35
+ --engagement <dir> --artifact report --by <name>` (ADR-023 — set-status
36
+ refuses reporting → delivered without it, and without gate pass +
37
+ report.verify). Optional formal export: `pensieve-sdk report.pdf
38
+ --engagement <dir>` renders the approved report to a styled PDF (lane-B
39
+ host tool; gated on report.verify + the recorded approval).
40
+ Delivery + `pensieve-sdk state.set-status --engagement <dir> delivered` are
41
+ the human's call. Retest later = /pensieve-retest on retest_pending findings.
42
+
43
+ success_criteria:
44
+ - report contains validated findings only
45
+ - every severity traces to an sdk-computed score
46
+ - coverage limitations stated verbatim from SCOPE.md
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: pensieve-resume
3
+ description: "Reconstruct engagement state and propose the next action. Zero guessing."
4
+ version: 1.0.0
5
+ license: AGPL-3.0-only
6
+ platforms: [linux]
7
+ metadata:
8
+ hermes:
9
+ tags: [pensieve, pentest, command]
10
+ category: software-development
11
+ ---
12
+
13
+ # /pensieve-resume
14
+
15
+ 1. `pensieve-sdk state.current` (walk-up) or `state.list` to find the engagement.
16
+ If the sdk errors that STATE.md is missing its status frontmatter
17
+ (fail-closed — STATE.md is the ground truth, never hand-edit it), repair
18
+ with `pensieve-sdk state.sync --engagement <dir>` first; it reattaches the
19
+ frontmatter and preserves the human body byte-for-byte.
20
+ 2. `pensieve-sdk state.resume --engagement <dir>` — returns status, the digest's
21
+ next-action hint, and continue-here.md if a pause left one. If
22
+ continue_here is non-null, show it verbatim FIRST (the human's own note
23
+ outranks everything else).
24
+ 3. Read: STATE.md (status + phase notes), findings/INDEX.md, plans/
25
+ checkbox states, runs/ count, report/ existence.
26
+ 4. Print the honest state: where we are, what's done, what's pending, any
27
+ `## HUMAN NEEDED` items left open in run logs.
28
+ 5. Propose exactly ONE next command (the workflow matching the status) and
29
+ wait for the human.
30
+
31
+ success_criteria:
32
+ - state summary derived from files only (no memory, no guessing)
33
+ - exactly one proposed next action
@@ -0,0 +1,35 @@
1
+ ---
2
+ name: pensieve-retest
3
+ description: "Re-run validated findings' reproduction plans against fixes → evidence-bound verdicts."
4
+ version: 1.0.0
5
+ license: AGPL-3.0-only
6
+ platforms: [linux]
7
+ metadata:
8
+ hermes:
9
+ tags: [pensieve, pentest, command]
10
+ category: software-development
11
+ ---
12
+
13
+ # /pensieve-retest
14
+
15
+ Agent: pensieve-validator (independent replay — same bar as validation).
16
+
17
+ 1. Preconditions: status=delivered, client reports fixes landed; env up.
18
+ 2. `pensieve-sdk findings.retest-request --engagement <dir>` — moves every
19
+ validated finding to retest_pending (or pass an id for a single lane).
20
+ 3. Per finding: read its validation reproduction plan (finding file Evidence
21
+ section + linked run log), re-run it against the fixed target INSIDE the
22
+ toolbox at STEALTH unless the human says otherwise.
23
+ 4. Capture the replay output → `pensieve-sdk evidence.put --engagement <dir>`,
24
+ then record the verdict: `pensieve-sdk findings.retest-record --engagement
25
+ <dir> <F-id> --verdict pass|fail --evidence E-id[,E-id] [--note ...]`. A
26
+ verdict without replay evidence is refused — same bar as the original finding.
27
+ 5. `pensieve-sdk state.set-status --engagement <dir> retesting` on entry; when
28
+ all verdicts are in: `pensieve-sdk report.compile --engagement <dir>
29
+ --variant retest` → verdict table for the client; surface any
30
+ STILL-REPRODUCIBLE findings to the human.
31
+
32
+ success_criteria:
33
+ - every retest_pending finding has a recorded verdict with ≥1 E-id
34
+ - report/RETEST.md exists with the full verdict table
35
+ - failed fixes are surfaced, not quietly re-queued