Skip to content

feat(afk): work to the end, notify only on done or needs-you - #46

Merged
cmj0121 merged 2 commits into
mainfrom
feat/afk-task-mode
Oct 6, 2026
Merged

cmj0121 merged 2 commits into
mainfrom
feat/afk-task-mode

Conversation

@cmj0121

@cmj0121 cmj0121 commented Oct 6, 2026

Copy link
Copy Markdown
Owner

What

A standing afk mode (magic word afk mode, off with afk off) for when you step away from a long task.

  • Skill afk — the agent works to completion, decides ordinary obstacles and reversible choices itself, and stops only when the task is done, for a question only you can answer, or before a hard-to-undo action you did not ask for. Every turn ends in AFK: DONE or AFK: ASK — <question>.
  • Hook afk-notify.py on Stop, Notification and SessionEnd — while the session's marker exists it rings the terminal (bell + OSC 9; under Terminal.app also a Notification Center message) with "done", "needs you: …" or "stopped". Idle reminders are skipped. Sessions that never turned the mode on are untouched.
  • Plugin bumped to 3.2.0; both READMEs list the skill and its caveats.

Verified

  • make test: 4/4 checks, 24 skills.
  • Hook driven with piped payloads, 26 cases: silence without a marker, the three texts, idle and auth notifications silent, unknown notification types ping, transcript fallback, control characters stripped and text passed to osascript as argv only, unreachable tty is a silent no-op, SessionEnd clears the marker.

Not yet verified

  • A run as a real hook in a live session (hooks load at session start): whether the hook process sees CLAUDE_PID / CLAUDE_CODE_SESSION_ID, and the real Notification payload field names. The script falls back to the payload's session_id and the parent pid.

Closes #45

🤖 Generated with Claude Code

cmj0121 and others added 2 commits October 6, 2026 10:34
The hook is the half of afk mode that reaches the user: while a
session's marker exists, Stop and a non-idle Notification ring the
terminal, and the text says whether the work is done or needs them.
It reads that from the last line of the final message, so a missing
line degrades to a neutral ping rather than to silence.

The terminal is found through the TUI's pid because /dev/tty cannot be
opened from a hook's child process. Terminal.app shows no OSC 9, so it
also gets a Notification Center message, with the text passed as argv
and never parsed as AppleScript.

Bump the plugin to 3.2.0: an installed copy is re-fetched only when
the version moves.

Refs: #45

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add the afk skill, a standing mode for when the user steps away: the
agent decides the ordinary itself, stops only when the task is done,
for a question only the user can answer, or before a hard-to-undo
action they did not ask for, and ends every turn with `AFK: DONE` or
`AFK: ASK — <question>` for the hook to turn into the notification.

The mode changes when the agent stops, never what it may do: no
permission is widened, and a permission request is itself the
needs-you ping. The READMEs say so, with the Terminal.app and tmux
caveats.

Closes #45

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cmj0121
cmj0121 merged commit cfa2b57 into main Oct 6, 2026
2 checks passed
@cmj0121
cmj0121 deleted the feat/afk-task-mode branch October 6, 2026 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an afk mode: keep working, notify only on done or needs-you

1 participant