@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,11 @@
1
+ {
2
+ "name": "pensieve-sdk",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "description": "PENSIEVE deterministic bridge: scope, state, evidence, findings, CVSS",
6
+ "license": "AGPL-3.0-only",
7
+ "bin": { "pensieve-sdk": "bin/pensieve-sdk.cjs" },
8
+ "scripts": {
9
+ "test": "node --test '../../tests/pensieve-sdk/**/*.test.cjs'"
10
+ }
11
+ }
@@ -0,0 +1,35 @@
1
+ # Accounts — {{ENGAGEMENT_ID}}
2
+
3
+ Identity ledger (ADR-010). Every credential used in testing lives here.
4
+ Secrets themselves are referenced, never pasted (vault reference or env name).
5
+
6
+ | Account | Role | Tenant | MFA delivery channel | MFA code lifetime | MFA lockout policy | Source | Created by | Status | Notes |
7
+ |---------|------|--------|----------------------|-------------------|--------------------|--------|------------|--------|-------|
8
+ | | user / admin / api | | sms / ivr / email / authenticator / none | e.g. 60s | e.g. 3 fails / 15min | provided / self-provisioned | | active / disabled | |
9
+
10
+ The MFA columns drive the OTP economy (reference/otp-relay.md): the code
11
+ lifetime bounds how much of an OTP flow must be pre-chained before any code
12
+ is requested, and the lockout policy bounds how many failed submits the
13
+ account tolerates across the WHOLE engagement — budget every consumed code
14
+ and every failed attempt against them. MFA enforcement is per-account: the
15
+ per-account MFA runbook (V2-AUTH-MFA in web/asvs-l2) walks every row of
16
+ this table and records which accounts enforce step-up.
17
+
18
+ ## Account matrix (derived by the planner)
19
+
20
+ | Objective | Needs | Satisfied by |
21
+ |-----------|-------|--------------|
22
+ | BOLA/IDOR | 2 same-role users + 1 cross-tenant victim | |
23
+ | AuthZ matrix | user + admin | |
24
+ | Unauthenticated baseline | none (no session) | n/a |
25
+ | Per-account MFA (V2-AUTH-MFA) | every account row above | |
26
+
27
+ ## Email catch-point
28
+
29
+ _self-provisioned accounts need a mailbox the tester controls (e.g. mailpit
30
+ pattern); recorded here with the capture location_
31
+
32
+ ## Cleanup
33
+
34
+ _all self-provisioned accounts are disabled/deleted at engagement end and
35
+ the cleanup is noted in the report appendix_
@@ -0,0 +1,30 @@
1
+ # Attack Surface — {{ENGAGEMENT_ID}}
2
+
3
+ _synthesized from recon/ by pensieve-mapper; the planner reads this, never raw recon_
4
+
5
+ ## Assets
6
+
7
+ | AST | Host | What it is | Exposure | Auth | Notes |
8
+ |-----|------|-----------|----------|------|-------|
9
+
10
+ ## Entry points
11
+
12
+ _API endpoints, forms, upload handlers, auth flows, webhooks, admin panels —
13
+ with the recon file that evidences each_
14
+
15
+ ## Trust boundaries
16
+
17
+ _where identity/role/tenant changes hands_
18
+
19
+ ## Data sensitivity map
20
+
21
+ _where PII / credentials / money movement / tokens live_
22
+
23
+ ## Technology signals
24
+
25
+ _frameworks, servers, CDNs, JS libs (versions where known) → hints for packs_
26
+
27
+ ## Out-of-scope adjacency (do not touch)
28
+
29
+ _neighbors that look related but are excluded in SCOPE.md — flagged so agents
30
+ don't drift_
@@ -0,0 +1,43 @@
1
+ ---
2
+ id: {{FINDING_ID}}
3
+ title: {{CWE_NAMED_TITLE}}
4
+ cwe: {{CWE-NNN}}
5
+ cvss_vector: {{VECTOR}}
6
+ cvss_score: {{COMPUTED_BY_SDK}}
7
+ severity: {{COMPUTED_BY_SDK}}
8
+ status: draft
9
+ assets: [{{AST_IDS}}]
10
+ evidence: []
11
+ business_adjustment: null
12
+ created: {{DATE}}
13
+ ---
14
+ # {{FINDING_ID}} — {{CWE_NAMED_TITLE}}
15
+
16
+ ## Summary
17
+
18
+ _two sentences: what is broken and what an attacker gets. CWE-named; plain
19
+ language a client engineer recognizes._
20
+
21
+ ## Attack Narrative
22
+
23
+ _the story a client engineer can follow end-to-end: preconditions → steps →
24
+ impact. Include the account/role used (ACCOUNTS.md). Exact case — the sdk
25
+ reads this heading verbatim (report.compile / report.pdf)._
26
+
27
+ ## Severity rationale
28
+
29
+ CVSS vector (validator-proposed) + the engagement's business context
30
+ (business_adjustment only with written rationale; never rewrites the CVSS
31
+ number — ADR-011).
32
+
33
+ ## Evidence
34
+
35
+ _evidence/ ids + replay steps; every claim hash-backed_
36
+
37
+ ## Report artifact
38
+
39
+ _Nuclei template (evidence id) where template-able — readers re-run the proof_
40
+
41
+ ## Remediation
42
+
43
+ _specific to the stack seen in recon; reference, not boilerplate_
@@ -0,0 +1,33 @@
1
+ ---
2
+ id: PLAN-{{N}}
3
+ objective: {{OBJECTIVE_ID}}
4
+ status: pending
5
+ ---
6
+ # Plan {{N}} — {{TITLE}}
7
+
8
+ ## Objective
9
+
10
+ _the single thing this plan proves or disproves (maps to METHODOLOGY/PACK)_
11
+
12
+ ## Pack checklist
13
+
14
+ - [ ] {{CHECKLIST_ITEM_1}}
15
+ - [ ] {{CHECKLIST_ITEM_2}}
16
+
17
+ ## Preconditions
18
+
19
+ _accounts (see ACCOUNTS.md matrix), tokens, seed data, environment up_
20
+
21
+ ## Steps
22
+
23
+ _for the testing agent: what to attempt, where, with what tooling (runs in
24
+ the toolbox, proxied). Reference pack knowledge by file:line, not by memory._
25
+
26
+ ## Expected evidence
27
+
28
+ _what proof looks like for each potential finding (response pairs, PoC script)_
29
+
30
+ ## New-scope tripwires
31
+
32
+ _anything discovered outside SCOPE.md → stop, note, ask (never expand scope
33
+ silently)_
@@ -0,0 +1,29 @@
1
+ # {{ENGAGEMENT_ID}}
2
+
3
+ | | |
4
+ |---|---|
5
+ | Client | {{CLIENT}} |
6
+ | Primary target | {{TARGET}} |
7
+ | Methodology | {{METHODOLOGY}} |
8
+ | Box | white / gray / black |
9
+ | Created | {{DATE}} |
10
+ | Authorization ref | {{AUTH_REF}} |
11
+
12
+ ## Objectives
13
+
14
+ _one paragraph: what the client needs answered — not "find vulns" but the
15
+ business question (e.g. "can a retail customer reach another customer's data
16
+ or move money outside their account")_
17
+
18
+ ## Constraints
19
+
20
+ - Max test intensity: {{INTENSITY}} (low / normal / high — maps to
21
+ reference/param-profiles.md profiles STEALTH / NORMAL / AGGRESSIVE)
22
+ - Data handling: evidence stays in this engagement directory; report via {{CHANNEL}}
23
+ - Third parties / CDNs / payment processors: in scope only as listed in SCOPE.md
24
+
25
+ ## Deliverables
26
+
27
+ - report/REPORT.md — the client report (structure per templates/report/REPORT.md)
28
+ - findings/ register with replayable evidence
29
+ - retest lane for validated findings
@@ -0,0 +1,50 @@
1
+ # Rules of Engagement — {{ENGAGEMENT_ID}}
2
+
3
+ ## Authorization
4
+
5
+ Testing is authorized only as recorded in SCOPE.md (Authority table). Every
6
+ agent run begins by reading this file and SCOPE.md (roe_check contract).
7
+
8
+ ## Hard limits (enforced by the stack, not by goodwill)
9
+
10
+ 1. Out-of-scope network traffic is refused by TWO independent layers:
11
+ - Layer 1 (network): toolbox containers live on an isolated docker network
12
+ with no route out; a squid egress proxy enforces an allowlist generated
13
+ from SCOPE.md. DNS for out-of-scope names does not resolve.
14
+ - Layer 2 (runtime): a pre_tool_call scope-guard hook refuses tool calls
15
+ whose command text targets out-of-scope hosts, fail-closed.
16
+ 2. The guard sees command text only. Redirects, CNAME chains, and
17
+ proxy-indirection are NOT decidable at layer 2 — layer 1 sees the real
18
+ destination and is the final word. (spike 001, residual-risk note)
19
+ 3. Raw-socket scanning (nmap -sS, masscan) cannot run inside the containment
20
+ model and is DEFERRED to a separate host lane (M2). Port/service discovery
21
+ in this engagement uses proxied connect-based tooling only.
22
+ 4. No testing outside the authorization window (SCOPE.md valid dates).
23
+ 5. Data-handling: evidence stays in this engagement directory, hash-indexed;
24
+ nothing is uploaded anywhere except the delivered report.
25
+
26
+ ## Techniques
27
+
28
+ | Allowed | Not allowed |
29
+ |---------|-------------|
30
+ | {{ALLOWED}} | DoS/stress, social engineering (unless listed), physical, {{DENIED}} |
31
+
32
+ ## Execution lanes (ADR-013)
33
+
34
+ | Lane | Where tools run | Containment | Used for |
35
+ |------|-----------------|-------------|----------|
36
+ | A (default) | toolbox container | pensieve-net + hook | everything, unless justified below |
37
+ | B (exception) | host/local | hook only — reduced | named tools that cannot run in-container |
38
+
39
+ Lane-B tools in this engagement (name + justification + plan approval):
40
+ _lane-B use is repeated in the report's coverage limitations_
41
+
42
+ ## Human checkpoints
43
+
44
+ Scope approval (pre-recon) → plan approval (pre-testing) → report approval
45
+ (pre-delivery). Agents never skip these; they pause and ask.
46
+
47
+ ## Incident / stop conditions
48
+
49
+ If testing trips client defenses or instability: stop, log in STATE.md,
50
+ contact {{EMERGENCY_CONTACT}}.
@@ -0,0 +1,19 @@
1
+ ---
2
+ run_id: {{RUN_ID}}
3
+ agent: {{AGENT}}
4
+ plan: {{PLAN_ID}}
5
+ started: {{TS}}
6
+ status: running
7
+ ---
8
+ # Run Log — {{RUN_ID}}
9
+
10
+ | Time | Action | Target (asset) | Result | Evidence id |
11
+ |------|--------|----------------|--------|-------------|
12
+
13
+ ## Notes
14
+
15
+ _free-form observations; every claim needs an evidence/ entry or a finding_
16
+
17
+ **Redact before `evidence.put`** (agents/pensieve-tester.md → Evidence hygiene):
18
+ secrets, tokens, and out-of-scope PII never enter the append-only ledger —
19
+ prove the exposure, don't archive the secret.
@@ -0,0 +1,32 @@
1
+ # Scope — {{ENGAGEMENT_ID}}
2
+
3
+ This file is the enforcement source of truth. The egress allowlist
4
+ (pensieve-net) and the scope-guard hook are GENERATED from it. If it is not
5
+ written here, it is not in scope.
6
+
7
+ ## In Scope
8
+
9
+ <!-- one asset per line: - AST-NNN <host|CIDR> (<description>, ports <n,n>) -->
10
+
11
+ ## Out of Scope
12
+
13
+ <!-- explicit exclusions; an asset here NEVER tests, even if it overlaps -->
14
+
15
+ ## Authority
16
+
17
+ | | |
18
+ |---|---|
19
+ | Authorized by | {{NAME}}, {{TITLE}}, {{ORG}} |
20
+ | Authorization document | {{DOC_REF}} (contract / SOW / signed email) |
21
+ | Valid from → to | {{START}} → {{END}} |
22
+ | Emergency contact | {{CONTACT}} |
23
+
24
+ ## Accounts
25
+
26
+ see ACCOUNTS.md — provided credentials and self-provisioned test accounts (ADR-010).
27
+
28
+ ## Coverage notes
29
+
30
+ - Authentication: credentialed / self-provisioned / unauthenticated-only
31
+ - Coverage limitations to state in the report: _e.g. no raw-socket lanes (M2),
32
+ unauthenticated-only if no creds, black-box only if no source provided_
@@ -0,0 +1,62 @@
1
+ ---
2
+ finding: {{FINDING_ID}}
3
+ validator: {{AGENT}}
4
+ verdict: pending
5
+ ---
6
+ # Validation — {{FINDING_ID}}
7
+
8
+ ## Claim under test
9
+
10
+ _the finding's core claim, one sentence_
11
+
12
+ ## Replay (independent)
13
+
14
+ _tooling and steps the VALIDATOR used — chosen independently of the testing
15
+ agent's original method (any tool that fits; runs in the toolbox)_
16
+
17
+ - [ ] Reproduced as described
18
+ - [ ] Impact claim holds (not just the bug, the claimed effect)
19
+
20
+ ## Control markers (class-conditional — enforced by `findings.status validated`)
21
+
22
+ For two CWE classes the SDK refuses the `draft -> validated` flip until the
23
+ record carries the matching control markers below (fail-closed; the refusal
24
+ names the finding, the class, and the missing control). All other CWEs need
25
+ no markers. Marker lines must start at column 0 — prose mentions don't count.
26
+
27
+ **TLS-floor findings (CWE 319 / 310 / 326 / 327)** — a silent TLS negotiation
28
+ once faked a NULL-cipher acceptance, so the replay must PROVE the protocol
29
+ was forced and name the cipher observed on that forced protocol:
30
+
31
+ ```
32
+ forced-protocol: TLSv1.0 forced via openssl s_client -tls1 (no negotiation)
33
+ control-cipher: DES-CBC3-SHA observed on the forced protocol
34
+ ```
35
+
36
+ **Disclosure findings (CWE 200 / 209)** — a `200 OK` with a friendly-error
37
+ body is the endemic disclosure false-positive, so a status code is never
38
+ proof. Quote the actual response BODY in a fenced block:
39
+
40
+ ````
41
+ ```body-quote
42
+ {"error":"Internal Server Error","exception":"java.sql.SQLException: ..."}
43
+ ```
44
+ ````
45
+
46
+ The block must contain at least one line with more than 10 non-space
47
+ characters — the body itself, not `HTTP 200`.
48
+
49
+ ## Verdict
50
+
51
+ `validated` / `rejected` / `human-needed` — with one-paragraph justification.
52
+
53
+ ## Report artifact
54
+
55
+ _if template-able: Nuclei template path in evidence/ (re-fires on vulnerable,
56
+ passes on fixed). The template is a REPORT ARTIFACT for readers — the
57
+ validation itself is the replay above (ADR-005)._
58
+
59
+ ## Static-only findings (white-box lane)
60
+
61
+ _if not dynamically reproducible: independent code-path re-review record —
62
+ file:line chain, verdict `validated-static`, what would make it dynamic_
@@ -0,0 +1,49 @@
1
+ # Penetration Test Report — {{CLIENT}} {{ENGAGEMENT_ID}}
2
+
3
+ ## 1. Executive Summary
4
+
5
+ _for leadership: overall risk posture in business language, the 3-5 findings
6
+ that matter most, and the single most important remediation. One page max._
7
+
8
+ ## 2. Scope & Methodology
9
+
10
+ _The box level is assembled by the SDK from the structured config.yaml field
11
+ (rendered above as **Box level:**) — do not re-derive it from interview prose.
12
+ Cover: assets tested (SCOPE.md), methodology + packs used, dates, accounts/roles
13
+ used, COVERAGE LIMITATIONS (what was NOT tested and why)_
14
+
15
+ ## 3. Findings
16
+
17
+ _prioritized by severity (validated findings only — the register gate)_
18
+
19
+ ### {{F-001}} {{CWE-named title}} — {{severity}} (CVSS {{score}})
20
+
21
+ - Vector: `{{CVSS vector}}`
22
+ - Affected assets: {{AST ids}}
23
+
24
+ {{Summary}}
25
+
26
+ **Attack narrative.** {{story a client engineer can follow}}
27
+
28
+ **Evidence.** {{evidence ids + replay steps}}
29
+
30
+ **Remediation.** {{specific fix}}
31
+
32
+ _(structure matches report.cjs compile() output — the sdk assembles these
33
+ blocks from the finding files; the reporter writes prose, never numbers.
34
+ The finding file's "Report artifact" (Nuclei template, ADR-005) ships
35
+ alongside.)_
36
+
37
+ ## 4. Compliance Mapping
38
+
39
+ _findings and pack coverage mapped to the client's frameworks (SAMA CSF,
40
+ PCI DSS, etc. — per fintech/practice packs) — the section bank clients audit
41
+ against_
42
+
43
+ ## 5. Appendix
44
+
45
+ - Tools used (toolbox inventory)
46
+ - Accounts used (ACCOUNTS.md, incl. self-provisioned cleanup note)
47
+ - Evidence manifest (hash index reference)
48
+ - Raw-log manifest (runs/)
49
+ - Methodology references
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: pensieve-close
3
+ description: Gated engagement close-out — stack down, retrospective, registry, closed.
4
+ ---
5
+
6
+ # /pensieve-close
7
+
8
+ 1. Gate: `pensieve-sdk engagement.close --engagement <dir>` refuses unless
9
+ status is delivered|retesting AND the evidence chain verifies — a broken
10
+ ledger means the engagement is not done, whatever the calendar says.
11
+ REACH-03 (v1.1) — early close: `--reason unreachable|withdrawn|owner-abort
12
+ --by <name> --note <why>` closes from ANY status (owner-gated, the
13
+ risk_accepted precedent; the `unreachable` reason additionally requires a
14
+ recon/LIVENESS.md verdict from `scope.liveness` whose evidence ids
15
+ verify — no closing "unreachable" without the probe record). The default
16
+ (no --reason) keeps the delivered|retesting gate byte-identical, and the
17
+ registry + STATE.md carry close_reason so closed-unreachable is
18
+ distinguishable from closed-complete.
19
+ 2. The sdk brings the stack down (idempotent), writes
20
+ RETROSPECTIVE.md (engagement root), stamps the registry, sets status
21
+ closed.
22
+ 3. The human/agent fills RETROSPECTIVE.md: objectives met?, what worked,
23
+ what did not (tooling defects!), and learnings → pack candidates —
24
+ written as pack-ready items, the M4 learnings-loop input.
25
+ Submit each candidate: `pensieve-sdk pack.learn --pack <slug> --item
26
+ "<TTP/checklist row>" --source <engagement-id>`. Promotion is AUTONOMOUS
27
+ (v0.6 05-03): a candidate that later proves itself in enough independent
28
+ engagements (pack.confirm) promotes itself into the checklist — no human
29
+ pick. The human veto is `pensieve-sdk pack.revert <slug> <L-NNN>`.
30
+
31
+ success_criteria:
32
+ - STATE.md = closed; registry has closed_at + findings counts
33
+ - RETROSPECTIVE.md completed (pack candidates actionable, not prose)
34
+ - no pensieve containers left running for the engagement
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: pensieve-map
3
+ description: Synthesize recon into the attack-surface model.
4
+ ---
5
+
6
+ # /pensieve-map
7
+
8
+ **Spawn** (isolated subagent — not inline role-play): launch `pensieve-mapper` via
9
+ the Task tool with `subagent_type: pensieve-mapper` (contract:
10
+ agents/pensieve-mapper.md). Its prompt is the raw output of `pensieve-sdk
11
+ subagent.brief pensieve-mapper --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. mapper protocol → ATTACK-SURFACE.md.
17
+ 2. Target-profile learning (automatic): for each asset whose auth/login flow the
18
+ mapper has now worked out, save it so the NEXT engagement reuses it instead of
19
+ re-deriving it:
20
+ `pensieve-sdk target.put --host <host> auth_method=<password|sso|mfa|...>
21
+ login_endpoint=<path> session=<cookie|bearer|none> token_names=<a,b>
22
+ waf=<signature> login_flow="<the working steps>"`.
23
+ This is the store that recon's `target.recognize` reads on the next run —
24
+ e.g. a hard-won example-gate.test login is saved once and reused, not rebuilt.
25
+ 3. Build the ADR-025 attack graph: `pensieve-sdk graph.build --engagement <dir>`
26
+ after `ATTACK-SURFACE.md` is written. On error → stop; do not reach
27
+ `mapped`/`planned` with a broken graph. Emits `surface/graph.json` +
28
+ `surface/ATTACK-GRAPH.md`.
29
+ 4. `pensieve-sdk state.set-status --engagement <dir> mapped`.
30
+ 5. Present the surface to the human in 10 lines: assets, entry points, data
31
+ sensitivity, pack recommendation, target profiles saved, and the shortest
32
+ path to the objective.
33
+
34
+ success_criteria:
35
+ - `## SURFACE MAPPED` marker
36
+ - every entry traces to a recon file/E-id
37
+ - a TARGET-PROFILE.md written (target.put) for every asset with an auth flow
38
+ - out-of-scope adjacency copied verbatim from recon
39
+ - `surface/graph.json` + `surface/ATTACK-GRAPH.md` written (graph.build ok)
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: pensieve-new-engagement
3
+ description: Initialize an engagement directory and open the scoping interview.
4
+ ---
5
+
6
+ # /pensieve-new-engagement
7
+
8
+ 1. Ask: client name, primary target, methodology (web/api), unless already
9
+ given — through the runtime's built-in question form (Hermes: `clarify`;
10
+ Claude Code: `AskUserQuestion`), never prose.
11
+ 2. Run: `pensieve-sdk init --client <c> --target <t> --methodology <m> --cwd
12
+ <cwd>` → engagement dir. The methodology is wired into config.yaml and
13
+ STATE.md frontmatter by init (it is engagement metadata — never drop it).
14
+ 3. Read the skeletons, then follow the pensieve-scoper agent protocol
15
+ (workflows/scope.md covers the full interview).
16
+ 4. The interview includes the MANDATORY checklist-selection step
17
+ (commands/pensieve-scope.md) — presented as one multi-select question
18
+ form: present (a) built-in packs — filtered by
19
+ methodology where applicable, (b) user-root/custom packs, (c) the
20
+ client-workbook import option, and (d) the `pack.scaffold` path for
21
+ "author a new one now" — then record the selection with
22
+ `pensieve-sdk scope.set-checklists --engagement <dir> --packs <slugs>
23
+ [--client-workbook <file>]`. It is validate-then-write (unknown slugs
24
+ and collisions refuse with nothing written) and its `## Checklists`
25
+ section in SCOPE.md is covered by the single scope approval — record it
26
+ BEFORE `## SCOPE READY FOR APPROVAL`.
27
+ 5. End with `## SCOPE READY FOR APPROVAL` or continue into /pensieve-scope if
28
+ the human wants to interview now.
29
+
30
+ success_criteria:
31
+ - engagement dir exists with the full flat layout (STATE.md, SCOPE.md,
32
+ ROE.md, config.yaml, findings/, evidence/, recon/, plans/, runs/,
33
+ report/ at the root)
34
+ - registry lists it (`pensieve-sdk state.list`)
35
+ - checklist selection recorded (`scope.set-checklists` ran; SCOPE.md
36
+ carries a `## Checklists` section) or explicitly deferred to
37
+ /pensieve-scope
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: pensieve-plan
3
+ description: Attack plan from packs + account matrix → HUMAN CHECKPOINT.
4
+ ---
5
+
6
+ # /pensieve-plan
7
+
8
+ **Spawn** (isolated subagents — not inline role-play): this command spawns TWO
9
+ subagents via the Task tool — `subagent_type: pensieve-planner` (step 1, contract:
10
+ agents/pensieve-planner.md) and then `subagent_type: pensieve-roe-checker` (step 4,
11
+ contract: agents/pensieve-roe-checker.md). Each prompt is the raw output of
12
+ `pensieve-sdk subagent.brief pensieve-<role> --engagement <dir>`. The spawned subagents
13
+ — not the orchestrator — run their protocols and return at their terminal markers;
14
+ on return, `pensieve-sdk subagent.record` each hand-back and `pensieve-sdk
15
+ subagent.verify` the declared artifacts (self-reports ≠ evidence).
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` → the AI approver records the checkpoint on
31
+ EVERY plan (ADR-024): `pensieve-sdk ai-approve --engagement <dir>
32
+ --artifact plan:<id> --by pensieve-planner --confidence <0-1> --reasoning
33
+ "<why this plan is safe + in scope>" --evidence <E-id>`.
34
+ - verdict `approved` on every plan → `pensieve-sdk state.set-status
35
+ --engagement <dir> planned`.
36
+ - verdict `escalate` on any plan → **HUMAN CHECKPOINT**: HUMAN-NEEDED.md
37
+ names the reason; the human records the checkpoint with `pensieve-sdk
38
+ approve --engagement <dir> --artifact plan:<id> --by <name>`.
39
+ (ADR-023 — set-status refuses planned → testing while any plan is
40
+ unapproved.)
41
+
42
+ success_criteria:
43
+ - every plan cites pack items and expected evidence
44
+ - roe check PASSED on the final plan set
45
+ - account matrix satisfied or provisioning complete
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: pensieve-progress
3
+ description: Where are we? Reads state from files (never conversation) and outputs the exact next action.
4
+ ---
5
+
6
+ # /pensieve-progress
7
+
8
+ Zero-guessing status. All truth comes from files via the sdk.
9
+
10
+ 1. `pensieve-sdk state.current` → engagement + STATE.md digest (status, updated,
11
+ next hint). No engagement → list engagements (`state.list`) and offer to
12
+ resume one.
13
+ 2. Digest the register: `pensieve-sdk findings.list --engagement <dir>` (counts
14
+ by status) + `pensieve-sdk findings.gate --engagement <dir>`.
15
+ 3. Check the environment: `pensieve-sdk env.status --engagement <dir>` (toolbox
16
+ up/down).
17
+ 4. Output, compact:
18
+ - engagement, status, last updated
19
+ - findings: N draft / N validated / N rejected / gate verdict
20
+ - env: up/down
21
+ - NEXT: the one command to run (from STATE.md's next hint, sanity-checked
22
+ against the register — e.g. drafts remaining during 'validating' means
23
+ next is more validation, not the report)
24
+ 5. If the user says "continue": run that next workflow.
25
+
26
+ success_criteria:
27
+ - [ ] every number came from sdk output, not memory
28
+ - [ ] exactly one NEXT action named
@@ -0,0 +1,67 @@
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. `--item <ID> [target...]` runs one checklist item's runbook end-to-end with the SAME guarantees — an entry point onto this Flow, not a second path around its gates.
4
+ ---
5
+
6
+ # /pensieve-quick [what to test]
7
+
8
+ The fast lane for "just test this one thing, properly." Everything that makes
9
+ PENSIEVE accountable still applies — this is a compressed loop, not a loophole.
10
+
11
+ ## Preconditions
12
+
13
+ - Inside an engagement directory (state ≥ scoped). No engagement → tell the
14
+ user to /pensieve-new-engagement or /pensieve-scope first. Quick NEVER creates
15
+ scope implicitly.
16
+ - If env is down: `pensieve-sdk env.up --engagement <dir>` + the containment
17
+ self-check first.
18
+
19
+ ## Flow
20
+
21
+ 1. SCOPE GATE: `pensieve-sdk scope.check --engagement <dir> <target>` on
22
+ everything the test touches. Anything not in-scope → stop, tell the user
23
+ how to amend scope.
24
+ 2. ONE plan: write plans/PLAN-QUICK-<slug>.md (single objective, expected
25
+ evidence). No human checkpoint UNLESS the test is destructive, lane-B, or
26
+ needs an uninstalled tool (then tools.check → approval per ADR-014).
27
+ 3. Execute in the toolbox (lane A). Raw output → `pensieve-sdk evidence.put
28
+ --engagement <dir>`.
29
+ 4. If a vuln is found: register draft → independent replay (validator
30
+ protocol, any tool) → validated/rejected. Findings never skip the gate.
31
+ 5. RUN-LOG entry + checklist row update if a pack item matches. Client
32
+ checklist rows (imported clientlist): when the work answers a client row,
33
+ record its verdict by CR id — `pensieve-sdk clientlist.write --engagement
34
+ <dir> --slug <s> --id CR-<sheet>-<pos> --tier no_done|no_na|yes` (or
35
+ `--tier "" --blocker-note` when blocked) — never fabricate coverage.
36
+ 6. Output: verdict + evidence ids + finding id (if any), ≤10 lines.
37
+
38
+ `--full` flag: run the standard pipeline instead (quick is the wrong tool).
39
+
40
+ ### `--item <ID> [target...]` lane
41
+
42
+ The alternative to the free-text `[what to test]` lane: run exactly one checklist
43
+ item's runbook. NOT a bypass — it reuses the Flow above verbatim, it does not fork
44
+ a second loop.
45
+
46
+ - Target required: `--item <ID>` needs at least one in-scope `[target...]` the
47
+ runbook binds its `$TARGET` placeholders to. With no target there is nothing for
48
+ the scope gate to check → STOP, ask the operator for an in-scope target, write
49
+ nothing.
50
+ - Resolve: `pensieve-sdk runbook-item <ID> --engagement <dir>`. Non-zero exit
51
+ (unknown ID) → STOP, surface the SDK error, write NOTHING — no plan, no evidence.
52
+ - Plan: the resolved runbook IS the single plan. Write plans/PLAN-QUICK-<ID>.md that
53
+ POINTS at it (`@packs/.../<ID>/SKILL.md`, paths-not-payloads) and takes its Steps /
54
+ Expected Evidence / Pass-Fail as the objective; its `$TARGET` binds to the named
55
+ in-scope asset(s).
56
+ - Then run the Flow steps 1–6 above VERBATIM — scope.check on every touched asset →
57
+ execute lane A → evidence.put → any finding draft → independent validation →
58
+ validated/rejected → RUN-LOG + checklist row for the matched item → verdict +
59
+ evidence ids + finding id output. The `--item` lane restates none of these; it
60
+ is an entry point onto the same gates. `--full` still routes to the standard
61
+ pipeline.
62
+
63
+ success_criteria:
64
+ - [ ] scope.check passed for every touched asset
65
+ - [ ] raw output in evidence with E-id
66
+ - [ ] finding (if any) reached validated/rejected, not left draft
67
+ - [ ] RUN-LOG has the entry