npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

afk-snake

v0.7.0

Published

A terminal game to play while AI agents finish jobs. npx afk-snake

Downloads

1,075

Readme

afk-snake 🐍

A game you play in your terminal while you wait for your AI agents to finish a job. No install, one command:

npx afk-snake

Step 1: Snake

  • Steer: Arrow keys or WASD
  • Pause: P — freezes the game so you can jump back to your Claude terminal (Enter returns to Claude; an arrow key resumes)
  • Restart: R · Quit: Q / Ctrl-C
  • Walls and your own tail are deadly. The snake speeds up as you eat.
  • Levels: every 10 points is a level (┌─ LV 2 ─ in the border). Each run starts with a random wall layout, and every level-up sweeps a ▸ LEVEL ▸ marquee under the board while new walls blink in — they can't hurt you until they turn solid, and the game never stops moving.
  • Power-ups: now and then a pickup appears — grab it before it blinks away. ✦ ghost slips you through walls and your own tail for a few seconds, ● slow-mo winds the speed back down, ▼ shrink trims your tail, and ★ ×2 doubles the score of every food while it lasts (tokens still count real food eaten).
  • AI boss: from level 3 on, a rival crimson snake enters and hunts the same food you do, growing longer every time it feeds. Touching any part of it ends your run — even ✦ ghost won't carry you through it.
  • Your best score is saved to ~/.term-game.json.

Beat your high score, screenshot the game-over card, and share it — the install command is right there on the card.

Daily streaks

Log in and play on consecutive days to build a streak. Every day you show up pays +5 tokens, with milestone jackpots at days 3 (+20), 7 (+50), 14 (+100), and 30 (+250) on top. Miss a day and the streak resets — your card nudges you to keep it alive.

Leaderboards

Press L on the game-over or ready card to open the leaderboard. Toggle between the Daily board (your best score on the current UTC day) and the All-time board (your career best) with / , and B to go back. Each board shows the top players and your own standing — even when you're outside the top ten. Only logged-in players appear; names are GitHub logins.

Shop

Press S on the game-over or ready card to open the Shop and spend your tokens. Switch between the two tabs with / :

  • Cosmetics — snake skins. The Glowing Trail (30 tokens) gives your snake a glowing comet tail, and five more color trails are buyable: Emerald Viper and Ocean Tide (500 each), Wraith (750), Neon Pulse (1000), and Prism (1500). Press E in the shop to equip any skin you own.
  • Rewards — lottery raffles. Spend tokens to buy entries into a draw; enter as many times as you like for better odds. Launch rewards: Claude Max (1 month) at 200 tokens/entry and a $25 Visa gift card at 100 tokens/entry.

The shop shows a live preview of what you're browsing: on Cosmetics the comet trail of the selected skin slithers above the list, and on Rewards you see one ◇ ticket per entry you already hold. Move the cursor with / , press Enter to buy or enter (the bottom line always shows what Enter will do), and B to go back. You need to be logged in (afk-snake login) to make purchases.

Snake Farm

Press F on the game-over or ready card to open your Snake Farm — a passive earner that works while you're away (waiting on your agents). You own one snake that accrues tokens over real time, up to a storage cap.

  • C collect — bank the tokens your snake earned since you last collected.
  • Enter upgrade — raise your snake's level: it earns faster and stores more hours' worth (starts at 5 tokens/hr with an 8-hour cap). Each upgrade costs a little more than the last, and upgrading auto-collects first so you never lose progress.
  • Your snake evolves in name as it levels — Garden Snake → Corn Snake → Python.
  • The farm card is alive: your snake slithers front and center (each evolution has its own look, and it grows with each stage), a wide gold meter fills as tokens store up, collects pop a gold flourish, and a full belly pulses FULL until you collect. Colors turn off automatically when NO_COLOR is set or output isn't a TTY.

Storage caps out (8h at level 1), so check back between agent runs. B goes back; you need to be logged in (afk-snake login) to play the farm.

afk-arcade

afk-snake now has neighbors. npx afk-arcade opens a terminal game arcade — browse games published by other devs, save favorites to a local library, and launch them without leaving your terminal. Devs publish their own npm-packaged games from the TUI (P), listings go live after review, and players rate games right from the arcade (R). See arcade/README.md.

The arcade also lives on the web: afk-arcade.pages.dev · browse the catalog, read ratings and reviews, and check live leaderboards.

Develop

npm start     # play from source
npm test      # run the unit tests (node:test, zero deps)

Phase 2: Auto-launch while you wait

Run your AI agent (Claude Code) in a terminal, then once:

afk-snake install      # adds wait-game hooks + a resume hotkey (Ctrl-S)

Every prompt you send opens the game in a pane beside your agent's terminal — you play on the right while you watch the agent work on the left. Your game is one continuous session: it freezes when the pane closes and resumes right where you left off (same score and snake) on the next prompt — press any key to un-pause. Dying, quitting (Q), or restarting (R) starts a fresh game next time.

You don't need tmux for this — the hook tries a chain of terminal surfaces and takes the first one that works:

  1. tmux — if the agent's shell is inside a tmux session (or a tmux client is attached anywhere), a real split opens beside it. This wins even when you're also inside Cursor/VS Code/Windsurf's integrated terminal.
  2. Cursor, VS Code, Windsurf — a terminal split beside Claude via the companion extension, provided it's installed (auto-installed by afk-snake install when it detects the editor). To install manually, use <cli> --install-extension or the Extensions view, then reload the window.
  3. zellij — a right-hand pane via zellij action new-pane.
  4. WezTerm — a right-hand pane via wezterm cli split-pane.
  5. kitty — a vertical split via kitten's remote control.
  6. iTerm2 — a split pane via AppleScript, if iTerm2 is running.
  7. A new Terminal.app window (macOS only) — the last resort, since it's the most intrusive option.

A few warts worth knowing about:

  • kitty needs allow_remote_control yes in your kitty.conf. Without it the split silently fails to launch and the chain falls through to the next surface (a new window on macOS, or nothing on Linux) — but only if kitty's own listen-on marker isn't present. If it is (kitty is running but remote control is off), the chain has already committed to kitty and that split attempt just does nothing.
  • The first AppleScript-driven launch (iTerm2 or the Terminal.app fallback) may trigger a one-time macOS automation consent dialog asking to control that app. Denying it means that surface is skipped from then on and the chain continues without it.
  • The Terminal.app fallback window closes itself when the game exits only if Terminal's "close the window if the shell exited cleanly" preference is set; otherwise the window sticks around showing [Process completed] and you close it yourself.

Control which surfaces are eligible:

  • afk-snake install --no-window skips the new-window fallback entirely (real splits — tmux/zellij/WezTerm/kitty/iTerm2 — still work; only the last-resort window is disabled).
  • Set "surface": "auto" | "panes-only" | "off" in ~/.term-game.jsonpanes-only is the same as --no-window, off disables the auto pop-up altogether. The tmux resume hotkey (Ctrl-S) still works with off set — it's an explicit ask, so only the automatic per-prompt pop-up is silenced.
  • TERM_GAME_SURFACE (same three values) overrides the file for one shell — handy for scripts or a one-off session without editing your profile.

On Linux, splits work in zellij, WezTerm, and kitty; there's no new-window fallback yet, so outside of those three (and tmux) the hook stays quiet.

Rather browse the whole arcade while you wait? Install with:

afk-snake install --arcade   # the side pane opens afk-arcade instead of Snake

Then any game deployed on the arcade plays in that pane, and the arcade shows the same "your agent is ready" beacon when the agent finishes (while a third-party game has the terminal, the beacon appears as soon as you're back in the store).

Jump back in anytime (resume hotkey)

afk-snake install also binds a tmux hotkey — Ctrl-S by default — that reopens the game pane and resumes your saved game without prompting the agent. Press it from anywhere inside tmux. Pick a different key with:

afk-snake install --key M-g   # e.g. Alt-G instead of Ctrl-S

The binding lives in a managed block in your ~/.tmux.conf (or ~/.config/tmux/tmux.conf if that exists) and is applied live immediately when you run install from inside tmux. afk-snake uninstall removes it.

Auto-return when the agent needs you

The game also flips to the "ready" card automatically whenever the agent pauses to wait on you mid-task — a tool permission prompt, an AskUserQuestion choice, or plan-mode approval — not just when the whole turn ends. Press Enter to close the pane and hop back to Claude to answer.

Remove it any time with:

afk-snake uninstall

Not on a supported surface (no tmux/zellij/WezTerm/kitty/iTerm2, and not macOS)? The hooks stay out of your way (the pane is skipped) — just run afk-snake in a spare terminal instead.

Note: the resume hotkey above is tmux-only — it's bound in your tmux config, so it needs an actual tmux session to press it from. The auto pop-up itself works across every surface in the chain.

Profile knobs (~/.term-game.json)

  • idleExitMinutes (default 90): the wait-game and arcade exit on their own after this many minutes without a keypress, so a forgotten pane or window never blocks the next auto-launch. 0 disables the idle exit.
  • raise (default true): when a prompt fires while the game is already running, bring its pane/window to the front (tmux pane select; tty-matched window raise for Terminal.app and iTerm2). Set to false to restore the old silent behavior. A process whose window has closed is cleaned up and relaunched automatically either way.

MIT © jsiwinski