dsh-time-inject: Inject Chinese Time Context into DSH Agents

Introduction

The DeepSeek Harness (DSH) host plugin dsh-time-inject appends a single-line Chinese time reading to the model context at the first step of every conversation turn. This ensures the agent always knows the current time and the duration elapsed since the last message. This is an unofficial community project (unrelated to DeepSeek) aimed at providing a more compact Chinese time context than the official @deepseek-ai/dsh-time-context.

Core Features

The plugin mainly provides the following capabilities:

  1. Context Injection: Appends a time reading to the message list at the first step (step === 1) of each turn.
  2. Single-line Chinese Output: The output format is [Clock] Time Day of Week · Time since last message.
  3. Time Details: Includes current time, day of the week, timezone (default Asia/Shanghai), and the duration since the last message.
  4. Intelligent Duration Display:
    • Displays “Just now” if the interval is less than 1 second.
    • Displays “X min Y sec” or “X hrs Y min” for intervals exceeding 1 second.
    • Displays “Unknown” if it cannot be retrieved.
  5. Empty Turn Protection: Returns the decision as-is when decision.messages.length === 0 to avoid wasting model requests.

Installation and Activation

It is recommended to use the link: method for import to minimize changes.

  1. Link Dependency
    Copy the source code from this repository into the profile’s vendor/ directory and add the dependency to the profile’s package.json:
    // ~/.dsh/profiles/web/package.json
    "dependencies": { "dsh-time-inject": "link:vendor/dsh-time-inject-src" }
  1. Configuration Patch
    Append the configuration to the profile’s cordis.patch.yml:
    - insert:
        - id: time-inject
          name: 'dsh-time-inject'
  1. Activation
    Run pnpm install once in the profile directory (required for link: dependencies to establish the connection), then restart dsh web.

Working Mechanism & Differences

This plugin hooks into the agent/pre-step hook and operates as a prepend: true waterfall hook.

  • Trigger Condition: Injects only when step === 1, meaning it injects only once per turn.
  • Empty Turn Protection: If decision.messages.length === 0 is detected, the plugin returns the decision as-is. This is because injecting content into an empty message list turns a turn that should have ended into a real step, resulting in a wasted model request.
  • Collapsed State: The plugin maintains sessionProjections('timeInject') to record the timestamp of the last non-plugin message, allowing for the calculation of accurate duration differences.

Compared to the official @deepseek-ai/dsh-time-context, this plugin makes the following adjustments:
* Copy: Changed to a compact Chinese single-line format.
* Trigger: Removed throttling logic, fixed to step === 1.
* Timezone: Fixed to Asia/Shanghai (configurable).
* Identifier: Uses source.kind: 'time-inject' and does not reuse the official identifier.

Typical Usage

The model input actually seen looks like this:

[Clock] 2026-09-25 21:34:07 +08:00 Friday · 8 min 12 sec since last message

If there is no previous message or if the clock rolls back, it may display as:

[Clock] 2026-09-25 21:34:07 +08:00 Friday · Just now
[Clock] 2026-09-25 21:34:07 +08:00 Friday · Unknown

Notes

  • This plugin is a community work and not an official plugin; it is unrelated to DeepSeek.
  • The timezone is fixed to Asia/Shanghai; modifying it requires changing the source code.
  • The plugin clamps clock rollback to ensure the duration is not displayed as a negative number.
  • It is recommended to review the source code and license before installation.

Summary

dsh-time-inject is a lightweight DSH plugin that solves the issue of agents perceiving time latency by injecting a Chinese time context at the first step. Through strict empty turn protection and a single-line format, it ensures functionality while reducing token consumption.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye