discrete-text-sequence — Claude Code rule: stepped terminal typing
discrete-text-sequence — a rule for GSAP scenes where the terminal line swaps whole states instead of typing evenly: typos, backspaces, pasted chunks and holds.
AGPL-3.0 ★ 78,316 updated 2026-10-24
.claude/rules/discrete-text-sequence.mdWhat discrete-text-sequence does
Instead of revealing characters one at a time, this scene swaps whole strings. States sit in a SEQUENCE array of { text, t } entries measured in seconds; each update walks the array backwards and paints the newest entry whose time has elapsed. Typos, deletions, pasted chunks and holds all fall out of that. Nothing tweens between states — the line jumps.
The file carries terminal markup with a $ prompt, a .text node and a cursor, plus CSS and a GSAP timeline built with paused: true. A tween running from 0 to TOTAL_DURATION with ease: "none" advances a counter, and its onUpdate writes textContent. Cursor blinking is computed with Math.sin, so it stays tied to the timeline. Variants at the bottom: plain per-character typing, a hold that reads as thinking, a scale pulse, and colour shifts per phase.
Timestamps must rise, and TOTAL_DURATION has to cover T_DONE with roughly a second to spare, or the final check mark never registers. Give .text-wrap a width at least as wide as the longest state at your TERMINAL_FONT_SIZE; a smaller TEXT_WRAP_MIN_WIDTH makes the right edge shudder on every swap. Monospace only. GSAP loads from a CDN script.
What it helps with
- build a terminal scene where a typo gets corrected on screen
- paste a chunk of text in one jump
- insert a thinking pause mid-sentence
- blink the cursor in sync with the render timeline
- highlight the finished line with a colour change and pulse
Example prompts for the agent
- Make a terminal scene that types in jumps from a
SEQUENCEarray and ends with a check mark. - Add a hold at
THINK_HOLD_DURbefore the phrase continues. - Set a monospace font and size
TEXT_WRAP_MIN_WIDTHto the longest state so the right edge stops moving.
How to install discrete-text-sequence
Manually: put the files in place
.claude/rules/discrete-text-sequence.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/discrete-text-sequence.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/discrete-text-sequence.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/discrete-text-sequence.mdManually: put the files in place
.clinerules/discrete-text-sequence.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about discrete-text-sequence
How do I install discrete-text-sequence in Claude Code?
Create the file .claude/rules/discrete-text-sequence.md in your project and put the rule text inside it.
What does discrete-text-sequence do?
It describes a scene where the terminal line is replaced state by state on timestamps: typos, backspacing, pasted chunks, holds. Even per-character typing ships as a separate variant.
What do I need for the scene to work?
GSAP from a CDN, a monospace font, and a container at least as wide as the longest state. Timestamps in SEQUENCE go in ascending order.