AliceSaikawa/cache-sentinel ↗★ 1

cache-sentinel

防止未缓存提示词消耗,超时则锁定或归档会话 适合需要通过控制会话闲置时间来节省Token成本的用户

套件
cache-sentinel
相容性
待驗證
版本
0.5.0
授權
MIT
最近更新
2026年10月18日

安裝

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:AliceSaikawa/cache-sentinel

Usage

Modes

ModeBehavior
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
archiveAutomatically archives the session once idleMinutes (default: 60 minutes) have passed since the last update (hidden from the sidebar and cannot be opened)
bothBlocks input idleMinutes (default: 60 minutes) after the last response, and automatically archives archiveAfterMinutes (default: 1440 minutes = 24 hours) after the last update
offNeither 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, and dryRun status.
  • /sentinel block | archive | both | off: Switches the effective mode. It is saved to $DSH_HOME/cache-sentinel/state.json and preserved across DSH restarts (takes precedence over mode in YAML).
  • /sentinel default: Clears the mode saved via /sentinel and reverts to the mode setting in YAML.

/unlock Command

  • Running /unlock in an expired session under input blocking (block / both mode) allows just the next send once. The permission expires after unlockTtlMinutes (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.yml take effect without restarting DSH (the plugin is re-applied with the new settings, and in-memory /unlock permissions are cleared).
  • Specifying unknown keys or values with invalid types or ranges results in an error.