ShriD5/claude-mods/tree/main/night-mode
night-mode
一個 Claude Code 外掛,在可設定的深夜時間內,讓 Claude 格外謹慎:危險的 Bash 指令(部署、強制推送、rm -rf、DROP/TRUNCATE)被保留以待確認,系統提示取得謹慎部分,狀態列顯示活躍視窗。
關於這個 mod
night-mode 是一個 Claude Code 外掛,在安全視窗激活(預設 01:00–05:00 本機時間)。在該視窗內,它透過 prompt.compose 鉤點附加工作階段範圍內的謹慎部分,透過 tool.call 鉤點截獲 Bash 指令,並分類危險操作如 wrangler/vercel/fly 部署、kubectl apply、terraform apply、git push --force、rm -rf、npm publish 和 SQL DROP/TRUNCATE。危險指令需要透過 $.ui.ask 進行明確認;如果沒有人可以回答(例如 claude -p)或使用者拒絕,指令將被保留,並指示手動執行或回覆「是的,傳送」。回覆「是的,傳送」在 10 分鐘內繞過提示。狀態列顯示「🌙 night mode until 05:00」,/night on|off|(狀態)控制每個工作階段的行為。選項包括 start、end 和 timezone(IANA 區域,回退到 $TZ 然後是機器時鐘)。透過 claude --plugin-dir /path/to/claude-mods/night-mode 安裝或透過新增 repo 作為市場並使用 /plugin。
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add ShriD5/claude-mods claude plugin install night-mode
原文 / README
night-mode
Between 01:00 and 05:00, Claude Code gets more careful.
- Claude's system prompt gets a short section: it's late, double-check anything destructive, prefer reversible steps, summarise the risks before acting.
- Risky Bash commands stop and ask you first:
It's 2:41am. Run this prod deploy (wrangler deploy)?That covers deploys (wrangler deploy,vercel --prod,fly deploy),kubectl apply,terraform apply,git push --force,rm -rf,npm publishandDROP/TRUNCATEin SQL. If nobody can answer (claude -p) or you pick "Not tonight", the command is held with:it's 2:41am. if you're sure, run it yourself or reply 'yes, ship it'. - Reply
yes, ship itand risky commands run without asking for 10 minutes. - The status line shows
🌙 night mode until 05:00while it's on. /night offturns it off for the rest of the session./night onbrings it back, and/nightsays where things stand.
Install
claude --plugin-dir /path/to/claude-mods/night-mode
Or add the repo as a marketplace and install it with /plugin.
Options
| Option | Default | What it does |
| --- | --- | --- |
| start | 01:00 | local time night mode turns on |
| end | 05:00 | local time it turns off (a window can wrap past midnight, e.g. 23:00 to 06:00) |
| timezone | empty | an IANA zone like Asia/Kolkata; empty uses $TZ, then the machine's clock |
How it works
A prompt.compose hook appends a session-scoped section at night, a tool.call hook on Bash classifies the command and confirms it through $.ui.ask, which works in every permission mode, and a $.clock.every timer keeps the status line current.
