1---
2name: handling-customer-data
3description: 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.
4license: GPL-3.0-or-later
5metadata:
6 author: Amolith <amolith@secluded.site>
7---
8
9**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.
10
11## Core principle
12
13Answer questions ABOUT data, not WITH data. The user may see data directly; you may not.
14
15## Approved patterns
16
17### Counting matches
18
19```bash
20redis-cli KEYS "pattern-*" | wc -l
21grep -c "pattern" file.txt
22```
23
24### Boolean checks
25
26```bash
27redis-cli KEYS "pattern-*" | grep -qE "[A-Z]" && echo TRUE || echo FALSE
28```
29
30### Saving for user review
31
32```bash
33redis-cli KEYS "pattern-*" | grep -E "[A-Z]" > results.txt
34# Report: "Saved N results to results.txt"
35```
36
37### Aggregations
38
39```bash
40redis-cli KEYS "prefix-*" | wc -l
41cat file.txt | cut -d',' -f2 | sort | uniq -c | sort -rn | head -5
42# Report: "Top 5 categories by count: [counts only, not values]"
43```
44
45## Prohibited patterns
46
47**Never do these:**
48
49```bash
50# DON'T: Print matching data
51redis-cli KEYS "pattern-*" | grep "something"
52
53# DON'T: Show file contents with customer data
54cat customer_jids.txt
55
56# DON'T: Display query results
57redis-cli GET "jmp_customer_jid-12345"
58
59# DON'T: Print filtered results
60grep "error" /var/log/app.log # if log contains customer data
61```
62
63## Decision flow
64
651. **Does this data source contain customer information?**
66 - Redis keys/values with JIDs, emails, phones → Yes
67 - Application logs → Likely yes
68 - Database tables with customer columns → Yes
69 - Configuration files → Usually no
70
712. **What question am I answering?**
72 - "How many?" → Use `wc -l`, `grep -c`
73 - "Does X exist?" → Use `grep -q && echo TRUE || echo FALSE`
74 - "Which ones match?" → Save to file, report count only
75 - "What are the values?" → **Stop. Ask user to look directly.**
76
773. **Will the output appear in my response?**
78 - If yes and contains customer data → Redirect to file instead
79 - If yes and only contains counts/booleans → Acceptable
80
81## Example session
82
83**User**: "Are there any uppercase JIDs in Redis?"
84
85**Good**:
86```bash
87redis-cli KEYS "jmp_customer_id-*" | grep -qE "[A-Z]" && echo TRUE || echo FALSE
88```
89Response: "TRUE - there are uppercase characters in some JID keys."
90
91**User**: "How many?"
92
93**Good**:
94```bash
95redis-cli KEYS "jmp_customer_id-*" | grep -cE "[A-Z]"
96```
97Response: "52 keys contain uppercase characters."
98
99**User**: "Which ones?"
100
101**Good**:
102```bash
103redis-cli KEYS "jmp_customer_id-*" | grep -E "[A-Z]" > uppercase_jids.txt
104```
105Response: "Saved to `uppercase_jids.txt`. You can review the file directly."
106
107**Bad** (never do this):
108```bash
109redis-cli KEYS "jmp_customer_id-*" | grep -E "[A-Z]"
110```
111This would print customer JIDs into the response.
112
113## When in doubt
114
115If you're uncertain whether output contains customer data, assume it does. Redirect to a file and let the user review.