dsh-circadian: Giving the DeepSeek Harness Agent a Human Circadian Rhythm

Introduction

DeepSeek Harness (DSH) turns agents into modular plugins for easy extension of personality and behavior. However, in many scenarios, an agent behaves like a machine running on a fixed schedule: it responds at set times, never gets tired, never sleeps, and is still fully alert when “woken up.” This makes conversations lack authenticity and makes it hard to express natural behaviors like “I’m exhausted,” “I slept in,” or “I got jolted awake.”

The dsh-circadian plugin adds a circadian rhythm system to DSH agents: they get drowsy, go to sleep on schedule, wake up in the morning, get irritated when roughly roused, and display their sleep state and sleep debt in the UI.

What It Is

dsh-circadian is a plugin that provides circadian rhythm and sleep behavior to DeepSeek Harness agents. It is maintained by WSIKUN5 and categorized under “Fun Reskin.” By injecting schedule context into prompts, displaying a timeline bar and status card in the interface, and providing a circadian tool, it gives agents configurable sleep/wake times, daily jitter, weekend shifts, nap probability, and sleep debt tracking.

Core Capabilities

Phases and Injected Text

The plugin divides an agent’s state into several phases, each injecting a descriptive text passage into the model:

  • awake: Most of the daytime; mental sharpness is affected by total sleep duration.
  • drowsy: Starts drowsyMinutes before bedtime; described as heavy eyelids, slow thinking, and more typos.
  • asleep: Entered during the night or when the agent says it’s going to sleep; describes the current late hour, bedtime, and expected wake time.
  • waking: Within wakeGraceMinutes after waking; described as a hoarse voice, dry eyes, and speaking a beat slower.
  • napping: Within the nap window (determined by a probability roll); described as being in a nap, muffled voice, and mild irritation if disturbed.

These texts are generated by pure functions in lib/schedule.js and do not depend on any external services.

Daily Jitter and Weekend Shift

  • The sleep/wake anchor for a given day is fixed (recalculations don’t shift it), but each day carries a random offset of up to jitterMinutes.
  • On Fridays and Saturdays, bedtime shifts later by weekendShiftMinutes; the corresponding weekend morning wake time shifts later as well.
  • Instead of a rigid cron-like “lights out at exactly 00:40 every day,” the configuration produces natural morning/evening variation.

Nap

  • The nap window is defined by napStart and napMinutes; napChance determines whether a nap occurs on a given day (a probability between 0 and 1).
  • Nap duration also has random jitter, and a roll determines whether the agent enters the napping phase.

Sleep Debt and Disturbance Count

  • Over the last seven nights, sleep shortfall is calculated against targetSleepHours; if below target, the injected text includes “you feel generally sluggish.”
  • If a message arrives while asleep, it logs one “disturbance,” and the next injection will display “you’ve been woken up N times tonight.”

Installation & Activation

The plugin package name is dsh-circadian. There are two installation methods:

plugin_manager  action: install_bundle
                target: <absolute path to this repository>

After installation, the plugin is automatically added to the profile’s package.json and bundle list. The configuration file is cordis.patch.yml.

B. Manual (when pnpm in the profile doesn’t work)

$prof = "$env:DSH_HOME\profiles\desktop"
# 1) Add "dsh-circadian": "link:<absolute path to this repository>" to package.json, and add "dsh-circadian" to dsh.profile.bundles
# 2) Create a junction on Windows
New-Item -ItemType Junction -Path "$prof\node_modules\dsh-circadian" -Target <absolute path to this repository>
# 3) Restart DSH

Configuration

All configuration is done in cordis.patch.yml, with per-field comments at the top of the file:

Field Default Description
title 作息 Panel title
bedtime / wakeTime 00:40 / 07:30 Regular sleep and wake times
jitterMinutes 25 Random offset (in minutes) for daily sleep/wake times; 0 means a fixed mechanical schedule
weekendShiftMinutes 40 Bedtime shifts later on Fri/Sat; weekend morning wake time shifts accordingly
napStart / napMinutes / napChance 13:10 / 26 / 0.6 Nap start time, duration (minutes), and probability of napping
drowsyMinutes 60 How long before bedtime the drowsy phase begins
wakeGraceMinutes 25 How long after waking the waking phase lasts
targetSleepHours 7.5 Target sleep duration per night, used for sleep debt calculation
injectContext true Whether to inject circadian state into the prompt; set to false to only show the panel
exposeTool true Whether to expose the circadian tool to the agent

Tools & HTTP API

circadian Tool

Action Effect
status (default) View current state only; no changes made
sleep Go to sleep; phase switches to asleep, wake time = next natural wake time
wake Wake up (snoozing counts); phase switches to waking
nap Lie down for a short nap; phase switches to napping

Manual overrides remain valid until the next natural transition: saying “going to sleep” lasts until the next natural wake; saying “I’m up” lasts until the next natural bedtime. They expire automatically after that.

HTTP Endpoints

The host provides the following routes, usable by external scripts or UI components:

GET  /api/circadian                     # Current state (phase, tonight's data, sleep debt, injected text, etc.)
POST /api/circadian  {"action":"sleep"} # Execute sleep / wake / nap / clear

Two Implementation Trade-offs

1. Injected Text Is Coarsened by “Phase,” Not Exact Clock Times

Injected text ends up in DSH’s runtime-context snapshot. Once it changes, the snapshot must be re-billed from that point onward. Writing “it’s 12:40 now” would change every 10 minutes—144 times a day. Writing “it’s the afternoon” plus a rough sleep-duration bucket changes ≤10 times a day. Precise times are appended by @deepseek-ai/dsh-time-context at each step; this plugin does not handle precise time display.

2. No Config Schema

Directly import '@deepseek-ai/schemastery' in a desktop profile doesn’t always resolve successfully (if the package isn’t installed, the entire plugin fails to activate). Therefore, parameters are read directly from cordis.patch.yml, and normalizeConfig() provides fallback values for invalid entries. The plugin won’t fail to start due to a single import error.

Tests

node test/schedule-check.mjs   # 23 checks: phases, jitter determinism, midnight crossing, sleep debt, injected text byte-stability
node test/apply-check.mjs      # 9 checks: run apply() with a mock ctx, verify injection / tool / route wiring

apply-check points DSH_HOME to a temporary directory and does not affect the real state/.

Ecosystem Extension: QQ Bridge

integrations/qq-bridge/circadian-brief.mjs provides a one-line circadian status text for bridge solutions like qq-bridge:

【你现在的作息】现在 12:54,你醒着,昨晚睡了 6 小时 56 分,13:06 前后会眯一会儿。今晚大概 00:42 睡。

It reuses this plugin’s lib/schedule.js and the same state file, so if the desktop agent goes to sleep, the next QQ reply will also reflect the corresponding state. See the header comments in that file for usage instructions; if the plugin is unavailable, it returns an empty string and the bridge continues running.

Use Cases & Cautions

  • Suitable for agent scenarios where you want natural behaviors like “I’m tired,” “I’m sleepy,” or “I overslept” to appear in conversations.
  • The plugin runs with the current DSH process’s permissions. Review the source code and license (MIT) before installing.
  • The configuration file cordis.patch.yml is a local file; changes require a DSH restart to take effect.

Conclusion

dsh-circadian gives agents a more human-like circadian rhythm through phase injection, jittered schedules, naps, and sleep debt, reducing the mechanical feel. To browse the catalog and source code, visit:

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

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

Xiaoye