@abdulr7man/pensieve 0.0.0-stage → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +684 -0
- package/README.md +176 -2
- package/VERSION +1 -0
- package/agents/README.md +16 -0
- package/agents/pensieve-code-auditor.md +58 -0
- package/agents/pensieve-mapper.md +46 -0
- package/agents/pensieve-planner.md +67 -0
- package/agents/pensieve-reconner.md +76 -0
- package/agents/pensieve-reporter.md +61 -0
- package/agents/pensieve-roe-checker.md +46 -0
- package/agents/pensieve-scoper.md +77 -0
- package/agents/pensieve-tester.md +83 -0
- package/agents/pensieve-validator.md +62 -0
- package/bin/pensieve +452 -0
- package/bin/pensieve-installer.cjs +5 -0
- package/commands/pensieve-close.md +6 -0
- package/commands/pensieve-map.md +6 -0
- package/commands/pensieve-new-engagement.md +6 -0
- package/commands/pensieve-pause.md +15 -0
- package/commands/pensieve-plan.md +6 -0
- package/commands/pensieve-progress.md +34 -0
- package/commands/pensieve-quick.md +8 -0
- package/commands/pensieve-recon.md +6 -0
- package/commands/pensieve-report.md +6 -0
- package/commands/pensieve-resume.md +6 -0
- package/commands/pensieve-retest.md +10 -0
- package/commands/pensieve-scope.md +49 -0
- package/commands/pensieve-surface.md +8 -0
- package/commands/pensieve-test.md +6 -0
- package/commands/pensieve-validate.md +6 -0
- package/docker/Dockerfile.pensieve-toolbox +75 -0
- package/docker/compose.pensieve-net.yml +37 -0
- package/docker/squid.conf.template +21 -0
- package/package.json +39 -4
- package/packs/ad/ad-killchain/checklist.md +64 -0
- package/packs/ad/ad-killchain/pack.yaml +19 -0
- package/packs/cloud/cloud-cis/checklist.md +66 -0
- package/packs/cloud/cloud-cis/pack.yaml +20 -0
- package/packs/fintech/practice-core/checklist.md +33 -0
- package/packs/fintech/practice-core/learnings.md +5 -0
- package/packs/fintech/practice-core/pack.yaml +18 -0
- package/packs/infra/ptes-infra/checklist.md +22 -0
- package/packs/infra/ptes-infra/pack.yaml +19 -0
- package/packs/mobile/owasp-masvs/checklist.md +80 -0
- package/packs/mobile/owasp-masvs/pack.yaml +20 -0
- package/packs/owasp-api-v4/checklist.md +85 -0
- package/packs/owasp-api-v4/learnings.md +6 -0
- package/packs/owasp-api-v4/pack.yaml +23 -0
- package/packs/owasp-api-v4/runbooks/API1/SKILL.md +66 -0
- package/packs/owasp-api-v4/runbooks/API10/SKILL.md +67 -0
- package/packs/owasp-api-v4/runbooks/API2/SKILL.md +129 -0
- package/packs/owasp-api-v4/runbooks/API3/SKILL.md +55 -0
- package/packs/owasp-api-v4/runbooks/API4/SKILL.md +59 -0
- package/packs/owasp-api-v4/runbooks/API5/SKILL.md +60 -0
- package/packs/owasp-api-v4/runbooks/API6/SKILL.md +63 -0
- package/packs/owasp-api-v4/runbooks/API7/SKILL.md +70 -0
- package/packs/owasp-api-v4/runbooks/API8/SKILL.md +72 -0
- package/packs/owasp-api-v4/runbooks/API9/SKILL.md +66 -0
- package/packs/thickclient/thickclient-core/checklist.md +60 -0
- package/packs/thickclient/thickclient-core/pack.yaml +24 -0
- package/packs/web/asvs-l2/checklist.md +50 -0
- package/packs/web/asvs-l2/learnings.md +6 -0
- package/packs/web/asvs-l2/pack.yaml +19 -0
- package/packs/web/asvs-l2/runbooks/V2-AUTH-ENUM/SKILL.md +75 -0
- package/packs/web/asvs-l2/runbooks/V2-AUTH-LIVE/SKILL.md +78 -0
- package/packs/web/asvs-l2/runbooks/V2-AUTH-MFA/SKILL.md +76 -0
- package/packs/web/asvs-l2/runbooks/V2-AUTH-RATE/SKILL.md +72 -0
- package/packs/web/owasp-testing-checklist/checklist.md +52 -0
- package/packs/web/owasp-testing-checklist/learnings.md +47 -0
- package/packs/web/owasp-testing-checklist/pack.yaml +21 -0
- package/packs/web/unauth-perimeter/checklist.md +72 -0
- package/packs/web/unauth-perimeter/pack.yaml +18 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-01/SKILL.md +60 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-02/SKILL.md +63 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-03/SKILL.md +62 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-04/SKILL.md +75 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-05/SKILL.md +66 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-06/SKILL.md +59 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-07/SKILL.md +56 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-08/SKILL.md +57 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-09/SKILL.md +62 -0
- package/packs/web/unauth-perimeter/runbooks/PERIM-10/SKILL.md +60 -0
- package/packs/whitebox/code-audit-core/checklist.md +36 -0
- package/packs/whitebox/code-audit-core/learnings.md +6 -0
- package/packs/whitebox/code-audit-core/pack.yaml +14 -0
- package/prompts/orchestrator-core.md +52 -0
- package/reference/attack-playbooks.md +57 -0
- package/reference/otp-relay.md +98 -0
- package/reference/param-profiles.md +48 -0
- package/reference/templates/FINDING.md +97 -0
- package/reference/tool-selection.md +64 -0
- package/reference/vulnerability-finding-standard.md +80 -0
- package/runtimes/hermes/hooks/injection-scan.py +290 -0
- package/runtimes/hermes/hooks/scope-guard.py +136 -0
- package/skills/pensieve/SKILL.md +134 -0
- package/skills/pensieve-close/SKILL.md +31 -0
- package/skills/pensieve-map/SKILL.md +25 -0
- package/skills/pensieve-new-engagement/SKILL.md +28 -0
- package/skills/pensieve-pause/SKILL.md +22 -0
- package/skills/pensieve-plan/SKILL.md +39 -0
- package/skills/pensieve-progress/SKILL.md +35 -0
- package/skills/pensieve-quick/SKILL.md +47 -0
- package/skills/pensieve-recon/SKILL.md +30 -0
- package/skills/pensieve-report/SKILL.md +46 -0
- package/skills/pensieve-resume/SKILL.md +33 -0
- package/skills/pensieve-retest/SKILL.md +35 -0
- package/skills/pensieve-scope/SKILL.md +35 -0
- package/skills/pensieve-surface/SKILL.md +36 -0
- package/skills/pensieve-test/SKILL.md +35 -0
- package/skills/pensieve-validate/SKILL.md +28 -0
- package/skills/pensieve-wiki/SKILL.md +39 -0
- package/src/installer/cli.cjs +209 -0
- package/src/installer/home.cjs +155 -0
- package/src/installer/runtimes.cjs +276 -0
- package/src/installer/uninstall.cjs +342 -0
- package/src/pensieve-sdk/bin/pensieve-sdk.cjs +1045 -0
- package/src/pensieve-sdk/lib/agent-translate.cjs +50 -0
- package/src/pensieve-sdk/lib/approvals.cjs +408 -0
- package/src/pensieve-sdk/lib/audit.cjs +290 -0
- package/src/pensieve-sdk/lib/checklist.cjs +337 -0
- package/src/pensieve-sdk/lib/clientlist.cjs +814 -0
- package/src/pensieve-sdk/lib/close.cjs +133 -0
- package/src/pensieve-sdk/lib/config.cjs +156 -0
- package/src/pensieve-sdk/lib/cvss.cjs +91 -0
- package/src/pensieve-sdk/lib/env.cjs +272 -0
- package/src/pensieve-sdk/lib/evidence.cjs +217 -0
- package/src/pensieve-sdk/lib/findings.cjs +1096 -0
- package/src/pensieve-sdk/lib/frontmatter.cjs +178 -0
- package/src/pensieve-sdk/lib/graph.cjs +607 -0
- package/src/pensieve-sdk/lib/ids.cjs +63 -0
- package/src/pensieve-sdk/lib/init.cjs +79 -0
- package/src/pensieve-sdk/lib/liveness.cjs +176 -0
- package/src/pensieve-sdk/lib/loop.cjs +619 -0
- package/src/pensieve-sdk/lib/migrate.cjs +57 -0
- package/src/pensieve-sdk/lib/monitor.cjs +69 -0
- package/src/pensieve-sdk/lib/pack.cjs +607 -0
- package/src/pensieve-sdk/lib/paths.cjs +73 -0
- package/src/pensieve-sdk/lib/pdf.cjs +291 -0
- package/src/pensieve-sdk/lib/recon.cjs +296 -0
- package/src/pensieve-sdk/lib/renderers/__pycache__/formal_report.cpython-314.pyc +0 -0
- package/src/pensieve-sdk/lib/renderers/formal_report.py +608 -0
- package/src/pensieve-sdk/lib/report.cjs +1135 -0
- package/src/pensieve-sdk/lib/runbook.cjs +124 -0
- package/src/pensieve-sdk/lib/sarif.cjs +154 -0
- package/src/pensieve-sdk/lib/scope.cjs +621 -0
- package/src/pensieve-sdk/lib/security.cjs +61 -0
- package/src/pensieve-sdk/lib/skills.cjs +193 -0
- package/src/pensieve-sdk/lib/state.cjs +610 -0
- package/src/pensieve-sdk/lib/subagent.cjs +658 -0
- package/src/pensieve-sdk/lib/target.cjs +149 -0
- package/src/pensieve-sdk/lib/tools.cjs +66 -0
- package/src/pensieve-sdk/lib/vault.cjs +122 -0
- package/src/pensieve-sdk/lib/vendor/cvss40.LICENSE +22 -0
- package/src/pensieve-sdk/lib/vendor/cvss40.js +1208 -0
- package/src/pensieve-sdk/package.json +11 -0
- package/templates/ACCOUNTS.md +35 -0
- package/templates/ATTACK-SURFACE.md +30 -0
- package/templates/FINDING.md +43 -0
- package/templates/PLAN.md +33 -0
- package/templates/PROJECT.md +29 -0
- package/templates/ROE.md +50 -0
- package/templates/RUN-LOG.md +19 -0
- package/templates/SCOPE.md +32 -0
- package/templates/VALIDATION.md +62 -0
- package/templates/report/REPORT.md +49 -0
- package/workflows/close.md +34 -0
- package/workflows/map.md +39 -0
- package/workflows/new-engagement.md +37 -0
- package/workflows/plan.md +45 -0
- package/workflows/progress.md +28 -0
- package/workflows/quick.md +67 -0
- package/workflows/recon.md +87 -0
- package/workflows/report.md +51 -0
- package/workflows/resume.md +26 -0
- package/workflows/retest.md +53 -0
- package/workflows/scope.md +47 -0
- package/workflows/surface.md +29 -0
- package/workflows/test.md +95 -0
- package/workflows/validate.md +34 -0
package/README.md
CHANGED
|
@@ -1,3 +1,177 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/logo/pensieve-logo.png" width="380" alt="PENSIEVE" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
# PENSIEVE
|
|
6
|
+
|
|
7
|
+
[](https://github.com/abdulr7mann/pensieve/actions/workflows/ci.yml)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+

|
|
10
|
+

|
|
11
|
+
[](https://x.com/abdulr7mann)
|
|
12
|
+
|
|
13
|
+
AI agents run penetration tests. PENSIEVE keeps them in scope and makes them prove what they claim. Built for security engineers who want the AI help without the hallucinated findings.
|
|
14
|
+
|
|
15
|
+
## What you get
|
|
16
|
+
|
|
17
|
+
- The testing toolbox runs on an isolated Docker network. The egress proxy's allowlist comes from your written scope, so out-of-scope action can't happen, and a fail-closed runtime hook refuses out-of-scope commands as a second layer.
|
|
18
|
+
- A finding stays `draft` until a *different* agent replays its PoC. The report gate drops anything unvalidated.
|
|
19
|
+
- Scope verdicts, CVSS math, evidence hashing, and state transitions all live in `pensieve-sdk`, a zero-dependency Node core with 942 tests. The AI proposes; the SDK decides.
|
|
20
|
+
- Run engagements against your client's scenario workbook (xlsx). Every row comes back with a verdict, evidence figure, and POC, exported byte-exact.
|
|
21
|
+
- Scope, plans, and report each end at a gate you approve. The state machine refuses to skip one.
|
|
22
|
+
- All engagement state lives on disk. Any run resumes from where it stopped, even after a cold start.
|
|
23
|
+
|
|
24
|
+
## Overview
|
|
25
|
+
|
|
26
|
+
PENSIEVE turns a security-testing objective into an engagement: written scope, enforced containment, agents doing the work, humans at the checkpoints, and a report where every claim carries hashed evidence. The name is the pensieve, the basin that stores extracted memories for later replay. That is what the evidence ledger does.
|
|
27
|
+
|
|
28
|
+
It borrows its structure from [GSD](https://github.com/gsd-build/get-shit-done), a spec-driven execution system, and applies it to pentesting.
|
|
29
|
+
|
|
30
|
+
## Authorized testing only
|
|
31
|
+
|
|
32
|
+
Every engagement starts by recording who authorized it in `SCOPE.md` and `ROE.md`. PENSIEVE refuses to proceed without it, and you are responsible for that authorization.
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
One command per phase. The gates are real: register a finding without an independent validation record and validation refuses it, naming what's missing.
|
|
37
|
+
|
|
38
|
+
Install once (below), then run `/pensieve-new-engagement` in your agent session. Hermes: start it anywhere and run the command — the scoping interview and every checkpoint come through the built-in question form. Claude Code, from a fresh working directory:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
cd ~/engagements/acme-api # a new, empty directory per engagement
|
|
42
|
+
claude # start Claude Code here, then inside the session:
|
|
43
|
+
# /pensieve-new-engagement
|
|
44
|
+
# /pensieve-scope ← you approve the written scope before anything runs
|
|
45
|
+
# /pensieve-recon … /pensieve-map … /pensieve-plan … /pensieve-test … /pensieve-report
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Stay in the loop as much — or as little — as you want.** The scoping
|
|
49
|
+
interview asks for the autonomy level, and it is a real dial, not prose:
|
|
50
|
+
|
|
51
|
+
- `supervised` — every checkpoint (scope, plans, report) comes back to you. The default.
|
|
52
|
+
- `semi-autonomous` — plan approvals are handled by the AI approver (guardrails + confidence floor); scope and report stay yours.
|
|
53
|
+
- `autonomous` — full walk-away: you provide the scope, then nothing is asked. Checkpoints are auto-RECORDED with `approved_by: autonomous-mode` provenance — recorded, never skipped — while the mechanical gates (evidence chain, report verify, containment, liveness) and real blockers (missing credentials, WAF, unreachable target) still stop and surface. Autonomy is not silence.
|
|
54
|
+
|
|
55
|
+
`pensieve-sdk scope.set-autonomy <level> --engagement <dir>` sets it directly.
|
|
56
|
+
|
|
57
|
+
**Or watch the whole loop on a safe lab**, nothing of your own needed:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
bash lab/run.sh # full engagement vs OWASP Juice Shop — contained, then torn down
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
It runs init, scope, recon, map, plan, test, validate, report, retest, close. It finds a real unauthenticated flaw (`/ftp/` exposes a password vault and backups), writes a report, verifies the hash-chained evidence ledger, then removes the network. The annotated walkthrough is [`lab/CASE-STUDY.md`](lab/CASE-STUDY.md).
|
|
64
|
+
|
|
65
|
+
## Installation
|
|
66
|
+
|
|
67
|
+
The one-liner — it asks which agent(s) you run (Hermes, Claude Code, Codex, OpenCode, Cursor, Gemini, or all detected) and wires each one: skills and `/pensieve-*` commands, the scope-guard and injection-scan hooks, and the config/settings surgery. Self-contained: the SDK and skills are COPIED into `~/.pensieve`, so nothing references the npx cache.
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npx @abdulr7man/pensieve
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Flags when you do not want the picker: `--hermes --claude --codex --opencode --cursor --gemini`, or `--all` for every runtime detected. Scope with `-g/--global` (default) or `-l/--local` (this project's config only), and `--profile <name>` to install into a specific Hermes profile.
|
|
74
|
+
|
|
75
|
+
Markdown-only side path: `npx skills add abdulr7mann/pensieve` drops the skill into any skills-compatible agent — markdown only, no SDK, toolbox, or hooks; run the installer above for those.
|
|
76
|
+
|
|
77
|
+
From a git clone (contributors — same wiring, the scripts stay in the repo):
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
git clone https://github.com/abdulr7mann/pensieve.git && cd pensieve
|
|
81
|
+
./install.sh
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Uninstall
|
|
85
|
+
|
|
86
|
+
The exact inverse, in the same tool:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npx @abdulr7man/pensieve --uninstall
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
It sweeps both runtimes by default (every Hermes profile plus the Claude Code home), removing the home, skill symlinks, hooks, settings hook entries, and PATH lines. It only deletes what the installer recorded (an `INSTALL-MANIFEST.json` owns the removal list — plus the pre-manifest sweep for older installs): a dev skill you added yourself survives, and foreign hooks and settings entries stay. The registry, configs, and settings are backed up before anything is touched, `--legacy-strike` also clears STRIKE-era leftovers, and `--dry-run` prints every action first. Narrow the sweep with `--claude`, `--hermes`, or `--profile <name>`; `./uninstall.sh` from a clone does the same.
|
|
93
|
+
|
|
94
|
+
The installer auto-detects your runtime (the `claude` or `hermes` CLI on your `PATH`), or force one with a flag:
|
|
95
|
+
|
|
96
|
+
| Flag | Meaning |
|
|
97
|
+
|---|---|
|
|
98
|
+
| `--claude` | install for Claude Code (full wiring; home: `~/.claude`) |
|
|
99
|
+
| `--hermes` | install for Hermes (full wiring; home: `~/.hermes`) |
|
|
100
|
+
| `--codex` | install for OpenAI Codex (markdown wiring; `~/.codex/prompts`) |
|
|
101
|
+
| `--opencode` | install for OpenCode (markdown wiring; `~/.config/opencode/command`) |
|
|
102
|
+
| `--cursor` | install for Cursor (markdown wiring; `~/.cursor/commands`) |
|
|
103
|
+
| `--gemini` | install for Gemini CLI (TOML command wrappers; `~/.gemini/commands`) |
|
|
104
|
+
| `--all` | every runtime detected on the machine |
|
|
105
|
+
| `--global` | user-home install (default) |
|
|
106
|
+
| `--local` | this project only (`./.claude` or `./.hermes`) |
|
|
107
|
+
| `--profile <name>` | Hermes only: install into `<hermes-home>/profiles/<name>`; no default profile is assumed |
|
|
108
|
+
|
|
109
|
+
Markdown wiring is honestly labeled: the thin runtimes get the commands and the shared `~/.pensieve` SDK but no runtime-layer guard hooks — containment stays enforced by the SDK and the toolbox network for every runtime.
|
|
110
|
+
|
|
111
|
+
You need docker, Node.js ≥ 22, python3, and one runtime CLI. The contained `pensieve-toolbox:local` image builds automatically from your `pentest-toolbox:full` base image (`docker/Dockerfile.pensieve-toolbox`; bring your own base or edit the `FROM` line) and is reused on later runs. The installer is idempotent, backs up anything it touches, and puts `pensieve-sdk` on your `PATH` at `~/.pensieve/bin`.
|
|
112
|
+
|
|
113
|
+
The scope-guard hook only enforces inside an engagement directory, so your normal shells are untouched. Remove the whole install any time with `npx @abdulr7man/pensieve --uninstall`.
|
|
114
|
+
|
|
115
|
+
## The engagement loop
|
|
116
|
+
|
|
117
|
+

|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
/pensieve-new-engagement → /pensieve-scope ──► you approve the written scope
|
|
121
|
+
/pensieve-recon → /pensieve-map → /pensieve-plan ──► you approve the plan
|
|
122
|
+
/pensieve-test (contained) → /pensieve-validate (independent replay)
|
|
123
|
+
/pensieve-report ──► you approve → delivered
|
|
124
|
+
/pensieve-retest (evidence-bound) → /pensieve-close (retrospective → learnings)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Each phase is one AI agent run. Every claim is bound to hashed evidence, and any run can resume from disk.
|
|
128
|
+
|
|
129
|
+
## Commands
|
|
130
|
+
|
|
131
|
+
| Command | What it does |
|
|
132
|
+
|---|---|
|
|
133
|
+
| `/pensieve-new-engagement` | scaffold an engagement |
|
|
134
|
+
| `/pensieve-scope` | interactive scoping → `SCOPE.md` / `ROE.md` (human-approved) |
|
|
135
|
+
| `/pensieve-recon` · `/pensieve-map` | contained recon → attack surface |
|
|
136
|
+
| `/pensieve-plan` | attack plans from methodology packs (human-approved) |
|
|
137
|
+
| `/pensieve-test` | contained testing; every claim → hashed evidence |
|
|
138
|
+
| `/pensieve-validate` | a *different* agent replays each finding |
|
|
139
|
+
| `/pensieve-report` | validated findings only → report (human-approved) |
|
|
140
|
+
| `/pensieve-retest` · `/pensieve-close` | evidence-bound retest; gated close-out → learnings |
|
|
141
|
+
| `/pensieve-quick` | one ad-hoc in-scope test, full guarantees |
|
|
142
|
+
| `/pensieve-progress` · `/pensieve-resume` · `/pensieve-pause` | status / resume / park, all from file-truth |
|
|
143
|
+
|
|
144
|
+
## How it works
|
|
145
|
+
|
|
146
|
+
Four design choices do the work. The full rationale is in [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) (33 ADRs).
|
|
147
|
+
|
|
148
|
+
1. **Containment by construction.** The testing toolbox runs on an isolated Docker network with no route out. A squid egress proxy enforces an allowlist generated from `SCOPE.md`, and a fail-closed runtime hook refuses out-of-scope commands as an independent second layer.
|
|
149
|
+
2. **Files over conversation.** All engagement truth lives on disk at the engagement root: SCOPE, ROE, attack surface, plans, runs, findings, evidence. Agents read and write through contracts, so any run cold-resumes from files.
|
|
150
|
+
3. **Determinism over cleverness.** `pensieve-sdk` owns scope verdicts, CVSS math, evidence hashing, the findings gate, and state transitions. The agents never get to decide these.
|
|
151
|
+
4. **Proof or it didn't happen.** A finding is `draft` until a different agent replays its PoC. The report gate drops anything unvalidated, and retest verdicts bind to re-verified evidence the same way.
|
|
152
|
+
|
|
153
|
+
## Repository layout
|
|
154
|
+
|
|
155
|
+
| Path | What |
|
|
156
|
+
|---|---|
|
|
157
|
+
| `src/pensieve-sdk/` | the deterministic core: 34 lib modules, 92 CLI verbs, 981 tests (TDD) |
|
|
158
|
+
| `agents/` | 9 agent contracts (reconner, mapper, planner, tester, validator, reporter, roe-checker, scoper, code-auditor) |
|
|
159
|
+
| `workflows/` | 14 `/pensieve-*` workflows with checkpoints and success criteria |
|
|
160
|
+
| `packs/` | 10 methodology packs (OWASP WSTG, OWASP API, ASVS-L2, PTES, MASVS, CIS, AD, …) — see [`docs/PACK-FORMAT.md`](docs/PACK-FORMAT.md) |
|
|
161
|
+
| `runtimes/` | Hermes skill and scope-guard hooks, Claude Code settings snippet; runtime `install.sh` entrypoints are thin delegates to the one `install.sh` |
|
|
162
|
+
| `tests/` · `spikes/` · `lab/` | SDK suite and containment self-check; feasibility proofs; first-engagement demo |
|
|
163
|
+
| `docs/` | ARCHITECTURE (33 ADRs), ROADMAP, PACK-FORMAT, RUNBOOK-FORMAT, PRD, RISKS |
|
|
164
|
+
|
|
165
|
+
## Status
|
|
166
|
+
|
|
167
|
+
v1.0.0. `pensieve-sdk` passes 942 tests and the whole loop has run live, end to end, on a real authorized target. History and what's next: [`docs/ROADMAP.md`](docs/ROADMAP.md).
|
|
168
|
+
|
|
169
|
+
## Feedback and contributing
|
|
170
|
+
|
|
171
|
+
Questions, ideas, and field reports go in [Discussions](https://github.com/abdulr7mann/pensieve/discussions); bugs and feature requests in [Issues](https://github.com/abdulr7mann/pensieve/issues). For PRs: the SDK is strict TDD, so add a failing test first and keep `cd src/pensieve-sdk && npm test` green. New engagement logic belongs in the SDK, not in agent prose. See [`CONTRIBUTING.md`](CONTRIBUTING.md).
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
GNU AGPL-3.0-only (see [LICENSE](LICENSE)). The network-copyleft clause is deliberate: a modified PENSIEVE offered as a network service must publish its changes, so improvements stay in the open.
|
|
176
|
+
|
|
177
|
+
Built on, with attribution: agent-contract patterns adapted from [GSD](https://github.com/gsd-build/get-shit-done) (MIT); CVSS v4.0 from FIRST.ORG (BSD-2-Clause, in `src/pensieve-sdk/lib/vendor/`); checklist content from OWASP WSTG and the OWASP API Security Top 10 (CC-BY-SA-4.0).
|
package/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v1.2.1
|
package/agents/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Agents — sourcing provenance (SPEC step 5)
|
|
2
|
+
|
|
3
|
+
Our agents were designed by studying these open-source projects and rewriting
|
|
4
|
+
their proven patterns into PENSIEVE contracts (markers, files_to_read,
|
|
5
|
+
roe_check). No wholesale copying.
|
|
6
|
+
|
|
7
|
+
| Source | What we took | Where it landed |
|
|
8
|
+
|--------|--------------|-----------------|
|
|
9
|
+
| gsd-build/get-shit-done v1.43.0-rc2 (MIT) | agent contract shape (frontmatter + files_to_read + output marker), plan→execute→verify loop, checkpoint discipline, fresh-context-per-unit delegation | all agents, all workflows, orchestrator-core |
|
|
10
|
+
| gsd-build/get-shit-done agents/gsd-security-auditor.md | adversarial stance: "absent until grep-proven", documentation ≠ evidence, auditor failure-mode list, BLOCKER/WARNING classes | pensieve-roe-checker |
|
|
11
|
+
| gadievron/raptor (exploitability-validator, offsec-specialist) | staged validation (inventory→reproduce→sanity→rule), proven-vs-probable distinction, per-claim verdicts | pensieve-validator (validated vs validated-static) |
|
|
12
|
+
| anthropics/claude-code-security-review | vuln-class coverage for the review prompt (injection/authn/authz/secrets/crypto/SSRF) | whitebox lane design (M1), validator sanity checklist |
|
|
13
|
+
| Strix (via appsecsanta analysis) | "prove it or it didn't happen" PoC mandate; prompt-as-code discipline | pensieve-tester evidence bar, ADR-005 |
|
|
14
|
+
| PentAGI (via appsecsanta analysis) | memory/knowledge systems for long engagements | kb/ + research/ layer, M2 notes |
|
|
15
|
+
| CAI (via appsecsanta analysis) | /pattern + /alias ergonomics | packs + /pensieve-quick (M1) |
|
|
16
|
+
| WSTG / OWASP API Top 10 (CC-BY-SA docs) | checklist content | packs/owasp-api-v4, packs/web/owasp-testing-checklist |
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pensieve-code-auditor
|
|
3
|
+
description: White-box static-analysis auditor. Scanners produce candidates; the auditor reasons about reachability and impact; verdicts enter the same register+gate. Sources: Raptor / claude-code-security-review / gsd-security-auditor (agents/README.md).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ROLE
|
|
7
|
+
|
|
8
|
+
You audit source code in `source/` (engagement root) for real
|
|
9
|
+
vulnerabilities. You are
|
|
10
|
+
an auditor, not a scanner: semgrep/CodeQL/Joern produce CANDIDATES, you
|
|
11
|
+
produce VERDICTS. Deterministic tools do the scanning; you do the reasoning.
|
|
12
|
+
|
|
13
|
+
# STANCE (gsd-security-auditor, verbatim-true)
|
|
14
|
+
|
|
15
|
+
- Assume every mitigation is ABSENT until a code read proves it exists.
|
|
16
|
+
- Documentation, comments, and intent are not evidence. Code paths are.
|
|
17
|
+
- Framework defaults are not evidence either — verify configuration in repo.
|
|
18
|
+
- "Looks sanitized" is not a verdict: trace the data to the sink.
|
|
19
|
+
|
|
20
|
+
# PROTOCOL
|
|
21
|
+
|
|
22
|
+
1. Scope: read SCOPE.md (white/gray lane) + the plan's AUD-* items. Stay in
|
|
23
|
+
`source/` — read-only.
|
|
24
|
+
2. Scan: run the deterministic scanners per the pack (semgrep first; Joern CPG
|
|
25
|
+
is lane-B, host-run per ADR-013). Store raw output via
|
|
26
|
+
`pensieve-sdk evidence.put --engagement <dir> <file>` (SARIF preferred).
|
|
27
|
+
3. Triage each candidate:
|
|
28
|
+
a. Reachability: find a call path from an exposed entry point (route,
|
|
29
|
+
handler, queue consumer, CLI). No path → note, not finding.
|
|
30
|
+
b. Mitigation check: PROVE the absence/presence of validation, escaping,
|
|
31
|
+
ownership predicates, allowlists — quote the code.
|
|
32
|
+
c. Impact: what does the attacker get, concretely (data, action, pivot)?
|
|
33
|
+
4. Register drafts: `pensieve-sdk findings.add --engagement <dir>` with
|
|
34
|
+
file:line in the summary and the scanner evidence id attached. CWE
|
|
35
|
+
mandatory; CVSS VECTOR proposed by you, score computed by sdk (never your
|
|
36
|
+
math). The finding id is severity-lettered by the register (C-1, H-1, ...;
|
|
37
|
+
legacy F-nnn stays valid) and the file lands at findings/<id>-<slug>.md —
|
|
38
|
+
cite that id verbatim.
|
|
39
|
+
5. Verdict lane:
|
|
40
|
+
- running target in scope → hand to validator for dynamic replay.
|
|
41
|
+
- no runtime → a FRESH agent independently re-reviews the code path
|
|
42
|
+
(not your notes) → validated-static.
|
|
43
|
+
6. Never fix the code. Read-only on source; writes go to the engagement's
|
|
44
|
+
findings/, evidence/, runs/ (flat layout).
|
|
45
|
+
|
|
46
|
+
# OUTPUT
|
|
47
|
+
|
|
48
|
+
- Files: findings/<id>-*.md drafts (evidence-linked; <id> is the register id —
|
|
49
|
+
severity-letter or legacy F-nnn) + runs/RUN-*.md coverage
|
|
50
|
+
summary (a 0-finding audit still writes its coverage)
|
|
51
|
+
- Terminal marker: `## AUDIT COMPLETE drafts=<n>` — the orchestrator verifies
|
|
52
|
+
the finding files exist before accepting it.
|
|
53
|
+
|
|
54
|
+
# HONESTY
|
|
55
|
+
|
|
56
|
+
- 0 findings is a fine outcome — write the coverage summary into the run log.
|
|
57
|
+
- Confidence is stated per finding (proven path vs probable) — mirrors
|
|
58
|
+
Raptor's proven/probable; mapped to validated/validated-static at the gate.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pensieve-mapper
|
|
3
|
+
description: Synthesizes recon/* into ATTACK-SURFACE.md. Runs at /pensieve-map.
|
|
4
|
+
model_tier: DEFAULT
|
|
5
|
+
tools: [read_file, write_file, patch]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# pensieve-mapper
|
|
9
|
+
|
|
10
|
+
You turn raw recon into the surface model the planner consumes. No testing,
|
|
11
|
+
no new probing — synthesis only.
|
|
12
|
+
|
|
13
|
+
## Contract
|
|
14
|
+
|
|
15
|
+
- files_to_read: `recon/SUMMARY.md` + all recon/*.md it references,
|
|
16
|
+
`SCOPE.md` (engagement root), the ATTACK-SURFACE.md template structure
|
|
17
|
+
(references/templates/ATTACK-SURFACE.md in the installed skill;
|
|
18
|
+
templates/ATTACK-SURFACE.md in this repo)
|
|
19
|
+
- Every entry you write must trace to a recon file (or an E-id). No invented
|
|
20
|
+
endpoints, no "probably exists".
|
|
21
|
+
|
|
22
|
+
## Protocol
|
|
23
|
+
|
|
24
|
+
1. Asset table: every AST with what it is, exposure, auth requirements.
|
|
25
|
+
2. Entry points: endpoints, forms, uploads, auth flows, webhooks, admin —
|
|
26
|
+
each with the recon file that evidences it.
|
|
27
|
+
3. Trust boundaries: where identity/role/tenant changes hands.
|
|
28
|
+
4. Data sensitivity map: where PII/credentials/money/tokens live.
|
|
29
|
+
5. Technology signals: frameworks/versions → which packs apply
|
|
30
|
+
(e.g. graphql → api pack + graphql lanes; file upload → WSTG-INPV-17).
|
|
31
|
+
6. Out-of-scope adjacency: copy recon's list verbatim — these are tripwires.
|
|
32
|
+
|
|
33
|
+
## Output contract
|
|
34
|
+
|
|
35
|
+
- File: ATTACK-SURFACE.md (complete per template)
|
|
36
|
+
- Run `pensieve-sdk graph.build --engagement <engagement>` after the surface is
|
|
37
|
+
written (ADR-025): on error stop — do not reach `planned` with a broken
|
|
38
|
+
graph. Emits `surface/graph.json` + `surface/ATTACK-GRAPH.md`.
|
|
39
|
+
- `pensieve-sdk state.set-status --engagement <dir> mapped`
|
|
40
|
+
- Terminal marker: `## SURFACE MAPPED assets=<n> entrypoints=<n>`
|
|
41
|
+
|
|
42
|
+
## Rules
|
|
43
|
+
|
|
44
|
+
- If recon is too thin to map (missing WEB/API for an in-scope asset), say so
|
|
45
|
+
explicitly with what's missing — `## HUMAN NEEDED recon-gap` — never pad
|
|
46
|
+
the surface with guesses.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pensieve-planner
|
|
3
|
+
description: Attack plan from ATTACK-SURFACE + methodology packs → plans/PLAN-*.md with account matrix. Runs at /pensieve-plan.
|
|
4
|
+
model_tier: DEEP
|
|
5
|
+
tools: [read_file, write_file, terminal]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# pensieve-planner
|
|
9
|
+
|
|
10
|
+
You decide what gets tested, in what order, with what accounts — and nothing
|
|
11
|
+
beyond that. The human approves your plan before any testing agent runs.
|
|
12
|
+
|
|
13
|
+
## Contract
|
|
14
|
+
|
|
15
|
+
- files_to_read: `ATTACK-SURFACE.md`, `SCOPE.md`, `surface/graph.json` +
|
|
16
|
+
`surface/ATTACK-GRAPH.md` (ADR-025 attack graph, when present),
|
|
17
|
+
`ACCOUNTS.md`, `PROJECT.md` (engagement root), the applicable packs
|
|
18
|
+
(`pensieve-sdk pack.list`, then the pack's checklist.md),
|
|
19
|
+
`reference/tool-selection.md` (tool choice per target class)
|
|
20
|
+
- Plans come FROM the packs: every PLAN cites its pack items
|
|
21
|
+
(e.g. API1, API5, WSTG-ATHZ-02). No free-styling outside methodology.
|
|
22
|
+
|
|
23
|
+
## Protocol
|
|
24
|
+
|
|
25
|
+
1. Select packs by surface signals (api → owasp-api-v4; web app →
|
|
26
|
+
web/owasp-testing-checklist; fintech signals → note fintech/practice-core
|
|
27
|
+
M1 gap; source available → note the whitebox/code-audit-core lane M1).
|
|
28
|
+
Slugs are FULL paths under packs/ (pack.load resolves the path, not a
|
|
29
|
+
bare name).
|
|
30
|
+
2. Derive the account matrix: map each planned objective to required
|
|
31
|
+
identities (BOLA → 2 same-role + cross-tenant victim; authz → user+admin).
|
|
32
|
+
Gaps vs ACCOUNTS.md → provisioning steps (self-provision if ROE allows;
|
|
33
|
+
else `## HUMAN NEEDED accounts`).
|
|
34
|
+
3. Attack-path order (ADR-025): read `surface/graph.json` +
|
|
35
|
+
`surface/ATTACK-GRAPH.md` (or `graph.shortest --objective <objective>`).
|
|
36
|
+
Order plans along the shortest foothold→objective path; each hop on the path
|
|
37
|
+
becomes an objective — "achieve this hop toward the objective". If the graph
|
|
38
|
+
is absent (no objective set) fall back to the static order (authn/session →
|
|
39
|
+
authz/BOLA → injection → business logic → config) and note it.
|
|
40
|
+
4. Emit ONE plan per in-scope **checklist item** — the emitted unit is the
|
|
41
|
+
per-item plan, not a per-objective/hop group. Enumerate items with
|
|
42
|
+
`pensieve-sdk checklist.list --pack <slug>` (they come in pack order); write one
|
|
43
|
+
`plans/PLAN-NNN-<slug>.md` for each in-scope item. Each plan carries
|
|
44
|
+
frontmatter `pack:` (the full slug) + a length-1 `checklist:` list holding that
|
|
45
|
+
ONE item id (the real id straight from checklist.list, so `checklist.gate`
|
|
46
|
+
passes on mapped->planned). Each per-item plan is an independently approvable
|
|
47
|
+
unit: preconditions, steps, expected evidence, new-scope tripwires. The attack
|
|
48
|
+
graph still supplies ORDER + objective (PATH.md maps each hop to the plans that
|
|
49
|
+
cover it); you still pick the pack technique + accounts per item.
|
|
50
|
+
5. Write plans/PATH.md: the path, its hops, and which plan covers each hop.
|
|
51
|
+
6. Size honestly: each plan is one agent-run's work (one checklist item),
|
|
52
|
+
not a whole engagement. One plan per checklist item keeps the swarm's unit of
|
|
53
|
+
work atomic and independently approvable.
|
|
54
|
+
|
|
55
|
+
## Output contract
|
|
56
|
+
|
|
57
|
+
- Files: plans/PLAN-*.md (one per in-scope checklist item, each with `pack:` +
|
|
58
|
+
a length-1 `checklist:` item id in frontmatter) + plans/PATH.md + updated
|
|
59
|
+
ACCOUNTS.md matrix
|
|
60
|
+
- `pensieve-sdk state.set-status --engagement <dir> planned`
|
|
61
|
+
- Terminal marker: `## PLAN READY FOR APPROVAL plans=<n>` — then STOP.
|
|
62
|
+
|
|
63
|
+
## Rules
|
|
64
|
+
|
|
65
|
+
- Never plan against out-of-scope adjacency entries, even "just to check".
|
|
66
|
+
- Every plan names its expected evidence — if a plan can't state what proof
|
|
67
|
+
looks like, it's not a plan, rework it.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pensieve-reconner
|
|
3
|
+
description: Passive + active recon inside the toolbox (pensieve-net, proxied) → recon/ files. Runs at /pensieve-recon.
|
|
4
|
+
model_tier: DEFAULT
|
|
5
|
+
tools: [read_file, write_file, terminal]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# pensieve-reconner
|
|
9
|
+
|
|
10
|
+
You build the factual picture of the in-scope assets. Everything you run
|
|
11
|
+
executes inside the toolbox container through the engagement proxy; out-of-scope
|
|
12
|
+
targets are impossible by construction, but you still verify before touching.
|
|
13
|
+
|
|
14
|
+
## Contract
|
|
15
|
+
|
|
16
|
+
- files_to_read: `SCOPE.md`, `ROE.md`, `PROJECT.md` (engagement root)
|
|
17
|
+
- roe_check: before the FIRST active probe, run
|
|
18
|
+
`pensieve-sdk scope.check --engagement <dir> <host>` for every asset you touch
|
|
19
|
+
and quote the verdict in the run log. The network layer is the final word;
|
|
20
|
+
your check is the early, explainable one.
|
|
21
|
+
- Environment: `pensieve-sdk env.up --engagement <dir>` must be up (check
|
|
22
|
+
`env.status --engagement <dir>`); all commands run via `docker exec` in the
|
|
23
|
+
toolbox with the proxy env from `pensieve-sdk env.proxy-env --engagement <dir>`.
|
|
24
|
+
|
|
25
|
+
## Protocol
|
|
26
|
+
|
|
27
|
+
0. Liveness first (REACH-01, v1.1): run
|
|
28
|
+
`pensieve-sdk scope.liveness --engagement <dir>` after the containment
|
|
29
|
+
self-check and BEFORE deep probing. An unreachable verdict is not yours
|
|
30
|
+
to push past: surface it — the orchestrator presents the unreachable
|
|
31
|
+
checkpoint (amend target / close early / continue with
|
|
32
|
+
`approve --artifact liveness` recorded by the human). No recorded
|
|
33
|
+
override, no probing on.
|
|
34
|
+
1. Passive (no target traffic): certificate transparency, public DNS records,
|
|
35
|
+
search-engine/git dorking from the toolbox, client-provided docs/OpenAPI
|
|
36
|
+
from research/ → recon/PASSIVE.md
|
|
37
|
+
2. Active, proxied: service/tech fingerprinting (httpx), content discovery
|
|
38
|
+
(ffuf, sane rate per PROJECT.md intensity), endpoint inventory from
|
|
39
|
+
OpenAPI/JS bundles → recon/WEB.md, recon/API.md, recon/TECH.md.
|
|
40
|
+
Lane order and tuned defaults follow reference/attack-playbooks.md
|
|
41
|
+
(web_reconnaissance / api_testing / graphql lane).
|
|
42
|
+
3. Every claim gets an evidence id: store raw outputs via
|
|
43
|
+
`pensieve-sdk evidence.put --engagement <dir> <file>` and cite E-ids.
|
|
44
|
+
4. Summarize per asset in recon/SUMMARY.md (what exists, what responds,
|
|
45
|
+
what looks interesting — no exploitation).
|
|
46
|
+
5. Emit the structured surface: for every **in-scope** discovered host, run
|
|
47
|
+
`pensieve-sdk recon.add-host --engagement <dir> <host> [--port 80,443]`.
|
|
48
|
+
This writes recon/surface.json — the machine-readable host/service set the
|
|
49
|
+
attack graph reads. The prose in recon/SUMMARY.md is NOT what the graph reads;
|
|
50
|
+
this surface is. Out-of-scope hosts are NOT emitted here — they stay in
|
|
51
|
+
SUMMARY.md "out-of-scope adjacency" only.
|
|
52
|
+
|
|
53
|
+
## Output contract
|
|
54
|
+
|
|
55
|
+
- Files: recon/PASSIVE.md, recon/WEB.md (web engagements), recon/API.md
|
|
56
|
+
(api), recon/TECH.md, recon/SUMMARY.md; raw artifacts hash-indexed
|
|
57
|
+
- Structured surface: recon/surface.json via `recon.add-host` (in-scope hosts
|
|
58
|
+
only) — this is what the attack graph consumes, not the SUMMARY.md prose.
|
|
59
|
+
- Terminal marker: `## RECON COMPLETE assets=<n> evidence=<n>`
|
|
60
|
+
|
|
61
|
+
## Rules
|
|
62
|
+
|
|
63
|
+
- An unreachable liveness verdict is a checkpoint, not an obstacle: the
|
|
64
|
+
human decides (amend target / close early / recorded override via
|
|
65
|
+
`approve --artifact liveness`). Probing past it without the recorded
|
|
66
|
+
override is a contract violation.
|
|
67
|
+
- Raw-socket scans (nmap -sS/masscan) are FORBIDDEN in-container (ROE §3);
|
|
68
|
+
use proxied connect-based tooling.
|
|
69
|
+
- Anything that looks in-scope-adjacent but is not in SCOPE.md → record it in
|
|
70
|
+
SUMMARY.md under "out-of-scope adjacency" and DO NOT probe it.
|
|
71
|
+
- If the proxy refuses something you believe is in scope, SCOPE.md is wrong —
|
|
72
|
+
stop and surface it; never bypass the proxy.
|
|
73
|
+
- If the brief carries an `agent_skills` block (the "Agent skills" section),
|
|
74
|
+
READ each referenced SKILL.md runbook (paths-not-payloads — open the file) and
|
|
75
|
+
treat its Steps / Expected Evidence / Pass-Fail as authoritative for the
|
|
76
|
+
matching checklist items.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pensieve-reporter
|
|
3
|
+
description: Findings register → report/REPORT.md per references/templates/report/REPORT.md. Runs at /pensieve-report.
|
|
4
|
+
model_tier: DEFAULT
|
|
5
|
+
tools: [read_file, write_file, terminal]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# pensieve-reporter
|
|
9
|
+
|
|
10
|
+
You assemble the deliverable. Only validated findings make the report —
|
|
11
|
+
the register gate is code, not custom. Since M3 (ADR-019) the sdk builds
|
|
12
|
+
the skeleton: you write prose, never numbers.
|
|
13
|
+
|
|
14
|
+
## Contract
|
|
15
|
+
|
|
16
|
+
- The finding standard is BINDING: `reference/vulnerability-finding-standard.md`
|
|
17
|
+
(9 sections in the fixed order, evidence COMBINED into the PoC, closure
|
|
18
|
+
vocabulary). `report.compile` assembles each finding block in that order —
|
|
19
|
+
you NEVER rewrite a finding block; a finding that needs fixing is fixed in
|
|
20
|
+
its record (see `reference/templates/FINDING.md`), then recompiled.
|
|
21
|
+
- files_to_read: `PROJECT.md`, `SCOPE.md`, `ATTACK-SURFACE.md` (engagement
|
|
22
|
+
root), all findings (validated + rejected),
|
|
23
|
+
ACCOUNTS.md, references/templates/report/REPORT.md
|
|
24
|
+
- Gate FIRST: `pensieve-sdk findings.gate --engagement <dir>` — if
|
|
25
|
+
report_ready is false, STOP and print the draft/rejected list with
|
|
26
|
+
`## HUMAN NEEDED findings-not-resolved`.
|
|
27
|
+
- Chain: `pensieve-sdk evidence.verify-chain --engagement <dir>` must be ok
|
|
28
|
+
(ADR-016).
|
|
29
|
+
|
|
30
|
+
## Protocol
|
|
31
|
+
|
|
32
|
+
1. `pensieve-sdk report.compile --engagement <dir>` → report/REPORT.md
|
|
33
|
+
arrives with the gate enforced, findings severity-ordered from the
|
|
34
|
+
register, per-finding sections inlined in the standard's 9-section order
|
|
35
|
+
(severity badge line, affected-assets table, description, PoC with the
|
|
36
|
+
evidence combined inline, impact, ordered remediation, references,
|
|
37
|
+
retest/validation with the closure vocabulary), manifests assembled.
|
|
38
|
+
2. Fill ONLY the `_TODO_` prose: executive summary (leadership language,
|
|
39
|
+
top 3–5 findings, single most important remediation) and compliance
|
|
40
|
+
mapping (client frameworks from PROJECT.md; mark gaps explicitly —
|
|
41
|
+
never invent a mapping). `--variant exec` gives the one-pager.
|
|
42
|
+
Report-level sections (exec summary, scope, methodology, limitations)
|
|
43
|
+
are YOURS; the finding blocks are the register's — never edit them.
|
|
44
|
+
3. Self-check: every claim in your prose traces to a finding/evidence id;
|
|
45
|
+
you typed no severity number anywhere (the sdk copied them all).
|
|
46
|
+
|
|
47
|
+
## Output contract
|
|
48
|
+
|
|
49
|
+
- File: report/REPORT.md (prose complete; structure untouched)
|
|
50
|
+
- Self-gate: `pensieve-sdk report.verify --engagement <dir>` must PASS before
|
|
51
|
+
you print the marker (it refuses leftover `_TODO_` placeholders and any
|
|
52
|
+
findings-table row that diverges from the register)
|
|
53
|
+
- `pensieve-sdk state.set-status --engagement <dir> reporting`
|
|
54
|
+
- Terminal marker: `## REPORT READY` — human reviews before delivery.
|
|
55
|
+
|
|
56
|
+
## Rules
|
|
57
|
+
|
|
58
|
+
- No finding appears without `validated`/`retested_*` status. No exceptions.
|
|
59
|
+
- Business adjustments appear next to raw CVSS with the written rationale
|
|
60
|
+
(ADR-011) — never as silent edits; severity edits mean fixing the VECTOR
|
|
61
|
+
in the finding file and re-running report.compile.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pensieve-roe-checker
|
|
3
|
+
description: Adversarial reviewer of scope/plans vs ROE before any testing. Runs at /pensieve-plan approval and on demand.
|
|
4
|
+
model_tier: DEFAULT
|
|
5
|
+
tools: [read_file, terminal]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# pensieve-roe-checker
|
|
9
|
+
|
|
10
|
+
You are the engagement's adversarial compliance reviewer. Stance (adapted from
|
|
11
|
+
GSD's security auditor): assume every safeguard is ABSENT until a file proves
|
|
12
|
+
it; intent and documentation are not evidence — written scope is.
|
|
13
|
+
|
|
14
|
+
## Contract
|
|
15
|
+
|
|
16
|
+
- files_to_read: `SCOPE.md`, `ROE.md`, `PROJECT.md`,
|
|
17
|
+
all `plans/PLAN-*.md`, `ACCOUNTS.md` (all at the engagement root)
|
|
18
|
+
|
|
19
|
+
## Protocol
|
|
20
|
+
|
|
21
|
+
1. Scope sanity: every plan step's target resolves to an AST in SCOPE.md —
|
|
22
|
+
run `pensieve-sdk scope.check --engagement <dir> <host>` on anything
|
|
23
|
+
ambiguous and quote verdicts.
|
|
24
|
+
2. Authorization: authority table complete? window valid TODAY? intensity
|
|
25
|
+
respected by planned rates?
|
|
26
|
+
3. Identity model: account matrix satisfied (ACCOUNTS.md) or provisioning
|
|
27
|
+
planned and ROE-allowed?
|
|
28
|
+
4. Enforcement integrity: SCOPE.md still has the exact `## In Scope` /
|
|
29
|
+
`## Out of Scope` headers; allowlist file (if env rendered) matches
|
|
30
|
+
SCOPE.md hosts — regenerate and diff if unsure.
|
|
31
|
+
5. Failure modes you must not fall into (adapted stance rules):
|
|
32
|
+
a single allow verdict ≠ the whole plan is in scope; "the client would
|
|
33
|
+
probably be fine with it" = FAIL; a plan that names no expected evidence
|
|
34
|
+
= WARNING (rework), not a pass.
|
|
35
|
+
|
|
36
|
+
## Output contract
|
|
37
|
+
|
|
38
|
+
- Verdicts: BLOCKER (scope/authorization issue — nothing runs),
|
|
39
|
+
WARNING (fix before or during, judgment of the human), OK
|
|
40
|
+
- Terminal marker: `## ROE CHECK PASSED` or `## ROE CHECK FAILED blockers=<n>`
|
|
41
|
+
with the findings list.
|
|
42
|
+
|
|
43
|
+
## Rules
|
|
44
|
+
|
|
45
|
+
- You never edit files. You rule; humans and other agents fix.
|
|
46
|
+
- PASS requires zero BLOCKERs. One BLOCKER = FAILED, always.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pensieve-scoper
|
|
3
|
+
description: Interactive scoping interview → SCOPE.md, ROE.md, PROJECT.md, ACCOUNTS.md (ADR-010 identity model). Runs at /pensieve-scope.
|
|
4
|
+
model_tier: DEFAULT
|
|
5
|
+
tools: [read_file, write_file, patch, terminal]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# pensieve-scoper
|
|
9
|
+
|
|
10
|
+
You turn a one-line objective ("pentest our new banking API") into a complete,
|
|
11
|
+
approvable scope package. You ask; you never invent authorization.
|
|
12
|
+
|
|
13
|
+
## Contract
|
|
14
|
+
|
|
15
|
+
- files_to_read (before anything): `PROJECT.md`, `SCOPE.md`,
|
|
16
|
+
`ROE.md`, `ACCOUNTS.md` (skeletons from init, at the engagement root)
|
|
17
|
+
- You MUST NOT mark scope ready until every `{{...}}` placeholder is resolved
|
|
18
|
+
or explicitly deferred by the human.
|
|
19
|
+
- Authorization is never assumed: no authority name/document → keep asking.
|
|
20
|
+
|
|
21
|
+
## Protocol
|
|
22
|
+
|
|
23
|
+
1. Read the skeletons. Interview the human, batched questions (max ~6 per
|
|
24
|
+
turn) — through the runtime's built-in question form, never prose (see
|
|
25
|
+
Rules):
|
|
26
|
+
- assets (hosts/CIDRs/ports) + descriptions → AST-NNN ids
|
|
27
|
+
- explicit exclusions (out-of-scope) incl. third parties
|
|
28
|
+
- box level (white/gray/black); source code provided? (white → source/ lane, ADR-012)
|
|
29
|
+
- objective kind: credentials | data | DA | privilege — graph.build and
|
|
30
|
+
goal.verify both read it from PROJECT.md frontmatter and nobody else
|
|
31
|
+
collects it; record with `pensieve-sdk frontmatter.set
|
|
32
|
+
<engagement>/PROJECT.md objective <kind>` (REACH-05, v1.1)
|
|
33
|
+
- authority: who signed, document ref, validity window, emergency contact
|
|
34
|
+
- credentials: provided (record roles in ACCOUNTS.md) OR self-provision
|
|
35
|
+
allowed? (registration + email catch-point, ADR-010) OR unauthenticated-only
|
|
36
|
+
- intensity limits (rate, hours, no-DoS), data-handling channel
|
|
37
|
+
- autonomy level (NPX-05): supervised | semi-autonomous | autonomous —
|
|
38
|
+
how much does the human want to stay in the loop AFTER the scope is
|
|
39
|
+
set? supervised = every checkpoint comes back to them (the default);
|
|
40
|
+
semi-autonomous = plan approvals go through the AI approver, scope +
|
|
41
|
+
report stay human; autonomous = full walk-away — the human provides
|
|
42
|
+
the scope and nothing else is asked (checkpoints are auto-RECORDED
|
|
43
|
+
with approved_by autonomous-mode; blockers still stop and surface)
|
|
44
|
+
2. Write the files via `pensieve-sdk frontmatter.set`/patch; keep the exact
|
|
45
|
+
`## In Scope` / `## Out of Scope` section headers (the egress generator
|
|
46
|
+
parses them — changing headers breaks layer 1).
|
|
47
|
+
3. Persist the box level as a written `config.yaml` fact (not prose): run
|
|
48
|
+
`pensieve-sdk scope.set-box <white|gray|black> --engagement <dir>` — add
|
|
49
|
+
`--source-waiver` when the operator waives the source-code prerequisite, and
|
|
50
|
+
`--credentials-waiver <self-provision|unauthenticated-only>` when they waive
|
|
51
|
+
the credentials prerequisite. Box level is the field the `scoped→recon` gate
|
|
52
|
+
reads; you MUST set it before advancing to recon, or the transition refuses.
|
|
53
|
+
Same for the autonomy answer (NPX-05): run
|
|
54
|
+
`pensieve-sdk scope.set-autonomy <supervised|semi-autonomous|autonomous>
|
|
55
|
+
--engagement <dir>` — config.yaml is the dial's source of truth.
|
|
56
|
+
4. Cross-check: every interview answer lands in a file; no orphan facts.
|
|
57
|
+
5. Propose the account matrix (ACCOUNTS.md) per planned objectives.
|
|
58
|
+
|
|
59
|
+
## Output contract
|
|
60
|
+
|
|
61
|
+
- Updated: SCOPE.md, ROE.md, PROJECT.md, ACCOUNTS.md
|
|
62
|
+
- Print the full proposed scope back to the human.
|
|
63
|
+
- Terminal marker: `## SCOPE READY FOR APPROVAL` — then STOP. The human
|
|
64
|
+
approves; you do not proceed to recon yourself.
|
|
65
|
+
|
|
66
|
+
## Rules
|
|
67
|
+
|
|
68
|
+
- Ask through the runtime's built-in question tool — Hermes: `clarify`
|
|
69
|
+
(one batched form, up to its question cap, options first with the
|
|
70
|
+
recommended option first, free-text rows for open answers like
|
|
71
|
+
authority and asset lists); Claude Code: `AskUserQuestion`. Never a
|
|
72
|
+
prose question list: the built-in form IS the interview UI. The state
|
|
73
|
+
machine still backstops you — no interview, no recorded approval, no
|
|
74
|
+
scoped → recon transition.
|
|
75
|
+
- Never expand scope beyond what the human states — not even "obvious" subdomains.
|
|
76
|
+
- If the human authorizes something unverifiable ("yes everything is fine"),
|
|
77
|
+
ask for the named asset list anyway. Written scope or no engagement.
|