Repository navigation
Tool bin keepawake
Installed with ./install.sh --extras.
Keeps the machine awake while there is work going on, so it can continue from a phone while the laptop stands closed. Under WSL it holds Windows awake; on plain Linux it holds the machine itself (see below), and on a Mac too (below), the Telegram bot and code-server with it.
What holds it. A person at the machine — an SSH session, an open
code-server tab, traffic over Tailscale — holds it for as long as they are
there. Work that may be going on with nobody around — a busy claude, a dev
server — holds it for an hour at a time, and half an hour before the end the bot
asks whether to extend. With nothing holding it, the machine sleeps by its own
settings. If something holds it for an hour with no sign of anybody, the bot
asks whether a session was forgotten.
When in doubt it lets go: a laptop that sleeps too early costs a button press, one that never sleeps costs a flat battery.
keepawake status # why the laptop is (or is not) sleeping
keepawake extend 3600 # hold for another hour
keepawake release # let go nowkeepawake status prints two sections, HOLD and HEALTH.
The Telegram bot. With phone access on, the menu is an app inside Telegram
("☰ Menu" by the input box): 💤 Keepawake — extend, until a time, release, and
why the machine is or is not sleeping; 📋 Sclaude — the repositories, their
features with what each step is doing (🟢 running, 🟡 waiting for you, ⚪ idle,
⚫ not started), a new feature — from an open issue, yours first and marked
when something blocks it, with the branch name to correct, or from a name with
a tick for creating its issue, as sclaude new offers at the terminal — and 🧩
the project's config, every section explained, with review, qa, merge,
ship, previewRegression, prodRegression, demo, partAccept and sleep_mode set by a button; 💻 Code-server; 🌐 Chrome and the list of every
feature; 🛠 Workshop — sclaude workshop in a tab on the laptop, a session that
changes sclaude, picked up over Remote Control in the Claude app; ⚙️ Settings — language, docs, restarting the bot (the screen waits
and says when it is back), phone access. Each
screen says under it what it is for. What you start there leaves a 📱 line in
the chat — in the feature's topic when it is about a feature — and what only
shows something leaves nothing. sclaude's questions stay in the chat as buttons,
and an answered one becomes its answer. Without phone access /menu in the chat
keeps what works without it: the hold, and turning access on; the command list
follows. It answers in Russian to a Russian Telegram client and in English to
everyone else.
Answering sclaude from the phone. Every question sclaude asks goes to the terminal and to the bot at once, and whichever you answer first counts. Start a feature at the laptop, walk away, answer from the phone: the terminal carries on by itself. While you are sitting at the terminal the question arrives silently, so the phone does not buzz for something already on your screen. Claude's own conversation in a step continues in the Claude mobile app.
Once a question is answered — by a button, by text or in the terminal — its message becomes the question with the answer; one that closed unanswered is deleted.
A topic per feature. With Threaded Mode on for your bot (the @BotFather mini
app: Bot Settings → Threads Settings; also turn on "Disallow users to create new
threads"), each feature has a topic of its own: pressing a feature in the sclaude
section opens it, and its questions go there, so features running in parallel do
not ask over one another. The topic starts with the feature's card — its step,
issue and pull request, .sclaude/local/feature/telegram-log.jsonl, never in
git and with no token or key in it, for the retrospective to read. And it follows what sclaude is doing there — each session that
starts and ends, and each step once it is done; a review fix session with
what it is handed and what it leaves (findings not fixed yet, new, fixed,
declined, commits), and the review on this machine as it runs — its start
carries the keys its terminal takes, ⏭ the last pass for new findings and ⏹
end the search, and a fix session's start the first of them, so a review can be
ended from the phone; the buttons go once that pass or session ends; regressions
(a red one names the specs that failed, by their titles), deploys and QA's
moves on the board — in short messages, one step's lines apart from the next one's, silent unless something went wrong while you are
away from the laptop. Typing an answer inside a topic answers
that feature; in the main chat, with several questions open there, answer one
with Telegram's Reply on its message. The menu, the sleep warning and questions not about a feature stay
in the main chat. When sclaude done or drop cleans a feature up, it leaves the menus
as soon as its worktree starts going, and its topic is deleted, everything in it
included, so the chat's "All" view is cleared of it too (Telegram lets the bot
delete only messages under 48 hours old); drop therefore asks all its questions before it removes anything. A
question still open about it elsewhere — the action list opened from the phone —
is withdrawn, and its sclaude ends. Without Threaded Mode everything stays in one
chat, as before. If getMe still says has_topics_enabled: false after the
switch, change any classic setting (/setjoingroups) to refresh it.
code-server starts on demand — from a button in the bot, by following its
local link, or with systemctl --user start code-server — and stops itself
after an hour idle.
There is no Windows side, so keepawake-linux.service holds the machine itself
with systemd-inhibit. By default a background service may only stop the
machine sleeping when idle: a closed lid or an explicit suspend still sleeps
it, and the hold log says so once.
install.sh --extras offers to change that on plain Linux, and only there. It explains
when the rule is worth having (a laptop you close while working from a phone),
shows the command that removes it, and asks for a yes or a no.
./install.sh --lid (or --polkit) adds it without asking, --no-lid
(--no-polkit) skips the question. To remove it later:
sudo rm /etc/polkit-1/rules.d/49-keepawake.rules && systemctl --user restart keepawake-linux.serviceBy hand, the polkit rule is this:
sudo tee /etc/polkit-1/rules.d/49-keepawake.rules <<RULE
polkit.addRule(function(action, subject) {
if ((action.id == "org.freedesktop.login1.inhibit-block-sleep" ||
action.id == "org.freedesktop.login1.inhibit-handle-lid-switch") &&
subject.user == "$USER") {
return polkit.Result.YES;
}
});
RULE
systemctl --user restart keepawake-linux.serviceTwo launchd agents in your login session, written into ~/Library/LaunchAgents
by ./install.sh --extras: keepawake counts the holders once a minute, and
keepawake.hold runs keepawake-macos, which holds the Mac with a power
assertion while there is work. pmset -g assertions names it — "keepawake:
work in progress" — and macOS drops it by itself if the holder dies. It stops
idle sleep; the display still sleeps as usual. Their logs are in
~/Library/Logs/sclaude/, the hold's own log in
~/.local/state/keepawake/hold.log.
A person at the Mac itself counts as presence too: keepawake reads how long
its keyboard and mouse have been idle, which is what lets a dev server hold the
Mac while you work in a browser. An SSH session needs Remote Login, in System
Settings → General → Sharing; keepawake status says when it is off.
No power assertion holds a closed lid: only root can, with
pmset -a disablesleep 1. install.sh --extras offers a sudoers rule that lets
your user run exactly that and its 0 without a password, and nothing else;
keepawake-macos then turns it on while it holds and off when it lets go, so
the Mac stays up with its lid shut until the work ends — in a bag too.
./install.sh --lid adds it without asking, --no-lid skips the question. To
remove it later:
sudo rm /etc/sudoers.d/keepawake && sudo pmset -a disablesleep 0The bot is the agent keepawake.telegram, which install.sh writes and loads
only once ~/.config/keepawake/env has its token and your chat id (see
Configuration), and which launchd keeps running. The token
stays in that file: the bot reads it itself, so it never goes into a plist.
Its log is ~/Library/Logs/sclaude/telegram.log.
code-server is the agent keepawake.code-server, on the repository chosen in
the bot. Loading it starts nothing: the bot's button starts it, its idle timeout
ends it, and nothing brings it back. Install it with brew install code-server;
the config is ~/.config/code-server/config.yaml, as on Linux. There is no
localhost:8080 forward on a Mac — it is for a Windows browser outside the
tailnet — so the laptop opens code-server at its own address, which is what the
bot's links say.
The phone's gate is the agent sclaude.gate, loaded on every Mac: launchd
listens on 127.0.0.1:3001 and starts the gate on the first connection, and
the gate exits again after half an hour with nobody looking. Phone access needs
the tailscale command on PATH; the Tailscale app installs it from its
settings, or brew install tailscale brings its own.
Telegram. Create a bot with @BotFather, find your chat_id (message the
bot and open https://api.telegram.org/bot<TOKEN>/getUpdates), and fill in
~/.config/keepawake/env from keepawake/env.example. The file must be mode
600, or the bot refuses to start.
cp keepawake/env.example ~/.config/keepawake/env
chmod 600 ~/.config/keepawake/env
$EDITOR ~/.config/keepawake/env
systemctl --user enable --now keepawake-telegram.service # Linux, WSL
./install.sh --extras # macOS: writes and loads keepawake.telegramSSH for Termius is the one part that needs sudo, which is why install.sh
does not do it. On a Mac it is Remote Login, in System Settings → General →
Sharing; on Linux and WSL:
sudo apt-get install -y openssh-server
sudo tee /etc/ssh/sshd_config.d/10-keepawake.conf <<'EOF'
ListenAddress <tailscale-ip>
PasswordAuthentication no
KbdInteractiveAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
EOF
sudo systemctl enable --now ssh
sudo loginctl enable-linger $USERListenAddress is your Tailscale address (tailscale ip -4), so SSH is not
reachable from a café's network. enable-linger is required: without it the bot
stops as soon as you close your last terminal — exactly when you need it.
Generate the key on the phone (Termius → Keychain → Generate) and copy only
the public half into ~/.ssh/authorized_keys. In Termius: host
<node>.<tailnet>.ts.net (the name tailscale status shows), port 22, your
user name. No port forwarding or firewall rule is needed: Tailscale runs inside
WSL, so the phone reaches it directly.
code-server opens in the phone's browser at http://<tailscale-ip>:8080; the
password is in ~/.config/code-server/config.yaml. Put its bind-addr on the
Tailscale address: on Linux and WSL install.sh then also opens
localhost:8080 for the laptop's browser. A code-server left on its default 127.0.0.1:8080 gets no
such forward — it already answers there.
journalctl --user -u keepawake-telegram.service -f # the bot's log on Linux and WSL
tail -f ~/Library/Logs/sclaude/telegram.log # and on a MacGenerated from docs/tools.md; edit it there, then rebuild with wiki/build.py.
SClaude is open source under MIT · Repository · Landing page · Contact
Why
How it works
- The cycle
- Big features in parts
- Limits in code
- Fewer tokens
- Feedback loops
- Metrics and the replay
- For a team
- Working from the phone
- Stack and costs
- Privacy
Guide
- Getting started
- Setting up
- Using sclaude
- The config, key by key
- When something goes wrong
- Glossary
- Gates and rules
- Team setup
- Privacy in full
- The tools
- Decks and the map
- Contributing
Inside
Links