@xaccefy/pi-casefile 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 x4cc3
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # Casefile — Offensive Security Case Tracker
2
+
3
+ Track durable security cases during bug bounties, CTFs, and security audits.
4
+
5
+ ## Surface Support
6
+
7
+ - **pi extension** — registers tools and `/casefile` dashboard.
8
+
9
+ ## Tools (pi)
10
+
11
+ | pi | Description |
12
+ |---|---|
13
+ | **CaseAdd** | Open a new hypothesis or investigation |
14
+ | **CaseUpdate** | Update fields (status, evidence, impact, etc.) |
15
+ | **PromoteFinding** | **PoC Runner**: Verify PoC in Docker to confirm |
16
+ | **CaseGet** | Get full details of a single case |
17
+ | **CaseList** / **Search** | Browse or search across fields |
18
+ | **CaseLink** / **Unlink** | Connect primitives into exploit chains |
19
+ | **CaseReport** | Generate markdown report (confirmed/reported only) |
20
+
21
+ ## PoC Runner (Docker / Local)
22
+
23
+ To promote a case from `investigating` to `confirmed`, you must use `PromoteFinding` with an on-disk PoC path.
24
+
25
+ - **Sandbox (Docker)**: Default. Runs in a `--network none` container with read-only mounts. Uses `python:3.12-slim` (.py) or `alpine` (.sh).
26
+ - **Local**: Use `local: true`. Runs directly on the host (e.g. for network-dependent bugs).
27
+ - **Verification**: Only promotes to `confirmed` if the PoC returns **exit code 0**.
28
+ - **Timeout**: 30 second limit.
29
+
30
+ ## Offensive Security Workflow
31
+
32
+ 1. **Hypothesize**: `CaseAdd(status: hypothesis)`
33
+ 2. **Investigate**: `CaseUpdate(status: investigating, evidence, confidence)`
34
+ 3. **Confirm**: `PromoteFinding(id, poc_path, local?)` -> Exit 0 verifies and confirms.
35
+ 4. **Chain**: `CaseLink` primitives to escalations.
36
+ 5. **Report**: `CaseReport` -> `CaseUpdate(status: reported)`.
37
+ 6. **Kill**: `CaseUpdate(status: killed)` for dead ends.
38
+
39
+ ### State Gates
40
+ - `hypothesis` → `investigating` requires `evidence` + `confidence`.
41
+ - `investigating` → `confirmed` requires a verified PoC run (exit 0) and `poc`, `evidence`, `impact`, `severity`.
42
+ - `confirmed` → `reported` requires `CaseReport` to have been generated.
43
+ - `killed` and `reported` are **terminal**.
44
+
45
+ ## Storage & Environment
46
+
47
+ Stored as **SQLite** at `.casefile/casefile.db` (project) or `~/.casefile/casefile.db` (global).
48
+
49
+ - `CASEFILE_PATH`: Force exact ledger path.
50
+ - `CASEFILE_SCOPE=project|global`: Set storage scope.
51
+
52
+ ## Project Structure
53
+
54
+ ```
55
+ src/
56
+ index.ts — pi extension (tools, commands, events)
57
+ ledger.ts — SQLite storage engine
58
+ poc-runner.ts — Docker/local PoC verification
59
+ sqlite-compat.ts — node:sqlite / bun:sqlite compat layer
60
+ skills/
61
+ casefile/SKILL.md — agent skill prompt
62
+ test/
63
+ ledger.test.ts — unit tests
64
+ ```
65
+
66
+ ---
67
+ Install: `pi install npm:pi-casefile`
68
+
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@xaccefy/pi-casefile",
3
+ "version": "0.1.0",
4
+ "description": "Offensive security case tracker for Pi Agent — bug bounties, CTFs, security audits",
5
+ "keywords": [
6
+ "pi-package",
7
+ "pi-extension",
8
+ "xpi",
9
+ "security",
10
+ "bug-bounty",
11
+ "ctf",
12
+ "casefile"
13
+ ],
14
+ "type": "module",
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/x4cc3/pi-xpi.git",
19
+ "directory": "packages/pi-casefile"
20
+ },
21
+ "homepage": "https://github.com/x4cc3/pi-xpi/tree/main/packages/pi-casefile#readme",
22
+ "bugs": {
23
+ "url": "https://github.com/x4cc3/pi-xpi/issues"
24
+ },
25
+ "scripts": {
26
+ "test": "bun test test",
27
+ "typecheck": "tsc --noEmit --project tsconfig.json"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public",
31
+ "registry": "https://registry.npmjs.org/"
32
+ },
33
+ "files": [
34
+ "src/index.ts",
35
+ "src/ledger.ts",
36
+ "src/poc-runner.ts",
37
+ "src/sqlite-compat.ts",
38
+ "skills",
39
+ "README.md",
40
+ "LICENSE"
41
+ ],
42
+ "main": "src/index.ts",
43
+ "pi": {
44
+ "extensions": [
45
+ "./src/index.ts"
46
+ ],
47
+ "skills": [
48
+ "./skills"
49
+ ]
50
+ },
51
+ "dependencies": {
52
+ "@sinclair/typebox": "^0.32.34"
53
+ },
54
+ "devDependencies": {
55
+ "@types/bun": "^1.3.14",
56
+ "typescript": "^6.0.3"
57
+ },
58
+ "peerDependencies": {
59
+ "@earendil-works/pi-ai": "*",
60
+ "@earendil-works/pi-coding-agent": "*",
61
+ "@earendil-works/pi-tui": "*"
62
+ }
63
+ }
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: casefile
3
+ description: Use when tracking security investigations, bug bounty findings, CTF leads, audit evidence, exploit chains, dead ends, or reports in the Casefile ledger.
4
+ license: MIT
5
+ ---
6
+
7
+ # Casefile Tracker
8
+
9
+ Use Casefile to maintain durable security investigation state across agent turns.
10
+
11
+ ## Workflow
12
+
13
+ 1. Check existing cases before opening a new one with CaseList or CaseSearch.
14
+ 2. Open new leads with CaseAdd as `hypothesis` or `investigating`.
15
+ 3. Promote cases with CaseUpdate only after materially new evidence, proof, impact, blockers, remediation, or status changes.
16
+ 4. Mark `confirmed` only when evidence and a PoC or repro are recorded.
17
+ 5. Use CaseLink and CaseUnlink for exploit chains. Do not edit linked case IDs directly.
18
+ 6. Use CaseReport only for confirmed or already reported cases.
19
+ 7. Use `killed` for disproven, duplicate, or dead-end leads, and include evidence, blockers, next step, or assumptions explaining why.
20
+
21
+ ## Tool Map
22
+
23
+ - `CaseAdd`: create a new case.
24
+ - `CaseUpdate`: update an existing case.
25
+ - `PromoteFinding`: run an on-disk PoC script (Docker sandbox or local) and promote a case to confirmed on exit 0.
26
+ - `CaseGet`: read one case by ID.
27
+ - `CaseList`: list cases with filters and pagination.
28
+ - `CaseSearch`: search all fields or a scoped field.
29
+ - `CaseLink`: bidirectionally link two cases.
30
+ - `CaseUnlink`: remove a bidirectional case link.
31
+ - `CaseReport`: write a markdown report for a confirmed or reported case.