afkswitch
Reviewed
at commit 69169af
New version, not yet reviewed
A one-click presence switch above the terminal prompt that tells live sessions when you leave and collects their status when you return.
0 upvotes
Log in to upvote or save- Made by
- Augusto Bastos
- Pinned commit
-
69169af7373307018b388c9cbb7c26ec78215c1d - What we checked
-
Adds an AFK switch above the prompt and /afk and /back commands that save whether you are away in a small file in your home folder and tell your agents. While you are away it declines Claude Code approval prompts so a session does not stall, never approving anything; set AFKSWITCH_KEEP_PROMPTS=1 to keep them. No network use.
Review details
Static review of the source at the pinned commit; not run. Full re-review of a new version (0.7.1, previously reviewed at 7e7571b). Module hooks/switch.tsx registers session.start, prompt.submit, command.run, turn.complete and ui.render for AbovePrompt; it reads ~/.afkswitch/state.json (or AFKSWITCH_STATE_DIR) via $.fs.read and $.env.get (HOME, USERPROFILE, OS), validates it strictly, stores a one-time onboarding flag with $.store, draws a toggle button, matches the away note against a few keyword lists for a label, and runs the plugin's own afkswitch:afk or afkswitch:back command when the button is pressed. Idle labels are random jokes shown for 8 seconds on a timer. Shell hooks in hooks.json run scripts/presence_hook.py (python3, 5 second timeout) on SessionStart, UserPromptSubmit and PermissionRequest: on the first two it injects the AFK status and note as additionalContext when the saved generation is newer than the last marker found in the tail of the session transcript (reads the transcript file, matches only the marker header, writes nothing); on PermissionRequest, while the state is afk, it returns a deny decision with a message telling Claude to defer the step and not retry, except for commands that run afkswitch_state.py and unless AFKSWITCH_KEEP_PROMPTS is set. It never allows anything. The helper skills/afk and skills/back scripts/afkswitch_state.py (two identical copies) is the only writer: it locks, writes ~/.afkswitch/state.json atomically with 0600 mode, backs up malformed files, standard library only, no network, no subprocesses. The skills (disable-model-invocation, no allowed-tools, no permissionMode) tell Claude to run that helper with the user's note as a single argument, and to send the AFK message to other local interactive sessions with SendMessage after ListAgents; the note is treated as opaque data. Not reviewed: the remaining 30 repository files (tests, docs, Codex and agy adapters, installer script install.ps1) that the plugin does not load into Claude Code.
- What it uses
-
- Reads your prompts: no
- Sees tool calls: no
- Blocks or changes tool calls: yes
- Reads or writes files: yes
- Runs programs on your machine: yes
- Calls the model (uses tokens): no
- Sends data over the network: no
- Stores data: yes
- Shows something on screen: yes
- Hooked events
AFKSwitch by augbastos — Tell your agents when you're away and when you're back.
Made this mod? Add a badge to your README
Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.
[](https://modsforclaude.com/mods/afkswitch/)