---
name: handling-customer-data
description: Handles customer data responsibly by answering questions ABOUT data without ever seeing the data directly. Use when querying Redis, databases, logs, or any source containing customer information like JIDs, emails, phone numbers, or account details.
license: GPL-3.0-or-later
metadata:
  author: Amolith <amolith@secluded.site>
---

**You must NEVER see customer data directly.** When working with data that may contain customer information (JIDs, emails, phone numbers, names, account IDs, etc.), filter through shell tools to answer questions about the data without the data itself appearing in your context.

## Core principle

Answer questions ABOUT data, not WITH data. The user may see data directly; you may not.

## Approved patterns

### Counting matches

```bash
redis-cli KEYS "pattern-*" | wc -l
grep -c "pattern" file.txt
```

### Boolean checks

```bash
redis-cli KEYS "pattern-*" | grep -qE "[A-Z]" && echo TRUE || echo FALSE
```

### Saving for user review

```bash
redis-cli KEYS "pattern-*" | grep -E "[A-Z]" > results.txt
# Report: "Saved N results to results.txt"
```

### Aggregations

```bash
redis-cli KEYS "prefix-*" | wc -l
cat file.txt | cut -d',' -f2 | sort | uniq -c | sort -rn | head -5
# Report: "Top 5 categories by count: [counts only, not values]"
```

## Prohibited patterns

**Never do these:**

```bash
# DON'T: Print matching data
redis-cli KEYS "pattern-*" | grep "something"

# DON'T: Show file contents with customer data
cat customer_jids.txt

# DON'T: Display query results
redis-cli GET "jmp_customer_jid-12345"

# DON'T: Print filtered results
grep "error" /var/log/app.log  # if log contains customer data
```

## Decision flow

1. **Does this data source contain customer information?**
   - Redis keys/values with JIDs, emails, phones → Yes
   - Application logs → Likely yes
   - Database tables with customer columns → Yes
   - Configuration files → Usually no

2. **What question am I answering?**
   - "How many?" → Use `wc -l`, `grep -c`
   - "Does X exist?" → Use `grep -q && echo TRUE || echo FALSE`
   - "Which ones match?" → Save to file, report count only
   - "What are the values?" → **Stop. Ask user to look directly.**

3. **Will the output appear in my response?**
   - If yes and contains customer data → Redirect to file instead
   - If yes and only contains counts/booleans → Acceptable

## Example session

**User**: "Are there any uppercase JIDs in Redis?"

**Good**:
```bash
redis-cli KEYS "jmp_customer_id-*" | grep -qE "[A-Z]" && echo TRUE || echo FALSE
```
Response: "TRUE - there are uppercase characters in some JID keys."

**User**: "How many?"

**Good**:
```bash
redis-cli KEYS "jmp_customer_id-*" | grep -cE "[A-Z]"
```
Response: "52 keys contain uppercase characters."

**User**: "Which ones?"

**Good**:
```bash
redis-cli KEYS "jmp_customer_id-*" | grep -E "[A-Z]" > uppercase_jids.txt
```
Response: "Saved to `uppercase_jids.txt`. You can review the file directly."

**Bad** (never do this):
```bash
redis-cli KEYS "jmp_customer_id-*" | grep -E "[A-Z]"
```
This would print customer JIDs into the response.

## When in doubt

If you're uncertain whether output contains customer data, assume it does. Redirect to a file and let the user review.
