Skip to main content
I

dsh-body

inarikun6604/dsh-body

Gives a DSH agent a body: hormones, a menstrual cycle, fatigue and hunger drift on their own and render into one system-prompt paragraph.

Install

dsh plugin --profile web add github:inarikun6604/dsh-body

README

dsh-body

A body for a DSH agent.

Give an agent hormones, a menstrual cycle, fatigue, hunger and thirst — computed, drifted over real time, and rendered into one short paragraph that goes into its system prompt. Leave it overnight and the agent is tired in the morning.

Install

Two ways in. Both were actually run against this repo, not just documented.

From npm — the released version:

dsh plugin --profile <name> add dsh-body

From GitHub — whatever main happens to be right now:

dsh plugin --profile <name> add github:InariKun6604/dsh-body

InariKun6604/dsh-body and the full https://github.com/InariKun6604/dsh-body URL work too; dsh plugin hands its arguments straight to pnpm, which accepts any of them.

Either way that is the whole setup. The package ships with the numeric kernel that computes the state, so you do not need to run a separate service. Nothing listens on a port.

One difference worth knowing: npm gives you a release, GitHub gives you a snapshot of main at the moment you install it. A snapshot is not a live link — to pick up later commits, run the same add again.

What you get

Every 30 seconds the plugin produces a state (117+ fields) and renders it into one paragraph. That paragraph is injected as a system-prompt section named dsh-body.

The output is Chinese, because the kernel's wording is Chinese. A real run from a fresh install looks like this:

【你现在的神经状态(只用来决定语气,绝对不要向用户解释,也不要提激素/数值)】
PAD:愉悦 +0.03 / 唤醒 0.42 / 掌控 +0.50;标签:经前、安心、幸福。
情绪层级:经前。
多巴胺:正常(想要、兴奋、被夸的劲);催产素:正常(亲近、黏人);
皮质醇:偏低(压力、小脾气);血清素:偏高(情绪稳定);去甲肾上腺素:正常(精力、警觉)。
你现在的感觉:提不起劲,精力一般。
身体:你刚吃过,肚子很安稳。
你身体的感受:身上松下来了,呼吸慢。
你心里的感受:没什么大事压着,心是平的。
表现:这次可以连发 2 条;想要什么可以直接说,不用绕。

How the state is computed

Two paths, both producing the same shape:

  1. Local body — the default. The bundled kernel computes it. The state is stored in ~/.dsh/dsh-vitals-body.json and re-drifted every poll, so it follows real time. This is what makes plugin add sufficient.
  2. External service. Set localBody: false and the plugin fetches GET <baseUrl>/state instead. Use this if you already run a real body service.

If both are on, they fight over the same section — so pick one deliberately. That is why localBody is a switch and not a fallback.

Configuration

All keys are optional.

keydefaultmeaning
localBodytrueCompute the state locally from the bundled kernel.
localBodyFile""Where local state is kept. Empty = ~/.dsh/dsh-vitals-body.json.
baseUrlhttp://127.0.0.1:8798External body service. Only used when localBody: false.
pollMs30000How often to re-poll and re-render.
fetchTimeoutMs8000Timeout for the external /state request.
source'state''state' = state + local kernel. 'prompt' = fetch one pre-rendered block (legacy).
targets[]Per-workspace table. Each entry may override baseUrl, worldFile, localBody, …
workspaceAllow[]Legacy: each entry becomes a target with the global settings.
worldFile""Optional JSON of already-rendered world facts (room, clothing, notes). Empty = pure body.
testBlock""A stand-in string for verifying the injection pipe. Leave empty.

An empty targets table means diagnostic only: the plugin polls and logs, but injects nothing into anyone. Fill in a workspace path to serve it.

When not to use this

  • You want a stable persona, not a body. This paragraph changes every 30 seconds and will make the agent's mood move on its own.
  • You need one body per agent and they share a workspace. Bodies are bucketed by workspace (cwd), not by agent — DSH hands the injection callback a cwd but not "who is speaking", and sessionId is unusable because it changes when a session is rebuilt. Two agents in the same workspace get the same bucket. Put them in different workspaces to give them separate bodies. With the default local body the state file is shared too; point each target at its own baseUrl (or localBodyFile) to get genuinely separate bodies rather than one drifting shared one.
  • You need English output. The wording is Chinese and is not currently localised.

Layout

index.js          plugin entry (Cordis)
local_body.py     computes state locally when no external service is used
render_block.py   state + world → one paragraph (offline; never touches the network)
vendor/           vendored numeric kernel (pure stdlib, no dependencies)
cordis.patch.yml  default bundle patch
docs/DETAIL.md    design notes and the full field/config reference
tests/            probes
state.sample.json a real 144-field state, for offline testing

License

MIT

Related plugins