Created
May 14, 2026 16:13
-
-
Save wbern/198ed438cd0f40cd03ffda92bc46e917 to your computer and use it in GitHub Desktop.
Prompt to get word cloud of your prompts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Make a word-cloud of my favorite short Claude Code prompts. | |
| 1. Scan every `.jsonl` under `~/.claude/projects/`. Each line is one transcript event. | |
| 2. Keep only events with `type:"user"` whose `message.content` is a **string** (skip tool results, which are lists). Also skip events with `isCompactSummary:true` or `isVisibleInTranscriptOnly:true`. | |
| 3. Drop content that isn't a user keystroke: | |
| - anything starting with `<` followed by a lowercase tag — e.g. `<bash-input>`, `<command-name>`, `<command-message>`, `<command-args>`, `<command-stdout>`, `<command-stderr>`, `<local-command-stdout>`, `<bash-stdout>`, `<bash-stderr>`, `<system-reminder>`, `<user-memory-input>`, `<ide_*>` | |
| - anything starting with `/` (slash commands like `/clear`) | |
| - system echoes: `[Request interrupted ...]`, `unknown command: ...` | |
| 4. Normalize: lowercase, collapse whitespace, strip trailing `.,;:!?`. Track the `sessionId` for each occurrence. | |
| 5. Within each transcript file, sort events by timestamp and collapse runs of the same normalized phrase to one occurrence — repeated identical prompts in a row are duplicate submits. | |
| 6. Keep prompts that are **≥ 2 characters and ≤ 10 words**. Drop single-character replies (`y`, `1`, `a`). Count exact-phrase occurrences across all transcripts. **Drop singletons (keep count ≥ 2).** | |
| 7. **Cross-session uniformity filter** — humans paraphrase, daemons template: for any phrase with **≥ 3 words**, count the number of distinct `sessionId`s it appears in. If that exceeds **5**, drop it as likely daemon/hook injection. | |
| 8. **Final structural-noise pass** — drop only entries that match a concrete automation shape: | |
| - `ALL_CAPS_TOKEN:` prefix (e.g. `HEALTH_CHECK:`, `URGENT:`) | |
| - `key=value` fragments (e.g. `exit=completed`, `pid=1234`) | |
| - contain explicit status verbs in templated position: `dispatched`, `slung`, `enqueued`, `exit=` | |
| Do **NOT** drop entries just because they are high-frequency, terse, or feel unusual. A human typing `address` 84 times is plausible. When in doubt, keep. | |
| 9. Render an SVG word cloud — each phrase once, font size ∝ frequency, largest centred, non-overlapping spiral placement. Save to `./prompt_cloud.svg` and open it. | |
| 10. Print the top 20 phrases with counts as a markdown table, and briefly list any phrases you dropped in steps 7 and 8 with their counts so I can sanity-check. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment