@xaccefy/pi-casefile 0.9.3 → 0.10.0
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/README.md +31 -67
- package/package.json +14 -17
- package/src/confirmation.ts +729 -0
- package/src/evidence.ts +4 -4
- package/src/index.ts +189 -293
- package/src/ledger-internal.ts +321 -0
- package/src/ledger.ts +75 -1142
- package/src/oob-oracle.ts +279 -0
- package/src/poc-runner.ts +10 -0
- package/src/scratchpad.ts +5 -6
- package/src/workflow.ts +46 -327
- package/skills/casefile/SKILL.md +0 -44
- package/src/ledger-worker-entry.ts +0 -35
- package/src/ledger-worker.ts +0 -77
- package/src/pipeline-submit.ts +0 -797
package/README.md
CHANGED
|
@@ -1,88 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Local security case book for Pi Agent. Keeps your guesses → proven findings behind a PoC gate, saved in SQLite, run in a sandbox.
|
|
1
|
+
<div align="center">
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
# pi-casefile
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
pi install npm:@xaccefy/pi-casefile
|
|
9
|
-
```
|
|
5
|
+
**Security case ledger for the [Pi agent](https://github.com/earendil-works/pi-coding-agent)** — evidence tracking with machine-verified PoC gates.
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
[](https://www.npmjs.com/package/@xaccefy/pi-casefile)
|
|
8
|
+
[](LICENSE)
|
|
12
9
|
|
|
13
|
-
|
|
10
|
+
</div>
|
|
14
11
|
|
|
15
|
-
|
|
12
|
+
## What it is
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|---------|--------|
|
|
19
|
-
| `/xp` | Toggle SWARM/OFF |
|
|
20
|
-
| `/xp on` | Default enabled mode: SWARM |
|
|
21
|
-
| `/xp swarm` | Bounded multi-agent workflow: auditor/tracer/skeptic/chain only |
|
|
22
|
-
| `/xp lite` | Focused workflow: single-agent, no subagent dispatch |
|
|
23
|
-
| `/xp off` | Quiet mode explicitly |
|
|
24
|
-
| `PI_XP_MODE=on` | Force SWARM for this process (same as `swarm`) |
|
|
25
|
-
| `PI_XP_MODE=swarm` | Force SWARM for this process (overrides file) |
|
|
26
|
-
| `PI_XP_MODE=lite` | Force LITE (single-agent, no subagent dispatch) |
|
|
27
|
-
| `PI_XP_MODE=off` | Force OFF |
|
|
14
|
+
A structured ledger for offensive-security work — bug bounties, CTFs, audits — built around one idea: **an agent's claim is not evidence until the machine replays it**.
|
|
28
15
|
|
|
29
|
-
|
|
16
|
+
Cases move `hypothesis → investigating → confirmed → reported`. Promotion between phases is gated:
|
|
30
17
|
|
|
31
|
-
|
|
18
|
+
- **Zero exit is necessary but never proof** — direct-response findings require nonce-bound body evidence plus a DNS-pinned, conclusive `target_only` replay against an operator-approved control
|
|
19
|
+
- **Differential confirmation** — `inter_host` (attack vs control host) or `intra_target` (attack vs baseline request) so "it worked" means *the discriminator fired*, not "the agent said so"
|
|
20
|
+
- **Blind/OOB classes** confirm through an operator-run oracle with per-run tokens and source-separation attestation
|
|
21
|
+
- Only the main agent makes the semantic decision and commits phase transitions
|
|
32
22
|
|
|
33
|
-
|
|
23
|
+
Designed for **human + AI workflows**: every confirmed finding carries a reproducible evidence trail a human can audit.
|
|
34
24
|
|
|
35
|
-
|
|
36
|
-
|----------|---------|
|
|
37
|
-
| `PI_CASEFILE_PATH` | Absolute path to the SQLite ledger file |
|
|
38
|
-
| `CASEFILE_WORKSPACE_ROOT` / `PI_WORKSPACE_ROOT` | Override workspace root used to place `.pi/casefile.db` |
|
|
39
|
-
| `PI_POC_ALLOW_NETWORK=1` | Operator authorization for a networked PoC sandbox |
|
|
40
|
-
| `PI_POC_ALLOW_PRIVATE_REPLAY=1` | Operator authorization for harness replay to private/internal targets |
|
|
41
|
-
| `PI_POC_CONTROL_TARGETS` | Comma/newline-separated operator-approved control hosts/origins; agent-invented controls are rejected |
|
|
25
|
+
## Tools
|
|
42
26
|
|
|
43
|
-
|
|
27
|
+
| Tool | Purpose |
|
|
28
|
+
|---|---|
|
|
29
|
+
| `CaseAdd` / `CaseList` / `CaseUpdate` / `CaseContext` | case lifecycle and context retrieval |
|
|
30
|
+
| `EvidenceAdd` | attach raw evidence to a case |
|
|
31
|
+
| `PromoteFinding` → harness replay → `ConfirmFinding` | gated finding pipeline |
|
|
32
|
+
| Scratchpad | phase-scoped working notes, resume-safe |
|
|
44
33
|
|
|
45
|
-
##
|
|
34
|
+
## Install
|
|
46
35
|
|
|
36
|
+
```bash
|
|
37
|
+
pi install npm:@xaccefy/pi-casefile
|
|
47
38
|
```
|
|
48
|
-
hypothesis → investigating → confirmed → reported
|
|
49
|
-
↓ ↓
|
|
50
|
-
blocked killed (terminal)
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
- **investigating** needs `evidence` + `confidence`
|
|
54
|
-
- **confirmed** only through the two-phase gate — `PromoteFinding` runs the PoC 2× target + 1× control, requires complete zero-exit runs and nonce-bound discriminating response-body evidence, then the harness performs a DNS-pinned identical replay and requires two conclusive responses with `target_only`. Reflection-capable requests may add a post-PoC harness-generated canary that must appear only on target. Status-only/trivial matchers and incomplete response capture are rejected. Exit zero is necessary but never proof. The main agent performs semantic review and calls `ConfirmFinding`, which captures a second fresh harness replay and binds it to the verdict; worker processes are rejected. Blind/OOB claims fail closed without a source-separated oracle.
|
|
55
|
-
- **Every promotion requires a distinct `control_target`** pre-approved by the operator in `PI_POC_CONTROL_TARGETS`; an agent cannot invent its own easy control. `control_path` defaults to `poc_path` and exists only as an override — if supplied, it must contain the same bytes as the PoC (sha256 enforced). The control run is stored as `controlVerified`. Crashes, transport-inconclusive controls, status-only evidence, and missing evidence all block promotion.
|
|
56
|
-
- **New cases require `disproveIf`** — falsification conditions (what would disprove this hypothesis). A hypothesis that can't say what kills it isn't one yet.
|
|
57
|
-
- **A kill must be justified**: either an EvidenceAdd `refutation` item, or a canonical kill-reason token (intended_behavior, duplicate, framework_protection, out_of_scope, insufficient_impact, no_attack_path, ...) in assumptions/nextStep. Bare `status: "killed"` is rejected.
|
|
58
|
-
- **reported** needs `CaseContext` first (records the report path; the main agent produces the final file)
|
|
59
|
-
- **killed** / **reported** are final (no more edits)
|
|
60
39
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
`EvidenceAdd` records role-typed, artifact-backed evidence (observation / reproduction / impact / refutation / cleanup). Artifact reads are restricted to regular, non-symlink files inside the workspace. Bytes are copied durably and stored as basename + SHA-256; the full source path is never persisted. The PoC gate auto-records the `reproduction` item at promotion.
|
|
64
|
-
|
|
65
|
-
## Tools
|
|
66
|
-
|
|
67
|
-
| Tool | Use |
|
|
68
|
-
|------|-----|
|
|
69
|
-
| `CaseAdd` | Open a case (`title` + `disproveIf` required; start as `hypothesis` or `investigating`) |
|
|
70
|
-
| `CaseUpdate` | Evidence, impact, severity, status (not direct confirm) |
|
|
71
|
-
| `EvidenceAdd` | Role-typed, hashed evidence item on a case (refutation justifies kills; cleanup tracks cleanup) |
|
|
72
|
-
| `PromoteFinding` | Phase 1: main-agent-only PoC 2× target + 1× operator-approved control, then DNS-pinned harness-owned replay requiring conclusive `target_only`; optional reflection canary upgrades the recorded proof strength when observed only on target. `local:true` and private replay are operator-gated; blind/OOB proof fails closed without source separation |
|
|
73
|
-
| `ConfirmFinding` | Phase 2: main-agent-only semantic decision plus a fresh harness-owned target/control replay (CONFIRMED promotes; NOT_CONFIRMED keeps investigating; worker/subagent gate calls are rejected) |
|
|
74
|
-
| `CaseGet` / `CaseList` / `CaseSearch` | Read / filter / search |
|
|
75
|
-
| `CaseLink` / `CaseUnlink` | Bidirectional exploit chains |
|
|
76
|
-
| `ChainSuggest` | Scan cases for exploitable chain combinations (credential+endpoint→ATO, redirect+OAuth→token theft, XSS+state-change→CSRF, IDOR+user-data, SSTI→RCE, race+payment, info-disclosure+SSRF), ranked by confidence |
|
|
77
|
-
| `CoverageAdd` | Record a tested (asset × attack-class) cell — `scope: wide` (deployment-wide verdict, applies to every later asset) or `local`; both found and clean results count. Optionally link the cell to an artifact-backed evidence item (`evidence_item_id`); unbacked cells render as ⚠ unbacked in the report |
|
|
78
|
-
| `CoverageReport` | Render the machine-checkable coverage matrix (which classes are tested where; plateau claims must match it) |
|
|
79
|
-
| `CaseContext` | Context bundle for a confirmed/reported case (full record, logs, links, artifacts) + report path |
|
|
80
|
-
|
|
81
|
-
Commands: `/casefile` (dashboard), `/xp` (XP mode).
|
|
40
|
+
Peer-depends on a Pi-compatible agent host (`@earendil-works/pi-coding-agent`, `pi-ai`, `pi-tui`, `typebox`). Runtime deps: `@xaccefy/pi-shared`, `undici`.
|
|
82
41
|
|
|
83
42
|
## Development
|
|
84
43
|
|
|
85
44
|
```bash
|
|
86
|
-
bun
|
|
45
|
+
bun install
|
|
46
|
+
bun test --isolate # 222 tests
|
|
87
47
|
bun run typecheck
|
|
88
48
|
```
|
|
49
|
+
|
|
50
|
+
## License
|
|
51
|
+
|
|
52
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xaccefy/pi-casefile",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Offensive security case tracker for Pi Agent
|
|
3
|
+
"version": "0.10.0",
|
|
4
|
+
"description": "Offensive security case tracker for Pi Agent \u2014 bug bounties, CTFs, security audits",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
7
7
|
"pi-extension",
|
|
@@ -15,16 +15,17 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/xaccefy/pi-
|
|
19
|
-
"directory": "packages/pi-casefile"
|
|
18
|
+
"url": "git+https://github.com/xaccefy/pi-casefile.git"
|
|
20
19
|
},
|
|
21
|
-
"homepage": "https://github.com/xaccefy/pi-
|
|
20
|
+
"homepage": "https://github.com/xaccefy/pi-casefile#readme",
|
|
22
21
|
"bugs": {
|
|
23
|
-
"url": "https://github.com/xaccefy/pi-
|
|
22
|
+
"url": "https://github.com/xaccefy/pi-casefile/issues"
|
|
24
23
|
},
|
|
25
24
|
"scripts": {
|
|
26
|
-
"test": "bun test
|
|
27
|
-
"typecheck": "tsc --noEmit
|
|
25
|
+
"test": "bun test --isolate",
|
|
26
|
+
"typecheck": "tsc --noEmit",
|
|
27
|
+
"lint": "biome check .",
|
|
28
|
+
"lint:fix": "biome check . --write"
|
|
28
29
|
},
|
|
29
30
|
"publishConfig": {
|
|
30
31
|
"access": "public",
|
|
@@ -34,30 +35,26 @@
|
|
|
34
35
|
"src/index.ts",
|
|
35
36
|
"src/evidence.ts",
|
|
36
37
|
"src/harness-verify.ts",
|
|
38
|
+
"src/oob-oracle.ts",
|
|
39
|
+
"src/confirmation.ts",
|
|
40
|
+
"src/ledger-internal.ts",
|
|
37
41
|
"src/safe-state.ts",
|
|
38
|
-
"src/ledger-worker.ts",
|
|
39
|
-
"src/ledger-worker-entry.ts",
|
|
40
42
|
"src/ledger.ts",
|
|
41
|
-
"src/workflow.ts",
|
|
42
43
|
"src/poc-runner.ts",
|
|
43
|
-
"src/pipeline-submit.ts",
|
|
44
44
|
"src/scratchpad.ts",
|
|
45
|
+
"src/workflow.ts",
|
|
45
46
|
"src/sqlite-compat/index.ts",
|
|
46
|
-
"skills",
|
|
47
47
|
"README.md",
|
|
48
48
|
"LICENSE"
|
|
49
49
|
],
|
|
50
50
|
"main": "src/index.ts",
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@xaccefy/pi-shared": "0.9.
|
|
52
|
+
"@xaccefy/pi-shared": "0.9.4",
|
|
53
53
|
"undici": "^8.9.0"
|
|
54
54
|
},
|
|
55
55
|
"pi": {
|
|
56
56
|
"extensions": [
|
|
57
57
|
"./src/index.ts"
|
|
58
|
-
],
|
|
59
|
-
"skills": [
|
|
60
|
-
"./skills"
|
|
61
58
|
]
|
|
62
59
|
},
|
|
63
60
|
"devDependencies": {
|