cd /news/ai-tools/forma-ai-generated-terminal-prompt-a… · home › topics › ai-tools › article
[ARTICLE · art-181498] src=dev.to ↗ pub= topic=ai-tools verified=true sentiment=↑ positive

forma: AI‑Generated Terminal Prompt Animations on GitHub

An open-source project called forma, from the wrong-nebula GitHub repository, generates terminal prompt animations by using an LLM to compile a plain-English description into a schema-validated JSON scene once, then rendering it deterministically at frame rate with no network calls in the animation loop. The project's design separates a slow, non-deterministic model compile step (roughly 0.5–3 seconds) from a seeded frame evaluator that must fit a 16.6 ms per-frame budget at 60 FPS, and it probes terminal capabilities to degrade from truecolor to 256, 16, or monochrome output. The writeup argues that calling a model inside the render loop is three orders of magnitude too slow and that seeds stored in sampling temperature make scenes impossible to replay or diff.

recommendation

Keep LLM calls out of real-time loops: compile intent to a cached, schema-validated JSON scene once, then render deterministically from a stored seed and probe terminal capabilities before drawing.

more in playbook: Designing agent systems
by read6 min views1 publishedDec 4, 2026

Terminal eye candy is usually a hardcoded GIF or a 400-line bash script nobody wants to maintain. forma takes a different swing: describe the vibe in plain English, let a model compile it into a scene, and let a deterministic renderer paint it into your terminal at frame rate.

TL;DR: wrong-nebula/forma is a trending open-source project for AI-driven terminal prompt animations. The interesting engineering isn't the prompt — it's the hard boundary between a slow, non-deterministic LLM "compile" step and a fast, seeded render loop that never touches the network. Get that boundary wrong and you get flicker, torn frames, and a $40 API bill from an idle shell.

The failure mode I keep seeing in generative-terminal tools is putting the model inside the animation loop. Someone wires an LLM call to "generate the next frame," and the arithmetic kills it immediately: a 60 FPS loop has a 16.6 ms budget per frame, and even a fast small model streaming 20 tokens is a 200–600 ms round trip. You are three orders of magnitude off.

The second failure mode is subtler: non-reproducibility. Generative art that can't be replayed isn't art tooling, it's a slot machine. If your seed lives in a model's sampling temperature instead of in a file, you can never render the same scene twice, diff two variants, or commit a look to a repo.

The third is terminal reality. A TUI that looks perfect in Kitty on Linux can shred itself in tmux, in a CI log, or on a legacy conhost window — because the author assumed truecolor SGR and cursor addressing that the target emulator doesn't honor.

I haven't audited every line of forma, so treat this as the pipeline shape any tool in this class must converge on — verify against the source before you build on it. The load-bearing idea is compile once, render deterministically.

  ┌──────────────┐   intent (natural language)
  │  user / CLI  │──────────────────────────────┐
  └──────────────┘                              ▼
                                    ┌───────────────────────┐
                                    │  LLM scene compiler   │  ~0.5–3 s, ONCE
                                    │  text → JSON scene    │  schema-validated
                                    └───────────┬───────────┘
                                                │ scene.json (seed, palette, motion)
                                                ▼
   SIGWINCH ──▶ ┌──────────────┐    ┌───────────────────────┐
                │ term caps /  │───▶│  deterministic frame  │  16.6 ms budget
                │ size probe   │    │  evaluator f(t, seed) │  ZERO network
                └──────────────┘    └───────────┬───────────┘
                                                │ cell grid [rows][cols]
                                                ▼
                                    ┌───────────────────────┐
                                    │  diff → ANSI encoder  │  dirty cells only
                                    └───────────┬───────────┘
                                                │ write(2) → PTY
                                                ▼
                                          terminal emulator

1. Scene compiler (LLM, offline path). The model's job is parameter synthesis, not pixels. It emits a constrained JSON document — seed, palette, motion field, glyph set, density — validated against a schema with a retry-on-invalid loop. Constrain the output with a JSON schema or grammar, not a polite request in the system prompt. Cache the result keyed on hash(intent + model + schema_version) so the same phrase never re-bills you.

2. Capability probe. Read TERM, COLORTERM, and isatty(); query size via ioctl(TIOCGWINSZ); install a SIGWINCH handler. Degrade deliberately: truecolor → 256 → 16 → monochrome glyphs. If stdout isn't a TTY, emit nothing or a single static frame. This one check is the difference between a tool people keep and one they uninstall.

3. Frame evaluator. Pure function f(t, seed) → grid. Same seed, same t, same grid — on any machine. This is what makes scenes committable and reviewable.

4. Diff + ANSI encoder. Keep two buffers, compare cells, and emit only what changed: \x1b[<row>;<col>H to position, \x1b[38;2;R;G;Bm for truecolor. Full-screen repaints at 60 FPS on a 200×50 grid is ~600 KB/s of escape codes; dirty-cell diffing typically cuts that by 90%+ and eliminates tearing. Wrap the whole session in the alternate screen (\x1b[?1049h) and hide the cursor (\x1b[?25l), with restore in a finally/ atexit and a signal handler — otherwise a Ctrl-C leaves the user's shell cursorless.

Flag names below are the shape to look for; run --help and trust the source over any snippet, including this one.

git clone https://github.com/wrong-nebula/forma.git
cd forma

ls -1 | grep -Ei 'pyproject|requirements|package.json|Cargo.toml|go.mod'
cat README.md | head -60

Python path:

python3 -m venv .venv && source .venv/bin/activate
pip install -e .            # or: pip install -r requirements.txt
forma --help

Node path:

corepack enable && pnpm install
pnpm run build && pnpm start -- --help

Keep credentials out of your shell history and out of the repo:

export FORMA_API_KEY="$(pass show ai/anthropic)"   # or your secret manager
printf '.venv/\n.env\n*.scene.cache.json\n' >> .gitignore

A scene descriptor worth committing looks roughly like this — the point is that it's small, diffable, and replayable without an API key:

{
  "seed": 20240917,
  "palette": ["#0b0f14", "#3ddc97", "#f5f7fa"],
  "motion": { "kind": "drift", "hz": 0.25 },
  "glyphs": " .:-=+*#%@",
  "fps": 30,
  "color_mode": "auto"
}

Smoke-test the degradation path before you demo it anywhere:

TERM=xterm-256color forma --scene scene.json
forma --scene scene.json | cat        # must not spew raw escapes
tmux new-session 'forma --scene scene.json'

Win 1 — reviewable generative assets. Because the scene is a seeded JSON file, a "look" becomes a PR diff. Designers and CLI authors can iterate on palette and motion in code review instead of trading screen recordings.

Win 2 — zero-cost idle. The LLM runs once at authoring time. An ambient animation on a dashboard box or a kiosk consumes CPU, not tokens. That's the correct cost topology for anything long-running.

Win 3 — a genuinely good ANSI test harness. Tools like this stress cursor addressing, resize handling, and color fallback harder than most unit suites. I've found real emulator bugs by running cell-based renderers across Kitty, Alacritty, WezTerm, and tmux.

Limitation 1 — emulator variance is not solved, only managed. tmux passthrough, SSH latency, Windows legacy consoles, and multiplexer color quantization all produce different output. Budget real time for a compatibility matrix; "works on my Kitty" is not a release criterion.

Limitation 2 — this is not your shell prompt. A PS1/ precmd hook has a ~50 ms tolerance before humans perceive lag. Anything with a network call or a 30 FPS loop belongs in a dedicated pane or a screensaver mode, never in the interactive prompt path. Also: cell-based animation is hostile to screen readers, so ship a --static/--no-motion flag and mean it.

📡 Daily drops: I post one vetted open-source AI repo a day on VibeNode AI on Telegram — plus Claude Code hooks and ready-to-import n8n JSON workflows. Search #Drop09 in the channel for the companion notes and config files for this one. No drip campaigns, just the artifacts.

Your turn: where do you draw the line between the LLM and the render loop in your own tools — do you cache a compiled artifact like a scene file, or keep the model in the loop and eat the latency? And has anyone shipped cell-based animation that behaves correctly under tmux and legacy conhost without a fork in the codepath? I'd genuinely like to see that diff.

── more in #ai-tools 4 stories · sorted by recency
── more on @forma 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/forma-ai-generated-t…] indexed:0 read:6min 2026-12-04 · —