AliceSaikawa/cache-sentinel ↗★ 1
cache-sentinel
防止未缓存提示词消耗,超时则锁定或归档会话 适合需要通过控制会话闲置时间来节省Token成本的用户
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:AliceSaikawa/cache-sentinel说明文档
阅读完整 README ↗Usage
Modes
| Mode | Behavior |
|---|---|
block (default) | Blocks input once idleMinutes (default: 60 minutes) have passed since the last response (viewing is still allowed). /unlock allows the next single send |
archive | Automatically archives the session once idleMinutes (default: 60 minutes) have passed since the last update (hidden from the sidebar and cannot be opened) |
both | Blocks input idleMinutes (default: 60 minutes) after the last response, and automatically archives archiveAfterMinutes (default: 1440 minutes = 24 hours) after the last update |
off | Neither blocks input nor archives sessions (/sentinel and /unlock commands remain available) |
/sentinel Command
You can check the current status and switch modes from the chat input box.
/sentinel: Shows the current effective mode and its source (set via/sentinel/ set in YAML), thresholds, elapsed minutes since the last response in this session, anddryRunstatus./sentinel block|archive|both|off: Switches the effective mode. It is saved to$DSH_HOME/cache-sentinel/state.jsonand preserved across DSH restarts (takes precedence overmodein YAML)./sentinel default: Clears the mode saved via/sentineland reverts to themodesetting in YAML.
/unlock Command
- Running
/unlockin an expired session under input blocking (block/bothmode) allows just the next send once. The permission expires afterunlockTtlMinutes(default: 10 minutes). - Once a model response (
step/end) returns after unlocking, the permission has served its purpose and normal checks resume (since the session is not expired right after a response, you can continue the conversation naturally). - Running it in a session that has not expired yet or has no model response yet does not record a permission and only displays the current elapsed time or status.
Configuration
You can change the settings in your profile's cordis.patch.yml. Omitted keys use their default values.
- id: cache-sentinel
config:
mode: block # block / archive / both / off (can be overridden with /sentinel)
idleMinutes: 60 # threshold for input blocking (min); in archive mode, the archive threshold (min)
archiveAfterMinutes: 1440 # archive threshold in both mode (min)
unlockTtlMinutes: 10 # how long /unlock stays valid (min)
checkIntervalSeconds: 60 # archive check interval (sec, 10 or more)
skipPinned: true # do not archive pinned sessions
archiveExisting: false # also archive sessions that have been idle since before archiving was first enabled
maxPerCycle: 20 # maximum sessions to archive per cycle
dryRun: false # when true, neither block nor archive, only log
# stateFile: /path/to/state.json # path to persistent state file (default: $DSH_HOME/cache-sentinel/state.json)
- Changes to
cordis.patch.ymltake effect without restarting DSH (the plugin is re-applied with the new settings, and in-memory/unlockpermissions are cleared). - Specifying unknown keys or values with invalid types or ranges results in an error.