{"id":51505795,"url":"https://github.com/maxgfr/claudfeine","last_synced_at":"2026-07-08T00:03:42.946Z","repository":{"id":367251552,"uuid":"1279961174","full_name":"maxgfr/claudfeine","owner":"maxgfr","description":"Run Claude Code (and Codex) caffeinated — keeps your machine awake for exactly the session, then restores normal sleep automatically. Zero-dependency, cross-platform (macOS/Linux/Windows).","archived":false,"fork":false,"pushed_at":"2026-07-04T14:14:52.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-04T16:08:29.979Z","etag":null,"topics":["ai","caffeinate","caffeine","claude","claude-code","cli","codex","homebrew","keep-awake","linux","macos","no-sleep","posix","powershell","prevent-sleep","shell","systemd-inhibit","windows"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxgfr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-25T06:40:32.000Z","updated_at":"2026-07-04T14:14:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/maxgfr/claudfeine","commit_stats":null,"previous_names":["maxgfr/claudfeine"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/maxgfr/claudfeine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxgfr%2Fclaudfeine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxgfr%2Fclaudfeine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxgfr%2Fclaudfeine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxgfr%2Fclaudfeine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxgfr","download_url":"https://codeload.github.com/maxgfr/claudfeine/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxgfr%2Fclaudfeine/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35246577,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-07T02:00:07.222Z","response_time":90,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","caffeinate","caffeine","claude","claude-code","cli","codex","homebrew","keep-awake","linux","macos","no-sleep","posix","powershell","prevent-sleep","shell","systemd-inhibit","windows"],"created_at":"2026-07-08T00:03:39.724Z","updated_at":"2026-07-08T00:03:42.925Z","avatar_url":"https://github.com/maxgfr.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# claudfeine ☕\n\n**Run [Claude Code](https://github.com/anthropics/claude-code) (and [Codex](https://github.com/openai/codex)) caffeinated.**\n\n`claudfeine` is a transparent wrapper around `claude`: it keeps your machine awake for\n**exactly** the duration of the session, then lets normal sleep behaviour return on its\nown — whether the session ends cleanly or crashes. Nothing permanent is ever changed; the\nkeep-awake assertion lives only as long as the wrapped process.\n\nIt is a pure pass-through. Every argument goes straight to `claude`:\n\n```sh\nclaudfeine                       # same as: claude\nclaudfeine --continue            # same as: claude --continue\nclaudfeine -p \"summarise this repo\"\n```\n\nThere is a sibling, **`codexfeine`**, that does the exact same thing for OpenAI Codex.\n\n---\n\n## Features\n\n- **Zero dependencies.** Pure POSIX `sh` on macOS/Linux; a single PowerShell script on\n  Windows. Nothing to install beyond the agent itself.\n- **Transparent.** All arguments are forwarded verbatim; the exit code is preserved.\n- **Self-healing.** The moment the agent exits — normally, on a crash, or on `Ctrl-C` —\n  sleep returns to normal. No leftover state, no permanent setting touched.\n- **Cross-platform**, using each OS's built-in mechanism (no third-party tools).\n- Works for both **Claude Code** (`claudfeine`) and **Codex** (`codexfeine`).\n\n## How it works\n\n| OS | Mechanism | What it blocks |\n| --- | --- | --- |\n| **macOS** | wraps the agent in `caffeinate -dims` | display, idle system, disk, and (on AC) system sleep, for the agent's lifetime |\n| **Linux** | wraps the agent in `systemd-inhibit --what=sleep:idle --mode=block` (falls back to `gnome-session-inhibit`, then to a plain run with a warning) | system sleep + idle |\n| **Windows** | the PowerShell wrapper calls Win32 `SetThreadExecutionState` and releases it in a `finally` block | system + display sleep |\n\nIf the agent isn't installed, `claudfeine` tells you exactly how to install it and stops.\n\n## Install\n\n### macOS / Linux — Homebrew (recommended)\n\n```sh\nbrew install maxgfr/tap/claudfeine\n# and/or, for Codex:\nbrew install maxgfr/tap/codexfeine\n```\n\n### macOS / Linux — manual\n\n```sh\ngit clone https://github.com/maxgfr/claudfeine.git\ncd claudfeine\nchmod +x claudfeine\n# put it on your PATH, e.g.:\nln -s \"$PWD/claudfeine\" /usr/local/bin/claudfeine\nln -s \"$PWD/claudfeine\" /usr/local/bin/codexfeine   # same script, Codex target\n```\n\nThe script decides which agent to wrap from the name it's invoked as\n(`claudfeine` → `claude`, `codexfeine` → `codex`), so a symlink under either name is all\nit takes.\n\n### Windows\n\nDownload the `windows/` folder (`_feine.ps1` + `claudfeine.ps1` + `codexfeine.ps1`, and the\noptional `.cmd` shims) and either:\n\n**A. Add a profile function (cleanest — perfect argument pass-through).** In your\nPowerShell profile (`notepad $PROFILE`):\n\n```powershell\nfunction claudfeine { \u0026 \"C:\\path\\to\\claudfeine\\windows\\claudfeine.ps1\" @args }\nfunction codexfeine { \u0026 \"C:\\path\\to\\claudfeine\\windows\\codexfeine.ps1\" @args }\n```\n\n**B. Or put the folder on your `PATH`** and call `claudfeine.cmd` / `codexfeine.cmd` from\n`cmd.exe` or PowerShell.\n\n\u003e The wrapper forces UTF-8 output so the agent's output renders correctly even on the older\n\u003e Windows PowerShell 5.1.\n\n\u003e `--feine-install-alias` is macOS/Linux only. On Windows, invoke `claudfeine` / `codexfeine`\n\u003e directly — aliasing the agent name to a PowerShell profile function would recurse back into the\n\u003e wrapper.\n\n## Usage\n\n```sh\nclaudfeine [claude arguments...]   # run Claude Code, keeping the machine awake\ncodexfeine [codex arguments...]    # run Codex, keeping the machine awake\n\nclaudfeine --feine-version         # print the wrapper version\nclaudfeine --feine-help            # print wrapper help\nclaudfeine --feine-install-alias   # alias claude→claudfeine (+ codex→codexfeine) in your shell rc\n```\n\n`--feine-version`, `--feine-help`, and `--feine-install-alias` are the **only** flags the wrapper\ninterprets (the `--feine-` namespace can't collide with the agent's flags). Everything else is\npassed through unchanged.\n\n## Make `claude` always caffeinated\n\nPrefer not to type the `claudfeine` prefix? Add a shell alias so `claude` *is* the caffeinated\nwrapper (and `codex` is `codexfeine`):\n\n```sh\nclaudfeine --feine-install-alias\n```\n\nIt appends — idempotently, and without touching any alias you already have —\n\n```sh\nalias claude='claudfeine'\nalias codex='codexfeine'\n```\n\nto your shell's rc file (`~/.zshrc`, `~/.bashrc`, or `~/.config/fish/config.fish`, auto-detected\nfrom `$SHELL`). Restart your shell (or `source` the file) and `claude` keeps the machine awake for\nthe whole session. Only the aliases whose wrapper is actually on your `PATH` are written.\n\n\u003e **Why an alias and not a program named `claude`?** An alias only affects what *you* type at an\n\u003e interactive prompt. When the wrapper then runs `claude` internally, the shell isn't involved, so\n\u003e it resolves the real `claude` binary — no loop. A file literally named `claude` ahead of the real\n\u003e one on your `PATH` would make the wrapper call itself forever.\n\nFor a shell it doesn't recognise, it prints the two `alias` lines so you can paste them into your\nstartup file yourself. On **Windows** the helper isn't available — keep calling `claudfeine` /\n`codexfeine` directly (see the Windows section above).\n\n## Uninstall\n\n```sh\nbrew uninstall claudfeine codexfeine    # if installed via Homebrew\n```\n\nFor a manual install, remove the symlinks you created.\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md). Commits follow\n[Conventional Commits](https://www.conventionalcommits.org/); releases are automated with\n[semantic-release](https://github.com/semantic-release/semantic-release).\n\n## License\n\n[MIT](LICENSE) © Maxime ([maxgfr](https://github.com/maxgfr))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxgfr%2Fclaudfeine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxgfr%2Fclaudfeine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxgfr%2Fclaudfeine/lists"}