Introduction¶
In most companion-type agents, conversation is a passive “one in, one out” mode: the persona stays silent if the user doesn’t speak. If you want the persona to miss the user and occasionally initiate a conversation, without using a fixed cron schedule, you need a lightweight decision layer that works with the chat buffer and delegates the conclusion to the host. dsh-companion-heartbeat, maintained by Joe-Miller-1314, is packaged as a DeepSeek Harness (DSH) plugin and plays the role of this “small pulse engine”: it asks every few seconds “Does the persona want to speak now, and how long until it can speak again?”, and writes the answer to a location readable by JSON or the host adapter, without binding to a specific chat product.
What is it¶
The plugin’s full name is dsh-companion-heartbeat, categorized as a workflow. The repository address is Joe-Miller-1314/dsh-companion-heartbeat, license is MIT, and the runtime environment requires Node.js 20+. The state falls into several JSON files under a single data directory; no API key, account, or database is required.
The data flow can be summarized as:
needs ──► impulse ──► (suppression) ──► decision ──► adapter ──► your app
▲
activity from the chat buffer (who spoke last, and when)
Core Capabilities¶
Below are the behaviors already explained in the README, without expanding on adapter details not mentioned in the documentation.
When to speak. Each tracked chat makes a decision once per tick (default 10 seconds), expressed as “Allowed to speak in N minutes”.
Time sense. Three internal needs — missing the user, wanting companionship, curiosity — slowly rise when no one speaks; partially satisfied when the other side sends a new message; decay after the persona finishes speaking. There are also deliberately designed bursts, follow-ups, quiet periods, and daily caps to avoid looking like a scheduled task.
Optional Memory. By default, the last day’s chat is consolidated into speaking habits, small memories, and short first-person narratives (consolidate) via a DSH session weekly.
Optional “Watch Video”. You can select materials from a public video API and record them in the persona file (watch, disabled by default).
Local Panel. You can check “Which sessions should the persona keep in mind” on a local page and select sessions to write to config.json under dataDir.
What the Decision Calculates¶
Rough steps for each tick and each chat (consistent with README):
- Growth —
miss,social, andcuriousgrow by minute and rate and are capped at 0..1, potentially being suddenly raised byburstChance. - Satisfaction — Incoming messages from the buffer lower needs; new outgoing messages count towards the daily cap and may open a “talkative window”.
- Impulse —
0.5 × miss + 0.3 × social + 0.2 × curious. - Suppression — Just spoke, user still “within input distance”, quiet hours, etc., will raise suppression.
- Decision — Under constraints like intervals and daily caps, decide whether to speak based on thresholds and noise; if speaking, write
speakIntervalMinutes(default 2), if silent, writeholdIntervalMinutes(default 1440); both can be configured as[min, max]jitter.
Installation and Enablement¶
The installation method in the documentation is based on a DSH bundle, not concatenating the repository name with dsh plugin add.
- Execute packaging in the plugin source code directory:
npm pack
Will generate e.g., dsh-companion-heartbeat-1.2.0.tgz (version depends on package.json, current documentation is 1.2.0).
- Install that tarball in DSH as a bundle (Plugin Manager or equivalent
install_bundleoperation), then enable the plugin.
package.json declares dsh.bundle.patch pointing to cordis.patch.yml for inserting the plugin line. The plugin can also be used as a regular ES module: import apply and pass a context with on / effect (smoke test does this).
You should read the repository source code and MIT license yourself before installation; the plugin runs with the current DSH process permissions, and paths and buffer files are specified in the configuration, so you need to confirm they match the data access scope of your host application.
Configuration Essentials¶
Paths, names, and host details are completed in the configuration, supporting ~ and ${ENV_VAR}. The example snippet in cordis.patch.yml is as follows (only for field explanation, paths need to be modified according to your local machine):
- insert:
- id: heartbeat
name: dsh-companion-heartbeat
config:
persona: 'companion'
dataDir: '~/.dsh/heartbeat'
chats: ['demo']
rolePath: '~/my-app/roles/companion.md'
bufferPath: '~/my-app/state/messages.json'
tickSeconds: 10
adapter:
type: json
path: '~/my-app/state/proactive.json'
quietStart: 0
Summary of common keys:
| Key | Default | Meaning |
|---|---|---|
persona |
companion |
Display name, used for memory consolidation hints |
dataDir |
~/.dsh/heartbeat |
Status, logs, tuning parameters, memory directory |
chats |
[] |
Tracked session keys; empty means asking the adapter |
bufferPath |
— | Message buffer JSON; if missing, the persona is always considered idle |
tickSeconds |
10 |
Decision interval, minimum 1 |
adapter |
{ type: 'json' } |
Decision output location |
panel.port |
43110 |
Local “who to keep in mind” page port |
The first run will write tuning parameters to <dataDir>/config.json, re-read every tick, and changing this file allows you to tune “clingy / cold” without restarting DSH, for example:
{ "missRate": 0.026, "threshold": 0.16, "dailyCap": 20, "quietStart": 1, "quietEnd": 7 }
The local panel URL looks like http://127.0.0.1:43110/?token=<dataDir>/panel-token.txt>, and checking sessions and saving writes back to chats. Manual trigger: create consolidate-now or watch-now under dataDir, and they will be executed and deleted after the next tick.
The default adapter json writes a structure containing allowed, intervalMinutes, decision, etc., to adapter.path, facilitating polling by any host.
Scenarios and Notes¶
Suitable for developers who have already built a companion/workflow on DSH, have their own message buffer or WeChat-like adapters, and want active speech driven by “internal state + suppression” rather than hardcoded scheduling. Not suitable for those expecting “out-of-the-box” chatting and not planning to maintain bufferPath / adapter.path — without a buffer, the persona will remain idle.
The community directory page dsh-companion-heartbeat on SkillHub and the GitHub repository are independent of each other; SkillHub is not an official DeepSeek/Huansuan app store; the DSH ecosystem philosophy is “everything is a plugin,” so the choice of plugin is still based on the repository README and source code.
Conclusion¶
dsh-companion-heartbeat pushes the companion from a purely reactive state to a pulse decision with a slow clock: needs fluctuate over time, fall into JSON or the adapter after suppression and caps, and your application decides whether to actually send a message. To check the version, adapter table, and complete default tuning values, please directly view the GitHub README; the directory entry can be found at the SkillHub plugin page.