Skills › Superpowers › diagnosing-superpowers › context-safety.md
context-safety.md
22 lines · skills/diagnosing-superpowers/references/context-safety.md at 2ce8aa1
Most marks come from matching words in the file, so treat them as pointers.
1# Context safety for session transcripts
3One transcript record can exceed a megabyte or embed a whole history. Printing
4one whole record can overflow the context of the session doing the diagnosis.
5Every reader of a session file, controller or subagent, follows these rules for
6every file, every time.
81. **Measure before reading.**
10 ```bash
11 wc -lc "$F"
12 awk '{ if (length($0) > 100000) print NR, length($0) }' "$F" # long lines
13 ```
152. **Never `cat` or `grep` for content.** Get line numbers and counts
16 first (`grep -n … | cut -d: -f1`, `jq -r '.type' | sort | uniq -c`),
17 then small fields from specific lines (`sed -n Np | jq -c '{…}'` or
18 `| cut -c1-500`). Use the field-extraction commands established during
19 discovery for the source in front of you.
203. **Narrow anything over 500 characters.** If a command returns more than
21 500 characters for one record, tighten the field or the slice.
224. **Read-only.** Never modify, move, or delete a session file.
Context safety for session transcripts
One transcript record can exceed a megabyte or embed a whole history. Printing one whole record can overflow the context of the session doing the diagnosis. Every reader of a session file, controller or subagent, follows these rules for every file, every time.
- Measure before reading.
bash wc -lc "$F" awk '{ if (length($0) > 100000) print NR, length($0) }' "$F" # long lines
- **Never
catorgrepfor content.** Get line numbers and counts first (grep -n … | cut -d: -f1,jq -r '.type' | sort | uniq -c), then small fields from specific lines (sed -n Np | jq -c '{…}'or| cut -c1-500). Use the field-extraction commands established during discovery for the source in front of you. - Narrow anything over 500 characters. If a command returns more than 500 characters for one record, tighten the field or the slice.
- Read-only. Never modify, move, or delete a session file.
Starts an agent subagent :5