Is always-on.mjs Compatible with Windows, macOS, and Linux for i-have-adhd?
Yes, always-on.mjs is fully compatible with Windows, macOS, and Linux. The hook runs under Node.js and uses only cross-platform core modules, eliminating dependencies on POSIX shells or PowerShell.
The always-on.mjs script in the ayghri/i-have-adhd repository provides a universal solution for automatically injecting ADHD-focused rulesets into Claude Code sessions. Unlike platform-specific shell scripts, this Node.js module ensures consistent behavior across all major operating systems without requiring environment-specific configurations or interpreter availability.
Cross-Platform Architecture of always-on.mjs
The always-on.mjs file in hooks/always-on.mjs is explicitly designed as an OS-agnostic Node.js hook. According to the comment block at lines 5-8 of the source file, the script "Runs under Node so it works on macOS, Linux, and Windows without depending on a POSIX shell (sh) … Native sh and PowerShell implementations remain available as fallbacks."
Core Node.js Module Dependencies
The script imports only standard Node.js libraries that are available on every platform:
fsfor filesystem operationsosfor operating system utilitiespathfor cross-platform path handlingurlfor URL resolution
These modules provide consistent APIs across Windows, macOS, and Linux, ensuring that file paths, environment variables, and system calls behave identically regardless of the host operating system.
Platform-Agnostic APIs
Instead of shell commands, always-on.mjs relies on Node.js built-ins for system interaction:
process.envto access environment variablesos.homedir()to locate the user's home directorypath.join()to construct file paths using the correct separator for the current OS
This approach eliminates path separator issues (backslashes vs. forward slashes) and avoids shell-specific syntax that would break across platforms.
Exec-Form Hook Configuration
The hook is registered via hooks/hooks.json using exec-form invocation, which passes the script path directly to the Node.js executable. This method bypasses shell parsing entirely, ensuring that Claude Code executes the script consistently on Windows, macOS, and Linux without requiring sh or PowerShell to be present.
Fallback Scripts for Restricted Environments
While always-on.mjs covers all three major platforms, the repository includes fallback implementations for environments where Node.js might be unavailable:
hooks/always-on.sh: POSIX-shell implementation for Linux and macOS systemshooks/always-on.ps1: PowerShell implementation for Windows systems
These alternatives ensure the i-have-adhd skill remains functional even in minimal containerized or restricted environments lacking Node.js.
Enabling Always-On Mode
To activate the cross-platform hook, create the opt-in flag file in your home directory:
mkdir -p ~/.claude && touch ~/.claude/.i-have-adhd-always
When Claude Code starts a session, always-on.mjs automatically detects this file and injects the ADHD ruleset. The script outputs confirmation:
ADHD MODE ACTIVE (always-on). The ruleset below applies to every response. "stop adhd mode" turns it off for this session; delete /home/username/.claude/.i-have-adhd-always to turn always-on off for good.
<contents of SKILL.md>
Disabling Always-On Mode
To temporarily disable for the current session, type:
stop adhd mode
To permanently remove the always-on functionality:
rm ~/.claude/.i-have-adhd-always
Summary
- always-on.mjs is fully compatible with Windows, macOS, and Linux through its Node.js foundation.
- The script uses only cross-platform core modules (
fs,os,path,url) available in every Node.js installation. - Exec-form invocation in
hooks/hooks.jsonensures direct Node.js execution without shell dependencies. - Platform-specific fallbacks (
always-on.shandalways-on.ps1) exist for environments without Node.js. - The hook checks for
~/.claude/.i-have-adhd-alwaysto determine activation state across all operating systems.
Frequently Asked Questions
Does always-on.mjs require bash or PowerShell to run?
No. The script runs directly under Node.js without invoking a shell interpreter. This design choice explicitly removes dependencies on POSIX shells (sh) or PowerShell, making it truly cross-platform according to the source code comments in hooks/always-on.mjs.
What happens if Node.js is not installed?
If Node.js is unavailable, the hook system falls back to platform-specific scripts. On Linux and macOS, Claude Code uses hooks/always-on.sh; on Windows, it uses hooks/always-on.ps1. These ensure the i-have-adhd skill remains functional even without Node.js.
How does always-on.mjs handle file paths on Windows?
The script uses Node.js's path.join() method to construct file paths, which automatically uses the correct directory separator for the current operating system (backslashes on Windows, forward slashes on macOS/Linux). Combined with os.homedir(), it reliably locates ~/.claude/.i-have-adhd-always regardless of platform.
Is there a performance difference between always-on.mjs and the shell alternatives?
No meaningful performance difference exists for this use case. The Node.js script executes in milliseconds during Claude Code's session initialization, and the exec-form invocation ensures minimal overhead compared to shell script execution.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →