---
title: "night-mode"
url: "https://claudemods.dev/zh-tw/builds/night-mode-b14745"
source: "https://github.com/ShriD5/claude-mods/tree/main/night-mode"
source_type: "github"
repo: "https://github.com/ShriD5/claude-mods/tree/main/night-mode"
author: "ShriD5"
author_handle: "ShriD5"
stars: 2
category: "安全與隱私"
categories: ["security"]
tags: ["bash-guard", "claude-code", "hooks", "night-mode", "plugin", "safety"]
permission_level: 2
scan_complete: true
install: "claude plugin marketplace add ShriD5/claude-mods\nclaude plugin install night-mode"
added: "2026-10-05T01:59:16.341Z"
updated: "2026-10-04T18:19:52Z"
locale: "zh-tw"
content_locale: "zh-tw"
---

# night-mode

一個 Claude Code 外掛，在可設定的深夜時間內，讓 Claude 格外謹慎：危險的 Bash 指令（部署、強制推送、rm -rf、DROP/TRUNCATE）被保留以待確認，系統提示取得謹慎部分，狀態列顯示活躍視窗。

## Description

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。

## Install

```
claude plugin marketplace add ShriD5/claude-mods
claude plugin install night-mode
```

## Original 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 publish` and `DROP`/`TRUNCATE` in 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 it` and risky commands run without asking for 10 minutes.
- The status line shows `🌙 night mode until 05:00` while it's on.
- `/night off` turns it off for the rest of the session. `/night on` brings it back, and `/night` says where things stand.

## Install

```sh
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.
