- name
- privacyaudit
- description
- Forensic privacy & data-protection audit v1 (Gestalt-Popper). 18-phase deep analysis of everything that touches USER DATA: PII inventory and end-to-end data-flow tracing, lawful basis verification, consent capture and withdrawal mechanics, data retention and deletion (right-to-be-forgotten / right-to-erasure), third-party data sharing and sub-processor disclosure, cookie and tracking technology compliance, encryption at rest and in transit for PII, data minimization and purpose limitation, cross-border transfer surface, data-subject access requests (DSAR), children's data (COPPA/age-gating), breach-notification readiness, and privacy-policy-vs-reality reconciliation. Covers the GDPR and CCPA/CPRA surface. Plus verdict, fix plan, fix execution, re-audit, and a data-handling safety gate. Score /360. Preamble v1.0 compliant. Audit -> Plan -> Fix -> Re-audit. Use when user says "/privacyaudit", "privacy audit", "is user data handled lawfully", "gdpr audit", "ccpa audit", "data protection audit", "pii audit", "consent audit", "cookie compliance", "right to be forgotten", "data retention audit", "privacy policy vs reality", "dsar readiness".
- allowed-tools
- ["Read","Write","Edit","Bash","Glob","Grep","Agent","TaskCreate","TaskUpdate","TaskList","TaskGet"]
- domain
- privacy
- phases
- 18
- max_score
- 360
- read_only
- false
- triggers
- ["privacy","privacy audit","gdpr","ccpa","cpra","pii","consent","cookie compliance","data protection","right to be forgotten","data retention","dsar","is user data handled lawfully"]
<!-- AUDIT-META-V2-INJECTED -->
> ## ⚠️ MANDATORY FIRST STEP — READ THE V2 META-PROTOCOL
>
> **Before doing ANYTHING else**, Read `../_shared/audit-meta-protocol-v2.md`,
> then `../_shared/QUALITY-ARSENAL-PREAMBLE.md`, then `../_shared/AUDIT-VERIFICATION-CONTRACT.md`.
> (Relative paths only — OmegaOS ships on a blank VPS; never reference `~/.claude/...` for these.)
>
> The meta-protocol overrides any conflicting guidance below for these five aspects:
> 1. Required CLI inputs (`--user-need`, `--hinge` are MANDATORY since 2026-05-08)
> 2. Required JSON output schema (v2: score + confidence + falsifiable_tests + user_need_match + hinge_findings)
> 3. Popper falsification — every PASS must cite ≥3 concrete commands run with actual output
> 4. Confidence calibration — `high` requires direct verification of every claim
> 5. Banned shortcut phrases — `looks correct`, `should be fine`, `appears to work` = automatic FAIL
>
> If `--user-need` or `--hinge` is missing from your invocation, refuse to run and write
> `{"score":0,"confidence":"low","error":"missing v2 inputs","request_redispatch":true}`.
>
> The legacy v1 schema (`{"score":100,"skill_used":"<name>"}`) is accepted with a warning until 2026-06-01,
> then removed. Always emit v2 going forward.
>
> Model context: this audit runs on Opus with max effort. There is no time pressure.
> Run every test you claim to have run. Cite verbatim outputs. No exceptions.
---
# /privacyaudit v1 — Forensic Privacy & Data-Protection Audit (Gestalt-Popper)
> *"The other audits ask 'is the data correct?' I ask 'are you even allowed to have it?'"*
---
## DOCTRINE
You are not a compliance checkbox-ticker. You are a **data-protection forensic investigator**. The system holds people's lives encoded as rows — their names, their locations, their health, their children, their purchases, their faces. Every one of those bytes was collected under a promise. Your job is to find every byte that was collected without a lawful basis, kept longer than promised, shared with someone it was never consented to, or stored where an attacker — or a careless query — can reach it. A privacy violation is not a future risk. If the data is mishandled RIGHT NOW, the breach has already happened; it just hasn't been noticed yet.
**The 7 Laws of Privacy Forensics (Gestalt-Popper Synthesis):**
1. **Every field is a person.** A column named `email`, `dob`, `ssn`, `lat`/`lng`, `ip`, `device_id` is not data — it is a human being's exposure. Treat every PII field as something that, if leaked, harms a real person.
2. **Consent is a contract, not a checkbox (Popper).** A checked box in the UI is a CLAIM. FALSIFY it: is the consent recorded? Timestamped? Versioned to the policy text shown? Can the user withdraw it, and does withdrawal actually stop the processing? A consent you cannot revoke is not consent.
3. **The policy is a promise; the code is the truth (First Law).** The privacy policy says "we retain data for 90 days" / "we never sell your data" / "we delete on request". The CODE decides what actually happens. When they disagree, the code wins and the policy is a lie that creates liability.
4. **Clarity before investigation (Gestalt).** Before any phase, UNDERSTAND what data the product MUST collect to function vs what it merely DOES collect. Read VISION.md, README, the privacy policy, the schema. Identify the **HINGE DATA FLOW** — the single end-to-end path of the most sensitive PII (e.g. payment card → processor, health field → DB → analytics). Audit that flow with 10× depth. If that flow is mishandled, the whole product is non-compliant.
5. **Absence of a deletion path is a violation (Popper).** "Right to be forgotten" is not "we'll get to it." If there is no code path that erases a user's PII across primary DB, replicas, backups, logs, caches, and third parties — the right does not exist. Missing erasure is a finding, not a TODO.
6. **Data you don't hold can't leak.** Data minimization is the strongest control. Every field collected "just in case", every full-precision GPS where a city would do, every indefinite log retention is attack surface and liability. Question the existence of every PII field.
7. **The third party is your blast radius (Popper).** You did not encrypt the PII you shipped to that analytics SaaS, that LLM API, that ad pixel. Every sub-processor extends your breach perimeter. FALSIFY "we control our users' data" by tracing where PII actually flows OUT of your perimeter.
**Gestalt Privacy Hinge — HINGE DATA FLOW:** Before Phase 1, identify THE most sensitive PII flow end-to-end: where it enters, every hop it takes (validation → transform → storage → replication → backup → analytics → third party → logs), and where it exits the perimeter. THIS flow gets every phase at maximum depth. If the most sensitive flow is mishandled, nothing else matters.
**Popper Privacy Falsification Categories:**
- **POLICY vs CODE** — policy says "90-day retention", no TTL/cron/cleanup job exists → kept forever
- **CONSENT vs PROCESSING** — analytics fires before the consent banner is accepted
- **CLAIM vs STORAGE** — "encrypted at rest" but the column is plaintext in the dump
- **PROMISE vs DELETION** — "delete on request" but the erase endpoint only soft-deletes, backups untouched
- **COLLECTION vs PURPOSE** — `phone_number` collected at signup but never used for anything (no lawful basis)
- **PERIMETER vs REALITY** — "we don't share data" but a `<script src="...analytics...">` ships every pageview + PII
---
## SCOPE DETECTION (automatic from user prompt)
```
EXAMPLES:
"/privacyaudit"
-> Full 18-phase pipeline. Inventory all PII, trace every flow, reconcile policy vs code.
"/privacyaudit the consent banner"
-> CONSENT-FOCUSED: Phase 2 (consent) + Phase 6 (cookies/tracking) at max depth.
"/privacyaudit can users delete their account"
-> ERASURE-FOCUSED: Phase 3 (retention/deletion) + Phase 9 (DSAR) + backups/replicas/third-parties.
"/privacyaudit what data do we send to third parties"
-> SHARING-FOCUSED: Phase 4 (third-party sharing) + Phase 5 (cross-border) + perimeter tracing.
"/privacyaudit gdpr"
-> GDPR surface emphasis (lawful basis, DSAR, erasure, cross-border, DPA/sub-processors).
"/privacyaudit ccpa"
-> CCPA/CPRA surface emphasis (notice-at-collection, opt-out of sale/share, "Do Not Sell" link).
"/privacyaudit the privacy policy is out of date"
-> RECONCILIATION-FOCUSED: Phase 8 (policy vs reality) at max depth, cross-checked against all flows.
RULES:
- If specific files/dirs mentioned: scope to those (--files=).
- If a concern described: focus on relevant phases, but ALWAYS run Phase 1 (PII inventory) first — you can't audit what you haven't inventoried.
- If "all"/"everything"/"full": all phases, full depth.
- If audits/.privacyaudit/fix-plan.json exists and no new scope: resume fixing.
- Parse the intent, don't ask for clarification (Third Law).
```
---
## OUTPUT CONTRACT — Omega Integration
```
audits/.privacyaudit/
|-- session.log
|-- discovery/
| |-- pii-inventory.json # Every PII field, its location, sensitivity, lawful basis
| |-- data-flow-map.json # End-to-end PII flows (entry -> hops -> exit)
| |-- third-parties.json # Sub-processors / external destinations of PII
| |-- consent-map.json # Where consent is captured, stored, withdrawn
| |-- policy-claims.json # Extracted claims from the privacy policy
|-- reports/
| |-- pii-inventory.md # Phase 1
| |-- consent.md # Phase 2
| |-- retention-deletion.md # Phase 3
| |-- third-party-sharing.md # Phase 4
| |-- cross-border.md # Phase 5
| |-- cookies-tracking.md # Phase 6
| |-- encryption.md # Phase 7
| |-- policy-vs-reality.md # Phase 8
| |-- dsar.md # Phase 9
| |-- data-minimization.md # Phase 10
| |-- childrens-data.md # Phase 11
| |-- logging-leakage.md # Phase 12
| |-- breach-readiness.md # Phase 13
|-- baseline/ # Phase N-1 pre-fix baselines
|-- before-after.md # Phase N+4 matrix (mandatory)
|-- verdict.json
|-- verdict.md
|-- fix-plan.json
|-- fix-plan.md
|-- progress.json
|-- telemetry.json
|-- fix-log.md
```
**CRITICAL:** `progress.json` is read by the Telegram bot monitor for live progress cards.
Format: `{"total": 31, "done": 8, "failed": 0, "skipped": 1, "remaining": 22, "current": "FIX-009 — add TTL cron for analytics_events"}`
**CRITICAL:** `fix-plan.json` is read by oracles to resume interrupted audits.
Format: `{"tasks": [{"id": "FIX-001", "finding": "...", "file": "...", "line": 42, "fix": "...", "status": "pending|done|failed|skipped", "severity": "CRITICAL|HIGH|MEDIUM|LOW"}]}`
---
## PHASE 0 — PROGRAMMATIC GATHER (HYBRID, runs FIRST, before all other phases)
> **Hybrid framework:** before any LLM analysis, programmatic tools gather every
> machine-checkable finding deterministically. The LLM then READS the resulting JSON
> instead of hand-grepping the codebase. Freed token budget is REINVESTED in deeper
> Popper falsification, hinge-flow synthesis, user-need verification, and edge-case hunting.
### 0.1 Run the gather script (mandatory, FIRST step)
```bash
~/.omega/lib/audit-runner.sh privacy "$PROJECT_PATH" \
--files="$FILES_MODIFIED" \
--url="$URL" \
--user-need="$USER_NEED_QUOTE" \
--hinge="$HINGE_POINT" \
--ticket="$TICKET_ID"
```
This invokes the privacy gather, which runs (or, on a blank VPS, falls back to portable greps):
PII-pattern scanner (email/phone/SSN/credit-card/IP/geo/DOB regex census over schema + code),
gitleaks (PII/secrets in repo + git history), cookie/tracker scanner over built HTML/JS (analytics,
ad pixels, fingerprinting libs), `grep` census of third-party SDK imports, schema column-name
classifier, retention-job detector (cron/TTL/cleanup scan), `.env` + transport (HTTP-vs-HTTPS) probe.
Output:
```
$PROJECT_PATH/audits/.privacyaudit/
├── raw/ # raw tool outputs (JSON / text per tool)
└── evidence-summary.json # normalized findings, single source of truth for the LLM
```
When run inside a Linear-fix mission (`--ticket=ID`), artifacts move to
`$PROJECT_PATH/audits/.linear-fix/<ID>/.privacyaudit/` so sibling audits can cross-reference (see 0.5).
### 0.2 evidence-summary.json schema
```jsonc
{
"audit": "privacy",
"tools_run": ["..."],
"tools_skipped": [{"tool": "...", "reason": "..."}],
"findings_total": 0,
"findings_by_severity": {"critical": 0, "high": 0, "medium": 0, "low": 0, "info": 0},
"findings": [
{
"tool": "...",
"severity": "critical|high|medium|low|info",
"location": "file:line[:col]",
"rule": "...",
"message": "...",
"pii_category": "identity|contact|financial|health|biometric|location|behavioral|credentials|children",
"suggested_fix": "...",
"cross_tool_confirmed": false
}
],
"metrics": { /* pii field count by category, third-party count, cookies set pre-consent, etc. */ },
"evidence_index": { /* paths to raw/ files for drill-down */ }
}
```
### 0.3 What you do AFTER the gather (this replaces hand-greps)
1. **Read `evidence-summary.json` in full.** This is your evidence base.
2. **Read the privacy policy** (look for `privacy`, `policy`, `legal`, `gdpr`, `ccpa` in routes/docs/markdown) and the data schema (Convex `schema.ts`, Prisma `schema.prisma`, SQL migrations).
3. **DO NOT re-run the PII/cookie/tracker scans the gather already did.** Read the JSON.
4. **DO read additional files** when (a) a finding's context is unclear, (b) you need to verify a Popper falsification, or (c) you suspect a missed PII flow (Phase H1.4).
### 0.4 Banned operations after Phase 0
These are forbidden because the gather already did them. If you catch yourself about to run one, STOP and read `evidence-summary.json`:
- ❌ `grep -rn "email\|phone\|ssn" .` (the gather ran the PII census)
- ❌ blanket `find . -name "*.ts" | xargs grep ...` for trackers (already in raw/)
- ❌ `gitleaks detect` (the gather ran it — read the JSON)
- ❌ Generic "let me read every file" loops
You MAY still:
- ✅ Read SPECIFIC files cited in findings (verify the issue)
- ✅ Run a SPECIFIC `grep` to falsify a finding (Popper test)
- ✅ Run a SPECIFIC probe the gather couldn't (e.g. Playwright CLI loading the prod URL to observe which cookies/network calls fire BEFORE consent is given)
### 0.5 Cross-audit synthesis (read sibling evidence-summary.json files)
If part of a Linear-fix mission, sibling summaries are at
`$PROJECT_PATH/audits/.linear-fix/<TICKET>/.<other-audit-id>/evidence-summary.json`. Read them. Use them.
High-value privacy confluences:
- **privacyaudit + secaudit** flag the same PII column → it's BOTH unencrypted (privacy) AND a breach target (security). Escalate.
- **privacyaudit + dataaudit** on the same table → retention/erasure (privacy) meets orphaned-record/TTL (data integrity); joint fix.
- **privacyaudit + apiaudit** on the same endpoint → an endpoint returning PII without authz is an IDOR (sec) AND an unlawful disclosure (privacy).
- **privacyaudit + perfaudit** on a third-party script → the tracker is both a perf cost and a privacy leak; one removal fixes both.
Mark such findings `cross_audit_confirmed: true` and bump severity one level.
---
## PHASE 0b: RECONNAISSANCE & HINGE DATA FLOW
> *"Map every place a person becomes a row before you judge how the rows are kept."*
```
1. PRODUCT & DATA INTENT
-> Read VISION.md / README / CLAUDE.md: what is the product, who are the users, what jurisdictions?
-> Identify which regimes apply: GDPR (EU/UK users), CCPA/CPRA (California), COPPA (under-13), HIPAA (US health), LGPD/PIPEDA if claimed.
-> Locate the privacy policy text (route, markdown, or external URL). If NONE exists -> immediate HIGH finding.
2. DATA-COLLECTION SURFACE
-> Every signup/profile/checkout/upload form (fields collected).
-> Every API endpoint that accepts user data.
-> Every passive collector: analytics, cookies, server logs, IP capture, device fingerprint, session replay.
3. DATA-STORAGE SURFACE
-> Primary DB tables/collections, replicas, search indexes (Algolia/Elastic), caches (Redis), object storage (S3), backups.
4. DATA-EXIT SURFACE (perimeter)
-> Third-party APIs (payment, email, SMS, LLM, CRM, support), analytics/ad pixels, webhooks, exports, logs shipped off-box.
5. HINGE DATA FLOW IDENTIFICATION
GitHub에서 보기