@distracted/server
v1.2.0
Published
Local server + hook installer for distracted's AI Coding Agent integration (Claude Code, OpenCode).
Readme

what is this package?
local server that integrates with AI coding agent hooks (Claude Code + OpenCode) to enable real-time distraction blocking. receives hook events from your agent(s) and forwards them to the extension via websocket.
how to use
setup
install the extension first! then run the server:
bunx @distracted/serverif no agent hooks are configured yet, the CLI will prompt you to set them up.
you can also configure/remove hooks explicitly:
bunx @distracted/server --setup
bunx @distracted/server --setup claude
bunx @distracted/server --setup opencode
bunx @distracted/server --setup all
bunx @distracted/server --remove
bunx @distracted/server --remove claude
bunx @distracted/server --remove opencode
bunx @distracted/server --remove all
bunx @distracted/server --statusby default the server runs on port 8765 (or use --port <port> to specify a different port).
configuration locations:
- Claude Code:
~/.claude/settings.json(hooks thatcurlto the local server) - OpenCode:
~/.config/opencode/plugin/distracted.ts(self-contained plugin file)
in the extension, setup a distraction with Claude Blocker as the unlock method.
how it works
- Claude Code hooks and/or OpenCode plugin send hook events (UserPromptSubmit, PreToolUse, SessionStart/End, etc.) to the local server via HTTP POST
- the server processes these events and maintains state about agent activity across multiple sessions
- the extension connects via websocket and receives real-time updates
- if either agent is active/working, the user is unblocked
credits
- @t3dotgg/@theo for the original claude-blocker
- opencode for some small bits of CLI code (
lib/ui.ts,lib/error.ts)
