Skip to main content

Control Claude Code remotely via Slack — approve permissions, answer questions, and continue sessions while AFK

Project description

claude-afk

You're running Claude Code on your terminal. It's writing code, you're approving. But you have groceries to pick up, a dentist appointment, or a filter coffee waiting at Rameshwaram Cafe. The coding shouldn't stop - Claude writes the code anyway, you just approve. Why sit in front of the computer? Go touch grass.

claude-afk routes Claude's prompts to your Slack DMs so you can keep things moving from your phone. Proceed with Caution.

Install

pip install claude-afk

Slack app setup (One time, for admins)

  1. Go to api.slack.com/appsCreate New AppFrom an app manifest

  2. Paste the manifest:

    Slack app manifest (click to expand)
    {
        "display_information": {
            "name": "Claude AFK",
            "description": "Control Claude Code remotely via Slack",
            "background_color": "#505870"
        },
        "features": {
            "app_home": {
                "messages_tab_enabled": true,
                "messages_tab_read_only_enabled": false
            },
            "bot_user": {
                "display_name": "Claude AFK",
                "always_online": false
            }
        },
        "oauth_config": {
            "scopes": {
                "bot": [
                    "chat:write",
                    "im:history",
                    "im:write",
                    "reactions:read"
                ]
            }
        },
        "settings": {
            "event_subscriptions": {
                "bot_events": [
                    "message.im",
                    "reaction_added"
                ]
            },
            "interactivity": {
                "is_enabled": true
            },
            "org_deploy_enabled": false,
            "socket_mode_enabled": true,
            "token_rotation_enabled": false
        }
    }
    
  3. Install the app to your workspace

  4. Grab the tokens:

    • Bot Token (xoxb-...): OAuth & Permissions → Bot User OAuth Token
    • App-Level Token (xapp-...): Basic Information → App-Level Tokens → Generate (scope: connections:write)
  5. Find your Slack User ID: click your profile → three dots → Copy member ID

Usage

1. Run setup

This prompts for your Slack tokens and user ID, verifies the connection by sending a code to your DMs, and installs hooks into Claude Code's ~/.claude/settings.json.

 claude-afk setup

Slack Bot Token (xoxb-...): <xoxb-your-bot-token>
Slack App-Level Token (xapp-...): <xapp-your-app-level-token>
Your Slack User ID (e.g. U05ABC123): <your-user-id>

Opening DM conversation...
Sent a verification code to your Slack DMs.
Enter the 6-digit code from Slack: <code-you-just-received>
Verified!

Config saved to .../.claude-afk/config.json
Hooks installed in .../.claude/settings.json

Done! Use `claude-afk enable all` to start routing to Slack.

2. Enable and keep coding

claude-afk enable <session-id>   # or `claude-afk enable all`

Then keep using Claude Code like before:

claude --resume <session-id>

When Claude needs a permission, asks a question, or finishes - it gets routed to your Slack DMs. Reply in the thread to respond.

3. When you're back, disable

claude-afk disable <session-id>    # disable one session
claude-afk disable all             # disable all sessions
claude --resume <session-id>       # continue like before

Other commands

claude-afk status                              # show config and enabled sessions
claude-afk add-home ~/.claude-personal         # register another Claude Code config dir
claude-afk uninstall --claude-home ~/.claude   # remove hooks from one home
claude-afk uninstall                           # remove hooks from all registered homes

How it works

claude-afk installs hooks into Claude Code that route interactive prompts to your Slack DMs:

  • Stop - when Claude finishes, posts the last message to Slack. Reply in the thread to continue the session.
  • PreToolUse - tool permission requests and AskUserQuestion prompts are forwarded to Slack. Reply to approve/deny or answer.
  • Notification - one-way DM when Claude needs attention.

Caution

This is new. Please proceed with care.

  • settings.json modification - claude-afk merges hooks into your Claude Code config. It's tested to preserve existing settings, but back up your settings.json to be safe.
  • Security - this effectively gives you remote control of your machine through Slack. Anyone with access to your Slack DM can approve tool executions.
  • Not fully tested - edge cases exist. If something breaks, claude-afk uninstall removes all hooks cleanly.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_afk-0.1.1.tar.gz (66.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_afk-0.1.1-py3-none-any.whl (33.9 kB view details)

Uploaded Python 3

File details

Details for the file claude_afk-0.1.1.tar.gz.

File metadata

  • Download URL: claude_afk-0.1.1.tar.gz
  • Upload date:
  • Size: 66.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for claude_afk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7d3d73cd7afd0f4d3e2db7716421529426ef9816a8c2ff55d7bb8dcfeb9b2071
MD5 21eb704c68628ee2b4a566835b9cfa31
BLAKE2b-256 1949ed012d17a0db5cda9dd337bcd4b93b4193cc071dc85629c7dd21a332e586

See more details on using hashes here.

File details

Details for the file claude_afk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: claude_afk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 33.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for claude_afk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7d8388a7e6850663f04a81aeedfc0236e72458ddc43eb21aa2ffd5dd03ca05b7
MD5 619a4eeda0e563b838122fc7167520fe
BLAKE2b-256 d39868f8a84f835cfaff20f501e7bdc74a5c2d2d9875e5e07112ce305aaafa27

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page